@leafer/worker 1.9.4 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- const t={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(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const n={};function o(t){return void 0===t}function r(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(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 y(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&y(t[n]={},e[n],i[n]):t[n]=e[n]})},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:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!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 n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(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}}const{round:v,pow:w,PI:x}=Math,b={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(t,e){let i;if(u(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]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),b.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:w(10,e);return-0===(t=v(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,n=(l(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&b.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:k,randColor:t=>`rgba(${k(255)},${k(255)},${k(255)},${t||1})`};function k(t){return Math.round(Math.random()*t)}const E=x/180,S=2*x,B=x/2;function R(){return{x:0,y:0}}function T(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:O,cos:P,acos:L,sqrt:A}=Math,{float:M}=b,D={};function F(){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 I={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:F(),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:C,getWorld:F,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.scaleOfInner(t,D,i,s)},scaleOfInner(t,e,i,s=i){W.translateInner(t,e.x,e.y),W.scale(t,i,s),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=P(e*=E),a=O(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){W.toInnerPoint(t,e,D),W.rotateOfInner(t,D,i)},rotateOfInner(t,e,i){W.translateInner(t,e.x,e.y),W.rotate(t,i),W.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=E,t.a=s+o*i,t.b=n+r*i),e&&(e*=E,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.skewOfInner(t,D,i,s)},skewOfInner(t,e,i,s=0){W.translateInner(t,e.x,e.y),W.skew(t,i,s),W.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:r,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: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=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.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:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*E,r=P(o),a=O(o);if(s||n){const e=s*E,i=n*E;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=r,t.f=a,(i=i||s)&&W.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=A(n*n+o*o),c=t/d;const e=n/d;u=o>0?L(e):-L(e)}else{c=A(r*r+a*a),d=t/c;const e=r/c;u=B-(a>0?L(-e):-L(e))}const e=M(P(u)),i=O(u);d=M(d),c=M(c),_=e?M((r/c+i)/e/E,9):0,p=e?M((o/d-i)/e/E,9):0,u=M(u/E)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*r,f+=e.x*o+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:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=A(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){W.set(t)}},W=I,{toInnerPoint:z,toOuterPoint:N}=I,{sin:Y,cos:H,abs:X,sqrt:V,atan2:U,min:j,round:G}=Math,K={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?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(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=q.defaultPoint);const s=H(e*=E),n=Y(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}=q;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return J(i,t),N(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return J(i,t),q.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){N(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)=>Z(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=X(i-t),o=X(s-e);return V(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>j(Z(t,e,i,s),Z(i,s,n,o)),getAngle:(t,e)=>$(t,e)/E,getRotation:(t,e,i,s)=>(s||(s=e),q.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/E),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>U(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=$(t,e);return(e=s?e:{}).x=t.x+H(n)*i,e.y=t.y+Y(n)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=K,{getDistanceFrom:Z,copy:J,getAtan2:$}=q;class Q{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Q(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new Q(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new Q(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new Q;class et{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return _(t)?I.copy(this,t):I.set(this,t,e,i,s,n,o),this}setWith(t){return I.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 et(this)}translate(t,e){return I.translate(this,t,e),this}translateInner(t,e){return I.translateInner(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleWith(t,e){return I.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return I.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return I.scaleOfInner(this,t,e,i),this}rotate(t){return I.rotate(this,t),this}rotateOfOuter(t,e){return I.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return I.rotateOfInner(this,t,e),this}skew(t,e){return I.skew(this,t,e),this}skewOfOuter(t,e,i){return I.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return I.skewOfInner(this,t,e,i),this}multiply(t){return I.multiply(this,t),this}multiplyParent(t){return I.multiplyParent(this,t),this}divide(t){return I.divide(this,t),this}divideParent(t){return I.divideParent(this,t),this}invert(){return I.invert(this),this}invertWith(){return I.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){I.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){I.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return I.setLayout(this,t,e,i),this}getLayout(t,e,i){return I.getLayout(this,t,e,i)}withScale(t,e){return I.withScale(this,t,e)}reset(){I.reset(this)}}const it=new et,st={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){nt(t,e,i),nt(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:nt}=st;var ot,rt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(ot||(ot={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(rt||(rt={}));const at=[{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}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,i,s,n,o){const r=lt(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={}),ht.toPoint(t,e,i,!0),i)};function lt(t){return a(t)?at[rt[t]]:t}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,n,o){dt(t,i,s,n,e,o)}},{tempPointBounds:ut,setPoint:_t,addPoint:pt,toBounds:gt}=st,{toOuterPoint:ft}=I,{float:yt,fourNumber:mt}=b,{floor:vt,ceil:wt}=Math;let xt,bt,kt,Et;const St={},Bt={},Rt={},Tt={tempBounds:Rt,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=mt(i);s?Ct.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ct.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),Ct.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Pt(e,t):e=t,i?(e.offsetX=-(Ct.maxX(i)-t.x),e.offsetY=-(Ct.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||K.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){K.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ct.copy(Rt,t),Ct.toOuterOf(Rt,e),Rt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.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 St.x=t.x,St.y=t.y,ft(e,St,Bt),_t(ut,Bt.x,Bt.y),St.x=t.x+t.width,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),St.y=t.y+t.height,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),St.x=t.x,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),gt(ut,i)},toInnerOf(t,e,i){i||(i=t),Ct.move(i,-e.e,-e.f),Ct.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ct.getFitScale(t,e));return new et(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),a(s)&&(s=Ct.getFitScale(t,e,"cover"===s)),Rt.width=n?e.width*=s:e.width*s,Rt.height=n?e.height*=s:e.height*s,ct.toPoint(i,Rt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ct.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ct.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ct.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=i>t.y?wt(t.height+i-t.y):wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,i){xt=t.x+t.width,bt=t.y+t.height,kt=e.x,Et=e.y,i||(kt+=e.width,Et+=e.height),xt=xt>kt?xt:kt,bt=bt>Et?bt:Et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=bt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ct.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ct.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||Pt(t,n)):Ot(t,n));o&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ut,t.x,t.y):pt(ut,t.x,t.y)),gt(ut,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Ot(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=K.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=K.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=Ct.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=Ct.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=Ct.tempToOuterOf(e,i)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return xt=s+o,bt=n+r,kt=t.x+t.width,Et=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,xt=xt<kt?xt:kt,bt=bt<Et?bt:Et,o=xt-s,r=bt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Ct.copy(t,Ct.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){Ct.set(t)}},Ct=Tt,{add:Ot,copy:Pt}=Ct;class Lt{get minX(){return Tt.minX(this)}get minY(){return Tt.minY(this)}get maxX(){return Tt.maxX(this)}get maxY(){return Tt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Tt.copy(this,t):Tt.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 Lt(this)}move(t,e){return Tt.move(this,t,e),this}scale(t,e,i){return Tt.scale(this,t,e,i),this}scaleOf(t,e,i){return Tt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Tt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Tt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Tt.getFitMatrix(this,t,e)}put(t,e,i){Tt.put(this,t,e,i)}spread(t,e){return Tt.spread(this,t,e),this}shrink(t,e){return Tt.shrink(this,t,e),this}ceil(){return Tt.ceil(this),this}unsign(){return Tt.unsign(this),this}float(t){return Tt.float(this,t),this}add(t){return Tt.add(this,t),this}addList(t){return Tt.setList(this,t,!0),this}setList(t){return Tt.setList(this,t),this}addListWithFn(t,e){return Tt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Tt.setListWithFn(this,t,e),this}setPoint(t){return Tt.setPoint(this,t),this}setPoints(t){return Tt.setPoints(this,t),this}addPoint(t){return Tt.addPoint(this,t),this}getPoints(){return Tt.getPoints(this)}hitPoint(t,e){return Tt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Tt.hitRadiusPoint(this,t,e)}hit(t,e){return Tt.hit(this,t,e)}includes(t,e){return Tt.includes(this,t,e)}intersect(t,e){return Tt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Tt.getIntersectData(this,t,e))}isSame(t){return Tt.isSame(this,t)}isEmpty(){return Tt.isEmpty(this)}reset(){Tt.reset(this)}}const At=new Lt;class Mt{constructor(t,e,i,s,n,o){_(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 Lt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Dt={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:Ft}=b;class It{constructor(t){this.repeatMap={},this.name=t}static get(t){return new It(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const i=Ft();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===It.showBounds,n=t.__nowWorld,o=Ft();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 Wt(t){return t?a(t)&&(t=[t]):t=[],t}It.filterList=[],It.excludeList=[],It.showWarn=!0;const zt=It,Nt=It.get("RunTime"),Yt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Ht.currentId=Ht.idMap[s]=i?performance.now():Date.now(),Ht.currentName=Ht.nameMap[s]=t,Ht.nameToIdMap[t]=s,s},end(t,e){const i=Ht.idMap[t],s=Ht.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Ht.idMap[t]=Ht.nameMap[t]=Ht.nameToIdMap[s]=void 0,Nt.log(s,n,"ms")},endOfName(t,e){const i=Ht.nameToIdMap[t];o(i)||Ht.end(i,e)}},Ht=Yt,Xt=[],Vt={list:{},add(t,...e){this.list[t]=!0,Xt.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(()=>Xt.forEach(t=>Vt.has(t,!0)));const Ut={editor:t=>Vt.need("editor")},jt=It.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&jt.repeat(e),Kt[e]=t},get(t,e,i,s,n,r){Kt[t]||jt.error("not register "+t);const a=new Kt[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:Kt}=Gt,qt=It.get("EventCreator"),Zt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(Jt[e]&&qt.repeat(e),Jt[e]=t)})},changeName(t,e){const i=Jt[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,Jt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Jt[t](...e)},{nameList:Jt}=Zt;class $t{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=Ut.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 Qt(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 te(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){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ee(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 ie=[];function se(){return(t,e)=>{ie.push(e)}}const ne=[];let oe=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ne)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.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){_(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}};Qt([ee("imageSmoothingEnabled")],oe.prototype,"smooth",void 0),Qt([ee("imageSmoothingQuality")],oe.prototype,"smoothLevel",void 0),Qt([ee("globalAlpha")],oe.prototype,"opacity",void 0),Qt([ee()],oe.prototype,"fillStyle",void 0),Qt([ee()],oe.prototype,"strokeStyle",void 0),Qt([ee("lineWidth")],oe.prototype,"strokeWidth",void 0),Qt([ee("lineCap")],oe.prototype,"strokeCap",void 0),Qt([ee("lineJoin")],oe.prototype,"strokeJoin",void 0),Qt([ee("lineDashOffset")],oe.prototype,"dashOffset",void 0),Qt([ee()],oe.prototype,"miterLimit",void 0),Qt([ee()],oe.prototype,"shadowBlur",void 0),Qt([ee()],oe.prototype,"shadowColor",void 0),Qt([ee()],oe.prototype,"shadowOffsetX",void 0),Qt([ee()],oe.prototype,"shadowOffsetY",void 0),Qt([ee()],oe.prototype,"filter",void 0),Qt([ee()],oe.prototype,"font",void 0),Qt([ee()],oe.prototype,"fontKerning",void 0),Qt([ee()],oe.prototype,"fontStretch",void 0),Qt([ee()],oe.prototype,"fontVariantCaps",void 0),Qt([ee()],oe.prototype,"textAlign",void 0),Qt([ee()],oe.prototype,"textBaseline",void 0),Qt([ee()],oe.prototype,"textRendering",void 0),Qt([ee()],oe.prototype,"wordSpacing",void 0),Qt([ee()],oe.prototype,"letterSpacing",void 0),Qt([ee()],oe.prototype,"direction",void 0),Qt([se()],oe.prototype,"setTransform",null),Qt([se()],oe.prototype,"resetTransform",null),Qt([se()],oe.prototype,"getTransform",null),Qt([se()],oe.prototype,"save",null),Qt([se()],oe.prototype,"restore",null),Qt([se()],oe.prototype,"translate",null),Qt([se()],oe.prototype,"scale",null),Qt([se()],oe.prototype,"rotate",null),Qt([se()],oe.prototype,"fill",null),Qt([se()],oe.prototype,"stroke",null),Qt([se()],oe.prototype,"clip",null),Qt([se()],oe.prototype,"fillRect",null),Qt([se()],oe.prototype,"strokeRect",null),Qt([se()],oe.prototype,"clearRect",null),Qt([se()],oe.prototype,"beginPath",null),Qt([se()],oe.prototype,"moveTo",null),Qt([se()],oe.prototype,"lineTo",null),Qt([se()],oe.prototype,"bezierCurveTo",null),Qt([se()],oe.prototype,"quadraticCurveTo",null),Qt([se()],oe.prototype,"closePath",null),Qt([se()],oe.prototype,"arc",null),Qt([se()],oe.prototype,"arcTo",null),Qt([se()],oe.prototype,"ellipse",null),Qt([se()],oe.prototype,"rect",null),Qt([se()],oe.prototype,"roundRect",null),Qt([se()],oe.prototype,"createConicGradient",null),Qt([se()],oe.prototype,"createLinearGradient",null),Qt([se()],oe.prototype,"createPattern",null),Qt([se()],oe.prototype,"createRadialGradient",null),Qt([se()],oe.prototype,"fillText",null),Qt([se()],oe.prototype,"measureText",null),Qt([se()],oe.prototype,"strokeText",null);const{copy:re,multiplyParent:ae}=I,{round:he}=Math,le=new Lt,de=new Lt,ce={width:1,height:1,pixelRatio:1},ue=["width","height","pixelRatio"];class _e extends oe{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(i,s){super(),this.size={},this.worldTransform={},i||(i=ce),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:n,height:o,pixelRatio:r}=i;this.autoLayout=!n||!o,this.size.pixelRatio=r||t.devicePixelRatio,this.config=i,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,ue),ue.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&ae(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=he(n.e-.5)+.5,n.f=he(n.f-.5)+.5):(n.e=he(n.e),n.f=he(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:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,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=de):i=le,this.drawImage(t.view,le.x,le.y,le.width,le.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,Tt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,le.x,le.y,le.width,le.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(le.x,le.y,le.width,le.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,le.x,le.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(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(de,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):Ut.canvas(Object.assign({},i));return n.save(),t&&(re(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 pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ge={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},fe=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},ge),ye={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},me={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},ve=Object.assign(Object.assign({},me),ge),we=fe,xe={};for(let t in we)xe[we[t]]=t;const be={};for(let t in we)be[we[t]]=ye[t];const ke={drawRoundRect(t,e,i,s,n,o){const r=b.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:Ee,cos:Se,atan2:Be,ceil:Re,abs:Te,PI:Ce,sqrt:Oe,pow:Pe}=Math,{setPoint:Le,addPoint:Ae}=st,{set:Me,toNumberPoints:De}=K,{M:Fe,L:Ie,C:We,Q:ze,Z:Ne}=fe,Ye={},He={points(t,e,i,s){let n=De(e);if(t.push(Fe,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,_,p,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-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],p=Oe(Pe(r-e,2)+Pe(a-o,2)),g=Oe(Pe(h-r,2)+Pe(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(ze,d,c,r,a):t.push(We,u,_,d,c,r,a),u=r+g*h,_=a+g*l);s||t.push(ze,u,_,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Ie,n[e],n[e+1]);s&&t.push(Ne)},rect(t,e,i,s,n){pe.creator.path=t,pe.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){pe.creator.path=[],ke.drawRoundRect(pe.creator,e,i,s,n,o),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,_=o-s,p=r-n;let g=Be(u,c),f=Be(p,_),y=f-g;if(y<0&&(y+=S),y===Ce||Te(c+u)<1e-12||Te(_+p)<1e-12)return t&&t.push(Ie,s,n),h&&(Le(h,e,i),Ae(h,s,n)),d&&Me(d,e,i),void(l&&Me(l,s,n));const m=c*p-_*u<0,v=m?-1:1,w=a/Se(y/2),x=s+w*Se(g+y/2+B*v),b=n+w*Ee(g+y/2+B*v);return g-=B*v,f-=B*v,Ue(t,x,b,a,a,0,g/E,f/E,m,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>Ue(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*E,_=Ee(u),p=Se(u);let g=r*E,f=a*E;g>Ce&&(g-=S),f<0&&(f+=S);let y=f-g;y<0?y+=S:y>S&&(y-=S),h&&(y-=S);const m=Re(Te(y/B)),v=y/m,w=Ee(v/4),x=8/3*w*w/Ee(v/2);f=g+v;let b,k,R,T,C,O,P,L,A=Se(g),M=Ee(g),D=R=p*s*A-_*n*M,F=T=_*s*A+p*n*M,I=e+R,W=i+T;t&&t.push(t.length?Ie:Fe,I,W),l&&Le(l,I,W),c&&Me(c,I,W);for(let o=0;o<m;o++)b=Se(f),k=Ee(f),R=p*s*b-_*n*k,T=_*s*b+p*n*k,C=e+D-x*(p*s*M+_*n*A),O=i+F-x*(_*s*M-p*n*A),P=e+R+x*(p*s*k+_*n*b),L=i+T+x*(_*s*k-p*n*b),t&&t.push(We,C,O,P,L,e+R,i+T),l&&Ve(e+D,i+F,C,O,P,L,e+R,i+T,l,!0),D=R,F=T,A=b,M=k,g=f,f+=v;d&&Me(d,e+R,i+T)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(We,(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){Ve(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,y,m,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,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?Ae(h,t,e):Le(h,t,e),Ae(h,r,a);for(let l=0,c=d.length;l<c;l++)Xe(d[l],t,e,i,s,n,o,r,a,Ye),Ae(h,Ye.x,Ye.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,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*o+p*a,l.y=c*i+u*n+_*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Xe(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:Xe,toTwoPointBounds:Ve,ellipse:Ue}=He,{sin:je,cos:Ge,sqrt:Ke,atan2:qe}=Math,{ellipse:Ze}=He,Je={ellipticalArc(e,i,s,n,o,r,a,h,l,d,c){const u=(l-i)/2,_=(d-s)/2,p=r*E,g=je(p),f=Ge(p),y=-f*u-g*_,m=-f*_+g*u,v=n*n,w=o*o,x=m*m,b=y*y,k=v*w-v*x-w*b;let B=0;if(k<0){const t=Ke(1-k/(v*w));n*=t,o*=t}else B=(a===h?-1:1)*Ke(k/(v*x+w*b));const R=B*n*m/o,T=-B*o*y/n,C=qe((m-T)/o,(y-R)/n),O=qe((-m-T)/o,(-y-R)/n);let P=O-C;0===h&&P>0?P-=S:1===h&&P<0&&(P+=S);const L=i+u+f*R-g*T,A=s+_+g*R+f*T,M=P<0?1:0;c||t.ellipseToCurve?Ze(e,L,A,n,o,r,C/E,O/E,M):n!==o||r?e.push(fe.G,L,A,n,o,r,C/E,O/E,M):e.push(fe.O,L,A,n,C/E,O/E,M)}},{M:$e,m:Qe,L:ti,l:ei,H:ii,h:si,V:ni,v:oi,C:ri,c:ai,S:hi,s:li,Q:di,q:ci,T:ui,t:_i,A:pi,a:gi,Z:fi,z:yi,N:mi,D:vi,X:wi,G:xi,F:bi,O:ki,P:Ei,U:Si}=fe,{rect:Bi,roundRect:Ri,arcTo:Ti,arc:Ci,ellipse:Oi,quadraticCurveTo:Pi}=He,{ellipticalArc:Li}=Je,Ai=It.get("PathConvert"),Mi={},Di={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=be[s],a+=s===n?" ":xe[s];for(let s=1;s<i;s++)a+=b.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?ve:me;for(let e=0,h=t.length;e<h;e++)s=t[e],Dt[s]?("."===s&&(Fi.dot&&(Ii(r,o),o=""),Fi.dot++),"0"===o&&"."!==s&&(Ii(r,o),o=""),o+=s):fe[s]?(o&&(Ii(r,o),o=""),Fi.name=fe[s],Fi.length=ye[s],Fi.index=0,Ii(r,Fi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Ii(r,o),o=s):o&&(Ii(r,o),o=""),n=s;return o&&Ii(r,o),i?Di.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 _=[];for(;c<u;){switch(n=t[c],n){case Qe:t[c+1]+=a,t[c+2]+=h;case $e:a=t[c+1],h=t[c+2],_.push($e,a,h),c+=3;break;case si:t[c+1]+=a;case ii:a=t[c+1],_.push(ti,a,h),c+=2;break;case oi:t[c+1]+=h;case ni:h=t[c+1],_.push(ti,a,h),c+=2;break;case ei:t[c+1]+=a,t[c+2]+=h;case ti:a=t[c+1],h=t[c+2],_.push(ti,a,h),c+=3;break;case li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=hi;case hi:r=o===ri||o===hi,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],_.push(ri,l,d,i,s,a,h),c+=5;break;case ai: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=ri;case ri:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(ri,t[c+1],t[c+2],i,s,a,h),c+=7;break;case _i:t[c+1]+=a,t[c+2]+=h,n=ui;case ui:r=o===di||o===ui,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Pi(_,a,h,i,s,t[c+1],t[c+2]):_.push(di,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=di;case di:i=t[c+1],s=t[c+2],e?Pi(_,a,h,i,s,t[c+3],t[c+4]):_.push(di,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case gi:t[c+6]+=a,t[c+7]+=h;case pi:Li(_,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 yi:case fi:_.push(fi),c++;break;case mi:a=t[c+1],h=t[c+2],e?Bi(_,a,h,t[c+3],t[c+4]):Wi(_,t,c,5),c+=5;break;case vi:a=t[c+1],h=t[c+2],e?Ri(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Wi(_,t,c,9),c+=9;break;case wi:a=t[c+1],h=t[c+2],e?Ri(_,a,h,t[c+3],t[c+4],t[c+5]):Wi(_,t,c,6),c+=6;break;case xi:Oi(e?_:Wi(_,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,Mi),a=Mi.x,h=Mi.y,c+=9;break;case bi:e?Oi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Wi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ki:Ci(e?_:Wi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Mi),a=Mi.x,h=Mi.y,c+=7;break;case Ei:e?Ci(_,t[c+1],t[c+2],t[c+3],0,360,!1):Wi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Si:Ti(e?_:Wi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Mi),a=Mi.x,h=Mi.y,c+=6;break;default:return Ai.error(`command: ${n} [index:${c}]`,t),_}o=n}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push($e,t.x,t.y);break;case"L":e.push(ti,t.x,t.y);break;case"C":e.push(ri,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(di,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(fi)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Fi.index===Fi.length&&(Fi.index=1,t.push(Fi.name)),t.push(Number(e)),Fi.index++,Fi.dot=0}},{current:Fi,pushData:Ii,copyData:Wi}=Di,{M:zi,L:Ni,C:Yi,Q:Hi,Z:Xi,N:Vi,D:Ui,X:ji,G:Gi,F:Ki,O:qi,P:Zi,U:Ji}=fe,{getMinDistanceFrom:$i,getRadianFrom:Qi}=K,{tan:ts,min:es,abs:is}=Math,ss={},ns={beginPath(t){t.length=0},moveTo(t,e,i){t.push(zi,e,i)},lineTo(t,e,i){t.push(Ni,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Yi,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Hi,e,i,s,n)},closePath(t){t.push(Xi)},rect(t,e,i,s,n){t.push(Vi,e,i,s,n)},roundRect(t,e,i,s,n,o){if(l(o))t.push(ji,e,i,s,n,o);else{const r=b.fourNumber(o);r?t.push(Ui,e,i,s,n,...r):t.push(Vi,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){r(o)?t.push(Ki,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(Gi,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(Zi,e,i,s):(r(o)&&(o=360),t.push(qi,e,i,s,n,o,a?1:0))},arcTo(t,e,i,s,n,r,a,h){if(!o(a)){const t=$i(a,h,e,i,s,n);r=es(r,es(t/2,t/2*is(ts(Qi(a,h,e,i,s,n)/2))))}t.push(Ji,e,i,s,n,r)},drawEllipse(t,e,i,s,n,o,a,h,l){He.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,ss),t.push(zi,ss.x,ss.y),os(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){He.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,ss),t.push(zi,ss.x,ss.y),rs(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){He.points(t,e,i,s)}},{ellipse:os,arc:rs}=ns,{moveTo:as,lineTo:hs,quadraticCurveTo:ls,bezierCurveTo:ds,closePath:cs,beginPath:us,rect:_s,roundRect:ps,ellipse:gs,arc:fs,arcTo:ys,drawEllipse:ms,drawArc:vs,drawPoints:ws}=ns;class xs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?pe.parse(t):t:[],this}beginPath(){return us(this.__path),this.paint(),this}moveTo(t,e){return as(this.__path,t,e),this.paint(),this}lineTo(t,e){return hs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return ds(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return cs(this.__path),this.paint(),this}rect(t,e,i,s){return _s(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return ps(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return gs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return fs(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return ys(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return ms(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return vs(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:bs,L:ks,C:Es,Q:Ss,Z:Bs,N:Rs,D:Ts,X:Cs,G:Os,F:Ps,O:Ls,P:As,U:Ms}=fe,Ds=It.get("PathDrawer"),Fs={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case bs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case ks:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Es:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ss:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Bs:t.closePath(),s+=1;break;case Rs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ts: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 Cs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Os:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*E,e[s+6]*E,e[s+7]*E,e[s+8]),s+=9;break;case Ps:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,S,!1),s+=5;break;case Ls:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*E,e[s+5]*E,e[s+6]),s+=7;break;case As:t.arc(e[s+1],e[s+2],e[s+3],0,S,!1),s+=4;break;case Ms:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ds.error(`command: ${i} [index:${s}]`,e)}}},{M:Is,L:Ws,C:zs,Q:Ns,Z:Ys,N:Hs,D:Xs,X:Vs,G:Us,F:js,O:Gs,P:Ks,U:qs}=fe,{toTwoPointBounds:Zs,toTwoPointBoundsByQuadraticCurve:Js,arcTo:$s,arc:Qs,ellipse:tn}=He,{addPointBounds:en,copy:sn,addPoint:nn,setPoint:on,addBounds:rn,toBounds:an}=st,hn=It.get("PathBounds");let ln,dn,cn;const un={},_n={},pn={},gn={toBounds(t,e){gn.toTwoPointBounds(t,_n),an(_n,e)},toTwoPointBounds(t,e){if(!t||!t.length)return on(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===Ys||r===zs||r===Ns?on(e,h,l):on(e,t[a+1],t[a+2])),r){case Is:case Ws:h=t[a+1],l=t[a+2],nn(e,h,l),a+=3;break;case zs:n=t[a+5],o=t[a+6],Zs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,un),en(e,un),h=n,l=o,a+=7;break;case Ns:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],Js(h,l,i,s,n,o,un),en(e,un),h=n,l=o,a+=5;break;case Ys:a+=1;break;case Hs:h=t[a+1],l=t[a+2],rn(e,h,l,t[a+3],t[a+4]),a+=5;break;case Xs:case Vs:h=t[a+1],l=t[a+2],rn(e,h,l,t[a+3],t[a+4]),a+=r===Xs?9:6;break;case Us:tn(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],un,pn),0===a?sn(e,un):en(e,un),h=pn.x,l=pn.y,a+=9;break;case js:h=t[a+1],l=t[a+2],dn=t[a+3],cn=t[a+4],rn(e,h-dn,l-cn,2*dn,2*cn),h+=dn,a+=5;break;case Gs:Qs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],un,pn),0===a?sn(e,un):en(e,un),h=pn.x,l=pn.y,a+=7;break;case Ks:h=t[a+1],l=t[a+2],ln=t[a+3],rn(e,h-ln,l-ln,2*ln,2*ln),h+=ln,a+=4;break;case qs:$s(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],un,pn),0===a?sn(e,un):en(e,un),h=pn.x,l=pn.y,a+=6;break;default:return void hn.error(`command: ${r} [index:${a}]`,t)}}},{M:fn,L:yn,Z:mn}=fe,{getCenterX:vn,getCenterY:wn}=K,{arcTo:xn}=ns,bn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;r<g;){switch(s=t[r],s){case fn:l=_=t[r+1],d=p=t[r+2],r+=3,t[r]===yn?(c=t[r+1],u=t[r+2],f.push(fn,vn(l,c),wn(d,u))):f.push(fn,l,d);break;case yn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case yn:xn(f,a,h,t[r+1],t[r+2],e,_,p);break;case mn:xn(f,a,h,l,d,e,_,p);break;default:f.push(yn,a,h)}_=a,p=h;break;case mn:n!==mn&&(xn(f,l,d,c,u,e,_,p),f.push(mn)),r+=1;break;default:o=be[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==mn&&(f[1]=l,f[2]=d),f}};pe.creator=new xs,pe.parse=Di.parse,pe.convertToCanvasData=Di.toCanvasData;const kn=new xs,{drawRoundRect:En}=ke;function Sn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){En(this,t,e,i,s,n)})}(t)}const Bn={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=Rn.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{}}}},Rn=Bn;Rn.alphaPixelTypes.forEach(t=>Rn.upperCaseTypeMap[t]=t.toUpperCase());const Tn=It.get("TaskProcessor");class Cn{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Tn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class On{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,r;const a=new Cn(t);return a.parent=this,l(e)?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),o(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),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.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Pn=It.get("Resource"),Ln={tasker:new On,map:{},get isComplete(){return An.tasker.isComplete},set(t,e){An.map[t]&&Pn.repeat(t),An.map[t]=e},get:t=>An.map[t],remove(t){const e=An.map[t];e&&(e.destroy&&e.destroy(),delete An.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Ut.image(s)),An.set(t,e),e},destroy(){An.map={}}},An=Ln,Mn={maxRecycled:10,recycledList:[],patternTasker:new On,get(t){let e=Ln.get(t.url);return e||Ln.set(t.url,e=Ut.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Dn.recycledList.push(t)})},clearRecycled(){const t=Dn.recycledList;t.length>Dn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Ln.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Bn.alphaPixelTypes.some(e=>Dn.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Bn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Bn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Dn.recycledList=[]}},Dn=Mn,{IMAGE:Fn,create:In}=e,{floor:Wn,max:zn}=Math;class Nn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=In(Fn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Mn.isFormat("svg",t)&&(this.isSVG=!0),Mn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),Ln.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,i,s,n,o,r){if(e||(e=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=t.origin.createCanvas(zn(Wn(e+(o||0)),1),zn(Wn(i+(r||0)),1)),h=a.getContext("2d");return s&&(h.globalAlpha=s),h.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(e,i,s,n){const o=t.canvas.createPattern(e,i);try{s&&o.setTransform&&(o.setTransform(s),s=void 0)}catch(t){}return n&&f.stintSet(n,"transform",s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Yn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Hn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Xn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function Vn(t,e){return(i,s)=>jn(i,s,t,e&&e(s))}function Un(t){return t}function jn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Yn(t,e,Object.assign(n,s||{})),xo(t,e,i)}function Gn(t){return Vn(t)}function Kn(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function qn(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function Zn(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),eo(this))}}))}function Jn(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function $n(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Qn(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i,e)&&eo(this)}}))}function to(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(eo(this),this.__.__removeNaturalSize())}}))}function eo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function io(t){return Vn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),eo(this)}}))}const so=Qn;function no(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i)&&(oo(this),e&&(this.__.__useStroke=!0))}}))}function oo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&eo(t)}const ro=no;function ao(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ho(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function lo(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&uo(this)}}))}function co(t){return Vn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>_o(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");_o(this,t,e,i),this.mask&&uo(this)}}))}function uo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function _o(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||eo(t))}function po(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function go(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function fo(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function yo(t){return Vn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===It.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function mo(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function vo(t){return(e,i)=>{Yn(e,"__DataProcessor",{get:()=>t})}}function wo(t){return(e,i)=>{Yn(e,"__LayoutProcessor",{get:()=>t})}}function xo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Xn(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(_(i)){const t=g(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=Hn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),Yn(s,e,a)}const bo=new It("rewrite"),ko=[],Eo=["destroy","constructor"];function So(t){return(e,i)=>{ko.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Bo(){return t=>{Ro()}}function Ro(t){ko.length&&(ko.forEach(e=>{t&&bo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),ko.length=0)}function To(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Eo.includes(s)||e&&e.includes(s)))if(t.prototype){Hn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Co(){return t=>{Gt.register(t)}}function Oo(){return t=>{Zt.register(t)}}setTimeout(()=>Ro(!0));const{copy:Po,toInnerPoint:Lo,toOuterPoint:Ao,scaleOfOuter:Mo,rotateOfOuter:Do,skewOfOuter:Fo,multiplyParent:Io,divideParent:Wo,getLayout:zo}=I,No={},{round:Yo}=Math,Ho={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Uo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Vo(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)jo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&jo(t),t.__updateChange()},updateAllChange(t){if(Ko(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Go(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,i,s,n,o,r){n||(n=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,n,e.__nowWorld,o,r):i.copyWorldToInner(s,n,e.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,n){const o=_(e)?Object.assign({},e):{x:e,y:i};s?Ao(t.localTransform,o,o,!0):t.parent&&Lo(t.parent.scrollWorldTransform,o,o,!0),Xo.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Yo(e),i=Yo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){Xo.zoomOfLocal(t,qo(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(l(s)||(s&&(o=s),s=i),Po(No,r),Mo(No,e,i,s),Xo.hasHighPosition(t))Xo.setTransform(t,No,n,o);else{const e=t.x+No.e-r.e,a=t.y+No.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Xo.rotateOfLocal(t,qo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Po(No,n),Do(No,e,i),Xo.hasHighPosition(t)?Xo.setTransform(t,No,!1,s):t.set({x:t.x+No.e-n.e,y:t.y+No.f-n.f,rotation:b.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Xo.skewOfLocal(t,qo(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Po(No,t.__localMatrix),Fo(No,e,i,s),Xo.setTransform(t,No,n,o)},transformWorld(t,e,i,s){Po(No,t.worldTransform),Io(No,e),t.parent&&Wo(No,t.parent.scrollWorldTransform),Xo.setTransform(t,No,i,s)},transform(t,e,i,s){Po(No,t.localTransform),Io(No,e),Xo.setTransform(t,No,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Xo.getInnerOrigin(t,n.origin),r=zo(e,o,n.around&&Xo.getInnerOrigin(t,n.around));if(Xo.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Tt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Xo.getInnerOrigin(t,n.origin);K.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Mo(i,Xo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(Xo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Po(No,t.worldTransform),Wo(No,e.scrollWorldTransform),i?No:Object.assign({},No)),drop(t,e,i,s){t.setTransform(Xo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||Xo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const n=i.x*s,o=i.y*s;i.x-=n,i.y-=o,e.move(n,o),t.requestRender(()=>Xo.animateMove(e,i,s))}}},Xo=Ho,{updateAllMatrix:Vo,updateMatrix:Uo,updateAllWorldOpacity:jo,updateAllChange:Go,updateChange:Ko}=Xo;function qo(t,e){return t.parent?K.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Zo={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>$o(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>$o(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>$o(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Jo;function $o(t,e){return e||(Jo=0),t.__.mask&&(Jo=1),Jo<0?null:(Jo&&(Jo=-1),!0)}const{updateBounds:Qo}=Ho,tr={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),er(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ir(e[t],e)},updateBounds(t,e){const i=[t];ir(t,i),sr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Qo(s[t]);e&&e===i||Qo(i)}}},{pushAllChildBranch:er,pushAllBranchStack:ir,updateBoundsByBranchStack:sr}=tr,nr={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:or,updateBounds:rr}=Ho,{toOuterOf:ar,getPoints:hr,copy:lr}=Tt,dr="_localContentBounds",cr="_worldContentBounds",ur="_worldBoxBounds",_r="_worldStrokeBounds";class pr{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return ar(this.contentBounds,this.leaf.__localMatrix,this[dr]||(this[dr]={})),this[dr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ar(this.contentBounds,this.leaf.__world,this[cr]||(this[cr]={})),this[cr]}get worldBoxBounds(){return ar(this.boxBounds,this.leaf.__world,this[ur]||(this[ur]={})),this[ur]}get worldStrokeBounds(){return ar(this.strokeBounds,this.leaf.__world,this[_r]||(this[_r]={})),this[_r]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:i}=e;if(e.isApp)return rr(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return I.defaultMatrix;case"page":t=e.zoomLayer;default:return or(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=I.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=or(s,e,!0)}if(r||(r=I.getLayout(o)),lr(r,a),K.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=hr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class gr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class fr extends gr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}fr.ADD="child.add",fr.REMOVE="child.remove",fr.CREATED="created",fr.MOUNTED="mounted",fr.UNMOUNTED="unmounted",fr.DESTROY="destroy";const yr="property.scroll";class mr extends gr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}mr.CHANGE="property.change",mr.LEAFER_CHANGE="property.leafer_change",mr.SCROLL=yr;const vr={scrollX:yr,scrollY:yr};class wr extends gr{constructor(t,e){super(t),Object.assign(this,e)}}wr.LOAD="image.load",wr.LOADED="image.loaded",wr.ERROR="image.error";class xr extends gr{static checkHas(t,e,i){"on"===i?e===Sr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(br)||t.hasEvent(kr)||t.hasEvent(Er),t.__hasWorldEvent=t.hasEvent(Sr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(br,t),"inner"===e&&t.emit(kr,t)),t.emit(Er,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Sr,this)}}xr.RESIZE="bounds.resize",xr.INNER="bounds.inner",xr.LOCAL="bounds.local",xr.WORLD="bounds.world";const{RESIZE:br,INNER:kr,LOCAL:Er,WORLD:Sr}=xr,Br={};[br,kr,Er,Sr].forEach(t=>Br[t]=1);class Rr extends gr{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){_(t)?(super(Rr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Rr.RESIZE="resize";class Tr extends gr{constructor(t,e){super(t),this.data=e}}Tr.REQUEST="watch.request",Tr.DATA="watch.data";class Cr extends gr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Cr.REQUEST="layout.request",Cr.START="layout.start",Cr.BEFORE="layout.before",Cr.LAYOUT="layout",Cr.AFTER="layout.after",Cr.AGAIN="layout.again",Cr.END="layout.end";class Or extends gr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Or.REQUEST="render.request",Or.CHILD_START="render.child_start",Or.CHILD_END="render.child_end",Or.START="render.start",Or.BEFORE="render.before",Or.RENDER="render",Or.AFTER="render.after",Or.AGAIN="render.again",Or.END="render.end",Or.NEXT="render.next";class Pr extends gr{}Pr.START="leafer.start",Pr.BEFORE_READY="leafer.before_ready",Pr.READY="leafer.ready",Pr.AFTER_READY="leafer.after_ready",Pr.VIEW_READY="leafer.view_ready",Pr.VIEW_COMPLETED="leafer.view_completed",Pr.STOP="leafer.stop",Pr.RESTART="leafer.restart",Pr.END="leafer.end",Pr.TRANSFORM="leafer.transform",Pr.MOVE="leafer.move",Pr.SCALE="leafer.scale",Pr.ROTATE="leafer.rotate",Pr.SKEW="leafer.skew";const{MOVE:Lr,SCALE:Ar,ROTATE:Mr,SKEW:Dr}=Pr,Fr={x:Lr,y:Lr,scaleX:Ar,scaleY:Ar,rotation:Mr,skewX:Dr,skewY:Dr},Ir={};class Wr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=zr(this,s,!0),h=a(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],Br[t]&&xr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=zr(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],Br[t]&&xr.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Zt.has(t)&&(e=Zt.get(t,{type:t,target:this,current:this}));const s=zr(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function zr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Ir)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Ir)}}const{on:Nr,on_:Yr,off:Hr,off_:Xr,once:Vr,emit:Ur,emitEvent:jr,hasEvent:Gr,destroy:Kr}=Wr.prototype,qr={on:Nr,on_:Yr,off:Hr,off_:Xr,once:Vr,emit:Ur,emitEvent:jr,hasEvent:Gr,destroyEventer:Kr},Zr=It.get("setAttr"),Jr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||o(e)||(Zr.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new mr(mr.LEAFER_CHANGE,this,t,s,e));const i=Fr[t];i&&(this.emitEvent(new Pr(i,this)),this.emitEvent(new Pr(Pr.TRANSFORM,this)))}this.emitPropertyEvent(mr.CHANGE,t,s,e);const i=vr[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new mr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:$r,multiplyParent:Qr,translateInner:ta,defaultWorld:ea}=I,{toPoint:ia,tempPoint:sa}=ht,na={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;Qr(this.__local||e,t?t.__scrollWorld||t.__world:ea,i,!!e.affectScaleOrRotation,n),s&&ta(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&($r(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(ia(i.around||i.origin,t.boxBounds,sa),ta(e,-sa.x,-sa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:oa,updateAllMatrix:ra}=Ho,{updateBounds:aa}=tr,{toOuterOf:ha,copyAndSpread:la,copy:da}=Tt,{toBounds:ca}=gn,ua={__updateWorldBounds(){const t=this.__layout;ha(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&xr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&xr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ha(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ha(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ha(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__pathInputed?ca(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ra(this),aa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ra(this),aa(this,this))):oa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;la(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?la(e.renderBounds,e.boxBounds,e.renderSpread):da(e.renderBounds,e.strokeBounds)}},_a={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),Ho.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);It.showBounds&&It.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:pa}=Zo,ga={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)pa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)pa(i[s],e)||i[s].__clip(t,e)}}},fa={},{LEAF:ya,create:ma}=e,{toInnerPoint:va,toOuterPoint:wa,multiplyParent:xa}=I,{toOuterOf:ba}=Tt,{copy:ka,move:Ea}=K,{moveLocal:Sa,zoomOfLocal:Ba,rotateOfLocal:Ra,skewOfLocal:Ta,moveWorld:Ca,zoomOfWorld:Oa,rotateOfWorld:Pa,skewOfWorld:La,transform:Aa,transformWorld:Ma,setTransform:Da,getFlipTransform:Fa,getLocalOrigin:Ia,getRelativeWorld:Wa,drop:za}=Ho;let Na=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return pr}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=ma(ya),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(fr.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(fr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(fr.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(fr.MOUNTED)):this.__emitLifeEvent(fr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return xa(i,t.matrix,e,void 0,i),ba(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Mn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),fa.scaleX=i,fa.scaleY=s,fa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?Wa(this,e):this.worldTransform,n=i?t:{};return ba(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ka(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ka(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),va(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){wa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return Ea(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return Ea(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Da(this,t,e,i)}transform(t,e,i){Aa(this,t,e,i)}move(t,e,i){Sa(this,t,e,i)}moveInner(t,e,i){Ca(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Ba(this,Ia(this,t),e,i,s,n)}rotateOf(t,e,i){Ra(this,Ia(this,t),e,i)}skewOf(t,e,i,s,n){Ta(this,Ia(this,t),e,i,s,n)}transformWorld(t,e,i){Ma(this,t,e,i)}moveWorld(t,e,i){Ca(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Oa(this,t,e,i,s,n)}rotateOfWorld(t,e){Pa(this,t,e)}skewOfWorld(t,e,i,s,n){La(this,t,e,i,s,n)}flip(t,e){Aa(this,Fa(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Vt.need("path")}getMotionPoint(t){return Vt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){za(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):xo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Qn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new fr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(fr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};Na=Qt([To(Jr),To(na),To(ua),To(qr),To(_a)],Na);const{setListWithFn:Ya}=Tt,{sort:Ha}=tr,{localBoxBounds:Xa,localStrokeBounds:Va,localRenderBounds:Ua,maskLocalBoxBounds:ja,maskLocalStrokeBounds:Ga,maskLocalRenderBounds:Ka}=Zo,qa=new It("Branch");let Za=class extends Na{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){Ya(e||this.__layout.boxBounds,this.children,this.__hasMask?ja:Xa)}__updateStrokeBounds(t){Ya(t||this.__layout.strokeBounds,this.children,this.__hasMask?Ga:Va)}__updateRenderBounds(t){Ya(t||this.__layout.renderBounds,this.children,this.__hasMask?Ka:Ua)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(Ha),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return qa.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Gt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(fr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(fr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(fr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(fr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new fr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Za=Qt([To(ga)],Za);class Ja{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Ja;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class $a{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Qa="1.9.4";class th extends _e{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Sn(OffscreenCanvasRenderingContext2D.prototype),Sn(Path2D.prototype);const{mineType:eh}=Bn;function ih(e,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:eh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:eh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",t.image.getRealURL(e),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},t.canvas=Ut.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(Ut,{canvas:(t,e)=>new th(t,e),image:t=>new Nn(t)}),t.name="web",t.isWorker=!0,t.backgrounder=!0,t.requestRender=function(t){requestAnimationFrame(t)},Yn(t,"devicePixelRatio",{get:()=>1});const{userAgent:sh}=navigator;sh.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.fullImageShadow=!0),sh.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):sh.indexOf("Mac")>-1?t.os="Mac":sh.indexOf("Linux")>-1&&(t.os="Linux");class nh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ja;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new Ja,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Or.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===fr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Tr(Tr.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ja,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[mr.CHANGE,this.__onAttrChange,this],[[fr.ADD,fr.REMOVE],this.__onChildEvent,this],[Tr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:oh,updateBounds:rh,updateChange:ah}=Ho,{pushAllChildBranch:hh,pushAllParent:lh}=tr;const{worldBounds:dh}=Zo;class ch{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,u(t)&&(t=new Ja(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,dh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,dh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:uh,updateAllChange:_h}=Ho,ph=It.get("Layouter");class gh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new $a,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Cr.START),this.layoutOnce(),t.emitEvent(new Cr(Cr.END,this.layoutedBlocks,this.times))}catch(t){ph.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ph.warn("layouting"):this.times>3?ph.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Tr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Yt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Cr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Cr(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(oh(t,!0),e.add(t),t.isBranch&&hh(t,e),lh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),lh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||rh(s[t])}rh(i)}})}(this.__levelList),function(t){t.list.forEach(ah)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Cr(o,a,this.times)),i.emitEvent(new Cr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Yt.end(e)}fullLayout(){const t=Yt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Cr,o=this.getBlocks(new Ja(e));e.emitEvent(new Cr(i,o,this.times)),gh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Cr(s,o,this.times)),e.emitEvent(new Cr(n,o,this.times)),this.addBlocks(o),Yt.end(t)}static fullLayout(t){uh(t,!0),t.isBranch?tr.updateBounds(t):Ho.updateBounds(t),_h(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ch([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ch(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Cr.REQUEST,this.layout,this],[Cr.AGAIN,this.layoutAgain,this],[Tr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const fh=It.get("Renderer");class yh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Cr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Or.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Or.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Or.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,fh.log(e.innerName,"---\x3e");try{this.emitRender(Or.START),this.renderOnce(t),this.emitRender(Or.END,this.totalBounds),Mn.clearRecycled()}catch(t){this.rendering=!1,fh.error(t)}fh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return fh.warn("rendering");if(this.times>3)return fh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Or.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Or.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Or.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Or.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Yt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Lt(s);i.save(),s.spread(yh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),Yt.end(e)}fullRender(){const t=Yt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Yt.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),It.showRepaint&&It.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now();t.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Lt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||fh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Or(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Or.REQUEST,this.update,this],[Cr.END,this.__onLayoutEnd,this],[Or.AGAIN,this.renderAgain,this],[Rr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}yh.clipSpread=10;const{hitRadiusPoint:mh}=Tt;class vh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ja(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new Ja;if(t.length){let e;const{x:n,y:o}=this.point,r={x:n,y:o,radiusX:0,radiusY:0};for(let n=0,o=t.length;n<o;n++)if(e=t[n],(i||Ho.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Ho.hasParent(t,e))){s.reset();break}return s.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),s.length)return s.list[0];return i?t[0]:t.find(t=>Ho.worldHittable(t))}getPath(t){const e=new Ja;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Ja;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new Ja,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||mh(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class wh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new vh(this.target=t,this),this.finder=Ut.finder&&Ut.finder()}getByPoint(e,i,s){const{target:n,picker:o}=this;return t.backgrounder&&n&&n.updateLayout(),o.getByPoint(e,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Vt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function xh(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function bh(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function kh(){return(t,e)=>{const i="_"+e;Yn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Eh(t){return(e,i)=>{Yn(e,i,Xn(i,t))}}Object.assign(Ut,{watcher:(t,e)=>new nh(t,e),layouter:(t,e)=>new gh(t,e),renderer:(t,e,i)=>new yh(t,e,i),selector:(t,e)=>new wh(t,e)}),t.layout=gh.fullLayout;const Sh={},Bh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Rh={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Th={},Ch={},Oh={},Ph={},Lh={},Ah={apply(){Vt.need("filter")}},Mh={},Dh={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Fh={list:{},register(t,e){Fh.list[t]=e},get:t=>Fh.list[t]},{parse:Ih,objectToCanvasData:Wh}=Di,{stintSet:zh}=f,{hasTransparent:Nh}=Bh,Yh={},Hh=It.get("UIData");class Xh extends m{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Hh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Hh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(zh(this,"__isTransparentFill",Nh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(zh(this,"__isTransparentStroke",Nh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?Ih(t):Wh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Vh(this,"shadow",t)}setInnerShadow(t){Vh(this,"innerShadow",t)}setFilter(t){Vh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ch.compute("fill",this.__leaf),e&&Ch.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Yh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Yh))}__removePaint(t,e){e&&this.__removeInput(t),Oh.recycleImage(t,this),"fill"===t?(zh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(zh(this,"__isAlphaPixelStroke",void 0),zh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Vh(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Uh extends Xh{}class jh extends Uh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Gh extends Uh{__getInputData(t,e){const i=super.__getInputData(t,e);return ue.forEach(t=>delete i[t]),i}}class Kh extends jh{}class qh extends Xh{}class Zh extends Xh{get __boxStroke(){return!this.__pathInputed}}class Jh extends Xh{get __boxStroke(){return!this.__pathInputed}}class $h extends Xh{}class Qh extends Xh{}class tl extends Xh{get __pathInputed(){return 2}}class el extends Uh{}const il={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class sl extends Xh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=il[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Gt.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange(),o.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class nl extends Zh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class ol extends Zh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const rl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),o&&(t+=Ah.getSpread(o)),r&&(t+=r);let a=t=Math.ceil(t);return i&&i.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),n&&(a=Math.max(a,n)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},al={getValidMove(t,e,i,s,n){const o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;n||(s=Object.assign({},s));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==i?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),u&&"outer"!==i?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=b.float(s.x),s.y=b.float(s.y),s},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&hl.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),hl.axisMove(t,e)}},hl=al,{stintSet:ll}=f,dl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);ll(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),ll(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;ll(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),ll(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){cl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Ch.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Lh.shadow(this,t,h),a&&(s.__isStrokes?Ch.strokes(o,this,t):Ch.stroke(o,this,t)),n&&(s.__isFills?Ch.fills(n,this,t):Ch.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&Lh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Ch.strokes(o,this,t):Ch.stroke(o,this,t)),c&&Ah.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Ch.strokes(o,this,t):Ch.stroke(o,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,Bh.string(e.color))}n&&(s.__isFills?Ch.fills(n,this,t):Ch.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Ch.strokes(o,this,t):Ch.stroke(o,this,t))}}else s.__pathInputed?cl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Ch.fills(s,this,t):Ch.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ch.strokes(n,this,t):Ch.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function cl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Ch.stroke(n,t,e),s&&Ch.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&Ch.stroke(n,t,e)}const ul={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var _l;let pl=_l=class extends Na{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){b.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return kn.set(this.path=t||[]),t||this.__drawPathByBox(kn),kn}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Vt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Vt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(kn.set(i=[]),this.__drawPathByBox(kn)),t?Di.toCanvasData(i,!0):i}getPathString(t,e,i){return Di.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Mh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?bn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Th.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Fs.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,l(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Ch.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Vt.need("animate")}killAnimate(t,e){}export(t,e){return Vt.need("export")}syncExport(t,e){return Vt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),_l.one(e)}static one(t,e,i,s,n){return Gt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Co()(this)}static registerData(t){vo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};Qt([vo(Xh)],pl.prototype,"__",void 0),Qt([kh()],pl.prototype,"zoomLayer",void 0),Qt([Gn("")],pl.prototype,"id",void 0),Qt([Gn("")],pl.prototype,"name",void 0),Qt([Gn("")],pl.prototype,"className",void 0),Qt([ho("pass-through")],pl.prototype,"blendMode",void 0),Qt([lo(1)],pl.prototype,"opacity",void 0),Qt([co(!0)],pl.prototype,"visible",void 0),Qt([ho(!1)],pl.prototype,"locked",void 0),Qt([ho(!1)],pl.prototype,"dim",void 0),Qt([ho(!1)],pl.prototype,"dimskip",void 0),Qt([po(0)],pl.prototype,"zIndex",void 0),Qt([go(!1)],pl.prototype,"mask",void 0),Qt([fo(!1)],pl.prototype,"eraser",void 0),Qt([Kn(0,!0)],pl.prototype,"x",void 0),Qt([Kn(0,!0)],pl.prototype,"y",void 0),Qt([Qn(100,!0)],pl.prototype,"width",void 0),Qt([Qn(100,!0)],pl.prototype,"height",void 0),Qt([Jn(1,!0)],pl.prototype,"scaleX",void 0),Qt([Jn(1,!0)],pl.prototype,"scaleY",void 0),Qt([$n(0,!0)],pl.prototype,"rotation",void 0),Qt([$n(0,!0)],pl.prototype,"skewX",void 0),Qt([$n(0,!0)],pl.prototype,"skewY",void 0),Qt([Kn(0,!0)],pl.prototype,"offsetX",void 0),Qt([Kn(0,!0)],pl.prototype,"offsetY",void 0),Qt([qn(0,!0)],pl.prototype,"scrollX",void 0),Qt([qn(0,!0)],pl.prototype,"scrollY",void 0),Qt([Zn()],pl.prototype,"origin",void 0),Qt([Zn()],pl.prototype,"around",void 0),Qt([Gn(!1)],pl.prototype,"lazy",void 0),Qt([to(1)],pl.prototype,"pixelRatio",void 0),Qt([ao(0)],pl.prototype,"renderSpread",void 0),Qt([io()],pl.prototype,"path",void 0),Qt([so()],pl.prototype,"windingRule",void 0),Qt([so(!0)],pl.prototype,"closed",void 0),Qt([Qn(0)],pl.prototype,"padding",void 0),Qt([Qn(!1)],pl.prototype,"lockRatio",void 0),Qt([Qn()],pl.prototype,"widthRange",void 0),Qt([Qn()],pl.prototype,"heightRange",void 0),Qt([Gn(!1)],pl.prototype,"draggable",void 0),Qt([Gn()],pl.prototype,"dragBounds",void 0),Qt([Gn("auto")],pl.prototype,"dragBoundsType",void 0),Qt([Gn(!1)],pl.prototype,"editable",void 0),Qt([yo(!0)],pl.prototype,"hittable",void 0),Qt([yo("path")],pl.prototype,"hitFill",void 0),Qt([ro("path")],pl.prototype,"hitStroke",void 0),Qt([yo(!1)],pl.prototype,"hitBox",void 0),Qt([yo(!0)],pl.prototype,"hitChildren",void 0),Qt([yo(!0)],pl.prototype,"hitSelf",void 0),Qt([yo()],pl.prototype,"hitRadius",void 0),Qt([mo("")],pl.prototype,"cursor",void 0),Qt([ho()],pl.prototype,"fill",void 0),Qt([ro(void 0,!0)],pl.prototype,"stroke",void 0),Qt([ro("inside")],pl.prototype,"strokeAlign",void 0),Qt([ro(1,!0)],pl.prototype,"strokeWidth",void 0),Qt([ro(!1)],pl.prototype,"strokeWidthFixed",void 0),Qt([ro("none")],pl.prototype,"strokeCap",void 0),Qt([ro("miter")],pl.prototype,"strokeJoin",void 0),Qt([ro()],pl.prototype,"dashPattern",void 0),Qt([ro(0)],pl.prototype,"dashOffset",void 0),Qt([ro(10)],pl.prototype,"miterLimit",void 0),Qt([so(0)],pl.prototype,"cornerRadius",void 0),Qt([so()],pl.prototype,"cornerSmoothing",void 0),Qt([xh()],pl.prototype,"shadow",void 0),Qt([xh()],pl.prototype,"innerShadow",void 0),Qt([xh()],pl.prototype,"blur",void 0),Qt([xh()],pl.prototype,"backgroundBlur",void 0),Qt([xh()],pl.prototype,"grayscale",void 0),Qt([xh()],pl.prototype,"filter",void 0),Qt([ho()],pl.prototype,"placeholderColor",void 0),Qt([Gn(100)],pl.prototype,"placeholderDelay",void 0),Qt([Gn({})],pl.prototype,"data",void 0),Qt([So(Na.prototype.reset)],pl.prototype,"reset",null),pl=_l=Qt([To(rl),To(dl),Bo()],pl);let gl=class extends pl{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var fl;Qt([vo(Uh)],gl.prototype,"__",void 0),Qt([Qn(0)],gl.prototype,"width",void 0),Qt([Qn(0)],gl.prototype,"height",void 0),gl=Qt([To(Za),Co()],gl);const yl=It.get("Leafer");let ml=fl=class extends gl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Ln.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),fl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const n=this.canvas=Ut.canvas(s);this.__controllers.push(this.renderer=Ut.renderer(this,n,s),this.watcher=Ut.watcher(this,s),this.layouter=Ut.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=n.view,e||(this.selector=Ut.selector(this),this.interaction=Ut.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Ut.hitCanvasManager()),this.canvasManager=new $t,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),nr.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Pr.RESTART):this.emitLeafer(Pr.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Pr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,ue);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=f.copyAttrs({},this.canvas,ue);e.resize(t),this.updateLazyBounds(),this.__onResize(new Rr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ue),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new Mt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ue.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ue.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=f.copyAttrs({},this.canvas,ue);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Pr.BEFORE_READY),this.emitLeafer(Pr.READY),this.emitLeafer(Pr.AFTER_READY),nr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Pr.VIEW_READY),nr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){nr.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Pr.VIEW_COMPLETED),nr.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Vt.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Pr(t,this))}__listenEvents(){const t=Yt.start("FirstCreate "+this.innerName);this.once([[Pr.START,()=>Yt.end(t)],[Cr.START,this.updateLazyBounds,this],[Or.START,this.__onCreated,this],[Or.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Tr.DATA,this.__onWatchData,this],[Cr.END,this.__onLayoutEnd,this],[Or.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){fl.list.remove(this);try{this.stop(),this.emitLeafer(Pr.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Mn.clearRecycled()},100)}catch(t){yl.error(t)}}};t?e():setTimeout(e)}};ml.list=new Ja,Qt([vo(Gh)],ml.prototype,"__",void 0),Qt([Qn()],ml.prototype,"pixelRatio",void 0),ml=fl=Qt([Co()],ml);let vl=class extends pl{get __tag(){return"Rect"}constructor(t){super(t)}};Qt([vo(Zh)],vl.prototype,"__",void 0),vl=Qt([To(ul),Bo(),Co()],vl);const{add:wl,includes:xl,scroll:bl}=Tt,kl=vl.prototype,El=gl.prototype;let Sl=class extends gl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(wl(a,o),bl(a,i)),this.__updateRectRenderBounds(),t=!xl(o,a),t&&"show"===r&&wl(n,a)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};Qt([vo(jh)],Sl.prototype,"__",void 0),Qt([Qn(100)],Sl.prototype,"width",void 0),Qt([Qn(100)],Sl.prototype,"height",void 0),Qt([Gn(!1)],Sl.prototype,"resizeChildren",void 0),Qt([ao("show")],Sl.prototype,"overflow",void 0),Qt([So(kl.__updateStrokeSpread)],Sl.prototype,"__updateStrokeSpread",null),Qt([So(kl.__updateRenderSpread)],Sl.prototype,"__updateRectRenderSpread",null),Qt([So(kl.__updateBoxBounds)],Sl.prototype,"__updateRectBoxBounds",null),Qt([So(kl.__updateStrokeBounds)],Sl.prototype,"__updateStrokeBounds",null),Qt([So(kl.__updateRenderBounds)],Sl.prototype,"__updateRectRenderBounds",null),Qt([So(kl.__updateChange)],Sl.prototype,"__updateRectChange",null),Qt([So(kl.__render)],Sl.prototype,"__renderRect",null),Qt([So(El.__render)],Sl.prototype,"__renderGroup",null),Sl=Qt([Bo(),Co()],Sl);let Bl=class extends Sl{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}};Qt([vo(Kh)],Bl.prototype,"__",void 0),Qt([ho("#FFFFFF")],Bl.prototype,"fill",void 0),Qt([ao("hide")],Bl.prototype,"overflow",void 0),Bl=Qt([Co()],Bl);const{moveTo:Rl,closePath:Tl,ellipse:Cl}=ns;let Ol=class extends pl{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Cl(h,r,a,r*s,a*s,0,n,o,!1),Cl(h,r,a,r,a,0,o,n,!0),s<1&&Tl(h)):(s<1&&(Cl(h,r,a,r*s,a*s),Rl(h,e,a)),Cl(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Rl(h,r,a),Cl(h,r,a,r,a,0,n,o,!1),Tl(h)):Cl(h,r,a,r,a)}};Qt([vo(Jh)],Ol.prototype,"__",void 0),Qt([so(0)],Ol.prototype,"innerRadius",void 0),Qt([so(0)],Ol.prototype,"startAngle",void 0),Qt([so(0)],Ol.prototype,"endAngle",void 0),Ol=Qt([Co()],Ol);const{moveTo:Pl,lineTo:Ll,drawPoints:Al}=ns,{rotate:Ml,getAngle:Dl,getDistance:Fl,defaultPoint:Il}=K,{toBounds:Wl}=gn;let zl=class extends pl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Ml(i,e),i}set toPoint(t){this.width=Fl(Il,t),this.rotation=Dl(Il,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?Al(e,t.points,!1,t.closed):(Pl(e,0,0),Ll(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(Al(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&Th.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Wl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}};Qt([vo(qh)],zl.prototype,"__",void 0),Qt([no("center")],zl.prototype,"strokeAlign",void 0),Qt([Qn(0)],zl.prototype,"height",void 0),Qt([so()],zl.prototype,"points",void 0),Qt([so(0)],zl.prototype,"curve",void 0),Qt([so(!1)],zl.prototype,"closed",void 0),zl=Qt([Co()],zl);const{sin:Nl,cos:Yl,PI:Hl}=Math,{moveTo:Xl,lineTo:Vl,closePath:Ul,drawPoints:jl}=ns,Gl=zl.prototype;let Kl=class extends pl{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)jl(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,o=i/2;Xl(t,n,0);for(let e=1;e<s;e++)Vl(t,n+n*Nl(2*e*Hl/s),o-o*Yl(2*e*Hl/s));Ul(t)}}__updateRenderPath(){}__updateBoxBounds(){}};Qt([vo($h)],Kl.prototype,"__",void 0),Qt([so(3)],Kl.prototype,"sides",void 0),Qt([so()],Kl.prototype,"points",void 0),Qt([so(0)],Kl.prototype,"curve",void 0),Qt([So(Gl.__updateRenderPath)],Kl.prototype,"__updateRenderPath",null),Qt([So(Gl.__updateBoxBounds)],Kl.prototype,"__updateBoxBounds",null),Kl=Qt([Bo(),Co()],Kl);const{sin:ql,cos:Zl,PI:Jl}=Math,{moveTo:$l,lineTo:Ql,closePath:td}=ns;let ed=class extends pl{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];$l(r,n,0);for(let t=1;t<2*i;t++)Ql(r,n+(t%2==0?n:n*s)*ql(t*Jl/i),o-(t%2==0?o:o*s)*Zl(t*Jl/i));td(r)}};Qt([vo(Qh)],ed.prototype,"__",void 0),Qt([so(5)],ed.prototype,"corners",void 0),Qt([so(.382)],ed.prototype,"innerRadius",void 0),ed=Qt([Co()],ed);let id=class extends vl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}constructor(t){super(t)}};Qt([vo(nl)],id.prototype,"__",void 0),Qt([Qn("")],id.prototype,"url",void 0),id=Qt([Co()],id);const sd=id;let nd=class extends vl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Ut.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Nn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new wr(wr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new et(t.worldTransform).invert(),o=new et;e&&o.translate(e.x,e.y),i&&(l(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};Qt([vo(ol)],nd.prototype,"__",void 0),Qt([bh(100)],nd.prototype,"width",void 0),Qt([bh(100)],nd.prototype,"height",void 0),Qt([bh(1)],nd.prototype,"pixelRatio",void 0),Qt([bh(!0)],nd.prototype,"smooth",void 0),Qt([Gn(!1)],nd.prototype,"safeResize",void 0),Qt([bh()],nd.prototype,"contextSettings",void 0),nd=Qt([Co()],nd);const{copyAndSpread:od,includes:rd,spread:ad,setList:hd}=Tt;let ld=class extends pl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Rh.number(e,n),t.__letterSpacing=Rh.number(i,n),t.__padding=l?b.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Sh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&ad(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!rd(h,a)),this.isOverflow?(hd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;od(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Qt([vo(sl)],ld.prototype,"__",void 0),Qt([Qn(0)],ld.prototype,"width",void 0),Qt([Qn(0)],ld.prototype,"height",void 0),Qt([ho()],ld.prototype,"boxStyle",void 0),Qt([Gn(!1)],ld.prototype,"resizeFontSize",void 0),Qt([ho("#000000")],ld.prototype,"fill",void 0),Qt([no("outside")],ld.prototype,"strokeAlign",void 0),Qt([yo("all")],ld.prototype,"hitFill",void 0),Qt([Qn("")],ld.prototype,"text",void 0),Qt([Qn("")],ld.prototype,"placeholder",void 0),Qt([Qn("caption")],ld.prototype,"fontFamily",void 0),Qt([Qn(12)],ld.prototype,"fontSize",void 0),Qt([Qn("normal")],ld.prototype,"fontWeight",void 0),Qt([Qn(!1)],ld.prototype,"italic",void 0),Qt([Qn("none")],ld.prototype,"textCase",void 0),Qt([Qn("none")],ld.prototype,"textDecoration",void 0),Qt([Qn(0)],ld.prototype,"letterSpacing",void 0),Qt([Qn({type:"percent",value:1.5})],ld.prototype,"lineHeight",void 0),Qt([Qn(0)],ld.prototype,"paraIndent",void 0),Qt([Qn(0)],ld.prototype,"paraSpacing",void 0),Qt([Qn("x")],ld.prototype,"writingMode",void 0),Qt([Qn("left")],ld.prototype,"textAlign",void 0),Qt([Qn("top")],ld.prototype,"verticalAlign",void 0),Qt([Qn(!0)],ld.prototype,"autoSizeAlign",void 0),Qt([Qn("normal")],ld.prototype,"textWrap",void 0),Qt([Qn("show")],ld.prototype,"textOverflow",void 0),Qt([ho(!1)],ld.prototype,"textEditing",void 0),ld=Qt([Co()],ld);let dd=class extends pl{get __tag(){return"Path"}constructor(t){super(t)}};Qt([vo(tl)],dd.prototype,"__",void 0),Qt([no("center")],dd.prototype,"strokeAlign",void 0),dd=Qt([Co()],dd);let cd=class extends gl{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new dd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};Qt([vo(el)],cd.prototype,"__",void 0),Qt([(t,e)=>{Yn(t,e,{get(){return this.__path}})}],cd.prototype,"path",void 0),cd=Qt([To(xs,["set","path","paint"]),Co()],cd);let ud=class extends ml{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&Ut.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new ml(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ue),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Cr.END,this.__onReady,this],[Or.START,this.__onCreated,this],[Or.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Or.END,this.__onChildRenderEnd,this))}};ud=Qt([Co()],ud);const _d={},pd={isHoldSpaceKey:()=>pd.isHold("Space"),isHold:t=>_d[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){_d[t]||(_d[t]=!0)},setUpCode(t){_d[t]=!1}},gd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class fd extends gr{get spaceKey(){return pd.isHoldSpaceKey()}get left(){return gd.left(this)}get right(){return gd.right(this)}get middle(){return gd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return pd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){Zt.changeName(t,e)}}let yd=class extends fd{};yd.POINTER="pointer",yd.BEFORE_DOWN="pointer.before_down",yd.BEFORE_MOVE="pointer.before_move",yd.BEFORE_UP="pointer.before_up",yd.DOWN="pointer.down",yd.MOVE="pointer.move",yd.UP="pointer.up",yd.OVER="pointer.over",yd.OUT="pointer.out",yd.ENTER="pointer.enter",yd.LEAVE="pointer.leave",yd.TAP="tap",yd.DOUBLE_TAP="double_tap",yd.CLICK="click",yd.DOUBLE_CLICK="double_click",yd.LONG_PRESS="long_press",yd.LONG_TAP="long_tap",yd.MENU="pointer.menu",yd.MENU_TAP="pointer.menu_tap",yd=Qt([Oo()],yd);const md=yd,vd={};let wd=class extends yd{static setList(t){this.list=t instanceof Ja?t:new Ja(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return K.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),al.axisMove(t,n),n}static limitMove(t,e){al.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(vd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(vd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(vd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Tt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Tt.unsign(i),i}assignMove(t){vd.x=t?this.totalX:this.moveX,vd.y=t?this.totalY:this.moveY}};wd.BEFORE_DRAG="drag.before_drag",wd.START="drag.start",wd.DRAG="drag",wd.END="drag.end",wd.OVER="drag.over",wd.OUT="drag.out",wd.ENTER="drag.enter",wd.LEAVE="drag.leave",wd=Qt([Oo()],wd);const xd=wd;let bd=class extends yd{static setList(t){wd.setList(t)}static setData(t){wd.setData(t)}};bd.DROP="drop",bd=Qt([Oo()],bd);let kd=class extends wd{};kd.BEFORE_MOVE="move.before_move",kd.START="move.start",kd.MOVE="move",kd.END="move.end",kd=Qt([Oo()],kd);let Ed=class extends yd{};Ed.BEFORE_ROTATE="rotate.before_rotate",Ed.START="rotate.start",Ed.ROTATE="rotate",Ed.END="rotate.end",Ed=Qt([Oo()],Ed);let Sd=class extends wd{};Sd.SWIPE="swipe",Sd.LEFT="swipe.left",Sd.RIGHT="swipe.right",Sd.UP="swipe.up",Sd.DOWN="swipe.down",Sd=Qt([Oo()],Sd);let Bd=class extends yd{};Bd.BEFORE_ZOOM="zoom.before_zoom",Bd.START="zoom.start",Bd.ZOOM="zoom",Bd.END="zoom.end",Bd=Qt([Oo()],Bd);let Rd=class extends fd{};Rd.BEFORE_DOWN="key.before_down",Rd.BEFORE_UP="key.before_up",Rd.DOWN="key.down",Rd.HOLD="key.hold",Rd.UP="key.up",Rd=Qt([Oo()],Rd);const Td={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Sd.UP:t>45&&t<135?Sd.DOWN:t<=45&&t>=-45?Sd.RIGHT:Sd.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Cd.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Ja,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>Ho.draggable(t)||!t.isLeafer&&t.hasEvent(wd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Cd=Td,Od=new Ja,{getDragEventData:Pd,getDropEventData:Ld,getSwipeEventData:Ad}=Td;class Md{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Pd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=wd.list||this.draggableList||Od;return this.dragging&&(s?t?Od:new Ja(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(kd.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&gd.left(t),this.dragging&&(this.interaction.emit(wd.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],Ho.draggable(e)){this.draggableList=new Ja(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=Pd(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",e.emit(kd.BEFORE_MOVE,this.dragData),e.emit(kd.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(wd.BEFORE_DRAG,this.dragData),e.emit(wd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,r=!o||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=wd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},r||s);o&&!s&&t?Ho.animateMove(e,h,l(o)?o:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(wd.OUT,t,i),e.emit(wd.OVER,t,s)):e.emit(wd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(wd.LEAVE,t,i,s),e.emit(wd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=Pd(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(kd.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(wd.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(K.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Ad(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Ld(t,e,wd.data);s.path=i,this.interaction.emit(bd.DROP,s),this.interaction.emit(wd.LEAVE,t,i)}dragReset(){wd.list=wd.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Dd=It.get("emit");const Fd=["move","zoom","rotate","key"];function Id(t,e,i,s,n){if(Fd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!zd(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&Wd(o,e,i,s,n)}}function Wd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!zd(t,n)&&(Dh.updateEventStyle&&!s&&Dh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=Zt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function zd(t,e){return e&&e.has(t)}const Nd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Yd,pathCanDrag:Hd,pathHasOutside:Xd}=Td;class Vd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&gd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&gd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&pd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Nd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ja(t),this.createTransformer(),this.dragger=new Md(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(gd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(yd.BEFORE_DOWN,t),this.emit(yd.DOWN,t),gd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=gd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&gd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(yd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=K.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(yd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;gd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(yd.BEFORE_UP,t),this.emit(yd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(yd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(yd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Rd.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,pd.setDownCode(e),this.emit(Rd.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Rd.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Rd.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,pd.setUpCode(e),this.emit(Rd.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Ja),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(yd.OUT,t,i),this.emit(yd.OVER,t,e)):this.emit(yd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(yd.LEAVE,t,i,e),this.emit(yd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(yd.LEAVE,t),this.dragger.dragging&&this.emit(bd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[yd.DOUBLE_TAP,yd.DOUBLE_CLICK].some(e=>Yd(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:o,name:e.type},i||{through:n}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Xd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Hd(t.path))&&!Xd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:yd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&K.round(s),s}emitTap(t){this.emit(yd.TAP,t),this.emit(yd.CLICK,t)}emitDoubleTap(t){this.emit(yd.DOUBLE_TAP,t),this.emit(yd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(yd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(yd.LONG_TAP,t),(Yd(t.path,yd.LONG_TAP)||Yd(t.path,yd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Lt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Rr.RESIZE,this.__onResize,this)],t.once(Pr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],Wd(n,t,e,!0,s))return;n.isApp&&Id(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Id(n,t,e,!1,s),Wd(n,t,e,!1,s))return}catch(t){Dd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Ud{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ud.custom={};class jd extends $t{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ja,this.pixelList=new Ja}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Ut.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Ut.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Ut.selector())};const{toInnerRadiusPointOf:Gd,copy:Kd,setRadius:qd}=K,{hitRadiusPoint:Zd,hitPoint:Jd}=Tt,$d={},Qd={},tc=Na.prototype;tc.hit=function(e,i=0){this.updateLayout(),Kd(Qd,e),qd(Qd,i);const s=this.__world;return!!(i?Zd(s,Qd):Jd(s,Qd))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},Qd),i,{target:this}):this.__hitWorld(Qd))},tc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Kd($d,t),qd(t=$d,e.hitRadius)),Gd(t,i,$d),e.hitBox||n){if(Tt.hitRadiusPoint(s.boxBounds,$d))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit($d)},tc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},tc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},tc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},tc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ec=new et,ic=pl.prototype;ic.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,n=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,o=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=n||o;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,r=a.hitScale=At.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=At.set(e).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Mn.patternLocked=!0,this.__renderShape(a,{matrix:ec.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!o}),Mn.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},ic.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const sc=pl.prototype,nc=vl.prototype,oc=Sl.prototype;nc.__updateHitCanvas=oc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?sc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},nc.__hitFill=oc.__hitFill=function(t){return this.__hitCanvas?sc.__hitFill.call(this,t):Tt.hitRadiusPoint(this.__layout.boxBounds,t)},ld.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},gl.prototype.pick=function(e,i){return i||(i=n),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const rc=_e.prototype;function ac(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,o)))}}function hc(t,e){t.__.__font?ac(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function lc(t,e,i){switch(e.__.strokeAlign){case"center":dc(t,1,e,i);break;case"inside":cc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?dc(t,2,e,i):cc(t,"outside",e,i)}}function dc(t,e,i,s){const n=i.__;_(t)?_c(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),uc(i,s))}function cc(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,dc(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",ac(i,n),n.blendMode="normal",Ho.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function uc(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(o){const{decorationHeight:t}=s;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function _c(t,e,i,s,n){let o;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||n.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!Oh.checkImage(s,n,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?n.setStroke(o.style,r.__getRealStrokeWidth(t)*e,r,t):n.setStroke(o.style,r.__strokeWidth*e,r)}else n.strokeStyle=o.style;o.blendMode?(n.saveBlendMode(o.blendMode),i?uc(s,n):n.stroke(),n.restoreBlendMode()):i?uc(s,n):n.stroke()}}function pc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)lc(t,e,i);else switch(s.strokeAlign){case"center":gc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),gc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)gc(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),gc(t,2,e,o),o.clipUI(s),o.clearWorld(n),Ho.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i)}}function gc(t,e,i,s){const n=i.__;_(t)?_c(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Ch.strokeArrow(t,i,s)}rc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},rc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},rc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),At.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(At.x,At.y,At.width||1,At.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:fc,getOuterOf:yc,getByMove:mc,getIntersectData:vc}=Tt;let wc;const{stintSet:xc}=f,{hasTransparent:bc}=Bh;function kc(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Oh.image(i,t,e,n,!wc||!wc[e.url]);break;case"linear":s=Ph.linearGradient(e,n);break;case"radial":s=Ph.radialGradient(e,n);break;case"angular":s=Ph.conicGradient(e,n);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:Bh.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:Bh.string(e)})}if(s){if(a(s.style)&&bc(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const Ec={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];u(a)||(a=[a]),wc=Oh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=kc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(xc(i,"__isAlphaPixelFill",n),xc(i,"__isTransparentFill",o)):(xc(i,"__isAlphaPixelStroke",n),xc(i,"__isTransparentStroke",o),xc(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,hc(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(Oh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),hc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),hc(e,i),i.restoreBlendMode()):hc(e,i)}},fillPathOrText:hc,fillText:ac,stroke:pc,strokes:function(t,e,i){pc(t,e,i)},strokeText:lc,drawTextStroke:uc,shape:function(e,i,s){const n=i.getSameCanvas(),o=e.__nowWorld,r=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=e.getRenderScaleData(!0);if(r.includes(o))c=n,a=d=o;else{const{renderShapeSpread:n}=e.__layout;let p;if(t.fullImageShadow)p=o;else{const t=n?fc(r,u===_?n*u:[n*_,n*u]):r;p=vc(t,o)}l=r.getFitMatrix(p);let{a:g,d:f}=l;l.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,s),u*=g,_*=f),d=yc(o,l),a=mc(d,-l.e,-l.f);const y=s.matrix;y?(h=new et(l),h.multiply(y),g*=y.scaleX,f*=y.scaleY):h=l,h.withScale(g,f),s=Object.assign(Object.assign({},s),{matrix:h})}return e.__renderShape(n,s),{canvas:n,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let Sc={},Bc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Rc,rotateOfOuter:Tc,translate:Cc,scaleOfOuter:Oc,multiplyParent:Pc,scale:Lc,rotate:Ac,skew:Mc}=I;function Dc(t,e,i,s,n,o,r){const a=Rc();Cc(a,e.x+i,e.y+s),Lc(a,n,o),r&&Tc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Fc(t,e,i,s,n,o,r,a,h){const l=Rc();Wc(l,e,i,s,n,o,r,a),h&&(Bc.a=e.width/h.width,Bc.d=e.height/h.height,Pc(l,Bc)),t.transform=l}function Ic(t,e,i,s,n,o,r,a,h,l,d,c){const u=Rc();if(c)Wc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Tc(u,{x:i/2,y:s/2},h);else switch(Ac(u,h),h){case 90:Cc(u,s,0);break;case 180:Cc(u,i,s);break;case 270:Cc(u,0,i)}Sc.x=e.x+n,Sc.y=e.y+o,Cc(u,Sc.x,Sc.y),r&&Oc(u,Sc,r,a)}t.transform=u}function Wc(t,e,i,s,n,o,r,a){r&&Ac(t,r),a&&Mc(t,a.x,a.y),n&&Lc(t,n,o),Cc(t,e.x+i,e.y+s)}const{get:zc,translate:Nc}=I,Yc=new Lt,Hc={},Xc={};function Vc(t,e,i,s){const{changeful:n,sync:o,scaleFixed:r}=i;n&&(t.changeful=n),o&&(t.sync=o),r&&(t.scaleFixed=r),t.data=Uc(i,s,e)}function Uc(t,e,i){t.padding&&(e=Yc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==h&&(u||0)%180==90;let k,E;switch(Tt.set(Xc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(b.getScaleData(d,c,i,Hc),k=Hc.scaleX,E=Hc.scaleY),(h||y||f)&&(k&&Tt.scale(Xc,k,E,!0),h&&ct.toPoint(h,Xc,e,Xc,!0,!0))):v&&!u||(k=E=Tt.getFitScale(e,Xc,"fit"!==r),Tt.put(e,i,h,k,!1,Xc),Tt.scale(Xc,k,E,!0)),l&&K.move(Xc,l),r){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(Xc.x||Xc.y||k||g||u||p)&&Fc(w,e,Xc.x,Xc.y,k,E,u,p,t.clipSize);break;case"repeat":(!v||k||u||p)&&Ic(w,e,s,n,Xc.x,Xc.y,k,E,u,p,h,t.freeTransform),f||(w.repeat="repeat");const i=_(f);(y||i)&&(w.gap=function(t,e,i,s,n){let o,r;_(t)?(o=t.x,r=t.y):o=r=t;return{x:jc(o,i,n.width,e&&e.x),y:jc(r,s,n.height,e&&e.y)}}(y,i&&f,Xc.width,Xc.height,e));break;default:k&&Dc(w,e,Xc.x,Xc.y,k,E,u)}return w.transform||(e.x||e.y)&&(w.transform=zc(),Nc(w.transform,e.x,e.y)),k&&"stretch"!==r&&(w.scaleX=k,w.scaleY=E),w.width=s,w.height=n,o&&(w.opacity=o),m&&(w.filters=m),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function jc(t,e,i,s){const n=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Gc,Kc=new Lt;const{isSame:qc}=Tt;function Zc(t,e,i,s,n,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Vc(n,s,i,o),!0}function Jc(t,e){tu(t,wr.LOAD,e)}function $c(t,e){tu(t,wr.LOADED,e)}function Qc(t,e,i){e.error=i,t.forceUpdate("surface"),tu(t,wr.ERROR,e)}function tu(t,e,i){t.hasEvent(e)&&t.emitEvent(new wr(e,i))}function eu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:iu,scale:su,copy:nu}=I,{floor:ou,max:ru,abs:au}=Math;function hu(e,i,s){let{scaleX:n,scaleY:o}=e.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+o+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:e,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:g,gap:f}=a;n*=s,o*=s;const y=f&&f.x*n,m=f&&f.y*o;u&&(u=au(u),_=au(_),l=iu(),nu(l,p),su(l,1/u,1/_),n*=u,o*=_),d*=n,c*=o;const v=d*c;if(!g&&v>t.image.maxCacheSize)return!1;let w=t.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;w>t&&(w=t)}if(v>w&&(h=Math.sqrt(v/w)),h&&(n/=h,o/=h,d/=h,c/=h),u&&(n/=u,o/=_),(p||1!==n||1!==o)&&(l||(l=iu(),p&&nu(l,p)),su(l,1/n,1/o)),l){const t=d+(y||0),e=c+(m||0);su(l,t/ru(ou(t),1),e/ru(ou(e),1))}const x=e.getCanvas(d,c,a.opacity,a.filters,y,m),b=e.getPattern(x,g||t.origin.noRepeat||"no-repeat",l,i);return i.style=b,i.patternId=r,!0}}const lu={image:function(t,e,i,s,n){let o,r;const a=Mn.get(i);return Gc&&i===Gc.paint&&qc(s,Gc.boxBounds)?o=Gc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Gc=a.use>1?{leafPaint:o,paint:i,boxBounds:Kc.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Zc(t,e,i,a,o,s),n&&(Jc(t,r),$c(t,r))):a.error?n&&Qc(t,r,a.error):(n&&(eu(t,!0),Jc(t,r)),o.loadId=a.load(()=>{eu(t,!1),t.destroyed||(Zc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),$c(t,r)),o.loadId=void 0},e=>{eu(t,!1),Qc(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(e,i,s,n){const{scaleX:o,scaleY:r}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!Mh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===t.name&&Rr.isResizing(e)||Mh.running)){let{width:e,height:i}=h;e*=o*a,i*=r*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),n=e*i>t.image.maxCacheSize}return n?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||Mh.running?hu(e,s,a):s.patternTask||(s.patternTask=Mn.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&hu(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:hu,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,Mn.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createData:Vc,getPatternData:Uc,fillOrFitMode:Dc,clipMode:Fc,repeatMode:Ic},{toPoint:du}=ht,{hasTransparent:cu}=Bh,uu={},_u={};function pu(t,e,i,s){if(i){let n,o,r,h;for(let t=0,l=i.length;t<l;t++)n=i[t],a(n)?(r=t/(l-1),o=Bh.string(n,s)):(r=n.offset,o=Bh.string(n.color,s)),e.addColorStop(r,o),!h&&cu(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:gu,getDistance:fu}=K,{get:yu,rotateOfOuter:mu,scaleOfOuter:vu}=I,{toPoint:wu}=ht,xu={},bu={};function ku(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=gu(e,i);o=yu(),n?(vu(o,e,r/a*(s||1),1),mu(o,e,t+90)):(vu(o,e,1,r/a*(s||1)),mu(o,e,t))}return o}const{getDistance:Eu}=K,{toPoint:Su}=ht,Bu={},Ru={};const Tu={linearGradient:function(e,i){let{from:s,to:n,type:o,opacity:r}=e;du(s||"top",i,uu),du(n||"bottom",i,_u);const a=t.canvas.createLinearGradient(uu.x,uu.y,_u.x,_u.y),h={type:o,style:a};return pu(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=e;wu(s||"center",i,xu),wu(n||"bottom",i,bu);const h=t.canvas.createRadialGradient(xu.x,xu.y,0,xu.x,xu.y,fu(xu,bu)),l={type:o,style:h};pu(l,h,e.stops,r);const d=ku(i,xu,bu,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=e;Su(s||"center",i,Bu),Su(n||"bottom",i,Ru);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Bu.x,Bu.y):t.canvas.createRadialGradient(Bu.x,Bu.y,0,Bu.x,Bu.y,Eu(Bu,Ru)),l={type:o,style:h};pu(l,h,e.stops,r);const d=ku(i,Bu,Ru,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:ku},{copy:Cu,toOffsetOutBounds:Ou}=Tt,Pu={},Lu={};function Au(e,i,s,n){const{bounds:o,shapeBounds:r}=n;if(t.fullImageShadow){if(Cu(Pu,e.bounds),Pu.x+=i.x-r.x,Pu.y+=i.y-r.y,s){const{fitMatrix:t}=n;Pu.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Pu.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Pu.width*=s,Pu.height*=s}e.copyWorld(n.canvas,e.bounds,Pu)}else s&&(Cu(Pu,i),Pu.x-=i.width/2*(s-1),Pu.y-=i.height/2*(s-1),Pu.width*=s,Pu.height*=s),e.copyWorld(n.canvas,r,s?Pu:i)}const{toOffsetOutBounds:Mu}=Tt,Du={};const Fu={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Ou(l,Lu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Lu.offsetX+a.x*c*f,Lu.offsetY+a.y*u*f,a.blur*c*f,Bh.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Au(_,Lu,n,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),s=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),Ho.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Mu(l,Du),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Du.offsetX+a.x*c*f,Du.offsetY+a.y*u*f,a.blur*c*f),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Au(_,Du,n,i),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),s=o):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Bh.string(a.color),"source-in"),Ho.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Iu}=Zo;let Wu;function zu(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Wu||(Wu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);Yu(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":Yu(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Nu(t){return t.getSameCanvas(!1,!0)}function Yu(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}gl.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(zu(this,r,t,n,s,o,void 0,!0),s=n=null),o=i.__.opacity,Wu=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Nu(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Nu(t)),n||(n=Nu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||Iu(i,e)||i.__render(t,e);continue}const d=1===o&&i.__.__blendMode;d&&zu(this,r,t,n,s,o,void 0,!1),Iu(i,e)||i.__render(n||t,e),d&&zu(this,r,t,n,s,o,d,!1)}zu(this,r,t,n,s,o,void 0,!0)};const Hu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Xu=Hu+"_#~&*+\\=|≮≯≈≠=…",Vu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Uu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const ju=Uu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Gu=Uu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ku=Uu(Hu),qu=Uu(Xu),Zu=Uu("- —/~|┆·");var Ju;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Ju||(Ju={}));const{Letter:$u,Single:Qu,Before:t_,After:e_,Symbol:i_,Break:s_}=Ju;function n_(t){return ju[t]?$u:Zu[t]?s_:Gu[t]?t_:Ku[t]?e_:qu[t]?i_:Vu.test(t)?Qu:$u}const o_={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function r_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:a_}=o_,{Letter:h_,Single:l_,Before:d_,After:c_,Symbol:u_,Break:__}=Ju;let p_,g_,f_,y_,m_,v_,w_,x_,b_,k_,E_,S_,B_,R_,T_,C_,O_,P_=[];function L_(t,e){b_&&!x_&&(x_=b_),p_.data.push({char:t,width:e}),f_+=e}function A_(){y_+=f_,p_.width=f_,g_.words.push(p_),p_={data:[]},f_=0}function M_(){R_&&(T_.paraNumber++,g_.paraStart=!0,R_=!1),b_&&(g_.startCharSize=x_,g_.endCharSize=b_,x_=0),g_.width=y_,C_.width?a_(g_):O_&&D_(),P_.push(g_),g_={words:[]},y_=0}function D_(){y_>(T_.maxWidth||0)&&(T_.maxWidth=y_)}const{top:F_,right:I_,bottom:W_,left:z_}=ot;function N_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const Y_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(o?(s=d[z_],o-=d[I_]+d[z_]):i.autoSizeAlign||(s=d[z_]),r?(n=d[F_],r-=d[F_]+d[W_]):i.autoSizeAlign||(n=d[F_]));const c={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){T_=e,P_=e.rows,C_=e.bounds,O_=!C_.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=C_;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;R_=!0,E_=null,x_=w_=b_=f_=y_=0,p_={data:[]},g_={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)v_=i[s],"\n"===v_?(f_&&A_(),g_.paraEnd=!0,M_(),R_=!0):(k_=n_(v_),k_===h_&&"none"!==r&&(v_=r_(v_,r,!f_)),w_=a.measureText(v_).width,n&&(n<0&&(b_=w_),w_+=n),S_=k_===l_&&(E_===l_||E_===h_)||E_===l_&&k_!==c_,B_=!(k_!==d_&&k_!==l_||E_!==u_&&E_!==c_),m_=R_&&o?h-o:h,t&&h&&y_+f_+w_>m_&&(e?(f_&&A_(),y_&&M_()):(B_||(B_=k_===h_&&E_==c_),S_||B_||k_===__||k_===d_||k_===l_||f_+w_>m_?(f_&&A_(),y_&&M_()):y_&&M_()))," "===v_&&!0!==R_&&y_+f_===0||(k_===__?(" "===v_&&f_&&A_(),L_(v_,w_),A_()):S_||B_?(f_&&A_(),L_(v_,w_)):L_(v_,w_)),E_=k_);f_&&A_(),y_&&M_(),P_.length>0&&(P_[P_.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{T_.paraNumber++,y_=a.measureText(t).width,P_.push({x:o||0,text:t,width:y_,paraStart:!0}),O_&&D_()})}(c,e,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":N_(e,"x",t[z_]);break;case"right":N_(e,"x",-t[I_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":N_(e,"y",t[F_]);break;case"bottom":N_(e,"y",-t[W_])}}(d,c,i,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=o*n+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(m+=c),v.y=m,m+=o,t.overflow>r&&m>y&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,o),c.overflow&&function(e,i,s,n){if(!n)return;const{rows:o,overflow:r}=e;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,s,o),"none"!==h&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,_(n)?(i=n.type,n.color&&(t.decorationColor=Bh.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const H_={string:function(t,e){const i=l(e)&&e<1;if(a(t)){if(!i||!Bh.object)return t;t=Bh.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function X_(t){return t?u(t)?t:[t]:[]}Object.assign(Sh,Y_),Object.assign(Bh,H_),Object.assign(Ch,Ec),Object.assign(Oh,lu),Object.assign(Ph,Tu),Object.assign(Lh,Fu),Object.assign(Ut,{interaction:(t,e,i,s)=>new Vd(t,e,i,s),hitCanvas:(t,e)=>new th(t,e),hitCanvasManager:()=>new jd}),ih();class V_ extends gr{get list(){return X_(this.value)}get oldList(){return X_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function U_(t){return(e,i)=>{const s="_"+i;Yn(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){if(this.config){const t="target"===i;if(t){u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(_(i))e=i;else if(!1===i)return}}const s=t?V_.BEFORE_SELECT:V_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new V_(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}V_.BEFORE_SELECT="editor.before_select",V_.SELECT="editor.select",V_.AFTER_SELECT="editor.after_select",V_.BEFORE_HOVER="editor.before_hover",V_.HOVER="editor.hover";const{abs:j_}=Math,{copy:G_,scale:K_}=I,{setListWithFn:q_}=Tt,{worldBounds:Z_}=Zo,J_={a:1,b:0,c:0,d:1,e:0,f:0},$_={x:0,y:0,width:0,height:0};class Q_ extends pl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(q_($_,e,Z_),t&&this.set(t),this.set($_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=j_(c.scaleX),l=j_(c.scaleY);if(G_(J_,c),J_.half=r%2,i!==l){K_(J_,1/i,1/l),t.setWorld(J_,e.matrix),t.beginPath(),n.strokeWidth=r;const{x:o,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,a*l,h*i,d*l)}else t.setWorld(J_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/j_(c.scaleX);o&&(a(o)?Ch.stroke(o,this,t):Ch.strokes(o,this,t)),h&&(a(h)?Ch.fill(h,this,t):Ch.fills(h,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}Qt([U_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],Q_.prototype,"target",void 0);class tp extends gl{constructor(t){super(t),this.strokeArea=new vl({strokeAlign:"center"}),this.fillArea=new vl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const ep={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return ip([t],i,e),i}};function ip(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&ip(s.children,e,i)}}const{findOne:sp,findByBounds:np}=ep;class op extends gl{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Q_,this.targetStroker=new Q_,this.bounds=new Lt,this.selectArea=new tp,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:n}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},n||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new Ja(np(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!sp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ja(this.editor.editBox.rect)};return sp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):sp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[V_.HOVER,this.onHover,this],[V_.SELECT,this.onSelect,this]]),e.on_([[yd.MOVE,this.onPointerMove,this],[yd.BEFORE_DOWN,this.onBeforeDown,this],[yd.TAP,this.onTap,this],[wd.START,this.onDragStart,this,!0],[wd.DRAG,this.onDrag,this],[wd.END,this.onDragEnd,this],[kd.MOVE,this.onAutoMove,this],[[Bd.ZOOM,kd.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:rp,top:ap,topRight:hp,right:lp,bottomRight:dp,bottom:cp,bottomLeft:up,left:_p}=rt,{toPoint:pp}=ht,{within:gp,sign:fp}=b,yp={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:p,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=fp(v),b=fp(w),k=a?v:x*u.width/y,E=a?w:b*u.height/m;s.x*=a?v:x,s.y*=a?w:b;const S=(-s.y+m)/m,B=(s.x+y)/y,R=(s.y+m)/m,T=(-s.x+y)/y;switch(i){case ap:c=S,h="bottom";break;case lp:d=B,h="left";break;case cp:c=R,h="top";break;case _p:d=T,h="right";break;case rp:c=S,d=T,h="bottom-right";break;case hp:c=S,d=B,h="bottom-left";break;case dp:c=R,d=B,h="top-left";break;case up:c=R,d=T,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case ap:case cp:t=c;break;case _p:case lp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const C=1!==d,O=1!==c;if(C&&(d/=k),O&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(pp(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new Lt(t.__localBoxBounds);if(Tt.includes(new Lt(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Tt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;C&&(d*=s),O&&(c*=n)}}if(C&&_){const e=u.width*t.scaleX;d=gp(e*d,_)/e}if(O&&p){const e=u.height*t.scaleY;c=gp(e*c,p)/e}return C&&Math.abs(d*f.width)<1&&(d=fp(d)/f.width),O&&Math.abs(c*f.height)<1&&(c=fp(c)/f.height),n&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case rp:o="bottom-right";break;case hp:o="bottom-left";break;case dp:o="top-left";break;case up:o="top-right";break;default:o="center"}return pp(n||o,t.boxBounds,r,!0),{origin:r,rotation:K.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case ap:case rp:o={x:.5,y:0},n="bottom",a=1;break;case cp:case dp:o={x:.5,y:1},n="top",a=1;break;case _p:case up:o={x:0,y:.5},n="right",h=1;break;case lp:case hp:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,pp(s||n,t,r,!0);const c=K.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case _p:t=lp;break;case rp:t=hp;break;case up:t=dp;break;case lp:t=_p;break;case hp:t=rp;break;case dp:t=up}if(i)switch(t){case ap:t=cp;break;case rp:t=up;break;case hp:t=dp;break;case cp:t=ap;break;case up:t=rp;break;case dp:t=hp}return t}},mp={};function vp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:_,rotateable:p,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&p&&(t.isHoldRotateKey(e)||!_)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?n?u:o?d:c:y?u:f?d:c;h+=45*(yp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(b.formatRotation(h,!0)/2);const{url:v,x:w,y:x}=m,k=v+h;mp[k]?i.cursor=mp[k]:mp[k]=i.cursor={url:xp(v,h),x:w,y:x}}function wp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function xp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class bp extends Sl{constructor(t){super(t),this.useFastShadow=!0}}const kp=["top","right","bottom","left"],Ep=void 0;class Sp extends gl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}constructor(t){super(),this.view=new gl,this.rect=new Sl({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new bp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new gl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new bp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new bp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new bp({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o}=this,{stroke:r,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;this.visible=!t.locked;for(let t=0;t<8;t++)d=o[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;n.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:Ep},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),wp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{middlePoint:c,resizeable:u,rotateable:_,hideOnSmall:p,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Tt.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=l(p)?p:10,w=g&&!(p&&e<y&&f<y);let x,b,k,E={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,E),b=a[i],x=h[i],b.set(E),x.set(E),b.visible=w&&!(!u&&!_),x.visible=w&&_&&u&&!m,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=b.visible&&!v,b.visible=x.visible=w&&!!c,(i+1)/2%2?(k.width=e,p&&2*b.width>e&&(b.visible=!1)):(k.height=f,p&&2*b.width>f&&(b.visible=!1)));o.visible=w&&_&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||g})),r.visible=w&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=kp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=kp.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?yp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:Ep};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:n}=this,{target:o}=this,{moveable:r,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(r&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||this.isHoldRotateKey(t)||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),n.x=t.x,n.y=t.y,n.point={x:o.x,y:o.y},n.bounds=Object.assign({},o.getLayoutBounds("box","local")),n.rotation=o.rotation,i&&i.includes("resize")&&(Rr.resizingKeys=s.leafList.keys)}onDragEnd(t){this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds&&this.transformTool.onMove(t),this.dragPoint=null,this.resetDoing();const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(Rr.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t),wp(this);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t),vp(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onMoveEnd(t){this.moving&&this.transformTool.onMove(t),this.resetDoing()}onScale(t){this.canGesture&&(t.stop(),a(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){vp(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":e=-n;break;case"ArrowRight":e=n}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof ld)||t.find(t=>t instanceof ld);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e;const s=[[wd.START,this.onDragStart,this],[wd.DRAG,this.onDrag,this],[wd.END,this.onDragEnd,this],[yd.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&s.push([yd.ENTER,e=>{this.enterPoint=t,vp(this,e)}]),this.__eventIds.push(t.on_(s))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[wd.START,this.onDragStart,this],[wd.DRAG,this.onDrag,this],[wd.END,this.onDragEnd,this],[yd.ENTER,()=>wp(this)],[yd.DOUBLE_TAP,this.onDoubleTap,this],[yd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[Rd.HOLD,Rd.UP],this.onKey,this],[Rd.DOWN,this.onArrow,this],[kd.BEFORE_MOVE,this.onMove,this,!0],[Bd.BEFORE_ZOOM,this.onScale,this,!0],[Ed.BEFORE_ROTATE,this.onRotate,this,!0],[kd.END,this.onMoveEnd,this],[Bd.END,this.resetDoing,this],[Ed.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Bp={x:0,y:0,width:1e5,height:1e5};class Rp extends pl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Bp),Object.assign(this.__world,Bp)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const Tp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',Cp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${Tp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${Tp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${Tp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},Op=new Lt;function Pp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Op.setListWithFn(i,t=>t.getBounds("box","page")),0===Op.width&&(Op.width=.1),0===Op.height&&(Op.height=.1),e.reset(Op.get())}),s.add(e)}const Lp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Ap=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Mp={group(t,e,i){t.sort(Ap);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new gl(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(Lp);const r=new et(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(Lp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Ap),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},Dp=It.get("EditToolCreator");function Fp(){return t=>{Wp.register(t)}}const Ip=Fp,Wp={list:{},register(t){const{tag:e}=t.prototype;zp[e]&&Dp.repeat(e),zp[e]=t},get:(t,e)=>new zp[t](e)},{list:zp}=Wp;class Np extends V_{constructor(t,e){super(t,e)}}Np.BEFORE_OPEN="innerEditor.before_open",Np.OPEN="innerEditor.open",Np.BEFORE_CLOSE="innerEditor.before_close",Np.CLOSE="innerEditor.close";class Yp extends V_{constructor(t,e){super(t,e)}}Yp.BEFORE_GROUP="editor.before_group",Yp.GROUP="editor.group",Yp.BEFORE_UNGROUP="editor.before_ungroup",Yp.UNGROUP="editor.ungroup",Yp.BEFORE_OPEN="editor.before_open_group",Yp.OPEN="editor.open_group",Yp.BEFORE_CLOSE="editor.before_close_group",Yp.CLOSE="editor.close_group";const{updateMatrix:Hp}=Ho,Xp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Vp="top-left";class Up extends vl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(mr.CHANGE,e=>{if(this.checkChange&&Xp[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,Hp(this.parent),Hp(this);const a=new et(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Hp(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(Vp,o);break;case"scaleX":t.scaleOf(Vp,o,1);break;case"scaleY":t.scaleOf(Vp,1,o);break;case"skewX":t.skewOf(Vp,o,0);break;case"skewY":t.skewOf(Vp,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class jp extends V_{constructor(t,e){super(t,e)}}jp.BEFORE_MOVE="editor.before_move",jp.MOVE="editor.move";class Gp extends V_{constructor(t,e){super(t,e)}}Gp.BEFORE_SCALE="editor.before_scale",Gp.SCALE="editor.scale";class Kp extends V_{constructor(t,e){super(t,e)}}Kp.BEFORE_ROTATE="editor.before_rotate",Kp.ROTATE="editor.rotate";class qp extends V_{constructor(t,e){super(t,e)}}qp.BEFORE_SKEW="editor.before_skew",qp.SKEW="editor.skew";class Zp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const r=t.type===kd.END||t.type===wd.END,h=a(e.draggable),d=!o||r||h;if(t instanceof kd)n=t.getLocalMove(e),d&&wd.limitMove(e,n);else{const i={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),n=wd.getValidMove(e,s.point,i,d)}(n.x||n.y)&&(o&&!h&&r?Ho.animateMove(this,n,l(o)?o:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let{around:o,lockRatio:r,flipable:a,editSize:h}=i;if(t instanceof Bd)this.scaleOf(e.getBoxPoint(t),t.scale,t.scale);else{const{direction:i}=t.current;(t.shiftKey||e.lockRatio)&&(r=!0);const l=yp.getScaleData(e,n.bounds,i,t.getInnerTotal(e),r,yp.getAround(o,t.altKey),a,!s||"scale"===h);this.editTool&&this.editTool.onScaleWithDrag?(l.drag=t,this.scaleWithDrag(l)):this.scaleOf(l.origin,l.scaleX,l.scaleY)}}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r}=i,{direction:a}=t.current;let h,l;if(t instanceof Ed)l=t.rotation,h=o?ht.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=yp.getRotateData(e,a,t,s,t.shiftKey?null:o||e.around||e.origin||n||"center");l=s.rotation+i.rotation-e.rotation,h=i.origin}l=b.float(b.getGapRotation(l,r,e.rotation),2),l&&this.rotateOf(h,l)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=yp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),yp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;_(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(_(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new jp(jp.BEFORE_MOVE,h));const l=new jp(jp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Gp(Gp.BEFORE_SCALE,t));const o=new Gp(Gp.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(_(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Gp(Gp.BEFORE_SCALE,c));const u=new Gp(Gp.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new et(Ho.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new Gp(Gp.BEFORE_SCALE,r));const a=new Gp(Gp.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Kp(Kp.BEFORE_ROTATE,d));const c=new Kp(Kp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(_(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new qp(qp.BEFORE_SKEW,c));const u=new qp(qp.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(Ho.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new et(e.worldTransform);return t(),new et(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Jp=class extends gl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new Ja,this.openedGroupList=new Ja,this.simulateTarget=new Up(this),this.editBox=new Sp(this),this.editToolList={},this.selector=new op(this),this.editMask=new Rp(this),this.targetEventIds=[];let i=f.clone(Cp);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Vt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Pp(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(a(s))e=s;else if(!1===s)return}if(Wp.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||Wp.get(e,this);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Yp.BEFORE_GROUP),this.target=Mp.group(this.list,this.element,t),this.emitGroupEvent(Yp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Yp.BEFORE_UNGROUP,t)),this.target=Mp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Yp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Yp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Yp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Yp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Yp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Ho.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Yp(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(a(i))s=i;else if(!1===i)return}Wp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||Wp.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(Np.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Np.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Np.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Np.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Np(t,{editTarget:i,innerEditor:e});i.syncEventer||this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(Mp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Mp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Or.START,this.onRenderStart,this),i&&i.on_(mr.SCROLL,this.onChildScroll,this),t.on_(Or.CHILD_START,this.onAppRenderStart,this)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};Qt([(t,e)=>{Yn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=this,a=Object.assign({},t);return e&&e.editConfig&&Object.assign(a,e.editConfig),s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),o(a.dragLimitAnimate)&&(a.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Jp.prototype,"mergeConfig",void 0),Qt([U_(function(t,e){t.emitEvent(new V_(V_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Jp.prototype,"hoverTarget",void 0),Qt([U_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ja?i:new Ja(i),t.multiple&&Pp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new V_(V_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new V_(V_.AFTER_SELECT,s))})],Jp.prototype,"target",void 0),Jp=Qt([To(Zp,["editBox","editTool","emitEvent"])],Jp);class $p{static registerInnerEditor(){Wp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new gl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Qp=class extends $p{static registerEditTool(){Wp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Qp=Qt([Fp()],Qp);const{left:tg,right:eg}=rt,{move:ig,copy:sg,toNumberPoints:ng}=K;let og=class extends Qp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===tg;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=ng(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(ig(t,o,r),s&&ig(e,-o,-r)):(s&&ig(t,-o,-r),ig(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),sg(s[7],i),sg(e[7],i),sg(s[3],a),sg(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===tg||t===eg,s[t].visible=a,e[t].visible=!r&&a}};og=Qt([Fp()],og);const{M:rg,L:ag,C:hg,Q:lg,Z:dg,N:cg,D:ug,X:_g,G:pg,F:gg,O:fg,P:yg,U:mg}=fe,vg={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case rg:case ag:wg(t,e,i,n,1),n+=3;break;case hg:wg(t,e,i,n,3),n+=7;break;case lg:wg(t,e,i,n,2),n+=5;break;case dg:n+=1;break;case cg:wg(t,e,i,n,2),n+=5;break;case ug:wg(t,e,i,n,2),n+=9;break;case _g:wg(t,e,i,n,2),n+=6;break;case pg:wg(t,e,i,n,2),n+=9;break;case gg:wg(t,e,i,n,2),n+=5;break;case fg:t[n]=pg,t.splice(n+4,0,t[n+3],0),wg(t,e,i,n,2),n+=9,o+=2;break;case yg:t[n]=gg,t.splice(n+4,0,t[n+3]),wg(t,e,i,n,2),n+=5,o+=1;break;case mg:wg(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:wg}=vg,xg=I.get(),{topLeft:bg,top:kg,topRight:Eg,right:Sg,bottom:Bg,left:Rg}=rt;function Tg(t,e,i){t.pathInputed?Og(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Cg(t,e,i,s){let n=e;if(!o(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case kg:case Bg:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Rg:case Sg:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case bg:case Eg:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function Og(t,e,i){vg.scale(t.__.path,e,i),t.path=t.__.path}function Pg(t,e,i){const{points:s}=t;_(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):vg.scalePoints(s,e,i),t.points=s}function Lg(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)xg.a=e,xg.d=i,s[t].transform(xg,!0)}const Ag=Na.prototype;Ag.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},Ag.__scaleResize=function(t,e){Tg(this,t,e)},Ag.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Ag.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},ld.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)Cg(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),Tg(this,t,e)}},dd.prototype.__scaleResize=function(t,e){Og(this,t,e)},zl.prototype.__scaleResize=function(t,e){this.pathInputed?Og(this,t,e):this.points?Pg(this,t,e):this.width*=t},Kl.prototype.__scaleResize=function(t,e){this.pathInputed?Og(this,t,e):this.points?Pg(this,t,e):Tg(this,t,e)},gl.prototype.__scaleResize=function(t,e){Lg(this,t,e)},Sl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Tg(this,t,e),i&&Lg(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),Ut.editor=function(t,e){const i=new Jp(t);return e&&e.sky.add(e.editor=i),i},Sl.addAttr("textBox",!1,Gn),pl.addAttr("editConfig",void 0,Gn),pl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),Gn),pl.addAttr("editInner","PathEditor",Gn),gl.addAttr("editInner","",Gn),ld.addAttr("editInner","TextEditor",Gn),pl.setEditConfig=function(t){this.changeAttr("editConfig",t)},pl.setEditOuter=function(t){this.changeAttr("editOuter",t)},pl.setEditInner=function(t){this.changeAttr("editInner",t)};const Mg={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Dg={top:"flex-start",middle:"center",bottom:"flex-end"},Fg={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Ig(t,e,i){const{style:s}=t,{fill:n,padding:r,textWrap:h,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(_(e))switch(e.type){case"solid":i=Bh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Bh.string(a(t)?t:t.color);break;default:o(e.r)||(i=Bh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,_(d)?(c=d.type,d.color&&(s.textDecorationColor=Bh.string(d.color))):c=d,s.textDecoration=Fg[c],s.textTransform=Mg[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Dg[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(r)?r.map(t=>t*i+"px").join(" "):(r||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}let Wg=class extends $p{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof ld),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div"),{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(yd.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];a.setStartAfter(t),a.setEndAfter(t),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth&&(i+=20,r.autoSizeAlign))switch(r.textAlign){case"center":n=-i/2;break;case"right":n=-i}if(r.__autoHeight&&(s+=20,r.autoSizeAlign))switch(r.verticalAlign){case"middle":o=-s/2;break;case"bottom":o=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:_,f:p}=new et(t.worldTransform).scale(1/e).translateInner(n,o),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${_},${p})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||Ig(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function zg(t,e,i){Ng(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(kd.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(kd.END,e=>{Ho.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(Bd.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function Ng(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}Wg=Qt([Ip()],Wg),Vt.add("text-editor","editor");const Yg=It.get("LeaferTypeCreator"),Hg={list:{},register(t,e){Xg[t]&&Yg.repeat(t),Xg[t]=e},run(t,e){const i=Xg[t];i&&i(e)}},{list:Xg,register:Vg}=Hg;Vg("viewport",zg),Vg("custom",function(t){zg(t,null,!0)}),Vg("design",function(t){zg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Vg("document",function(t){zg(t,{zoom:{min:1},move:{scroll:"limit"}})});const Ug={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),n=K.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=K.getDistance(e.from,i.from);return{move:o,scale:K.getDistance(e.to,i.to)/r,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:n}}},{abs:jg,max:Gg}=Math,{sign:Kg,within:qg}=b,Zg={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=jg(s),r=jg(n);return o>50&&(s=Gg(50,o/3)*Kg(s)),r>50&&(n=Gg(50,r/3)*Kg(n)),{x:-s*i*2,y:-n*i*2}},getScale(e,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=e.deltaY||e.deltaX;if(o?(s="mouse"===o||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=qg(r,0,1);const t=e.deltaY?i.delta.y:i.delta.x;n=qg(1-a/(4*t)*r,.5,1.5)}return n}};class Jg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(kd.START,this.moveData)),t.path=this.moveData.path,e.emit(kd.BEFORE_MOVE,t),e.emit(kd.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Bd.START,this.zoomData)),t.path=this.zoomData.path,e.emit(Bd.BEFORE_ZOOM,t),e.emit(Bd.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Ed.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Ed.BEFORE_ROTATE,t),e.emit(Ed.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(kd.END,e),i&&t.emit(Bd.END,i),s&&t.emit(Ed.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const $g=ml.prototype,Qg=new Lt,tf=new Q;function ef(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function sf(t,e){return Object.assign(Object.assign({},e),{scale:t})}$g.initType=function(t){Hg.run(t,this)},$g.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(tf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?tf.y=0:t.includes("y")?tf.x=0:Math.abs(tf.x)>Math.abs(tf.y)?tf.y=0:tf.x=0,i&&t.includes("limit")&&(Qg.set(this.__world).addPoint(this.zoomLayer),al.getValidMove(Qg,this.canvas.bounds,"inner",tf,!0),t.includes("x")?tf.y=0:t.includes("y")&&(tf.x=0))}return{x:n?0:tf.x,y:n?0:tf.y}},$g.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const nf=Vd.prototype;nf.createTransformer=function(){this.transformer=new Jg(this)},nf.move=function(t){this.transformer.move(t)},nf.zoom=function(t){this.transformer.zoom(t)},nf.rotate=function(t){this.transformer.rotate(t)},nf.transformEnd=function(){this.transformer.transformEnd()},nf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):Zg.getScale(t,e);if(1!==o)this.zoom(sf(o,t));else{const s=e.getMove?e.getMove(t,e):Zg.getMove(t,e);i.snap&&K.round(s),this.move(ef(s,t))}},nf.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=Ug.getData(e);Object.assign(t,o),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(sf(n,t)),this.move(ef(i,t))};const of=Md.prototype,{abs:rf}=Math;function af(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}of.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=rf(i),o=rf(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;n*(e=e?l(a)?a:.95:r)>h?e=h/n:o*e>h&&(e=h/o),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},of.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},of.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},of.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Tt.maxX(r),d=Tt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let _=0,p=0;this.autoMoveTimer=setInterval(()=>{_+=c,p+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},of.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),ml.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),p(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,h=this.canvas.bounds.clone().shrink(r(n)?30:n),d=new Lt,c={x:h.x+h.width/2,y:h.y+h.height/2};let g;const{x:f,y:y,scaleX:m,scaleY:v}=o.__;if(a(t))switch(t){case"in":g=af(m,"in");break;case"out":g=af(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Lt(this.boxBounds)).height=0;break;case"fit-height":(t=new Lt(this.boxBounds)).width=0}else l(t)&&(g=t/m);if(g)g=this.getValidScale(g),o.scaleOfWorld(c,g,g,!1,s);else if(_(t)){const e={x:f,y:y,scaleX:m,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];d.setListWithFn(e,Zo.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,h);d.set(o.getWorldBounds(e))}const{width:r,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-r)/2,0),c+=Math.max((h.height-a)/2,0)):(g=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*g)/2,c+=(h.height-a*g)/2,K.scaleOf(e,d,g),d.scaleOf(d,g),e.scaleX*=g,e.scaleY*=g),"x"===i?c=0:"y"===i&&(l=0),K.move(e,l,c),d.move(l,c),o.set(e,s),d}return o.worldBoxBounds};class hf extends gl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Sl,this.scrollYBar=new Sl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Lt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,_=l<1,{scrollXBar:p,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,_?g.width+6:2,u?p.height+6:2,2]);p.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(wd.DRAG,this.onDrag,this),e.on_(wd.DRAG,this.onDrag,this),t.on_(wd.END,this.onDragEnd,this),e.on_(wd.END,this.onDragEnd,this),this.target.on_(Or.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Rr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Vt.add("scroll");class lf extends nl{setText(t){this._text=t,this.__htmlChanged=!0}}let df=class extends id{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}};Qt([vo(lf)],df.prototype,"__",void 0),Qt([Qn("")],df.prototype,"text",void 0),Qt([Gn("TextEditor")],df.prototype,"editInner",void 0),Qt([ho(!1)],df.prototype,"textEditing",void 0),df=Qt([Co()],df),Vt.add("html");class cf extends qh{}function uf(t){return Vn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,oo(this)}}}))}let _f=class extends zl{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}};Qt([vo(cf)],_f.prototype,"__",void 0),Qt([uf("angle")],_f.prototype,"endArrow",void 0),_f=Qt([Co()],_f);const{M:pf,L:gf,C:ff,Q:yf,O:mf}=fe,{rotate:vf,copyFrom:wf,scale:xf}=K,bf={},kf={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case pf:case gf:Ef(t,l+1,e,i,s,n,o,r),l+=3;break;case ff:for(h=1;h<6;h+=2)Ef(t,l+h,e,i,s,n,o,r);l+=7;break;case yf:for(h=1;h<4;h+=2)Ef(t,l+h,e,i,s,n,o,r);l+=5;break;case mf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){kf.layout(t,0,0,1,1,e,i)}};function Ef(t,e,i,s,n,o,r,a){wf(bf,t[e],t[e+1]),r&&vf(bf,r,a),n&&xf(bf,n,o),t[e]=i+bf.x,t[e+1]=s+bf.y}const{layout:Sf,rotate:Bf}=kf,{getAngle:Rf}=K,Tf={x:-.5},Cf={connect:Tf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Of={connect:Tf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Pf={connect:Tf,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},Lf={connect:Tf,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},Af={offset:Tf,path:[...Pf.path],dashPath:[1,-2.5,0,2,-1,0]};Bf(Af.path,180,{x:-1.5,y:0});const Mf={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Df={connect:{x:.5},path:[...Mf.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Ff={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},If={path:[...Ff.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Wf=f.clone(Ff),zf=f.clone(If);Bf(Wf.path,45),Bf(zf.path,45);const Nf={angle:Cf,"angle-side":Of,arrow:Lf,triangle:Pf,"triangle-flip":Af,circle:Df,"circle-line":Mf,square:If,"square-line":Ff,diamond:zf,"diamond-line":Wf,mark:{offset:Tf,path:[1,0,-2,2,0,2]}};function Yf(t,e,i,s,n,o,r){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}=_(e)?e:Nf[e];let p=d?d.x:0,g=l?l.x:0;const f=[...c];return r&&u&&f.push(...u),"none"!==a&&(p-=.5),l&&("round"===h&&l.roundJoin?g+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(g+=l.bevelJoin)),g&&Sf(f,g,0),Sf(f,s.x,s.y,n,n,Rf(i,s)),o.x=(p+g)*n,f}const{M:Hf,L:Xf,C:Vf,Q:Uf,Z:jf,N:Gf,D:Kf,X:qf,G:Zf,F:Jf,O:$f,P:Qf,U:ty}=fe,{copy:ey,copyFrom:iy,getDistancePoint:sy}=K,ny={},oy={},ry={},ay={},hy={},ly={list:Nf,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:n,dashPattern:o,__pathForRender:r}=t.__;let a,h=0,l=r.length,d=0,c=i&&"none"!==i;for(;h<l;){switch(a=r[h],a){case Hf:case Xf:(d<2||h+6>=l)&&(iy(hy,r[h+1],r[h+2]),!d&&c&&ey(oy,hy)),h+=3;break;case Vf:1!==d&&h+7!==l||dy(r,ay,hy,h+3),h+=7;break;case Uf:1!==d&&h+5!==l||dy(r,ay,hy,h+1),h+=5;break;case jf:return;case Gf:h+=5;break;case Kf:h+=9;break;case qf:h+=6;break;case Zf:h+=9;break;case Jf:h+=5;break;case $f:h+=7;break;case Qf:h+=4;break;case ty:1!==d&&h+6!==l||dy(r,ay,hy,h+1),h+=6}if(d++,1===d&&a!==Hf)return;if(2===d&&c&&ey(ry,a===Xf?hy:ay),h===l){const l=t.__.__pathForRender=e?[...r]:r,d=t.__.__pathForArrow=[];if(c){const e=Yf(t,i,ry,oy,n,ny,!!o);o?d.push(...e):l.push(...e),ny.x&&(sy(oy,ry,-ny.x,!0),l[1]=ry.x,l[2]=ry.y)}if(s&&"none"!==s){const e=Yf(t,s,ay,hy,n,ny,!!o);if(o?d.push(...e):l.push(...e),ny.x){let t;switch(sy(hy,ay,-ny.x,!0),a){case Xf:t=h-3+1;break;case Vf:t=h-7+5;break;case Uf:t=h-5+3;break;case ty:t=h-6+3}t&&cy(l,ay,t)}}}else ey(ay,hy)}}};function dy(t,e,i,s){iy(e,t[s],t[s+1]),iy(i,t[s+2],t[s+3])}function cy(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),pl.addAttr("startArrow","none",uf),pl.addAttr("endArrow","none",uf),Object.assign(Th,ly),Object.assign(Ch,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let uy=class extends Sl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};Qt([vo(class extends jh{})],uy.prototype,"__",void 0),Qt([Zn("x")],uy.prototype,"flow",void 0),uy=Qt([Co()],uy);const _y={},py={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},gy={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function fy(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;ct.toPoint(i,e,n,_y),e.x=s.__autoWidth?n.x:_y.x,e.y=s.__autoHeight?n.y:_y.y}const{move:yy}=K;function my(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),yy(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function vy(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const wy={};function xy(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,h=n&&(e?!o:!r);return _(i)?(wy.xGap=i.x||0,wy.yGap=i.y||0):wy.xGap=wy.yGap=c(i),wy.isAutoXGap=a(wy.xGap)&&!o,wy.isAutoYGap=a(wy.yGap)&&!r,wy.complex=h||"top-left"!==s||t.__hasGrow||wy.isAutoXGap||wy.isAutoYGap,wy.wrap=h,wy.complex&&(wy.isFitXGap="fit"===wy.xGap&&!o,wy.isFitYGap="fit"===wy.yGap&&!r,_(s)?(wy.contentAlign=s.content||"top-left",wy.rowXAlign=s.x||"from",wy.rowYAlign=s.y||"from"):(wy.contentAlign=s,wy.rowXAlign=py[s],wy.rowYAlign=gy[s])),wy}function by(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function ky(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function Ey(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Sy}=b;function By(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Ry(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Ry(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Ry(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Sy(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:Ty}=b;function Cy(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Oy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Oy(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Oy(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?Ty(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Py}=K;function Ly(t,e){const i="width",{children:s,itemBox:n}=t,o=xy(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:h;let p,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[y=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(g=Ey(p,n),r?(p.__flowBounds=g,m||(m=by(y,_)),a&&m.count&&m.width+g.width>x&&(m.grow?By(t,m,x,e):d&&ky(m,i,x,c),vy(u,m,i),m=by(y,_)),f=g.width,p.__widthGrow&&(m.grow+=p.__widthGrow,f=0,p.__.widthRange&&(m.hasRangeSize=!0)),p.__heightGrow&&Oy(p,g,b),m.width+=m.count?f+_:f,m.height=Math.max(m.height,g.height),m.count++):(Py(p,v-g.x,w-g.y),v+=g.width+_));if(r&&m){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:_}=o;m.count&&(m.grow?By(t,m,x,e):d&&ky(m,i,x,c),a&&vy(u,m,i)),a?(s?ky(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){fy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=py[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],my(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,_,e)):(fy(t,m,r),my(t,m,0,m.y,_,e))}}const{move:Ay}=K;function My(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Ay(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Dy}=K;function Fy(t,e){const i="height",{children:s,itemBox:n}=t,o=xy(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:l;let p,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[y=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(g=Ey(p,n),r?(p.__flowBounds=g,m||(m=by(y,_)),a&&m.count&&m.height+g.height>b&&(m.grow&&Cy(t,m,b,e),d&&ky(m,i,b,c),vy(u,m,i),m=by(y,_)),f=g.height,p.__heightGrow&&(m.grow+=p.__heightGrow,f=0,p.__.heightRange&&(m.hasRangeSize=!0)),p.__widthGrow&&Ry(p,g,x),m.height+=m.count?f+_:f,m.width=Math.max(m.width,g.width),m.count++):(Dy(p,v-g.x,w-g.y),w+=g.height+_));if(r&&m){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:_}=o;m.count&&(m.grow&&Cy(t,m,b,e),d&&ky(m,i,b,c),a&&vy(u,m,i)),a?(s?ky(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){fy(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=gy[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,_),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],My(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(fy(t,m,r),My(t,m,m.x,0,l,e))}}function Iy(t){return Vn(t,t=>({set(e){const i=l(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&eo(this)}}))}Vt.add("flow","resize");const Wy=Sl.prototype,{__updateBoxBounds:zy}=gl.prototype;pl.addAttr("flow",!1,Zn),pl.addAttr("gap",0,Qn),pl.addAttr("flowAlign","top-left",Qn),pl.addAttr("flowWrap",!1,Qn),pl.addAttr("itemBox","box",Qn),pl.addAttr("inFlow",!0,Qn),pl.addAttr("autoWidth",void 0,Iy),pl.addAttr("autoHeight",void 0,Iy),pl.addAttr("autoBox",void 0,Qn);const{copyAndSpread:Ny}=Tt;Wy.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Ly(this);break;case"y":Fy(this);break;case"x-reverse":Ly(this,!0);break;case"y-reverse":Fy(this,!0)}t&&(this.leafer.created=!0)},Wy.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Ny(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Wy.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():zy.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&Ny(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:Yy,sin:Hy,pow:Xy,sqrt:Vy,abs:Uy,ceil:jy,floor:Gy,round:Ky,PI:qy}=Math,Zy=5*qy,Jy=1.70158,$y=2.5949095,Qy=7.5625,tm=2.75;function em(t){return e=>Xy(e,t)}function im(t){return e=>1-Xy(1-e,t)}function sm(t){return e=>e<.5?.5*Xy(2*e,t):1-.5*Xy(2-2*e,t)}function nm(t){return t<1/tm?Qy*t*t:t<2/tm?Qy*(t-=1.5/tm)*t+.75:t<2.5/tm?Qy*(t-=2.25/tm)*t+.9375:Qy*(t-=2.625/tm)*t+.984375}function om(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=rm(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Uy(l)<1e-6));e++)c-=d/l;return n[r]=rm(c,e,s)}}function rm(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const am={get(t){const{list:e}=am;return a(t)?e[t||"ease"]:_(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){am.list[t]=e},list:{linear:t=>t,ease:om(.25,.1,.25,1),"ease-in":om(.42,0,1,1),"ease-out":om(0,0,.58,1),"ease-in-out":om(.42,0,.58,1),"sine-in":t=>1-Yy(t*qy*.5),"sine-out":t=>Hy(t*qy*.5),"sine-in-out":t=>.5*(1-Yy(t*qy)),"quad-in":em(2),"quad-out":im(2),"quad-in-out":sm(2),"cubic-in":em(3),"cubic-out":im(3),"cubic-in-out":sm(3),"quart-in":em(4),"quart-out":im(4),"quart-in-out":sm(4),"quint-in":em(5),"quint-out":im(5),"quint-in-out":sm(5),"expo-in":t=>t?Xy(2,10*t-10):0,"expo-out":t=>1===t?1:1-Xy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Xy(2,2*t*10-10):.5*(2-Xy(2,10-2*t*10)),"circ-in":t=>1-Vy(1-Xy(t,2)),"circ-out":t=>Vy(1-Xy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Vy(1-Xy(2*t,2))):.5*(Vy(1-Xy(2-2*t,2))+1),"back-in":t=>((Jy+1)*t-Jy)*t*t,"back-out":t=>(t-=1)*t*((Jy+1)*t+Jy)+1,"back-in-out":t=>t<.5?(t*=2)*t*(($y+1)*t-$y)*.5:.5*((t=2*t-2)*t*(($y+1)*t+$y)+2),"elastic-in":t=>0===t||1===t?t:-Xy(2,10*(t-1))*Hy((t-1.1)*Zy),"elastic-out":t=>0===t||1===t?t:Xy(2,-10*t)*Hy((t-.1)*Zy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Xy(2,10*((t*=2)-1))*Hy((t-1.1)*Zy)*.5:Xy(2,10*(1-(t*=2)))*Hy((t-1.1)*Zy)*.5+1,"bounce-in":t=>1-nm(1-t),"bounce-out":nm,"bounce-in-out":t=>t<.5?.5*(1-nm(1-2*t)):.5*(1+nm(2*t-1)),"cubic-bezier":om,steps:function(t,e="floor"){return i=>("floor"===e?Gy(i*t):"ceil"===e?jy(i*t):Ky(i*t))/t}}};function hm(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class lm{}lm.CREATED="created",lm.PLAY="play",lm.PAUSE="pause",lm.STOP="stop",lm.SEEK="seek",lm.UPDATE="update",lm.COMPLETED="completed";let dm=class extends Wr{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&l(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=am.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(lm.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(lm.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(lm.STOP))}seek(t){this.destroyed||(_(t)&&(t=Rh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(lm.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,d,c,u,_=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(d.swing=l(o)?o:2,u=2*d.swing-1),r&&(d.loop=u=l(r)?r:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=am.get(n))}if(!d.autoDuration&&o(d.duration)&&(n>1?s>0||r?p+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}p?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(lm.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(lm.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Fh.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(lm.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return l(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};Qt([hm("ease")],dm.prototype,"easing",void 0),Qt([hm(0)],dm.prototype,"delay",void 0),Qt([hm(.2)],dm.prototype,"duration",void 0),Qt([hm("auto")],dm.prototype,"ending",void 0),Qt([hm(!1)],dm.prototype,"reverse",void 0),Qt([hm(!1)],dm.prototype,"swing",void 0),Qt([hm(!1)],dm.prototype,"loop",void 0),Qt([hm(0)],dm.prototype,"loopDelay",void 0),Qt([hm(1)],dm.prototype,"speed",void 0),Qt([hm(!0)],dm.prototype,"autoplay",void 0),Qt([hm()],dm.prototype,"join",void 0),Qt([hm()],dm.prototype,"attrs",void 0),dm=Qt([To(qr)],dm);let cm=class extends dm{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new dm(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(lm.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(lm.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(lm.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(lm.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case lm.COMPLETED:this.completed&&this.emitType(t);break;case lm.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};cm=Qt([To(qr)],cm);const um={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},_m=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,pm=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,gm=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,fm=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,ym=parseInt,mm=parseFloat,{round:vm}=Math;let wm={},xm=0;function bm(t){let e,i,s,n=1;switch(t.length){case 9:e=ym(t.slice(1,3),16),i=ym(t.slice(3,5),16),s=ym(t.slice(5,7),16),n=ym(t.slice(7,9),16)/255;break;case 7:e=ym(t.slice(1,3),16),i=ym(t.slice(3,5),16),s=ym(t.slice(5,7),16);break;case 5:e=ym(t[1]+t[1],16),i=ym(t[2]+t[2],16),s=ym(t[3]+t[3],16),n=ym(t[4]+t[4],16)/255;break;case 4:e=ym(t[1]+t[1],16),i=ym(t[2]+t[2],16),s=ym(t[3]+t[3],16);break;case 3:e=i=s=ym(t[1]+t[2],16);break;case 2:e=i=s=ym(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const km=1/6,Em=.5,Sm=2/3,Bm=1/3;function Rm(t,e,i){return i<0?i++:i>1&&i--,i<km?t+6*(e-t)*i:i<Em?e:i<Sm?t+(e-t)*(Sm-i)*6:t}function Tm(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Rm(a,s,t+Bm),o=Rm(a,s,t),r=Rm(a,s,t-Bm)}return{r:vm(255*n),g:vm(255*o),b:vm(255*r),a:s}}Vt.add("color"),Bh.object=function(t,e){let i,s=!o(e)&&e<1;if(a(t)){const e=wm[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=bm(t);break;case"R":case"r":"("===t[4]&&pm.test(t)?i=function(t){const e=pm.exec(t);return{r:ym(e[1]),g:ym(e[2]),b:ym(e[3]),a:mm(e[4])}}(t):"("===t[3]&&_m.test(t)&&(i=function(t){const e=_m.exec(t);return{r:ym(e[1]),g:ym(e[2]),b:ym(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&fm.test(t)?i=function(t){const e=fm.exec(t);return Tm(mm(e[1]),mm(e[2]),mm(e[3]),mm(e[4]))}(t):"("===t[3]&&gm.test(t)&&(i=function(t){const e=gm.exec(t);return Tm(mm(e[1]),mm(e[2]),mm(e[3]),1)}(t))}if(!i){const e=um[t.toLowerCase()];e&&(i=bm("#"+e))}i&&(xm++,xm>1e4&&(wm={},xm=0),wm[t]=Object.assign({},i))}}else _(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Cm}=Math,{fourNumber:Om}=b,Pm={fill:Fm,stroke:Fm,cornerRadius:(t,e,i)=>l(t)&&l(e)?Mm(t,e,i):(t=Om(t),e=Om(e),t.map((t,s)=>Mm(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,n=e.length,o=Mm(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return l(t)||l(e)?b.float(Mm(t,e,i),Math.max(Am(t),Am(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Fh.setBetweenStyle(n,t,e,n,i,s),n},shadow:Im,innerShadow:Im},Lm={value:function(t,e,i){const s=l(t),n=l(e);return s&&n?t+(e-t)*i:n||s?Mm(t,e,i):t},number:Mm,color:Dm,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=Fh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function Am(t){const e=String(t).split(".")[1];return e?e.length:0}function Mm(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Cm(n):n}function Dm(t,e,i){t=Bh.object(t),e=Bh.object(e);const s=Mm(t.r,e.r,i,1)+","+Mm(t.g,e.g,i,1)+","+Mm(t.b,e.b,i,1),n=Mm(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Fm(t,e,i){return a(t)&&a(e)?Dm(t,e,i):e}function Im(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Mm((t=t||{}).x,e.x,i),y:Mm(t.y,e.y,i),blur:Mm(t.blur,e.blur,i),spread:Mm(t.spread,e.spread,i),color:Dm(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),Dh.canAnimate=!0,Object.assign(Fh.list,Pm),Object.assign(Fh,Lm);const Wm=pl.prototype;pl.addAttr("animation",void 0,function(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),pl.addAttr("animationOut",void 0,Gn),pl.addAttr("transition",!0,Gn),pl.addAttr("transitionOut",void 0,Gn),Wm.animate=function(t,e,i,s){if(o(t))return this.__animate;let n=u(t)&&!e&&i?new cm(this,t,s):new dm(this,t,e,s);this.killAnimate(i,n.toStyle);const r=this.__animate;return r&&(n instanceof cm?n.list.unshift(r):n=new cm(this,[r,n])),this.__animate=n},Wm.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof cm&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Wm.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(lm.COMPLETED,e)};const zm=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Nm=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Ym}=Math,{getDerivative:Hm}=He,Xm={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<zm.length;h++)l=f*(1+zm[h]),d=f*(1-zm[h]),c=Hm(l,t,i,n,r),u=Hm(l,e,s,o,a),_=Hm(d,t,i,n,r),p=Hm(d,e,s,o,a),g+=Nm[h]*(Ym(c*c+u*u)+Ym(_*_+p*p));return g*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Hm(t,e,s,o,a),d=Hm(t,i,n,r,h);return Math.atan2(d,l)/E},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)Vm(i,s,n,o,r,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,_=d*n+e*r,p=d*o+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*r+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(fe.C,c,u,g,f,y,m)}},{getDistance:Vm}=Xm,{M:Um,L:jm,C:Gm,Z:Km}=fe,qm={},Zm={},Jm={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Um:case jm:Jm.transformPoints(t,e,s,1),s+=3;break;case Gm:Jm.transformPoints(t,e,s,3),s+=7;break;case Km:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)qm.x=t[n],qm.y=t[n+1],I.toOuterPoint(e,qm),t[n]=qm.x,t[n+1]=qm.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Um:case jm:i=t[a+1],s=t[a+2],e=n===jm&&a>0?K.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Gm:i=t[a+5],s=t[a+6],e=Xm.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Km:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Rh.number(e,t.total);let o,r,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Um:case jm:if(r=n[f+1],a=n[f+2],o=s[y],p+o>=e||!t.total)return f||(m=r,v=a),Zm.x=m,Zm.y=v,g.x=r,g.y=a,K.getDistancePoint(Zm,g,e-p,!0),g.rotation=K.getAngle(Zm,g),g;m=r,v=a,f+=3;break;case Gm:if(r=n[f+5],a=n[f+6],o=s[y],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],_=Xm.getT(e-p,o,m,v,l,d,c,u,r,a,i),He.getPointAndSet(_,m,v,l,d,c,u,r,a,g),g.rotation=Xm.getRotation(_,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case Km:f+=1;default:o=0}y++,p+=o}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Rh.number(e,t.total);let r,a,h,l,d,c,u,_,p,g=0,f={},y=0,m=0,v=0,w=0;const x=n.length;for(;y<x;){switch(l=n[y],l){case Um:case jm:if(a=n[y+1],h=n[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),Zm.x=v,Zm.y=w,f.x=a,f.y=h,K.getDistancePoint(Zm,f,e-g,!0),o.push(l,f.x,f.y),o;v=a,w=h,y+=3,o.push(l,v,w);break;case Gm:if(d=n[y+1],c=n[y+2],u=n[y+3],_=n[y+4],a=n[y+5],h=n[y+6],r=s[m],g+r>=e)return p=Xm.getT(e-g,r,v,w,d,c,u,_,a,h,i),Xm.cut(o,p,v,w,d,c,u,_,a,h),o;v=a,w=h,y+=7,o.push(l,d,c,u,_,a,h);break;case Km:y+=1,o.push(l);default:r=0}m++,g+=r}return o}};function $m(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Fh.register("motion",function(t,e,i,s){return _(t)&&(t=Rh.number(t,s.getMotionTotal())),_(e)&&(e=Rh.number(e,s.getMotionTotal())),Fh.number(t||0,e||0,i)}),Fh.register("motionRotation",function(t,e,i){return Fh.number(t,e,i)});const Qm=pl.prototype,{updateMatrix:tv,updateAllMatrix:ev}=Ho,{updateBounds:iv}=tr;function sv(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=ov(t);i.total&&(t.__.__pathForRender=Jm.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(ev(t),iv(t,t)):tv(t));i&&(t.leafer.created=!0)}}function nv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function ov(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Jm.getMotionPathData(t.getPath(!0,!0))}function rv(t,e){return Vn(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Dh.setStyleName(this,e,i):Dh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function av(t){return Vn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function hv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function lv(t,e){_(e)||(e=void 0),uv(t,e,"in")}function dv(t,e){const{normalStyle:i}=t;_(e)||(e=void 0),i&&(e||(e=i),uv(t,e,"out"))}pl.addAttr("motionPath",void 0,$m),pl.addAttr("motionPrecision",1,$m),pl.addAttr("motion",void 0,$m),pl.addAttr("motionRotation",!0,$m),Qm.getMotionPathData=function(){return ov(nv(this))},Qm.getMotionPoint=function(t){const e=nv(this),i=ov(e);if(!i.total)return{};const s=Jm.getDistancePoint(i,t,e.motionPrecision);I.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:l(n)&&(s.rotation+=n),s},Qm.getMotionTotal=function(){return this.getMotionPathData().total},Qm.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),sv(t))}else sv(this)};const cv={};function uv(t,e,i){const{normalStyle:s}=t;e||(e=cv),e.scale&&(b.assignScale(e,e.scale),delete e.scale),e!==cv&&Dh.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=gv(e,t),s=t.animate();s&&gv(i,t,s.fromStyle);return i}(t,e):void 0;Dh.canAnimate&&_v(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=_v(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=pv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=pv(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function _v(t){let e;const i={},s=hv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Dh.isState(n,t,s)&&(e=fv(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Dh.isSelected(t,s)&&(e=fv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Dh.isPlacehold(t,s)&&(e=fv(i,a)),Dh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=fv(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Dh.isFocus(t,s)&&(e=fv(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Dh.isHover(t,s)&&(e=fv(i,o));const r=i.pressStyle||t.pressStyle;r&&Dh.isPress(t,s)&&(e=fv(i,r))}return e?i:void 0}function pv(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Dh.animateExcludes[t]||(n[t]=e[t]);return n}function gv(t,e,i){return pv(t,e,i,!0)}function fv(t,e){return Object.assign(t,e),!0}function yv(t,e){const i=t[e];i&&lv(t,i),t.button&&vv(t.children,e)}function mv(t,e,i){i||(i=t.states[e]),lv(t,i),t.button&&vv(t.children,null,e)}function vv(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":Dh.isHover(s)&&(n=!1);break;case"pressStyle":Dh.isPress(s)&&(n=!1);break;case"focusStyle":Dh.isFocus(s)&&(n=!1)}n&&yv(s,e)}else o(i)||mv(s,i);s.isBranch&&vv(s.children,e,i)}}function wv(t,e){const i=t[e];i&&dv(t,i),t.button&&bv(t.children,e)}function xv(t,e,i){dv(t,i),t.button&&bv(t.children,null,e)}function bv(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?wv(s,e):o(i)||xv(s,i),s.isBranch&&bv(s.children,e,i)}function kv(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=hv(e,i);o&&(s=n[t](o))}return s}function Ev(t,e,i){let s=e[t];if(!s&&i){const n=hv(e,i);n&&(s=n[t])}return s}Vt.add("state"),Dh.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Dh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=hv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Dh.isSelected=function(t,e){return Ev("selected",t,e)},Dh.isDisabled=function(t,e){return Ev("disabled",t,e)},Dh.isFocus=function(t,e){return kv("isFocus",t,e)},Dh.isHover=function(t,e){return kv("isHover",t,e)},Dh.isPress=function(t,e){return kv("isPress",t,e)},Dh.isPlacehold=function(t,e){return t.__.__isPlacehold},Dh.isDrag=function(t,e){return kv("isDrag",t,e)},Dh.setStyleName=function(t,e,i){i?mv(t,e,t[e]):xv(t,e,t[e])},Dh.set=function(t,e){const i=t.states[e];i?mv(t,e,i):xv(t,e,i)},Dh.getStyle=_v,Dh.updateStyle=uv,Dh.updateEventStyle=function(t,e){switch(e){case yd.ENTER:yv(t,"hoverStyle");break;case yd.LEAVE:wv(t,"hoverStyle");break;case yd.DOWN:yv(t,"pressStyle");break;case yd.UP:wv(t,"pressStyle")}};const Sv=pl.prototype;pl.addAttr("selected",!1,rv,"selectedStyle"),pl.addAttr("disabled",!1,rv,"disabledStyle"),pl.addAttr("states",{},av),pl.addAttr("state","",rv),pl.addAttr("normalStyle",void 0,Gn),pl.addAttr("hoverStyle",void 0,av),pl.addAttr("pressStyle",void 0,av),pl.addAttr("focusStyle",void 0,av),pl.addAttr("selectedStyle",void 0,av),pl.addAttr("disabledStyle",void 0,av),pl.addAttr("placeholderStyle",void 0,av),pl.addAttr("button",!1,Gn),Sv.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?yv(this,"focusStyle"):wv(this,"focusStyle")})},Sv.updateState=function(){Dh.updateStyle(this,void 0,"in")};const Bv=ld.prototype,Rv="text";Yn(Bv,Rv,Object.assign(Object.assign({},Hn(Bv,Rv)),{set(t){const e=this,i=e.text;e.__setAttr(Rv,t)&&(eo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Tv extends Xh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Cv=class extends pl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(l(t))this.now=t;else if(_(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Mn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:a,height:h}=o&&(l(o)?{width:o,height:o}:o)||(r>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new wr(wr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};Qt([vo(Tv)],Cv.prototype,"__",void 0),Qt([Qn()],Cv.prototype,"robot",void 0),Qt([Gn()],Cv.prototype,"actions",void 0),Qt([Gn("")],Cv.prototype,"action",void 0),Qt([ho(0)],Cv.prototype,"now",void 0),Qt([Gn(12)],Cv.prototype,"FPS",void 0),Qt([Gn(!0)],Cv.prototype,"loop",void 0),Cv=Qt([Co()],Cv),Vt.add("robot");const{Yes:Ov,NoAndSkip:Pv,YesAndSkip:Lv}=s,Av={},Mv={},Dv={};class Fv{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Av.id=t.substring(1),t=Av;break;case".":Mv.className=t.substring(1),t=Mv;break;default:Dv.tag=t,t=Dv}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Ho.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===Ov||o===Lv){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Pv&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(fr.REMOVE,this.__onRemoveChild,this),this.target.on_(mr.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Iv=pl.prototype;function Wv(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=Ut.selector())}Iv.find=function(t,e){return Wv(this).getBy(t,this,!1,e)},Iv.findOne=function(t,e){return Wv(this).getBy(t,this,!0,e)},Vt.add("find"),Ut.finder=function(t){return new Fv(t)};const{setPoint:zv,addPoint:Nv,toBounds:Yv}=st;const Hv={syncExport(e,i,s){let n;Mh.running=!0;try{const r=Bn.fileType(i),a=i.includes(".");s=Bn.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===r)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),n={data:!!a||e.toJSON(s.json)};else if("svg"===r)a&&l(h(e.toSVG(),"svg"),i),n={data:!!a||e.toSVG()};else{let t,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=e,{slice:_,clip:p,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=o(s.smooth)?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&o(s.fill)?e.fill:s.fill,k=Bn.isOpaqueImage(i)||x,E=new et;if(f)t=!0===f?d?c.canvas.bounds:e.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":E.set(l);break;case"local":E.set(l).divide(e.localTransform),a/=e.scaleX,h/=e.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||e;default:E.set(l).divide(e.getTransform(i));const t=i.worldTransform;a/=a/t.scaleX,h/=h/t.scaleY}t=e.getBounds("render",i)}const S={scaleX:1,scaleY:1};b.getScaleData(s.scale,s.size,t,S);let B=s.pixelRatio||1,{x:R,y:T,width:C,height:O}=new Lt(t).scale(S.scaleX,S.scaleY);p&&(R+=p.x,T+=p.y,C=p.width,O=p.height);const P={exporting:!0,matrix:E.scale(1/S.scaleX,1/S.scaleY).invert().translate(-R,-T).withScale(1/a*S.scaleX,1/h*S.scaleY)};let L,A=Ut.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:v,contextSettings:w});if(_&&(L=e,L.__worldOpacity=0,e=c||e,P.bounds=A.bounds),A.save(),u&&!o(x)){const t=e.get("fill");e.fill="",e.__render(A,P),e.fill=t}else e.__render(A,P);if(A.restore(),L&&L.__updateWorldOpacity(),g){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Nv(r,n,o):zv(r={},n,o)),a++;const h=new Lt;return r&&(Yv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=Ut.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(y){const[t,e,i,s]=b.fourNumber(y),n=A,{width:o,height:r}=n;A=Ut.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),m&&m(A);n={data:"canvas"===i?A:A.export(i,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:t,trimBounds:r}}}catch(t){n={data:"",error:t}}return Mh.running=!1,n},export(e,i,s){return Mh.running=!0,function(t){Xv||(Xv=new On);return new Promise(e=>{Xv.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>te(this,void 0,void 0,function*(){if(!Ln.isComplete)return t.requestRender(r);const a=Mh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()});e.updateLayout(),Vv(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))}};let Xv;function Vv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Vv(t))}const Uv=_e.prototype,jv=It.get("@leafer-in/export");Uv.export=function(t,e){const{quality:i,blob:s}=Bn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Uv.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{jv.error(t),s(null)})})},Uv.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Uv.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{jv.error(t),s(!1)})})},Vt.add("export"),Object.assign(Mh,Hv),pl.prototype.export=function(t,e){return Mh.export(this,t,e)},pl.prototype.syncExport=function(t,e){return Mh.syncExport(this,t,e)},Vt.add("filter"),Object.assign(Ah,{list:{},register(t,e){Ah.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=Ah.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Ah.list[t.type],e&&(i+=e.getSpread(t))}),i}});export{ct as AlignHelper,dm as Animate,am as AnimateEasing,lm as AnimateEvent,cm as AnimateList,s as Answer,ud as App,ht as AroundHelper,_f as Arrow,cf as ArrowData,Mt as AutoBounds,He as BezierHelper,Lt as Bounds,xr as BoundsEvent,Tt as BoundsHelper,Sl as Box,jh as BoxData,Za as Branch,tr as BranchHelper,ga as BranchRender,nd as Canvas,ol as CanvasData,$t as CanvasManager,fr as ChildEvent,Bh as ColorConvert,Ut as Creator,Ud as Cursor,f as DataHelper,It as Debug,ot as Direction4,rt as Direction9,al as DragBoundsHelper,wd as DragEvent,Md as Dragger,bd as DropEvent,Sp as EditBox,yp as EditDataHelper,bp as EditPoint,op as EditSelect,ep as EditSelectHelper,Qp as EditTool,Wp as EditToolCreator,Jp as Editor,V_ as EditorEvent,Yp as EditorGroupEvent,Mp as EditorHelper,jp as EditorMoveEvent,Kp as EditorRotateEvent,Gp as EditorScaleEvent,qp as EditorSkewEvent,Lh as Effect,Ol as Ellipse,Jh as EllipseData,Je as EllipseHelper,gr as Event,Zt as EventCreator,Wr as Eventer,Mh as Export,Bn as FileHelper,Ah as Filter,Fv as Finder,uy as Flow,Bl as Frame,Kh as FrameData,gl as Group,Uh as GroupData,df as HTMLText,lf as HTMLTextData,Xm as HighBezierHelper,Jm as HighCurveHelper,jd as HitCanvasManager,id as Image,nl as ImageData,wr as ImageEvent,Mn as ImageManager,e as IncrementId,$p as InnerEditor,Np as InnerEditorEvent,Vd as InteractionBase,Td as InteractionHelper,Rd as KeyEvent,pd as Keyboard,Cr as LayoutEvent,gh as Layouter,Na as Leaf,ua as LeafBounds,Zo as LeafBoundsHelper,m as LeafData,Jr as LeafDataProxy,qr as LeafEventer,Ho as LeafHelper,pr as LeafLayout,$a as LeafLevelList,Ja as LeafList,na as LeafMatrix,_a as LeafRender,ml as Leafer,th as LeaferCanvas,_e as LeaferCanvasBase,Gh as LeaferData,Pr as LeaferEvent,Nn as LeaferImage,Hg as LeaferTypeCreator,zl as Line,qh as LineData,og as LineEditTool,b as MathHelper,et as Matrix,I as MatrixHelper,kd as MoveEvent,Ug as MultiTouchHelper,xd as MyDragEvent,sd as MyImage,md as MyPointerEvent,me as NeedConvertToCanvasCommandMap,E as OneRadian,S as PI2,B as PI_2,Ch as Paint,Ph as PaintGradient,Oh as PaintImage,dd as Path,Th as PathArrow,ly as PathArrowModule,gn as PathBounds,ns as PathCommandDataHelper,fe as PathCommandMap,Di as PathConvert,bn as PathCorner,xs as PathCreator,tl as PathData,Fs as PathDrawer,pe as PathHelper,kf as PathMatrixHelper,be as PathNumberCommandLengthMap,xe as PathNumberCommandMap,vg as PathScaler,cd as Pen,el as PenData,vh as Picker,t as Platform,Vt as Plugin,Q as Point,K as PointHelper,gd as PointerButton,yd as PointerEvent,Kl as Polygon,$h as PolygonData,mr as PropertyEvent,vl as Rect,Zh as RectData,ke as RectHelper,ul as RectRender,Or as RenderEvent,yh as Renderer,Rr as ResizeEvent,Ln as Resource,Cv as Robot,Tv as RobotData,Ed as RotateEvent,Yt as Run,hf as ScrollBar,tp as SelectArea,wh as Selector,ed as Star,Qh as StarData,Dh as State,Dt as StringNumberMap,Q_ as Stroker,Sd as SwipeEvent,Cn as TaskItem,On as TaskProcessor,ld as Text,Sh as TextConvert,sl as TextData,Wg as TextEditor,Zp as TransformTool,Jg as Transformer,Fh as Transition,st as TwoPointBoundsHelper,pl as UI,rl as UIBounds,Gt as UICreator,Xh as UIData,fd as UIEvent,dl as UIRender,Rh as UnitConvert,nr as WaitHelper,Tr as WatchEvent,nh as Watcher,Zg as WheelEventHelper,Bd as ZoomEvent,zg as addViewport,Ng as addViewportConfig,ao as affectRenderBoundsType,no as affectStrokeBoundsType,uf as arrowType,Un as attr,Zn as autoLayoutType,Qn as boundsType,Sn as canvasPatch,ue as canvasSizeAttrs,Eh as createAttr,Xn as createDescriptor,mo as cursorType,vo as dataProcessor,Gn as dataType,Vn as decorateLeafAttr,xo as defineDataProcessor,Yn as defineKey,jn as defineLeafAttr,eo as doBoundsType,oo as doStrokeType,xh as effectType,n as emptyData,fo as eraserType,vr as extraPropertyEventMap,T as getBoundsData,Hn as getDescriptor,C as getMatrixData,R as getPointData,yo as hitType,u as isArray,p as isData,g as isEmptyData,h as isFinite,r as isNull,l as isNumber,_ as isObject,a as isString,o as isUndefined,wo as layoutProcessor,Fr as leaferTransformAttrMap,go as maskType,$m as motionPathType,to as naturalBoundsType,lo as opacityType,io as pathInputType,so as pathType,kn as pen,Kn as positionType,Fp as registerEditTool,Ip as registerInnerEditor,Co as registerUI,Oo as registerUIEvent,bh as resizeType,So as rewrite,Bo as rewriteAble,$n as rotationType,Tg as scaleResize,Cg as scaleResizeFontSize,Lg as scaleResizeGroup,Og as scaleResizePath,Pg as scaleResizePoints,Jn as scaleType,qn as scrollType,po as sortType,av as stateStyleType,rv as stateType,ro as strokeType,ho as surfaceType,At as tempBounds,it as tempMatrix,tt as tempPoint,c as tryToNumber,ih as useCanvas,To as useModule,Qa as version,co as visibleType,kh as zoomLayerType};
1
+ const t={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(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const n={};function o(t){return void 0===t}function r(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(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 y(t[n],e[n],i&&i[n]);i&&n in i?(null===(r=i[n])||void 0===r?void 0:r.constructor)===Object&&y(t[n]={},e[n],i[n]):t[n]=e[n]})},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:y}=f;class m{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 n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(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}}const{round:v,pow:w,PI:x}=Math,b={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(t,e){let i;if(u(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]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),b.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:w(10,e);return-0===(t=v(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,n=(l(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&b.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:k,randColor:t=>`rgba(${k(255)},${k(255)},${k(255)},${t||1})`};function k(t){return Math.round(Math.random()*t)}const E=x/180,S=2*x,B=x/2;function R(){return{x:0,y:0}}function T(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:O,cos:P,acos:L,sqrt:A}=Math,{float:M}=b,D={};function F(){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 I={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:F(),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:C,getWorld:F,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.scaleOfInner(t,D,i,s)},scaleOfInner(t,e,i,s=i){W.translateInner(t,e.x,e.y),W.scale(t,i,s),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=P(e*=E),a=O(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){W.toInnerPoint(t,e,D),W.rotateOfInner(t,D,i)},rotateOfInner(t,e,i){W.translateInner(t,e.x,e.y),W.rotate(t,i),W.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=E,t.a=s+o*i,t.b=n+r*i),e&&(e*=E,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.skewOfInner(t,D,i,s)},skewOfInner(t,e,i,s=0){W.translateInner(t,e.x,e.y),W.skew(t,i,s),W.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:r,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: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=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.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:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*E,r=P(o),a=O(o);if(s||n){const e=s*E,i=n*E;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=r,t.f=a,(i=i||s)&&W.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=A(n*n+o*o),c=t/d;const e=n/d;u=o>0?L(e):-L(e)}else{c=A(r*r+a*a),d=t/c;const e=r/c;u=B-(a>0?L(-e):-L(e))}const e=M(P(u)),i=O(u);d=M(d),c=M(c),_=e?M((r/c+i)/e/E,9):0,p=e?M((o/d-i)/e/E,9):0,u=M(u/E)}else d=n,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*n+e.y*r,f+=e.x*o+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:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=A(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){W.set(t)}},W=I,{toInnerPoint:z,toOuterPoint:N}=I,{sin:Y,cos:H,abs:X,sqrt:V,atan2:j,min:U,round:G}=Math,K={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?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(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=q.defaultPoint);const s=H(e*=E),n=Y(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}=q;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return J(i,t),N(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return J(i,t),q.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){N(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)=>Z(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=X(i-t),o=X(s-e);return V(n*n+o*o)},getMinDistanceFrom:(t,e,i,s,n,o)=>U(Z(t,e,i,s),Z(i,s,n,o)),getAngle:(t,e)=>$(t,e)/E,getRotation:(t,e,i,s)=>(s||(s=e),q.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/E),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>j(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=$(t,e);return(e=s?e:{}).x=t.x+H(n)*i,e.y=t.y+Y(n)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=K,{getDistanceFrom:Z,copy:J,getAtan2:$}=q;class Q{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Q(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new Q(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new Q(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new Q;class et{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return _(t)?I.copy(this,t):I.set(this,t,e,i,s,n,o),this}setWith(t){return I.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 et(this)}translate(t,e){return I.translate(this,t,e),this}translateInner(t,e){return I.translateInner(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleWith(t,e){return I.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return I.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return I.scaleOfInner(this,t,e,i),this}rotate(t){return I.rotate(this,t),this}rotateOfOuter(t,e){return I.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return I.rotateOfInner(this,t,e),this}skew(t,e){return I.skew(this,t,e),this}skewOfOuter(t,e,i){return I.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return I.skewOfInner(this,t,e,i),this}multiply(t){return I.multiply(this,t),this}multiplyParent(t){return I.multiplyParent(this,t),this}divide(t){return I.divide(this,t),this}divideParent(t){return I.divideParent(this,t),this}invert(){return I.invert(this),this}invertWith(){return I.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){I.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){I.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return I.setLayout(this,t,e,i),this}getLayout(t,e,i){return I.getLayout(this,t,e,i)}withScale(t,e){return I.withScale(this,t,e)}reset(){I.reset(this)}}const it=new et,st={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){nt(t,e,i),nt(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:nt}=st;var ot,rt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(ot||(ot={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(rt||(rt={}));const at=[{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}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,i,s,n,o){const r=lt(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={}),ht.toPoint(t,e,i,!0),i)};function lt(t){return a(t)?at[rt[t]]:t}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,n,o){dt(t,i,s,n,e,o)}},{tempPointBounds:ut,setPoint:_t,addPoint:pt,toBounds:gt}=st,{toOuterPoint:ft}=I,{float:yt,fourNumber:mt}=b,{floor:vt,ceil:wt}=Math;let xt,bt,kt,Et;const St={},Bt={},Rt={},Tt={tempBounds:Rt,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=mt(i);s?Ct.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ct.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),Ct.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Pt(e,t):e=t,i?(e.offsetX=-(Ct.maxX(i)-t.x),e.offsetY=-(Ct.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||K.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){K.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ct.copy(Rt,t),Ct.toOuterOf(Rt,e),Rt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.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 St.x=t.x,St.y=t.y,ft(e,St,Bt),_t(ut,Bt.x,Bt.y),St.x=t.x+t.width,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),St.y=t.y+t.height,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),St.x=t.x,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),gt(ut,i)},toInnerOf(t,e,i){i||(i=t),Ct.move(i,-e.e,-e.f),Ct.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ct.getFitScale(t,e));return new et(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),a(s)&&(s=Ct.getFitScale(t,e,"cover"===s)),Rt.width=n?e.width*=s:e.width*s,Rt.height=n?e.height*=s:e.height*s,ct.toPoint(i,Rt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Ct.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ct.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ct.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=i>t.y?wt(t.height+i-t.y):wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,i){xt=t.x+t.width,bt=t.y+t.height,kt=e.x,Et=e.y,i||(kt+=e.width,Et+=e.height),xt=xt>kt?xt:kt,bt=bt>Et?bt:Et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=bt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ct.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ct.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||Pt(t,n)):Ot(t,n));o&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ut,t.x,t.y):pt(ut,t.x,t.y)),gt(ut,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Ot(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=K.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=K.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=Ct.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=Ct.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=Ct.tempToOuterOf(e,i)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return xt=s+o,bt=n+r,kt=t.x+t.width,Et=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,xt=xt<kt?xt:kt,bt=bt<Et?bt:Et,o=xt-s,r=bt-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Ct.copy(t,Ct.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){Ct.set(t)}},Ct=Tt,{add:Ot,copy:Pt}=Ct;class Lt{get minX(){return Tt.minX(this)}get minY(){return Tt.minY(this)}get maxX(){return Tt.maxX(this)}get maxY(){return Tt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Tt.copy(this,t):Tt.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 Lt(this)}move(t,e){return Tt.move(this,t,e),this}scale(t,e,i){return Tt.scale(this,t,e,i),this}scaleOf(t,e,i){return Tt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Tt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Tt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Tt.getFitMatrix(this,t,e)}put(t,e,i){Tt.put(this,t,e,i)}spread(t,e){return Tt.spread(this,t,e),this}shrink(t,e){return Tt.shrink(this,t,e),this}ceil(){return Tt.ceil(this),this}unsign(){return Tt.unsign(this),this}float(t){return Tt.float(this,t),this}add(t){return Tt.add(this,t),this}addList(t){return Tt.setList(this,t,!0),this}setList(t){return Tt.setList(this,t),this}addListWithFn(t,e){return Tt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Tt.setListWithFn(this,t,e),this}setPoint(t){return Tt.setPoint(this,t),this}setPoints(t){return Tt.setPoints(this,t),this}addPoint(t){return Tt.addPoint(this,t),this}getPoints(){return Tt.getPoints(this)}hitPoint(t,e){return Tt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Tt.hitRadiusPoint(this,t,e)}hit(t,e){return Tt.hit(this,t,e)}includes(t,e){return Tt.includes(this,t,e)}intersect(t,e){return Tt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Tt.getIntersectData(this,t,e))}isSame(t){return Tt.isSame(this,t)}isEmpty(){return Tt.isEmpty(this)}reset(){Tt.reset(this)}}const At=new Lt;class Mt{constructor(t,e,i,s,n,o){_(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 Lt(n,e,o||t.width-n-i,r||t.height-e-s)}}const Dt={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:Ft}=b;class It{constructor(t){this.repeatMap={},this.name=t}static get(t){return new It(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const i=Ft();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===It.showBounds,n=t.__nowWorld,o=Ft();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 Wt(t){return t?a(t)&&(t=[t]):t=[],t}It.filterList=[],It.excludeList=[],It.showWarn=!0;const zt=It,Nt=It.get("RunTime"),Yt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Ht.currentId=Ht.idMap[s]=i?performance.now():Date.now(),Ht.currentName=Ht.nameMap[s]=t,Ht.nameToIdMap[t]=s,s},end(t,e){const i=Ht.idMap[t],s=Ht.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Ht.idMap[t]=Ht.nameMap[t]=Ht.nameToIdMap[s]=void 0,Nt.log(s,n,"ms")},endOfName(t,e){const i=Ht.nameToIdMap[t];o(i)||Ht.end(i,e)}},Ht=Yt,Xt=[],Vt={list:{},add(t,...e){this.list[t]=!0,Xt.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(()=>Xt.forEach(t=>Vt.has(t,!0)));const jt={editor:t=>Vt.need("editor")},Ut=It.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&Ut.repeat(e),Kt[e]=t},get(t,e,i,s,n,r){Kt[t]||Ut.error("not register "+t);const a=new Kt[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:Kt}=Gt,qt=It.get("EventCreator"),Zt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(Jt[e]&&qt.repeat(e),Jt[e]=t)})},changeName(t,e){const i=Jt[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,Jt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Jt[t](...e)},{nameList:Jt}=Zt;class $t{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=jt.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 Qt(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 te(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){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ee(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 ie=[];function se(){return(t,e)=>{ie.push(e)}}const ne=[];let oe=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ne)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.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){_(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}};Qt([ee("imageSmoothingEnabled")],oe.prototype,"smooth",void 0),Qt([ee("imageSmoothingQuality")],oe.prototype,"smoothLevel",void 0),Qt([ee("globalAlpha")],oe.prototype,"opacity",void 0),Qt([ee()],oe.prototype,"fillStyle",void 0),Qt([ee()],oe.prototype,"strokeStyle",void 0),Qt([ee("lineWidth")],oe.prototype,"strokeWidth",void 0),Qt([ee("lineCap")],oe.prototype,"strokeCap",void 0),Qt([ee("lineJoin")],oe.prototype,"strokeJoin",void 0),Qt([ee("lineDashOffset")],oe.prototype,"dashOffset",void 0),Qt([ee()],oe.prototype,"miterLimit",void 0),Qt([ee()],oe.prototype,"shadowBlur",void 0),Qt([ee()],oe.prototype,"shadowColor",void 0),Qt([ee()],oe.prototype,"shadowOffsetX",void 0),Qt([ee()],oe.prototype,"shadowOffsetY",void 0),Qt([ee()],oe.prototype,"filter",void 0),Qt([ee()],oe.prototype,"font",void 0),Qt([ee()],oe.prototype,"fontKerning",void 0),Qt([ee()],oe.prototype,"fontStretch",void 0),Qt([ee()],oe.prototype,"fontVariantCaps",void 0),Qt([ee()],oe.prototype,"textAlign",void 0),Qt([ee()],oe.prototype,"textBaseline",void 0),Qt([ee()],oe.prototype,"textRendering",void 0),Qt([ee()],oe.prototype,"wordSpacing",void 0),Qt([ee()],oe.prototype,"letterSpacing",void 0),Qt([ee()],oe.prototype,"direction",void 0),Qt([se()],oe.prototype,"setTransform",null),Qt([se()],oe.prototype,"resetTransform",null),Qt([se()],oe.prototype,"getTransform",null),Qt([se()],oe.prototype,"save",null),Qt([se()],oe.prototype,"restore",null),Qt([se()],oe.prototype,"translate",null),Qt([se()],oe.prototype,"scale",null),Qt([se()],oe.prototype,"rotate",null),Qt([se()],oe.prototype,"fill",null),Qt([se()],oe.prototype,"stroke",null),Qt([se()],oe.prototype,"clip",null),Qt([se()],oe.prototype,"fillRect",null),Qt([se()],oe.prototype,"strokeRect",null),Qt([se()],oe.prototype,"clearRect",null),Qt([se()],oe.prototype,"beginPath",null),Qt([se()],oe.prototype,"moveTo",null),Qt([se()],oe.prototype,"lineTo",null),Qt([se()],oe.prototype,"bezierCurveTo",null),Qt([se()],oe.prototype,"quadraticCurveTo",null),Qt([se()],oe.prototype,"closePath",null),Qt([se()],oe.prototype,"arc",null),Qt([se()],oe.prototype,"arcTo",null),Qt([se()],oe.prototype,"ellipse",null),Qt([se()],oe.prototype,"rect",null),Qt([se()],oe.prototype,"roundRect",null),Qt([se()],oe.prototype,"createConicGradient",null),Qt([se()],oe.prototype,"createLinearGradient",null),Qt([se()],oe.prototype,"createPattern",null),Qt([se()],oe.prototype,"createRadialGradient",null),Qt([se()],oe.prototype,"fillText",null),Qt([se()],oe.prototype,"measureText",null),Qt([se()],oe.prototype,"strokeText",null);const{copy:re,multiplyParent:ae}=I,{round:he}=Math,le=new Lt,de=new Lt,ce={width:1,height:1,pixelRatio:1},ue=["width","height","pixelRatio"];class _e extends oe{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(i,s){super(),this.size={},this.worldTransform={},i||(i=ce),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:n,height:o,pixelRatio:r}=i;this.autoLayout=!n||!o,this.size.pixelRatio=r||t.devicePixelRatio,this.config=i,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,ue),ue.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Lt(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&&ae(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=he(n.e-.5)+.5,n.f=he(n.f-.5)+.5):(n.e=he(n.e),n.f=he(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:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,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=de):i=le,this.drawImage(t.view,le.x,le.y,le.width,le.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,Tt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,le.x,le.y,le.width,le.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(le.x,le.y,le.width,le.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,le.x,le.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(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(de,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):jt.canvas(Object.assign({},i));return n.save(),t&&(re(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 pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ge={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},fe=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},ge),ye={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},me={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},ve=Object.assign(Object.assign({},me),ge),we=fe,xe={};for(let t in we)xe[we[t]]=t;const be={};for(let t in we)be[we[t]]=ye[t];const ke={drawRoundRect(t,e,i,s,n,o){const r=b.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:Ee,cos:Se,hypot:Be,atan2:Re,ceil:Te,abs:Ce,PI:Oe,sqrt:Pe,pow:Le}=Math,{setPoint:Ae,addPoint:Me}=st,{set:De,toNumberPoints:Fe}=K,{M:Ie,L:We,C:ze,Q:Ne,Z:Ye}=fe,He={},Xe={points(t,e,i,s){let n=Fe(e);if(t.push(Ie,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,_,p,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-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],p=Pe(Le(r-e,2)+Le(a-o,2)),g=Pe(Le(h-r,2)+Le(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=o,d=r-p*h,c=a-p*l,2===i?s||t.push(Ne,d,c,r,a):t.push(ze,u,_,d,c,r,a),u=r+g*h,_=a+g*l);s||t.push(Ne,u,_,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(We,n[e],n[e+1]);s&&t.push(Ye)},rect(t,e,i,s,n){pe.creator.path=t,pe.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){pe.creator.path=[],ke.drawRoundRect(pe.creator,e,i,s,n,o),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,_=o-s,p=r-n;let g=Re(u,c),f=Re(p,_);const y=Be(c,u),m=Be(_,p);let v=f-g;if(v<0&&(v+=S),y<1e-12||m<1e-12||v<1e-12||Ce(v-Oe)<1e-12)return t&&t.push(We,s,n),h&&(Ae(h,e,i),Me(h,s,n)),d&&De(d,e,i),void(l&&De(l,s,n));const w=c*p-_*u<0,x=w?-1:1,b=a/Se(v/2),k=s+b*Se(g+v/2+B*x),R=n+b*Ee(g+v/2+B*x);return g-=B*x,f-=B*x,Ue(t,k,R,a,a,0,g/E,f/E,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>Ue(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*E,_=Ee(u),p=Se(u);let g=r*E,f=a*E;g>Oe&&(g-=S),f<0&&(f+=S);let y=f-g;y<0?y+=S:y>S&&(y-=S),h&&(y-=S);const m=Te(Ce(y/B)),v=y/m,w=Ee(v/4),x=8/3*w*w/Ee(v/2);f=g+v;let b,k,R,T,C,O,P,L,A=Se(g),M=Ee(g),D=R=p*s*A-_*n*M,F=T=_*s*A+p*n*M,I=e+R,W=i+T;t&&t.push(t.length?We:Ie,I,W),l&&Ae(l,I,W),c&&De(c,I,W);for(let o=0;o<m;o++)b=Se(f),k=Ee(f),R=p*s*b-_*n*k,T=_*s*b+p*n*k,C=e+D-x*(p*s*M+_*n*A),O=i+F-x*(_*s*M-p*n*A),P=e+R+x*(p*s*k+_*n*b),L=i+T+x*(_*s*k-p*n*b),t&&t.push(ze,C,O,P,L,e+R,i+T),l&&je(e+D,i+F,C,O,P,L,e+R,i+T,l,!0),D=R,F=T,A=b,M=k,g=f,f+=v;d&&De(d,e+R,i+T)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(ze,(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){je(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,y,m,v=t,w=i,x=n,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=o,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?Me(h,t,e):Ae(h,t,e),Me(h,r,a);for(let l=0,c=d.length;l<c;l++)Ve(d[l],t,e,i,s,n,o,r,a,He),Me(h,He.x,He.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,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*o+p*a,l.y=c*i+u*n+_*r+p*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Ve(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:Ve,toTwoPointBounds:je,ellipse:Ue}=Xe,{sin:Ge,cos:Ke,sqrt:qe,atan2:Ze}=Math,{ellipse:Je}=Xe,$e={ellipticalArc(e,i,s,n,o,r,a,h,l,d,c){const u=(l-i)/2,_=(d-s)/2,p=r*E,g=Ge(p),f=Ke(p),y=-f*u-g*_,m=-f*_+g*u,v=n*n,w=o*o,x=m*m,b=y*y,k=v*w-v*x-w*b;let B=0;if(k<0){const t=qe(1-k/(v*w));n*=t,o*=t}else B=(a===h?-1:1)*qe(k/(v*x+w*b));const R=B*n*m/o,T=-B*o*y/n,C=Ze((m-T)/o,(y-R)/n),O=Ze((-m-T)/o,(-y-R)/n);let P=O-C;0===h&&P>0?P-=S:1===h&&P<0&&(P+=S);const L=i+u+f*R-g*T,A=s+_+g*R+f*T,M=P<0?1:0;c||t.ellipseToCurve?Je(e,L,A,n,o,r,C/E,O/E,M):n!==o||r?e.push(fe.G,L,A,n,o,r,C/E,O/E,M):e.push(fe.O,L,A,n,C/E,O/E,M)}},{M:Qe,m:ti,L:ei,l:ii,H:si,h:ni,V:oi,v:ri,C:ai,c:hi,S:li,s:di,Q:ci,q:ui,T:_i,t:pi,A:gi,a:fi,Z:yi,z:mi,N:vi,D:wi,X:xi,G:bi,F:ki,O:Ei,P:Si,U:Bi}=fe,{rect:Ri,roundRect:Ti,arcTo:Ci,arc:Oi,ellipse:Pi,quadraticCurveTo:Li}=Xe,{ellipticalArc:Ai}=$e,Mi=It.get("PathConvert"),Di={},Fi={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=be[s],a+=s===n?" ":xe[s];for(let s=1;s<i;s++)a+=b.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?ve:me;for(let e=0,h=t.length;e<h;e++)s=t[e],Dt[s]?("."===s&&(Ii.dot&&(Wi(r,o),o=""),Ii.dot++),"0"===o&&"."!==s&&(Wi(r,o),o=""),o+=s):fe[s]?(o&&(Wi(r,o),o=""),Ii.name=fe[s],Ii.length=ye[s],Ii.index=0,Wi(r,Ii.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Wi(r,o),o=s):o&&(Wi(r,o),o=""),n=s;return o&&Wi(r,o),i?Fi.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 _=[];for(;c<u;){switch(n=t[c],n){case ti:t[c+1]+=a,t[c+2]+=h;case Qe:a=t[c+1],h=t[c+2],_.push(Qe,a,h),c+=3;break;case ni:t[c+1]+=a;case si:a=t[c+1],_.push(ei,a,h),c+=2;break;case ri:t[c+1]+=h;case oi:h=t[c+1],_.push(ei,a,h),c+=2;break;case ii:t[c+1]+=a,t[c+2]+=h;case ei:a=t[c+1],h=t[c+2],_.push(ei,a,h),c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=li;case li:r=o===ai||o===li,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],_.push(ai,l,d,i,s,a,h),c+=5;break;case hi: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=ai;case ai:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(ai,t[c+1],t[c+2],i,s,a,h),c+=7;break;case pi:t[c+1]+=a,t[c+2]+=h,n=_i;case _i:r=o===ci||o===_i,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Li(_,a,h,i,s,t[c+1],t[c+2]):_.push(ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ui:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ci;case ci:i=t[c+1],s=t[c+2],e?Li(_,a,h,i,s,t[c+3],t[c+4]):_.push(ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case fi:t[c+6]+=a,t[c+7]+=h;case gi:Ai(_,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 mi:case yi:_.push(yi),c++;break;case vi:a=t[c+1],h=t[c+2],e?Ri(_,a,h,t[c+3],t[c+4]):zi(_,t,c,5),c+=5;break;case wi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):zi(_,t,c,9),c+=9;break;case xi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],t[c+5]):zi(_,t,c,6),c+=6;break;case bi:Pi(e?_:zi(_,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,Di),a=Di.x,h=Di.y,c+=9;break;case ki:e?Pi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):zi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ei:Oi(e?_:zi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Di),a=Di.x,h=Di.y,c+=7;break;case Si:e?Oi(_,t[c+1],t[c+2],t[c+3],0,360,!1):zi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Bi:Ci(e?_:zi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Di),a=Di.x,h=Di.y,c+=6;break;default:return Mi.error(`command: ${n} [index:${c}]`,t),_}o=n}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Qe,t.x,t.y);break;case"L":e.push(ei,t.x,t.y);break;case"C":e.push(ai,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(yi)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){Ii.index===Ii.length&&(Ii.index=1,t.push(Ii.name)),t.push(Number(e)),Ii.index++,Ii.dot=0}},{current:Ii,pushData:Wi,copyData:zi}=Fi,{M:Ni,L:Yi,C:Hi,Q:Xi,Z:Vi,N:ji,D:Ui,X:Gi,G:Ki,F:qi,O:Zi,P:Ji,U:$i}=fe,{getMinDistanceFrom:Qi,getRadianFrom:ts}=K,{tan:es,min:is,abs:ss}=Math,ns={},os={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ni,e,i)},lineTo(t,e,i){t.push(Yi,e,i)},bezierCurveTo(t,e,i,s,n,o,r){t.push(Hi,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Xi,e,i,s,n)},closePath(t){t.push(Vi)},rect(t,e,i,s,n){t.push(ji,e,i,s,n)},roundRect(t,e,i,s,n,o){if(l(o))t.push(Gi,e,i,s,n,o);else{const r=b.fourNumber(o);r?t.push(Ui,e,i,s,n,...r):t.push(ji,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){r(o)?t.push(qi,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(Ki,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(Ji,e,i,s):(r(o)&&(o=360),t.push(Zi,e,i,s,n,o,a?1:0))},arcTo(t,e,i,s,n,r,a,h){if(!o(a)){const t=Qi(a,h,e,i,s,n);r=is(r,is(t/2,t/2*ss(es(ts(a,h,e,i,s,n)/2))))}t.push($i,e,i,s,n,r)},drawEllipse(t,e,i,s,n,o,a,h,l){Xe.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,ns),t.push(Ni,ns.x,ns.y),rs(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){Xe.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,ns),t.push(Ni,ns.x,ns.y),as(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){Xe.points(t,e,i,s)}},{ellipse:rs,arc:as}=os,{moveTo:hs,lineTo:ls,quadraticCurveTo:ds,bezierCurveTo:cs,closePath:us,beginPath:_s,rect:ps,roundRect:gs,ellipse:fs,arc:ys,arcTo:ms,drawEllipse:vs,drawArc:ws,drawPoints:xs}=os;class bs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?pe.parse(t):t:[],this}beginPath(){return _s(this.__path),this.paint(),this}moveTo(t,e){return hs(this.__path,t,e),this.paint(),this}lineTo(t,e){return ls(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return cs(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return ds(this.__path,t,e,i,s),this.paint(),this}closePath(){return us(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,n){return gs(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return fs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return ys(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return ms(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return vs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return ws(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:ks,L:Es,C:Ss,Q:Bs,Z:Rs,N:Ts,D:Cs,X:Os,G:Ps,F:Ls,O:As,P:Ms,U:Ds}=fe,Fs=It.get("PathDrawer"),Is={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case ks:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Es:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ss:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Bs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Rs:t.closePath(),s+=1;break;case Ts:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Cs: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 Os:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ps:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*E,e[s+6]*E,e[s+7]*E,e[s+8]),s+=9;break;case Ls:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,S,!1),s+=5;break;case As:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*E,e[s+5]*E,e[s+6]),s+=7;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],0,S,!1),s+=4;break;case Ds:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Fs.error(`command: ${i} [index:${s}]`,e)}}},{M:Ws,L:zs,C:Ns,Q:Ys,Z:Hs,N:Xs,D:Vs,X:js,G:Us,F:Gs,O:Ks,P:qs,U:Zs}=fe,{toTwoPointBounds:Js,toTwoPointBoundsByQuadraticCurve:$s,arcTo:Qs,arc:tn,ellipse:en}=Xe,{addPointBounds:sn,copy:nn,addPoint:on,setPoint:rn,addBounds:an,toBounds:hn}=st,ln=It.get("PathBounds");let dn,cn,un;const _n={},pn={},gn={},fn={toBounds(t,e){fn.toTwoPointBounds(t,pn),hn(pn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return rn(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===Hs||r===Ns||r===Ys?rn(e,h,l):rn(e,t[a+1],t[a+2])),r){case Ws:case zs:h=t[a+1],l=t[a+2],on(e,h,l),a+=3;break;case Ns:n=t[a+5],o=t[a+6],Js(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,_n),sn(e,_n),h=n,l=o,a+=7;break;case Ys:i=t[a+1],s=t[a+2],n=t[a+3],o=t[a+4],$s(h,l,i,s,n,o,_n),sn(e,_n),h=n,l=o,a+=5;break;case Hs:a+=1;break;case Xs:h=t[a+1],l=t[a+2],an(e,h,l,t[a+3],t[a+4]),a+=5;break;case Vs:case js:h=t[a+1],l=t[a+2],an(e,h,l,t[a+3],t[a+4]),a+=r===Vs?9:6;break;case Us:en(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],_n,gn),0===a?nn(e,_n):sn(e,_n),h=gn.x,l=gn.y,a+=9;break;case Gs:h=t[a+1],l=t[a+2],cn=t[a+3],un=t[a+4],an(e,h-cn,l-un,2*cn,2*un),h+=cn,a+=5;break;case Ks:tn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],_n,gn),0===a?nn(e,_n):sn(e,_n),h=gn.x,l=gn.y,a+=7;break;case qs:h=t[a+1],l=t[a+2],dn=t[a+3],an(e,h-dn,l-dn,2*dn,2*dn),h+=dn,a+=4;break;case Zs:Qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],_n,gn),0===a?nn(e,_n):sn(e,_n),h=gn.x,l=gn.y,a+=6;break;default:return void ln.error(`command: ${r} [index:${a}]`,t)}}},{M:yn,L:mn,Z:vn}=fe,{getCenterX:wn,getCenterY:xn}=K,{arcTo:bn}=os,kn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;r<g;){switch(s=t[r],s){case yn:l=_=t[r+1],d=p=t[r+2],r+=3,t[r]===mn?(c=t[r+1],u=t[r+2],f.push(yn,wn(l,c),xn(d,u))):f.push(yn,l,d);break;case mn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case mn:bn(f,a,h,t[r+1],t[r+2],e,_,p);break;case vn:bn(f,a,h,l,d,e,_,p);break;default:f.push(mn,a,h)}_=a,p=h;break;case vn:n!==vn&&(bn(f,l,d,c,u,e,_,p),f.push(vn)),r+=1;break;default:o=be[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==vn&&(f[1]=l,f[2]=d),f}};function En(t){return new bs(t)}const Sn=En();pe.creator=En(),pe.parse=Fi.parse,pe.convertToCanvasData=Fi.toCanvasData;const{drawRoundRect:Bn}=ke;function Rn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Bn(this,t,e,i,s,n)})}(t)}const Tn={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=Cn.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{}}}},Cn=Tn;Cn.alphaPixelTypes.forEach(t=>Cn.upperCaseTypeMap[t]=t.toUpperCase());const On=It.get("TaskProcessor");class Pn{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){On.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ln{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,r;const a=new Pn(t);return a.parent=this,l(e)?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),o(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),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.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const An=It.get("Resource"),Mn={tasker:new Ln,map:{},get isComplete(){return Dn.tasker.isComplete},set(t,e){Dn.map[t]&&An.repeat(t),Dn.map[t]=e},get:t=>Dn.map[t],remove(t){const e=Dn.map[t];e&&(e.destroy&&e.destroy(),delete Dn.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=jt.image(s)),Dn.set(t,e),e},destroy(){Dn.map={}}},Dn=Mn,Fn={maxRecycled:10,recycledList:[],patternTasker:new Ln,get(t){let e=Mn.get(t.url);return e||Mn.set(t.url,e=jt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||In.recycledList.push(t)})},clearRecycled(){const t=In.recycledList;t.length>In.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Mn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Tn.alphaPixelTypes.some(e=>In.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Tn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Tn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){In.recycledList=[]}},In=Fn,{IMAGE:Wn,create:zn}=e,{floor:Nn,max:Yn}=Math;class Hn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=zn(Wn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Fn.isFormat("svg",t)&&(this.isSVG=!0),Fn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),Mn.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,i,s,n,o,r,a){if(e||(e=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=t.origin.createCanvas(Yn(Nn(e+(o||0)),1),Yn(Nn(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,i,s,n){const o=t.canvas.createPattern(e,i);try{s&&o.setTransform&&(o.setTransform(s),s=void 0)}catch(t){}return n&&f.stintSet(n,"transform",s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Xn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Vn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function jn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function Un(t,e){return(i,s)=>Kn(i,s,t,e&&e(s))}function Gn(t){return t}function Kn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Xn(t,e,Object.assign(n,s||{})),ko(t,e,i)}function qn(t){return Un(t)}function Zn(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Jn(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function $n(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),so(this))}}))}function Qn(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function to(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function eo(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i,e)&&so(this)}}))}function io(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(so(this),this.__.__removeNaturalSize())}}))}function so(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function no(t){return Un(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),so(this)}}))}const oo=eo;function ro(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i)&&(ao(this),e&&(this.__.__useStroke=!0))}}))}function ao(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&so(t)}const ho=ro;function lo(t){return Un(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function co(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function uo(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&po(this)}}))}function _o(t){return Un(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>go(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");go(this,t,e,i),this.mask&&po(this)}}))}function po(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function go(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||so(t))}function fo(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function yo(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function mo(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function vo(t){return Un(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===It.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function wo(t){return Un(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function xo(t){return(e,i)=>{Xn(e,"__DataProcessor",{get:()=>t})}}function bo(t){return(e,i)=>{Xn(e,"__LayoutProcessor",{get:()=>t})}}function ko(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=jn(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(_(i)){const t=g(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=Vn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),Xn(s,e,a)}const Eo=new It("rewrite"),So=[],Bo=["destroy","constructor"];function Ro(t){return(e,i)=>{So.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function To(){return t=>{Co()}}function Co(t){So.length&&(So.forEach(e=>{t&&Eo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),So.length=0)}function Oo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Bo.includes(s)||e&&e.includes(s)))if(t.prototype){Vn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Po(){return t=>{Gt.register(t)}}function Lo(){return t=>{Zt.register(t)}}setTimeout(()=>Co(!0));const{copy:Ao,toInnerPoint:Mo,toOuterPoint:Do,scaleOfOuter:Fo,rotateOfOuter:Io,skewOfOuter:Wo,multiplyParent:zo,divideParent:No,getLayout:Yo}=I,Ho={},{round:Xo}=Math,Vo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Go(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Uo(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Ko(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Ko(t),t.__updateChange()},updateAllChange(t){if(Zo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)qo(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,i,s,n,o,r){n||(n=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,n,e.__nowWorld,o,r):i.copyWorldToInner(s,n,e.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,n){const o=_(e)?Object.assign({},e):{x:e,y:i};s?Do(t.localTransform,o,o,!0):t.parent&&Mo(t.parent.scrollWorldTransform,o,o,!0),jo.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Xo(e),i=Xo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,o){jo.zoomOfLocal(t,Jo(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(l(s)||(s&&(o=s),s=i),Ao(Ho,r),Fo(Ho,e,i,s),jo.hasHighPosition(t))jo.setTransform(t,Ho,n,o);else{const e=t.x+Ho.e-r.e,a=t.y+Ho.f-r.f;o&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},o):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){jo.rotateOfLocal(t,Jo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Ao(Ho,n),Io(Ho,e,i),jo.hasHighPosition(t)?jo.setTransform(t,Ho,!1,s):t.set({x:t.x+Ho.e-n.e,y:t.y+Ho.f-n.f,rotation:b.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){jo.skewOfLocal(t,Jo(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Ao(Ho,t.__localMatrix),Wo(Ho,e,i,s),jo.setTransform(t,Ho,n,o)},transformWorld(t,e,i,s){Ao(Ho,t.worldTransform),zo(Ho,e),t.parent&&No(Ho,t.parent.scrollWorldTransform),jo.setTransform(t,Ho,i,s)},transform(t,e,i,s){Ao(Ho,t.localTransform),zo(Ho,e),jo.setTransform(t,Ho,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&jo.getInnerOrigin(t,n.origin),r=Yo(e,o,n.around&&jo.getInnerOrigin(t,n.around));if(jo.hasOffset(t)&&(r.x-=n.offsetX,r.y-=n.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,o){Tt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=jo.getInnerOrigin(t,n.origin);K.move(r,o.x-s.x,o.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Fo(i,jo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(jo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Ao(Ho,t.worldTransform),No(Ho,e.scrollWorldTransform),i?Ho:Object.assign({},Ho)),drop(t,e,i,s){t.setTransform(jo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||jo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const n=i.x*s,o=i.y*s;i.x-=n,i.y-=o,e.move(n,o),t.requestRender(()=>jo.animateMove(e,i,s))}}},jo=Vo,{updateAllMatrix:Uo,updateMatrix:Go,updateAllWorldOpacity:Ko,updateAllChange:qo,updateChange:Zo}=jo;function Jo(t,e){return t.updateLayout(),t.parent?K.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const $o={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>tr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>tr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>tr(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let Qo;function tr(t,e){return e||(Qo=0),t.__.mask&&(Qo=1),Qo<0?null:(Qo&&(Qo=-1),!0)}const{updateBounds:er}=Vo,ir={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),sr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)nr(e[t],e)},updateBounds(t,e){const i=[t];nr(t,i),or(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)er(s[t]);e&&e===i||er(i)}}},{pushAllChildBranch:sr,pushAllBranchStack:nr,updateBoundsByBranchStack:or}=ir,rr={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:ar,updateBounds:hr}=Vo,{toOuterOf:lr,getPoints:dr,copy:cr}=Tt,ur="_localContentBounds",_r="_worldContentBounds",pr="_worldBoxBounds",gr="_worldStrokeBounds";class fr{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return lr(this.contentBounds,this.leaf.__localMatrix,this[ur]||(this[ur]={})),this[ur]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return lr(this.contentBounds,this.leaf.__world,this[_r]||(this[_r]={})),this[_r]}get worldBoxBounds(){return lr(this.boxBounds,this.leaf.__world,this[pr]||(this[pr]={})),this[pr]}get worldStrokeBounds(){return lr(this.strokeBounds,this.leaf.__world,this[gr]||(this[gr]={})),this[gr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:i}=e;if(e.isApp)return hr(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return I.defaultMatrix;case"page":t=e.zoomLayer;default:return ar(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,o,r,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),o=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,o=I.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=ar(s,e,!0)}if(r||(r=I.getLayout(o)),cr(r,a),K.copy(r,n),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=dr(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class yr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class mr extends yr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}mr.ADD="child.add",mr.REMOVE="child.remove",mr.CREATED="created",mr.MOUNTED="mounted",mr.UNMOUNTED="unmounted",mr.DESTROY="destroy";const vr="property.scroll";class wr extends yr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}wr.CHANGE="property.change",wr.LEAFER_CHANGE="property.leafer_change",wr.SCROLL=vr;const xr={scrollX:vr,scrollY:vr};class br extends yr{constructor(t,e){super(t),Object.assign(this,e)}}br.LOAD="image.load",br.LOADED="image.loaded",br.ERROR="image.error";class kr extends yr{static checkHas(t,e,i){"on"===i?e===Rr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Er)||t.hasEvent(Sr)||t.hasEvent(Br),t.__hasWorldEvent=t.hasEvent(Rr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Er,t),"inner"===e&&t.emit(Sr,t)),t.emit(Br,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Rr,this)}}kr.RESIZE="bounds.resize",kr.INNER="bounds.inner",kr.LOCAL="bounds.local",kr.WORLD="bounds.world";const{RESIZE:Er,INNER:Sr,LOCAL:Br,WORLD:Rr}=kr,Tr={};[Er,Sr,Br,Rr].forEach(t=>Tr[t]=1);class Cr extends yr{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){_(t)?(super(Cr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Cr.RESIZE="resize";class Or extends yr{constructor(t,e){super(t),this.data=e}}Or.REQUEST="watch.request",Or.DATA="watch.data";class Pr extends yr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Pr.REQUEST="layout.request",Pr.START="layout.start",Pr.BEFORE="layout.before",Pr.LAYOUT="layout",Pr.AFTER="layout.after",Pr.AGAIN="layout.again",Pr.END="layout.end";class Lr extends yr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Lr.REQUEST="render.request",Lr.CHILD_START="render.child_start",Lr.CHILD_END="render.child_end",Lr.START="render.start",Lr.BEFORE="render.before",Lr.RENDER="render",Lr.AFTER="render.after",Lr.AGAIN="render.again",Lr.END="render.end",Lr.NEXT="render.next";class Ar extends yr{}Ar.START="leafer.start",Ar.BEFORE_READY="leafer.before_ready",Ar.READY="leafer.ready",Ar.AFTER_READY="leafer.after_ready",Ar.VIEW_READY="leafer.view_ready",Ar.VIEW_COMPLETED="leafer.view_completed",Ar.STOP="leafer.stop",Ar.RESTART="leafer.restart",Ar.END="leafer.end",Ar.TRANSFORM="leafer.transform",Ar.MOVE="leafer.move",Ar.SCALE="leafer.scale",Ar.ROTATE="leafer.rotate",Ar.SKEW="leafer.skew";const{MOVE:Mr,SCALE:Dr,ROTATE:Fr,SKEW:Ir}=Ar,Wr={x:Mr,y:Mr,scaleX:Dr,scaleY:Dr,rotation:Fr,skewX:Ir,skewY:Ir},zr={};class Nr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const r=Yr(this,s,!0),h=a(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],Tr[t]&&kr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=Yr(this,t);s.forEach(t=>{t&&(n=r[t],n&&(o=n.findIndex(t=>t.listener===e),o>-1&&n.splice(o,1),n.length||delete r[t],Tr[t]&&kr.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Zt.has(t)&&(e=Zt.get(t,{type:t,target:this,current:this}));const s=Yr(this,i)[t];if(s){let n;for(let o=0,r=s.length;o<r&&!((n=s[o])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),o--,r--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Yr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:zr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:zr)}}const{on:Hr,on_:Xr,off:Vr,off_:jr,once:Ur,emit:Gr,emitEvent:Kr,hasEvent:qr,destroy:Zr}=Nr.prototype,Jr={on:Hr,on_:Xr,off:Vr,off_:jr,once:Ur,emit:Gr,emitEvent:Kr,hasEvent:qr,destroyEventer:Zr},$r=It.get("setAttr"),Qr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||o(e)||($r.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new wr(wr.LEAFER_CHANGE,this,t,s,e));const i=Wr[t];i&&(this.emitEvent(new Ar(i,this)),this.emitEvent(new Ar(Ar.TRANSFORM,this)))}this.emitPropertyEvent(wr.CHANGE,t,s,e);const i=xr[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new wr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ta,multiplyParent:ea,translateInner:ia,defaultWorld:sa}=I,{toPoint:na,tempPoint:oa}=ht,ra={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ea(this.__local||e,t?t.__scrollWorld||t.__world:sa,i,!!e.affectScaleOrRotation,n),s&&ia(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ta(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(na(i.around||i.origin,t.boxBounds,oa),ia(e,-oa.x,-oa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:aa,updateAllMatrix:ha}=Vo,{updateBounds:la}=ir,{toOuterOf:da,copyAndSpread:ca,copy:ua}=Tt,{toBounds:_a}=fn,pa={__updateWorldBounds(){const t=this.__layout;da(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&kr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&kr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),da(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){da(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){da(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?_a(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ha(this),la(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ha(this),la(this,this))):aa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ca(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?ca(e.renderBounds,e.boxBounds,e.renderSpread):ua(e.renderBounds,e.strokeBounds)}},ga={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),Vo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);It.showBounds&&It.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:fa}=$o,ya={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)fa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)fa(i[s],e)||i[s].__clip(t,e)}}},ma={},{LEAF:va,create:wa}=e,{toInnerPoint:xa,toOuterPoint:ba,multiplyParent:ka}=I,{toOuterOf:Ea}=Tt,{copy:Sa,move:Ba}=K,{moveLocal:Ra,zoomOfLocal:Ta,rotateOfLocal:Ca,skewOfLocal:Oa,moveWorld:Pa,zoomOfWorld:La,rotateOfWorld:Aa,skewOfWorld:Ma,transform:Da,transformWorld:Fa,setTransform:Ia,getFlipTransform:Wa,getLocalOrigin:za,getRelativeWorld:Na,drop:Ya}=Vo;let Ha=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return fr}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=wa(va),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(mr.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(mr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(mr.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(mr.MOUNTED)):this.__emitLifeEvent(mr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return ka(i,t.matrix,e,void 0,i),Ea(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Fn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),ma.scaleX=i,ma.scaleY=s,ma}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?Na(this,e):this.worldTransform,n=i?t:{};return Ea(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Sa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Sa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),xa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){ba(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return Ba(n,-o,-r),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:o,y:r}=this.boxBounds;return Ba(n,o,r),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Ia(this,t,e,i)}transform(t,e,i){Da(this,t,e,i)}move(t,e,i){Ra(this,t,e,i)}moveInner(t,e,i){Pa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Ta(this,za(this,t),e,i,s,n)}rotateOf(t,e,i){Ca(this,za(this,t),e,i)}skewOf(t,e,i,s,n){Oa(this,za(this,t),e,i,s,n)}transformWorld(t,e,i){Fa(this,t,e,i)}moveWorld(t,e,i){Pa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){La(this,t,e,i,s,n)}rotateOfWorld(t,e){Aa(this,t,e)}skewOfWorld(t,e,i,s,n){Ma(this,t,e,i,s,n)}flip(t,e){Da(this,Wa(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Vt.need("path")}getMotionPoint(t){return Vt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){Ya(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):ko(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=eo),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new mr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(mr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};Ha=Qt([Oo(Qr),Oo(ra),Oo(pa),Oo(Jr),Oo(ga)],Ha);const{setListWithFn:Xa}=Tt,{sort:Va}=ir,{localBoxBounds:ja,localStrokeBounds:Ua,localRenderBounds:Ga,maskLocalBoxBounds:Ka,maskLocalStrokeBounds:qa,maskLocalRenderBounds:Za}=$o,Ja=new It("Branch");let $a=class extends Ha{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){Xa(e||this.__layout.boxBounds,this.children,this.__hasMask?Ka:ja)}__updateStrokeBounds(t){Xa(t||this.__layout.strokeBounds,this.children,this.__hasMask?qa:Ua)}__updateRenderBounds(t){Xa(t||this.__layout.renderBounds,this.children,this.__hasMask?Za:Ga)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(Va),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ja.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Gt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(mr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(mr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(mr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(mr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new mr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};$a=Qt([Oo(ya)],$a);class Qa{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Qa;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class th{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const eh="1.9.5";class ih extends _e{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Rn(OffscreenCanvasRenderingContext2D.prototype),Rn(Path2D.prototype);const{mineType:sh}=Tn;function nh(e,i){t.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:sh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:sh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:e=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",t.image.getRealURL(e),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},t.canvas=jt.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(jt,{canvas:(t,e)=>new ih(t,e),image:t=>new Hn(t)}),t.name="web",t.isWorker=!0,t.backgrounder=!0,t.requestRender=function(t){requestAnimationFrame(t)},Xn(t,"devicePixelRatio",{get:()=>1});const{userAgent:oh}=navigator;oh.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(t.fullImageShadow=!0),oh.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):oh.indexOf("Mac")>-1?t.os="Mac":oh.indexOf("Linux")>-1&&(t.os="Linux");class rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Qa;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new Qa,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Lr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===mr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Or(Or.DATA,{updatedList:this.updatedList})),this.__updatedList=new Qa,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[wr.CHANGE,this.__onAttrChange,this],[[mr.ADD,mr.REMOVE],this.__onChildEvent,this],[Or.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:ah,updateBounds:hh,updateChange:lh}=Vo,{pushAllChildBranch:dh,pushAllParent:ch}=ir;const{worldBounds:uh}=$o;class _h{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,u(t)&&(t=new Qa(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,uh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,uh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:ph,updateAllChange:gh}=Vo,fh=It.get("Layouter");class yh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new th,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Pr.START),this.layoutOnce(),t.emitEvent(new Pr(Pr.END,this.layoutedBlocks,this.times))}catch(t){fh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?fh.warn("layouting"):this.times>3?fh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Or.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Yt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Pr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Pr(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(ah(t,!0),e.add(t),t.isBranch&&dh(t,e),ch(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ch(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||hh(s[t])}hh(i)}})}(this.__levelList),function(t){t.list.forEach(lh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Pr(o,a,this.times)),i.emitEvent(new Pr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Yt.end(e)}fullLayout(){const t=Yt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Pr,o=this.getBlocks(new Qa(e));e.emitEvent(new Pr(i,o,this.times)),yh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Pr(s,o,this.times)),e.emitEvent(new Pr(n,o,this.times)),this.addBlocks(o),Yt.end(t)}static fullLayout(t){ph(t,!0),t.isBranch?ir.updateBounds(t):Vo.updateBounds(t),gh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new _h([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new _h(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Pr.REQUEST,this.layout,this],[Pr.AGAIN,this.layoutAgain,this],[Or.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const mh=It.get("Renderer");class vh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Pr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Lr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Lr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Lr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,mh.log(e.innerName,"---\x3e");try{this.emitRender(Lr.START),this.renderOnce(t),this.emitRender(Lr.END,this.totalBounds),Fn.clearRecycled()}catch(t){this.rendering=!1,mh.error(t)}mh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return mh.warn("rendering");if(this.times>3)return mh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Lr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Lr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Lr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Lr.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Yt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Lt(s);i.save(),s.spread(vh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),Yt.end(e)}fullRender(){const t=Yt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Yt.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),It.showRepaint&&It.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const e=1e3/(Date.now()-i),{maxFPS:n}=this.config;if(n&&e>n-.5)return t.requestRender(s);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Lt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||mh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Lr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Lr.REQUEST,this.update,this],[Pr.END,this.__onLayoutEnd,this],[Lr.AGAIN,this.renderAgain,this],[Cr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}vh.clipSpread=10;const{hitRadiusPoint:wh}=Tt;class xh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,o=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Qa(i.findList),i.findList||this.hitBranch(o.isBranchLeaf?{children:[o]}:o);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new Qa;if(t.length){let e;const{x:n,y:o}=this.point,r={x:n,y:o,radiusX:0,radiusY:0};for(let n=0,o=t.length;n<o;n++)if(e=t[n],(i||Vo.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Vo.hasParent(t,e))){s.reset();break}return s.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),s.length)return s.list[0];return i?t[0]:t.find(t=>Vo.worldHittable(t))}getPath(t){const e=new Qa;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new Qa;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new Qa,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,o;for(let t=0,r=i.length;t<r;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(o=s.list[t],!n||!n.has(o));t++)e.add(o)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||wh(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:o}=s;for(let s=0,r=o.length;s<r;s++)if(i=o[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class bh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new xh(this.target=t,this),this.finder=jt.finder&&jt.finder()}getByPoint(e,i,s){const{target:n,picker:o}=this;return t.backgrounder&&n&&n.updateLayout(),o.getByPoint(e,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Vt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function kh(t){return Un(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Eh(t){return Un(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Sh(){return(t,e)=>{const i="_"+e;Xn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Bh(t){return(e,i)=>{Xn(e,i,jn(i,t))}}Object.assign(jt,{watcher:(t,e)=>new rh(t,e),layouter:(t,e)=>new yh(t,e),renderer:(t,e,i)=>new vh(t,e,i),selector:(t,e)=>new bh(t,e)}),t.layout=yh.fullLayout;const Rh={},Th={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Ch={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Oh={},Ph={},Lh={},Ah={},Mh={},Dh={apply(){Vt.need("filter")}},Fh={},Ih={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Wh={list:{},register(t,e){Wh.list[t]=e},get:t=>Wh.list[t]},{parse:zh,objectToCanvasData:Nh}=Fi,{stintSet:Yh}=f,{hasTransparent:Hh}=Th,Xh={},Vh=It.get("UIData");class jh extends m{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Vh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Vh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Yh(this,"__isTransparentFill",Hh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Yh(this,"__isTransparentStroke",Hh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?zh(t):Nh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Uh(this,"shadow",t)}setInnerShadow(t){Uh(this,"innerShadow",t)}setFilter(t){Uh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ph.compute("fill",this.__leaf),e&&Ph.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Xh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Xh))}__removePaint(t,e){e&&this.__removeInput(t),Lh.recycleImage(t,this),"fill"===t?(Yh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Yh(this,"__isAlphaPixelStroke",void 0),Yh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Uh(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Gh extends jh{}class Kh extends Gh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class qh extends Gh{__getInputData(t,e){const i=super.__getInputData(t,e);return ue.forEach(t=>delete i[t]),i}}class Zh extends Kh{}class Jh extends jh{get __usePathBox(){return this.points||this.__pathInputed}}class $h extends jh{get __boxStroke(){return!this.__pathInputed}}class Qh extends jh{get __boxStroke(){return!this.__pathInputed}}class tl extends Jh{}class el extends jh{}class il extends jh{get __pathInputed(){return 2}}class sl extends Gh{}const nl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ol extends jh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=nl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Gt.get("Rect",0);const n=e.__layout,o=i.__layout;s||(i.parent=e,i.__world=e.__world,o.boxBounds=n.boxBounds),i.set(t),o.strokeChanged&&n.strokeChange(),o.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class rl extends $h{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return delete i.fill,i}}class al extends $h{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const hl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,o=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:o,renderSpread:r}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),o&&(t+=Dh.getSpread(o)),r&&(t+=r);let a=t=Math.ceil(t);return i&&i.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),n&&(a=Math.max(a,n)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},ll={getValidMove(t,e,i,s,n){const o=t.x+s.x,r=t.y+s.y,a=o+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;n||(s=Object.assign({},s));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==i?o>e.x?s.x+=e.x-o:a<l&&(s.x+=l-a):o<e.x?s.x+=e.x-o:a>l&&(s.x+=l-a),u&&"outer"!==i?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=b.float(s.x),s.y=b.float(s.y),s},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&dl.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),dl.axisMove(t,e)}},dl=ll,{stintSet:cl}=f,ul={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);cl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),cl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;cl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),cl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){_l(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:o,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Ph.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Mh.shadow(this,t,h),a&&(s.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t)),n&&(s.__isFills?Ph.fills(n,this,t):Ph.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&Mh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t)),c&&Dh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,Th.string(e.color))}n&&(s.__isFills?Ph.fills(n,this,t):Ph.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Ph.strokes(o,this,t):Ph.stroke(o,this,t))}}else s.__pathInputed?_l(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Ph.fills(s,this,t):Ph.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ph.strokes(n,this,t):Ph.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function _l(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Ph.stroke(n,t,e),s&&Ph.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&Ph.stroke(n,t,e)}const pl={__drawFast(t,e){let{x:i,y:s,width:n,height:o}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,n,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,n,o);break;case"inside":n-=h,o-=h,n<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,o),t.restore()):t.strokeRect(i+l,s+l,n,o);break;case"outside":t.strokeRect(i-l,s-l,n+h,o+h)}}}};var gl;let fl=gl=class extends Ha{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){b.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Sn.set(this.path=t||[]),t||this.__drawPathByBox(Sn),Sn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Vt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Vt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Sn.set(i=[]),this.__drawPathByBox(Sn)),t?Fi.toCanvasData(i,!0):i}getPathString(t,e,i){return Fi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Fh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?kn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Oh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Is.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,i,s,n,l(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Ph.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),Vt.need("animate")}killAnimate(t,e){}export(t,e){return Vt.need("export")}syncExport(t,e){return Vt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),gl.one(e)}static one(t,e,i,s,n){return Gt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Po()(this)}static registerData(t){xo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};Qt([xo(jh)],fl.prototype,"__",void 0),Qt([Sh()],fl.prototype,"zoomLayer",void 0),Qt([qn("")],fl.prototype,"id",void 0),Qt([qn("")],fl.prototype,"name",void 0),Qt([qn("")],fl.prototype,"className",void 0),Qt([co("pass-through")],fl.prototype,"blendMode",void 0),Qt([uo(1)],fl.prototype,"opacity",void 0),Qt([_o(!0)],fl.prototype,"visible",void 0),Qt([co(!1)],fl.prototype,"locked",void 0),Qt([co(!1)],fl.prototype,"dim",void 0),Qt([co(!1)],fl.prototype,"dimskip",void 0),Qt([fo(0)],fl.prototype,"zIndex",void 0),Qt([yo(!1)],fl.prototype,"mask",void 0),Qt([mo(!1)],fl.prototype,"eraser",void 0),Qt([Zn(0,!0)],fl.prototype,"x",void 0),Qt([Zn(0,!0)],fl.prototype,"y",void 0),Qt([eo(100,!0)],fl.prototype,"width",void 0),Qt([eo(100,!0)],fl.prototype,"height",void 0),Qt([Qn(1,!0)],fl.prototype,"scaleX",void 0),Qt([Qn(1,!0)],fl.prototype,"scaleY",void 0),Qt([to(0,!0)],fl.prototype,"rotation",void 0),Qt([to(0,!0)],fl.prototype,"skewX",void 0),Qt([to(0,!0)],fl.prototype,"skewY",void 0),Qt([Zn(0,!0)],fl.prototype,"offsetX",void 0),Qt([Zn(0,!0)],fl.prototype,"offsetY",void 0),Qt([Jn(0,!0)],fl.prototype,"scrollX",void 0),Qt([Jn(0,!0)],fl.prototype,"scrollY",void 0),Qt([$n()],fl.prototype,"origin",void 0),Qt([$n()],fl.prototype,"around",void 0),Qt([qn(!1)],fl.prototype,"lazy",void 0),Qt([io(1)],fl.prototype,"pixelRatio",void 0),Qt([lo(0)],fl.prototype,"renderSpread",void 0),Qt([no()],fl.prototype,"path",void 0),Qt([oo()],fl.prototype,"windingRule",void 0),Qt([oo(!0)],fl.prototype,"closed",void 0),Qt([eo(0)],fl.prototype,"padding",void 0),Qt([eo(!1)],fl.prototype,"lockRatio",void 0),Qt([eo()],fl.prototype,"widthRange",void 0),Qt([eo()],fl.prototype,"heightRange",void 0),Qt([qn(!1)],fl.prototype,"draggable",void 0),Qt([qn()],fl.prototype,"dragBounds",void 0),Qt([qn("auto")],fl.prototype,"dragBoundsType",void 0),Qt([qn(!1)],fl.prototype,"editable",void 0),Qt([vo(!0)],fl.prototype,"hittable",void 0),Qt([vo("path")],fl.prototype,"hitFill",void 0),Qt([ho("path")],fl.prototype,"hitStroke",void 0),Qt([vo(!1)],fl.prototype,"hitBox",void 0),Qt([vo(!0)],fl.prototype,"hitChildren",void 0),Qt([vo(!0)],fl.prototype,"hitSelf",void 0),Qt([vo()],fl.prototype,"hitRadius",void 0),Qt([wo("")],fl.prototype,"cursor",void 0),Qt([co()],fl.prototype,"fill",void 0),Qt([ho(void 0,!0)],fl.prototype,"stroke",void 0),Qt([ho("inside")],fl.prototype,"strokeAlign",void 0),Qt([ho(1,!0)],fl.prototype,"strokeWidth",void 0),Qt([ho(!1)],fl.prototype,"strokeWidthFixed",void 0),Qt([ho("none")],fl.prototype,"strokeCap",void 0),Qt([ho("miter")],fl.prototype,"strokeJoin",void 0),Qt([ho()],fl.prototype,"dashPattern",void 0),Qt([ho(0)],fl.prototype,"dashOffset",void 0),Qt([ho(10)],fl.prototype,"miterLimit",void 0),Qt([oo(0)],fl.prototype,"cornerRadius",void 0),Qt([oo()],fl.prototype,"cornerSmoothing",void 0),Qt([kh()],fl.prototype,"shadow",void 0),Qt([kh()],fl.prototype,"innerShadow",void 0),Qt([kh()],fl.prototype,"blur",void 0),Qt([kh()],fl.prototype,"backgroundBlur",void 0),Qt([kh()],fl.prototype,"grayscale",void 0),Qt([kh()],fl.prototype,"filter",void 0),Qt([co()],fl.prototype,"placeholderColor",void 0),Qt([qn(100)],fl.prototype,"placeholderDelay",void 0),Qt([qn({})],fl.prototype,"data",void 0),Qt([Ro(Ha.prototype.reset)],fl.prototype,"reset",null),fl=gl=Qt([Oo(hl),Oo(ul),To()],fl);let yl=class extends fl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var ml;Qt([xo(Gh)],yl.prototype,"__",void 0),Qt([eo(0)],yl.prototype,"width",void 0),Qt([eo(0)],yl.prototype,"height",void 0),yl=Qt([Oo($a),Po()],yl);const vl=It.get("Leafer");let wl=ml=class extends yl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Mn.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),ml.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const n=this.canvas=jt.canvas(s);this.__controllers.push(this.renderer=jt.renderer(this,n,s),this.watcher=jt.watcher(this,s),this.layouter=jt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=jt.selector(this),this.interaction=jt.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=jt.hitCanvasManager()),this.canvasManager=new $t,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),rr.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Ar.RESTART):this.emitLeafer(Ar.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Ar.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,ue);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=f.copyAttrs({},this.canvas,ue);e.resize(t),this.updateLazyBounds(),this.__onResize(new Cr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ue),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Mt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ue.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ue.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=f.copyAttrs({},s,ue);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Ar.BEFORE_READY),this.emitLeafer(Ar.READY),this.emitLeafer(Ar.AFTER_READY),rr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Ar.VIEW_READY),rr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:o}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(n=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:n,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){rr.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Ar.VIEW_COMPLETED),rr.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Vt.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Ar(t,this))}__listenEvents(){const t=Yt.start("FirstCreate "+this.innerName);this.once([[Ar.START,()=>Yt.end(t)],[Pr.START,this.updateLazyBounds,this],[Lr.START,this.__onCreated,this],[Lr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Or.DATA,this.__onWatchData,this],[Pr.END,this.__onLayoutEnd,this],[Lr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ml.list.remove(this);try{this.stop(),this.emitLeafer(Ar.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Fn.clearRecycled()},100)}catch(t){vl.error(t)}}};t?e():setTimeout(e)}};wl.list=new Qa,Qt([xo(qh)],wl.prototype,"__",void 0),Qt([eo()],wl.prototype,"pixelRatio",void 0),wl=ml=Qt([Po()],wl);let xl=class extends fl{get __tag(){return"Rect"}};Qt([xo($h)],xl.prototype,"__",void 0),xl=Qt([Oo(pl),To(),Po()],xl);const{add:bl,includes:kl,scroll:El}=Tt,Sl=xl.prototype,Bl=yl.prototype;let Rl=class extends yl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:o}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(bl(a,o),El(a,i)),this.__updateRectRenderBounds(),t=!kl(o,a),t&&"show"===r&&bl(n,a)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};Qt([xo(Kh)],Rl.prototype,"__",void 0),Qt([eo(100)],Rl.prototype,"width",void 0),Qt([eo(100)],Rl.prototype,"height",void 0),Qt([qn(!1)],Rl.prototype,"resizeChildren",void 0),Qt([lo("show")],Rl.prototype,"overflow",void 0),Qt([Ro(Sl.__updateStrokeSpread)],Rl.prototype,"__updateStrokeSpread",null),Qt([Ro(Sl.__updateRenderSpread)],Rl.prototype,"__updateRectRenderSpread",null),Qt([Ro(Sl.__updateBoxBounds)],Rl.prototype,"__updateRectBoxBounds",null),Qt([Ro(Sl.__updateStrokeBounds)],Rl.prototype,"__updateStrokeBounds",null),Qt([Ro(Sl.__updateRenderBounds)],Rl.prototype,"__updateRectRenderBounds",null),Qt([Ro(Sl.__updateChange)],Rl.prototype,"__updateRectChange",null),Qt([Ro(Sl.__render)],Rl.prototype,"__renderRect",null),Qt([Ro(Bl.__render)],Rl.prototype,"__renderGroup",null),Rl=Qt([To(),Po()],Rl);let Tl=class extends Rl{get __tag(){return"Frame"}get isFrame(){return!0}};Qt([xo(Zh)],Tl.prototype,"__",void 0),Qt([co("#FFFFFF")],Tl.prototype,"fill",void 0),Qt([lo("hide")],Tl.prototype,"overflow",void 0),Tl=Qt([Po()],Tl);const{moveTo:Cl,closePath:Ol,ellipse:Pl}=os;let Ll=class extends fl{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Pl(h,r,a,r*s,a*s,0,n,o,!1),Pl(h,r,a,r,a,0,o,n,!0),s<1&&Ol(h)):(s<1&&(Pl(h,r,a,r*s,a*s),Cl(h,e,a)),Pl(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Cl(h,r,a),Pl(h,r,a,r,a,0,n,o,!1),Ol(h)):Pl(h,r,a,r,a)}};Qt([xo(Qh)],Ll.prototype,"__",void 0),Qt([oo(0)],Ll.prototype,"innerRadius",void 0),Qt([oo(0)],Ll.prototype,"startAngle",void 0),Qt([oo(0)],Ll.prototype,"endAngle",void 0),Ll=Qt([Po()],Ll);const{moveTo:Al,lineTo:Ml,drawPoints:Dl}=os,{rotate:Fl,getAngle:Il,getDistance:Wl,defaultPoint:zl}=K;let Nl=class extends fl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Fl(i,e),i}set toPoint(t){this.width=Wl(zl,t),this.rotation=Il(zl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Dl(e,t.points,t.curve,t.closed):(Al(e,0,0),Ml(e,this.width,0))}};Qt([xo(Jh)],Nl.prototype,"__",void 0),Qt([ro("center")],Nl.prototype,"strokeAlign",void 0),Qt([eo(0)],Nl.prototype,"height",void 0),Qt([oo()],Nl.prototype,"points",void 0),Qt([oo(0)],Nl.prototype,"curve",void 0),Qt([oo(!1)],Nl.prototype,"closed",void 0),Nl=Qt([Po()],Nl);const{sin:Yl,cos:Hl,PI:Xl}=Math,{moveTo:Vl,lineTo:jl,closePath:Ul,drawPoints:Gl}=os,Kl=Nl.prototype;let ql=class extends fl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Gl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;Vl(e,o,0);for(let t=1;t<n;t++)jl(e,o+o*Yl(2*t*Xl/n),r-r*Hl(2*t*Xl/n));Ul(e)}}__updateRenderPath(){}__updateBoxBounds(){}};Qt([xo(tl)],ql.prototype,"__",void 0),Qt([oo(3)],ql.prototype,"sides",void 0),Qt([oo()],ql.prototype,"points",void 0),Qt([oo(0)],ql.prototype,"curve",void 0),Qt([Ro(Kl.__updateRenderPath)],ql.prototype,"__updateRenderPath",null),Qt([Ro(Kl.__updateBoxBounds)],ql.prototype,"__updateBoxBounds",null),ql=Qt([To(),Po()],ql);const{sin:Zl,cos:Jl,PI:$l}=Math,{moveTo:Ql,lineTo:td,closePath:ed}=os;let id=class extends fl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Ql(r,n,0);for(let t=1;t<2*i;t++)td(r,n+(t%2==0?n:n*s)*Zl(t*$l/i),o-(t%2==0?o:o*s)*Jl(t*$l/i));ed(r)}};Qt([xo(el)],id.prototype,"__",void 0),Qt([oo(5)],id.prototype,"corners",void 0),Qt([oo(.382)],id.prototype,"innerRadius",void 0),id=Qt([Po()],id);let sd=class extends xl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};Qt([xo(rl)],sd.prototype,"__",void 0),Qt([eo("")],sd.prototype,"url",void 0),sd=Qt([Po()],sd);const nd=sd;let od=class extends xl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=jt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Hn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new br(br.LOADED,{image:t}))})}draw(t,e,i,s){const n=new et(t.worldTransform).invert(),o=new et;e&&o.translate(e.x,e.y),i&&(l(i)?o.scale(i):o.scale(i.x,i.y)),s&&o.rotate(s),n.multiplyParent(o),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};Qt([xo(al)],od.prototype,"__",void 0),Qt([Eh(100)],od.prototype,"width",void 0),Qt([Eh(100)],od.prototype,"height",void 0),Qt([Eh(1)],od.prototype,"pixelRatio",void 0),Qt([Eh(!0)],od.prototype,"smooth",void 0),Qt([qn(!1)],od.prototype,"safeResize",void 0),Qt([Eh()],od.prototype,"contextSettings",void 0),od=Qt([Po()],od);const{copyAndSpread:rd,includes:ad,spread:hd,setList:ld}=Tt;let dd=class extends fl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:o,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Ch.number(e,n),t.__letterSpacing=Ch.number(i,n),t.__padding=l?b.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${n||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Rh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:o,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&hd(a,i/2),o||r){if(h.x=o?a.x:0,h.y=r?a.y:0,h.width=o?a.width:t.width,h.height=r?a.height:t.height,n){const[e,i,s,n]=t.__padding;o&&(h.x-=n,h.width+=i+n),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!ad(h,a)),this.isOverflow?(ld(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;rd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};Qt([xo(ol)],dd.prototype,"__",void 0),Qt([eo(0)],dd.prototype,"width",void 0),Qt([eo(0)],dd.prototype,"height",void 0),Qt([co()],dd.prototype,"boxStyle",void 0),Qt([qn(!1)],dd.prototype,"resizeFontSize",void 0),Qt([co("#000000")],dd.prototype,"fill",void 0),Qt([ro("outside")],dd.prototype,"strokeAlign",void 0),Qt([vo("all")],dd.prototype,"hitFill",void 0),Qt([eo("")],dd.prototype,"text",void 0),Qt([eo("")],dd.prototype,"placeholder",void 0),Qt([eo("caption")],dd.prototype,"fontFamily",void 0),Qt([eo(12)],dd.prototype,"fontSize",void 0),Qt([eo("normal")],dd.prototype,"fontWeight",void 0),Qt([eo(!1)],dd.prototype,"italic",void 0),Qt([eo("none")],dd.prototype,"textCase",void 0),Qt([eo("none")],dd.prototype,"textDecoration",void 0),Qt([eo(0)],dd.prototype,"letterSpacing",void 0),Qt([eo({type:"percent",value:1.5})],dd.prototype,"lineHeight",void 0),Qt([eo(0)],dd.prototype,"paraIndent",void 0),Qt([eo(0)],dd.prototype,"paraSpacing",void 0),Qt([eo("x")],dd.prototype,"writingMode",void 0),Qt([eo("left")],dd.prototype,"textAlign",void 0),Qt([eo("top")],dd.prototype,"verticalAlign",void 0),Qt([eo(!0)],dd.prototype,"autoSizeAlign",void 0),Qt([eo("normal")],dd.prototype,"textWrap",void 0),Qt([eo("show")],dd.prototype,"textOverflow",void 0),Qt([co(!1)],dd.prototype,"textEditing",void 0),dd=Qt([Po()],dd);let cd=class extends fl{get __tag(){return"Path"}};Qt([xo(il)],cd.prototype,"__",void 0),Qt([ro("center")],cd.prototype,"strokeAlign",void 0),cd=Qt([Po()],cd);let ud=class extends yl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new cd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,o){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,o,r,a){return this}arc(t,e,i,s,n,o){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,o,r,a){return this}drawArc(t,e,i,s,n,o){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};Qt([xo(sl)],ud.prototype,"__",void 0),Qt([(t,e)=>{Xn(t,e,{get(){return this.__path}})}],ud.prototype,"path",void 0),ud=Qt([Oo(bs,["set","path","paint"]),Po()],ud);let _d=class extends wl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&jt.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new wl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ue),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Pr.END,this.__onReady,this],[Lr.START,this.__onCreated,this],[Lr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Lr.END,this.__onChildRenderEnd,this))}};_d=Qt([Po()],_d);const pd={},gd={isHoldSpaceKey:()=>gd.isHold("Space"),isHold:t=>pd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){pd[t]||(pd[t]=!0)},setUpCode(t){pd[t]=!1}},fd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class yd extends yr{get spaceKey(){return gd.isHoldSpaceKey()}get left(){return fd.left(this)}get right(){return fd.right(this)}get middle(){return fd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return gd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){Zt.changeName(t,e)}}let md=class extends yd{};md.POINTER="pointer",md.BEFORE_DOWN="pointer.before_down",md.BEFORE_MOVE="pointer.before_move",md.BEFORE_UP="pointer.before_up",md.DOWN="pointer.down",md.MOVE="pointer.move",md.UP="pointer.up",md.OVER="pointer.over",md.OUT="pointer.out",md.ENTER="pointer.enter",md.LEAVE="pointer.leave",md.TAP="tap",md.DOUBLE_TAP="double_tap",md.CLICK="click",md.DOUBLE_CLICK="double_click",md.LONG_PRESS="long_press",md.LONG_TAP="long_tap",md.MENU="pointer.menu",md.MENU_TAP="pointer.menu_tap",md=Qt([Lo()],md);const vd=md,wd={};let xd=class extends md{static setList(t){this.list=t instanceof Qa?t:new Qa(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return K.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),ll.axisMove(t,n),n}static limitMove(t,e){ll.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(wd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(wd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(wd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Tt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Tt.unsign(i),i}assignMove(t){wd.x=t?this.totalX:this.moveX,wd.y=t?this.totalY:this.moveY}};xd.BEFORE_DRAG="drag.before_drag",xd.START="drag.start",xd.DRAG="drag",xd.END="drag.end",xd.OVER="drag.over",xd.OUT="drag.out",xd.ENTER="drag.enter",xd.LEAVE="drag.leave",xd=Qt([Lo()],xd);const bd=xd;let kd=class extends md{static setList(t){xd.setList(t)}static setData(t){xd.setData(t)}};kd.DROP="drop",kd=Qt([Lo()],kd);let Ed=class extends xd{};Ed.BEFORE_MOVE="move.before_move",Ed.START="move.start",Ed.MOVE="move",Ed.END="move.end",Ed=Qt([Lo()],Ed);let Sd=class extends md{};Sd.BEFORE_ROTATE="rotate.before_rotate",Sd.START="rotate.start",Sd.ROTATE="rotate",Sd.END="rotate.end",Sd=Qt([Lo()],Sd);let Bd=class extends xd{};Bd.SWIPE="swipe",Bd.LEFT="swipe.left",Bd.RIGHT="swipe.right",Bd.UP="swipe.up",Bd.DOWN="swipe.down",Bd=Qt([Lo()],Bd);let Rd=class extends md{};Rd.BEFORE_ZOOM="zoom.before_zoom",Rd.START="zoom.start",Rd.ZOOM="zoom",Rd.END="zoom.end",Rd=Qt([Lo()],Rd);let Td=class extends yd{};Td.BEFORE_DOWN="key.before_down",Td.BEFORE_UP="key.before_up",Td.DOWN="key.down",Td.HOLD="key.hold",Td.UP="key.up",Td=Qt([Lo()],Td);const Cd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Bd.UP:t>45&&t<135?Bd.DOWN:t<=45&&t>=-45?Bd.RIGHT:Bd.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Od.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Qa,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>Vo.draggable(t)||!t.isLeafer&&t.hasEvent(xd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Od=Cd,Pd=new Qa,{getDragEventData:Ld,getDropEventData:Ad,getSwipeEventData:Md}=Cd;class Dd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Ld(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,n=xd.list||this.draggableList||Pd;return this.dragging&&(s?t?Pd:new Qa(e?[...i.list,...i.dragHoverExclude]:i.list):n)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Ed.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&fd.left(t),this.dragging&&(this.interaction.emit(xd.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],Vo.draggable(e)){this.draggableList=new Qa(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:n,throughPath:o}=s;this.dragData=Ld(s,i,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",e.emit(Ed.BEFORE_MOVE,this.dragData),e.emit(Ed.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(xd.BEFORE_DRAG,this.dragData),e.emit(xd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:o}=e.p,r=!o||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=xd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},r||s);o&&!s&&t?Vo.animateMove(e,h,l(o)?o:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(xd.OUT,t,i),e.emit(xd.OVER,t,s)):e.emit(xd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(xd.LEAVE,t,i,s),e.emit(xd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:n,throughPath:o}=i,r=Ld(i,t,t);if(o&&(r.throughPath=o),r.path=n,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Ed.END,r)),this.dragging){const n=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(xd.END,r),this.swipe(t,i,s,r),this.drop(t,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(K.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Md(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Ad(t,e,xd.data);s.path=i,this.interaction.emit(kd.DROP,s),this.interaction.emit(xd.LEAVE,t,i)}dragReset(){xd.list=xd.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Fd=It.get("emit");const Id=["move","zoom","rotate","key"];function Wd(t,e,i,s,n){if(Id.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Nd(t,n)){let o;for(let r=0,a=t.children.length;r<a;r++)o=t.children[r],!i.path.has(o)&&o.__.hittable&&zd(o,e,i,s,n)}}function zd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Nd(t,n)&&(Ih.updateEventStyle&&!s&&Ih.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=Zt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Nd(t,e){return e&&e.has(t)}const Yd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Hd,pathCanDrag:Xd,pathHasOutside:Vd}=Cd;class jd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&fd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&fd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&gd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Yd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Qa(t),this.createTransformer(),this.dragger=new Dd(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(fd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(md.BEFORE_DOWN,t),this.emit(md.DOWN,t),fd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=fd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&fd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(md.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=K.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(md.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;fd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(md.BEFORE_UP,t),this.emit(md.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(md.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(md.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Td.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,gd.setDownCode(e),this.emit(Td.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Td.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Td.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,gd.setUpCode(e),this.emit(Td.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Qa),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(md.OUT,t,i),this.emit(md.OVER,t,e)):this.emit(md.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(md.LEAVE,t,i,e),this.emit(md.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(md.LEAVE,t),this.dragger.dragging&&this.emit(kd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,n=[md.DOUBLE_TAP,md.DOUBLE_CLICK].some(e=>Hd(t.path,e));s<e.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:o,name:e.type},i||{through:n}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Vd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Xd(t.path))&&!Vd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:md.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&K.round(s),s}emitTap(t){this.emit(md.TAP,t),this.emit(md.CLICK,t)}emitDoubleTap(t){this.emit(md.DOUBLE_TAP,t),this.emit(md.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(md.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(md.LONG_TAP,t),(Hd(t.path,md.LONG_TAP)||Hd(t.path,md.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Lt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Cr.RESIZE,this.__onResize,this)],t.once(Ar.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let o=i.length-1;o>-1;o--){if(n=i.list[o],zd(n,t,e,!0,s))return;n.isApp&&Wd(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&Wd(n,t,e,!1,s),zd(n,t,e,!1,s))return}catch(t){Fd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Ud{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ud.custom={};class Gd extends $t{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Qa,this.pixelList=new Qa}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),jt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),jt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=jt.selector())};const{toInnerRadiusPointOf:Kd,copy:qd,setRadius:Zd}=K,{hitRadiusPoint:Jd,hitPoint:$d}=Tt,Qd={},tc={},ec=Ha.prototype;ec.hit=function(e,i=0){this.updateLayout(),qd(tc,e),Zd(tc,i);const s=this.__world;return!!(i?Jd(s,tc):$d(s,tc))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},tc),i,{target:this}):this.__hitWorld(tc))},ec.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(qd(Qd,t),Zd(t=Qd,e.hitRadius)),Kd(t,i,Qd),e.hitBox||n){if(Tt.hitRadiusPoint(s.boxBounds,Qd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Qd)},ec.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},ec.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},ec.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},ec.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ic=new et,sc=fl.prototype;sc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,n=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,o=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=n||o;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,r=a.hitScale=At.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=At.set(e).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Fn.patternLocked=!0,this.__renderShape(a,{matrix:ic.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!o}),Fn.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},sc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:o}=e,r=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*o,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=o;break;case"outside":if(h+=2*o,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const nc=fl.prototype,oc=xl.prototype,rc=Rl.prototype;oc.__updateHitCanvas=rc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?nc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},oc.__hitFill=rc.__hitFill=function(t){return this.__hitCanvas?nc.__hitFill.call(this,t):Tt.hitRadiusPoint(this.__layout.boxBounds,t)},dd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:o}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):o.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},yl.prototype.pick=function(e,i){return i||(i=n),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const ac=_e.prototype;function hc(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let o;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)o=s[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(n){const{decorationColor:t,decorationHeight:o}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,o)))}}function lc(t,e){t.__.__font?hc(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function dc(t,e,i){switch(e.__.strokeAlign){case"center":cc(t,1,e,i);break;case"inside":uc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?cc(t,2,e,i):uc(t,"outside",e,i)}}function cc(t,e,i,s){const n=i.__;_(t)?pc(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),_c(i,s))}function uc(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,cc(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",hc(i,n),n.blendMode="normal",Vo.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function _c(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:o}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(o){const{decorationHeight:t}=s;n.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function pc(t,e,i,s,n){let o;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||n.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!Lh.checkImage(s,n,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?n.setStroke(o.style,r.__getRealStrokeWidth(t)*e,r,t):n.setStroke(o.style,r.__strokeWidth*e,r)}else n.strokeStyle=o.style;o.blendMode?(n.saveBlendMode(o.blendMode),i?_c(s,n):n.stroke(),n.restoreBlendMode()):i?_c(s,n):n.stroke()}}function gc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)dc(t,e,i);else switch(s.strokeAlign){case"center":fc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),fc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)fc(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),fc(t,2,e,o),o.clipUI(s),o.clearWorld(n),Vo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i)}}function fc(t,e,i,s){const n=i.__;_(t)?pc(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Ph.strokeArrow(t,i,s)}ac.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},ac.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},ac.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),At.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(At.x,At.y,At.width||1,At.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:yc,getOuterOf:mc,getByMove:vc,getIntersectData:wc}=Tt;let xc;const{stintSet:bc}=f,{hasTransparent:kc}=Th;function Ec(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Lh.image(i,t,e,n,!xc||!xc[e.url]);break;case"linear":s=Ah.linearGradient(e,n);break;case"radial":s=Ah.radialGradient(e,n);break;case"angular":s=Ah.conicGradient(e,n);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:Th.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:Th.string(e)})}if(s){if(a(s.style)&&kc(s.style)&&(s.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}e.editing&&(s.editing=e.editing),e.blendMode&&(s.blendMode=e.blendMode)}return s}const Sc={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];u(a)||(a=[a]),xc=Lh.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=Ec(t,a[n],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),o=!0),"fill"===t?(bc(i,"__isAlphaPixelFill",n),bc(i,"__isTransparentFill",o)):(bc(i,"__isAlphaPixelStroke",n),bc(i,"__isTransparentStroke",o),bc(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,lc(e,i)},fills:function(t,e,i){let s;for(let n=0,o=t.length;n<o;n++){if(s=t[n],s.image){if(Lh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),lc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),lc(e,i),i.restoreBlendMode()):lc(e,i)}},fillPathOrText:lc,fillText:hc,stroke:gc,strokes:function(t,e,i){gc(t,e,i)},strokeText:dc,drawTextStroke:_c,shape:function(e,i,s){const n=i.getSameCanvas(),o=e.__nowWorld,r=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=e.getRenderScaleData(!0);if(r.includes(o))c=n,a=d=o;else{const{renderShapeSpread:n}=e.__layout;let p;if(t.fullImageShadow)p=o;else{const t=n?yc(r,u===_?n*u:[n*_,n*u]):r;p=wc(t,o)}l=r.getFitMatrix(p);let{a:g,d:f}=l;l.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,s),u*=g,_*=f),d=mc(o,l),a=vc(d,-l.e,-l.f);const y=s.matrix;y?(h=new et(l),h.multiply(y),g*=y.scaleX,f*=y.scaleY):h=l,h.withScale(g,f),s=Object.assign(Object.assign({},s),{matrix:h})}return e.__renderShape(n,s),{canvas:n,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let Bc={},Rc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Tc,rotateOfOuter:Cc,translate:Oc,scaleOfOuter:Pc,multiplyParent:Lc,scale:Ac,rotate:Mc,skew:Dc}=I;function Fc(t,e,i,s,n,o,r){const a=Tc();Oc(a,e.x+i,e.y+s),Ac(a,n,o),r&&Cc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Ic(t,e,i,s,n,o,r,a,h){const l=Tc();zc(l,e,i,s,n,o,r,a),h&&(Rc.a=e.width/h.width,Rc.d=e.height/h.height,Lc(l,Rc)),t.transform=l}function Wc(t,e,i,s,n,o,r,a,h,l,d,c){const u=Tc();if(c)zc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)Cc(u,{x:i/2,y:s/2},h);else switch(Mc(u,h),h){case 90:Oc(u,s,0);break;case 180:Oc(u,i,s);break;case 270:Oc(u,0,i)}Bc.x=e.x+n,Bc.y=e.y+o,Oc(u,Bc.x,Bc.y),r&&Pc(u,Bc,r,a)}t.transform=u}function zc(t,e,i,s,n,o,r,a){r&&Mc(t,r),a&&Dc(t,a.x,a.y),n&&Ac(t,n,o),Oc(t,e.x+i,e.y+s)}const{get:Nc,translate:Yc}=I,Hc=new Lt,Xc={},Vc={};function jc(t,e,i,s){const{changeful:n,sync:o,scaleFixed:r}=i;n&&(t.changeful=n),o&&(t.sync=o),r&&(t.scaleFixed=r),t.data=Uc(i,s,e)}function Uc(t,e,i){t.padding&&(e=Hc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==h&&(u||0)%180==90;let k,E;switch(Tt.set(Vc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(b.getScaleData(d,c,i,Xc),k=Xc.scaleX,E=Xc.scaleY),(h||y||f)&&(k&&Tt.scale(Vc,k,E,!0),h&&ct.toPoint(h,Vc,e,Vc,!0,!0))):v&&!u||(k=E=Tt.getFitScale(e,Vc,"fit"!==r),Tt.put(e,i,h,k,!1,Vc),Tt.scale(Vc,k,E,!0)),l&&K.move(Vc,l),r){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(Vc.x||Vc.y||k||g||u||p)&&Ic(w,e,Vc.x,Vc.y,k,E,u,p,t.clipSize);break;case"repeat":(!v||k||u||p)&&Wc(w,e,s,n,Vc.x,Vc.y,k,E,u,p,h,t.freeTransform),f||(w.repeat="repeat");const i=_(f);(y||i)&&(w.gap=function(t,e,i,s,n){let o,r;_(t)?(o=t.x,r=t.y):o=r=t;return{x:Gc(o,i,n.width,e&&e.x),y:Gc(r,s,n.height,e&&e.y)}}(y,i&&f,Vc.width,Vc.height,e));break;default:k&&Fc(w,e,Vc.x,Vc.y,k,E,u)}return w.transform||(e.x||e.y)&&(w.transform=Nc(),Yc(w.transform,e.x,e.y)),k&&"stretch"!==r&&(w.scaleX=k,w.scaleY=E),w.width=s,w.height=n,o&&(w.opacity=o),m&&(w.filters=m),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function Gc(t,e,i,s){const n=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Kc,qc=new Lt;const{isSame:Zc}=Tt;function Jc(t,e,i,s,n,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||jc(n,s,i,o),!0}function $c(t,e){eu(t,br.LOAD,e)}function Qc(t,e){eu(t,br.LOADED,e)}function tu(t,e,i){e.error=i,t.forceUpdate("surface"),eu(t,br.ERROR,e)}function eu(t,e,i){t.hasEvent(e)&&t.emitEvent(new br(e,i))}function iu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:su,scale:nu,copy:ou}=I,{floor:ru,ceil:au,max:hu,abs:lu}=Math;function du(e,i,s){let{scaleX:n,scaleY:o}=e.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+o+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:g,repeat:f,gap:y}=h;n*=s,o*=s,_&&(_=lu(_),p=lu(p),d=su(),ou(d,g),nu(d,1/_,1/p),n*=_,o*=p),c*=n,u*=o;const m=c*u;if(!f&&m>t.image.maxCacheSize)return!1;let v=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/au(t))}else{const t=a.width*a.height;v>t&&(v=t)}m>v&&(l=Math.sqrt(m/v)),l&&(n/=l,o/=l,c/=l,u/=l),_&&(n/=_,o/=p);const w=y&&y.x*n,x=y&&y.y*o;if(g||1!==n||1!==o){const t=c+(w||0),e=u+(x||0);n/=t/hu(ru(t),1),o/=e/hu(ru(e),1),d||(d=su(),g&&ou(d,g)),nu(d,1/n,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,e.leafer&&e.leafer.config.smooth),k=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,i);return i.style=k,i.patternId=r,!0}}const cu={image:function(t,e,i,s,n){let o,r;const a=Fn.get(i);return Kc&&i===Kc.paint&&Zc(s,Kc.boxBounds)?o=Kc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Kc=a.use>1?{leafPaint:o,paint:i,boxBounds:qc.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Jc(t,e,i,a,o,s),n&&($c(t,r),Qc(t,r))):a.error?n&&tu(t,r,a.error):(n&&(iu(t,!0),$c(t,r)),o.loadId=a.load(()=>{iu(t,!1),t.destroyed||(Jc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Qc(t,r)),o.loadId=void 0},e=>{iu(t,!1),tu(t,r,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(e,i,s,n){const{scaleX:o,scaleY:r}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!Fh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===t.name&&Cr.isResizing(e)||Fh.running)){let{width:e,height:i}=h;e*=o*a,i*=r*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),n=e*i>t.image.maxCacheSize}return n?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||Fh.running?du(e,s,a):s.patternTask||(s.patternTask=Fn.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&du(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:du,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,o,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(o||(o={}),o[a]=!0,Fn.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createData:jc,getPatternData:Uc,fillOrFitMode:Fc,clipMode:Ic,repeatMode:Wc},{toPoint:uu}=ht,{hasTransparent:_u}=Th,pu={},gu={};function fu(t,e,i,s){if(i){let n,o,r,h;for(let t=0,l=i.length;t<l;t++)n=i[t],a(n)?(r=t/(l-1),o=Th.string(n,s)):(r=n.offset,o=Th.string(n.color,s)),e.addColorStop(r,o),!h&&_u(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:yu,getDistance:mu}=K,{get:vu,rotateOfOuter:wu,scaleOfOuter:xu}=I,{toPoint:bu}=ht,ku={},Eu={};function Su(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=yu(e,i);o=vu(),n?(xu(o,e,r/a*(s||1),1),wu(o,e,t+90)):(xu(o,e,1,r/a*(s||1)),wu(o,e,t))}return o}const{getDistance:Bu}=K,{toPoint:Ru}=ht,Tu={},Cu={};const Ou={linearGradient:function(e,i){let{from:s,to:n,type:o,opacity:r}=e;uu(s||"top",i,pu),uu(n||"bottom",i,gu);const a=t.canvas.createLinearGradient(pu.x,pu.y,gu.x,gu.y),h={type:o,style:a};return fu(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=e;bu(s||"center",i,ku),bu(n||"bottom",i,Eu);const h=t.canvas.createRadialGradient(ku.x,ku.y,0,ku.x,ku.y,mu(ku,Eu)),l={type:o,style:h};fu(l,h,e.stops,r);const d=Su(i,ku,Eu,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=e;Ru(s||"center",i,Tu),Ru(n||"bottom",i,Cu);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Tu.x,Tu.y):t.canvas.createRadialGradient(Tu.x,Tu.y,0,Tu.x,Tu.y,Bu(Tu,Cu)),l={type:o,style:h};fu(l,h,e.stops,r);const d=Su(i,Tu,Cu,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Su},{copy:Pu,toOffsetOutBounds:Lu}=Tt,Au={},Mu={};function Du(e,i,s,n){const{bounds:o,shapeBounds:r}=n;if(t.fullImageShadow){if(Pu(Au,e.bounds),Au.x+=i.x-r.x,Au.y+=i.y-r.y,s){const{fitMatrix:t}=n;Au.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Au.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Au.width*=s,Au.height*=s}e.copyWorld(n.canvas,e.bounds,Au)}else s&&(Pu(Au,i),Au.x-=i.width/2*(s-1),Au.y-=i.height/2*(s-1),Au.width*=s,Au.height*=s),e.copyWorld(n.canvas,r,s?Au:i)}const{toOffsetOutBounds:Fu}=Tt,Iu={};const Wu={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Lu(l,Mu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Mu.offsetX+a.x*c*f,Mu.offsetY+a.y*u*f,a.blur*c*f,Th.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Du(_,Mu,n,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),s=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),Vo.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Fu(l,Iu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Iu.offsetX+a.x*c*f,Iu.offsetY+a.y*u*f,a.blur*c*f),n=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Du(_,Iu,n,i),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),s=o):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Th.string(a.color),"source-in"),Vo.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:zu}=$o;let Nu;function Yu(t,e,i,s,n,o,r,a){switch(e){case"grayscale":Nu||(Nu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,o){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),o&&s.recycle(r);Xu(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":Xu(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function Hu(t){return t.getSameCanvas(!1,!0)}function Xu(t,e,i,s,n,o){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,n),o?i.recycle(r):i.clearWorld(r)}yl.prototype.__renderMask=function(t,e){let i,s,n,o,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(Yu(this,r,t,n,s,o,void 0,!0),s=n=null),o=i.__.opacity,Nu=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=Hu(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Hu(t)),n||(n=Hu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||zu(i,e)||i.__render(t,e);continue}const d=1===o&&i.__.__blendMode;d&&Yu(this,r,t,n,s,o,void 0,!1),zu(i,e)||i.__render(n||t,e),d&&Yu(this,r,t,n,s,o,d,!1)}Yu(this,r,t,n,s,o,void 0,!0)};const Vu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ju=Vu+"_#~&*+\\=|≮≯≈≠=…",Uu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Gu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ku=Gu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),qu=Gu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Zu=Gu(Vu),Ju=Gu(ju),$u=Gu("- —/~|┆·");var Qu;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Qu||(Qu={}));const{Letter:t_,Single:e_,Before:i_,After:s_,Symbol:n_,Break:o_}=Qu;function r_(t){return Ku[t]?t_:$u[t]?o_:qu[t]?i_:Zu[t]?s_:Ju[t]?n_:Uu.test(t)?e_:t_}const a_={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function h_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:l_}=a_,{Letter:d_,Single:c_,Before:u_,After:__,Symbol:p_,Break:g_}=Qu;let f_,y_,m_,v_,w_,x_,b_,k_,E_,S_,B_,R_,T_,C_,O_,P_,L_,A_=[];function M_(t,e){E_&&!k_&&(k_=E_),f_.data.push({char:t,width:e}),m_+=e}function D_(){v_+=m_,f_.width=m_,y_.words.push(f_),f_={data:[]},m_=0}function F_(){C_&&(O_.paraNumber++,y_.paraStart=!0,C_=!1),E_&&(y_.startCharSize=k_,y_.endCharSize=E_,k_=0),y_.width=v_,P_.width?l_(y_):L_&&I_(),A_.push(y_),y_={words:[]},v_=0}function I_(){v_>(O_.maxWidth||0)&&(O_.maxWidth=v_)}const{top:W_,right:z_,bottom:N_,left:Y_}=ot;function H_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const X_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(o?(s=d[Y_],o-=d[z_]+d[Y_]):i.autoSizeAlign||(s=d[Y_]),r?(n=d[W_],r-=d[W_]+d[N_]):i.autoSizeAlign||(n=d[W_]));const c={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){O_=e,A_=e.rows,P_=e.bounds,L_=!P_.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=P_;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;C_=!0,B_=null,k_=b_=E_=m_=v_=0,f_={data:[]},y_={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)x_=i[s],"\n"===x_?(m_&&D_(),y_.paraEnd=!0,F_(),C_=!0):(S_=r_(x_),S_===d_&&"none"!==r&&(x_=h_(x_,r,!m_)),b_=a.measureText(x_).width,n&&(n<0&&(E_=b_),b_+=n),R_=S_===c_&&(B_===c_||B_===d_)||B_===c_&&S_!==__,T_=!(S_!==u_&&S_!==c_||B_!==p_&&B_!==__),w_=C_&&o?h-o:h,t&&h&&v_+m_+b_>w_&&(e?(m_&&D_(),v_&&F_()):(T_||(T_=S_===d_&&B_==__),R_||T_||S_===g_||S_===u_||S_===c_||m_+b_>w_?(m_&&D_(),v_&&F_()):v_&&F_()))," "===x_&&!0!==C_&&v_+m_===0||(S_===g_?(" "===x_&&m_&&D_(),M_(x_,b_),D_()):R_||T_?(m_&&D_(),M_(x_,b_)):M_(x_,b_)),B_=S_);m_&&D_(),v_&&F_(),A_.length>0&&(A_[A_.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{O_.paraNumber++,v_=a.measureText(t).width,A_.push({x:o||0,text:t,width:v_,paraStart:!0}),L_&&I_()})}(c,e,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":H_(e,"x",t[Y_]);break;case"right":H_(e,"x",-t[z_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":H_(e,"y",t[W_]);break;case"bottom":H_(e,"y",-t[N_])}}(d,c,i,o,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:o,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=o*n+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(m+=c),v.y=m,m+=o,t.overflow>r&&m>y&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:o,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=r||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,o),c.overflow&&function(e,i,s,n){if(!n)return;const{rows:o,overflow:r}=e;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,s,o),"none"!==h&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,_(n)?(i=n.type,n.color&&(t.decorationColor=Th.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const V_={string:function(t,e){const i=l(e)&&e<1;if(a(t)){if(!i||!Th.object)return t;t=Th.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function j_(t){return t?u(t)?t:[t]:[]}Object.assign(Rh,X_),Object.assign(Th,V_),Object.assign(Ph,Sc),Object.assign(Lh,cu),Object.assign(Ah,Ou),Object.assign(Mh,Wu),Object.assign(jt,{interaction:(t,e,i,s)=>new jd(t,e,i,s),hitCanvas:(t,e)=>new ih(t,e),hitCanvasManager:()=>new Gd}),nh();class U_ extends yr{get list(){return j_(this.value)}get oldList(){return j_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function G_(t){return(e,i)=>{const s="_"+i;Xn(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){if(this.config){const t="target"===i;if(t){u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(_(i))e=i;else if(!1===i)return}}const s=t?U_.BEFORE_SELECT:U_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new U_(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}U_.BEFORE_SELECT="editor.before_select",U_.SELECT="editor.select",U_.AFTER_SELECT="editor.after_select",U_.BEFORE_HOVER="editor.before_hover",U_.HOVER="editor.hover";const{abs:K_}=Math,{copy:q_,scale:Z_}=I,{setListWithFn:J_}=Tt,{worldBounds:$_}=$o,Q_={a:1,b:0,c:0,d:1,e:0,f:0},tp={x:0,y:0,width:0,height:0};class ep extends fl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(J_(tp,e,$_),t&&this.set(t),this.set(tp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:r,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=K_(c.scaleX),l=K_(c.scaleY);if(q_(Q_,c),Q_.half=r%2,i!==l){Z_(Q_,1/i,1/l),t.setWorld(Q_,e.matrix),t.beginPath(),n.strokeWidth=r;const{x:o,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,a*l,h*i,d*l)}else t.setWorld(Q_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/K_(c.scaleX);o&&(a(o)?Ph.stroke(o,this,t):Ph.strokes(o,this,t)),h&&(a(h)?Ph.fill(h,this,t):Ph.fills(h,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}Qt([G_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],ep.prototype,"target",void 0);class ip extends yl{constructor(t){super(t),this.strokeArea=new xl({strokeAlign:"center"}),this.fillArea=new xl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const sp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return np([t],i,e),i}};function np(t,e,i){let s,n;for(let o=0,r=t.length;o<r;o++)if(s=t[o],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&np(s.children,e,i)}}const{findOne:op,findByBounds:rp}=sp;class ap extends yl{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new ep,this.targetStroker=new ep,this.bounds=new Lt,this.selectArea=new ip,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:n}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},n||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:o}=t.getInnerPoint(this);this.bounds.set(n,o),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:o},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new Qa(rp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!op(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Qa(this.editor.editBox.rect)};return op(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):op(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[U_.HOVER,this.onHover,this],[U_.SELECT,this.onSelect,this]]),e.on_([[md.MOVE,this.onPointerMove,this],[md.BEFORE_DOWN,this.onBeforeDown,this],[md.TAP,this.onTap,this],[xd.START,this.onDragStart,this,!0],[xd.DRAG,this.onDrag,this],[xd.END,this.onDragEnd,this],[Ed.MOVE,this.onAutoMove,this],[[Rd.ZOOM,Ed.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:hp,top:lp,topRight:dp,right:cp,bottomRight:up,bottom:_p,bottomLeft:pp,left:gp}=rt,{toPoint:fp}=ht,{within:yp,sign:mp}=b,vp={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:p,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=mp(v),b=mp(w),k=a?v:x*u.width/y,E=a?w:b*u.height/m;s.x*=a?v:x,s.y*=a?w:b;const S=(-s.y+m)/m,B=(s.x+y)/y,R=(s.y+m)/m,T=(-s.x+y)/y;switch(i){case lp:c=S,h="bottom";break;case cp:d=B,h="left";break;case _p:c=R,h="top";break;case gp:d=T,h="right";break;case hp:c=S,d=T,h="bottom-right";break;case dp:c=S,d=B,h="bottom-left";break;case up:c=R,d=B,h="top-left";break;case pp:c=R,d=T,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case lp:case _p:t=c;break;case gp:case cp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const C=1!==d,O=1!==c;if(C&&(d/=k),O&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(fp(o||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new Lt(t.__localBoxBounds);if(Tt.includes(new Lt(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Tt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;C&&(d*=s),O&&(c*=n)}}if(C&&_){const e=u.width*t.scaleX;d=yp(e*d,_)/e}if(O&&p){const e=u.height*t.scaleY;c=yp(e*c,p)/e}return C&&Math.abs(d*f.width)<1&&(d=mp(d)/f.width),O&&Math.abs(c*f.height)<1&&(c=mp(c)/f.height),n&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:n,around:o}},getRotateData(t,e,i,s,n){let o,r={};switch(e){case hp:o="bottom-right";break;case dp:o="bottom-left";break;case up:o="top-left";break;case pp:o="top-right";break;default:o="center"}return fp(n||o,t.boxBounds,r,!0),{origin:r,rotation:K.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case lp:case hp:o={x:.5,y:0},n="bottom",a=1;break;case _p:case up:o={x:.5,y:1},n="top",a=1;break;case gp:case pp:o={x:0,y:.5},n="right",h=1;break;case cp:case dp:o={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;o.x=o.x*l,o.y=o.y*d,fp(s||n,t,r,!0);const c=K.getRotation(o,r,{x:o.x+(a?i.x:0),y:o.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case gp:t=cp;break;case hp:t=dp;break;case pp:t=up;break;case cp:t=gp;break;case dp:t=hp;break;case up:t=pp}if(i)switch(t){case lp:t=_p;break;case hp:t=pp;break;case dp:t=up;break;case _p:t=lp;break;case pp:t=hp;break;case up:t=dp}return t}},wp={};function xp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:o,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:_,rotateable:p,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&p&&(t.isHoldRotateKey(e)||!_)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?n?u:o?d:c:y?u:f?d:c;h+=45*(vp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(b.formatRotation(h,!0)/2);const{url:v,x:w,y:x}=m,k=v+h;wp[k]?i.cursor=wp[k]:wp[k]=i.cursor={url:kp(v,h),x:w,y:x}}function bp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function kp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Ep extends Rl{constructor(t){super(t),this.useFastShadow=!0}}const Sp=["top","right","bottom","left"],Bp=void 0;class Rp extends yl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}constructor(t){super(),this.view=new yl,this.rect=new Rl({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Ep({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new yl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:o,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new Ep({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Ep({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Ep({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...o,a,h,l,...r,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o}=this,{stroke:r,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;this.visible=!t.locked;for(let t=0;t<8;t++)d=o[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;n.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:Bp},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),bp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:o,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{middlePoint:c,resizeable:u,rotateable:_,hideOnSmall:p,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Tt.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=l(p)?p:10,w=g&&!(p&&e<y&&f<y);let x,b,k,E={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,E),b=a[i],x=h[i],b.set(E),x.set(E),b.visible=w&&!(!u&&!_),x.visible=w&&_&&u&&!m,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=b.visible&&!v,b.visible=x.visible=w&&!!c,(i+1)/2%2?(k.width=e,p&&2*b.width>e&&(b.visible=!1)):(k.height=f,p&&2*b.width>f&&(b.visible=!1)));o.visible=w&&_&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||g})),r.visible=w&&r.children.length>0||0,r.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,o=Sp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,o,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:o,flippedY:r}=this;let a=Sp.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?vp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=o?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],o=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*r;o?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:o}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:o,offsetX:0,offsetY:0,editConfig:Bp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:n}=this,{target:o}=this,{moveable:r,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(r&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||this.isHoldRotateKey(t)||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),n.x=t.x,n.y=t.y,n.point={x:o.x,y:o.y},n.bounds=Object.assign({},o.getLayoutBounds("box","local")),n.rotation=o.rotation,i&&i.includes("resize")&&(Cr.resizingKeys=s.leafList.keys)}onDragEnd(t){this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds&&this.transformTool.onMove(t),this.dragPoint=null,this.resetDoing();const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(Cr.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t),bp(this);else if(s||n||o){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),o&&e.onSkew(t),xp(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onMoveEnd(t){this.moving&&this.transformTool.onMove(t),this.resetDoing()}onScale(t){this.canGesture&&(t.stop(),a(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){xp(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":e=-n;break;case"ArrowRight":e=n}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof dd)||t.find(t=>t instanceof dd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e;const s=[[xd.START,this.onDragStart,this],[xd.DRAG,this.onDrag,this],[xd.END,this.onDragEnd,this],[md.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&s.push([md.ENTER,e=>{this.enterPoint=t,xp(this,e)}]),this.__eventIds.push(t.on_(s))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[xd.START,this.onDragStart,this],[xd.DRAG,this.onDrag,this],[xd.END,this.onDragEnd,this],[md.ENTER,()=>bp(this)],[md.DOUBLE_TAP,this.onDoubleTap,this],[md.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[Td.HOLD,Td.UP],this.onKey,this],[Td.DOWN,this.onArrow,this],[Ed.BEFORE_MOVE,this.onMove,this,!0],[Rd.BEFORE_ZOOM,this.onScale,this,!0],[Sd.BEFORE_ROTATE,this.onRotate,this,!0],[Ed.END,this.onMoveEnd,this],[Rd.END,this.resetDoing,this],[Sd.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Tp={x:0,y:0,width:1e5,height:1e5};class Cp extends fl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Tp),Object.assign(this.__world,Tp)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const Op='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',Pp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${Op}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${Op}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${Op}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},Lp=new Lt;function Ap(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Lp.setListWithFn(i,t=>t.getBounds("box","page")),0===Lp.width&&(Lp.width=.1),0===Lp.height&&(Lp.height=.1),e.reset(Lp.get())}),s.add(e)}const Mp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Dp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Fp={group(t,e,i){t.sort(Dp);const{app:s,parent:n}=t[0];let o;o=i&&i.add?i:new yl(i),n.addAt(o,n.children.indexOf(t[0])),t.sort(Mp);const r=new et(e.worldTransform);return r.divideParent(n.scrollWorldTransform),o.setTransform(r),o.editable=!0,o.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(o)),s.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(Mp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Dp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},Ip=It.get("EditToolCreator");function Wp(){return t=>{Np.register(t)}}const zp=Wp,Np={list:{},register(t){const{tag:e}=t.prototype;Yp[e]&&Ip.repeat(e),Yp[e]=t},get:(t,e)=>new Yp[t](e)},{list:Yp}=Np;class Hp extends U_{constructor(t,e){super(t,e)}}Hp.BEFORE_OPEN="innerEditor.before_open",Hp.OPEN="innerEditor.open",Hp.BEFORE_CLOSE="innerEditor.before_close",Hp.CLOSE="innerEditor.close";class Xp extends U_{constructor(t,e){super(t,e)}}Xp.BEFORE_GROUP="editor.before_group",Xp.GROUP="editor.group",Xp.BEFORE_UNGROUP="editor.before_ungroup",Xp.UNGROUP="editor.ungroup",Xp.BEFORE_OPEN="editor.before_open_group",Xp.OPEN="editor.open_group",Xp.BEFORE_CLOSE="editor.before_close_group",Xp.CLOSE="editor.close_group";const{updateMatrix:Vp}=Vo,jp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Up="top-left";class Gp extends xl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(wr.CHANGE,e=>{if(this.checkChange&&jp[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,o="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const r=this.__;r[i]=n,Vp(this.parent),Vp(this);const a=new et(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Vp(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(Up,o);break;case"scaleX":t.scaleOf(Up,o,1);break;case"scaleY":t.scaleOf(Up,1,o);break;case"skewX":t.skewOf(Up,o,0);break;case"skewY":t.skewOf(Up,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Kp extends U_{constructor(t,e){super(t,e)}}Kp.BEFORE_MOVE="editor.before_move",Kp.MOVE="editor.move";class qp extends U_{constructor(t,e){super(t,e)}}qp.BEFORE_SCALE="editor.before_scale",qp.SCALE="editor.scale";class Zp extends U_{constructor(t,e){super(t,e)}}Zp.BEFORE_ROTATE="editor.before_rotate",Zp.ROTATE="editor.rotate";class Jp extends U_{constructor(t,e){super(t,e)}}Jp.BEFORE_SKEW="editor.before_skew",Jp.SKEW="editor.skew";class $p{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:o}=i;const r=t.type===Ed.END||t.type===xd.END,h=a(e.draggable),d=!o||r||h;if(t instanceof Ed)n=t.getLocalMove(e),d&&xd.limitMove(e,n);else{const i={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),n=xd.getValidMove(e,s.point,i,d)}(n.x||n.y)&&(o&&!h&&r?Vo.animateMove(this,n,l(o)?o:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:n}=this.editBox;let{around:o,lockRatio:r,flipable:a,editSize:h}=i;if(t instanceof Rd)this.scaleOf(e.getBoxPoint(t),t.scale,t.scale);else{const{direction:i}=t.current;(t.shiftKey||e.lockRatio)&&(r=!0);const l=vp.getScaleData(e,n.bounds,i,t.getInnerTotal(e),r,vp.getAround(o,t.altKey),a,!s||"scale"===h);this.editTool&&this.editTool.onScaleWithDrag?(l.drag=t,this.scaleWithDrag(l)):this.scaleOf(l.origin,l.scaleX,l.scaleY)}}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:n,rotateAround:o,rotateGap:r}=i,{direction:a}=t.current;let h,l;if(t instanceof Sd)l=t.rotation,h=o?ht.getPoint(o,e.boxBounds):e.getBoxPoint(t);else{const i=vp.getRotateData(e,a,t,s,t.shiftKey?null:o||e.around||e.origin||n||"center");l=s.rotation+i.rotation-e.rotation,h=i.origin}l=b.float(b.getGapRotation(l,r,e.rotation),2),l&&this.rotateOf(h,l)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=vp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),vp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;_(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(_(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:o,moveX:a.x,moveY:a.y};this.emitEvent(new Kp(Kp.BEFORE_MOVE,h));const l=new Kp(Kp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:o,drag:r}=t;if(!1===n({target:e,drag:r,origin:i,scaleX:s,scaleY:o}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new qp(qp.BEFORE_SCALE,t));const o=new qp(qp.SCALE,t);this.editTool.onScaleWithDrag(o),this.emitEvent(o)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeScale:h}=o;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(_(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new qp(qp.BEFORE_SCALE,c));const u=new qp(qp.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),o=i?new et(Vo.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:o};this.emitEvent(new qp(qp.BEFORE_SCALE,r));const a=new qp(qp.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:o}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Zp(Zp.BEFORE_ROTATE,d));const c=new Zp(Zp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:o,single:r,editor:a}=this.editBox,{beforeSkew:h}=o;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(_(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Jp(Jp.BEFORE_SKEW,c));const u=new Jp(Jp.SKEW,c);this.doSkew(u),this.emitEvent(u)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(Vo.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new et(e.worldTransform);return t(),new et(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Qp=class extends yl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new Qa,this.openedGroupList=new Qa,this.simulateTarget=new Gp(this),this.editBox=new Rp(this),this.editToolList={},this.selector=new ap(this),this.editMask=new Cp(this),this.targetEventIds=[];let i=f.clone(Pp);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Vt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Ap(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(a(s))e=s;else if(!1===s)return}if(Np.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||Np.get(e,this);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Xp.BEFORE_GROUP),this.target=Fp.group(this.list,this.element,t),this.emitGroupEvent(Xp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Xp.BEFORE_UNGROUP,t)),this.target=Fp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Xp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Xp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Xp.OPEN,t)}closeGroup(t){this.emitGroupEvent(Xp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Xp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Vo.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Xp(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(a(i))s=i;else if(!1===i)return}Np.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||Np.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(Hp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Hp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Hp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Hp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Hp(t,{editTarget:i,innerEditor:e});i.syncEventer||this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(Fp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Fp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Lr.START,this.onRenderStart,this),i&&i.on_(wr.SCROLL,this.onChildScroll,this),t.on_(Lr.CHILD_START,this.onAppRenderStart,this)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};Qt([(t,e)=>{Xn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=this,a=Object.assign({},t);return e&&e.editConfig&&Object.assign(a,e.editConfig),s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),o(a.dragLimitAnimate)&&(a.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Qp.prototype,"mergeConfig",void 0),Qt([G_(function(t,e){t.emitEvent(new U_(U_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Qp.prototype,"hoverTarget",void 0),Qt([G_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Qa?i:new Qa(i),t.multiple&&Ap(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new U_(U_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new U_(U_.AFTER_SELECT,s))})],Qp.prototype,"target",void 0),Qp=Qt([Oo($p,["editBox","editTool","emitEvent"])],Qp);class tg{static registerInnerEditor(){Np.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new yl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let eg=class extends tg{static registerEditTool(){Np.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:o}=s;n.lockLayout(),o.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(n,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:o,list:r}=n;o.lockLayout(),r.forEach(t=>{const o="scale"!==n.getEditSize(t);i?t.transformWorld(i,o):t.rotateOfWorld(s,e)}),o.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:o}=t,{app:r,list:a}=o;r.lockLayout(),a.forEach(t=>{const r="scale"!==o.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(n,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};eg=Qt([Wp()],eg);const{left:ig,right:sg}=rt,{move:ng,copy:og,toNumberPoints:rg}=K;let ag=class extends eg{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,o=t.target,r=i===ig;if(o.pathInputed){const{path:t}=o.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,o.path=t}else if(o.points){const{points:t}=o,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,n,this.getInnerMove(o,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,o.points=t}else{const t={x:0,y:0},{toPoint:i}=o;o.rotation=0,this.dragPoint(t,i,r,n,this.getInnerMove(o,e,s)),o.getLocalPointByInner(t,null,null,!0),o.getLocalPointByInner(i,null,null,!0),o.x=t.x,o.y=t.y,o.getInnerPointByLocal(i,null,null,!0),o.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=rg(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:o,y:r}=n;i?(ng(t,o,r),s&&ng(e,-o,-r)):(s&&ng(t,-o,-r),ng(e,o,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,o=this.editor.element;let r,a;if(o.pathInputed?r=this.getFromToByPath(o.__.path):o.points&&(r=this.getFromToByPoints(o.__.points)),r){const{from:i,to:a}=r;o.innerToWorld(i,i,!1,t),o.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),og(s[7],i),og(e[7],i),og(s[3],a),og(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===ig||t===sg,s[t].visible=a,e[t].visible=!r&&a}};ag=Qt([Wp()],ag);const{M:hg,L:lg,C:dg,Q:cg,Z:ug,N:_g,D:pg,X:gg,G:fg,F:yg,O:mg,P:vg,U:wg}=fe,xg={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case hg:case lg:bg(t,e,i,n,1),n+=3;break;case dg:bg(t,e,i,n,3),n+=7;break;case cg:bg(t,e,i,n,2),n+=5;break;case ug:n+=1;break;case _g:bg(t,e,i,n,2),n+=5;break;case pg:bg(t,e,i,n,2),n+=9;break;case gg:bg(t,e,i,n,2),n+=6;break;case fg:bg(t,e,i,n,2),n+=9;break;case yg:bg(t,e,i,n,2),n+=5;break;case mg:t[n]=fg,t.splice(n+4,0,t[n+3],0),bg(t,e,i,n,2),n+=9,o+=2;break;case vg:t[n]=yg,t.splice(n+4,0,t[n+3]),bg(t,e,i,n,2),n+=5,o+=1;break;case wg:bg(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let o=n?s+1:0,r=n?o+2*n:t.length;o<r;o+=2)t[o]*=e,t[o+1]*=i}},{scalePoints:bg}=xg,kg=I.get(),{topLeft:Eg,top:Sg,topRight:Bg,right:Rg,bottom:Tg,left:Cg}=rt;function Og(t,e,i){t.pathInputed?Lg(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Pg(t,e,i,s){let n=e;if(!o(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case Sg:case Tg:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Cg:case Rg:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Eg:case Bg:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function Lg(t,e,i){xg.scale(t.__.path,e,i),t.path=t.__.path}function Ag(t,e,i){const{points:s}=t;_(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):xg.scalePoints(s,e,i),t.points=s}function Mg(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)kg.a=e,kg.d=i,s[t].transform(kg,!0)}const Dg=Ha.prototype;Dg.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},Dg.__scaleResize=function(t,e){Og(this,t,e)},Dg.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Dg.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},dd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,o=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===n.mergedConfig.editSize)Pg(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:o}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=r.x),s&&"top"!==o&&1!==e&&(this.y+=r.y),Og(this,t,e)}},cd.prototype.__scaleResize=function(t,e){Lg(this,t,e)},Nl.prototype.__scaleResize=function(t,e){this.pathInputed?Lg(this,t,e):this.points?Ag(this,t,e):this.width*=t},ql.prototype.__scaleResize=function(t,e){this.pathInputed?Lg(this,t,e):this.points?Ag(this,t,e):Og(this,t,e)},yl.prototype.__scaleResize=function(t,e){Mg(this,t,e)},Rl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Og(this,t,e),i&&Mg(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),jt.editor=function(t,e){const i=new Qp(t);return e&&e.sky.add(e.editor=i),i},Rl.addAttr("textBox",!1,qn),fl.addAttr("editConfig",void 0,qn),fl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),qn),fl.addAttr("editInner","PathEditor",qn),yl.addAttr("editInner","",qn),dd.addAttr("editInner","TextEditor",qn),fl.setEditConfig=function(t){this.changeAttr("editConfig",t)},fl.setEditOuter=function(t){this.changeAttr("editOuter",t)},fl.setEditInner=function(t){this.changeAttr("editInner",t)};const Fg={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Ig={top:"flex-start",middle:"center",bottom:"flex-end"},Wg={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function zg(t,e,i){const{style:s}=t,{fill:n,padding:r,textWrap:h,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(_(e))switch(e.type){case"solid":i=Th.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Th.string(a(t)?t:t.color);break;default:o(e.r)||(i=Th.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,_(d)?(c=d.type,d.color&&(s.textDecorationColor=Th.string(d.color))):c=d,s.textDecoration=Wg[c],s.textTransform=Fg[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Ig[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(r)?r.map(t=>t*i+"px").join(" "):(r||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}let Ng=class extends tg{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:t}=this,{config:e}=t.app,i=this.editTarget;i.textEditing=!0,this.isHTMLText=!(i instanceof dd),this._keyEvent=e.keyEvent,e.keyEvent=!1;const s=this.editDom=document.createElement("div"),{style:n}=s;s.contentEditable="true",n.position="fixed",n.transformOrigin="left top",n.boxSizing="border-box",this.isHTMLText?s.innerHTML=String(i.text):s.innerText=String(i.text);const{view:o}=t.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(s):o.appendChild(s),this.eventIds=[t.app.on_(md.DOWN,e=>{let i,{target:n}=e.origin;for(;n;)n===s&&(i=!0),n=n.parentElement;i||t.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),s.addEventListener("focus",this.onFocus),s.addEventListener("input",this.onInput),s.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const r=window.getSelection(),a=document.createRange();if(this.config.selectAll)a.selectNodeContents(s);else{const t=s.childNodes[0];a.setStartAfter(t),a.setEndAfter(t),a.collapse(!0)}r.removeAllRanges(),r.addRange(a)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const o=i.split("\n"),r=document.createDocumentFragment();o.forEach((t,e)=>{e>0&&r.appendChild(document.createElement("br")),r.appendChild(document.createTextNode(t))}),n.insertNode(r),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,o=0;i*=e,s*=e;const r=t.__;if(r.__autoWidth&&(i+=20,r.autoSizeAlign))switch(r.textAlign){case"center":n=-i/2;break;case"right":n=-i}if(r.__autoHeight&&(s+=20,r.autoSizeAlign))switch(r.verticalAlign){case"middle":o=-s/2;break;case"bottom":o=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:_,f:p}=new et(t.worldTransform).scale(1/e).translateInner(n,o),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${_},${p})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||zg(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}};function Yg(t,e,i){Hg(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Ed.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(Ed.END,e=>{Vo.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(Rd.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function Hg(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}Ng=Qt([zp()],Ng),Vt.add("text-editor","editor");const Xg=It.get("LeaferTypeCreator"),Vg={list:{},register(t,e){jg[t]&&Xg.repeat(t),jg[t]=e},run(t,e){const i=jg[t];i&&i(e)}},{list:jg,register:Ug}=Vg;Ug("viewport",Yg),Ug("custom",function(t){Yg(t,null,!0)}),Ug("design",function(t){Yg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Ug("document",function(t){Yg(t,{zoom:{min:1},move:{scroll:"limit"}})});const Gg={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),n=K.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=K.getDistance(e.from,i.from);return{move:o,scale:K.getDistance(e.to,i.to)/r,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:n}}},{abs:Kg,max:qg}=Math,{sign:Zg,within:Jg}=b,$g={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=Kg(s),r=Kg(n);return o>50&&(s=qg(50,o/3)*Zg(s)),r>50&&(n=qg(50,r/3)*Zg(n)),{x:-s*i*2,y:-n*i*2}},getScale(e,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=e.deltaY||e.deltaX;if(o?(s="mouse"===o||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=Jg(r,0,1);const t=e.deltaY?i.delta.y:i.delta.x,s=Jg(1-Kg(a)/(4*t)*r,.5,2);n=a>0?s:1/s}return n}};class Qg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Ed.START,this.moveData)),t.path=this.moveData.path,e.emit(Ed.BEFORE_MOVE,t),e.emit(Ed.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Rd.START,this.zoomData)),t.path=this.zoomData.path,e.emit(Rd.BEFORE_ZOOM,t),e.emit(Rd.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Sd.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Sd.BEFORE_ROTATE,t),e.emit(Sd.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Ed.END,e),i&&t.emit(Rd.END,i),s&&t.emit(Sd.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const tf=wl.prototype,ef=new Lt,sf=new Q;function nf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function of(t,e){return Object.assign(Object.assign({},e),{scale:t})}tf.initType=function(t){Vg.run(t,this)},tf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(sf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?sf.y=0:t.includes("y")?sf.x=0:Math.abs(sf.x)>Math.abs(sf.y)?sf.y=0:sf.x=0,i&&t.includes("limit")&&(ef.set(this.__world).addPoint(this.zoomLayer),ll.getValidMove(ef,this.canvas.bounds,"inner",sf,!0),t.includes("x")?sf.y=0:t.includes("y")&&(sf.x=0))}return{x:n?0:sf.x,y:n?0:sf.y}},tf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,o=Math.abs(e*t);return i&&o<i?t=i/e:s&&o>s&&(t=s/e),n?1:t};const rf=jd.prototype;rf.createTransformer=function(){this.transformer=new Qg(this)},rf.move=function(t){this.transformer.move(t)},rf.zoom=function(t){this.transformer.zoom(t)},rf.rotate=function(t){this.transformer.rotate(t)},rf.transformEnd=function(){this.transformer.transformEnd()},rf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const o=e.getScale?e.getScale(t,e):$g.getScale(t,e);if(1!==o)this.zoom(of(o,t));else{const s=e.getMove?e.getMove(t,e):$g.getMove(t,e);i.snap&&K.round(s),this.move(nf(s,t))}},rf.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=Gg.getData(e);Object.assign(t,o),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(of(n,t)),this.move(nf(i,t))};const af=Dd.prototype,{abs:hf}=Math;function lf(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}af.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=hf(i),o=hf(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(n>r||o>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;n*(e=e?l(a)?a:.95:r)>h?e=h/n:o*e>h&&(e=h/o),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},af.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},af.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},af.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:o}=e.m;if(!o||!s||!n)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Tt.maxX(r),d=Tt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let _=0,p=0;this.autoMoveTimer=setInterval(()=>{_+=c,p+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},af.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),wl.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),p(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,h=this.canvas.bounds.clone().shrink(r(n)?30:n),d=new Lt,c={x:h.x+h.width/2,y:h.y+h.height/2};let g;const{x:f,y:y,scaleX:m,scaleY:v}=o.__;if(a(t))switch(t){case"in":g=lf(m,"in");break;case"out":g=lf(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Lt(this.boxBounds)).height=0;break;case"fit-height":(t=new Lt(this.boxBounds)).width=0}else l(t)&&(g=t/m);if(g)g=this.getValidScale(g),o.scaleOfWorld(c,g,g,!1,s);else if(_(t)){const e={x:f,y:y,scaleX:m,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];d.setListWithFn(e,$o.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:o,height:r}=t;return r||(r=o*(e.height/e.width),i=!0),o||(o=r*(e.width/e.height),i=!0),i?{x:s,y:n,width:o,height:r}:t}(t,h);d.set(o.getWorldBounds(e))}const{width:r,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-r)/2,0),c+=Math.max((h.height-a)/2,0)):(g=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*g)/2,c+=(h.height-a*g)/2,K.scaleOf(e,d,g),d.scaleOf(d,g),e.scaleX*=g,e.scaleY*=g),"x"===i?c=0:"y"===i&&(l=0),K.move(e,l,c),d.move(l,c),o.set(e,s),d}return o.worldBoxBounds};class df extends yl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Rl,this.scrollYBar=new Rl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:o}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(o))return;this.scrollBounds=new Lt(o);const r=n.bounds.clone().shrink(i),a=r.clone().add(o),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,_=l<1,{scrollXBar:p,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,_?g.width+6:2,u?p.height+6:2,2]);p.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(xd.DRAG,this.onDrag,this),e.on_(xd.DRAG,this.onDrag,this),t.on_(xd.END,this.onDragEnd,this),e.on_(xd.END,this.onDragEnd,this),this.target.on_(Lr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Cr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Vt.add("scroll");class cf extends rl{setText(t){this._text=t,this.__htmlChanged=!0}}let uf=class extends sd{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),o=s+10,r=`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}">\n <foreignObject width="${o}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(r)),t.__naturalWidth=o/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}};Qt([xo(cf)],uf.prototype,"__",void 0),Qt([eo("")],uf.prototype,"text",void 0),Qt([qn("TextEditor")],uf.prototype,"editInner",void 0),Qt([co(!1)],uf.prototype,"textEditing",void 0),uf=Qt([Po()],uf),Vt.add("html");class _f extends Jh{}function pf(t){return Un(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,ao(this)}}}))}let gf=class extends Nl{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Oh.register(t,e)}};Qt([xo(_f)],gf.prototype,"__",void 0),Qt([pf("angle")],gf.prototype,"endArrow",void 0),gf=Qt([Po()],gf);const{M:ff,L:yf,C:mf,Q:vf,O:wf}=fe,{rotate:xf,copyFrom:bf,scale:kf}=K,Ef={},Sf={layout(t,e,i,s,n,o,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case ff:case yf:Bf(t,l+1,e,i,s,n,o,r),l+=3;break;case mf:for(h=1;h<6;h+=2)Bf(t,l+h,e,i,s,n,o,r);l+=7;break;case vf:for(h=1;h<4;h+=2)Bf(t,l+h,e,i,s,n,o,r);l+=5;break;case wf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),o&&(t[l+4]+=o,t[l+5]+=o),l+=7}},rotate(t,e,i){Sf.layout(t,0,0,1,1,e,i)}};function Bf(t,e,i,s,n,o,r,a){bf(Ef,t[e],t[e+1]),r&&xf(Ef,r,a),n&&kf(Ef,n,o),t[e]=i+Ef.x,t[e+1]=s+Ef.y}const{layout:Rf,rotate:Tf}=Sf,{getAngle:Cf}=K,Of={x:-.5},Pf={connect:Of,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Lf={connect:Of,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Af={connect:Of,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},Mf={connect:Of,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},Df={offset:Of,path:[...Af.path],dashPath:[1,-2.5,0,2,-1,0]};Tf(Df.path,180,{x:-1.5,y:0});const Ff={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},If={connect:{x:.5},path:[...Ff.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Wf={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},zf={path:[...Wf.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Nf=f.clone(Wf),Yf=f.clone(zf);Tf(Nf.path,45),Tf(Yf.path,45);const Hf={angle:Pf,"angle-side":Lf,arrow:Mf,triangle:Af,"triangle-flip":Df,circle:If,"circle-line":Ff,square:zf,"square-line":Wf,diamond:Yf,"diamond-line":Nf,mark:{offset:Of,path:[1,0,-2,2,0,2]}};function Xf(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;_(e)?e.type?(h=e.scale,a=Hf[e.type]):a=e:a=Hf[e];const{offset:c,connect:u,path:p,dashPath:g}=a;let f=u?u.x:0,y=c?c.x:0;const m=[...p];return r&&g&&m.push(...g),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?y+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(y+=c.bevelJoin)),h&&Rf(m,0,0,h,h),y&&Rf(m,y,0),Rf(m,s.x,s.y,n,n,Cf(i,s)),o.x=(f+y)*n,m}const{M:Vf,L:jf,C:Uf,Q:Gf,Z:Kf,N:qf,D:Zf,X:Jf,G:$f,F:Qf,O:ty,P:ey,U:iy}=fe,{copy:sy,copyFrom:ny,getDistancePoint:oy}=K,ry={},ay={},hy={},ly={},dy={},cy={list:Hf,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:o,cornerRadius:r}=t.__,a=!r;let h,l=0,d=o.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=o[l],h){case Vf:case jf:(c<2||l+6>=d)&&(ny(dy,o[l+1],o[l+2]),!c&&u&&sy(ay,dy)),l+=3;break;case Uf:(1===c||l+7>=d-3)&&uy(o,ly,dy,l+3),l+=7;break;case Gf:(1===c||l+5>=d-3)&&uy(o,ly,dy,l+1),l+=5;break;case Kf:return;case qf:l+=5;break;case Zf:l+=9;break;case Jf:l+=6;break;case $f:l+=9;break;case Qf:l+=5;break;case ty:l+=7;break;case ey:l+=4;break;case iy:(1===c||l+6>=d-3)&&(uy(o,ly,dy,l+1),l+6!==d&&(dy.x-=(dy.x-ly.x)/10,dy.y-=(dy.y-ly.y)/10)),l+=6}if(c++,1===c&&h!==Vf)return;if(2===c&&u&&sy(hy,h===jf?dy:ly),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=Xf(t,e,hy,ay,s,ry,!!n);n?d.push(...i):r.push(...i),ry.x&&(oy(ay,hy,-ry.x,!0),r[1]=hy.x,r[2]=hy.y)}if(i&&"none"!==i){const e=Xf(t,i,ly,dy,s,ry,!!n);if(n?d.push(...e):r.push(...e),ry.x){let t;switch(oy(dy,ly,-ry.x,!0),h){case jf:t=l-3+1;break;case Uf:t=l-7+5;break;case Gf:t=l-5+3;break;case iy:t=l-6+3}t&&_y(r,ly,t)}}}else sy(ly,dy)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function uy(t,e,i,s){ny(e,t[s],t[s+1]),ny(i,t[s+2],t[s+3])}function _y(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),fl.addAttr("startArrow","none",pf),fl.addAttr("endArrow","none",pf),Object.assign(Oh,cy),Object.assign(Ph,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let py=class extends Rl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};Qt([xo(class extends Kh{})],py.prototype,"__",void 0),Qt([$n("x")],py.prototype,"flow",void 0),py=Qt([Po()],py);const gy={},fy={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},yy={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function my(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;ct.toPoint(i,e,n,gy),e.x=s.__autoWidth?n.x:gy.x,e.y=s.__autoHeight?n.y:gy.y}const{move:vy}=K;function wy(t,e,i,s,n,o){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=s+(e.height-h.height)/("center"===n?2:1)),vy(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function xy(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const by={};function ky(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,h=n&&(e?!o:!r);return _(i)?(by.xGap=i.x||0,by.yGap=i.y||0):by.xGap=by.yGap=c(i),by.isAutoXGap=a(by.xGap)&&!o,by.isAutoYGap=a(by.yGap)&&!r,by.complex=h||"top-left"!==s||t.__hasGrow||by.isAutoXGap||by.isAutoYGap,by.wrap=h,by.complex&&(by.isFitXGap="fit"===by.xGap&&!o,by.isFitYGap="fit"===by.yGap&&!r,_(s)?(by.contentAlign=s.content||"top-left",by.rowXAlign=s.x||"from",by.rowYAlign=s.y||"from"):(by.contentAlign=s,by.rowXAlign=fy[s],by.rowYAlign=yy[s])),by}function Ey(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Sy(t,e,i,s){const{count:n}=t;n>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(n-1),t[e]=i)}function By(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Ry}=b;function Ty(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__widthGrow)&&(r=Cy(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.widthRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__widthGrow,n=e/i*s,r=Cy(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Cy(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Ry(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:Oy}=b;function Py(t,e,i,s){let n,o,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)n=u[s?d-t:d+t],n.__.inFlow&&0!==n.__.visible?(o=n.__heightGrow)&&(r=Ly(n,n.__flowBounds,c*o),r?(a+=r,l-=o):h&&(n.__.heightRange?h.unshift(n):h.push(n))):i++;a&&function(t,e,i){let s,n,o,r;t.forEach(t=>{s=t.__heightGrow,n=e/i*s,r=Ly(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function Ly(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?Oy(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:Ay}=K;function My(t,e){const i="width",{children:s,itemBox:n}=t,o=ky(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:h;let p,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[y=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(g=By(p,n),r?(p.__flowBounds=g,m||(m=Ey(y,_)),a&&m.count&&m.width+g.width>x&&(m.grow?Ty(t,m,x,e):d&&Sy(m,i,x,c),xy(u,m,i),m=Ey(y,_)),f=g.width,p.__widthGrow&&(m.grow+=p.__widthGrow,f=0,p.__.widthRange&&(m.hasRangeSize=!0)),p.__heightGrow&&Ly(p,g,b),m.width+=m.count?f+_:f,m.height=Math.max(m.height,g.height),m.count++):(Ay(p,v-g.x,w-g.y),v+=g.width+_));if(r&&m){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:_}=o;m.count&&(m.grow?Ty(t,m,x,e):d&&Sy(m,i,x,c),a&&xy(u,m,i)),a?(s?Sy(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){my(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=fy[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],wy(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,_,e)):(my(t,m,r),wy(t,m,0,m.y,_,e))}}const{move:Dy}=K;function Fy(t,e,i,s,n,o){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[o?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==n&&(c=i+(e.width-h.width)/("center"===n?2:1)),Dy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Iy}=K;function Wy(t,e){const i="height",{children:s,itemBox:n}=t,o=ky(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=o;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:l;let p,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)p=s[y=e?h-1-o:o],p.__.inFlow&&0!==p.__.visible&&(g=By(p,n),r?(p.__flowBounds=g,m||(m=Ey(y,_)),a&&m.count&&m.height+g.height>b&&(m.grow&&Py(t,m,b,e),d&&Sy(m,i,b,c),xy(u,m,i),m=Ey(y,_)),f=g.height,p.__heightGrow&&(m.grow+=p.__heightGrow,f=0,p.__.heightRange&&(m.hasRangeSize=!0)),p.__widthGrow&&Cy(p,g,x),m.height+=m.count?f+_:f,m.width=Math.max(m.width,g.width),m.count++):(Iy(p,v-g.x,w-g.y),w+=g.height+_));if(r&&m){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:_}=o;m.count&&(m.grow&&Py(t,m,b,e),d&&Sy(m,i,b,c),a&&xy(u,m,i)),a?(s?Sy(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){my(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=yy[i]),"from"!==s)){let t;for(let i=0,o=n.length;i<o;i++)t=n[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,_),function(t,e,i,s){const{list:n}=e,o="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=n.length;l<d;l++)r=n[o?d-1-l:l],Fy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(my(t,m,r),Fy(t,m,m.x,0,l,e))}}function zy(t){return Un(t,t=>({set(e){const i=l(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&so(this)}}))}Vt.add("flow","resize");const Ny=Rl.prototype,{__updateBoxBounds:Yy}=yl.prototype;fl.addAttr("flow",!1,$n),fl.addAttr("gap",0,eo),fl.addAttr("flowAlign","top-left",eo),fl.addAttr("flowWrap",!1,eo),fl.addAttr("itemBox","box",eo),fl.addAttr("inFlow",!0,eo),fl.addAttr("autoWidth",void 0,zy),fl.addAttr("autoHeight",void 0,zy),fl.addAttr("autoBox",void 0,eo);const{copyAndSpread:Hy}=Tt;Ny.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:My(this);break;case"y":Wy(this);break;case"x-reverse":My(this,!0);break;case"y-reverse":Wy(this,!0)}t&&(this.leafer.created=!0)},Ny.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Hy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Ny.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():Yy.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&Hy(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:Xy,sin:Vy,pow:jy,sqrt:Uy,abs:Gy,ceil:Ky,floor:qy,round:Zy,PI:Jy}=Math,$y=5*Jy,Qy=1.70158,tm=2.5949095,em=7.5625,im=2.75;function sm(t){return e=>jy(e,t)}function nm(t){return e=>1-jy(1-e,t)}function om(t){return e=>e<.5?.5*jy(2*e,t):1-.5*jy(2-2*e,t)}function rm(t){return t<1/im?em*t*t:t<2/im?em*(t-=1.5/im)*t+.75:t<2.5/im?em*(t-=2.25/im)*t+.9375:em*(t-=2.625/im)*t+.984375}function am(t,e,i,s){const n={};return o=>{const r=~~(1e4*o),a=n[r];if(a)return a;let h,l,d,c=o;for(let e=0;e<8&&(h=1-c,d=hm(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Gy(l)<1e-6));e++)c-=d/l;return n[r]=hm(c,e,s)}}function hm(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const lm={get(t){const{list:e}=lm;return a(t)?e[t||"ease"]:_(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){lm.list[t]=e},list:{linear:t=>t,ease:am(.25,.1,.25,1),"ease-in":am(.42,0,1,1),"ease-out":am(0,0,.58,1),"ease-in-out":am(.42,0,.58,1),"sine-in":t=>1-Xy(t*Jy*.5),"sine-out":t=>Vy(t*Jy*.5),"sine-in-out":t=>.5*(1-Xy(t*Jy)),"quad-in":sm(2),"quad-out":nm(2),"quad-in-out":om(2),"cubic-in":sm(3),"cubic-out":nm(3),"cubic-in-out":om(3),"quart-in":sm(4),"quart-out":nm(4),"quart-in-out":om(4),"quint-in":sm(5),"quint-out":nm(5),"quint-in-out":om(5),"expo-in":t=>t?jy(2,10*t-10):0,"expo-out":t=>1===t?1:1-jy(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*jy(2,2*t*10-10):.5*(2-jy(2,10-2*t*10)),"circ-in":t=>1-Uy(1-jy(t,2)),"circ-out":t=>Uy(1-jy(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Uy(1-jy(2*t,2))):.5*(Uy(1-jy(2-2*t,2))+1),"back-in":t=>((Qy+1)*t-Qy)*t*t,"back-out":t=>(t-=1)*t*((Qy+1)*t+Qy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((tm+1)*t-tm)*.5:.5*((t=2*t-2)*t*((tm+1)*t+tm)+2),"elastic-in":t=>0===t||1===t?t:-jy(2,10*(t-1))*Vy((t-1.1)*$y),"elastic-out":t=>0===t||1===t?t:jy(2,-10*t)*Vy((t-.1)*$y)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-jy(2,10*((t*=2)-1))*Vy((t-1.1)*$y)*.5:jy(2,10*(1-(t*=2)))*Vy((t-1.1)*$y)*.5+1,"bounce-in":t=>1-rm(1-t),"bounce-out":rm,"bounce-in-out":t=>t<.5?.5*(1-rm(1-2*t)):.5*(1+rm(2*t-1)),"cubic-bezier":am,steps:function(t,e="floor"){return i=>("floor"===e?qy(i*t):"ceil"===e?Ky(i*t):Zy(i*t))/t}}};function dm(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class cm{}cm.CREATED="created",cm.PLAY="play",cm.PAUSE="pause",cm.STOP="stop",cm.SEEK="seek",cm.UPDATE="update",cm.COMPLETED="completed";let um=class extends Nr{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&l(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=lm.get(n),(o||this.attrsMap)&&(this.attrsMap=o?o.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(cm.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(cm.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(cm.STOP))}seek(t){this.destroyed||(_(t)&&(t=Ch.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(cm.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,d,c,u,_=0,p=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(d.swing=l(o)?o:2,u=2*d.swing-1),r&&(d.loop=u=l(r)?r:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),n&&(d.easingFn=lm.get(n))}if(!d.autoDuration&&o(d.duration)&&(n>1?s>0||r?p+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}p?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(cm.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(cm.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:o}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Wh.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(cm.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return l(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};Qt([dm("ease")],um.prototype,"easing",void 0),Qt([dm(0)],um.prototype,"delay",void 0),Qt([dm(.2)],um.prototype,"duration",void 0),Qt([dm("auto")],um.prototype,"ending",void 0),Qt([dm(!1)],um.prototype,"reverse",void 0),Qt([dm(!1)],um.prototype,"swing",void 0),Qt([dm(!1)],um.prototype,"loop",void 0),Qt([dm(0)],um.prototype,"loopDelay",void 0),Qt([dm(1)],um.prototype,"speed",void 0),Qt([dm(!0)],um.prototype,"autoplay",void 0),Qt([dm()],um.prototype,"join",void 0),Qt([dm()],um.prototype,"attrs",void 0),um=Qt([Oo(Jr)],um);let _m=class extends um{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new um(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(cm.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(cm.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(cm.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(cm.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case cm.COMPLETED:this.completed&&this.emitType(t);break;case cm.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};_m=Qt([Oo(Jr)],_m);const pm={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},gm=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,fm=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,ym=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,mm=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,vm=parseInt,wm=parseFloat,{round:xm}=Math;let bm={},km=0;function Em(t){let e,i,s,n=1;switch(t.length){case 9:e=vm(t.slice(1,3),16),i=vm(t.slice(3,5),16),s=vm(t.slice(5,7),16),n=vm(t.slice(7,9),16)/255;break;case 7:e=vm(t.slice(1,3),16),i=vm(t.slice(3,5),16),s=vm(t.slice(5,7),16);break;case 5:e=vm(t[1]+t[1],16),i=vm(t[2]+t[2],16),s=vm(t[3]+t[3],16),n=vm(t[4]+t[4],16)/255;break;case 4:e=vm(t[1]+t[1],16),i=vm(t[2]+t[2],16),s=vm(t[3]+t[3],16);break;case 3:e=i=s=vm(t[1]+t[2],16);break;case 2:e=i=s=vm(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Sm=1/6,Bm=.5,Rm=2/3,Tm=1/3;function Cm(t,e,i){return i<0?i++:i>1&&i--,i<Sm?t+6*(e-t)*i:i<Bm?e:i<Rm?t+(e-t)*(Rm-i)*6:t}function Om(t,e,i,s=1){let n,o,r;if(t/=360,i/=100,0===(e/=100))n=o=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=Cm(a,s,t+Tm),o=Cm(a,s,t),r=Cm(a,s,t-Tm)}return{r:xm(255*n),g:xm(255*o),b:xm(255*r),a:s}}Vt.add("color"),Th.object=function(t,e){let i,s=!o(e)&&e<1;if(a(t)){const e=bm[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Em(t);break;case"R":case"r":"("===t[4]&&fm.test(t)?i=function(t){const e=fm.exec(t);return{r:vm(e[1]),g:vm(e[2]),b:vm(e[3]),a:wm(e[4])}}(t):"("===t[3]&&gm.test(t)&&(i=function(t){const e=gm.exec(t);return{r:vm(e[1]),g:vm(e[2]),b:vm(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&mm.test(t)?i=function(t){const e=mm.exec(t);return Om(wm(e[1]),wm(e[2]),wm(e[3]),wm(e[4]))}(t):"("===t[3]&&ym.test(t)&&(i=function(t){const e=ym.exec(t);return Om(wm(e[1]),wm(e[2]),wm(e[3]),1)}(t))}if(!i){const e=pm[t.toLowerCase()];e&&(i=Em("#"+e))}i&&(km++,km>1e4&&(bm={},km=0),bm[t]=Object.assign({},i))}}else _(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:Pm}=Math,{fourNumber:Lm}=b,Am={fill:Wm,stroke:Wm,cornerRadius:(t,e,i)=>l(t)&&l(e)?Fm(t,e,i):(t=Lm(t),e=Lm(e),t.map((t,s)=>Fm(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,n=e.length,o=Fm(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return l(t)||l(e)?b.float(Fm(t,e,i),Math.max(Dm(t),Dm(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Wh.setBetweenStyle(n,t,e,n,i,s),n},shadow:zm,innerShadow:zm},Mm={value:function(t,e,i){const s=l(t),n=l(e);return s&&n?t+(e-t)*i:n||s?Fm(t,e,i):t},number:Fm,color:Im,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=Wh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,o)))}};function Dm(t){const e=String(t).split(".")[1];return e?e.length:0}function Fm(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Pm(n):n}function Im(t,e,i){t=Th.object(t),e=Th.object(e);const s=Fm(t.r,e.r,i,1)+","+Fm(t.g,e.g,i,1)+","+Fm(t.b,e.b,i,1),n=Fm(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Wm(t,e,i){return a(t)&&a(e)?Im(t,e,i):e}function zm(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Fm((t=t||{}).x,e.x,i),y:Fm(t.y,e.y,i),blur:Fm(t.blur,e.blur,i),spread:Fm(t.spread,e.spread,i),color:Im(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),Ih.canAnimate=!0,Object.assign(Wh.list,Am),Object.assign(Wh,Mm);const Nm=fl.prototype;fl.addAttr("animation",void 0,function(t){return Un(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),fl.addAttr("animationOut",void 0,qn),fl.addAttr("transition",!0,qn),fl.addAttr("transitionOut",void 0,qn),Nm.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Nm.animate=function(t,e,i,s){if(o(t))return this.__animate;let n=u(t)&&!e&&i?new _m(this,t,s):new um(this,t,e,s);this.killAnimate(i,n.toStyle);const r=this.__animate;return r&&(n instanceof _m?n.list.unshift(r):n=new _m(this,[r,n])),this.__animate=n},Nm.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof _m&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Nm.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(cm.COMPLETED,e)};const Ym=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Hm=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Xm}=Math,{getDerivative:Vm}=Xe,jm={getDistance(t,e,i,s,n,o,r,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<Ym.length;h++)l=f*(1+Ym[h]),d=f*(1-Ym[h]),c=Vm(l,t,i,n,r),u=Vm(l,e,s,o,a),_=Vm(d,t,i,n,r),p=Vm(d,e,s,o,a),g+=Hm[h]*(Xm(c*c+u*u)+Xm(_*_+p*p));return g*f},getRotation(t,e,i,s,n,o,r,a,h){const l=Vm(t,e,s,o,a),d=Vm(t,i,n,r,h);return Math.atan2(d,l)/E},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)Um(i,s,n,o,r,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,n,o,r,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*o,_=d*n+e*r,p=d*o+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*r+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(fe.C,c,u,g,f,y,m)}},{getDistance:Um}=jm,{M:Gm,L:Km,C:qm,Z:Zm}=fe,Jm={},$m={},Qm={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Gm:case Km:Qm.transformPoints(t,e,s,1),s+=3;break;case qm:Qm.transformPoints(t,e,s,3),s+=7;break;case Zm:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)Jm.x=t[n],Jm.y=t[n+1],I.toOuterPoint(e,Jm),t[n]=Jm.x,t[n+1]=Jm.y},getMotionPathData(t){let e,i,s,n,o=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(n=t[a],n){case Gm:case Km:i=t[a+1],s=t[a+2],e=n===Km&&a>0?K.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case qm:i=t[a+5],s=t[a+6],e=jm.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Zm:a+=1;default:e=0}r.push(e),o+=e}return{total:o,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:n}=t;e=Ch.number(e,t.total);let o,r,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case Gm:case Km:if(r=n[f+1],a=n[f+2],o=s[y],p+o>=e||!t.total)return f||(m=r,v=a),$m.x=m,$m.y=v,g.x=r,g.y=a,K.getDistancePoint($m,g,e-p,!0),g.rotation=K.getAngle($m,g),g;m=r,v=a,f+=3;break;case qm:if(r=n[f+5],a=n[f+6],o=s[y],p+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],_=jm.getT(e-p,o,m,v,l,d,c,u,r,a,i),Xe.getPointAndSet(_,m,v,l,d,c,u,r,a,g),g.rotation=jm.getRotation(_,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case Zm:f+=1;default:o=0}y++,p+=o}return g},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Ch.number(e,t.total);let r,a,h,l,d,c,u,_,p,g=0,f={},y=0,m=0,v=0,w=0;const x=n.length;for(;y<x;){switch(l=n[y],l){case Gm:case Km:if(a=n[y+1],h=n[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),$m.x=v,$m.y=w,f.x=a,f.y=h,K.getDistancePoint($m,f,e-g,!0),o.push(l,f.x,f.y),o;v=a,w=h,y+=3,o.push(l,v,w);break;case qm:if(d=n[y+1],c=n[y+2],u=n[y+3],_=n[y+4],a=n[y+5],h=n[y+6],r=s[m],g+r>=e)return p=jm.getT(e-g,r,v,w,d,c,u,_,a,h,i),jm.cut(o,p,v,w,d,c,u,_,a,h),o;v=a,w=h,y+=7,o.push(l,d,c,u,_,a,h);break;case Zm:y+=1,o.push(l);default:r=0}m++,g+=r}return o}};function tv(t){return Un(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Wh.register("motion",function(t,e,i,s){return _(t)&&(t=Ch.number(t,s.getMotionTotal())),_(e)&&(e=Ch.number(e,s.getMotionTotal())),Wh.number(t||0,e||0,i)}),Wh.register("motionRotation",function(t,e,i){return Wh.number(t,e,i)});const ev=fl.prototype,{updateMatrix:iv,updateAllMatrix:sv}=Vo,{updateBounds:nv}=ir;function ov(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=av(t);i.total&&(t.__.__pathForRender=Qm.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(sv(t),nv(t,t)):iv(t));i&&(t.leafer.created=!0)}}function rv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function av(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Qm.getMotionPathData(t.getPath(!0,!0))}function hv(t,e){return Un(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Ih.setStyleName(this,e,i):Ih.set(this,i):this.__layout.stateStyleChanged=!0}}))}function lv(t){return Un(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function dv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function cv(t,e){_(e)||(e=void 0),pv(t,e,"in")}function uv(t,e){const{normalStyle:i}=t;_(e)||(e=void 0),i&&(e||(e=i),pv(t,e,"out"))}fl.addAttr("motionPath",void 0,tv),fl.addAttr("motionPrecision",1,tv),fl.addAttr("motion",void 0,tv),fl.addAttr("motionRotation",!0,tv),ev.getMotionPathData=function(){return av(rv(this))},ev.getMotionPoint=function(t){const e=rv(this),i=av(e);if(!i.total)return{};const s=Qm.getDistancePoint(i,t,e.motionPrecision);I.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:l(n)&&(s.rotation+=n),s},ev.getMotionTotal=function(){return this.getMotionPathData().total},ev.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),ov(t))}else ov(this)};const _v={};function pv(t,e,i){const{normalStyle:s}=t;e||(e=_v),e.scale&&(b.assignScale(e,e.scale),delete e.scale),e!==_v&&Ih.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=yv(e,t),s=t.animate();s&&yv(i,t,s.fromStyle);return i}(t,e):void 0;Ih.canAnimate&&gv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=gv(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=fv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=fv(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function gv(t){let e;const i={},s=dv(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Ih.isState(n,t,s)&&(e=mv(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Ih.isSelected(t,s)&&(e=mv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Ih.isPlacehold(t,s)&&(e=mv(i,a)),Ih.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=mv(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Ih.isFocus(t,s)&&(e=mv(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Ih.isHover(t,s)&&(e=mv(i,o));const r=i.pressStyle||t.pressStyle;r&&Ih.isPress(t,s)&&(e=mv(i,r))}return e?i:void 0}function fv(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Ih.animateExcludes[t]||(n[t]=e[t]);return n}function yv(t,e,i){return fv(t,e,i,!0)}function mv(t,e){return Object.assign(t,e),!0}function vv(t,e){const i=t[e];i&&cv(t,i),t.button&&xv(t.children,e)}function wv(t,e,i){i||(i=t.states[e]),cv(t,i),t.button&&xv(t.children,null,e)}function xv(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":Ih.isHover(s)&&(n=!1);break;case"pressStyle":Ih.isPress(s)&&(n=!1);break;case"focusStyle":Ih.isFocus(s)&&(n=!1)}n&&vv(s,e)}else o(i)||wv(s,i);s.isBranch&&xv(s.children,e,i)}}function bv(t,e){const i=t[e];i&&uv(t,i),t.button&&Ev(t.children,e)}function kv(t,e,i){uv(t,i),t.button&&Ev(t.children,null,e)}function Ev(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?bv(s,e):o(i)||kv(s,i),s.isBranch&&Ev(s.children,e,i)}function Sv(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=dv(e,i);o&&(s=n[t](o))}return s}function Bv(t,e,i){let s=e[t];if(!s&&i){const n=dv(e,i);n&&(s=n[t])}return s}Vt.add("state"),Ih.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Ih.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=dv(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Ih.isSelected=function(t,e){return Bv("selected",t,e)},Ih.isDisabled=function(t,e){return Bv("disabled",t,e)},Ih.isFocus=function(t,e){return Sv("isFocus",t,e)},Ih.isHover=function(t,e){return Sv("isHover",t,e)},Ih.isPress=function(t,e){return Sv("isPress",t,e)},Ih.isPlacehold=function(t,e){return t.__.__isPlacehold},Ih.isDrag=function(t,e){return Sv("isDrag",t,e)},Ih.setStyleName=function(t,e,i){i?wv(t,e,t[e]):kv(t,e,t[e])},Ih.set=function(t,e){const i=t.states[e];i?wv(t,e,i):kv(t,e,i)},Ih.getStyle=gv,Ih.updateStyle=pv,Ih.updateEventStyle=function(t,e){switch(e){case md.ENTER:vv(t,"hoverStyle");break;case md.LEAVE:bv(t,"hoverStyle");break;case md.DOWN:vv(t,"pressStyle");break;case md.UP:bv(t,"pressStyle")}};const Rv=fl.prototype;fl.addAttr("selected",!1,hv,"selectedStyle"),fl.addAttr("disabled",!1,hv,"disabledStyle"),fl.addAttr("states",{},lv),fl.addAttr("state","",hv),fl.addAttr("normalStyle",void 0,qn),fl.addAttr("hoverStyle",void 0,lv),fl.addAttr("pressStyle",void 0,lv),fl.addAttr("focusStyle",void 0,lv),fl.addAttr("selectedStyle",void 0,lv),fl.addAttr("disabledStyle",void 0,lv),fl.addAttr("placeholderStyle",void 0,lv),fl.addAttr("button",!1,qn),Rv.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?vv(this,"focusStyle"):bv(this,"focusStyle")})},Rv.updateState=function(){Ih.updateStyle(this,void 0,"in")};const Tv=dd.prototype,Cv="text";Xn(Tv,Cv,Object.assign(Object.assign({},Vn(Tv,Cv)),{set(t){const e=this,i=e.text;e.__setAttr(Cv,t)&&(so(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Ov extends jh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Pv=class extends fl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(l(t))this.now=t;else if(_(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Fn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:o,total:r}=e,{width:a,height:h}=o&&(l(o)?{width:o,height:o}:o)||(r>1?this:t);let d=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new br(br.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};Qt([xo(Ov)],Pv.prototype,"__",void 0),Qt([eo()],Pv.prototype,"robot",void 0),Qt([qn()],Pv.prototype,"actions",void 0),Qt([qn("")],Pv.prototype,"action",void 0),Qt([co(0)],Pv.prototype,"now",void 0),Qt([qn(12)],Pv.prototype,"FPS",void 0),Qt([qn(!0)],Pv.prototype,"loop",void 0),Pv=Qt([Po()],Pv),Vt.add("robot");const{Yes:Lv,NoAndSkip:Av,YesAndSkip:Mv}=s,Dv={},Fv={},Iv={};class Wv{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Dv.id=t.substring(1),t=Dv;break;case".":Fv.className=t.substring(1),t=Fv;break;default:Iv.tag=t,t=Iv}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Vo.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let r=0,a=t.length;r<a;r++){if(n=t[r],o=e(n,s),o===Lv||o===Mv){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<Av&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(mr.REMOVE,this.__onRemoveChild,this),this.target.on_(wr.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const zv=fl.prototype;function Nv(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=jt.selector())}zv.find=function(t,e){return Nv(this).getBy(t,this,!1,e)},zv.findOne=function(t,e){return Nv(this).getBy(t,this,!0,e)},Vt.add("find"),jt.finder=function(t){return new Wv(t)};const{setPoint:Yv,addPoint:Hv,toBounds:Xv}=st;const Vv={syncExport(e,i,s){let n;Fh.running=!0;try{const r=Tn.fileType(i),a=i.includes(".");s=Tn.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===r)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),n={data:!!a||e.toJSON(s.json)};else if("svg"===r)a&&l(h(e.toSVG(),"svg"),i),n={data:!!a||e.toSVG()};else{let t,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=e,{slice:_,clip:p,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=o(s.smooth)?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&o(s.fill)?e.fill:s.fill,k=Tn.isOpaqueImage(i)||x,E=new et;if(f)t=!0===f?d?c.canvas.bounds:e.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":E.set(l);break;case"local":E.set(l).divide(e.localTransform),a/=e.scaleX,h/=e.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||e;default:E.set(l).divide(e.getTransform(i));const t=i.worldTransform;a/=a/t.scaleX,h/=h/t.scaleY}t=e.getBounds("render",i)}const S={scaleX:1,scaleY:1};b.getScaleData(s.scale,s.size,t,S);let B=s.pixelRatio||1,{x:R,y:T,width:C,height:O}=new Lt(t).scale(S.scaleX,S.scaleY);p&&(R+=p.x,T+=p.y,C=p.width,O=p.height);const P={exporting:!0,matrix:E.scale(1/S.scaleX,1/S.scaleY).invert().translate(-R,-T).withScale(1/a*S.scaleX,1/h*S.scaleY)};let L,A=jt.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:v,contextSettings:w});if(_&&(L=e,L.__worldOpacity=0,e=c||e,P.bounds=A.bounds),A.save(),u&&!o(x)){const t=e.get("fill");e.fill="",e.__render(A,P),e.fill=t}else e.__render(A,P);if(A.restore(),L&&L.__updateWorldOpacity(),g){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,o=(a-n)/e,r?Hv(r,n,o):Yv(r={},n,o)),a++;const h=new Lt;return r&&(Xv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=jt.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(y){const[t,e,i,s]=b.fourNumber(y),n=A,{width:o,height:r}=n;A=jt.canvas({width:o+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),m&&m(A);n={data:"canvas"===i?A:A.export(i,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:t,trimBounds:r}}}catch(t){n={data:"",error:t}}return Fh.running=!1,n},export(e,i,s){return Fh.running=!0,function(t){jv||(jv=new Ln);return new Promise(e=>{jv.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>te(this,void 0,void 0,function*(){if(!Mn.isComplete)return t.requestRender(r);const a=Fh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()});e.updateLayout(),Uv(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))}};let jv;function Uv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Uv(t))}const Gv=_e.prototype,Kv=It.get("@leafer-in/export");Gv.export=function(t,e){const{quality:i,blob:s}=Tn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Gv.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{Kv.error(t),s(null)})})},Gv.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Gv.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{Kv.error(t),s(!1)})})},Vt.add("export"),Object.assign(Fh,Vv),fl.prototype.export=function(t,e){return Fh.export(this,t,e)},fl.prototype.syncExport=function(t,e){return Fh.syncExport(this,t,e)},Vt.add("filter"),Object.assign(Dh,{list:{},register(t,e){Dh.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=Dh.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Dh.list[t.type],e&&(i+=e.getSpread(t))}),i}});export{ct as AlignHelper,um as Animate,lm as AnimateEasing,cm as AnimateEvent,_m as AnimateList,s as Answer,_d as App,ht as AroundHelper,gf as Arrow,_f as ArrowData,Mt as AutoBounds,Xe as BezierHelper,Lt as Bounds,kr as BoundsEvent,Tt as BoundsHelper,Rl as Box,Kh as BoxData,$a as Branch,ir as BranchHelper,ya as BranchRender,od as Canvas,al as CanvasData,$t as CanvasManager,mr as ChildEvent,Th as ColorConvert,jt as Creator,Ud as Cursor,f as DataHelper,It as Debug,ot as Direction4,rt as Direction9,ll as DragBoundsHelper,xd as DragEvent,Dd as Dragger,kd as DropEvent,Rp as EditBox,vp as EditDataHelper,Ep as EditPoint,ap as EditSelect,sp as EditSelectHelper,eg as EditTool,Np as EditToolCreator,Qp as Editor,U_ as EditorEvent,Xp as EditorGroupEvent,Fp as EditorHelper,Kp as EditorMoveEvent,Zp as EditorRotateEvent,qp as EditorScaleEvent,Jp as EditorSkewEvent,Mh as Effect,Ll as Ellipse,Qh as EllipseData,$e as EllipseHelper,yr as Event,Zt as EventCreator,Nr as Eventer,Fh as Export,Tn as FileHelper,Dh as Filter,Wv as Finder,py as Flow,Tl as Frame,Zh as FrameData,yl as Group,Gh as GroupData,uf as HTMLText,cf as HTMLTextData,jm as HighBezierHelper,Qm as HighCurveHelper,Gd as HitCanvasManager,sd as Image,rl as ImageData,br as ImageEvent,Fn as ImageManager,e as IncrementId,tg as InnerEditor,Hp as InnerEditorEvent,jd as InteractionBase,Cd as InteractionHelper,Td as KeyEvent,gd as Keyboard,Pr as LayoutEvent,yh as Layouter,Ha as Leaf,pa as LeafBounds,$o as LeafBoundsHelper,m as LeafData,Qr as LeafDataProxy,Jr as LeafEventer,Vo as LeafHelper,fr as LeafLayout,th as LeafLevelList,Qa as LeafList,ra as LeafMatrix,ga as LeafRender,wl as Leafer,ih as LeaferCanvas,_e as LeaferCanvasBase,qh as LeaferData,Ar as LeaferEvent,Hn as LeaferImage,Vg as LeaferTypeCreator,Nl as Line,Jh as LineData,ag as LineEditTool,b as MathHelper,et as Matrix,I as MatrixHelper,Ed as MoveEvent,Gg as MultiTouchHelper,bd as MyDragEvent,nd as MyImage,vd as MyPointerEvent,me as NeedConvertToCanvasCommandMap,E as OneRadian,S as PI2,B as PI_2,Ph as Paint,Ah as PaintGradient,Lh as PaintImage,cd as Path,Oh as PathArrow,cy as PathArrowModule,fn as PathBounds,os as PathCommandDataHelper,fe as PathCommandMap,Fi as PathConvert,kn as PathCorner,bs as PathCreator,il as PathData,Is as PathDrawer,pe as PathHelper,Sf as PathMatrixHelper,be as PathNumberCommandLengthMap,xe as PathNumberCommandMap,xg as PathScaler,ud as Pen,sl as PenData,xh as Picker,t as Platform,Vt as Plugin,Q as Point,K as PointHelper,fd as PointerButton,md as PointerEvent,ql as Polygon,tl as PolygonData,wr as PropertyEvent,xl as Rect,$h as RectData,ke as RectHelper,pl as RectRender,Lr as RenderEvent,vh as Renderer,Cr as ResizeEvent,Mn as Resource,Pv as Robot,Ov as RobotData,Sd as RotateEvent,Yt as Run,df as ScrollBar,ip as SelectArea,bh as Selector,id as Star,el as StarData,Ih as State,Dt as StringNumberMap,ep as Stroker,Bd as SwipeEvent,Pn as TaskItem,Ln as TaskProcessor,dd as Text,Rh as TextConvert,ol as TextData,Ng as TextEditor,$p as TransformTool,Qg as Transformer,Wh as Transition,st as TwoPointBoundsHelper,fl as UI,hl as UIBounds,Gt as UICreator,jh as UIData,yd as UIEvent,ul as UIRender,Ch as UnitConvert,rr as WaitHelper,Or as WatchEvent,rh as Watcher,$g as WheelEventHelper,Rd as ZoomEvent,Yg as addViewport,Hg as addViewportConfig,lo as affectRenderBoundsType,ro as affectStrokeBoundsType,pf as arrowType,Gn as attr,$n as autoLayoutType,eo as boundsType,Rn as canvasPatch,ue as canvasSizeAttrs,Bh as createAttr,jn as createDescriptor,wo as cursorType,xo as dataProcessor,qn as dataType,Un as decorateLeafAttr,ko as defineDataProcessor,Xn as defineKey,Kn as defineLeafAttr,so as doBoundsType,ao as doStrokeType,kh as effectType,n as emptyData,mo as eraserType,xr as extraPropertyEventMap,T as getBoundsData,Vn as getDescriptor,C as getMatrixData,R as getPointData,vo as hitType,u as isArray,p as isData,g as isEmptyData,h as isFinite,r as isNull,l as isNumber,_ as isObject,a as isString,o as isUndefined,bo as layoutProcessor,Wr as leaferTransformAttrMap,yo as maskType,tv as motionPathType,io as naturalBoundsType,uo as opacityType,En as path,no as pathInputType,oo as pathType,Sn as pen,Zn as positionType,Wp as registerEditTool,zp as registerInnerEditor,Po as registerUI,Lo as registerUIEvent,Eh as resizeType,Ro as rewrite,To as rewriteAble,to as rotationType,Og as scaleResize,Pg as scaleResizeFontSize,Mg as scaleResizeGroup,Lg as scaleResizePath,Ag as scaleResizePoints,Qn as scaleType,Jn as scrollType,fo as sortType,lv as stateStyleType,hv as stateType,ho as strokeType,co as surfaceType,At as tempBounds,it as tempMatrix,tt as tempPoint,c as tryToNumber,nh as useCanvas,Oo as useModule,eh as version,_o as visibleType,Sh as zoomLayerType};
2
2
  //# sourceMappingURL=worker.module.min.js.map