@leafer/worker 1.9.6 → 1.9.7

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
- var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i;var n;t.Answer=void 0,(n=t.Answer||(t.Answer={}))[n.No=0]="No",n[n.Yes=1]="Yes",n[n.NoAndSkip=2]="NoAndSkip",n[n.YesAndSkip=3]="YesAndSkip";const o={};function r(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;function u(t){return"string"==typeof t&&c.test(t)?+t:t}const{isArray:p}=Array;function g(t){return t&&"object"==typeof t}function _(t){return g(t)&&!p(t)}function f(t){return"{}"===JSON.stringify(t)}const m={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=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=m;class v{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(p(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:w,pow:x,PI:b}=Math,E={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(p(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),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)),E.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:x(10,e);return-0===(t=w(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&E.assignScale(s,t);return s},assignScale(t,e){d(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 S=b/180,B=2*b,T=b/2;function P(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function L(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:C,cos:O,acos:A,sqrt:D}=Math,{float:M}=E,I={};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 W={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:L,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){U.toInnerPoint(t,e,I),U.scaleOfInner(t,I,i,s)},scaleOfInner(t,e,i,s=i){U.translateInner(t,e.x,e.y),U.scale(t,i,s),U.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=O(e*=S),a=C(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){U.toInnerPoint(t,e,I),U.rotateOfInner(t,I,i)},rotateOfInner(t,e,i){U.translateInner(t,e.x,e.y),U.rotate(t,i),U.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=S,t.a=s+o*i,t.b=n+r*i),e&&(e*=S,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){U.toInnerPoint(t,e,I),U.skewOfInner(t,I,i,s)},skewOfInner(t,e,i,s=0){U.translateInner(t,e.x,e.y),U.skew(t,i,s),U.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n){const{e:o,f:a}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){U.multiply(t,U.tempInvert(e))},divideParent(t,e){U.multiplyParent(t,U.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=U;return U.copy(e,t),U.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*S,r=O(o),a=C(o);if(s||n){const e=s*S,i=n*S;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||s)&&U.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=D(n*n+o*o),c=t/d;const e=n/d;u=o>0?A(e):-A(e)}else{c=D(r*r+a*a),d=t/c;const e=r/c;u=T-(a>0?A(-e):-A(e))}const e=M(O(u)),i=C(u);d=M(d),c=M(c),p=e?M((r/c+i)/e/S,9):0,g=e?M((o/d-i)/e/S,9):0,u=M(u/S)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=D(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){U.set(t)}},U=W,{toInnerPoint:z,toOuterPoint:H}=W,{sin:N,cos:Y,abs:X,sqrt:V,atan2:G,min:j,round:K}=Math,Z={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?K(t.x-.5)+.5:K(t.x),t.y=e?K(t.y-.5)+.5:K(t.y)},move(t,e,i){g(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=Y(e*=S),n=N(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=q;return $(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return $(i,t),H(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return $(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){H(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)=>J(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(J(t,e,i,s),J(i,s,n,o)),getAngle:(t,e)=>Q(t,e)/S,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)/S),getRadianFrom(t,e,i,s,n,o,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>G(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=Q(t,e);return(e=s?e:{}).x=t.x+Y(n)*i,e.y=t.y+N(n)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=Z,{getDistanceFrom:J,copy:$,getAtan2:Q}=q;class tt{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?Z.copy(this,t):Z.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new tt(this)}move(t,e){return Z.move(this,t,e),this}scale(t,e){return Z.scale(this,t,e),this}scaleOf(t,e,i){return Z.scaleOf(this,t,e,i),this}rotate(t,e){return Z.rotate(this,t,e),this}rotateOf(t,e){return Z.rotate(this,e,t),this}getRotation(t,e,i){return Z.getRotation(this,t,e,i)}toInnerOf(t,e){return Z.toInnerOf(this,t,e),this}toOuterOf(t,e){return Z.toOuterOf(this,t,e),this}getCenter(t){return new tt(Z.getCenter(this,t))}getDistance(t){return Z.getDistance(this,t)}getDistancePoint(t,e,i){return new tt(Z.getDistancePoint(this,t,e,i))}getAngle(t){return Z.getAngle(this,t)}getAtan2(t){return Z.getAtan2(this,t)}reset(){return Z.reset(this),this}}const et=new tt;class it{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return g(t)?W.copy(this,t):W.set(this,t,e,i,s,n,o),this}setWith(t){return W.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 it(this)}translate(t,e){return W.translate(this,t,e),this}translateInner(t,e){return W.translateInner(this,t,e),this}scale(t,e){return W.scale(this,t,e),this}scaleWith(t,e){return W.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return W.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return W.scaleOfInner(this,t,e,i),this}rotate(t){return W.rotate(this,t),this}rotateOfOuter(t,e){return W.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return W.rotateOfInner(this,t,e),this}skew(t,e){return W.skew(this,t,e),this}skewOfOuter(t,e,i){return W.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return W.skewOfInner(this,t,e,i),this}multiply(t){return W.multiply(this,t),this}multiplyParent(t){return W.multiplyParent(this,t),this}divide(t){return W.divide(this,t),this}divideParent(t){return W.divideParent(this,t),this}invert(){return W.invert(this),this}invertWith(){return W.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){W.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){W.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return W.setLayout(this,t,e,i),this}getLayout(t,e,i){return W.getLayout(this,t,e,i)}withScale(t,e){return W.withScale(this,t,e)}reset(){W.reset(this)}}const st=new it,nt={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){ot(t,e,i),ot(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:ot}=nt;var rt,at;t.Direction4=void 0,(rt=t.Direction4||(t.Direction4={}))[rt.top=0]="top",rt[rt.right=1]="right",rt[rt.bottom=2]="bottom",rt[rt.left=3]="left",t.Direction9=void 0,(at=t.Direction9||(t.Direction9={}))[at.topLeft=0]="topLeft",at[at.top=1]="top",at[at.topRight=2]="topRight",at[at.right=3]="right",at[at.bottomRight=4]="bottomRight",at[at.bottom=5]="bottom",at[at.bottomLeft=6]="bottomLeft",at[at.left=7]="left",at[at.center=8]="center",at[at["top-left"]=0]="top-left",at[at["top-right"]=2]="top-right",at[at["bottom-right"]=4]="bottom-right",at[at["bottom-left"]=6]="bottom-left";const ht=[{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}];ht.forEach(t=>t.type="percent");const lt={directionData:ht,tempPoint:{},get:dt,toPoint(t,e,i,s,n,o){const r=dt(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={}),lt.toPoint(t,e,i,!0),i)};function dt(e){return h(e)?ht[t.Direction9[e]]:e}const{toPoint:ct}=lt,ut={toPoint(t,e,i,s,n,o){ct(t,i,s,n,e,o)}},{tempPointBounds:pt,setPoint:gt,addPoint:_t,toBounds:ft}=nt,{toOuterPoint:mt}=W,{float:yt,fourNumber:vt}=E,{floor:wt,ceil:xt}=Math;let bt,Et,kt,St;const Bt={},Tt={},Pt={},Rt={tempBounds:Pt,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(p(i)){const e=vt(i);s?Lt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Lt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Lt.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),Lt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ot(e,t):e=t,i?(e.offsetX=-(Lt.maxX(i)-t.x),e.offsetY=-(Lt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Lt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||Z.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){Z.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Lt.copy(Pt,t),Lt.toOuterOf(Pt,e),Pt),getOuterOf:(t,e)=>(t=Object.assign({},t),Lt.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 Bt.x=t.x,Bt.y=t.y,mt(e,Bt,Tt),gt(pt,Tt.x,Tt.y),Bt.x=t.x+t.width,mt(e,Bt,Tt),_t(pt,Tt.x,Tt.y),Bt.y=t.y+t.height,mt(e,Bt,Tt),_t(pt,Tt.x,Tt.y),Bt.x=t.x,mt(e,Bt,Tt),_t(pt,Tt.x,Tt.y),ft(pt,i)},toInnerOf(t,e,i){i||(i=t),Lt.move(i,-e.e,-e.f),Lt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Lt.getFitScale(t,e));return new it(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),h(s)&&(s=Lt.getFitScale(t,e,"cover"===s)),Pt.width=n?e.width*=s:e.width*s,Pt.height=n?e.height*=s:e.height*s,ut.toPoint(i,Pt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Lt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Lt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Lt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=wt(t.x),t.y=wt(t.y),t.width=e>t.x?xt(t.width+e-t.x):xt(t.width),t.height=i>t.y?xt(t.height+i-t.y):xt(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){bt=t.x+t.width,Et=t.y+t.height,kt=e.x,St=e.y,i||(kt+=e.width,St+=e.height),bt=bt>kt?bt:kt,Et=Et>St?Et:St,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=bt-t.x,t.height=Et-t.y},addList(t,e){Lt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Lt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Lt.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||Ot(t,n)):Ct(t,n));o&&Lt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?gt(pt,t.x,t.y):_t(pt,t.x,t.y)),ft(pt,t)},setPoint(t,e){Lt.set(t,e.x,e.y)},addPoint(t,e){Ct(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=Z.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=Z.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=Lt.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=Lt.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=Lt.tempToOuterOf(e,i)),!Lt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return bt=s+o,Et=n+r,kt=t.x+t.width,St=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,bt=bt<kt?bt:kt,Et=Et<St?Et:St,o=bt-s,r=Et-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Lt.copy(t,Lt.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){Lt.set(t)}},Lt=Rt,{add:Ct,copy:Ot}=Lt;class At{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?Rt.copy(this,t):Rt.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 At(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,i){return Rt.scale(this,t,e,i),this}scaleOf(t,e,i){return Rt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,i){Rt.put(this,t,e,i)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new At(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const Dt=new At;class Mt{constructor(t,e,i,s,n,o){g(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 At(n,e,o||t.width-n-i,r||t.height-e-s)}}const It={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}=E;class Wt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Wt(t)}static set filter(t){this.filterList=Ut(t)}static set exclude(t){this.excludeList=Ut(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"===Wt.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 Ut(t){return t?h(t)&&(t=[t]):t=[],t}Wt.filterList=[],Wt.excludeList=[],Wt.showWarn=!0;const zt=Wt,Ht=Wt.get("RunTime"),Nt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Yt.currentId=Yt.idMap[s]=e?performance.now():Date.now(),Yt.currentName=Yt.nameMap[s]=t,Yt.nameToIdMap[t]=s,s},end(t,e){const i=Yt.idMap[t],s=Yt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Yt.idMap[t]=Yt.nameMap[t]=Yt.nameToIdMap[s]=void 0,Ht.log(s,n,"ms")},endOfName(t,e){const i=Yt.nameToIdMap[t];r(i)||Yt.end(i,e)}},Yt=Nt,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 Gt={editor:t=>Vt.need("editor")},jt=Wt.get("UICreator"),Kt={list:{},register(t){const{__tag:e}=t.prototype;Zt[e]&&jt.repeat(e),Zt[e]=t},get(t,e,i,s,n,o){Zt[t]||jt.error("not register "+t);const a=new Zt[t](e);return r(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),o&&(a.height=o)),a}},{list:Zt}=Kt,qt=Wt.get("EventCreator"),Jt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&($t[e]&&qt.repeat(e),$t[e]=t)})},changeName(t,e){const i=$t[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,$t[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new $t[t](...e)},{nameList:$t}=Jt;class Qt{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=Gt.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 te(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 ee(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 ie(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 se=[];function ne(){return(t,e)=>{se.push(e)}}const oe=[];class re{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||oe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;se.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){g(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}}te([ie("imageSmoothingEnabled")],re.prototype,"smooth",void 0),te([ie("imageSmoothingQuality")],re.prototype,"smoothLevel",void 0),te([ie("globalAlpha")],re.prototype,"opacity",void 0),te([ie()],re.prototype,"fillStyle",void 0),te([ie()],re.prototype,"strokeStyle",void 0),te([ie("lineWidth")],re.prototype,"strokeWidth",void 0),te([ie("lineCap")],re.prototype,"strokeCap",void 0),te([ie("lineJoin")],re.prototype,"strokeJoin",void 0),te([ie("lineDashOffset")],re.prototype,"dashOffset",void 0),te([ie()],re.prototype,"miterLimit",void 0),te([ie()],re.prototype,"shadowBlur",void 0),te([ie()],re.prototype,"shadowColor",void 0),te([ie()],re.prototype,"shadowOffsetX",void 0),te([ie()],re.prototype,"shadowOffsetY",void 0),te([ie()],re.prototype,"filter",void 0),te([ie()],re.prototype,"font",void 0),te([ie()],re.prototype,"fontKerning",void 0),te([ie()],re.prototype,"fontStretch",void 0),te([ie()],re.prototype,"fontVariantCaps",void 0),te([ie()],re.prototype,"textAlign",void 0),te([ie()],re.prototype,"textBaseline",void 0),te([ie()],re.prototype,"textRendering",void 0),te([ie()],re.prototype,"wordSpacing",void 0),te([ie()],re.prototype,"letterSpacing",void 0),te([ie()],re.prototype,"direction",void 0),te([ne()],re.prototype,"setTransform",null),te([ne()],re.prototype,"resetTransform",null),te([ne()],re.prototype,"getTransform",null),te([ne()],re.prototype,"save",null),te([ne()],re.prototype,"restore",null),te([ne()],re.prototype,"translate",null),te([ne()],re.prototype,"scale",null),te([ne()],re.prototype,"rotate",null),te([ne()],re.prototype,"fill",null),te([ne()],re.prototype,"stroke",null),te([ne()],re.prototype,"clip",null),te([ne()],re.prototype,"fillRect",null),te([ne()],re.prototype,"strokeRect",null),te([ne()],re.prototype,"clearRect",null),te([ne()],re.prototype,"beginPath",null),te([ne()],re.prototype,"moveTo",null),te([ne()],re.prototype,"lineTo",null),te([ne()],re.prototype,"bezierCurveTo",null),te([ne()],re.prototype,"quadraticCurveTo",null),te([ne()],re.prototype,"closePath",null),te([ne()],re.prototype,"arc",null),te([ne()],re.prototype,"arcTo",null),te([ne()],re.prototype,"ellipse",null),te([ne()],re.prototype,"rect",null),te([ne()],re.prototype,"roundRect",null),te([ne()],re.prototype,"createConicGradient",null),te([ne()],re.prototype,"createLinearGradient",null),te([ne()],re.prototype,"createPattern",null),te([ne()],re.prototype,"createRadialGradient",null),te([ne()],re.prototype,"fillText",null),te([ne()],re.prototype,"measureText",null),te([ne()],re.prototype,"strokeText",null);const{copy:ae,multiplyParent:he}=W,{round:le}=Math,de=new At,ce=new At,ue={width:1,height:1,pixelRatio:1},pe=["width","height","pixelRatio"];class ge extends re{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,s){super(),this.size={},this.worldTransform={},t||(t=ue),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:o,pixelRatio:r}=t;this.autoLayout=!n||!o,this.size.pixelRatio=r||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;m.copyAttrs(s,t,pe),pe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new At(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&&he(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=le(n.e-.5)+.5,n.f=le(n.f-.5)+.5):(n.e=le(n.e),n.f=le(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=ce):i=de,this.drawImage(t.view,de.x,de.y,de.width,de.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,Rt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,de.x,de.y,de.width,de.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(de.x,de.y,de.width,de.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,de.x,de.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(de.x,de.y,de.width,de.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(de.x,de.y,de.width,de.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(de.x,de.y,de.width,de.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(de.x,de.y,de.width,de.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(de,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(ce,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):Gt.canvas(Object.assign({},i));return n.save(),t&&(ae(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 _e={creator:{},parse(t,e){},convertToCanvasData(t,e){}},fe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},me=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},fe),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},ve={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},we=Object.assign(Object.assign({},ve),fe),xe=me,be={};for(let t in xe)be[xe[t]]=t;const Ee={};for(let t in xe)Ee[xe[t]]=ye[t];const ke={drawRoundRect(t,e,i,s,n,o){const r=E.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:Se,cos:Be,hypot:Te,atan2:Pe,ceil:Re,abs:Le,PI:Ce,sqrt:Oe,pow:Ae}=Math,{setPoint:De,addPoint:Me}=nt,{set:Ie,toNumberPoints:Fe}=Z,{M:We,L:Ue,C:ze,Q:He,Z:Ne}=me,Ye={},Xe={points(t,e,i,s){let n=Fe(e);if(t.push(We,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,p,g,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],g=Oe(Ae(r-e,2)+Ae(a-o,2)),_=Oe(Ae(h-r,2)+Ae(l-a,2)),(g||_)&&(f=g+_,g=y*g/f,_=y*_/f,h-=e,l-=o,d=r-g*h,c=a-g*l,2===i?s||t.push(He,d,c,r,a):t.push(ze,u,p,d,c,r,a),u=r+_*h,p=a+_*l);s||t.push(He,u,p,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Ue,n[e],n[e+1]);s&&t.push(Ne)},rect(t,e,i,s,n){_e.creator.path=t,_e.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){_e.creator.path=[],ke.drawRoundRect(_e.creator,e,i,s,n,o),t.push(..._e.convertToCanvasData(_e.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,p=o-s,g=r-n;let _=Pe(u,c),f=Pe(g,p);const m=Te(c,u),y=Te(p,g);let v=f-_;if(v<0&&(v+=B),m<1e-12||y<1e-12||v<1e-12||Le(v-Ce)<1e-12)return t&&t.push(Ue,s,n),h&&(De(h,e,i),Me(h,s,n)),d&&Ie(d,e,i),void(l&&Ie(l,s,n));const w=c*g-p*u<0,x=w?-1:1,b=a/Be(v/2),E=s+b*Be(_+v/2+T*x),k=n+b*Se(_+v/2+T*x);return _-=T*x,f-=T*x,je(t,E,k,a,a,0,_/S,f/S,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>je(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*S,p=Se(u),g=Be(u);let _=r*S,f=a*S;_>Ce&&(_-=B),f<0&&(f+=B);let m=f-_;m<0?m+=B:m>B&&(m-=B),h&&(m-=B);const y=Re(Le(m/T)),v=m/y,w=Se(v/4),x=8/3*w*w/Se(v/2);f=_+v;let b,E,k,P,R,L,C,O,A=Be(_),D=Se(_),M=k=g*s*A-p*n*D,I=P=p*s*A+g*n*D,F=e+k,W=i+P;t&&t.push(t.length?Ue:We,F,W),l&&De(l,F,W),c&&Ie(c,F,W);for(let o=0;o<y;o++)b=Be(f),E=Se(f),k=g*s*b-p*n*E,P=p*s*b+g*n*E,R=e+M-x*(g*s*D+p*n*A),L=i+I-x*(p*s*D-g*n*A),C=e+k+x*(g*s*E+p*n*b),O=i+P+x*(p*s*E-g*n*b),t&&t.push(ze,R,L,C,O,e+k,i+P),l&&Ge(e+M,i+I,R,L,C,O,e+k,i+P,l,!0),M=k,I=P,A=b,D=E,_=f,f+=v;d&&Ie(d,e+k,i+P)},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){Ge(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(o+2*s)/3,n,o,r,a)},toTwoPointBounds(t,e,i,s,n,o,r,a,h,l){const d=[];let c,u,p,g,_,f,m,y,v=t,w=i,x=n,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,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Me(h,t,e):De(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,Ye),Me(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,p=3*d*t*t,g=t*t*t;l.x=c*e+u*s+p*o+g*a,l.y=c*i+u*n+p*r+g*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return 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:Ge,ellipse:je}=Xe,{sin:Ke,cos:Ze,sqrt:qe,atan2:Je}=Math,{ellipse:$e}=Xe,Qe={ellipticalArc(t,i,s,n,o,r,a,h,l,d,c){const u=(l-i)/2,p=(d-s)/2,g=r*S,_=Ke(g),f=Ze(g),m=-f*u-_*p,y=-f*p+_*u,v=n*n,w=o*o,x=y*y,b=m*m,E=v*w-v*x-w*b;let k=0;if(E<0){const t=qe(1-E/(v*w));n*=t,o*=t}else k=(a===h?-1:1)*qe(E/(v*x+w*b));const T=k*n*y/o,P=-k*o*m/n,R=Je((y-P)/o,(m-T)/n),L=Je((-y-P)/o,(-m-T)/n);let C=L-R;0===h&&C>0?C-=B:1===h&&C<0&&(C+=B);const O=i+u+f*T-_*P,A=s+p+_*T+f*P,D=C<0?1:0;c||e.ellipseToCurve?$e(t,O,A,n,o,r,R/S,L/S,D):n!==o||r?t.push(me.G,O,A,n,o,r,R/S,L/S,D):t.push(me.O,O,A,n,R/S,L/S,D)}},{M:ti,m:ei,L:ii,l:si,H:ni,h:oi,V:ri,v:ai,C:hi,c:li,S:di,s:ci,Q:ui,q:pi,T:gi,t:_i,A:fi,a:mi,Z:yi,z:vi,N:wi,D:xi,X:bi,G:Ei,F:ki,O:Si,P:Bi,U:Ti}=me,{rect:Pi,roundRect:Ri,arcTo:Li,arc:Ci,ellipse:Oi,quadraticCurveTo:Ai}=Xe,{ellipticalArc:Di}=Qe,Mi=Wt.get("PathConvert"),Ii={},Fi={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=Ee[s],a+=s===n?" ":be[s];for(let s=1;s<i;s++)a+=E.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?we:ve;for(let e=0,h=t.length;e<h;e++)s=t[e],It[s]?("."===s&&(Wi.dot&&(Ui(r,o),o=""),Wi.dot++),"0"===o&&"."!==s&&(Ui(r,o),o=""),o+=s):me[s]?(o&&(Ui(r,o),o=""),Wi.name=me[s],Wi.length=ye[s],Wi.index=0,Ui(r,Wi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Ui(r,o),o=s):o&&(Ui(r,o),o=""),n=s;return o&&Ui(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 p=[];for(;c<u;){switch(n=t[c],n){case ei:t[c+1]+=a,t[c+2]+=h;case ti:a=t[c+1],h=t[c+2],p.push(ti,a,h),c+=3;break;case oi:t[c+1]+=a;case ni:a=t[c+1],p.push(ii,a,h),c+=2;break;case ai:t[c+1]+=h;case ri:h=t[c+1],p.push(ii,a,h),c+=2;break;case si:t[c+1]+=a,t[c+2]+=h;case ii:a=t[c+1],h=t[c+2],p.push(ii,a,h),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:r=o===hi||o===di,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(hi,l,d,i,s,a,h),c+=5;break;case li: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=hi;case hi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(hi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case _i:t[c+1]+=a,t[c+2]+=h,n=gi;case gi:r=o===ui||o===gi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Ai(p,a,h,i,s,t[c+1],t[c+2]):p.push(ui,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ui;case ui:i=t[c+1],s=t[c+2],e?Ai(p,a,h,i,s,t[c+3],t[c+4]):p.push(ui,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case mi:t[c+6]+=a,t[c+7]+=h;case fi:Di(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case vi:case yi:p.push(yi),c++;break;case wi:a=t[c+1],h=t[c+2],e?Pi(p,a,h,t[c+3],t[c+4]):zi(p,t,c,5),c+=5;break;case xi:a=t[c+1],h=t[c+2],e?Ri(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):zi(p,t,c,9),c+=9;break;case bi:a=t[c+1],h=t[c+2],e?Ri(p,a,h,t[c+3],t[c+4],t[c+5]):zi(p,t,c,6),c+=6;break;case Ei:Oi(e?p:zi(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Ii),a=Ii.x,h=Ii.y,c+=9;break;case ki:e?Oi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):zi(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Si:Ci(e?p:zi(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ii),a=Ii.x,h=Ii.y,c+=7;break;case Bi:e?Ci(p,t[c+1],t[c+2],t[c+3],0,360,!1):zi(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ti:Li(e?p:zi(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ii),a=Ii.x,h=Ii.y,c+=6;break;default:return Mi.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ti,t.x,t.y);break;case"L":e.push(ii,t.x,t.y);break;case"C":e.push(hi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ui,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){Wi.index===Wi.length&&(Wi.index=1,t.push(Wi.name)),t.push(Number(e)),Wi.index++,Wi.dot=0}},{current:Wi,pushData:Ui,copyData:zi}=Fi,{M:Hi,L:Ni,C:Yi,Q:Xi,Z:Vi,N:Gi,D:ji,X:Ki,G:Zi,F:qi,O:Ji,P:$i,U:Qi}=me,{getMinDistanceFrom:ts,getRadianFrom:es}=Z,{tan:is,min:ss,abs:ns}=Math,os={},rs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Hi,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(Xi,e,i,s,n)},closePath(t){t.push(Vi)},rect(t,e,i,s,n){t.push(Gi,e,i,s,n)},roundRect(t,e,i,s,n,o){if(d(o))t.push(Ki,e,i,s,n,o);else{const r=E.fourNumber(o);r?t.push(ji,e,i,s,n,...r):t.push(Gi,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,h,l){a(o)?t.push(qi,e,i,s,n):(a(r)&&(r=0),a(h)&&(h=360),t.push(Zi,e,i,s,n,o,r,h,l?1:0))},arc(t,e,i,s,n,o,r){a(n)?t.push($i,e,i,s):(a(o)&&(o=360),t.push(Ji,e,i,s,n,o,r?1:0))},arcTo(t,e,i,s,n,o,a,h){if(!r(a)){const t=ts(a,h,e,i,s,n);o=ss(o,ss(t/2,t/2*ns(is(es(a,h,e,i,s,n)/2))))}t.push(Qi,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,h,l){Xe.ellipse(null,e,i,s,n,a(o)?0:o,a(r)?0:r,a(h)?360:h,l,null,null,os),t.push(Hi,os.x,os.y),as(t,e,i,s,n,o,r,h,l)},drawArc(t,e,i,s,n,o,r){Xe.arc(null,e,i,s,a(n)?0:n,a(o)?360:o,r,null,null,os),t.push(Hi,os.x,os.y),hs(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){Xe.points(t,e,i,s)}},{ellipse:as,arc:hs}=rs,{moveTo:ls,lineTo:ds,quadraticCurveTo:cs,bezierCurveTo:us,closePath:ps,beginPath:gs,rect:_s,roundRect:fs,ellipse:ms,arc:ys,arcTo:vs,drawEllipse:ws,drawArc:xs,drawPoints:bs}=rs;class Es{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?_e.parse(t):t:[],this}beginPath(){return gs(this.__path),this.paint(),this}moveTo(t,e){return ls(this.__path,t,e),this.paint(),this}lineTo(t,e){return ds(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return us(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return ps(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 fs(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return ms(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 vs(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return ws(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return xs(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return bs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:ks,L:Ss,C:Bs,Q:Ts,Z:Ps,N:Rs,D:Ls,X:Cs,G:Os,F:As,O:Ds,P:Ms,U:Is}=me,Fs=Wt.get("PathDrawer"),Ws={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 Ss:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Bs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ts:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ps: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 Ls: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]*S,e[s+6]*S,e[s+7]*S,e[s+8]),s+=9;break;case As:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,B,!1),s+=5;break;case Ds:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*S,e[s+5]*S,e[s+6]),s+=7;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],0,B,!1),s+=4;break;case Is: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:Us,L:zs,C:Hs,Q:Ns,Z:Ys,N:Xs,D:Vs,X:Gs,G:js,F:Ks,O:Zs,P:qs,U:Js}=me,{toTwoPointBounds:$s,toTwoPointBoundsByQuadraticCurve:Qs,arcTo:tn,arc:en,ellipse:sn}=Xe,{addPointBounds:nn,copy:on,addPoint:rn,setPoint:an,addBounds:hn,toBounds:ln}=nt,dn=Wt.get("PathBounds");let cn,un,pn;const gn={},_n={},fn={},mn={toBounds(t,e){mn.toTwoPointBounds(t,_n),ln(_n,e)},toTwoPointBounds(t,e){if(!t||!t.length)return an(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===Hs||r===Ns?an(e,h,l):an(e,t[a+1],t[a+2])),r){case Us:case zs:h=t[a+1],l=t[a+2],rn(e,h,l),a+=3;break;case Hs:n=t[a+5],o=t[a+6],$s(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,gn),nn(e,gn),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],Qs(h,l,i,s,n,o,gn),nn(e,gn),h=n,l=o,a+=5;break;case Ys:a+=1;break;case Xs:h=t[a+1],l=t[a+2],hn(e,h,l,t[a+3],t[a+4]),a+=5;break;case Vs:case Gs:h=t[a+1],l=t[a+2],hn(e,h,l,t[a+3],t[a+4]),a+=r===Vs?9:6;break;case js:sn(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],gn,fn),0===a?on(e,gn):nn(e,gn),h=fn.x,l=fn.y,a+=9;break;case Ks:h=t[a+1],l=t[a+2],un=t[a+3],pn=t[a+4],hn(e,h-un,l-pn,2*un,2*pn),h+=un,a+=5;break;case Zs:en(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],gn,fn),0===a?on(e,gn):nn(e,gn),h=fn.x,l=fn.y,a+=7;break;case qs:h=t[a+1],l=t[a+2],cn=t[a+3],hn(e,h-cn,l-cn,2*cn,2*cn),h+=cn,a+=4;break;case Js:tn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],gn,fn),0===a?on(e,gn):nn(e,gn),h=fn.x,l=fn.y,a+=6;break;default:return void dn.error(`command: ${r} [index:${a}]`,t)}}},{M:yn,L:vn,Z:wn}=me,{getCenterX:xn,getCenterY:bn}=Z,{arcTo:En}=rs,kn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,g=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case yn:l=p=t[r+1],d=g=t[r+2],r+=3,t[r]===vn?(c=t[r+1],u=t[r+2],f.push(yn,xn(l,c),bn(d,u))):f.push(yn,l,d);break;case vn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case vn:En(f,a,h,t[r+1],t[r+2],e,p,g);break;case wn:En(f,a,h,l,d,e,p,g);break;default:f.push(vn,a,h)}p=a,g=h;break;case wn:n!==wn&&(En(f,l,d,c,u,e,p,g),f.push(wn)),r+=1;break;default:o=Ee[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==wn&&(f[1]=l,f[2]=d),f}};function Sn(t){return new Es(t)}const Bn=Sn();_e.creator=Sn(),_e.parse=Fi.parse,_e.convertToCanvasData=Fi.toCanvasData;const{drawRoundRect:Tn}=ke;function Pn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Tn(this,t,e,i,s,n)})}(t)}const Rn={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=Ln.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{}}}},Ln=Rn;Ln.alphaPixelTypes.forEach(t=>Ln.upperCaseTypeMap[t]=t.toUpperCase());const Cn=Wt.get("TaskProcessor");class On{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return ee(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Cn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class An{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&&m.assign(this.config,t),this.empty()}add(t,e){let i,s,n,o;const a=new On(t);return a.parent=this,d(e)?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),r(o)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},o)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}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 Dn=Wt.get("Resource"),Mn={tasker:new An,map:{},get isComplete(){return In.tasker.isComplete},set(t,e){In.map[t]&&Dn.repeat(t),In.map[t]=e},get:t=>In.map[t],remove(t){const e=In.map[t];e&&(e.destroy&&e.destroy(),delete In.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 h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Gt.image(s)),In.set(t,e),e},destroy(){In.map={}}},In=Mn,Fn={maxRecycled:10,recycledList:[],patternTasker:new An,get(t){let e=Mn.get(t.url);return e||Mn.set(t.url,e=Gt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Wn.recycledList.push(t)})},clearRecycled(){const t=Wn.recycledList;t.length>Wn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Mn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Rn.alphaPixelTypes.some(e=>Wn.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:"+Rn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Rn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Wn.recycledList=[]}},Wn=Fn,{IMAGE:Un,create:zn}=i,{floor:Hn,max:Nn}=Math;class Yn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=zn(Un),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(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),Mn.tasker.add(()=>ee(this,void 0,void 0,function*(){return yield t(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,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(t,i,s,n,o,r,a){if(t||(t=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=e.origin.createCanvas(Nn(Hn(t+(o||0)),1),Nn(Hn(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,i,s,n){const o=e.canvas.createPattern(t,i);try{s&&o.setTransform&&(o.setTransform(s),s=void 0)}catch(t){}return n&&m.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 Gn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function jn(t,e){return(i,s)=>Zn(i,s,t,e&&e(s))}function Kn(t){return t}function Zn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Xn(t,e,Object.assign(n,s||{})),Eo(t,e,i)}function qn(t){return jn(t)}function Jn(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function $n(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function Qn(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),no(this))}}))}function to(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function eo(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function io(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i,e)&&no(this)}}))}function so(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(no(this),this.__.__removeNaturalSize())}}))}function no(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function oo(t){return jn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),no(this)}}))}const ro=io;function ao(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i)&&(ho(this),e&&(this.__.__useStroke=!0))}}))}function ho(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&no(t)}const lo=ao;function co(t){return jn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function uo(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function po(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&_o(this)}}))}function go(t){return jn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>fo(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");fo(this,t,e,i),this.mask&&_o(this)}}))}function _o(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function fo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||no(t))}function mo(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function yo(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function vo(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function wo(t){return jn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Wt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function xo(t){return jn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function bo(t){return(e,i)=>{Xn(e,"__DataProcessor",{get:()=>t})}}function Eo(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Gn(e,i);if(r(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(g(i)){const t=f(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:m.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[o]&&(a.set=s[o],delete s[o]),Xn(s,e,a)}const ko=new Wt("rewrite"),So=[],Bo=["destroy","constructor"];function To(t){return(e,i)=>{So.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Po(){return t=>{Ro()}}function Ro(t){So.length&&(So.forEach(e=>{t&&ko.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),So.length=0)}function Lo(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 Co(){return t=>{Kt.register(t)}}function Oo(){return t=>{Jt.register(t)}}setTimeout(()=>Ro(!0));const{copy:Ao,toInnerPoint:Do,toOuterPoint:Mo,scaleOfOuter:Io,rotateOfOuter:Fo,skewOfOuter:Wo,multiplyParent:Uo,divideParent:zo,getLayout:Ho}=W,No={},{round:Yo}=Math,Xo={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),jo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Go(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(qo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Zo(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(t,i,s,n,o,r){n||(n=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,n,t.__nowWorld,o,r):i.copyWorldToInner(s,n,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,n){const o=g(e)?Object.assign({},e):{x:e,y:i};s?Mo(t.localTransform,o,o,!0):t.parent&&Do(t.parent.scrollWorldTransform,o,o,!0),Vo.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){g(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){Vo.zoomOfLocal(t,Jo(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(d(s)||(s&&(o=s),s=i),Ao(No,r),Io(No,e,i,s),Vo.hasHighPosition(t))Vo.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){Vo.rotateOfLocal(t,Jo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Ao(No,n),Fo(No,e,i),Vo.hasHighPosition(t)?Vo.setTransform(t,No,!1,s):t.set({x:t.x+No.e-n.e,y:t.y+No.f-n.f,rotation:E.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){Vo.skewOfLocal(t,Jo(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Ao(No,t.__localMatrix),Wo(No,e,i,s),Vo.setTransform(t,No,n,o)},transformWorld(t,e,i,s){Ao(No,t.worldTransform),Uo(No,e),t.parent&&zo(No,t.parent.scrollWorldTransform),Vo.setTransform(t,No,i,s)},transform(t,e,i,s){Ao(No,t.localTransform),Uo(No,e),Vo.setTransform(t,No,i,s)},setTransform(t,e,i,s){const n=t.__,o=n.origin&&Vo.getInnerOrigin(t,n.origin),r=Ho(e,o,n.around&&Vo.getInnerOrigin(t,n.around));if(Vo.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){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Vo.getInnerOrigin(t,n.origin);Z.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 Io(i,Vo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>Z.tempToOuterOf(Vo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return lt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Ao(No,t.worldTransform),zo(No,e.scrollWorldTransform),i?No:Object.assign({},No)),drop(t,e,i,s){t.setTransform(Vo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||Vo.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(t,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)t.move(i);else{const n=i.x*s,o=i.y*s;i.x-=n,i.y-=o,t.move(n,o),e.requestRender(()=>Vo.animateMove(t,i,s))}}},Vo=Xo,{updateAllMatrix:Go,updateMatrix:jo,updateAllWorldOpacity:Ko,updateAllChange:Zo,updateChange:qo}=Vo;function Jo(t,e){return t.updateLayout(),t.parent?Z.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}=Xo,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&&r(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}=Xo,{toOuterOf:lr,getPoints:dr,copy:cr}=Rt,ur="_localContentBounds",pr="_worldContentBounds",gr="_worldBoxBounds",_r="_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[pr]||(this[pr]={})),this[pr]}get worldBoxBounds(){return lr(this.boxBounds,this.leaf.__world,this[gr]||(this[gr]={})),this[gr]}get worldStrokeBounds(){return lr(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:t}=this,{leafer:i}=t;if(t.isApp)return hr(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.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 W.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 At(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=W.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=ar(s,e,!0)}if(r||(r=W.getLayout(o)),cr(r,a),Z.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 r(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 mr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class yr extends mr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}yr.ADD="child.add",yr.REMOVE="child.remove",yr.CREATED="created",yr.MOUNTED="mounted",yr.UNMOUNTED="unmounted",yr.DESTROY="destroy";const vr="property.scroll";class wr extends mr{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 mr{constructor(t,e){super(t),Object.assign(this,e)}}br.LOAD="image.load",br.LOADED="image.loaded",br.ERROR="image.error";class Er extends mr{static checkHas(t,e,i){"on"===i?e===Tr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(kr)||t.hasEvent(Sr)||t.hasEvent(Br),t.__hasWorldEvent=t.hasEvent(Tr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(kr,t),"inner"===e&&t.emit(Sr,t)),t.emit(Br,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Tr,this)}}Er.RESIZE="bounds.resize",Er.INNER="bounds.inner",Er.LOCAL="bounds.local",Er.WORLD="bounds.world";const{RESIZE:kr,INNER:Sr,LOCAL:Br,WORLD:Tr}=Er,Pr={};[kr,Sr,Br,Tr].forEach(t=>Pr[t]=1);class Rr extends mr{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){g(t)?(super(Rr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Rr.RESIZE="resize";class Lr extends mr{constructor(t,e){super(t),this.data=e}}Lr.REQUEST="watch.request",Lr.DATA="watch.data";class Cr extends mr{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 mr{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 Ar extends mr{}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.UPDATE_MODE="leafer.update_mode",Ar.TRANSFORM="leafer.transform",Ar.MOVE="leafer.move",Ar.SCALE="leafer.scale",Ar.ROTATE="leafer.rotate",Ar.SKEW="leafer.skew";const{MOVE:Dr,SCALE:Mr,ROTATE:Ir,SKEW:Fr}=Ar,Wr={x:Dr,y:Dr,scaleX:Mr,scaleY:Mr,rotation:Ir,skewX:Fr,skewY:Fr},Ur={};class zr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(p(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)p(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=Hr(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],Pr[t]&&Er.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,o;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=Hr(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],Pr[t]&&Er.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):p(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=p(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):p(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 p(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));g(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Jt.has(t)&&(e=Jt.get(t,{type:t,target:this,current:this}));const s=Hr(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],o=s&&s[t];return!!(r(e)?n||o:e?o:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Hr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Ur)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Ur)}}const{on:Nr,on_:Yr,off:Xr,off_:Vr,once:Gr,emit:jr,emitEvent:Kr,hasEvent:Zr,destroy:qr}=zr.prototype,Jr={on:Nr,on_:Yr,off:Xr,off_:Vr,once:Gr,emit:jr,emitEvent:Kr,hasEvent:Zr,destroyEventer:qr},$r=Wt.get("setAttr"),Qr={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||r(e)||($r.warn(this.innerName,t,e),e=void 0),g(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||r(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}=W,{toPoint:na,tempPoint:oa}=lt,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}=Xo,{updateBounds:la}=ir,{toOuterOf:da,copyAndSpread:ca,copy:ua}=Rt,{toBounds:pa}=mn,ga={__updateWorldBounds(){const t=this.__layout;da(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Er.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Er.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?pa(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)}},_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),Xo.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Wt.showBounds&&Wt.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,ma={__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)}}},ya={},{LEAF:va,create:wa}=i,{toInnerPoint:xa,toOuterPoint:ba,multiplyParent:Ea}=W,{toOuterOf:ka}=Rt,{copy:Sa,move:Ba}=Z,{moveLocal:Ta,zoomOfLocal:Pa,rotateOfLocal:Ra,skewOfLocal:La,moveWorld:Ca,zoomOfWorld:Oa,rotateOfWorld:Aa,skewOfWorld:Da,transform:Ma,transformWorld:Ia,setTransform:Fa,getFlipTransform:Wa,getLocalOrigin:Ua,getRelativeWorld:za,drop:Ha}=Xo;t.Leaf=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 v}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(yr.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(yr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(yr.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(yr.MOUNTED)):this.__emitLifeEvent(yr.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){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(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 Ea(i,t.matrix,e,void 0,i),ka(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),ya.scaleX=i,ya.scaleY=s,ya}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?za(this,e):this.worldTransform,n=i?t:{};return ka(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){Fa(this,t,e,i)}transform(t,e,i){Ma(this,t,e,i)}move(t,e,i){Ta(this,t,e,i)}moveInner(t,e,i){Ca(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Pa(this,Ua(this,t),e,i,s,n)}rotateOf(t,e,i){Ra(this,Ua(this,t),e,i)}skewOf(t,e,i,s,n){La(this,Ua(this,t),e,i,s,n)}transformWorld(t,e,i){Ia(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){Aa(this,t,e)}skewOfWorld(t,e,i,s,n){Da(this,t,e,i,s,n)}flip(t,e){Ma(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){Ha(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):Eo(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=io),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new yr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(yr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=te([Lo(Qr),Lo(ra),Lo(ga),Lo(Jr),Lo(_a)],t.Leaf);const{setListWithFn:Na}=Rt,{sort:Ya}=ir,{localBoxBounds:Xa,localStrokeBounds:Va,localRenderBounds:Ga,maskLocalBoxBounds:ja,maskLocalStrokeBounds:Ka,maskLocalRenderBounds:Za}=$o,qa=new Wt("Branch");t.Branch=class extends t.Leaf{__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){Na(e||this.__layout.boxBounds,this.children,this.__hasMask?ja:Xa)}__updateStrokeBounds(t){Na(t||this.__layout.strokeBounds,this.children,this.__hasMask?Ka:Va)}__updateRenderBounds(t){Na(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(Ya),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return qa.warn("add self or destroyed");const i=r(e);if(!t.__){if(p(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Kt.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(yr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(yr.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)):r(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(yr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(yr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new yr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=te([Lo(ma)],t.Branch);class Ja{get length(){return this.list.length}constructor(t){this.reset(),t&&(p(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(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++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(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&&(p(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(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}}class Qa extends ge{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.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}}Pn(OffscreenCanvasRenderingContext2D.prototype),Pn(Path2D.prototype);const{mineType:th}=Rn;function eh(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:th(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:th(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=Gt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Gt,{canvas:(t,e)=>new Qa(t,e),image:t=>new Yn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Xn(e,"devicePixelRatio",{get:()=>1});const{userAgent:ih}=navigator;ih.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),ih.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):ih.indexOf("Mac")>-1?e.os="Mac":ih.indexOf("Linux")>-1&&(e.os="Linux");class sh{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=m.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===yr.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 Lr(Lr.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_([[wr.CHANGE,this.__onAttrChange,this],[[yr.ADD,yr.REMOVE],this.__onChildEvent,this],[Lr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:nh,updateBounds:oh,updateChange:rh}=Xo,{pushAllChildBranch:ah,pushAllParent:hh}=ir;const{worldBounds:lh}=$o;class dh{constructor(t){this.updatedBounds=new At,this.beforeBounds=new At,this.afterBounds=new At,p(t)&&(t=new Ja(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,lh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,lh),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:ch,updateAllChange:uh}=Xo,ph=Wt.get("Layouter");class gh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new $a,this.target=t,e&&(this.config=m.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(Lr.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=Nt.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?(nh(t,!0),e.add(t),t.isBranch&&ah(t,e),hh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),hh(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||oh(s[t])}oh(i)}})}(this.__levelList),function(t){t.list.forEach(rh)}(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,Nt.end(e)}fullLayout(){const t=Nt.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),Nt.end(t)}static fullLayout(t){ch(t,!0),t.isBranch?ir.updateBounds(t):Xo.updateBounds(t),uh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new dh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new dh(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],[Lr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const _h=Wt.get("Renderer");class fh{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=m.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 At,_h.log(e.innerName,"---\x3e");try{this.emitRender(Or.START),this.renderOnce(t),this.emitRender(Or.END,this.totalBounds),Fn.clearRecycled()}catch(t){this.rendering=!1,_h.error(t)}_h.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return _h.warn("rendering");if(this.times>3)return _h.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new At,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=Nt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new At(s);i.save(),s.spread(fh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),Nt.end(e)}fullRender(){const t=Nt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Nt.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),Wt.showRepaint&&Wt.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 At;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const t=1e3/(Date.now()-i),{maxFPS:n}=this.config;if(n&&t>n-.5)return e.requestRender(s);this.FPS=Math.min(120,Math.ceil(t)),this.requestTime=0,this.checkRender()};e.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new At(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 At(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||_h.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.config={},this.target=this.canvas=null)}}fh.clipSpread=10;const{hitRadiusPoint:mh}=Rt;class yh{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||Xo.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Xo.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=>Xo.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&&(!i.isLeafer||"draw"!==i.mode));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 vh{constructor(t,e){this.config={},e&&(this.config=m.default(e,this.config)),this.picker=new yh(this.target=t,this),this.finder=Gt.finder&&Gt.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,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 wh(t){return jn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function xh(t){return jn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function bh(){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}})}}Object.assign(Gt,{watcher:(t,e)=>new sh(t,e),layouter:(t,e)=>new gh(t,e),renderer:(t,e,i)=>new fh(t,e,i),selector:(t,e)=>new vh(t,e)}),e.layout=gh.fullLayout;const Eh={},kh={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}},Sh={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},Bh={},Th={},Ph={},Rh={},Lh={},Ch={apply(){Vt.need("filter")}},Oh={},Ah={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Dh={list:{},register(t,e){Dh.list[t]=e},get:t=>Dh.list[t]},{parse:Mh,objectToCanvasData:Ih}=Fi,{stintSet:Fh}=m,{hasTransparent:Wh}=kh,Uh={},zh=Wt.get("UIData");class Hh extends v{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,zh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,zh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(Fh(this,"__isTransparentFill",Wh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(Fh(this,"__isTransparentStroke",Wh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):g(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&g(t[0])?(this.__setInput("path",t),this._path=e?Mh(t):Ih(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Nh(this,"shadow",t)}setInnerShadow(t){Nh(this,"innerShadow",t)}setFilter(t){Nh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Th.compute("fill",this.__leaf),e&&Th.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(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(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Uh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Uh))}__removePaint(t,e){e&&this.__removeInput(t),Ph.recycleImage(t,this),"fill"===t?(Fh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Fh(this,"__isAlphaPixelStroke",void 0),Fh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Nh(t,e,i){t.__setInput(e,i),p(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 Yh extends Hh{}class Xh extends Yh{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 Vh extends Yh{__getInputData(t,e){const i=super.__getInputData(t,e);return pe.forEach(t=>delete i[t]),i}}class Gh extends Xh{}class jh extends Hh{get __usePathBox(){return this.points||this.__pathInputed}}class Kh extends Hh{get __boxStroke(){return!this.__pathInputed}}class Zh extends Hh{get __boxStroke(){return!this.__pathInputed}}class qh extends jh{}class Jh extends Hh{}class $h extends Hh{get __pathInputed(){return 2}}class Qh extends Yh{}const tl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class el extends Hh{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=tl[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=Kt.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()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class il extends Kh{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 sl extends Kh{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 nl={__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&&(t=Lh.getShadowSpread(this,e)),s&&(t=Math.max(t,s)),o&&(t+=Ch.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}},{float:ol}=E,rl=new At,al=new At,hl=new At,ll={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&dl.getValidMove(t.__localBoxBounds,dl.getDragBounds(t),s,e,!0),dl.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:n}=t;s&&dl.getValidScaleOf(t.__localBoxBounds,dl.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],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;return n||(s=Object.assign({},s)),dl.isInnerMode(t,e,i,"width")?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),dl.isInnerMode(t,e,i,"height")?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=ol(s.x),s.y=ol(s.y),s},getValidScaleOf(t,e,i,s,n,o){let r,a;return o||(n=Object.assign({},n)),rl.set(t).scaleOf(s,n.x,n.y).unsign(),al.set(rl).add(e),hl.set(rl).intersect(e),r=dl.isInnerMode(t,e,i,"width")?al.width/rl.width:hl.width/rl.width,a=dl.isInnerMode(t,e,i,"height")?al.height/rl.height:hl.height/rl.height,n.x=ol(hl.width)?n.x*r:1,n.y=ol(hl.height)?n.y*a:1,n}},dl=ll,{stintSet:cl}=m,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&&!Lh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(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){pl(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=Th.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?Th.strokes(o,this,t):Th.stroke(o,this,t)),n&&(s.__isFills?Th.fills(n,this,t):Th.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&Lh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Th.strokes(o,this,t):Th.stroke(o,this,t)),c&&Ch.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Th.strokes(o,this,t):Th.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,kh.string(e.color))}n&&(s.__isFills?Th.fills(n,this,t):Th.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Th.strokes(o,this,t):Th.stroke(o,this,t))}}else s.__pathInputed?pl(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?Th.fills(s,this,t):Th.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Th.strokes(n,this,t):Th.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 pl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:o,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Th.stroke(n,t,e),s&&Th.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&Th.stroke(n,t,e)}const gl={__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,fl;t.UI=_l=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){E.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 Bn.set(this.path=t||[]),t||this.__drawPathByBox(Bn),Bn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return h(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||(Bn.set(i=[]),this.__drawPathByBox(Bn)),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||Oh.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&&Bh.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?Ws.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,d(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Th.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=m.clone(this.toJSON());return t&&Object.assign(e,t),_l.one(e)}static one(t,e,i,s,n){return Kt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Co()(this)}static registerData(t){bo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},te([bo(Hh)],t.UI.prototype,"__",void 0),te([bh()],t.UI.prototype,"zoomLayer",void 0),te([qn("")],t.UI.prototype,"id",void 0),te([qn("")],t.UI.prototype,"name",void 0),te([qn("")],t.UI.prototype,"className",void 0),te([uo("pass-through")],t.UI.prototype,"blendMode",void 0),te([po(1)],t.UI.prototype,"opacity",void 0),te([go(!0)],t.UI.prototype,"visible",void 0),te([uo(!1)],t.UI.prototype,"locked",void 0),te([uo(!1)],t.UI.prototype,"dim",void 0),te([uo(!1)],t.UI.prototype,"dimskip",void 0),te([mo(0)],t.UI.prototype,"zIndex",void 0),te([yo(!1)],t.UI.prototype,"mask",void 0),te([vo(!1)],t.UI.prototype,"eraser",void 0),te([Jn(0,!0)],t.UI.prototype,"x",void 0),te([Jn(0,!0)],t.UI.prototype,"y",void 0),te([io(100,!0)],t.UI.prototype,"width",void 0),te([io(100,!0)],t.UI.prototype,"height",void 0),te([to(1,!0)],t.UI.prototype,"scaleX",void 0),te([to(1,!0)],t.UI.prototype,"scaleY",void 0),te([eo(0,!0)],t.UI.prototype,"rotation",void 0),te([eo(0,!0)],t.UI.prototype,"skewX",void 0),te([eo(0,!0)],t.UI.prototype,"skewY",void 0),te([Jn(0,!0)],t.UI.prototype,"offsetX",void 0),te([Jn(0,!0)],t.UI.prototype,"offsetY",void 0),te([$n(0,!0)],t.UI.prototype,"scrollX",void 0),te([$n(0,!0)],t.UI.prototype,"scrollY",void 0),te([Qn()],t.UI.prototype,"origin",void 0),te([Qn()],t.UI.prototype,"around",void 0),te([qn(!1)],t.UI.prototype,"lazy",void 0),te([so(1)],t.UI.prototype,"pixelRatio",void 0),te([co(0)],t.UI.prototype,"renderSpread",void 0),te([oo()],t.UI.prototype,"path",void 0),te([ro()],t.UI.prototype,"windingRule",void 0),te([ro(!0)],t.UI.prototype,"closed",void 0),te([io(0)],t.UI.prototype,"padding",void 0),te([io(!1)],t.UI.prototype,"lockRatio",void 0),te([io()],t.UI.prototype,"widthRange",void 0),te([io()],t.UI.prototype,"heightRange",void 0),te([qn(!1)],t.UI.prototype,"draggable",void 0),te([qn()],t.UI.prototype,"dragBounds",void 0),te([qn("auto")],t.UI.prototype,"dragBoundsType",void 0),te([qn(!1)],t.UI.prototype,"editable",void 0),te([wo(!0)],t.UI.prototype,"hittable",void 0),te([wo("path")],t.UI.prototype,"hitFill",void 0),te([lo("path")],t.UI.prototype,"hitStroke",void 0),te([wo(!1)],t.UI.prototype,"hitBox",void 0),te([wo(!0)],t.UI.prototype,"hitChildren",void 0),te([wo(!0)],t.UI.prototype,"hitSelf",void 0),te([wo()],t.UI.prototype,"hitRadius",void 0),te([xo("")],t.UI.prototype,"cursor",void 0),te([uo()],t.UI.prototype,"fill",void 0),te([lo(void 0,!0)],t.UI.prototype,"stroke",void 0),te([lo("inside")],t.UI.prototype,"strokeAlign",void 0),te([lo(1,!0)],t.UI.prototype,"strokeWidth",void 0),te([lo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),te([lo("none")],t.UI.prototype,"strokeCap",void 0),te([lo("miter")],t.UI.prototype,"strokeJoin",void 0),te([lo()],t.UI.prototype,"dashPattern",void 0),te([lo(0)],t.UI.prototype,"dashOffset",void 0),te([lo(10)],t.UI.prototype,"miterLimit",void 0),te([ro(0)],t.UI.prototype,"cornerRadius",void 0),te([ro()],t.UI.prototype,"cornerSmoothing",void 0),te([wh()],t.UI.prototype,"shadow",void 0),te([wh()],t.UI.prototype,"innerShadow",void 0),te([wh()],t.UI.prototype,"blur",void 0),te([wh()],t.UI.prototype,"backgroundBlur",void 0),te([wh()],t.UI.prototype,"grayscale",void 0),te([wh()],t.UI.prototype,"filter",void 0),te([uo()],t.UI.prototype,"placeholderColor",void 0),te([qn(100)],t.UI.prototype,"placeholderDelay",void 0),te([qn({})],t.UI.prototype,"data",void 0),te([To(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=_l=te([Lo(nl),Lo(ul),Po()],t.UI),t.Group=class extends t.UI{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(){}},te([bo(Yh)],t.Group.prototype,"__",void 0),te([io(0)],t.Group.prototype,"width",void 0),te([io(0)],t.Group.prototype,"height",void 0),t.Group=te([Lo(t.Branch),Co()],t.Group);const ml=Wt.get("Leafer");t.Leafer=fl=class extends t.Group{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),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,m.assign(s,t));const n=this.canvas=Gt.canvas(s);this.__controllers.push(this.renderer=Gt.renderer(this,n,s),this.watcher=Gt.watcher(this,s),this.layouter=Gt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=Gt.selector(this),this.interaction=Gt.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Gt.hitCanvasManager()),this.canvasManager=new Qt,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=m.copyAttrs({},t,pe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new At(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=m.copyAttrs({},this.canvas,pe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Rr(t,i))}__onResize(t){this.emitEvent(t),m.copyAttrs(this.__,t,pe),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&&(pe.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())):"mode"===t&&this.emit(Ar.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&pe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=m.copyAttrs({},s,pe);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=Nt.start("FirstCreate "+this.innerName);this.once([[Ar.START,()=>Nt.end(t)],[Cr.START,this.updateLazyBounds,this],[Or.START,this.__onCreated,this],[Or.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Lr.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(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){ml.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ja,te([bo(Vh)],t.Leafer.prototype,"__",void 0),te([io()],t.Leafer.prototype,"pixelRatio",void 0),te([qn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=fl=te([Co()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},te([bo(Kh)],t.Rect.prototype,"__",void 0),t.Rect=te([Lo(gl),Po(),Co()],t.Rect);const{add:yl,includes:vl,scroll:wl}=Rt,xl=t.Rect.prototype,bl=t.Group.prototype;t.Box=class extends t.Group{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"))&&(yl(a,o),wl(a,i)),this.__updateRectRenderBounds(),t=!vl(o,a),t&&"show"===r&&yl(n,a)}else this.__updateRectRenderBounds();m.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))}},te([bo(Xh)],t.Box.prototype,"__",void 0),te([io(100)],t.Box.prototype,"width",void 0),te([io(100)],t.Box.prototype,"height",void 0),te([qn(!1)],t.Box.prototype,"resizeChildren",void 0),te([co("show")],t.Box.prototype,"overflow",void 0),te([To(xl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),te([To(xl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),te([To(xl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),te([To(xl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),te([To(xl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),te([To(xl.__updateChange)],t.Box.prototype,"__updateRectChange",null),te([To(xl.__render)],t.Box.prototype,"__renderRect",null),te([To(bl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=te([Po(),Co()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},te([bo(Gh)],t.Frame.prototype,"__",void 0),te([uo("#FFFFFF")],t.Frame.prototype,"fill",void 0),te([co("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=te([Co()],t.Frame);const{moveTo:El,closePath:kl,ellipse:Sl}=rs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Sl(h,r,a,r*s,a*s,0,n,o,!1),Sl(h,r,a,r,a,0,o,n,!0),s<1&&kl(h)):(s<1&&(Sl(h,r,a,r*s,a*s),El(h,t,a)),Sl(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(El(h,r,a),Sl(h,r,a,r,a,0,n,o,!1),kl(h)):Sl(h,r,a,r,a)}},te([bo(Zh)],t.Ellipse.prototype,"__",void 0),te([ro(0)],t.Ellipse.prototype,"innerRadius",void 0),te([ro(0)],t.Ellipse.prototype,"startAngle",void 0),te([ro(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=te([Co()],t.Ellipse);const{sin:Bl,cos:Tl,PI:Pl}=Math,{moveTo:Rl,lineTo:Ll,closePath:Cl,drawPoints:Ol}=rs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ol(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;Rl(e,o,0);for(let t=1;t<n;t++)Ll(e,o+o*Bl(2*t*Pl/n),r-r*Tl(2*t*Pl/n));Cl(e)}}},te([bo(qh)],t.Polygon.prototype,"__",void 0),te([ro(3)],t.Polygon.prototype,"sides",void 0),te([ro()],t.Polygon.prototype,"points",void 0),te([ro(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=te([Po(),Co()],t.Polygon);const{sin:Al,cos:Dl,PI:Ml}=Math,{moveTo:Il,lineTo:Fl,closePath:Wl}=rs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Il(r,n,0);for(let t=1;t<2*i;t++)Fl(r,n+(t%2==0?n:n*s)*Al(t*Ml/i),o-(t%2==0?o:o*s)*Dl(t*Ml/i));Wl(r)}},te([bo(Jh)],t.Star.prototype,"__",void 0),te([ro(5)],t.Star.prototype,"corners",void 0),te([ro(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=te([Co()],t.Star);const{moveTo:Ul,lineTo:zl,drawPoints:Hl}=rs,{rotate:Nl,getAngle:Yl,getDistance:Xl,defaultPoint:Vl}=Z;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Nl(i,e),i}set toPoint(t){this.width=Xl(Vl,t),this.rotation=Yl(Vl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Hl(e,t.points,t.curve,t.closed):(Ul(e,0,0),zl(e,this.width,0))}},te([bo(jh)],t.Line.prototype,"__",void 0),te([ao("center")],t.Line.prototype,"strokeAlign",void 0),te([io(0)],t.Line.prototype,"height",void 0),te([ro()],t.Line.prototype,"points",void 0),te([ro(0)],t.Line.prototype,"curve",void 0),te([ro(!1)],t.Line.prototype,"closed",void 0),t.Line=te([Co()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}},te([bo(il)],t.Image.prototype,"__",void 0),te([io("")],t.Image.prototype,"url",void 0),t.Image=te([Co()],t.Image);const Gl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Gt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Yn({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 it(t.worldTransform).invert(),o=new it;e&&o.translate(e.x,e.y),i&&(d(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()}},te([bo(sl)],t.Canvas.prototype,"__",void 0),te([xh(100)],t.Canvas.prototype,"width",void 0),te([xh(100)],t.Canvas.prototype,"height",void 0),te([xh(1)],t.Canvas.prototype,"pixelRatio",void 0),te([xh(!0)],t.Canvas.prototype,"smooth",void 0),te([qn(!1)],t.Canvas.prototype,"safeResize",void 0),te([xh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=te([Co()],t.Canvas);const{copyAndSpread:jl,includes:Kl,spread:Zl,setList:ql}=Rt;t.Text=class extends t.UI{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=Sh.number(e,n),t.__letterSpacing=Sh.number(i,n),t.__padding=l?E.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=Eh.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&&Zl(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),m.stintSet(this,"isOverflow",!Kl(h,a)),this.isOverflow?(ql(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;jl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__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()}},te([bo(el)],t.Text.prototype,"__",void 0),te([io(0)],t.Text.prototype,"width",void 0),te([io(0)],t.Text.prototype,"height",void 0),te([uo()],t.Text.prototype,"boxStyle",void 0),te([qn(!1)],t.Text.prototype,"resizeFontSize",void 0),te([uo("#000000")],t.Text.prototype,"fill",void 0),te([ao("outside")],t.Text.prototype,"strokeAlign",void 0),te([wo("all")],t.Text.prototype,"hitFill",void 0),te([io("")],t.Text.prototype,"text",void 0),te([io("")],t.Text.prototype,"placeholder",void 0),te([io("caption")],t.Text.prototype,"fontFamily",void 0),te([io(12)],t.Text.prototype,"fontSize",void 0),te([io("normal")],t.Text.prototype,"fontWeight",void 0),te([io(!1)],t.Text.prototype,"italic",void 0),te([io("none")],t.Text.prototype,"textCase",void 0),te([io("none")],t.Text.prototype,"textDecoration",void 0),te([io(0)],t.Text.prototype,"letterSpacing",void 0),te([io({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),te([io(0)],t.Text.prototype,"paraIndent",void 0),te([io(0)],t.Text.prototype,"paraSpacing",void 0),te([io("x")],t.Text.prototype,"writingMode",void 0),te([io("left")],t.Text.prototype,"textAlign",void 0),te([io("top")],t.Text.prototype,"verticalAlign",void 0),te([io(!0)],t.Text.prototype,"autoSizeAlign",void 0),te([io("normal")],t.Text.prototype,"textWrap",void 0),te([io("show")],t.Text.prototype,"textOverflow",void 0),te([uo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=te([Co()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},te([bo($h)],t.Path.prototype,"__",void 0),te([ao("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=te([Co()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),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")}},te([bo(Qh)],t.Pen.prototype,"__",void 0),te([(t,e)=>{Xn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=te([Lo(Es,["set","path","paint"]),Co()],t.Pen),t.App=class extends t.Leafer{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&&Gt.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(e){const i=new t.Leafer(e);return this.add(i),i}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),r(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&&m.assign(e,t),this.autoLayout&&m.copyAttrs(e,this,pe),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))}},t.App=te([Co()],t.App);const Jl={},$l={isHoldSpaceKey:()=>$l.isHold("Space"),isHold:t=>Jl[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Jl[t]||(Jl[t]=!0)},setUpCode(t){Jl[t]=!1}},Ql={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 td extends mr{get spaceKey(){return $l.isHoldSpaceKey()}get left(){return Ql.left(this)}get right(){return Ql.right(this)}get middle(){return Ql.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return $l.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){Jt.changeName(t,e)}}t.PointerEvent=class extends td{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=te([Oo()],t.PointerEvent);const ed=t.PointerEvent,id={};t.DragEvent=class extends t.PointerEvent{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 Z.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(id,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(id,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(id,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 Rt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Rt.unsign(i),i}assignMove(t){id.x=t?this.totalX:this.moveX,id.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=te([Oo()],t.DragEvent);const sd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=te([Oo()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=te([Oo()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=te([Oo()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=te([Oo()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=te([Oo()],t.ZoomEvent),t.KeyEvent=class extends td{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=te([Oo()],t.KeyEvent);const nd={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:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.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(Z.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:r(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:e=>e&&e.list.some(e=>Xo.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},od=nd,rd=new Ja,{getDragEventData:ad,getDropEventData:hd,getSwipeEventData:ld}=nd;class dd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=ad(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||rd;return this.dragging&&(n?e?rd:new Ja(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&Ql.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.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],Xo.draggable(e)){this.draggableList=new Ja(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=ad(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:o}=this.dragData,{dragLimitAnimate:r}=i.p,a=!r||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},a||n);r&&!n&&e?Xo.animateMove(i,l,d(r)?r:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=ad(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(Z.getDistance(e,t)>n.config.pointer.swipeDistance){const t=ld(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=hd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.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 cd=Wt.get("emit");const ud=["move","zoom","rotate","key"];function pd(t,e,i,s,n){if(ud.some(t=>e.startsWith(t))&&t.__.hitChildren&&!_d(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&&gd(o,e,i,s,n)}}function gd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!_d(t,n)&&(Ah.updateEventStyle&&!s&&Ah.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=Jt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function _d(t,e){return e&&e.has(t)}const fd={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:md,pathCanDrag:yd,pathHasOutside:vd}=nd;class wd{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&&Ql.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Ql.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&$l.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=m.clone(fd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ja(t),this.createTransformer(),this.dragger=new dd(this),s&&(this.config=m.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Ql.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),Ql.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Ql.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Ql.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=Z.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;Ql.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,$l.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,$l.setUpCode(i),this.emit(t.KeyEvent.UP,e,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(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>md(e.path,t));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:o,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.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&&!yd(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(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}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&&Z.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}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(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(md(e.path,t.PointerEvent.LONG_TAP)||md(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new At(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Rr.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],gd(n,t,e,!0,s))return;n.isApp&&pd(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&pd(n,t,e,!1,s),gd(n,t,e,!1,s))return}catch(t){cd.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 xd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}xd.custom={};class bd extends Qt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ja,this.pixelList=new Ja}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Gt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Gt.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()}}e.getSelector=function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Gt.selector())};const{toInnerRadiusPointOf:Ed,copy:kd,setRadius:Sd}=Z,{hitRadiusPoint:Bd,hitPoint:Td}=Rt,Pd={},Rd={},Ld=t.Leaf.prototype;Ld.hit=function(t,i=0){this.updateLayout(),kd(Rd,t),Sd(Rd,i);const s=this.__world;return!!(i?Bd(s,Rd):Td(s,Rd))&&(this.isBranch?e.getSelector(this).hitPoint(Object.assign({},Rd),i,{target:this}):this.__hitWorld(Rd))},Ld.__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(Pd,t),Sd(t=Pd,e.hitRadius)),Ed(t,i,Pd),e.hitBox||n){if(Rt.hitRadiusPoint(s.boxBounds,Pd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Pd)},Ld.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Ld.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Ld.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Ld.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Cd=new it,Od=t.UI.prototype;Od.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.leafer||this.parent&&this.parent.leafer;if(!t)return;const i=this.__,{hitCanvasManager:s}=t,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:t}=this.__layout,s=e.image.hitCanvasSize,r=a.hitScale=Dt.set(0,0,s,s).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=Dt.set(t).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Fn.patternLocked=!0,this.__renderShape(a,{matrix:Cd.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)},Od.__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 Ad=t.UI.prototype,Dd=t.Rect.prototype,Md=t.Box.prototype;Dd.__updateHitCanvas=Md.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ad.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Dd.__hitFill=Md.__hitFill=function(t){return this.__hitCanvas?Ad.__hitFill.call(this,t):Rt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.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))},t.Group.prototype.pick=function(t,i){return i||(i=o),this.updateLayout(),e.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Id=ge.prototype;function Fd(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 Wd(t,e){t.__.__font?Fd(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Ud(t,e,i){switch(e.__.strokeAlign){case"center":zd(t,1,e,i);break;case"inside":Hd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?zd(t,2,e,i):Hd(t,"outside",e,i)}}function zd(t,e,i,s){const n=i.__;g(t)?Yd(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Nd(i,s))}function Hd(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,zd(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",Fd(i,n),n.blendMode="normal",Xo.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Nd(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 Yd(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||!Ph.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?Nd(s,n):n.stroke(),n.restoreBlendMode()):i?Nd(s,n):n.stroke()}}function Xd(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Ud(t,e,i);else switch(s.strokeAlign){case"center":Vd(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Vd(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Vd(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Vd(t,2,e,o),o.clipUI(s),o.clearWorld(n),Xo.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i)}}function Vd(t,e,i,s){const n=i.__;g(t)?Yd(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Th.strokeArrow(t,i,s)}Id.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Id.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Id.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Dt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Dt.x,Dt.y,Dt.width||1,Dt.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:Gd,getOuterOf:jd,getByMove:Kd,getIntersectData:Zd}=Rt;let qd;const{stintSet:Jd}=m,{hasTransparent:$d}=kh;function Qd(t,e,i){if(!g(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Ph.image(i,t,e,n,!qd||!qd[e.url]);break;case"linear":s=Rh.linearGradient(e,n);break;case"radial":s=Rh.radialGradient(e,n);break;case"angular":s=Rh.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:kh.string(a,h)};break;default:r(e.r)||(s={type:"solid",style:kh.string(e)})}if(s){if(h(s.style)&&$d(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 tc={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];p(a)||(a=[a]),qd=Ph.recycleImage(t,i);for(let i,n=0,o=a.length;n<o;n++)(i=Qd(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?(Jd(i,"__isAlphaPixelFill",n),Jd(i,"__isTransparentFill",o)):(Jd(i,"__isAlphaPixelStroke",n),Jd(i,"__isTransparentStroke",o),Jd(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Wd(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(Ph.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),Wd(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Wd(e,i),i.restoreBlendMode()):Wd(e,i)}},fillPathOrText:Wd,fillText:Fd,stroke:Xd,strokes:function(t,e,i){Xd(t,e,i)},strokeText:Ud,drawTextStroke:Nd,shape:function(t,i,s){const n=i.getSameCanvas(),o=t.__nowWorld,r=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:p}=t.getRenderScaleData(!0);if(r.includes(o))c=n,a=d=o;else{const{renderShapeSpread:n}=t.__layout;let g;if(e.fullImageShadow)g=o;else{const t=n?Gd(r,u===p?n*u:[n*p,n*u]):r;g=Zd(t,o)}l=r.getFitMatrix(g);let{a:_,d:f}=l;l.a<1&&(c=i.getSameCanvas(),t.__renderShape(c,s),u*=_,p*=f),d=jd(o,l),a=Kd(d,-l.e,-l.f);const m=s.matrix;m?(h=new it(l),h.multiply(m),_*=m.scaleX,f*=m.scaleY):h=l,h.withScale(_,f),s=Object.assign(Object.assign({},s),{matrix:h})}return t.__renderShape(n,s),{canvas:n,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:p}}};let ec={},ic={a:1,b:0,c:0,d:1,e:0,f:0};const{get:sc,rotateOfOuter:nc,translate:oc,scaleOfOuter:rc,multiplyParent:ac,scale:hc,rotate:lc,skew:dc}=W;function cc(t,e,i,s,n,o,r){const a=sc();oc(a,e.x+i,e.y+s),hc(a,n,o),r&&nc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function uc(t,e,i,s,n,o,r,a,h){const l=sc();gc(l,e,i,s,n,o,r,a),h&&(ic.a=e.width/h.width,ic.d=e.height/h.height,ac(l,ic)),t.transform=l}function pc(t,e,i,s,n,o,r,a,h,l,d,c){const u=sc();if(c)gc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)nc(u,{x:i/2,y:s/2},h);else switch(lc(u,h),h){case 90:oc(u,s,0);break;case 180:oc(u,i,s);break;case 270:oc(u,0,i)}ec.x=e.x+n,ec.y=e.y+o,oc(u,ec.x,ec.y),r&&rc(u,ec,r,a)}t.transform=u}function gc(t,e,i,s,n,o,r,a){r&&lc(t,r),a&&dc(t,a.x,a.y),n&&hc(t,n,o),oc(t,e.x+i,e.y+s)}const{get:_c,translate:fc}=W,mc=new At,yc={},vc={};function wc(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=xc(i,s,e)}function xc(t,e,i){t.padding&&(e=mc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:a,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==a&&(u||0)%180==90;let b,k;switch(Rt.set(vc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(E.getScaleData(d,c,i,yc),b=yc.scaleX,k=yc.scaleY),(a||m||f)&&(b&&Rt.scale(vc,b,k,!0),a&&ut.toPoint(a,vc,e,vc,!0,!0))):v&&!u||(b=k=Rt.getFitScale(e,vc,"fit"!==r),Rt.put(e,i,a,b,!1,vc),Rt.scale(vc,b,k,!0)),l&&Z.move(vc,l),r){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(vc.x||vc.y||b||_||u||p)&&uc(w,e,vc.x,vc.y,b,k,u,p,t.clipSize);break;case"repeat":(!v||b||u||p)&&pc(w,e,s,n,vc.x,vc.y,b,k,u,p,a,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;g(t)?(o=t.x,r=t.y):o=r=t;return{x:bc(o,i,n.width,e&&e.x),y:bc(r,s,n.height,e&&e.y)}}(m,i&&f,vc.width,vc.height,e));break;default:b&&cc(w,e,vc.x,vc.y,b,k,u)}return w.transform||(e.x||e.y)&&(w.transform=_c(),fc(w.transform,e.x,e.y)),b&&"stretch"!==r&&(w.scaleX=b,w.scaleY=k),w.width=s,w.height=n,o&&(w.opacity=o),y&&(w.filters=y),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function bc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Ec,kc=new At;const{isSame:Sc}=Rt;function Bc(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||wc(n,s,i,o),!0}function Tc(t,e){Lc(t,br.LOAD,e)}function Pc(t,e){Lc(t,br.LOADED,e)}function Rc(t,e,i){e.error=i,t.forceUpdate("surface"),Lc(t,br.ERROR,e)}function Lc(t,e,i){t.hasEvent(e)&&t.emitEvent(new br(e,i))}function Cc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Oc,scale:Ac,copy:Dc}=W,{floor:Mc,ceil:Ic,max:Fc,abs:Wc}=Math;function Uc(t,i,s){let{scaleX:n,scaleY:o}=t.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+o+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:p,scaleY:g,transform:_,repeat:f,gap:m}=h;n*=s,o*=s,p&&(p=Wc(p),g=Wc(g),d=Oc(),Dc(d,_),Ac(d,1/p,1/g),n*=p,o*=g),c*=n,u*=o;const y=c*u;if(!f&&y>e.image.maxCacheSize)return!1;let v=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Ic(t))}else{const t=a.width*a.height;v>t&&(v=t)}y>v&&(l=Math.sqrt(y/v)),l&&(n/=l,o/=l,c/=l,u/=l),p&&(n/=p,o/=g);const w=m&&m.x*n,x=m&&m.y*o;if(_||1!==n||1!==o){const t=c+(w||0),e=u+(x||0);n/=t/Fc(Mc(t),1),o/=e/Fc(Mc(e),1),d||(d=Oc(),_&&Dc(d,_)),Ac(d,1/n,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,t.leafer&&t.leafer.config.smooth),E=a.getPattern(b,f||e.origin.noRepeat||"no-repeat",d,i);return i.style=E,i.patternId=r,!0}}const zc={image:function(t,e,i,s,n){let o,r;const a=Fn.get(i);return Ec&&i===Ec.paint&&Sc(s,Ec.boxBounds)?o=Ec.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Ec=a.use>1?{leafPaint:o,paint:i,boxBounds:kc.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Bc(t,e,i,a,o,s),n&&(Tc(t,r),Pc(t,r))):a.error?n&&Rc(t,r,a.error):(n&&(Cc(t,!0),Tc(t,r)),o.loadId=a.load(()=>{Cc(t,!1),t.destroyed||(Bc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Pc(t,r)),o.loadId=void 0},e=>{Cc(t,!1),Rc(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(t,i,s,n){const{scaleX:o,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!Oh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&Rr.isResizing(t)||Oh.running)){let{width:t,height:i}=h;t*=o*a,i*=r*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__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()}(t,i,s,h),!0):(!s.style||s.sync||Oh.running?Uc(t,s,a):s.patternTask||(s.patternTask=Fn.patternTasker.add(()=>ee(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Uc(t,s,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Uc,recycleImage:function(t,e){const i=e["_"+t];if(p(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]||[],p(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createData:wc,getPatternData:xc,fillOrFitMode:cc,clipMode:uc,repeatMode:pc},{toPoint:Hc}=lt,{hasTransparent:Nc}=kh,Yc={},Xc={};function Vc(t,e,i,s){if(i){let n,o,r,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(r=t/(l-1),o=kh.string(n,s)):(r=n.offset,o=kh.string(n.color,s)),e.addColorStop(r,o),!a&&Nc(o)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Gc,getDistance:jc}=Z,{get:Kc,rotateOfOuter:Zc,scaleOfOuter:qc}=W,{toPoint:Jc}=lt,$c={},Qc={};function tu(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Gc(e,i);o=Kc(),n?(qc(o,e,r/a*(s||1),1),Zc(o,e,t+90)):(qc(o,e,1,r/a*(s||1)),Zc(o,e,t))}return o}const{getDistance:eu}=Z,{toPoint:iu}=lt,su={},nu={};const ou={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:r}=t;Hc(s||"top",i,Yc),Hc(n||"bottom",i,Xc);const a=e.canvas.createLinearGradient(Yc.x,Yc.y,Xc.x,Xc.y),h={type:o,style:a};return Vc(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Jc(s||"center",i,$c),Jc(n||"bottom",i,Qc);const h=e.canvas.createRadialGradient($c.x,$c.y,0,$c.x,$c.y,jc($c,Qc)),l={type:o,style:h};Vc(l,h,t.stops,r);const d=tu(i,$c,Qc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;iu(s||"center",i,su),iu(n||"bottom",i,nu);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,su.x,su.y):e.canvas.createRadialGradient(su.x,su.y,0,su.x,su.y,eu(su,nu)),l={type:o,style:h};Vc(l,h,t.stops,r);const d=tu(i,su,nu,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:tu},{copy:ru,toOffsetOutBounds:au}=Rt,hu={},lu={};function du(t,i,s,n){const{bounds:o,shapeBounds:r}=n;if(e.fullImageShadow){if(ru(hu,t.bounds),hu.x+=i.x-r.x,hu.y+=i.y-r.y,s){const{fitMatrix:t}=n;hu.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),hu.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),hu.width*=s,hu.height*=s}t.copyWorld(n.canvas,t.bounds,hu)}else s&&(ru(hu,i),hu.x-=i.width/2*(s-1),hu.y-=i.height/2*(s-1),hu.width*=s,hu.height*=s),t.copyWorld(n.canvas,r,s?hu:i)}const{toOffsetOutBounds:cu}=Rt,uu={};const pu={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,p=e.getSameCanvas(),g=a.length-1;au(l,lu),a.forEach((a,_)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.setWorldShadow(lu.offsetX+a.x*c*f,lu.offsetY+a.y*u*f,a.blur*c*f,kh.string(a.color)),n=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,du(p,lu,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),Lh.isTransformShadow(a)?Lh.renderTransformShadow(t,e,p,s,a):Xo.copyCanvasByWorld(t,e,p,s,a.blendMode),g&&_<g&&p.clearWorld(s)}),p.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,p=e.getSameCanvas(),g=a.length-1;cu(l,uu),a.forEach((a,_)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(uu.offsetX+a.x*c*f,uu.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(p,uu,n,i),p.restore(),h?(p.copyWorld(p,l,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,kh.string(a.color),"source-in"),Xo.copyCanvasByWorld(t,e,p,s,a.blendMode),g&&_<g&&p.clearWorld(s)}),p.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){},getShadowSpread:function(t,e){let i=0;return e.forEach(t=>i=Math.max(i,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),i},isTransformShadow(t){}},{excludeRenderBounds:gu}=$o;let _u;function fu(t,e,i,s,n,o,r,a){switch(e){case"grayscale":_u||(_u=!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 mu(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)}t.Group.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&&(fu(this,r,t,n,s,o,void 0,!0),s=n=null),o=i.__.opacity,_u=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=mu(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=mu(t)),n||(n=mu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||gu(i,e)||i.__render(t,e);continue}const d=1===o&&i.__.__blendMode;d&&fu(this,r,t,n,s,o,void 0,!1),gu(i,e)||i.__render(n||t,e),d&&fu(this,r,t,n,s,o,d,!1)}fu(this,r,t,n,s,o,void 0,!0)};const vu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",wu=vu+"_#~&*+\\=|≮≯≈≠=…",xu=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 bu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Eu=bu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ku=bu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Su=bu(vu),Bu=bu(wu),Tu=bu("- —/~|┆·");var Pu;!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"}(Pu||(Pu={}));const{Letter:Ru,Single:Lu,Before:Cu,After:Ou,Symbol:Au,Break:Du}=Pu;function Mu(t){return Eu[t]?Ru:Tu[t]?Du:ku[t]?Cu:Su[t]?Ou:Bu[t]?Au:xu.test(t)?Lu:Ru}const Iu={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 Fu(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:Wu}=Iu,{Letter:Uu,Single:zu,Before:Hu,After:Nu,Symbol:Yu,Break:Xu}=Pu;let Vu,Gu,ju,Ku,Zu,qu,Ju,$u,Qu,tp,ep,ip,sp,np,op,rp,ap,hp=[];function lp(t,e){Qu&&!$u&&($u=Qu),Vu.data.push({char:t,width:e}),ju+=e}function dp(){Ku+=ju,Vu.width=ju,Gu.words.push(Vu),Vu={data:[]},ju=0}function cp(){np&&(op.paraNumber++,Gu.paraStart=!0,np=!1),Qu&&(Gu.startCharSize=$u,Gu.endCharSize=Qu,$u=0),Gu.width=Ku,rp.width?Wu(Gu):ap&&up(),hp.push(Gu),Gu={words:[]},Ku=0}function up(){Ku>(op.maxWidth||0)&&(op.maxWidth=Ku)}const{top:pp,right:gp,bottom:_p,left:fp}=t.Direction4;function mp(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 yp={getDrawData:function(t,i){h(t)||(t=String(t));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:l,__padding:d}=i;d&&(o?(s=d[fp],o-=d[gp]+d[fp]):i.autoSizeAlign||(s=d[fp]),r?(n=d[pp],r-=d[pp]+d[_p]):i.autoSizeAlign||(n=d[pp]));const c={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){op=t,hp=t.rows,rp=t.bounds,ap=!rp.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=rp;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;np=!0,ep=null,$u=Ju=Qu=ju=Ku=0,Vu={data:[]},Gu={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)qu=i[s],"\n"===qu?(ju&&dp(),Gu.paraEnd=!0,cp(),np=!0):(tp=Mu(qu),tp===Uu&&"none"!==r&&(qu=Fu(qu,r,!ju)),Ju=a.measureText(qu).width,n&&(n<0&&(Qu=Ju),Ju+=n),ip=tp===zu&&(ep===zu||ep===Uu)||ep===zu&&tp!==Nu,sp=!(tp!==Hu&&tp!==zu||ep!==Yu&&ep!==Nu),Zu=np&&o?h-o:h,t&&h&&Ku+ju+Ju>Zu&&(e?(ju&&dp(),Ku&&cp()):(sp||(sp=tp===Uu&&ep==Nu),ip||sp||tp===Xu||tp===Hu||tp===zu||ju+Ju>Zu?(ju&&dp(),Ku&&cp()):Ku&&cp()))," "===qu&&!0!==np&&Ku+ju===0||(tp===Xu?(" "===qu&&ju&&dp(),lp(qu,Ju),dp()):ip||sp?(ju&&dp(),lp(qu,Ju)):lp(qu,Ju)),ep=tp);ju&&dp(),Ku&&cp(),hp.length>0&&(hp[hp.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{op.paraNumber++,Ku=a.measureText(t).width,hp.push({x:o||0,text:t,width:Ku,paraStart:!0}),ap&&up()})}(c,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":mp(e,"x",t[fp]);break;case"right":mp(e,"x",-t[gp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":mp(e,"y",t[pp]);break;case"bottom":mp(e,"y",-t[_p])}}(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:p,y:g,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(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&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(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(t,i,s,n){if(!n)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,i,s,o),"none"!==a&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,g(o)?(i=o.type,o.color&&(t.decorationColor=kh.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(c,i),c}};const vp={string:function(t,e){const i=d(e)&&e<1;if(h(t)){if(!i||!kh.object)return t;t=kh.object(t)}let s=r(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 wp(t){return t?p(t)?t:[t]:[]}Object.assign(Eh,yp),Object.assign(kh,vp),Object.assign(Th,tc),Object.assign(Ph,zc),Object.assign(Rh,ou),Object.assign(Lh,pu),Object.assign(Gt,{interaction:(t,e,i,s)=>new wd(t,e,i,s),hitCanvas:(t,e)=>new Qa(t,e),hitCanvasManager:()=>new bd}),eh();class xp extends mr{get list(){return wp(this.value)}get oldList(){return wp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function bp(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){p(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(g(i))e=i;else if(!1===i)return}}const s=t?xp.BEFORE_SELECT:xp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new xp(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}xp.BEFORE_SELECT="editor.before_select",xp.SELECT="editor.select",xp.AFTER_SELECT="editor.after_select",xp.BEFORE_HOVER="editor.before_hover",xp.HOVER="editor.hover";const{abs:Ep}=Math,{copy:kp,scale:Sp}=W,{setListWithFn:Bp}=Rt,{worldBounds:Tp}=$o,Pp={a:1,b:0,c:0,d:1,e:0,f:0},Rp={x:0,y:0,width:0,height:0};class Lp extends t.UI{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?(Bp(Rp,e,Tp),t&&this.set(t),this.set(Rp),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:a}=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=Ep(c.scaleX),l=Ep(c.scaleY);if(kp(Pp,c),Pp.half=r%2,i!==l){Sp(Pp,1/i,1/l),t.setWorld(Pp,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(Pp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/Ep(c.scaleX);o&&(h(o)?Th.stroke(o,this,t):Th.strokes(o,this,t)),a&&(h(a)?Th.fill(a,this,t):Th.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}te([bp(function(t){const e=t.target;t.list=e?p(e)?e:[e]:[]})],Lp.prototype,"target",void 0);class Cp extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,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 Op={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Ap([t],i,e),i}};function Ap(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&&Ap(s.children,e,i)}}const{findOne:Dp,findByBounds:Mp}=Op;class Ip extends t.Group{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&"normal"===this.app.mode}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Lp,this.targetStroker=new Lp,this.bounds=new At,this.selectArea=new Cp,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(Mp(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)&&!Dp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ja(this.editor.editBox.rect)};return Dp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Dp(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:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[xp.HOVER,this.onHover,this],[xp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Fp,top:Wp,topRight:Up,right:zp,bottomRight:Hp,bottom:Np,bottomLeft:Yp,left:Xp}=t.Direction9,{toPoint:Vp}=lt,{within:Gp,sign:jp}=E,Kp={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:g,dragBounds:_,worldBoxBounds:f}=t,{width:m,height:y}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=jp(v),b=jp(w),E=a?v:x*u.width/m,k=a?w:b*u.height/y;s.x*=a?v:x,s.y*=a?w:b;const S=(-s.y+y)/y,B=(s.x+m)/m,T=(s.y+y)/y,P=(-s.x+m)/m;switch(i){case Wp:c=S,h="bottom";break;case zp:d=B,h="left";break;case Np:c=T,h="top";break;case Xp:d=P,h="right";break;case Fp:c=S,d=P,h="bottom-right";break;case Up:c=S,d=B,h="bottom-left";break;case Hp:c=T,d=B,h="top-left";break;case Yp:c=T,d=P,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case Wp:case Np:t=c;break;case Xp:case zp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const R=1!==d,L=1!==c;if(R&&(d/=E),L&&(c/=k),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(Vp(o||h,u,l,!0),_){const e={x:d,y:c};ll.limitScaleOf(t,l,e),d=e.x,c=e.y}if(R&&p){const e=u.width*t.scaleX;d=Gp(e*d,p)/e}if(L&&g){const e=u.height*t.scaleY;c=Gp(e*c,g)/e}return R&&Math.abs(d*f.width)<1&&(d=jp(d)/f.width),L&&Math.abs(c*f.height)<1&&(c=jp(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 Fp:o="bottom-right";break;case Up:o="bottom-left";break;case Hp:o="top-left";break;case Yp:o="top-right";break;default:o="center"}return Vp(n||o,t.boxBounds,r,!0),{origin:r,rotation:Z.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Wp:case Fp:o={x:.5,y:0},n="bottom",a=1;break;case Np:case Hp:o={x:.5,y:1},n="top",a=1;break;case Xp:case Yp:o={x:0,y:.5},n="right",h=1;break;case zp:case Up: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,Vp(s||n,t,r,!0);const c=Z.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 Xp:t=zp;break;case Fp:t=Up;break;case Yp:t=Hp;break;case zp:t=Xp;break;case Up:t=Fp;break;case Hp:t=Yp}if(i)switch(t){case Wp:t=Np;break;case Fp:t=Yp;break;case Up:t=Hp;break;case Np:t=Wp;break;case Yp:t=Fp;break;case Hp:t=Up}return t}},Zp={};function qp(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:p,rotateable:g,skewable:_}=t.mergeConfig;let f=l.includes("resize");f&&g&&(t.isHoldRotateKey(e)||!p)&&(f=!1);const m=_&&!f&&("resize-line"===i.name||"skew"===l),y=s?n?u:o?d:c:m?u:f?d:c;h+=45*(Kp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(E.formatRotation(h,!0)/2);const{url:v,x:w,y:x}=y,b=v+h;Zp[b]?i.cursor=Zp[b]:Zp[b]=i.cursor={url:$p(v,h),x:w,y:x}}function Jp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function $p(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Qp extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const tg=["top","right","bottom","left"],eg=void 0;class ig extends t.Group{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 h(t)||h(e)||h(i)}constructor(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Qp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,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 Qp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Qp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Qp({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:eg},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}]),Jp(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:l}=this,{middlePoint:c,resizeable:u,rotateable:p,hideOnSmall:g,editBox:_,mask:f,spread:m,hideRotatePoints:y,hideResizeLines:v}=i;if(e.visible=!!f||0,m&&Rt.spread(t,m),this.view.worldOpacity){const{width:e,height:f}=t,m=d(g)?g:10,w=_&&!(g&&e<m&&f<m);let x,b,E,k={};for(let i=0;i<8;i++)lt.toPoint(lt.directionData[i],t,k),b=a[i],x=h[i],b.set(k),x.set(k),b.visible=w&&!(!u&&!p),x.visible=w&&p&&u&&!y,i%2&&(E=l[(i-1)/2],E.set(k),E.visible=b.visible&&!v,b.visible=x.visible=w&&!!c,(i+1)/2%2?(E.width=e,g&&2*b.width>e&&(b.visible=!1)):(E.height=f,g&&2*b.width>f&&(b.visible=!1)));o.visible=w&&p&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||_})),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=tg.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=tg.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Kp.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:eg};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return p(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return p(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),Jp(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),qp(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(),h(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(),h(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),h(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){qp(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(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i;const n=[[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]];"circle"!==e.name&&n.push([t.PointerEvent.ENTER,t=>{this.enterPoint=e,qp(this,t)}]),this.__eventIds.push(e.on_(n))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,()=>Jp(this)],[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[t.MoveEvent.END,this.onMoveEnd,this],[t.ZoomEvent.END,this.resetDoing,this],[t.RotateEvent.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const sg={x:0,y:0,width:1e5,height:1e5};class ng extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,sg),Object.assign(this.__world,sg)}__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 og='\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"/>',rg={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${og}\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${og}\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${og}\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},ag=new At;function hg(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{ag.setListWithFn(i,t=>t.getBounds("box","page")),0===ag.width&&(ag.width=.1),0===ag.height&&(ag.height=.1),e.reset(ag.get())}),s.add(e)}const lg=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),dg=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),cg={group(e,i,s){e.sort(dg);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(lg);const a=new it(i.worldTransform);return a.divideParent(o.scrollWorldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(r)),n.unlockLayout(),r},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(lg),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(dg),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},ug=Wt.get("EditToolCreator");function pg(){return t=>{_g.register(t)}}const gg=pg,_g={list:{},register(t){const{tag:e}=t.prototype;fg[e]&&ug.repeat(e),fg[e]=t},get:(t,e)=>new fg[t](e)},{list:fg}=_g;class mg extends xp{constructor(t,e){super(t,e)}}mg.BEFORE_OPEN="innerEditor.before_open",mg.OPEN="innerEditor.open",mg.BEFORE_CLOSE="innerEditor.before_close",mg.CLOSE="innerEditor.close";class yg extends xp{constructor(t,e){super(t,e)}}yg.BEFORE_GROUP="editor.before_group",yg.GROUP="editor.group",yg.BEFORE_UNGROUP="editor.before_ungroup",yg.UNGROUP="editor.ungroup",yg.BEFORE_OPEN="editor.before_open_group",yg.OPEN="editor.open_group",yg.BEFORE_CLOSE="editor.before_close_group",yg.CLOSE="editor.close_group";const{updateMatrix:vg}=Xo,wg={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},xg="top-left";class bg extends t.Rect{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&&wg[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,vg(this.parent),vg(this);const a=new it(this.__world);switch(r[i]=s,this.__layout.rotationChange(),vg(this),this.changedTransform=new it(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(xg,o);break;case"scaleX":t.scaleOf(xg,o,1);break;case"scaleY":t.scaleOf(xg,1,o);break;case"skewX":t.skewOf(xg,o,0);break;case"skewY":t.skewOf(xg,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Eg extends xp{constructor(t,e){super(t,e)}}Eg.BEFORE_MOVE="editor.before_move",Eg.MOVE="editor.move";class kg extends xp{constructor(t,e){super(t,e)}}kg.BEFORE_SCALE="editor.before_scale",kg.SCALE="editor.scale";class Sg extends xp{constructor(t,e){super(t,e)}}Sg.BEFORE_ROTATE="editor.before_rotate",Sg.ROTATE="editor.rotate";class Bg extends xp{constructor(t,e){super(t,e)}}Bg.BEFORE_SKEW="editor.before_skew",Bg.SKEW="editor.skew";class Tg{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let o,{dragLimitAnimate:r}=s;const a=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,l=h(i.draggable),c=!r||a||l;if(e instanceof t.MoveEvent)o=e.getLocalMove(i),c&&t.DragEvent.limitMove(i,o);else{const s={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),o=t.DragEvent.getValidMove(i,n.point,s,c)}(o.x||o.y)&&(r&&!l&&a?Xo.animateMove(this,o,d(r)?r:.3):this.move(o))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:o}=this.editBox;let{around:r,lockRatio:a,flipable:h,editSize:l}=s;if(e instanceof t.ZoomEvent)this.scaleOf(i.getBoxPoint(e),e.scale,e.scale);else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(a=!0);const s=Kp.getScaleData(i,o.bounds,t,e.getInnerTotal(i),a,Kp.getAround(r,e.altKey),h,!n||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(s.drag=e,this.scaleWithDrag(s)):this.scaleOf(s.origin,s.scaleX,s.scaleY)}}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:o,rotateAround:r,rotateGap:a}=s,{direction:h}=e.current;let l,d;if(e instanceof t.RotateEvent)d=e.rotation,l=r?lt.getPoint(r,i.boxBounds):i.getBoxPoint(e);else{const t=Kp.getRotateData(i,h,e,n,e.shiftKey?null:r||i.around||i.origin||o||"center");d=n.rotation+t.rotation-i.rotation,l=t.origin}d=E.float(E.getGapRotation(d,a,i.rotation),2),d&&this.rotateOf(l,d)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=Kp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Kp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(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(g(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 Eg(Eg.BEFORE_MOVE,h));const l=new Eg(Eg.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 kg(kg.BEFORE_SCALE,t));const o=new kg(kg.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(g(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 kg(kg.BEFORE_SCALE,c));const u=new kg(kg.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 it(Xo.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 kg(kg.BEFORE_SCALE,r));const a=new kg(kg.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(d(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),l={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Sg(Sg.BEFORE_ROTATE,l));const c=new Sg(Sg.ROTATE,l);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(g(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 Bg(Bg.BEFORE_SKEW,c));const u=new Bg(Bg.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(Xo.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new it(e.worldTransform);return t(),new it(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{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 bg(this),this.editBox=new ig(this),this.editToolList={},this.selector=new Ip(this),this.editMask=new ng(this),this.targetEventIds=[];let i=m.clone(rg);t&&(i=m.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&&hg(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(h(s))e=s;else if(!1===s)return}if(_g.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||_g.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(yg.BEFORE_GROUP),this.target=cg.group(this.list,this.element,t),this.emitGroupEvent(yg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(yg.BEFORE_UNGROUP,t)),this.target=cg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(yg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(yg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(yg.OPEN,t)}closeGroup(t){this.emitGroupEvent(yg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(yg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Xo.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 yg(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(h(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(h(i))s=i;else if(!1===i)return}_g.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||_g.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(mg.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(mg.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(mg.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(mg.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new mg(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&&(cg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(cg.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_(wr.SCROLL,this.onChildScroll,this),t.on_(Or.CHILD_START,this.onAppRenderStart,this),t.on_(Ar.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],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())}},te([(t,e)=>{Xn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=this,o=Object.assign({},t);return e&&e.editConfig&&Object.assign(o,e.editConfig),s.config&&Object.assign(o,s.config),i&&(i.editConfig&&Object.assign(o,i.editConfig),"font-size"===o.editSize&&(o.lockRatio=!0),"resize-rotate"===i.pointType&&(o.around||(o.around="center"),a(o.lockRatio)&&(o.lockRatio=!0))),r(o.dragLimitAnimate)&&(o.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=o}})}],t.Editor.prototype,"mergeConfig",void 0),te([bp(function(t,e){t.emitEvent(new xp(xp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),te([bp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ja?i:new Ja(i),t.multiple&&hg(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new xp(xp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new xp(xp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),t.Editor=te([Lo(Tg,["editBox","editTool","emitEvent"])],t.Editor);class Pg{static registerInnerEditor(){_g.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 t.Group,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)}}t.EditTool=class extends Pg{static registerEditTool(){_g.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()}},t.EditTool=te([pg()],t.EditTool);const{left:Rg,right:Lg}=t.Direction9,{move:Cg,copy:Og,toNumberPoints:Ag}=Z;t.LineEditTool=class extends t.EditTool{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===Rg;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=Ag(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?(Cg(t,o,r),s&&Cg(e,-o,-r)):(s&&Cg(t,-o,-r),Cg(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===Rg||t===Lg,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=te([pg()],t.LineEditTool);const{M:Dg,L:Mg,C:Ig,Q:Fg,Z:Wg,N:Ug,D:zg,X:Hg,G:Ng,F:Yg,O:Xg,P:Vg,U:Gg}=me,jg={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Dg:case Mg:Kg(t,e,i,n,1),n+=3;break;case Ig:Kg(t,e,i,n,3),n+=7;break;case Fg:Kg(t,e,i,n,2),n+=5;break;case Wg:n+=1;break;case Ug:Kg(t,e,i,n,2),n+=5;break;case zg:Kg(t,e,i,n,2),n+=9;break;case Hg:Kg(t,e,i,n,2),n+=6;break;case Ng:Kg(t,e,i,n,2),n+=9;break;case Yg:Kg(t,e,i,n,2),n+=5;break;case Xg:t[n]=Ng,t.splice(n+4,0,t[n+3],0),Kg(t,e,i,n,2),n+=9,o+=2;break;case Vg:t[n]=Yg,t.splice(n+4,0,t[n+3]),Kg(t,e,i,n,2),n+=5,o+=1;break;case Gg:Kg(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:Kg}=jg,Zg=W.get(),{topLeft:qg,top:Jg,topRight:$g,right:Qg,bottom:t_,left:e_}=t.Direction9;function i_(t,e,i){t.pathInputed?n_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function s_(t,e,i,s){let n=e;if(!r(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case Jg:case t_:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case e_:case Qg:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case qg:case $g:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:a}=o;a&&(t.padding=p(a)?a.map(t=>t*n):a*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}function n_(t,e,i){jg.scale(t.__.path,e,i),t.path=t.__.path}function o_(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):jg.scalePoints(s,e,i),t.points=s}function r_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Zg.a=e,Zg.d=i,s[t].transform(Zg,!0)}const a_=t.Leaf.prototype;a_.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))},a_.__scaleResize=function(t,e){i_(this,t,e)},a_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},a_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.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)s_(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),i_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){n_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?n_(this,t,e):this.points?o_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?n_(this,t,e):this.points?o_(this,t,e):i_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){r_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||i_(this,t,e),i&&r_(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),Gt.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,qn),t.UI.addAttr("editConfig",void 0,qn),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),qn),t.UI.addAttr("editInner","PathEditor",qn),t.Group.addAttr("editInner","",qn),t.Text.addAttr("editInner","TextEditor",qn),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const h_={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},l_={top:"flex-start",middle:"center",bottom:"flex-end"},d_={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function c_(t,e,i){const{style:s}=t,{fill:n,padding:o,textWrap:a,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";p(e)&&(e=e[0]);if(g(e))switch(e.type){case"solid":i=kh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=kh.string(h(t)?t:t.color);break;default:r(e.r)||(i=kh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,g(d)?(c=d.type,d.color&&(s.textDecorationColor=kh.string(d.color))):c=d,s.textDecoration=d_[c],s.textTransform=h_[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=l_[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===a||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===a?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=p(o)?o.map(t=>t*i+"px").join(" "):(o||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}function u_(e,i,s){p_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{Xo.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function p_(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&m.assign(i,e),m.assign(t.config,i,t.userConfig)}t.TextEditor=class extends Pg{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.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),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}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:p,f:g}=new it(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${p},${g})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||c_(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)}},t.TextEditor=te([gg()],t.TextEditor),Vt.add("text-editor","editor");const g_=Wt.get("LeaferTypeCreator"),__={list:{},register(t,e){f_[t]&&g_.repeat(t),f_[t]=e},run(t,e){const i=f_[t];i&&i(e)}},{list:f_,register:m_}=__;m_("viewport",u_),m_("custom",function(t){u_(t,null,!0)}),m_("design",function(t){u_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),m_("document",function(t){u_(t,{zoom:{min:1},move:{scroll:"limit"}})});const y_={getData(t){const e=t[0],i=t[1],s=Z.getCenter(e.from,i.from),n=Z.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=Z.getDistance(e.from,i.from);return{move:o,scale:Z.getDistance(e.to,i.to)/r,rotation:Z.getRotation(e.from,i.from,e.to,i.to),center:n}}},{abs:v_,max:w_}=Math,{sign:x_,within:b_}=E,E_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=v_(s),r=v_(n);return o>50&&(s=w_(50,o/3)*x_(s)),r>50&&(n=w_(50,r/3)*x_(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=b_(r,0,1);const e=t.deltaY?i.delta.y:i.delta.x,s=b_(1-v_(a)/(4*e)*r,.5,2);n=a>0?s:1/s}return n}};class k_{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),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:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const S_=t.Leafer.prototype,B_=new At,T_=new tt;function P_(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function R_(t,e){return Object.assign(Object.assign({},e),{scale:t})}S_.initType=function(t){__.run(t,this)},S_.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(T_.set(t,e),s){const t=!0===s?"":s;t.includes("x")?T_.y=0:t.includes("y")?T_.x=0:Math.abs(T_.x)>Math.abs(T_.y)?T_.y=0:T_.x=0,i&&t.includes("limit")&&(B_.set(this.__world).addPoint(this.zoomLayer),ll.getValidMove(B_,this.canvas.bounds,"inner",T_,!0),t.includes("x")?T_.y=0:t.includes("y")&&(T_.x=0))}return{x:n?0:T_.x,y:n?0:T_.y}},S_.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 L_=wd.prototype;L_.createTransformer=function(){this.transformer=new k_(this)},L_.move=function(t){this.transformer.move(t)},L_.zoom=function(t){this.transformer.zoom(t)},L_.rotate=function(t){this.transformer.rotate(t)},L_.transformEnd=function(){this.transformer.transformEnd()},L_.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):E_.getScale(t,e);if(1!==o)this.zoom(R_(o,t));else{const s=e.getMove?e.getMove(t,e):E_.getMove(t,e);i.snap&&Z.round(s),this.move(P_(s,t))}},L_.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=y_.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(R_(n,t)),this.move(P_(i,t))};const C_=dd.prototype,{abs:O_}=Math;function A_(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}C_.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=O_(i),o=O_(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?d(a)?a:.95:r)>h?e=h/n:o*e>h&&(e=h/o),t=Object.assign({},t),Z.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},C_.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},C_.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},C_.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=Rt.maxX(r),d=Rt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,Z.move(i,c,u),Z.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},C_.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),_(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,r=this.canvas.bounds.clone().shrink(a(n)?30:n),l=new At,c={x:r.x+r.width/2,y:r.y+r.height/2};let u;const{x:f,y:m,scaleX:y,scaleY:v}=o.__;if(h(t))switch(t){case"in":u=A_(y,"in");break;case"out":u=A_(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new At(this.boxBounds)).height=0;break;case"fit-height":(t=new At(this.boxBounds)).width=0}else d(t)&&(u=t/y);if(u)u=this.getValidScale(u),o.scaleOfWorld(c,u,u,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=p(t);if(n||t.tag){const e=n?t:[t];l.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,r);l.set(o.getWorldBounds(e))}const{width:a,height:h}=l;let d=r.x-l.x,c=r.y-l.y;return i?(d+=Math.max((r.width-a)/2,0),c+=Math.max((r.height-h)/2,0)):(u=this.getValidScale(Math.min(r.width/a,r.height/h)),d+=(r.width-a*u)/2,c+=(r.height-h*u)/2,Z.scaleOf(e,l,u),l.scaleOf(l,u),e.scaleX*=u,e.scaleY*=u),"x"===i?c=0:"y"===i&&(d=0),Z.move(e,d,c),l.move(d,c),o.set(e,s),l}return o.worldBoxBounds};class D_ extends t.Group{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&&m.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;h(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{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 At(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,p=l<1,{scrollXBar:g,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,p?_.width+6:2,u?g.height+6:2,2]);g.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:p})}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:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.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 M_ extends il{setText(t){this._text=t,this.__htmlChanged=!0}}t.HTMLText=class extends t.Image{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)}},te([bo(M_)],t.HTMLText.prototype,"__",void 0),te([io("")],t.HTMLText.prototype,"text",void 0),te([qn("TextEditor")],t.HTMLText.prototype,"editInner",void 0),te([uo(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=te([Co()],t.HTMLText),Vt.add("html");class I_ extends jh{}function F_(t){return jn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,ho(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Bh.register(t,e)}},te([bo(I_)],t.Arrow.prototype,"__",void 0),te([F_("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=te([Co()],t.Arrow);const{M:W_,L:U_,C:z_,Q:H_,O:N_}=me,{rotate:Y_,copyFrom:X_,scale:V_}=Z,G_={},j_={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 W_:case U_:K_(t,l+1,e,i,s,n,o,r),l+=3;break;case z_:for(h=1;h<6;h+=2)K_(t,l+h,e,i,s,n,o,r);l+=7;break;case H_:for(h=1;h<4;h+=2)K_(t,l+h,e,i,s,n,o,r);l+=5;break;case N_: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){j_.layout(t,0,0,1,1,e,i)}};function K_(t,e,i,s,n,o,r,a){X_(G_,t[e],t[e+1]),r&&Y_(G_,r,a),n&&V_(G_,n,o),t[e]=i+G_.x,t[e+1]=s+G_.y}const{layout:Z_,rotate:q_}=j_,{getAngle:J_}=Z,$_={x:-.5},Q_={connect:$_,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},tf={connect:$_,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},ef={connect:$_,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]},sf={connect:$_,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]},nf={offset:$_,path:[...ef.path],dashPath:[1,-2.5,0,2,-1,0]};q_(nf.path,180,{x:-1.5,y:0});const of={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},rf={connect:{x:.5},path:[...of.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},af={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]},hf={path:[...af.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},lf=m.clone(af),df=m.clone(hf);q_(lf.path,45),q_(df.path,45);const cf={angle:Q_,"angle-side":tf,arrow:sf,triangle:ef,"triangle-flip":nf,circle:rf,"circle-line":of,square:hf,"square-line":af,diamond:df,"diamond-line":lf,mark:{offset:$_,path:[1,0,-2,2,0,2]}};function uf(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=cf[e.type]):a=e:a=cf[e];const{offset:c,connect:u,path:p,dashPath:_}=a;let f=u?u.x:0,m=c?c.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&Z_(y,0,0,h,h),m&&Z_(y,m,0),Z_(y,s.x,s.y,n,n,J_(i,s)),o.x=(f+m)*n,y}const{M:pf,L:gf,C:_f,Q:ff,Z:mf,N:yf,D:vf,X:wf,G:xf,F:bf,O:Ef,P:kf,U:Sf}=me,{copy:Bf,copyFrom:Tf,getDistancePoint:Pf}=Z,Rf={},Lf={},Cf={},Of={},Af={},Df={list:cf,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 pf:case gf:(c<2||l+6>=d)&&(Tf(Af,o[l+1],o[l+2]),!c&&u&&Bf(Lf,Af)),l+=3;break;case _f:(1===c||l+7>=d-3)&&Mf(o,Of,Af,l+3),l+=7;break;case ff:(1===c||l+5>=d-3)&&Mf(o,Of,Af,l+1),l+=5;break;case mf:return;case yf:l+=5;break;case vf:l+=9;break;case wf:l+=6;break;case xf:l+=9;break;case bf:l+=5;break;case Ef:l+=7;break;case kf:l+=4;break;case Sf:(1===c||l+6>=d-3)&&(Mf(o,Of,Af,l+1),l+6!==d&&(Af.x-=(Af.x-Of.x)/10,Af.y-=(Af.y-Of.y)/10)),l+=6}if(c++,1===c&&h!==pf)return;if(2===c&&u&&Bf(Cf,h===gf?Af:Of),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=uf(t,e,Cf,Lf,s,Rf,!!n);n?d.push(...i):r.push(...i),Rf.x&&(Pf(Lf,Cf,-Rf.x,!0),r[1]=Cf.x,r[2]=Cf.y)}if(i&&"none"!==i){const e=uf(t,i,Of,Af,s,Rf,!!n);if(n?d.push(...e):r.push(...e),Rf.x){let t;switch(Pf(Af,Of,-Rf.x,!0),h){case gf:t=l-3+1;break;case _f:t=l-7+5;break;case ff:t=l-5+3;break;case Sf:t=l-6+3}t&&If(r,Of,t)}}}else Bf(Of,Af)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Mf(t,e,i,s){Tf(e,t[s],t[s+1]),Tf(i,t[s+2],t[s+3])}function If(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),t.UI.addAttr("startArrow","none",F_),t.UI.addAttr("endArrow","none",F_),Object.assign(Bh,Df),Object.assign(Th,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});t.Flow=class extends t.Box{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}},te([bo(class extends Xh{})],t.Flow.prototype,"__",void 0),te([Qn("x")],t.Flow.prototype,"flow",void 0),t.Flow=te([Co()],t.Flow);const Ff={},Wf={"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"},Uf={"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 zf(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;ut.toPoint(i,e,n,Ff),e.x=s.__autoWidth?n.x:Ff.x,e.y=s.__autoHeight?n.y:Ff.y}const{move:Hf}=Z;function Nf(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)),Hf(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Yf(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 Xf={};function Vf(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,a=n&&(e?!o:!r);return g(i)?(Xf.xGap=i.x||0,Xf.yGap=i.y||0):Xf.xGap=Xf.yGap=u(i),Xf.isAutoXGap=h(Xf.xGap)&&!o,Xf.isAutoYGap=h(Xf.yGap)&&!r,Xf.complex=a||"top-left"!==s||t.__hasGrow||Xf.isAutoXGap||Xf.isAutoYGap,Xf.wrap=a,Xf.complex&&(Xf.isFitXGap="fit"===Xf.xGap&&!o,Xf.isFitYGap="fit"===Xf.yGap&&!r,g(s)?(Xf.contentAlign=s.content||"top-left",Xf.rowXAlign=s.x||"from",Xf.rowYAlign=s.y||"from"):(Xf.contentAlign=s,Xf.rowXAlign=Wf[s],Xf.rowYAlign=Uf[s])),Xf}function Gf(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function jf(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 Kf(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Zf}=E;function qf(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=Jf(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=Jf(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Jf(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Zf(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:$f}=E;function Qf(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=tm(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=tm(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function tm(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?$f(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:em}=Z;function im(t,e){const i="width",{children:s,itemBox:n}=t,o=Vf(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:[]},p=d?0:h;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=Kf(g,n),r?(g.__flowBounds=_,y||(y=Gf(m,p)),a&&y.count&&y.width+_.width>x&&(y.grow?qf(t,y,x,e):d&&jf(y,i,x,c),Yf(u,y,i),y=Gf(m,p)),f=_.width,g.__widthGrow&&(y.grow+=g.__widthGrow,f=0,g.__.widthRange&&(y.hasRangeSize=!0)),g.__heightGrow&&tm(g,_,b),y.width+=y.count?f+p:f,y.height=Math.max(y.height,_.height),y.count++):(em(g,v-_.x,w-_.y),v+=_.width+p));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:p}=o;y.count&&(y.grow?qf(t,y,x,e):d&&jf(y,i,x,c),a&&Yf(u,y,i)),a?(s?jf(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){zf(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Wf[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],Nf(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):(zf(t,y,r),Nf(t,y,0,y.y,p,e))}}const{move:sm}=Z;function nm(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)),sm(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:om}=Z;function rm(t,e){const i="height",{children:s,itemBox:n}=t,o=Vf(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:[]},p=d?0:l;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=Kf(g,n),r?(g.__flowBounds=_,y||(y=Gf(m,p)),a&&y.count&&y.height+_.height>b&&(y.grow&&Qf(t,y,b,e),d&&jf(y,i,b,c),Yf(u,y,i),y=Gf(m,p)),f=_.height,g.__heightGrow&&(y.grow+=g.__heightGrow,f=0,g.__.heightRange&&(y.hasRangeSize=!0)),g.__widthGrow&&Jf(g,_,x),y.height+=y.count?f+p:f,y.width=Math.max(y.width,_.width),y.count++):(om(g,v-_.x,w-_.y),w+=_.height+p));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:p}=o;y.count&&(y.grow&&Qf(t,y,b,e),d&&jf(y,i,b,c),a&&Yf(u,y,i)),a?(s?jf(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){zf(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Uf[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,p),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],nm(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(zf(t,y,r),nm(t,y,y.x,0,l,e))}}function am(t){return jn(t,t=>({set(e){const i=d(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)&&no(this)}}))}Vt.add("flow","resize");const hm=t.Box.prototype,{__updateBoxBounds:lm}=t.Group.prototype;t.UI.addAttr("flow",!1,Qn),t.UI.addAttr("gap",0,io),t.UI.addAttr("flowAlign","top-left",io),t.UI.addAttr("flowWrap",!1,io),t.UI.addAttr("itemBox","box",io),t.UI.addAttr("inFlow",!0,io),t.UI.addAttr("autoWidth",void 0,am),t.UI.addAttr("autoHeight",void 0,am),t.UI.addAttr("autoBox",void 0,io);const{copyAndSpread:dm}=Rt;hm.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:im(this);break;case"y":rm(this);break;case"x-reverse":im(this,!0);break;case"y-reverse":rm(this,!0)}t&&(this.leafer.created=!0)},hm.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),dm(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},hm.__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():lm.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&&dm(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:cm,sin:um,pow:pm,sqrt:gm,abs:_m,ceil:fm,floor:mm,round:ym,PI:vm}=Math,wm=5*vm,xm=1.70158,bm=2.5949095,Em=7.5625,km=2.75;function Sm(t){return e=>pm(e,t)}function Bm(t){return e=>1-pm(1-e,t)}function Tm(t){return e=>e<.5?.5*pm(2*e,t):1-.5*pm(2-2*e,t)}function Pm(t){return t<1/km?Em*t*t:t<2/km?Em*(t-=1.5/km)*t+.75:t<2.5/km?Em*(t-=2.25/km)*t+.9375:Em*(t-=2.625/km)*t+.984375}function Rm(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=Lm(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(_m(l)<1e-6));e++)c-=d/l;return n[r]=Lm(c,e,s)}}function Lm(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Cm={get(t){const{list:e}=Cm;return h(t)?e[t||"ease"]:g(t)?e[t.name].apply(e,p(t.value)?t.value:[t.value]):e.ease},register(t,e){Cm.list[t]=e},list:{linear:t=>t,ease:Rm(.25,.1,.25,1),"ease-in":Rm(.42,0,1,1),"ease-out":Rm(0,0,.58,1),"ease-in-out":Rm(.42,0,.58,1),"sine-in":t=>1-cm(t*vm*.5),"sine-out":t=>um(t*vm*.5),"sine-in-out":t=>.5*(1-cm(t*vm)),"quad-in":Sm(2),"quad-out":Bm(2),"quad-in-out":Tm(2),"cubic-in":Sm(3),"cubic-out":Bm(3),"cubic-in-out":Tm(3),"quart-in":Sm(4),"quart-out":Bm(4),"quart-in-out":Tm(4),"quint-in":Sm(5),"quint-out":Bm(5),"quint-in-out":Tm(5),"expo-in":t=>t?pm(2,10*t-10):0,"expo-out":t=>1===t?1:1-pm(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*pm(2,2*t*10-10):.5*(2-pm(2,10-2*t*10)),"circ-in":t=>1-gm(1-pm(t,2)),"circ-out":t=>gm(1-pm(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-gm(1-pm(2*t,2))):.5*(gm(1-pm(2-2*t,2))+1),"back-in":t=>((xm+1)*t-xm)*t*t,"back-out":t=>(t-=1)*t*((xm+1)*t+xm)+1,"back-in-out":t=>t<.5?(t*=2)*t*((bm+1)*t-bm)*.5:.5*((t=2*t-2)*t*((bm+1)*t+bm)+2),"elastic-in":t=>0===t||1===t?t:-pm(2,10*(t-1))*um((t-1.1)*wm),"elastic-out":t=>0===t||1===t?t:pm(2,-10*t)*um((t-.1)*wm)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-pm(2,10*((t*=2)-1))*um((t-1.1)*wm)*.5:pm(2,10*(1-(t*=2)))*um((t-1.1)*wm)*.5+1,"bounce-in":t=>1-Pm(1-t),"bounce-out":Pm,"bounce-in-out":t=>t<.5?.5*(1-Pm(1-2*t)):.5*(1+Pm(2*t-1)),"cubic-bezier":Rm,steps:function(t,e="floor"){return i=>("floor"===e?mm(i*t):"ceil"===e?fm(i*t):ym(i*t))/t}}};function Om(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 Am{}Am.CREATED="created",Am.PLAY="play",Am.PAUSE="pause",Am.STOP="stop",Am.SEEK="seek",Am.UPDATE="update",Am.COMPLETED="completed";t.Animate=class extends zr{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&&d(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=p(e)?e:e?[e]:[];const{easing:n,attrs:o}=this;this.easingFn=Cm.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(Am.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Am.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Am.STOP))}seek(t){this.destroyed||(g(t)&&(t=Sh.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(Am.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,o=!(n>1)||this.join;let a,h,l,c,u,p=0,g=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=o?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(l.swing=d(o)?o:2,u=2*l.swing-1),r&&(l.loop=u=d(r)?r:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,g+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,g+=s*u),n&&(l.easingFn=Cm.get(n))}if(!l.autoDuration&&r(l.duration)&&(n>1?s>0||o?g+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}g?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*g),this.allocateTime((this.duration-p)/g)):p&&this.changeDuration(p),this.emitType(Am.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:o}=this;for(let a in e)r(s[a])&&(s[a]=n[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=r(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],r(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(),e.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(Am.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={}),Dh.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(Am.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 d(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)}},te([Om("ease")],t.Animate.prototype,"easing",void 0),te([Om(0)],t.Animate.prototype,"delay",void 0),te([Om(.2)],t.Animate.prototype,"duration",void 0),te([Om("auto")],t.Animate.prototype,"ending",void 0),te([Om(!1)],t.Animate.prototype,"reverse",void 0),te([Om(!1)],t.Animate.prototype,"swing",void 0),te([Om(!1)],t.Animate.prototype,"loop",void 0),te([Om(0)],t.Animate.prototype,"loopDelay",void 0),te([Om(1)],t.Animate.prototype,"speed",void 0),te([Om(!0)],t.Animate.prototype,"autoplay",void 0),te([Om()],t.Animate.prototype,"join",void 0),te([Om()],t.Animate.prototype,"attrs",void 0),t.Animate=te([Lo(Jr)],t.Animate),t.AnimateList=class extends t.Animate{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(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(Am.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Am.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Am.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Am.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Am.COMPLETED:this.completed&&this.emitType(t);break;case Am.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)}},t.AnimateList=te([Lo(Jr)],t.AnimateList);const Dm={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"},Mm=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Im=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Fm=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Wm=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Um=parseInt,zm=parseFloat,{round:Hm}=Math;let Nm={},Ym=0;function Xm(t){let e,i,s,n=1;switch(t.length){case 9:e=Um(t.slice(1,3),16),i=Um(t.slice(3,5),16),s=Um(t.slice(5,7),16),n=Um(t.slice(7,9),16)/255;break;case 7:e=Um(t.slice(1,3),16),i=Um(t.slice(3,5),16),s=Um(t.slice(5,7),16);break;case 5:e=Um(t[1]+t[1],16),i=Um(t[2]+t[2],16),s=Um(t[3]+t[3],16),n=Um(t[4]+t[4],16)/255;break;case 4:e=Um(t[1]+t[1],16),i=Um(t[2]+t[2],16),s=Um(t[3]+t[3],16);break;case 3:e=i=s=Um(t[1]+t[2],16);break;case 2:e=i=s=Um(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const Vm=1/6,Gm=.5,jm=2/3,Km=1/3;function Zm(t,e,i){return i<0?i++:i>1&&i--,i<Vm?t+6*(e-t)*i:i<Gm?e:i<jm?t+(e-t)*(jm-i)*6:t}function qm(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=Zm(a,s,t+Km),o=Zm(a,s,t),r=Zm(a,s,t-Km)}return{r:Hm(255*n),g:Hm(255*o),b:Hm(255*r),a:s}}Vt.add("color"),kh.object=function(t,e){let i,s=!r(e)&&e<1;if(h(t)){const e=Nm[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Xm(t);break;case"R":case"r":"("===t[4]&&Im.test(t)?i=function(t){const e=Im.exec(t);return{r:Um(e[1]),g:Um(e[2]),b:Um(e[3]),a:zm(e[4])}}(t):"("===t[3]&&Mm.test(t)&&(i=function(t){const e=Mm.exec(t);return{r:Um(e[1]),g:Um(e[2]),b:Um(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Wm.test(t)?i=function(t){const e=Wm.exec(t);return qm(zm(e[1]),zm(e[2]),zm(e[3]),zm(e[4]))}(t):"("===t[3]&&Fm.test(t)&&(i=function(t){const e=Fm.exec(t);return qm(zm(e[1]),zm(e[2]),zm(e[3]),1)}(t))}if(!i){const e=Dm[t.toLowerCase()];e&&(i=Xm("#"+e))}i&&(Ym++,Ym>1e4&&(Nm={},Ym=0),Nm[t]=Object.assign({},i))}}else g(t)&&(r(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:Jm}=Math,{fourNumber:$m}=E,Qm={fill:ny,stroke:ny,cornerRadius:(t,e,i)=>d(t)&&d(e)?iy(t,e,i):(t=$m(t),e=$m(e),t.map((t,s)=>iy(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,o=iy(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return d(t)||d(e)?E.float(iy(t,e,i),Math.max(ey(t),ey(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Dh.setBetweenStyle(n,t,e,n,i,s),n},shadow:oy,innerShadow:oy},ty={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?iy(t,e,i):t},number:iy,color:sy,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=Dh;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 ey(t){const e=String(t).split(".")[1];return e?e.length:0}function iy(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Jm(n):n}function sy(t,e,i){t=kh.object(t),e=kh.object(e);const s=iy(t.r,e.r,i,1)+","+iy(t.g,e.g,i,1)+","+iy(t.b,e.b,i,1),n=iy(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function ny(t,e,i){return h(t)&&h(e)?sy(t,e,i):e}function oy(t,e,i){return p(t)||p(e)?e:(e=e||{},{x:iy((t=t||{}).x,e.x,i),y:iy(t.y,e.y,i),blur:iy(t.blur,e.blur,i),spread:iy(t.spread,e.spread,i),color:sy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),Ah.canAnimate=!0,Object.assign(Dh.list,Qm),Object.assign(Dh,ty);const ry=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return jn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,qn),t.UI.addAttr("transition",!0,qn),t.UI.addAttr("transitionOut",void 0,qn),ry.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))},ry.animate=function(e,i,s,n){if(r(e))return this.__animate;let o=p(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,o.toStyle);const a=this.__animate;return a&&(o instanceof t.AnimateList?o.list.unshift(a):o=new t.AnimateList(this,[a,o])),this.__animate=o},ry.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},ry.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Am.COMPLETED,e)};const ay=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],hy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:ly}=Math,{getDerivative:dy}=Xe,cy={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<ay.length;h++)l=f*(1+ay[h]),d=f*(1-ay[h]),c=dy(l,t,i,n,r),u=dy(l,e,s,o,a),p=dy(d,t,i,n,r),g=dy(d,e,s,o,a),_+=hy[h]*(ly(c*c+u*u)+ly(p*p+g*g));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=dy(t,e,s,o,a),d=dy(t,i,n,r,h);return Math.atan2(d,l)/S},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,p=t/e,g=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>g;)uy(i,s,n,o,r,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},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,p=d*n+e*r,g=d*o+e*a,_=d*c+e*p,f=d*u+e*g,m=d*_+e*(d*p+e*(d*r+e*h)),y=d*f+e*(d*g+e*(d*a+e*l));t.push(me.C,c,u,_,f,m,y)}},{getDistance:uy}=cy,{M:py,L:gy,C:_y,Z:fy}=me,my={},yy={},vy={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case py:case gy:vy.transformPoints(t,e,s,1),s+=3;break;case _y:vy.transformPoints(t,e,s,3),s+=7;break;case fy:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)my.x=t[n],my.y=t[n+1],W.toOuterPoint(e,my),t[n]=my.x,t[n+1]=my.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 py:case gy:i=t[a+1],s=t[a+2],e=n===gy&&a>0?Z.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case _y:i=t[a+5],s=t[a+6],e=cy.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 fy: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=Sh.number(e,t.total);let o,r,a,h,l,d,c,u,p,g=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case py:case gy:if(r=n[f+1],a=n[f+2],o=s[m],g+o>=e||!t.total)return f||(y=r,v=a),yy.x=y,yy.y=v,_.x=r,_.y=a,Z.getDistancePoint(yy,_,e-g,!0),_.rotation=Z.getAngle(yy,_),_;y=r,v=a,f+=3;break;case _y:if(r=n[f+5],a=n[f+6],o=s[m],g+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=cy.getT(e-g,o,y,v,l,d,c,u,r,a,i),Xe.getPointAndSet(p,y,v,l,d,c,u,r,a,_),_.rotation=cy.getRotation(p,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case fy:f+=1;default:o=0}m++,g+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Sh.number(e,t.total);let r,a,h,l,d,c,u,p,g,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case py:case gy:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),yy.x=v,yy.y=w,f.x=a,f.y=h,Z.getDistancePoint(yy,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case _y:if(d=n[m+1],c=n[m+2],u=n[m+3],p=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return g=cy.getT(e-_,r,v,w,d,c,u,p,a,h,i),cy.cut(o,g,v,w,d,c,u,p,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,p,a,h);break;case fy:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function wy(t){return jn(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Dh.register("motion",function(t,e,i,s){return g(t)&&(t=Sh.number(t,s.getMotionTotal())),g(e)&&(e=Sh.number(e,s.getMotionTotal())),Dh.number(t||0,e||0,i)}),Dh.register("motionRotation",function(t,e,i){return Dh.number(t,e,i)});const xy=t.UI.prototype,{updateMatrix:by,updateAllMatrix:Ey}=Xo,{updateBounds:ky}=ir;function Sy(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Ty(t);i.total&&(t.__.__pathForRender=vy.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Ey(t),ky(t,t)):by(t));i&&(t.leafer.created=!0)}}function By(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 Ty(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=vy.getMotionPathData(t.getPath(!0,!0))}function Py(t,e){return jn(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Ah.setStyleName(this,e,i):Ah.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Ry(t){return jn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Ly(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 Cy(t,e){g(e)||(e=void 0),Dy(t,e,"in")}function Oy(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),Dy(t,e,"out"))}t.UI.addAttr("motionPath",void 0,wy),t.UI.addAttr("motionPrecision",1,wy),t.UI.addAttr("motion",void 0,wy),t.UI.addAttr("motionRotation",!0,wy),xy.getMotionPathData=function(){return Ty(By(this))},xy.getMotionPoint=function(t){const e=By(this),i=Ty(e);if(!i.total)return{};const s=vy.getDistancePoint(i,t,e.motionPrecision);W.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:d(n)&&(s.rotation+=n),s},xy.getMotionTotal=function(){return this.getMotionPathData().total},xy.__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],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Sy(t))}else Sy(this)};const Ay={};function Dy(t,e,i){const{normalStyle:s}=t;e||(e=Ay),e.scale&&(E.assignScale(e,e.scale),delete e.scale),e!==Ay&&Ah.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=Fy(e,t),s=t.animate();s&&Fy(i,t,s.fromStyle);return i}(t,e):void 0;Ah.canAnimate&&My(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const r=My(t);if(r){const{animation:s}=r;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(r,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete r.animation}t.normalStyle=Iy(r,t),t.set(r,"temp")}else t.normalStyle=void 0;if(n){const e=Iy(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function My(t){let e;const i={},s=Ly(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Ah.isState(n,t,s)&&(e=Wy(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Ah.isSelected(t,s)&&(e=Wy(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Ah.isPlacehold(t,s)&&(e=Wy(i,a)),Ah.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Wy(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Ah.isFocus(t,s)&&(e=Wy(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Ah.isHover(t,s)&&(e=Wy(i,o));const r=i.pressStyle||t.pressStyle;r&&Ah.isPress(t,s)&&(e=Wy(i,r))}return e?i:void 0}function Iy(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Ah.animateExcludes[t]||(n[t]=e[t]);return n}function Fy(t,e,i){return Iy(t,e,i,!0)}function Wy(t,e){return Object.assign(t,e),!0}function Uy(t,e){const i=t[e];i&&Cy(t,i),t.button&&Hy(t.children,e)}function zy(t,e,i){i||(i=t.states[e]),Cy(t,i),t.button&&Hy(t.children,null,e)}function Hy(t,e,i){if(!t)return;let s,n;for(let o=0,a=t.length;o<a;o++){if(s=t[o],e){switch(n=!0,e){case"hoverStyle":Ah.isHover(s)&&(n=!1);break;case"pressStyle":Ah.isPress(s)&&(n=!1);break;case"focusStyle":Ah.isFocus(s)&&(n=!1)}n&&Uy(s,e)}else r(i)||zy(s,i);s.isBranch&&Hy(s.children,e,i)}}function Ny(t,e){const i=t[e];i&&Oy(t,i),t.button&&Xy(t.children,e)}function Yy(t,e,i){Oy(t,i),t.button&&Xy(t.children,null,e)}function Xy(t,e,i){if(!t)return;let s;for(let n=0,o=t.length;n<o;n++)s=t[n],e?Ny(s,e):r(i)||Yy(s,i),s.isBranch&&Xy(s.children,e,i)}function Vy(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=Ly(e,i);o&&(s=n[t](o))}return s}function Gy(t,e,i){let s=e[t];if(!s&&i){const n=Ly(e,i);n&&(s=n[t])}return s}Vt.add("state"),Ah.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},Ah.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Ly(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Ah.isSelected=function(t,e){return Gy("selected",t,e)},Ah.isDisabled=function(t,e){return Gy("disabled",t,e)},Ah.isFocus=function(t,e){return Vy("isFocus",t,e)},Ah.isHover=function(t,e){return Vy("isHover",t,e)},Ah.isPress=function(t,e){return Vy("isPress",t,e)},Ah.isPlacehold=function(t,e){return t.__.__isPlacehold},Ah.isDrag=function(t,e){return Vy("isDrag",t,e)},Ah.setStyleName=function(t,e,i){i?zy(t,e,t[e]):Yy(t,e,t[e])},Ah.set=function(t,e){const i=t.states[e];i?zy(t,e,i):Yy(t,e,i)},Ah.getStyle=My,Ah.updateStyle=Dy,Ah.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Uy(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Ny(e,"hoverStyle");break;case t.PointerEvent.DOWN:Uy(e,"pressStyle");break;case t.PointerEvent.UP:Ny(e,"pressStyle")}};const jy=t.UI.prototype;t.UI.addAttr("selected",!1,Py,"selectedStyle"),t.UI.addAttr("disabled",!1,Py,"disabledStyle"),t.UI.addAttr("states",{},Ry),t.UI.addAttr("state","",Py),t.UI.addAttr("normalStyle",void 0,qn),t.UI.addAttr("hoverStyle",void 0,Ry),t.UI.addAttr("pressStyle",void 0,Ry),t.UI.addAttr("focusStyle",void 0,Ry),t.UI.addAttr("selectedStyle",void 0,Ry),t.UI.addAttr("disabledStyle",void 0,Ry),t.UI.addAttr("placeholderStyle",void 0,Ry),t.UI.addAttr("button",!1,qn),jy.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?Uy(this,"focusStyle"):Ny(this,"focusStyle")})},jy.updateState=function(){Ah.updateStyle(this,void 0,"in")};const Ky=t.Text.prototype,Zy="text";Xn(Ky,Zy,Object.assign(Object.assign({},Vn(Ky,Zy)),{set(t){const e=this,i=e.text;e.__setAttr(Zy,t)&&(no(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class qy extends Hh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}t.Robot=class extends t.UI{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;p(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),!r(t))if(d(t))this.now=t;else if(g(t)){const e=p(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&&(d(o)?{width:o,height:o}:o)||(r>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=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),r(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()}},te([bo(qy)],t.Robot.prototype,"__",void 0),te([io()],t.Robot.prototype,"robot",void 0),te([qn()],t.Robot.prototype,"actions",void 0),te([qn("")],t.Robot.prototype,"action",void 0),te([uo(0)],t.Robot.prototype,"now",void 0),te([qn(12)],t.Robot.prototype,"FPS",void 0),te([qn(!0)],t.Robot.prototype,"loop",void 0),t.Robot=te([Co()],t.Robot),Vt.add("robot");const{Yes:Jy,NoAndSkip:$y,YesAndSkip:Qy}=t.Answer,tv={},ev={},iv={};class sv{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"#":tv.id=t.substring(1),t=tv;break;case".":ev.className=t.substring(1),t=ev;break;default:iv.tag=t,t=iv}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,n=p(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?m.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&&Xo.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===Jy||o===Qy){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<$y&&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_(yr.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 nv=t.UI.prototype;function ov(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Gt.selector())}nv.find=function(t,e){return ov(this).getBy(t,this,!1,e)},nv.findOne=function(t,e){return ov(this).getBy(t,this,!0,e)},Vt.add("find"),Gt.finder=function(t){return new sv(t)};const{setPoint:rv,addPoint:av,toBounds:hv}=nt;const lv={syncExport(t,i,s){let n;Oh.running=!0;try{const o=Rn.fileType(i),a=i.includes(".");s=Rn.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===o)a&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!a||t.toJSON(s.json)};else if("svg"===o)a&&l(h(t.toSVG(),"svg"),i),n={data:!!a||t.toSVG()};else{let e,o,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:g,trim:_,screenshot:f,padding:m,onCanvas:y}=s,v=r(s.smooth)?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&r(s.fill)?t.fill:s.fill,b=Rn.isOpaqueImage(i)||x,k=new it;if(f)e=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||t;default:k.set(l).divide(t.getTransform(i));const e=i.worldTransform;a/=a/e.scaleX,h/=h/e.scaleY}e=t.getBounds("render",i)}const S={scaleX:1,scaleY:1};E.getScaleData(s.scale,s.size,e,S);let B=s.pixelRatio||1,{x:T,y:P,width:R,height:L}=new At(e).scale(S.scaleX,S.scaleY);g&&(T+=g.x,P+=g.y,R=g.width,L=g.height);const C={exporting:!0,matrix:k.scale(1/S.scaleX,1/S.scaleY).invert().translate(-T,-P).withScale(1/a*S.scaleX,1/h*S.scaleY)};let O,A=Gt.canvas({width:Math.floor(R),height:Math.floor(L),pixelRatio:B,smooth:v,contextSettings:w});if(p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=A.bounds),A.save(),u&&!r(x)){const e=t.get("fill");t.fill="",t.__render(A,C),t.fill=e}else t.__render(A,C);if(A.restore(),O&&O.__updateWorldOpacity(),_){o=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?av(r,n,o):rv(r={},n,o)),a++;const h=new At;return r&&(hv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=Gt.canvas(s),A.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=E.fourNumber(m),n=A,{width:o,height:r}=n;A=Gt.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()}b&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),y&&y(A);n={data:"canvas"===i?A:A.export(i,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:e,trimBounds:o};const D=c&&c.app;D&&D.canvasManager&&D.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return Oh.running=!1,n},export(t,i,s){return Oh.running=!0,function(t){dv||(dv=new An);return new Promise(e=>{dv.add(()=>ee(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>ee(this,void 0,void 0,function*(){if(!Mn.isComplete)return e.requestRender(r);const a=Oh.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()});t.updateLayout(),cv(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))}};let dv;function cv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>cv(t))}const uv=ge.prototype,pv=Wt.get("@leafer-in/export");return uv.export=function(t,e){const{quality:i,blob:s}=Rn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},uv.toBlob=function(t,i){return new Promise(s=>{e.origin.canvasToBolb(this.view,t,i).then(t=>{s(t)}).catch(t=>{pv.error(t),s(null)})})},uv.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},uv.saveAs=function(t,i){return new Promise(s=>{e.origin.canvasSaveAs(this.view,t,i).then(()=>{s(!0)}).catch(t=>{pv.error(t),s(!1)})})},Vt.add("export"),Object.assign(Oh,lv),t.UI.prototype.export=function(t,e){return Oh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Oh.syncExport(this,t,e)},Vt.add("filter"),Object.assign(Ch,{list:{},register(t,e){Ch.list[t]=e},apply(t,e,i,s,n,o){let r;t.forEach(t=>{r=Ch.list[t.type],r&&r.apply(t,e,i,s,n,o)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Ch.list[t.type],e&&(i+=e.getSpread(t))}),i}}),t.AlignHelper=ut,t.AnimateEasing=Cm,t.AnimateEvent=Am,t.AroundHelper=lt,t.ArrowData=I_,t.AutoBounds=Mt,t.BezierHelper=Xe,t.Bounds=At,t.BoundsEvent=Er,t.BoundsHelper=Rt,t.BoxData=Xh,t.BranchHelper=ir,t.BranchRender=ma,t.CanvasData=sl,t.CanvasManager=Qt,t.ChildEvent=yr,t.ColorConvert=kh,t.Creator=Gt,t.Cursor=xd,t.DataHelper=m,t.Debug=Wt,t.DragBoundsHelper=ll,t.Dragger=dd,t.EditBox=ig,t.EditDataHelper=Kp,t.EditPoint=Qp,t.EditSelect=Ip,t.EditSelectHelper=Op,t.EditToolCreator=_g,t.EditorEvent=xp,t.EditorGroupEvent=yg,t.EditorHelper=cg,t.EditorMoveEvent=Eg,t.EditorRotateEvent=Sg,t.EditorScaleEvent=kg,t.EditorSkewEvent=Bg,t.Effect=Lh,t.EllipseData=Zh,t.EllipseHelper=Qe,t.Event=mr,t.EventCreator=Jt,t.Eventer=zr,t.Export=Oh,t.FileHelper=Rn,t.Filter=Ch,t.Finder=sv,t.FrameData=Gh,t.GroupData=Yh,t.HTMLTextData=M_,t.HighBezierHelper=cy,t.HighCurveHelper=vy,t.HitCanvasManager=bd,t.ImageData=il,t.ImageEvent=br,t.ImageManager=Fn,t.IncrementId=i,t.InnerEditor=Pg,t.InnerEditorEvent=mg,t.InteractionBase=wd,t.InteractionHelper=nd,t.Keyboard=$l,t.LayoutEvent=Cr,t.Layouter=gh,t.LeafBounds=ga,t.LeafBoundsHelper=$o,t.LeafData=v,t.LeafDataProxy=Qr,t.LeafEventer=Jr,t.LeafHelper=Xo,t.LeafLayout=fr,t.LeafLevelList=$a,t.LeafList=Ja,t.LeafMatrix=ra,t.LeafRender=_a,t.LeaferCanvas=Qa,t.LeaferCanvasBase=ge,t.LeaferData=Vh,t.LeaferEvent=Ar,t.LeaferImage=Yn,t.LeaferTypeCreator=__,t.LineData=jh,t.MathHelper=E,t.Matrix=it,t.MatrixHelper=W,t.MultiTouchHelper=y_,t.MyDragEvent=sd,t.MyImage=Gl,t.MyPointerEvent=ed,t.NeedConvertToCanvasCommandMap=ve,t.OneRadian=S,t.PI2=B,t.PI_2=T,t.Paint=Th,t.PaintGradient=Rh,t.PaintImage=Ph,t.PathArrow=Bh,t.PathArrowModule=Df,t.PathBounds=mn,t.PathCommandDataHelper=rs,t.PathCommandMap=me,t.PathConvert=Fi,t.PathCorner=kn,t.PathCreator=Es,t.PathData=$h,t.PathDrawer=Ws,t.PathHelper=_e,t.PathMatrixHelper=j_,t.PathNumberCommandLengthMap=Ee,t.PathNumberCommandMap=be,t.PathScaler=jg,t.PenData=Qh,t.Picker=yh,t.Platform=e,t.Plugin=Vt,t.Point=tt,t.PointHelper=Z,t.PointerButton=Ql,t.PolygonData=qh,t.PropertyEvent=wr,t.RectData=Kh,t.RectHelper=ke,t.RectRender=gl,t.RenderEvent=Or,t.Renderer=fh,t.ResizeEvent=Rr,t.Resource=Mn,t.RobotData=qy,t.Run=Nt,t.ScrollBar=D_,t.SelectArea=Cp,t.Selector=vh,t.StarData=Jh,t.State=Ah,t.StringNumberMap=It,t.Stroker=Lp,t.TaskItem=On,t.TaskProcessor=An,t.TextConvert=Eh,t.TextData=el,t.TransformTool=Tg,t.Transformer=k_,t.Transition=Dh,t.TwoPointBoundsHelper=nt,t.UIBounds=nl,t.UICreator=Kt,t.UIData=Hh,t.UIEvent=td,t.UIRender=ul,t.UnitConvert=Sh,t.WaitHelper=rr,t.WatchEvent=Lr,t.Watcher=sh,t.WheelEventHelper=E_,t.addViewport=u_,t.addViewportConfig=p_,t.affectRenderBoundsType=co,t.affectStrokeBoundsType=ao,t.arrowType=F_,t.attr=Kn,t.autoLayoutType=Qn,t.boundsType=io,t.canvasPatch=Pn,t.canvasSizeAttrs=pe,t.createAttr=function(t){return(e,i)=>{Xn(e,i,Gn(i,t))}},t.createDescriptor=Gn,t.cursorType=xo,t.dataProcessor=bo,t.dataType=qn,t.decorateLeafAttr=jn,t.defineDataProcessor=Eo,t.defineKey=Xn,t.defineLeafAttr=Zn,t.doBoundsType=no,t.doStrokeType=ho,t.effectType=wh,t.emptyData=o,t.eraserType=vo,t.extraPropertyEventMap=xr,t.getBoundsData=R,t.getDescriptor=Vn,t.getMatrixData=L,t.getPointData=P,t.hitType=wo,t.isArray=p,t.isData=_,t.isEmptyData=f,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=g,t.isString=h,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{Xn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Wr,t.maskType=yo,t.motionPathType=wy,t.naturalBoundsType=so,t.opacityType=po,t.path=Sn,t.pathInputType=oo,t.pathType=ro,t.pen=Bn,t.positionType=Jn,t.registerEditTool=pg,t.registerInnerEditor=gg,t.registerUI=Co,t.registerUIEvent=Oo,t.resizeType=xh,t.rewrite=To,t.rewriteAble=Po,t.rotationType=eo,t.scaleResize=i_,t.scaleResizeFontSize=s_,t.scaleResizeGroup=r_,t.scaleResizePath=n_,t.scaleResizePoints=o_,t.scaleType=to,t.scrollType=$n,t.sortType=mo,t.stateStyleType=Ry,t.stateType=Py,t.strokeType=lo,t.surfaceType=uo,t.tempBounds=Dt,t.tempMatrix=st,t.tempPoint=et,t.tryToNumber=u,t.useCanvas=eh,t.useModule=Lo,t.version="1.9.6",t.visibleType=go,t.zoomLayerType=bh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
1
+ var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i;var n;t.Answer=void 0,(n=t.Answer||(t.Answer={}))[n.No=0]="No",n[n.Yes=1]="Yes",n[n.NoAndSkip=2]="NoAndSkip",n[n.YesAndSkip=3]="YesAndSkip";const o={};function r(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;function u(t){return"string"==typeof t&&c.test(t)?+t:t}const{isArray:p}=Array;function g(t){return t&&"object"==typeof t}function _(t){return g(t)&&!p(t)}function f(t){return"{}"===JSON.stringify(t)}const m={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=>{r(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=m;class v{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=r(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!r(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!r(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(p(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!r(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=r(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:o,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:o,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:w,pow:x,PI:b}=Math,E={within:(t,e,i)=>(g(e)&&(i=e.max,e=e.min),!r(e)&&t<e&&(t=e),!r(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(p(t))switch(t.length){case 4:i=r(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),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)),E.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=r(e)?1e12:x(10,e);return-0===(t=w(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&E.assignScale(s,t);return s},assignScale(t,e){d(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 S=b/180,B=2*b,T=b/2;function P(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function L(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:C,cos:O,acos:A,sqrt:D}=Math,{float:M}=E,I={};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 W={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:L,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},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){z.toInnerPoint(t,e,I),z.scaleOfInner(t,I,i,s)},scaleOfInner(t,e,i,s=i){z.translateInner(t,e.x,e.y),z.scale(t,i,s),z.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:o}=t,r=O(e*=S),a=C(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){z.toInnerPoint(t,e,I),z.rotateOfInner(t,I,i)},rotateOfInner(t,e,i){z.translateInner(t,e.x,e.y),z.rotate(t,i),z.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:o,d:r}=t;i&&(i*=S,t.a=s+o*i,t.b=n+r*i),e&&(e*=S,t.c=o+s*e,t.d=r+n*e)},skewOfOuter(t,e,i,s){z.toInnerPoint(t,e,I),z.skewOfInner(t,I,i,s)},skewOfInner(t,e,i,s=0){z.translateInner(t,e.x,e.y),z.skew(t,i,s),z.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:o,e:r,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*o,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*o,t.e=e.e*i+e.f*n+r,t.f=e.e*s+e.f*o+a},multiplyParent(t,e,i,s,n){const{e:o,f:a}=t;if(i||(i=t),r(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){z.multiply(t,z.tempInvert(e))},divideParent(t,e){z.multiplyParent(t,z.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=z;return z.copy(e,t),z.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:o,f:r}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(o*n-r*s)*a,t.f=-(r*e-o*i)*a}else if(1===e&&1===n)t.e=-o,t.f=-r;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-o*n*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:o}=e;i||(i=e),i.x=n*t.a+o*t.c,i.y=n*t.b+o*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:o,c:r,d:a}=t,h=1/(n*a-o*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*n-l*o)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*n-e*o)*h}},setLayout(t,e,i,s,n){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(r(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,o=i*S,r=O(o),a=C(o);if(s||n){const e=s*S,i=n*S;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(i=i||s)&&z.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=D(n*n+o*o),c=t/d;const e=n/d;u=o>0?A(e):-A(e)}else{c=D(r*r+a*a),d=t/c;const e=r/c;u=T-(a>0?A(-e):-A(e))}const e=M(O(u)),i=C(u);d=M(d),c=M(c),p=e?M((r/c+i)/e/S,9):0,g=e?M((o/d-i)/e/S,9):0,u=M(u/S)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*r,f+=e.x*o+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:o,d:r}=t;n||o?i=(s*r-n*o)/(e=D(s*s+n*n)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){z.set(t)}},z=W,{toInnerPoint:U,toOuterPoint:H}=W,{sin:N,cos:Y,abs:X,sqrt:V,atan2:G,min:j,round:K}=Math,Z={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=r(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?K(t.x-.5)+.5:K(t.x),t.y=e?K(t.y-.5)+.5:K(t.y)},move(t,e,i){g(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=Y(e*=S),n=N(e),o=t.x-i.x,r=t.y-i.y;t.x=i.x+o*s-r*n,t.y=i.y+o*n+r*s},tempToInnerOf(t,e){const{tempPoint:i}=q;return $(i,t),U(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return $(i,t),H(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return $(i,t),q.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),U(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){U(e,t,i)},toOuterOf(t,e,i){H(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)=>J(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(J(t,e,i,s),J(i,s,n,o)),getAngle:(t,e)=>Q(t,e)/S,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)/S),getRadianFrom(t,e,i,s,n,o,a,h){r(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>G(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=Q(t,e);return(e=s?e:{}).x=t.x+Y(n)*i,e.y=t.y+N(n)*i,e},toNumberPoints(t){let e=t;return g(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=Z,{getDistanceFrom:J,copy:$,getAtan2:Q}=q;class tt{constructor(t,e){this.set(t,e)}set(t,e){return g(t)?Z.copy(this,t):Z.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new tt(this)}move(t,e){return Z.move(this,t,e),this}scale(t,e){return Z.scale(this,t,e),this}scaleOf(t,e,i){return Z.scaleOf(this,t,e,i),this}rotate(t,e){return Z.rotate(this,t,e),this}rotateOf(t,e){return Z.rotate(this,e,t),this}getRotation(t,e,i){return Z.getRotation(this,t,e,i)}toInnerOf(t,e){return Z.toInnerOf(this,t,e),this}toOuterOf(t,e){return Z.toOuterOf(this,t,e),this}getCenter(t){return new tt(Z.getCenter(this,t))}getDistance(t){return Z.getDistance(this,t)}getDistancePoint(t,e,i){return new tt(Z.getDistancePoint(this,t,e,i))}getAngle(t){return Z.getAngle(this,t)}getAtan2(t){return Z.getAtan2(this,t)}reset(){return Z.reset(this),this}}const et=new tt;class it{constructor(t,e,i,s,n,o){this.set(t,e,i,s,n,o)}set(t,e,i,s,n,o){return g(t)?W.copy(this,t):W.set(this,t,e,i,s,n,o),this}setWith(t){return W.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 it(this)}translate(t,e){return W.translate(this,t,e),this}translateInner(t,e){return W.translateInner(this,t,e),this}scale(t,e){return W.scale(this,t,e),this}scaleWith(t,e){return W.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return W.pixelScale(this,t),this}scaleOfOuter(t,e,i){return W.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return W.scaleOfInner(this,t,e,i),this}rotate(t){return W.rotate(this,t),this}rotateOfOuter(t,e){return W.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return W.rotateOfInner(this,t,e),this}skew(t,e){return W.skew(this,t,e),this}skewOfOuter(t,e,i){return W.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return W.skewOfInner(this,t,e,i),this}multiply(t){return W.multiply(this,t),this}multiplyParent(t){return W.multiplyParent(this,t),this}divide(t){return W.divide(this,t),this}divideParent(t){return W.divideParent(this,t),this}invert(){return W.invert(this),this}invertWith(){return W.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){W.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){W.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return W.setLayout(this,t,e,i),this}getLayout(t,e,i){return W.getLayout(this,t,e,i)}withScale(t,e){return W.withScale(this,t,e)}reset(){W.reset(this)}}const st=new it,nt={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){ot(t,e,i),ot(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:ot}=nt;var rt,at;t.Direction4=void 0,(rt=t.Direction4||(t.Direction4={}))[rt.top=0]="top",rt[rt.right=1]="right",rt[rt.bottom=2]="bottom",rt[rt.left=3]="left",t.Direction9=void 0,(at=t.Direction9||(t.Direction9={}))[at.topLeft=0]="topLeft",at[at.top=1]="top",at[at.topRight=2]="topRight",at[at.right=3]="right",at[at.bottomRight=4]="bottomRight",at[at.bottom=5]="bottom",at[at.bottomLeft=6]="bottomLeft",at[at.left=7]="left",at[at.center=8]="center",at[at["top-left"]=0]="top-left",at[at["top-right"]=2]="top-right",at[at["bottom-right"]=4]="bottom-right",at[at["bottom-left"]=6]="bottom-left";const ht=[{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}];ht.forEach(t=>t.type="percent");const lt={directionData:ht,tempPoint:{},get:dt,toPoint(t,e,i,s,n,o){const r=dt(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={}),lt.toPoint(t,e,i,!0),i)};function dt(e){return h(e)?ht[t.Direction9[e]]:e}const{toPoint:ct}=lt,ut={toPoint(t,e,i,s,n,o){ct(t,i,s,n,e,o)}},{tempPointBounds:pt,setPoint:gt,addPoint:_t,toBounds:ft}=nt,{toOuterPoint:mt}=W,{float:yt,fourNumber:vt}=E,{floor:wt,ceil:xt}=Math;let bt,Et,kt,St;const Bt={},Tt={},Pt={},Rt={tempBounds:Pt,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(p(i)){const e=vt(i);s?Lt.set(t,o+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Lt.set(t,o-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Lt.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),Lt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ot(e,t):e=t,i?(e.offsetX=-(Lt.maxX(i)-t.x),e.offsetY=-(Lt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Lt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||Z.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){Z.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Lt.copy(Pt,t),Lt.toOuterOf(Pt,e),Pt),getOuterOf:(t,e)=>(t=Object.assign({},t),Lt.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 Bt.x=t.x,Bt.y=t.y,mt(e,Bt,Tt),gt(pt,Tt.x,Tt.y),Bt.x=t.x+t.width,mt(e,Bt,Tt),_t(pt,Tt.x,Tt.y),Bt.y=t.y+t.height,mt(e,Bt,Tt),_t(pt,Tt.x,Tt.y),Bt.x=t.x,mt(e,Bt,Tt),_t(pt,Tt.x,Tt.y),ft(pt,i)},toInnerOf(t,e,i){i||(i=t),Lt.move(i,-e.e,-e.f),Lt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Lt.getFitScale(t,e));return new it(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,o){o||(o=e),h(s)&&(s=Lt.getFitScale(t,e,"cover"===s)),Pt.width=n?e.width*=s:e.width*s,Pt.height=n?e.height*=s:e.height*s,ut.toPoint(i,Pt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Lt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Lt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Lt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=wt(t.x),t.y=wt(t.y),t.width=e>t.x?xt(t.width+e-t.x):xt(t.width),t.height=i>t.y?xt(t.height+i-t.y):xt(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){bt=t.x+t.width,Et=t.y+t.height,kt=e.x,St=e.y,i||(kt+=e.width,St+=e.height),bt=bt>kt?bt:kt,Et=Et>St?Et:St,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=bt-t.x,t.height=Et-t.y},addList(t,e){Lt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Lt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Lt.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||Ot(t,n)):Ct(t,n));o&&Lt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?gt(pt,t.x,t.y):_t(pt,t.x,t.y)),ft(pt,t)},setPoint(t,e){Lt.set(t,e.x,e.y)},addPoint(t,e){Ct(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=Z.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=Z.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=Lt.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=Lt.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=Lt.tempToOuterOf(e,i)),!Lt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:o,height:r}=e;return bt=s+o,Et=n+r,kt=t.x+t.width,St=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,bt=bt<kt?bt:kt,Et=Et<St?Et:St,o=bt-s,r=Et-n,{x:s,y:n,width:o,height:r}},intersect(t,e,i){Lt.copy(t,Lt.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){Lt.set(t)}},Lt=Rt,{add:Ct,copy:Ot}=Lt;class At{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return g(t)?Rt.copy(this,t):Rt.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 At(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,i){return Rt.scale(this,t,e,i),this}scaleOf(t,e,i){return Rt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,i){Rt.put(this,t,e,i)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new At(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const Dt=new At;class Mt{constructor(t,e,i,s,n,o){g(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 At(n,e,o||t.width-n-i,r||t.height-e-s)}}const It={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}=E;class Wt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Wt(t)}static set filter(t){this.filterList=zt(t)}static set exclude(t){this.excludeList=zt(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"===Wt.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(Ut.enable){if(Ut.filterList.length&&Ut.filterList.every(t=>t!==this.name))return;if(Ut.excludeList.length&&Ut.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Ut.enable&&this.warn(...t)}warn(...t){Ut.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 zt(t){return t?h(t)&&(t=[t]):t=[],t}Wt.filterList=[],Wt.excludeList=[],Wt.showWarn=!0;const Ut=Wt,Ht=Wt.get("RunTime"),Nt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Yt.currentId=Yt.idMap[s]=e?performance.now():Date.now(),Yt.currentName=Yt.nameMap[s]=t,Yt.nameToIdMap[t]=s,s},end(t,e){const i=Yt.idMap[t],s=Yt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Yt.idMap[t]=Yt.nameMap[t]=Yt.nameToIdMap[s]=void 0,Ht.log(s,n,"ms")},endOfName(t,e){const i=Yt.nameToIdMap[t];r(i)||Yt.end(i,e)}},Yt=Nt,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 Gt={editor:t=>Vt.need("editor")},jt=Wt.get("UICreator"),Kt={list:{},register(t){const{__tag:e}=t.prototype;Zt[e]&&jt.repeat(e),Zt[e]=t},get(t,e,i,s,n,o){Zt[t]||jt.error("not register "+t);const a=new Zt[t](e);return r(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),o&&(a.height=o)),a}},{list:Zt}=Kt,qt=Wt.get("EventCreator"),Jt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&($t[e]&&qt.repeat(e),$t[e]=t)})},changeName(t,e){const i=$t[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,$t[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new $t[t](...e)},{nameList:$t}=Jt;class Qt{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=Gt.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 te(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 ee(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 ie(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 se=[];function ne(){return(t,e)=>{se.push(e)}}const oe=[];class re{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||oe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;se.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){g(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}}te([ie("imageSmoothingEnabled")],re.prototype,"smooth",void 0),te([ie("imageSmoothingQuality")],re.prototype,"smoothLevel",void 0),te([ie("globalAlpha")],re.prototype,"opacity",void 0),te([ie()],re.prototype,"fillStyle",void 0),te([ie()],re.prototype,"strokeStyle",void 0),te([ie("lineWidth")],re.prototype,"strokeWidth",void 0),te([ie("lineCap")],re.prototype,"strokeCap",void 0),te([ie("lineJoin")],re.prototype,"strokeJoin",void 0),te([ie("lineDashOffset")],re.prototype,"dashOffset",void 0),te([ie()],re.prototype,"miterLimit",void 0),te([ie()],re.prototype,"shadowBlur",void 0),te([ie()],re.prototype,"shadowColor",void 0),te([ie()],re.prototype,"shadowOffsetX",void 0),te([ie()],re.prototype,"shadowOffsetY",void 0),te([ie()],re.prototype,"filter",void 0),te([ie()],re.prototype,"font",void 0),te([ie()],re.prototype,"fontKerning",void 0),te([ie()],re.prototype,"fontStretch",void 0),te([ie()],re.prototype,"fontVariantCaps",void 0),te([ie()],re.prototype,"textAlign",void 0),te([ie()],re.prototype,"textBaseline",void 0),te([ie()],re.prototype,"textRendering",void 0),te([ie()],re.prototype,"wordSpacing",void 0),te([ie()],re.prototype,"letterSpacing",void 0),te([ie()],re.prototype,"direction",void 0),te([ne()],re.prototype,"setTransform",null),te([ne()],re.prototype,"resetTransform",null),te([ne()],re.prototype,"getTransform",null),te([ne()],re.prototype,"save",null),te([ne()],re.prototype,"restore",null),te([ne()],re.prototype,"translate",null),te([ne()],re.prototype,"scale",null),te([ne()],re.prototype,"rotate",null),te([ne()],re.prototype,"fill",null),te([ne()],re.prototype,"stroke",null),te([ne()],re.prototype,"clip",null),te([ne()],re.prototype,"fillRect",null),te([ne()],re.prototype,"strokeRect",null),te([ne()],re.prototype,"clearRect",null),te([ne()],re.prototype,"beginPath",null),te([ne()],re.prototype,"moveTo",null),te([ne()],re.prototype,"lineTo",null),te([ne()],re.prototype,"bezierCurveTo",null),te([ne()],re.prototype,"quadraticCurveTo",null),te([ne()],re.prototype,"closePath",null),te([ne()],re.prototype,"arc",null),te([ne()],re.prototype,"arcTo",null),te([ne()],re.prototype,"ellipse",null),te([ne()],re.prototype,"rect",null),te([ne()],re.prototype,"roundRect",null),te([ne()],re.prototype,"createConicGradient",null),te([ne()],re.prototype,"createLinearGradient",null),te([ne()],re.prototype,"createPattern",null),te([ne()],re.prototype,"createRadialGradient",null),te([ne()],re.prototype,"fillText",null),te([ne()],re.prototype,"measureText",null),te([ne()],re.prototype,"strokeText",null);const{copy:ae,multiplyParent:he,pixelScale:le}=W,{round:de}=Math,ce=new At,ue=new At,pe={width:1,height:1,pixelRatio:1},ge=["width","height","pixelRatio"];class _e extends re{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,s){super(),this.size={},this.worldTransform={},t||(t=pe),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:o,pixelRatio:r}=t;this.autoLayout=!n||!o,this.size.pixelRatio=r||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;m.copyAttrs(s,t,ge),ge.forEach(t=>s[t]||(s[t]=1)),this.bounds=new At(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&&he(t,e,n),le(t,i,n),s&&(t.half&&t.half*i%2?(n.e=de(n.e-.5)+.5,n.f=de(n.f-.5)+.5):(n.e=de(n.e),n.f=de(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),r(e.dashPattern)||(n=e.dashPattern),r(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=ue):i=ce,this.drawImage(t.view,ce.x,ce.y,ce.width,ce.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,Rt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,ce.x,ce.y,ce.width,ce.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(ce.x,ce.y,ce.width,ce.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,ce.x,ce.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(ce.x,ce.y,ce.width,ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(ce.x,ce.y,ce.width,ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ce.x,ce.y,ce.width,ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ce.x,ce.y,ce.width,ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(ue,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):Gt.canvas(Object.assign({},i));return n.save(),t&&(ae(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 fe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},me={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ye=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},me),ve={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},we={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},xe=Object.assign(Object.assign({},we),me),be=ye,Ee={};for(let t in be)Ee[be[t]]=t;const ke={};for(let t in be)ke[be[t]]=ve[t];const Se={drawRoundRect(t,e,i,s,n,o){const r=E.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:Be,cos:Te,hypot:Pe,atan2:Re,ceil:Le,abs:Ce,PI:Oe,sqrt:Ae,pow:De}=Math,{setPoint:Me,addPoint:Ie}=nt,{set:Fe,toNumberPoints:We}=Z,{M:ze,L:Ue,C:He,Q:Ne,Z:Ye}=ye,Xe={},Ve={points(t,e,i,s){let n=We(e);if(t.push(ze,n[0],n[1]),i&&n.length>5){let e,o,r,a,h,l,d,c,u,p,g,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-2;i+=2)e=n[i-2],o=n[i-1],r=n[i],a=n[i+1],h=n[i+2],l=n[i+3],g=Ae(De(r-e,2)+De(a-o,2)),_=Ae(De(h-r,2)+De(l-a,2)),(g||_)&&(f=g+_,g=y*g/f,_=y*_/f,h-=e,l-=o,d=r-g*h,c=a-g*l,2===i?s||t.push(Ne,d,c,r,a):t.push(He,u,p,d,c,r,a),u=r+_*h,p=a+_*l);s||t.push(Ne,u,p,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Ue,n[e],n[e+1]);s&&t.push(Ye)},rect(t,e,i,s,n){fe.creator.path=t,fe.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){fe.creator.path=[],Se.drawRoundRect(fe.creator,e,i,s,n,o),t.push(...fe.convertToCanvasData(fe.creator.path,!0))},arcTo(t,e,i,s,n,o,r,a,h,l,d){const c=s-e,u=n-i,p=o-s,g=r-n;let _=Re(u,c),f=Re(g,p);const m=Pe(c,u),y=Pe(p,g);let v=f-_;if(v<0&&(v+=B),m<1e-12||y<1e-12||v<1e-12||Ce(v-Oe)<1e-12)return t&&t.push(Ue,s,n),h&&(Me(h,e,i),Ie(h,s,n)),d&&Fe(d,e,i),void(l&&Fe(l,s,n));const w=c*g-p*u<0,x=w?-1:1,b=a/Te(v/2),E=s+b*Te(_+v/2+T*x),k=n+b*Be(_+v/2+T*x);return _-=T*x,f-=T*x,Ke(t,E,k,a,a,0,_/S,f/S,w,h,l,d)},arc:(t,e,i,s,n,o,r,a,h,l)=>Ke(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*S,p=Be(u),g=Te(u);let _=r*S,f=a*S;_>Oe&&(_-=B),f<0&&(f+=B);let m=f-_;m<0?m+=B:m>B&&(m-=B),h&&(m-=B);const y=Le(Ce(m/T)),v=m/y,w=Be(v/4),x=8/3*w*w/Be(v/2);f=_+v;let b,E,k,P,R,L,C,O,A=Te(_),D=Be(_),M=k=g*s*A-p*n*D,I=P=p*s*A+g*n*D,F=e+k,W=i+P;t&&t.push(t.length?Ue:ze,F,W),l&&Me(l,F,W),c&&Fe(c,F,W);for(let o=0;o<y;o++)b=Te(f),E=Be(f),k=g*s*b-p*n*E,P=p*s*b+g*n*E,R=e+M-x*(g*s*D+p*n*A),L=i+I-x*(p*s*D-g*n*A),C=e+k+x*(g*s*E+p*n*b),O=i+P+x*(p*s*E-g*n*b),t&&t.push(He,R,L,C,O,e+k,i+P),l&&je(e+M,i+I,R,L,C,O,e+k,i+P,l,!0),M=k,I=P,A=b,D=E,_=f,f+=v;d&&Fe(d,e+k,i+P)},quadraticCurveTo(t,e,i,s,n,o,r){t.push(He,(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,m,y,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,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Ie(h,t,e):Me(h,t,e),Ie(h,r,a);for(let l=0,c=d.length;l<c;l++)Ge(d[l],t,e,i,s,n,o,r,a,Xe),Ie(h,Xe.x,Xe.y)},getPointAndSet(t,e,i,s,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,g=t*t*t;l.x=c*e+u*s+p*o+g*a,l.y=c*i+u*n+p*r+g*h},getPoint(t,e,i,s,n,o,r,a,h){const l={};return Ge(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:Ge,toTwoPointBounds:je,ellipse:Ke}=Ve,{sin:Ze,cos:qe,sqrt:Je,atan2:$e}=Math,{ellipse:Qe}=Ve,ti={ellipticalArc(t,i,s,n,o,r,a,h,l,d,c){const u=(l-i)/2,p=(d-s)/2,g=r*S,_=Ze(g),f=qe(g),m=-f*u-_*p,y=-f*p+_*u,v=n*n,w=o*o,x=y*y,b=m*m,E=v*w-v*x-w*b;let k=0;if(E<0){const t=Je(1-E/(v*w));n*=t,o*=t}else k=(a===h?-1:1)*Je(E/(v*x+w*b));const T=k*n*y/o,P=-k*o*m/n,R=$e((y-P)/o,(m-T)/n),L=$e((-y-P)/o,(-m-T)/n);let C=L-R;0===h&&C>0?C-=B:1===h&&C<0&&(C+=B);const O=i+u+f*T-_*P,A=s+p+_*T+f*P,D=C<0?1:0;c||e.ellipseToCurve?Qe(t,O,A,n,o,r,R/S,L/S,D):n!==o||r?t.push(ye.G,O,A,n,o,r,R/S,L/S,D):t.push(ye.O,O,A,n,R/S,L/S,D)}},{M:ei,m:ii,L:si,l:ni,H:oi,h:ri,V:ai,v:hi,C:li,c:di,S:ci,s:ui,Q:pi,q:gi,T:_i,t:fi,A:mi,a:yi,Z:vi,z:wi,N:xi,D:bi,X:Ei,G:ki,F:Si,O:Bi,P:Ti,U:Pi}=ye,{rect:Ri,roundRect:Li,arcTo:Ci,arc:Oi,ellipse:Ai,quadraticCurveTo:Di}=Ve,{ellipticalArc:Mi}=ti,Ii=Wt.get("PathConvert"),Fi={},Wi={current:{dot:0},stringify(t,e){let i,s,n,o=0,r=t.length,a="";for(;o<r;){s=t[o],i=ke[s],a+=s===n?" ":Ee[s];for(let s=1;s<i;s++)a+=E.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?xe:we;for(let e=0,h=t.length;e<h;e++)s=t[e],It[s]?("."===s&&(zi.dot&&(Ui(r,o),o=""),zi.dot++),"0"===o&&"."!==s&&(Ui(r,o),o=""),o+=s):ye[s]?(o&&(Ui(r,o),o=""),zi.name=ye[s],zi.length=ve[s],zi.index=0,Ui(r,zi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?o+=s:(o&&Ui(r,o),o=s):o&&(Ui(r,o),o=""),n=s;return o&&Ui(r,o),i?Wi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,n,o,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case ii:t[c+1]+=a,t[c+2]+=h;case ei:a=t[c+1],h=t[c+2],p.push(ei,a,h),c+=3;break;case ri:t[c+1]+=a;case oi:a=t[c+1],p.push(si,a,h),c+=2;break;case hi:t[c+1]+=h;case ai:h=t[c+1],p.push(si,a,h),c+=2;break;case ni:t[c+1]+=a,t[c+2]+=h;case si:a=t[c+1],h=t[c+2],p.push(si,a,h),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:r=o===li||o===ci,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(li,l,d,i,s,a,h),c+=5;break;case di: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=li;case li:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(li,t[c+1],t[c+2],i,s,a,h),c+=7;break;case fi:t[c+1]+=a,t[c+2]+=h,n=_i;case _i:r=o===pi||o===_i,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Di(p,a,h,i,s,t[c+1],t[c+2]):p.push(pi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case gi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=pi;case pi:i=t[c+1],s=t[c+2],e?Di(p,a,h,i,s,t[c+3],t[c+4]):p.push(pi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case yi:t[c+6]+=a,t[c+7]+=h;case mi:Mi(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case wi:case vi:p.push(vi),c++;break;case xi:a=t[c+1],h=t[c+2],e?Ri(p,a,h,t[c+3],t[c+4]):Hi(p,t,c,5),c+=5;break;case bi:a=t[c+1],h=t[c+2],e?Li(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Hi(p,t,c,9),c+=9;break;case Ei:a=t[c+1],h=t[c+2],e?Li(p,a,h,t[c+3],t[c+4],t[c+5]):Hi(p,t,c,6),c+=6;break;case ki:Ai(e?p:Hi(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Fi),a=Fi.x,h=Fi.y,c+=9;break;case Si:e?Ai(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Hi(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Bi:Oi(e?p:Hi(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Fi),a=Fi.x,h=Fi.y,c+=7;break;case Ti:e?Oi(p,t[c+1],t[c+2],t[c+3],0,360,!1):Hi(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Pi:Ci(e?p:Hi(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Fi),a=Fi.x,h=Fi.y,c+=6;break;default:return Ii.error(`command: ${n} [index:${c}]`,t),p}o=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(ei,t.x,t.y);break;case"L":e.push(si,t.x,t.y);break;case"C":e.push(li,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(pi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(vi)}}),e},copyData(t,e,i,s){for(let n=i,o=i+s;n<o;n++)t.push(e[n])},pushData(t,e){zi.index===zi.length&&(zi.index=1,t.push(zi.name)),t.push(Number(e)),zi.index++,zi.dot=0}},{current:zi,pushData:Ui,copyData:Hi}=Wi,{M:Ni,L:Yi,C:Xi,Q:Vi,Z:Gi,N:ji,D:Ki,X:Zi,G:qi,F:Ji,O:$i,P:Qi,U:ts}=ye,{getMinDistanceFrom:es,getRadianFrom:is}=Z,{tan:ss,min:ns,abs:os}=Math,rs={},as={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(Xi,e,i,s,n,o,r)},quadraticCurveTo(t,e,i,s,n){t.push(Vi,e,i,s,n)},closePath(t){t.push(Gi)},rect(t,e,i,s,n){t.push(ji,e,i,s,n)},roundRect(t,e,i,s,n,o){if(d(o))t.push(Zi,e,i,s,n,o);else{const r=E.fourNumber(o);r?t.push(Ki,e,i,s,n,...r):t.push(ji,e,i,s,n)}},ellipse(t,e,i,s,n,o,r,h,l){a(o)?t.push(Ji,e,i,s,n):(a(r)&&(r=0),a(h)&&(h=360),t.push(qi,e,i,s,n,o,r,h,l?1:0))},arc(t,e,i,s,n,o,r){a(n)?t.push(Qi,e,i,s):(a(o)&&(o=360),t.push($i,e,i,s,n,o,r?1:0))},arcTo(t,e,i,s,n,o,a,h){if(!r(a)){const t=es(a,h,e,i,s,n);o=ns(o,ns(t/2,t/2*os(ss(is(a,h,e,i,s,n)/2))))}t.push(ts,e,i,s,n,o)},drawEllipse(t,e,i,s,n,o,r,h,l){Ve.ellipse(null,e,i,s,n,a(o)?0:o,a(r)?0:r,a(h)?360:h,l,null,null,rs),t.push(Ni,rs.x,rs.y),hs(t,e,i,s,n,o,r,h,l)},drawArc(t,e,i,s,n,o,r){Ve.arc(null,e,i,s,a(n)?0:n,a(o)?360:o,r,null,null,rs),t.push(Ni,rs.x,rs.y),ls(t,e,i,s,n,o,r)},drawPoints(t,e,i,s){Ve.points(t,e,i,s)}},{ellipse:hs,arc:ls}=as,{moveTo:ds,lineTo:cs,quadraticCurveTo:us,bezierCurveTo:ps,closePath:gs,beginPath:_s,rect:fs,roundRect:ms,ellipse:ys,arc:vs,arcTo:ws,drawEllipse:xs,drawArc:bs,drawPoints:Es}=as;class ks{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?fe.parse(t):t:[],this}beginPath(){return _s(this.__path),this.paint(),this}moveTo(t,e){return ds(this.__path,t,e),this.paint(),this}lineTo(t,e){return cs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,o){return ps(this.__path,t,e,i,s,n,o),this.paint(),this}quadraticCurveTo(t,e,i,s){return us(this.__path,t,e,i,s),this.paint(),this}closePath(){return gs(this.__path),this.paint(),this}rect(t,e,i,s){return fs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return ms(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,o,r,a){return ys(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}arc(t,e,i,s,n,o){return vs(this.__path,t,e,i,s,n,o),this.paint(),this}arcTo(t,e,i,s,n){return ws(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,o,r,a){return xs(this.__path,t,e,i,s,n,o,r,a),this.paint(),this}drawArc(t,e,i,s,n,o){return bs(this.__path,t,e,i,s,n,o),this.paint(),this}drawPoints(t,e,i){return Es(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ss,L:Bs,C:Ts,Q:Ps,Z:Rs,N:Ls,D:Cs,X:Os,G:As,F:Ds,O:Ms,P:Is,U:Fs}=ye,Ws=Wt.get("PathDrawer"),zs={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Ss:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Bs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ts:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ps:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Rs:t.closePath(),s+=1;break;case Ls: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 As:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*S,e[s+6]*S,e[s+7]*S,e[s+8]),s+=9;break;case Ds:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,B,!1),s+=5;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*S,e[s+5]*S,e[s+6]),s+=7;break;case Is:t.arc(e[s+1],e[s+2],e[s+3],0,B,!1),s+=4;break;case Fs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Ws.error(`command: ${i} [index:${s}]`,e)}}},{M:Us,L:Hs,C:Ns,Q:Ys,Z:Xs,N:Vs,D:Gs,X:js,G:Ks,F:Zs,O:qs,P:Js,U:$s}=ye,{toTwoPointBounds:Qs,toTwoPointBoundsByQuadraticCurve:tn,arcTo:en,arc:sn,ellipse:nn}=Ve,{addPointBounds:on,copy:rn,addPoint:an,setPoint:hn,addBounds:ln,toBounds:dn}=nt,cn=Wt.get("PathBounds");let un,pn,gn;const _n={},fn={},mn={},yn={toBounds(t,e){yn.toTwoPointBounds(t,fn),dn(fn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return hn(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===Xs||r===Ns||r===Ys?hn(e,h,l):hn(e,t[a+1],t[a+2])),r){case Us:case Hs:h=t[a+1],l=t[a+2],an(e,h,l),a+=3;break;case Ns:n=t[a+5],o=t[a+6],Qs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,_n),on(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],tn(h,l,i,s,n,o,_n),on(e,_n),h=n,l=o,a+=5;break;case Xs:a+=1;break;case Vs:h=t[a+1],l=t[a+2],ln(e,h,l,t[a+3],t[a+4]),a+=5;break;case Gs:case js:h=t[a+1],l=t[a+2],ln(e,h,l,t[a+3],t[a+4]),a+=r===Gs?9:6;break;case Ks:nn(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,mn),0===a?rn(e,_n):on(e,_n),h=mn.x,l=mn.y,a+=9;break;case Zs:h=t[a+1],l=t[a+2],pn=t[a+3],gn=t[a+4],ln(e,h-pn,l-gn,2*pn,2*gn),h+=pn,a+=5;break;case qs:sn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],_n,mn),0===a?rn(e,_n):on(e,_n),h=mn.x,l=mn.y,a+=7;break;case Js:h=t[a+1],l=t[a+2],un=t[a+3],ln(e,h-un,l-un,2*un,2*un),h+=un,a+=4;break;case $s:en(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],_n,mn),0===a?rn(e,_n):on(e,_n),h=mn.x,l=mn.y,a+=6;break;default:return void cn.error(`command: ${r} [index:${a}]`,t)}}},{M:vn,L:wn,Z:xn}=ye,{getCenterX:bn,getCenterY:En}=Z,{arcTo:kn}=as,Sn={smooth(t,e,i){let s,n,o,r=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,g=0;const _=t.length,f=[];for(;r<_;){switch(s=t[r],s){case vn:l=p=t[r+1],d=g=t[r+2],r+=3,t[r]===wn?(c=t[r+1],u=t[r+2],f.push(vn,bn(l,c),En(d,u))):f.push(vn,l,d);break;case wn:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case wn:kn(f,a,h,t[r+1],t[r+2],e,p,g);break;case xn:kn(f,a,h,l,d,e,p,g);break;default:f.push(wn,a,h)}p=a,g=h;break;case xn:n!==xn&&(kn(f,l,d,c,u,e,p,g),f.push(xn)),r+=1;break;default:o=ke[s];for(let e=0;e<o;e++)f.push(t[r+e]);r+=o}n=s}return s!==xn&&(f[1]=l,f[2]=d),f}};function Bn(t){return new ks(t)}const Tn=Bn();fe.creator=Bn(),fe.parse=Wi.parse,fe.convertToCanvasData=Wi.toCanvasData;const{drawRoundRect:Pn}=Se;function Rn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Pn(this,t,e,i,s,n)})}(t)}const Ln={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=Ln;Cn.alphaPixelTypes.forEach(t=>Cn.upperCaseTypeMap[t]=t.toUpperCase());const On=Wt.get("TaskProcessor");class An{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return ee(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 Dn{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&&m.assign(this.config,t),this.empty()}add(t,e){let i,s,n,o;const a=new An(t);return a.parent=this,d(e)?o=e:e&&(s=e.parallel,i=e.start,n=e.time,o=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),r(o)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},o)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}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 Mn=Wt.get("Resource"),In={tasker:new Dn,map:{},get isComplete(){return Fn.tasker.isComplete},set(t,e){Fn.map[t]&&Mn.repeat(t),Fn.map[t]=e},get:t=>Fn.map[t],remove(t){const e=Fn.map[t];e&&(e.destroy&&e.destroy(),delete Fn.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 h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Gt.image(s)),Fn.set(t,e),e},destroy(){Fn.map={}}},Fn=In,Wn={maxRecycled:10,recycledList:[],patternTasker:new Dn,get(t){let e=In.get(t.url);return e||In.set(t.url,e=Gt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||zn.recycledList.push(t)})},clearRecycled(){const t=zn.recycledList;t.length>zn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&In.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Ln.alphaPixelTypes.some(e=>zn.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:"+Ln.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Ln.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){zn.recycledList=[]}},zn=Wn,{IMAGE:Un,create:Hn}=i,{floor:Nn,max:Yn}=Math;class Xn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Hn(Un),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Wn.isFormat("svg",t)&&(this.isSVG=!0),Wn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),In.tasker.add(()=>ee(this,void 0,void 0,function*(){return yield t(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,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(t,i,s,n,o,r,a){if(t||(t=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=e.origin.createCanvas(Yn(Nn(t+(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,t,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,i,s,n){const o=e.canvas.createPattern(t,i);try{s&&o.setTransform&&(o.setTransform(s),s=void 0)}catch(t){}return n&&m.stintSet(n,"transform",s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Vn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Gn(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 Kn(t,e){return(i,s)=>qn(i,s,t,e&&e(s))}function Zn(t){return t}function qn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Vn(t,e,Object.assign(n,s||{})),So(t,e,i)}function Jn(t){return Kn(t)}function $n(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Qn(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function to(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),oo(this))}}))}function eo(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function io(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function so(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i,e)&&oo(this)}}))}function no(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(oo(this),this.__.__removeNaturalSize())}}))}function oo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function ro(t){return Kn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),oo(this)}}))}const ao=so;function ho(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i)&&(lo(this),e&&(this.__.__useStroke=!0))}}))}function lo(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&oo(t)}const co=ho;function uo(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function po(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function go(t){return Kn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;m.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function _o(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&mo(this)}}))}function fo(t){return Kn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>yo(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");yo(this,t,e,i),this.mask&&mo(this)}}))}function mo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function yo(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||oo(t))}function vo(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function wo(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function xo(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function bo(t){return Kn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Wt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Eo(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function ko(t){return(e,i)=>{Vn(e,"__DataProcessor",{get:()=>t})}}function So(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=jn(e,i);if(r(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(g(i)){const t=f(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:m.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=Gn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),Vn(s,e,a)}const Bo=new Wt("rewrite"),To=[],Po=["destroy","constructor"];function Ro(t){return(e,i)=>{To.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Lo(){return t=>{Co()}}function Co(t){To.length&&(To.forEach(e=>{t&&Bo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),To.length=0)}function Oo(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Po.includes(s)||e&&e.includes(s)))if(t.prototype){Gn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Ao(){return t=>{Kt.register(t)}}function Do(){return t=>{Jt.register(t)}}setTimeout(()=>Co(!0));const{copy:Mo,toInnerPoint:Io,toOuterPoint:Fo,scaleOfOuter:Wo,rotateOfOuter:zo,skewOfOuter:Uo,multiplyParent:Ho,divideParent:No,getLayout:Yo}=W,Xo={},{round:Vo}=Math,Go={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Zo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Ko(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++)qo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&qo(t),t.__updateChange()},updateAllChange(t){if($o(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Jo(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(t,i,s,n,o,r){n||(n=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,n,t.__nowWorld,o,r):i.copyWorldToInner(s,n,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,n){const o=g(e)?Object.assign({},e):{x:e,y:i};s?Fo(t.localTransform,o,o,!0):t.parent&&Io(t.parent.scrollWorldTransform,o,o,!0),jo.moveLocal(t,o.x,o.y,n)},moveLocal(t,e,i=0,s){g(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Vo(e),i=Vo(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,Qo(t,e),i,s,n,o)},zoomOfLocal(t,e,i,s=i,n,o){const r=t.__localMatrix;if(d(s)||(s&&(o=s),s=i),Mo(Xo,r),Wo(Xo,e,i,s),jo.hasHighPosition(t))jo.setTransform(t,Xo,n,o);else{const e=t.x+Xo.e-r.e,a=t.y+Xo.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,Qo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Mo(Xo,n),zo(Xo,e,i),jo.hasHighPosition(t)?jo.setTransform(t,Xo,!1,s):t.set({x:t.x+Xo.e-n.e,y:t.y+Xo.f-n.f,rotation:E.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,o){jo.skewOfLocal(t,Qo(t,e),i,s,n,o)},skewOfLocal(t,e,i,s=0,n,o){Mo(Xo,t.__localMatrix),Uo(Xo,e,i,s),jo.setTransform(t,Xo,n,o)},transformWorld(t,e,i,s){Mo(Xo,t.worldTransform),Ho(Xo,e),t.parent&&No(Xo,t.parent.scrollWorldTransform),jo.setTransform(t,Xo,i,s)},transform(t,e,i,s){Mo(Xo,t.localTransform),Ho(Xo,e),jo.setTransform(t,Xo,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){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=jo.getInnerOrigin(t,n.origin);Z.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 Wo(i,jo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>Z.tempToOuterOf(jo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return lt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Mo(Xo,t.worldTransform),No(Xo,e.scrollWorldTransform),i?Xo:Object.assign({},Xo)),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(t,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)t.move(i);else{const n=i.x*s,o=i.y*s;i.x-=n,i.y-=o,t.move(n,o),e.requestRender(()=>jo.animateMove(t,i,s))}}},jo=Go,{updateAllMatrix:Ko,updateMatrix:Zo,updateAllWorldOpacity:qo,updateAllChange:Jo,updateChange:$o}=jo;function Qo(t,e){return t.updateLayout(),t.parent?Z.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const tr={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)=>ir(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>ir(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>ir(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 er;function ir(t,e){return e||(er=0),t.__.mask&&(er=1),er<0?null:(er&&(er=-1),!0)}const{updateBounds:sr}=Go,nr={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),or(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&r(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++)rr(e[t],e)},updateBounds(t,e){const i=[t];rr(t,i),ar(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++)sr(s[t]);e&&e===i||sr(i)}}},{pushAllChildBranch:or,pushAllBranchStack:rr,updateBoundsByBranchStack:ar}=nr,hr={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:lr,updateBounds:dr}=Go,{toOuterOf:cr,getPoints:ur,copy:pr}=Rt,gr="_localContentBounds",_r="_worldContentBounds",fr="_worldBoxBounds",mr="_worldStrokeBounds";class yr{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 cr(this.contentBounds,this.leaf.__localMatrix,this[gr]||(this[gr]={})),this[gr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return cr(this.contentBounds,this.leaf.__world,this[_r]||(this[_r]={})),this[_r]}get worldBoxBounds(){return cr(this.boxBounds,this.leaf.__world,this[fr]||(this[fr]={})),this[fr]}get worldStrokeBounds(){return cr(this.strokeBounds,this.leaf.__world,this[mr]||(this[mr]={})),this[mr]}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:t}=this,{leafer:i}=t;if(t.isApp)return dr(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.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 W.defaultMatrix;case"page":t=e.zoomLayer;default:return lr(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 At(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=W.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),o=lr(s,e,!0)}if(r||(r=W.getLayout(o)),pr(r,a),Z.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=ur(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 r(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 vr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class wr extends vr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}wr.ADD="child.add",wr.REMOVE="child.remove",wr.CREATED="created",wr.MOUNTED="mounted",wr.UNMOUNTED="unmounted",wr.DESTROY="destroy";const xr="property.scroll";class br extends vr{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}br.CHANGE="property.change",br.LEAFER_CHANGE="property.leafer_change",br.SCROLL=xr;const Er={scrollX:xr,scrollY:xr};class kr extends vr{constructor(t,e){super(t),Object.assign(this,e)}}kr.LOAD="image.load",kr.LOADED="image.loaded",kr.ERROR="image.error";class Sr extends vr{static checkHas(t,e,i){"on"===i?e===Rr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Br)||t.hasEvent(Tr)||t.hasEvent(Pr),t.__hasWorldEvent=t.hasEvent(Rr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Br,t),"inner"===e&&t.emit(Tr,t)),t.emit(Pr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Rr,this)}}Sr.RESIZE="bounds.resize",Sr.INNER="bounds.inner",Sr.LOCAL="bounds.local",Sr.WORLD="bounds.world";const{RESIZE:Br,INNER:Tr,LOCAL:Pr,WORLD:Rr}=Sr,Lr={};[Br,Tr,Pr,Rr].forEach(t=>Lr[t]=1);class Cr extends vr{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){g(t)?(super(Cr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!r(this.resizingKeys[t.innerId])}}Cr.RESIZE="resize";class Or extends vr{constructor(t,e){super(t),this.data=e}}Or.REQUEST="watch.request",Or.DATA="watch.data";class Ar extends vr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Ar.REQUEST="layout.request",Ar.START="layout.start",Ar.BEFORE="layout.before",Ar.LAYOUT="layout",Ar.AFTER="layout.after",Ar.AGAIN="layout.again",Ar.END="layout.end";class Dr extends vr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Dr.REQUEST="render.request",Dr.CHILD_START="render.child_start",Dr.CHILD_END="render.child_end",Dr.START="render.start",Dr.BEFORE="render.before",Dr.RENDER="render",Dr.AFTER="render.after",Dr.AGAIN="render.again",Dr.END="render.end",Dr.NEXT="render.next";class Mr extends vr{}Mr.START="leafer.start",Mr.BEFORE_READY="leafer.before_ready",Mr.READY="leafer.ready",Mr.AFTER_READY="leafer.after_ready",Mr.VIEW_READY="leafer.view_ready",Mr.VIEW_COMPLETED="leafer.view_completed",Mr.STOP="leafer.stop",Mr.RESTART="leafer.restart",Mr.END="leafer.end",Mr.UPDATE_MODE="leafer.update_mode",Mr.TRANSFORM="leafer.transform",Mr.MOVE="leafer.move",Mr.SCALE="leafer.scale",Mr.ROTATE="leafer.rotate",Mr.SKEW="leafer.skew";const{MOVE:Ir,SCALE:Fr,ROTATE:Wr,SKEW:zr}=Mr,Ur={x:Ir,y:Ir,scaleX:Fr,scaleY:Fr,rotation:Wr,skewX:zr,skewY:zr},Hr={};class Nr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(p(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)p(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),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(o=r[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):r[t]=[l],Lr[t]&&Sr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(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],Lr[t]&&Sr.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):p(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=p(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):p(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 p(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));g(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Jt.has(t)&&(e=Jt.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],o=s&&s[t];return!!(r(e)?n||o:e?o: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={}:Hr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Hr)}}const{on:Xr,on_:Vr,off:Gr,off_:jr,once:Kr,emit:Zr,emitEvent:qr,hasEvent:Jr,destroy:$r}=Nr.prototype,Qr={on:Xr,on_:Vr,off:Gr,off_:jr,once:Kr,emit:Zr,emitEvent:qr,hasEvent:Jr,destroyEventer:$r},ta=Wt.get("setAttr"),ea={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||r(e)||(ta.warn(this.innerName,t,e),e=void 0),g(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new br(br.LEAFER_CHANGE,this,t,s,e));const i=Ur[t];i&&(this.emitEvent(new Mr(i,this)),this.emitEvent(new Mr(Mr.TRANSFORM,this)))}this.emitPropertyEvent(br.CHANGE,t,s,e);const i=Er[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 br(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||r(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ia,multiplyParent:sa,translateInner:na,defaultWorld:oa}=W,{toPoint:ra,tempPoint:aa}=lt,ha={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;sa(this.__local||e,t?t.__scrollWorld||t.__world:oa,i,!!e.affectScaleOrRotation,n),s&&na(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)&&(ia(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)&&(ra(i.around||i.origin,t.boxBounds,aa),na(e,-aa.x,-aa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:la,updateAllMatrix:da}=Go,{updateBounds:ca}=nr,{toOuterOf:ua,copyAndSpread:pa,copy:ga}=Rt,{toBounds:_a}=yn,fa={__updateWorldBounds(){const t=this.__layout;ua(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Sr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Sr.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(),ua(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ua(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ua(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(),da(this),ca(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(da(this),ca(this,this))):la(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;pa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?pa(e.renderBounds,e.boxBounds,e.renderSpread):ga(e.renderBounds,e.strokeBounds)}},ma={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(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),Go.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Wt.showBounds&&Wt.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:ya}=tr,va={__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.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(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++)ya(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++)ya(i[s],e)||i[s].__clip(t,e)}}},wa={},{LEAF:xa,create:ba}=i,{toInnerPoint:Ea,toOuterPoint:ka,multiplyParent:Sa}=W,{toOuterOf:Ba}=Rt,{copy:Ta,move:Pa}=Z,{moveLocal:Ra,zoomOfLocal:La,rotateOfLocal:Ca,skewOfLocal:Oa,moveWorld:Aa,zoomOfWorld:Da,rotateOfWorld:Ma,skewOfWorld:Ia,transform:Fa,transformWorld:Wa,setTransform:za,getFlipTransform:Ua,getLocalOrigin:Ha,getRelativeWorld:Na,drop:Ya}=Go;t.Leaf=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 v}get __LayoutProcessor(){return yr}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=ba(xa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(wr.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(wr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(wr.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(wr.MOUNTED)):this.__emitLifeEvent(wr.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){r(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=r(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 Sa(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}=Wn.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),wa.scaleX=i,wa.scaleY=s,wa}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 Ba(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ta(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ta(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ea(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){ka(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 Pa(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 Pa(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){za(this,t,e,i)}transform(t,e,i){Fa(this,t,e,i)}move(t,e,i){Ra(this,t,e,i)}moveInner(t,e,i){Aa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){La(this,Ha(this,t),e,i,s,n)}rotateOf(t,e,i){Ca(this,Ha(this,t),e,i)}skewOf(t,e,i,s,n){Oa(this,Ha(this,t),e,i,s,n)}transformWorld(t,e,i){Wa(this,t,e,i)}moveWorld(t,e,i){Aa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Da(this,t,e,i,s,n)}rotateOfWorld(t,e){Ma(this,t,e)}skewOfWorld(t,e,i,s,n){Ia(this,t,e,i,s,n)}flip(t,e){Fa(this,Ua(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):So(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=so),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new wr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(wr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=te([Oo(ea),Oo(ha),Oo(fa),Oo(Qr),Oo(ma)],t.Leaf);const{setListWithFn:Xa}=Rt,{sort:Va}=nr,{localBoxBounds:Ga,localStrokeBounds:ja,localRenderBounds:Ka,maskLocalBoxBounds:Za,maskLocalStrokeBounds:qa,maskLocalRenderBounds:Ja}=tr,$a=new Wt("Branch");t.Branch=class extends t.Leaf{__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?Za:Ga)}__updateStrokeBounds(t){Xa(t||this.__layout.strokeBounds,this.children,this.__hasMask?qa:ja)}__updateRenderBounds(t){Xa(t||this.__layout.renderBounds,this.children,this.__hasMask?Ja:Ka)}__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 $a.warn("add self or destroyed");const i=r(e);if(!t.__){if(p(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Kt.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(wr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(wr.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)):r(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(wr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(wr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new wr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=te([Oo(va)],t.Branch);class Qa{get length(){return this.list.length}constructor(t){this.reset(),t&&(p(t)?this.addList(t):this.add(t))}has(t){return t&&!r(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return r(e)?-1:e}add(t){const{list:e,keys:i}=this;r(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(r(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++)r(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;r(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&&(p(t)?this.addList(t):this.add(t))}has(t){return!r(this.keys[t.innerId])}without(t){return r(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}}class eh extends _e{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.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:ih}=Ln;function sh(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:ih(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:ih(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=Gt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Gt,{canvas:(t,e)=>new eh(t,e),image:t=>new Xn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Vn(e,"devicePixelRatio",{get:()=>1});const{userAgent:nh}=navigator;nh.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),nh.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):nh.indexOf("Mac")>-1?e.os="Mac":nh.indexOf("Linux")>-1&&(e.os="Linux");class oh{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=m.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(Dr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===wr.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_([[br.CHANGE,this.__onAttrChange,this],[[wr.ADD,wr.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:rh,updateBounds:ah,updateChange:hh}=Go,{pushAllChildBranch:lh,pushAllParent:dh}=nr;const{worldBounds:ch}=tr;class uh{constructor(t){this.updatedBounds=new At,this.beforeBounds=new At,this.afterBounds=new At,p(t)&&(t=new Qa(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,ch)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,ch),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}=Go,_h=Wt.get("Layouter");class fh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new th,this.target=t,e&&(this.config=m.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(Ar.START),this.layoutOnce(),t.emitEvent(new Ar(Ar.END,this.layoutedBlocks,this.times))}catch(t){_h.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?_h.warn("layouting"):this.times>3?_h.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=Nt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:r}=Ar,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Ar(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?(rh(t,!0),e.add(t),t.isBranch&&lh(t,e),dh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),dh(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||ah(s[t])}ah(i)}})}(this.__levelList),function(t){t.list.forEach(hh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Ar(o,a,this.times)),i.emitEvent(new Ar(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Nt.end(e)}fullLayout(){const t=Nt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Ar,o=this.getBlocks(new Qa(e));e.emitEvent(new Ar(i,o,this.times)),fh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Ar(s,o,this.times)),e.emitEvent(new Ar(n,o,this.times)),this.addBlocks(o),Nt.end(t)}static fullLayout(t){ph(t,!0),t.isBranch?nr.updateBounds(t):Go.updateBounds(t),gh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new uh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new uh(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_([[Ar.REQUEST,this.layout,this],[Ar.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=Wt.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:120},this.target=t,this.canvas=e,i&&(this.config=m.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(Ar.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Dr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Dr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Dr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new At,mh.log(e.innerName,"---\x3e");try{this.emitRender(Dr.START),this.renderOnce(t),this.emitRender(Dr.END,this.totalBounds),Wn.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 At,this.renderOptions={},t)this.emitRender(Dr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Dr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Dr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Dr.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=Nt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new At(s);i.save(),s.spread(yh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),Nt.end(e)}fullRender(){const t=Nt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Nt.end(t)}__render(t,i){const{canvas:s}=this,n=t.includes(this.target.__world),o=n?{includes:n}:{bounds:t,includes:n};this.needFill&&s.fillWorld(t,this.config.fill),Wt.showRepaint&&Wt.drawRepaint(s,t),e.render(this.target,s,o),this.renderBounds=i=i||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),s.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new At;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const t=1e3/(Date.now()-i),{maxFPS:n}=this.config;if(n&&t>n-.5)return e.requestRender(s);this.FPS=Math.min(120,Math.ceil(t)),this.requestTime=0,this.checkRender()};e.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new At(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 At(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 Dr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Dr.REQUEST,this.update,this],[Ar.END,this.__onLayoutEnd,this],[Dr.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)}}yh.clipSpread=10;const{hitRadiusPoint:vh}=Rt;class wh{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||Go.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Go.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=>Go.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&&(!i.isLeafer||"draw"!==i.mode));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||vh(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 xh{constructor(t,e){this.config={},e&&(this.config=m.default(e,this.config)),this.picker=new wh(this.target=t,this),this.finder=Gt.finder&&Gt.finder()}getByPoint(t,i,s){const{target:n,picker:o}=this;return e.backgrounder&&n&&n.updateLayout(),o.getByPoint(t,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 bh(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Eh(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function kh(){return(t,e)=>{const i="_"+e;Vn(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}})}}Object.assign(Gt,{watcher:(t,e)=>new oh(t,e),layouter:(t,e)=>new fh(t,e),renderer:(t,e,i)=>new yh(t,e,i),selector:(t,e)=>new xh(t,e)}),e.layout=fh.fullLayout,e.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Qa,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};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}},Th={number:(t,e)=>g(t)?"percent"===t.type?t.value*e:t.value:t},Ph={},Rh={},Lh={},Ch={},Oh={},Ah={apply(){Vt.need("filter")}},Dh={},Mh={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Ih={list:{},register(t,e){Ih.list[t]=e},get:t=>Ih.list[t]},{parse:Fh,objectToCanvasData:Wh}=Wi,{stintSet:zh}=m,{hasTransparent:Uh}=Bh,Hh={},Nh=Wt.get("UIData");class Yh extends v{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,Nh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Nh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(zh(this,"__isTransparentFill",Uh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):g(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(zh(this,"__isTransparentStroke",Uh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):g(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&g(t[0])?(this.__setInput("path",t),this._path=e?Fh(t):Wh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Xh(this,"shadow",t)}setInnerShadow(t){Xh(this,"innerShadow",t)}setFilter(t){Xh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Rh.compute("fill",this.__leaf),e&&Rh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),r(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(),p(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Hh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Hh))}__removePaint(t,e){e&&this.__removeInput(t),Lh.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 Xh(t,e,i){t.__setInput(e,i),p(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 Vh extends Yh{}class Gh extends Vh{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 jh extends Vh{__getInputData(t,e){const i=super.__getInputData(t,e);return ge.forEach(t=>delete i[t]),i}}class Kh extends Gh{}class Zh extends Yh{get __usePathBox(){return this.points||this.__pathInputed}}class qh extends Yh{get __boxStroke(){return!this.__pathInputed}}class Jh extends Yh{get __boxStroke(){return!this.__pathInputed}}class $h extends Zh{}class Qh extends Yh{}class tl extends Yh{get __pathInputed(){return 2}}class el extends Vh{}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 Yh{get __useNaturalRatio(){return!1}setFontWeight(t){h(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=Kt.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()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class nl extends qh{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 qh{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&&(t=Oh.getShadowSpread(this,e)),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}},{float:al}=E,hl=new At,ll=new At,dl=new At,cl={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&ul.getValidMove(t.__localBoxBounds,ul.getDragBounds(t),s,e,!0),ul.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:n}=t;s&&ul.getValidScaleOf(t.__localBoxBounds,ul.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],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;return n||(s=Object.assign({},s)),ul.isInnerMode(t,e,i,"width")?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),ul.isInnerMode(t,e,i,"height")?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=al(s.x),s.y=al(s.y),s},getValidScaleOf(t,e,i,s,n,o){let r,a;return o||(n=Object.assign({},n)),hl.set(t).scaleOf(s,n.x,n.y).unsign(),ll.set(hl).add(e),dl.set(hl).intersect(e),r=ul.isInnerMode(t,e,i,"width")?ll.width/hl.width:dl.width/hl.width,a=ul.isInnerMode(t,e,i,"height")?ll.height/hl.height:dl.height/hl.height,n.x=al(dl.width)?n.x*r:1,n.y=al(dl.height)?n.y*a:1,n}},ul=cl,{stintSet:pl}=m,gl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);pl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),pl(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;pl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!Oh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(p(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),pl(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=Rh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Oh.shadow(this,t,h),a&&(s.__isStrokes?Rh.strokes(o,this,t):Rh.stroke(o,this,t)),n&&(s.__isFills?Rh.fills(n,this,t):Rh.fill(n,this,t)),r&&this.__drawAfterFill(t,e),d&&Oh.innerShadow(this,t,h),o&&!a&&(s.__isStrokes?Rh.strokes(o,this,t):Rh.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?Rh.strokes(o,this,t):Rh.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?Rh.fills(n,this,t):Rh.fill(n,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),o&&!a&&(s.__isStrokes?Rh.strokes(o,this,t):Rh.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?Rh.fills(s,this,t):Rh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Rh.strokes(n,this,t):Rh.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&&Rh.stroke(n,t,e),s&&Rh.fill(s,t,e),o&&t.__drawAfterFill(e,i),n&&!r&&Rh.stroke(n,t,e)}const fl={__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 ml,yl;t.UI=ml=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){E.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 Tn.set(this.path=t||[]),t||this.__drawPathByBox(Tn),Tn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return h(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||(Tn.set(i=[]),this.__drawPathByBox(Tn)),t?Wi.toCanvasData(i,!0):i}getPathString(t,e,i){return Wi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Dh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Sn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ph.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?zs.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,d(o)?[o]:o)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Rh.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=m.clone(this.toJSON());return t&&Object.assign(e,t),ml.one(e)}static one(t,e,i,s,n){return Kt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Ao()(this)}static registerData(t){ko(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},te([ko(Yh)],t.UI.prototype,"__",void 0),te([kh()],t.UI.prototype,"zoomLayer",void 0),te([Jn("")],t.UI.prototype,"id",void 0),te([Jn("")],t.UI.prototype,"name",void 0),te([Jn("")],t.UI.prototype,"className",void 0),te([po("pass-through")],t.UI.prototype,"blendMode",void 0),te([_o(1)],t.UI.prototype,"opacity",void 0),te([fo(!0)],t.UI.prototype,"visible",void 0),te([po(!1)],t.UI.prototype,"locked",void 0),te([go(!1)],t.UI.prototype,"dim",void 0),te([go(!1)],t.UI.prototype,"dimskip",void 0),te([vo(0)],t.UI.prototype,"zIndex",void 0),te([wo(!1)],t.UI.prototype,"mask",void 0),te([xo(!1)],t.UI.prototype,"eraser",void 0),te([$n(0,!0)],t.UI.prototype,"x",void 0),te([$n(0,!0)],t.UI.prototype,"y",void 0),te([so(100,!0)],t.UI.prototype,"width",void 0),te([so(100,!0)],t.UI.prototype,"height",void 0),te([eo(1,!0)],t.UI.prototype,"scaleX",void 0),te([eo(1,!0)],t.UI.prototype,"scaleY",void 0),te([io(0,!0)],t.UI.prototype,"rotation",void 0),te([io(0,!0)],t.UI.prototype,"skewX",void 0),te([io(0,!0)],t.UI.prototype,"skewY",void 0),te([$n(0,!0)],t.UI.prototype,"offsetX",void 0),te([$n(0,!0)],t.UI.prototype,"offsetY",void 0),te([Qn(0,!0)],t.UI.prototype,"scrollX",void 0),te([Qn(0,!0)],t.UI.prototype,"scrollY",void 0),te([to()],t.UI.prototype,"origin",void 0),te([to()],t.UI.prototype,"around",void 0),te([Jn(!1)],t.UI.prototype,"lazy",void 0),te([no(1)],t.UI.prototype,"pixelRatio",void 0),te([uo(0)],t.UI.prototype,"renderSpread",void 0),te([ro()],t.UI.prototype,"path",void 0),te([ao()],t.UI.prototype,"windingRule",void 0),te([ao(!0)],t.UI.prototype,"closed",void 0),te([so(0)],t.UI.prototype,"padding",void 0),te([so(!1)],t.UI.prototype,"lockRatio",void 0),te([so()],t.UI.prototype,"widthRange",void 0),te([so()],t.UI.prototype,"heightRange",void 0),te([Jn(!1)],t.UI.prototype,"draggable",void 0),te([Jn()],t.UI.prototype,"dragBounds",void 0),te([Jn("auto")],t.UI.prototype,"dragBoundsType",void 0),te([Jn(!1)],t.UI.prototype,"editable",void 0),te([bo(!0)],t.UI.prototype,"hittable",void 0),te([bo("path")],t.UI.prototype,"hitFill",void 0),te([co("path")],t.UI.prototype,"hitStroke",void 0),te([bo(!1)],t.UI.prototype,"hitBox",void 0),te([bo(!0)],t.UI.prototype,"hitChildren",void 0),te([bo(!0)],t.UI.prototype,"hitSelf",void 0),te([bo()],t.UI.prototype,"hitRadius",void 0),te([Eo("")],t.UI.prototype,"cursor",void 0),te([po()],t.UI.prototype,"fill",void 0),te([co(void 0,!0)],t.UI.prototype,"stroke",void 0),te([co("inside")],t.UI.prototype,"strokeAlign",void 0),te([co(1,!0)],t.UI.prototype,"strokeWidth",void 0),te([co(!1)],t.UI.prototype,"strokeWidthFixed",void 0),te([co("none")],t.UI.prototype,"strokeCap",void 0),te([co("miter")],t.UI.prototype,"strokeJoin",void 0),te([co()],t.UI.prototype,"dashPattern",void 0),te([co(0)],t.UI.prototype,"dashOffset",void 0),te([co(10)],t.UI.prototype,"miterLimit",void 0),te([ao(0)],t.UI.prototype,"cornerRadius",void 0),te([ao()],t.UI.prototype,"cornerSmoothing",void 0),te([bh()],t.UI.prototype,"shadow",void 0),te([bh()],t.UI.prototype,"innerShadow",void 0),te([bh()],t.UI.prototype,"blur",void 0),te([bh()],t.UI.prototype,"backgroundBlur",void 0),te([bh()],t.UI.prototype,"grayscale",void 0),te([bh()],t.UI.prototype,"filter",void 0),te([po()],t.UI.prototype,"placeholderColor",void 0),te([Jn(100)],t.UI.prototype,"placeholderDelay",void 0),te([Jn({})],t.UI.prototype,"data",void 0),te([Ro(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=ml=te([Oo(rl),Oo(gl),Lo()],t.UI),t.Group=class extends t.UI{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(){}},te([ko(Vh)],t.Group.prototype,"__",void 0),te([so(0)],t.Group.prototype,"width",void 0),te([so(0)],t.Group.prototype,"height",void 0),t.Group=te([Oo(t.Branch),Ao()],t.Group);const vl=Wt.get("Leafer");t.Leafer=yl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&In.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),yl.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,m.assign(s,t));const n=this.canvas=Gt.canvas(s);this.__controllers.push(this.renderer=Gt.renderer(this,n,s),this.watcher=Gt.watcher(this,s),this.layouter=Gt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=Gt.selector(this),this.interaction=Gt.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Gt.hitCanvasManager()),this.canvasManager=new Qt,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))),hr.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(Mr.RESTART):this.emitLeafer(Mr.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(Mr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=m.copyAttrs({},t,ge);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new At(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=m.copyAttrs({},this.canvas,ge);e.resize(t),this.updateLazyBounds(),this.__onResize(new Cr(t,i))}__onResize(t){this.emitEvent(t),m.copyAttrs(this.__,t,ge),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&&(ge.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())):"mode"===t&&this.emit(Mr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ge.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=m.copyAttrs({},s,ge);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(Mr.BEFORE_READY),this.emitLeafer(Mr.READY),this.emitLeafer(Mr.AFTER_READY),hr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Mr.VIEW_READY),hr.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){hr.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(Mr.VIEW_COMPLETED),hr.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 Mr(t,this))}__listenEvents(){const t=Nt.start("FirstCreate "+this.innerName);this.once([[Mr.START,()=>Nt.end(t)],[Ar.START,this.updateLazyBounds,this],[Dr.START,this.__onCreated,this],[Dr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Or.DATA,this.__onWatchData,this],[Ar.END,this.__onLayoutEnd,this],[Dr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){yl.list.remove(this);try{this.stop(),this.emitLeafer(Mr.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(()=>{Wn.clearRecycled()},100)}catch(t){vl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Qa,te([ko(jh)],t.Leafer.prototype,"__",void 0),te([so()],t.Leafer.prototype,"pixelRatio",void 0),te([Jn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=yl=te([Ao()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},te([ko(qh)],t.Rect.prototype,"__",void 0),t.Rect=te([Oo(fl),Lo(),Ao()],t.Rect);const{add:wl,includes:xl,scroll:bl}=Rt,El=t.Rect.prototype,kl=t.Group.prototype;t.Box=class extends t.Group{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();m.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))}},te([ko(Gh)],t.Box.prototype,"__",void 0),te([so(100)],t.Box.prototype,"width",void 0),te([so(100)],t.Box.prototype,"height",void 0),te([Jn(!1)],t.Box.prototype,"resizeChildren",void 0),te([uo("show")],t.Box.prototype,"overflow",void 0),te([Ro(El.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),te([Ro(El.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),te([Ro(El.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),te([Ro(El.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),te([Ro(El.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),te([Ro(El.__updateChange)],t.Box.prototype,"__updateRectChange",null),te([Ro(El.__render)],t.Box.prototype,"__renderRect",null),te([Ro(kl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=te([Lo(),Ao()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},te([ko(Kh)],t.Frame.prototype,"__",void 0),te([po("#FFFFFF")],t.Frame.prototype,"fill",void 0),te([uo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=te([Ao()],t.Frame);const{moveTo:Sl,closePath:Bl,ellipse:Tl}=as;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:o}=this.__,r=t/2,a=i/2,h=this.__.path=[];s?(n||o?(s<1&&Tl(h,r,a,r*s,a*s,0,n,o,!1),Tl(h,r,a,r,a,0,o,n,!0),s<1&&Bl(h)):(s<1&&(Tl(h,r,a,r*s,a*s),Sl(h,t,a)),Tl(h,r,a,r,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||o?(Sl(h,r,a),Tl(h,r,a,r,a,0,n,o,!1),Bl(h)):Tl(h,r,a,r,a)}},te([ko(Jh)],t.Ellipse.prototype,"__",void 0),te([ao(0)],t.Ellipse.prototype,"innerRadius",void 0),te([ao(0)],t.Ellipse.prototype,"startAngle",void 0),te([ao(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=te([Ao()],t.Ellipse);const{sin:Pl,cos:Rl,PI:Ll}=Math,{moveTo:Cl,lineTo:Ol,closePath:Al,drawPoints:Dl}=as;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Dl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,o=i/2,r=s/2;Cl(e,o,0);for(let t=1;t<n;t++)Ol(e,o+o*Pl(2*t*Ll/n),r-r*Rl(2*t*Ll/n));Al(e)}}},te([ko($h)],t.Polygon.prototype,"__",void 0),te([ao(3)],t.Polygon.prototype,"sides",void 0),te([ao()],t.Polygon.prototype,"points",void 0),te([ao(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=te([Lo(),Ao()],t.Polygon);const{sin:Ml,cos:Il,PI:Fl}=Math,{moveTo:Wl,lineTo:zl,closePath:Ul}=as;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,o=e/2,r=this.__.path=[];Wl(r,n,0);for(let t=1;t<2*i;t++)zl(r,n+(t%2==0?n:n*s)*Ml(t*Fl/i),o-(t%2==0?o:o*s)*Il(t*Fl/i));Ul(r)}},te([ko(Qh)],t.Star.prototype,"__",void 0),te([ao(5)],t.Star.prototype,"corners",void 0),te([ao(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=te([Ao()],t.Star);const{moveTo:Hl,lineTo:Nl,drawPoints:Yl}=as,{rotate:Xl,getAngle:Vl,getDistance:Gl,defaultPoint:jl}=Z;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Xl(i,e),i}set toPoint(t){this.width=Gl(jl,t),this.rotation=Vl(jl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Yl(e,t.points,t.curve,t.closed):(Hl(e,0,0),Nl(e,this.width,0))}},te([ko(Zh)],t.Line.prototype,"__",void 0),te([ho("center")],t.Line.prototype,"strokeAlign",void 0),te([so(0)],t.Line.prototype,"height",void 0),te([ao()],t.Line.prototype,"points",void 0),te([ao(0)],t.Line.prototype,"curve",void 0),te([ao(!1)],t.Line.prototype,"closed",void 0),t.Line=te([Ao()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return p(t)&&t[0].image}},te([ko(nl)],t.Image.prototype,"__",void 0),te([so("")],t.Image.prototype,"url",void 0),t.Image=te([Ao()],t.Image);const Kl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Gt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Xn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new kr(kr.LOADED,{image:t}))})}draw(t,e,i,s){const n=new it(t.worldTransform).invert(),o=new it;e&&o.translate(e.x,e.y),i&&(d(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()}},te([ko(ol)],t.Canvas.prototype,"__",void 0),te([Eh(100)],t.Canvas.prototype,"width",void 0),te([Eh(100)],t.Canvas.prototype,"height",void 0),te([Eh(1)],t.Canvas.prototype,"pixelRatio",void 0),te([Eh(!0)],t.Canvas.prototype,"smooth",void 0),te([Jn(!1)],t.Canvas.prototype,"safeResize",void 0),te([Eh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=te([Ao()],t.Canvas);const{copyAndSpread:Zl,includes:ql,spread:Jl,setList:$l}=Rt;t.Text=class extends t.UI{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=Th.number(e,n),t.__letterSpacing=Th.number(i,n),t.__padding=l?E.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&&Jl(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),m.stintSet(this,"isOverflow",!ql(h,a)),this.isOverflow?($l(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Zl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__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()}},te([ko(sl)],t.Text.prototype,"__",void 0),te([so(0)],t.Text.prototype,"width",void 0),te([so(0)],t.Text.prototype,"height",void 0),te([po()],t.Text.prototype,"boxStyle",void 0),te([Jn(!1)],t.Text.prototype,"resizeFontSize",void 0),te([po("#000000")],t.Text.prototype,"fill",void 0),te([ho("outside")],t.Text.prototype,"strokeAlign",void 0),te([bo("all")],t.Text.prototype,"hitFill",void 0),te([so("")],t.Text.prototype,"text",void 0),te([so("")],t.Text.prototype,"placeholder",void 0),te([so("caption")],t.Text.prototype,"fontFamily",void 0),te([so(12)],t.Text.prototype,"fontSize",void 0),te([so("normal")],t.Text.prototype,"fontWeight",void 0),te([so(!1)],t.Text.prototype,"italic",void 0),te([so("none")],t.Text.prototype,"textCase",void 0),te([so("none")],t.Text.prototype,"textDecoration",void 0),te([so(0)],t.Text.prototype,"letterSpacing",void 0),te([so({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),te([so(0)],t.Text.prototype,"paraIndent",void 0),te([so(0)],t.Text.prototype,"paraSpacing",void 0),te([so("x")],t.Text.prototype,"writingMode",void 0),te([so("left")],t.Text.prototype,"textAlign",void 0),te([so("top")],t.Text.prototype,"verticalAlign",void 0),te([so(!0)],t.Text.prototype,"autoSizeAlign",void 0),te([so("normal")],t.Text.prototype,"textWrap",void 0),te([so("show")],t.Text.prototype,"textOverflow",void 0),te([po(!1)],t.Text.prototype,"textEditing",void 0),t.Text=te([Ao()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},te([ko(tl)],t.Path.prototype,"__",void 0),te([ho("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=te([Ao()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),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")}},te([ko(el)],t.Pen.prototype,"__",void 0),te([(t,e)=>{Vn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=te([Oo(ks,["set","path","paint"]),Ao()],t.Pen),t.App=class extends t.Leafer{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&&Gt.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(e){const i=new t.Leafer(e);return this.add(i),i}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),r(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&&m.assign(e,t),this.autoLayout&&m.copyAttrs(e,this,ge),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Ar.END,this.__onReady,this],[Dr.START,this.__onCreated,this],[Dr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Dr.END,this.__onChildRenderEnd,this))}},t.App=te([Ao()],t.App);const Ql={},td={isHoldSpaceKey:()=>td.isHold("Space"),isHold:t=>Ql[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Ql[t]||(Ql[t]=!0)},setUpCode(t){Ql[t]=!1}},ed={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 id extends vr{get spaceKey(){return td.isHoldSpaceKey()}get left(){return ed.left(this)}get right(){return ed.right(this)}get middle(){return ed.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return td.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){Jt.changeName(t,e)}}t.PointerEvent=class extends id{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=te([Do()],t.PointerEvent);const sd=t.PointerEvent,nd={};t.DragEvent=class extends t.PointerEvent{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 Z.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),cl.axisMove(t,n),n}static limitMove(t,e){cl.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(nd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(nd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(nd,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 Rt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Rt.unsign(i),i}assignMove(t){nd.x=t?this.totalX:this.moveX,nd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=te([Do()],t.DragEvent);const od=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=te([Do()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=te([Do()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=te([Do()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=te([Do()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=te([Do()],t.ZoomEvent),t.KeyEvent=class extends id{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=te([Do()],t.KeyEvent);const rd={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:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.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:ad.getSwipeDirection(Z.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:r(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:e=>e&&e.list.some(e=>Go.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},ad=rd,hd=new Qa,{getDragEventData:ld,getDropEventData:dd,getSwipeEventData:cd}=rd;class ud{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(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,o=t.DragEvent.list||this.draggableList||hd;return this.dragging&&(n?e?hd:new Qa(i?[...s.list,...s.dragHoverExclude]:s.list):o)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&ed.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.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],Go.draggable(e)){this.draggableList=new Qa(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:o,throughPath:r}=n;this.dragData=ld(n,s,e),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:o}=this.dragData,{dragLimitAnimate:r}=i.p,a=!r||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},a||n);r&&!n&&e?Go.animateMove(i,l,d(r)?r:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:o,throughPath:r}=s,a=ld(s,e,e);if(r&&(a.throughPath=r),a.path=o,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const o=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(Z.getDistance(e,t)>n.config.pointer.swipeDistance){const t=cd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=dd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.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 pd=Wt.get("emit");const gd=["move","zoom","rotate","key"];function _d(t,e,i,s,n){if(gd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!md(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&&fd(o,e,i,s,n)}}function fd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!md(t,n)&&(Mh.updateEventStyle&&!s&&Mh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=Jt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function md(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:vd,pathCanDrag:wd,pathHasOutside:xd}=rd;class bd{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&&ed.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&ed.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&td.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=m.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 ud(this),s&&(this.config=m.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(ed.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),ed.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=ed.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&ed.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=Z.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;ed.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,td.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,td.setUpCode(i),this.emit(t.KeyEvent.UP,e,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(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,o=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>vd(e.path,t));n<i.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:o,target:r}=this;e.backgrounder||t.origin||r&&r.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:o,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.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&&!wd(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(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}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&&Z.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}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(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(vd(e.path,t.PointerEvent.LONG_TAP)||vd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new At(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Cr.RESIZE,this.__onResize,this)],t.once(Mr.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],fd(n,t,e,!0,s))return;n.isApp&&_d(n,t,e,!0,s)}for(let o=0,r=i.length;o<r;o++)if(n=i.list[o],n.isApp&&_d(n,t,e,!1,s),fd(n,t,e,!1,s))return}catch(t){pd.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 Ed{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ed.custom={};class kd extends Qt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Qa,this.pixelList=new Qa}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Gt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Gt.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()}}e.getSelector=function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Gt.selector())};const{toInnerRadiusPointOf:Sd,copy:Bd,setRadius:Td}=Z,{hitRadiusPoint:Pd,hitPoint:Rd}=Rt,Ld={},Cd={},Od=t.Leaf.prototype;Od.hit=function(t,i=0){this.updateLayout(),Bd(Cd,t),Td(Cd,i);const s=this.__world;return!!(i?Pd(s,Cd):Rd(s,Cd))&&(this.isBranch?e.getSelector(this).hitPoint(Object.assign({},Cd),i,{target:this}):this.__hitWorld(Cd))},Od.__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&&(Bd(Ld,t),Td(t=Ld,e.hitRadius)),Sd(t,i,Ld),e.hitBox||n){if(Rt.hitRadiusPoint(s.boxBounds,Ld))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Ld)},Od.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Od.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Od.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Od.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Ad=new it,Dd=t.UI.prototype;Dd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.leafer||this.parent&&this.parent.leafer;if(!t)return;const i=this.__,{hitCanvasManager:s}=t,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:t}=this.__layout,s=e.image.hitCanvasSize,r=a.hitScale=Dt.set(0,0,s,s).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=Dt.set(t).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Wn.patternLocked=!0,this.__renderShape(a,{matrix:Ad.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!o}),Wn.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},Dd.__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 Md=t.UI.prototype,Id=t.Rect.prototype,Fd=t.Box.prototype;Id.__updateHitCanvas=Fd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Md.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Id.__hitFill=Fd.__hitFill=function(t){return this.__hitCanvas?Md.__hitFill.call(this,t):Rt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.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))},t.Group.prototype.pick=function(t,i){return i||(i=o),this.updateLayout(),e.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Wd=_e.prototype;function zd(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 Ud(t,e){t.__.__font?zd(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Hd(t,e,i){switch(e.__.strokeAlign){case"center":Nd(t,1,e,i);break;case"inside":Yd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Nd(t,2,e,i):Yd(t,"outside",e,i)}}function Nd(t,e,i,s){const n=i.__;g(t)?Vd(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Xd(i,s))}function Yd(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Nd(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",zd(i,n),n.blendMode="normal",Go.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Xd(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 Vd(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?Xd(s,n):n.stroke(),n.restoreBlendMode()):i?Xd(s,n):n.stroke()}}function Gd(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Hd(t,e,i);else switch(s.strokeAlign){case"center":jd(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),jd(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)jd(t,2,e,i);else{const{renderBounds:n}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),jd(t,2,e,o),o.clipUI(s),o.clearWorld(n),Go.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i)}}function jd(t,e,i,s){const n=i.__;g(t)?Vd(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Rh.strokeArrow(t,i,s)}Wd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Wd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Wd.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:o,radiusY:r}=t;e&&(s-=e.x,n-=e.y),Dt.set(s-o,n-r,2*o,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Dt.x,Dt.y,Dt.width||1,Dt.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:Kd,getOuterOf:Zd,getByMove:qd,getIntersectData:Jd}=Rt;let $d;const{stintSet:Qd}=m,{hasTransparent:tc}=Bh;function ec(t,e,i){if(!g(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,!$d||!$d[e.url]);break;case"linear":s=Ch.linearGradient(e,n);break;case"radial":s=Ch.radialGradient(e,n);break;case"angular":s=Ch.conicGradient(e,n);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:Bh.string(a,h)};break;default:r(e.r)||(s={type:"solid",style:Bh.string(e)})}if(s){if(h(s.style)&&tc(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 ic={compute:function(t,e){const i=e.__,s=[];let n,o,r,a=i.__input[t];p(a)||(a=[a]),$d=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?(Qd(i,"__isAlphaPixelFill",n),Qd(i,"__isTransparentFill",o)):(Qd(i,"__isAlphaPixelStroke",n),Qd(i,"__isTransparentStroke",o),Qd(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,Ud(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),Ud(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Ud(e,i),i.restoreBlendMode()):Ud(e,i)}},fillPathOrText:Ud,fillText:zd,stroke:Gd,strokes:function(t,e,i){Gd(t,e,i)},strokeText:Hd,drawTextStroke:Xd,shape:function(t,i,s){const n=i.getSameCanvas(),o=t.__nowWorld,r=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:p}=t.getRenderScaleData(!0);if(r.includes(o))c=n,a=d=o;else{const{renderShapeSpread:n}=t.__layout;let g;if(e.fullImageShadow)g=o;else{const t=n?Kd(r,u===p?n*u:[n*p,n*u]):r;g=Jd(t,o)}l=r.getFitMatrix(g);let{a:_,d:f}=l;l.a<1&&(c=i.getSameCanvas(),t.__renderShape(c,s),u*=_,p*=f),d=Zd(o,l),a=qd(d,-l.e,-l.f);const m=s.matrix;m?(h=new it(l),h.multiply(m),_*=m.scaleX,f*=m.scaleY):h=l,h.withScale(_,f),s=Object.assign(Object.assign({},s),{matrix:h})}return t.__renderShape(n,s),{canvas:n,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:p}}};let sc={},nc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:oc,rotateOfOuter:rc,translate:ac,scaleOfOuter:hc,multiplyParent:lc,scale:dc,rotate:cc,skew:uc}=W;function pc(t,e,i,s,n,o,r){const a=oc();ac(a,e.x+i,e.y+s),dc(a,n,o),r&&rc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function gc(t,e,i,s,n,o,r,a,h){const l=oc();fc(l,e,i,s,n,o,r,a),h&&(nc.a=e.width/h.width,nc.d=e.height/h.height,lc(l,nc)),t.transform=l}function _c(t,e,i,s,n,o,r,a,h,l,d,c){const u=oc();if(c)fc(u,e,n,o,r,a,h,l);else{if(h)if("center"===d)rc(u,{x:i/2,y:s/2},h);else switch(cc(u,h),h){case 90:ac(u,s,0);break;case 180:ac(u,i,s);break;case 270:ac(u,0,i)}sc.x=e.x+n,sc.y=e.y+o,ac(u,sc.x,sc.y),r&&hc(u,sc,r,a)}t.transform=u}function fc(t,e,i,s,n,o,r,a){r&&cc(t,r),a&&uc(t,a.x,a.y),n&&dc(t,n,o),ac(t,e.x+i,e.y+s)}const{get:mc,translate:yc}=W,vc=new At,wc={},xc={};function bc(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=Ec(i,s,e)}function Ec(t,e,i){t.padding&&(e=vc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:o,mode:r,align:a,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==a&&(u||0)%180==90;let b,k;switch(Rt.set(xc,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((d||c)&&(E.getScaleData(d,c,i,wc),b=wc.scaleX,k=wc.scaleY),(a||m||f)&&(b&&Rt.scale(xc,b,k,!0),a&&ut.toPoint(a,xc,e,xc,!0,!0))):v&&!u||(b=k=Rt.getFitScale(e,xc,"fit"!==r),Rt.put(e,i,a,b,!1,xc),Rt.scale(xc,b,k,!0)),l&&Z.move(xc,l),r){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(xc.x||xc.y||b||_||u||p)&&gc(w,e,xc.x,xc.y,b,k,u,p,t.clipSize);break;case"repeat":(!v||b||u||p)&&_c(w,e,s,n,xc.x,xc.y,b,k,u,p,a,t.freeTransform),f||(w.repeat="repeat");const i=g(f);(m||i)&&(w.gap=function(t,e,i,s,n){let o,r;g(t)?(o=t.x,r=t.y):o=r=t;return{x:kc(o,i,n.width,e&&e.x),y:kc(r,s,n.height,e&&e.y)}}(m,i&&f,xc.width,xc.height,e));break;default:b&&pc(w,e,xc.x,xc.y,b,k,u)}return w.transform||(e.x||e.y)&&(w.transform=mc(),yc(w.transform,e.x,e.y)),b&&"stretch"!==r&&(w.scaleX=b,w.scaleY=k),w.width=s,w.height=n,o&&(w.opacity=o),y&&(w.filters=y),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function kc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Sc,Bc=new At;const{isSame:Tc}=Rt;function Pc(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||bc(n,s,i,o),!0}function Rc(t,e){Oc(t,kr.LOAD,e)}function Lc(t,e){Oc(t,kr.LOADED,e)}function Cc(t,e,i){e.error=i,t.forceUpdate("surface"),Oc(t,kr.ERROR,e)}function Oc(t,e,i){t.hasEvent(e)&&t.emitEvent(new kr(e,i))}function Ac(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Dc,scale:Mc,copy:Ic}=W,{floor:Fc,ceil:Wc,max:zc,abs:Uc}=Math;function Hc(t,i,s){let{scaleX:n,scaleY:o}=t.getRenderScaleData(!0,i.scaleFixed);const r=n+"-"+o+"-"+s;if(i.patternId===r||t.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:p,scaleY:g,transform:_,repeat:f,gap:m}=h;n*=s,o*=s,p&&(p=Uc(p),g=Uc(g),d=Dc(),Ic(d,_),Mc(d,1/p,1/g),n*=p,o*=g),c*=n,u*=o;const y=c*u;if(!f&&y>e.image.maxCacheSize)return!1;let v=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Wc(t))}else{const t=a.width*a.height;v>t&&(v=t)}y>v&&(l=Math.sqrt(y/v)),l&&(n/=l,o/=l,c/=l,u/=l),p&&(n/=p,o/=g);const w=m&&m.x*n,x=m&&m.y*o;if(_||1!==n||1!==o){const t=c+(w||0),e=u+(x||0);n/=t/zc(Fc(t),1),o/=e/zc(Fc(e),1),d||(d=Dc(),_&&Ic(d,_)),Mc(d,1/n,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,t.leafer&&t.leafer.config.smooth),E=a.getPattern(b,f||e.origin.noRepeat||"no-repeat",d,i);return i.style=E,i.patternId=r,!0}}const Nc={image:function(t,e,i,s,n){let o,r;const a=Wn.get(i);return Sc&&i===Sc.paint&&Tc(s,Sc.boxBounds)?o=Sc.leafPaint:(o={type:i.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Sc=a.use>1?{leafPaint:o,paint:i,boxBounds:Bc.set(s)}:null),(n||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(Pc(t,e,i,a,o,s),n&&(Rc(t,r),Lc(t,r))):a.error?n&&Cc(t,r,a.error):(n&&(Ac(t,!0),Rc(t,r)),o.loadId=a.load(()=>{Ac(t,!1),t.destroyed||(Pc(t,e,i,a,o,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Lc(t,r)),o.loadId=void 0},e=>{Ac(t,!1),Cc(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(t,i,s,n){const{scaleX:o,scaleY:r}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===o+"-"+r+"-"+a&&!Dh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&Cr.isResizing(t)||Dh.running)){let{width:t,height:i}=h;t*=o*a,i*=r*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__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()}(t,i,s,h),!0):(!s.style||s.sync||Dh.running?Hc(t,s,a):s.patternTask||(s.patternTask=Wn.patternTasker.add(()=>ee(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Hc(t,s,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Hc,recycleImage:function(t,e){const i=e["_"+t];if(p(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,Wn.recycle(n),n.loading&&(r||(r=e.__input&&e.__input[t]||[],p(r)||(r=[r])),n.unload(i[h].loadId,!r.some(t=>t.url===a))));return o}return null},createData:bc,getPatternData:Ec,fillOrFitMode:pc,clipMode:gc,repeatMode:_c},{toPoint:Yc}=lt,{hasTransparent:Xc}=Bh,Vc={},Gc={};function jc(t,e,i,s){if(i){let n,o,r,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(r=t/(l-1),o=Bh.string(n,s)):(r=n.offset,o=Bh.string(n.color,s)),e.addColorStop(r,o),!a&&Xc(o)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Kc,getDistance:Zc}=Z,{get:qc,rotateOfOuter:Jc,scaleOfOuter:$c}=W,{toPoint:Qc}=lt,tu={},eu={};function iu(t,e,i,s,n){let o;const{width:r,height:a}=t;if(r!==a||s){const t=Kc(e,i);o=qc(),n?($c(o,e,r/a*(s||1),1),Jc(o,e,t+90)):($c(o,e,1,r/a*(s||1)),Jc(o,e,t))}return o}const{getDistance:su}=Z,{toPoint:nu}=lt,ou={},ru={};const au={linearGradient:function(t,i){let{from:s,to:n,type:o,opacity:r}=t;Yc(s||"top",i,Vc),Yc(n||"bottom",i,Gc);const a=e.canvas.createLinearGradient(Vc.x,Vc.y,Gc.x,Gc.y),h={type:o,style:a};return jc(h,a,t.stops,r),h},radialGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;Qc(s||"center",i,tu),Qc(n||"bottom",i,eu);const h=e.canvas.createRadialGradient(tu.x,tu.y,0,tu.x,tu.y,Zc(tu,eu)),l={type:o,style:h};jc(l,h,t.stops,r);const d=iu(i,tu,eu,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:o,opacity:r,stretch:a}=t;nu(s||"center",i,ou),nu(n||"bottom",i,ru);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,ou.x,ou.y):e.canvas.createRadialGradient(ou.x,ou.y,0,ou.x,ou.y,su(ou,ru)),l={type:o,style:h};jc(l,h,t.stops,r);const d=iu(i,ou,ru,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:iu},{copy:hu,toOffsetOutBounds:lu}=Rt,du={},cu={};function uu(t,i,s,n){const{bounds:o,shapeBounds:r}=n;if(e.fullImageShadow){if(hu(du,t.bounds),du.x+=i.x-r.x,du.y+=i.y-r.y,s){const{fitMatrix:t}=n;du.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),du.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),du.width*=s,du.height*=s}t.copyWorld(n.canvas,t.bounds,du)}else s&&(hu(du,i),du.x-=i.width/2*(s-1),du.y-=i.height/2*(s-1),du.width*=s,du.height*=s),t.copyWorld(n.canvas,r,s?du:i)}const{toOffsetOutBounds:pu}=Rt,gu={};const _u={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,p=e.getSameCanvas(),g=a.length-1;lu(l,cu),a.forEach((a,_)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.setWorldShadow(cu.offsetX+a.x*c*f,cu.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,uu(p,cu,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,o,"copy"),s=o),h?p.copyWorld(h,o,o,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),Oh.isTransformShadow(a)?Oh.renderTransformShadow(t,e,p,s,a):Go.copyCanvasByWorld(t,e,p,s,a.blendMode),g&&_<g&&p.clearWorld(s)}),p.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,p=e.getSameCanvas(),g=a.length-1;pu(l,gu),a.forEach((a,_)=>{let f=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(gu.offsetX+a.x*c*f,gu.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,uu(p,gu,n,i),p.restore(),h?(p.copyWorld(p,l,o,"copy"),p.copyWorld(h,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,Bh.string(a.color),"source-in"),Go.copyCanvasByWorld(t,e,p,s,a.blendMode),g&&_<g&&p.clearWorld(s)}),p.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){},getShadowSpread:function(t,e){let i=0;return e.forEach(t=>i=Math.max(i,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread>0?t.spread:0)+1.5*t.blur)),i},isTransformShadow(t){}},{excludeRenderBounds:fu}=tr;let mu;function yu(t,e,i,s,n,o,r,a){switch(e){case"grayscale":mu||(mu=!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);wu(t,e,i,1,n,o)}(t,i,s,n,r,a);break;case"opacity-path":wu(t,i,s,o,r,a);break;case"path":a&&i.restore()}}function vu(t){return t.getSameCanvas(!1,!0)}function wu(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)}t.Group.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,mu=!1,"path"===a||"clipping-path"===a?(o<1?(r="opacity-path",n||(n=vu(t))):(r="path",t.save()),i.__clip(n||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=vu(t)),n||(n=vu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||fu(i,e)||i.__render(t,e);continue}const d=1===o&&i.__.__blendMode;d&&yu(this,r,t,n,s,o,void 0,!1),fu(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 xu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",bu=xu+"_#~&*+\\=|≮≯≈≠=…",Eu=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 ku(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Su=ku("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Bu=ku("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Tu=ku(xu),Pu=ku(bu),Ru=ku("- —/~|┆·");var Lu;!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"}(Lu||(Lu={}));const{Letter:Cu,Single:Ou,Before:Au,After:Du,Symbol:Mu,Break:Iu}=Lu;function Fu(t){return Su[t]?Cu:Ru[t]?Iu:Bu[t]?Au:Tu[t]?Du:Pu[t]?Mu:Eu.test(t)?Ou:Cu}const Wu={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 zu(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:Uu}=Wu,{Letter:Hu,Single:Nu,Before:Yu,After:Xu,Symbol:Vu,Break:Gu}=Lu;let ju,Ku,Zu,qu,Ju,$u,Qu,tp,ep,ip,sp,np,op,rp,ap,hp,lp,dp=[];function cp(t,e){ep&&!tp&&(tp=ep),ju.data.push({char:t,width:e}),Zu+=e}function up(){qu+=Zu,ju.width=Zu,Ku.words.push(ju),ju={data:[]},Zu=0}function pp(){rp&&(ap.paraNumber++,Ku.paraStart=!0,rp=!1),ep&&(Ku.startCharSize=tp,Ku.endCharSize=ep,tp=0),Ku.width=qu,hp.width?Uu(Ku):lp&&gp(),dp.push(Ku),Ku={words:[]},qu=0}function gp(){qu>(ap.maxWidth||0)&&(ap.maxWidth=qu)}const{top:_p,right:fp,bottom:mp,left:yp}=t.Direction4;function vp(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 wp={getDrawData:function(t,i){h(t)||(t=String(t));let s=0,n=0,o=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:a,__font:l,__padding:d}=i;d&&(o?(s=d[yp],o-=d[fp]+d[yp]):i.autoSizeAlign||(s=d[yp]),r?(n=d[_p],r-=d[_p]+d[mp]):i.autoSizeAlign||(n=d[_p]));const c={bounds:{x:s,y:n,width:o,height:r},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){ap=t,dp=t.rows,hp=t.bounds,lp=!hp.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:o,textCase:r}=s,{canvas:a}=e,{width:h,height:l}=hp;if(h||l||n||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;rp=!0,sp=null,tp=Qu=ep=Zu=qu=0,ju={data:[]},Ku={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)$u=i[s],"\n"===$u?(Zu&&up(),Ku.paraEnd=!0,pp(),rp=!0):(ip=Fu($u),ip===Hu&&"none"!==r&&($u=zu($u,r,!Zu)),Qu=a.measureText($u).width,n&&(n<0&&(ep=Qu),Qu+=n),np=ip===Nu&&(sp===Nu||sp===Hu)||sp===Nu&&ip!==Xu,op=!(ip!==Yu&&ip!==Nu||sp!==Vu&&sp!==Xu),Ju=rp&&o?h-o:h,t&&h&&qu+Zu+Qu>Ju&&(e?(Zu&&up(),qu&&pp()):(op||(op=ip===Hu&&sp==Xu),np||op||ip===Gu||ip===Yu||ip===Nu||Zu+Qu>Ju?(Zu&&up(),qu&&pp()):qu&&pp()))," "===$u&&!0!==rp&&qu+Zu===0||(ip===Gu?(" "===$u&&Zu&&up(),cp($u,Qu),up()):np||op?(Zu&&up(),cp($u,Qu)):cp($u,Qu)),sp=ip);Zu&&up(),qu&&pp(),dp.length>0&&(dp[dp.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{ap.paraNumber++,qu=a.measureText(t).width,dp.push({x:o||0,text:t,width:qu,paraStart:!0}),lp&&gp()})}(c,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":vp(e,"x",t[yp]);break;case"right":vp(e,"x",-t[fp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":vp(e,"y",t[_p]);break;case"bottom":vp(e,"y",-t[mp])}}(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:p,y:g,width:_,height:f}=s,m=o*n+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,o),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,w,x,b=_||u?_:t.maxWidth;for(let r=0,d=n;r<d;r++){if(v=i[r],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=o,t.overflow>r&&y>m&&(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&&_&&_<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(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(t,i,s,n){if(!n)return;const{rows:o,overflow:r}=t;let{textOverflow:a}=i;if(o.splice(r),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?o:[o[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,i,s,o),"none"!==a&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:o}=e;switch(t.decorationHeight=n/11,g(o)?(i=o.type,o.color&&(t.decorationColor=Bh.string(o.color)),o.offset&&(s=Math.min(.3*n,Math.max(o.offset,.15*-n)))):i=o,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(c,i),c}};const xp={string:function(t,e){const i=d(e)&&e<1;if(h(t)){if(!i||!Bh.object)return t;t=Bh.object(t)}let s=r(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 bp(t){return t?p(t)?t:[t]:[]}Object.assign(Sh,wp),Object.assign(Bh,xp),Object.assign(Rh,ic),Object.assign(Lh,Nc),Object.assign(Ch,au),Object.assign(Oh,_u),Object.assign(Gt,{interaction:(t,e,i,s)=>new bd(t,e,i,s),hitCanvas:(t,e)=>new eh(t,e),hitCanvasManager:()=>new kd}),sh();class Ep extends vr{get list(){return bp(this.value)}get oldList(){return bp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function kp(t){return(e,i)=>{const s="_"+i;Vn(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const o=this;if(o.config){const t="target"===i;if(t){o.setDimOthers(!1),o.setBright(!1),p(e)&&e.length>1&&e[0].locked&&e.splice(0,1),o.single&&(o.element.syncEventer=null);const{beforeSelect:t}=o.config;if(t){const i=t({target:e});if(g(i))e=i;else if(!1===i)return}}const s=t?Ep.BEFORE_SELECT:Ep.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Ep(s,{editor:o,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Ep.BEFORE_SELECT="editor.before_select",Ep.SELECT="editor.select",Ep.AFTER_SELECT="editor.after_select",Ep.BEFORE_HOVER="editor.before_hover",Ep.HOVER="editor.hover";const{abs:Sp}=Math,{copy:Bp,scale:Tp}=W,{setListWithFn:Pp}=Rt,{worldBounds:Rp}=tr,Lp={a:1,b:0,c:0,d:1,e:0,f:0},Cp={x:0,y:0,width:0,height:0};class Op extends t.UI{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?(Pp(Cp,e,Rp),t&&this.set(t),this.set(Cp),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:a}=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=Sp(c.scaleX),l=Sp(c.scaleY);if(Bp(Lp,c),Lp.half=r%2,i!==l){Tp(Lp,1/i,1/l),t.setWorld(Lp,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(Lp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=r/Sp(c.scaleX);o&&(h(o)?Rh.stroke(o,this,t):Rh.strokes(o,this,t)),a&&(h(a)?Rh.fill(a,this,t):Rh.fills(a,this,t))}}n.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}te([kp(function(t){const e=t.target;t.list=e?p(e)?e:[e]:[]})],Op.prototype,"target",void 0);class Ap extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,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 Dp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Mp([t],i,e),i}};function Mp(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&&Mp(s.children,e,i)}}const{findOne:Ip,findByBounds:Fp}=Dp;class Wp extends t.Group{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&"normal"===this.app.mode}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new Op,this.targetStroker=new Op,this.bounds=new At,this.selectArea=new Ap,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(Fp(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)&&!Ip(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Qa(this.editor.editBox.rect)};return Ip(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Ip(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:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[Ep.HOVER,this.onHover,this],[Ep.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:zp,top:Up,topRight:Hp,right:Np,bottomRight:Yp,bottom:Xp,bottomLeft:Vp,left:Gp}=t.Direction9,{toPoint:jp}=lt,{within:Kp,sign:Zp}=E,qp={getScaleData(t,e,i,s,n,o,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:g,dragBounds:_,worldBoxBounds:f}=t,{width:m,height:y}=e;o&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=Zp(v),b=Zp(w),E=a?v:x*u.width/m,k=a?w:b*u.height/y;s.x*=a?v:x,s.y*=a?w:b;const S=(-s.y+y)/y,B=(s.x+m)/m,T=(s.y+y)/y,P=(-s.x+m)/m;switch(i){case Up:c=S,h="bottom";break;case Np:d=B,h="left";break;case Xp:c=T,h="top";break;case Gp:d=P,h="right";break;case zp:c=S,d=P,h="bottom-right";break;case Hp:c=S,d=B,h="bottom-left";break;case Yp:c=T,d=B,h="top-left";break;case Vp:c=T,d=P,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case Up:case Xp:t=c;break;case Gp:case Np:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const R=1!==d,L=1!==c;if(R&&(d/=E),L&&(c/=k),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(jp(o||h,u,l,!0),_){const e={x:d,y:c};cl.limitScaleOf(t,l,e),d=e.x,c=e.y}if(R&&p){const e=u.width*t.scaleX;d=Kp(e*d,p)/e}if(L&&g){const e=u.height*t.scaleY;c=Kp(e*c,g)/e}return R&&Math.abs(d*f.width)<1&&(d=Zp(d)/f.width),L&&Math.abs(c*f.height)<1&&(c=Zp(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 zp:o="bottom-right";break;case Hp:o="bottom-left";break;case Yp:o="top-left";break;case Vp:o="top-right";break;default:o="center"}return jp(n||o,t.boxBounds,r,!0),{origin:r,rotation:Z.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let n,o,r={},a=0,h=0;switch(e){case Up:case zp:o={x:.5,y:0},n="bottom",a=1;break;case Xp:case Yp:o={x:.5,y:1},n="top",a=1;break;case Gp:case Vp:o={x:0,y:.5},n="right",h=1;break;case Np: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,jp(s||n,t,r,!0);const c=Z.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=Np;break;case zp:t=Hp;break;case Vp:t=Yp;break;case Np:t=Gp;break;case Hp:t=zp;break;case Yp:t=Vp}if(i)switch(t){case Up:t=Xp;break;case zp:t=Vp;break;case Hp:t=Yp;break;case Xp:t=Up;break;case Vp:t=zp;break;case Yp:t=Hp}return t}},Jp={};function $p(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("rect"===i.name)return Qp(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:p,moveable:g,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(g||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?n?p:o?c:u:v?p:y?c:u;h+=45*(qp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(E.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;Jp[S]?i.cursor=Jp[S]:Jp[S]=i.cursor={url:tg(x,h),x:b,y:k}}function Qp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function tg(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class eg extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const ig=["top","right","bottom","left"],sg=void 0;class ng extends t.Group{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 h(t)||h(e)||h(i)}constructor(e){super(),this.view=new t.Group,this.rect=new eg({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new eg({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,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 eg({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),o.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new eg({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new eg({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),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,resizeLines:r}=this,{stroke:a,strokeWidth:h,resizeLine:l}=e,d=this.getPointsStyle(),c=this.getMiddlePointsStyle();let u;this.visible=!t.locked;for(let t=0;t<8;t++)u=o[t],u.set(this.getPointStyle(t%2?c[(t-1)/2%c.length]:d[t/2%d.length])),u.rotation=(t-(t%2?1:0))/2*90,t%2&&r[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},l||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||d[0])),s.set(Object.assign({stroke:a,strokeWidth:h,editConfig:sg},e.rect||{}));const p=i&&this.transformTool.editTool;s.hittable=!p,s.syncEventer=p&&this.editor,p&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),Qp(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{editor:e,mergeConfig:i,single:s,rect:n,circle:o,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{editMask:c}=e,{middlePoint:u,resizeable:p,rotateable:g,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Rt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=d(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,w,E,k={};for(let i=0;i<8;i++)lt.toPoint(lt.directionData[i],t,k),w=a[i],v=h[i],w.set(k),v.set(k),w.visible=y&&!(!p&&!g),v.visible=y&&g&&p&&!x,i%2&&(E=l[(i-1)/2],E.set(k),E.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(E.width=e+E.height,_&&2*w.width>e&&(w.visible=!1)):(E.width=c+E.height,_&&2*w.width>c&&(w.visible=!1)));o.visible=y&&g&&!(!i.circle&&!i.rotatePoint),o.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&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=ig.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=ig.indexOf(e);(a%2&&o||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?qp.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:sg};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return p(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return p(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;"move"===i?(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{pointType:e}=t.current;"move"===e&&(this.editor.opacity=1),e&&e.includes("resize")&&(Cr.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:o}=this;if(i)e.onMove(t);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)}$p(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(),h(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(),h(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),h(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){$p(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(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i,this.__eventIds.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,t=>{this.enterPoint=e,$p(this,t)}],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[t.MoveEvent.END,this.onMoveEnd,this],[t.ZoomEvent.END,this.resetDoing,this],[t.RotateEvent.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const og={x:0,y:0,width:1e5,height:1e5};class rg extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,og),Object.assign(this.__world,og)}__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 ag='\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"/>',hg={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${ag}\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${ag}\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${ag}\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},lg=new At;function dg(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{lg.setListWithFn(i,t=>t.getBounds("box","page")),0===lg.width&&(lg.width=.1),0===lg.height&&(lg.height=.1),e.reset(lg.get())}),s.add(e)}const cg=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),ug=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),pg={group(e,i,s){e.sort(ug);const{app:n,parent:o}=e[0];let r;r=s&&s.add?s:new t.Group(s),o.addAt(r,o.children.indexOf(e[0])),e.sort(cg);const a=new it(i.worldTransform);return a.divideParent(o.scrollWorldTransform),r.setTransform(a),r.editable=!0,r.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(r)),n.unlockLayout(),r},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(cg),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(ug),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},gg=Wt.get("EditToolCreator");function _g(){return t=>{mg.register(t)}}const fg=_g,mg={list:{},register(t){const{tag:e}=t.prototype;yg[e]&&gg.repeat(e),yg[e]=t},get:(t,e)=>new yg[t](e)},{list:yg}=mg;class vg extends Ep{constructor(t,e){super(t,e)}}vg.BEFORE_OPEN="innerEditor.before_open",vg.OPEN="innerEditor.open",vg.BEFORE_CLOSE="innerEditor.before_close",vg.CLOSE="innerEditor.close";class wg extends Ep{constructor(t,e){super(t,e)}}wg.BEFORE_GROUP="editor.before_group",wg.GROUP="editor.group",wg.BEFORE_UNGROUP="editor.before_ungroup",wg.UNGROUP="editor.ungroup",wg.BEFORE_OPEN="editor.before_open_group",wg.OPEN="editor.open_group",wg.BEFORE_CLOSE="editor.before_close_group",wg.CLOSE="editor.close_group";const{updateMatrix:xg}=Go,bg={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Eg="top-left";class kg extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(br.CHANGE,e=>{if(this.checkChange&&bg[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,xg(this.parent),xg(this);const a=new it(this.__world);switch(r[i]=s,this.__layout.rotationChange(),xg(this),this.changedTransform=new it(this.__world).divide(a),i){case"x":t.move(o,0);break;case"y":t.move(0,o);break;case"rotation":t.rotateOf(Eg,o);break;case"scaleX":t.scaleOf(Eg,o,1);break;case"scaleY":t.scaleOf(Eg,1,o);break;case"skewX":t.skewOf(Eg,o,0);break;case"skewY":t.skewOf(Eg,0,o)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Sg extends Ep{constructor(t,e){super(t,e)}}Sg.BEFORE_MOVE="editor.before_move",Sg.MOVE="editor.move";class Bg extends Ep{constructor(t,e){super(t,e)}}Bg.BEFORE_SCALE="editor.before_scale",Bg.SCALE="editor.scale";class Tg extends Ep{constructor(t,e){super(t,e)}}Tg.BEFORE_ROTATE="editor.before_rotate",Tg.ROTATE="editor.rotate";class Pg extends Ep{constructor(t,e){super(t,e)}}Pg.BEFORE_SKEW="editor.before_skew",Pg.SKEW="editor.skew";class Rg{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let o,{dragLimitAnimate:r}=s;const a=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,l=h(i.draggable),c=!r||a||l;if(e instanceof t.MoveEvent)o=e.getLocalMove(i),c&&t.DragEvent.limitMove(i,o);else{const s={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),o=t.DragEvent.getValidMove(i,n.point,s,c)}(o.x||o.y)&&(r&&!l&&a?Go.animateMove(this,o,d(r)?r:.3):this.move(o))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:o}=this.editBox;let{around:r,lockRatio:a,flipable:h,editSize:l}=s;if(e instanceof t.ZoomEvent)this.scaleOf(i.getBoxPoint(e),e.scale,e.scale);else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(a=!0);const s=qp.getScaleData(i,o.bounds,t,e.getInnerTotal(i),a,qp.getAround(r,e.altKey),h,!n||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(s.drag=e,this.scaleWithDrag(s)):this.scaleOf(s.origin,s.scaleX,s.scaleY)}}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:o,rotateAround:r,rotateGap:a}=s,{direction:h}=e.current;let l,d;if(e instanceof t.RotateEvent)d=e.rotation,l=r?lt.getPoint(r,i.boxBounds):i.getBoxPoint(e);else{const t=qp.getRotateData(i,h,e,n,e.shiftKey?null:r||i.around||i.origin||o||"center");d=n.rotation+t.rotation-i.rotation,l=t.origin}d=E.float(E.getGapRotation(d,a,i.rotation),2),d&&this.rotateOf(l,d)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:o,skewY:r}=qp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),qp.getAround(s,t.altKey));(o||r)&&this.skewOf(n,o,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;g(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(g(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 Sg(Sg.BEFORE_MOVE,h));const l=new Sg(Sg.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 Bg(Bg.BEFORE_SCALE,t));const o=new Bg(Bg.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(g(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 Bg(Bg.BEFORE_SCALE,c));const u=new Bg(Bg.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 it(Go.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 Bg(Bg.BEFORE_SCALE,r));const a=new Bg(Bg.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(d(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),l={target:i,editor:o,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Tg(Tg.BEFORE_ROTATE,l));const c=new Tg(Tg.ROTATE,l);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(g(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 Pg(Pg.BEFORE_SKEW,c));const u=new Pg(Pg.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(Go.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new it(e.worldTransform);return t(),new it(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{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 kg(this),this.editBox=new ng(this),this.editToolList={},this.selector=new Wp(this),this.editMask=new rg(this),this.targetEventIds=[];let i=m.clone(hg);t&&(i=m.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)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?p(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>m.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}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&&dg(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(h(s))e=s;else if(!1===s)return}if(mg.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||mg.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(wg.BEFORE_GROUP),this.target=pg.group(this.list,this.element,t),this.emitGroupEvent(wg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(wg.BEFORE_UNGROUP,t)),this.target=pg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(wg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(wg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(wg.OPEN,t)}closeGroup(t){this.emitGroupEvent(wg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(wg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Go.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 wg(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(h(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(h(i))s=i;else if(!1===i)return}mg.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||mg.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(vg.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(vg.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(vg.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(vg.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new vg(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&&(pg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(pg.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_(Dr.START,this.onRenderStart,this),i&&i.on_(br.SCROLL,this.onChildScroll,this),t.on_(Dr.CHILD_START,this.onAppRenderStart,this),t.on_(Mr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],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())}},te([(t,e)=>{Vn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=this,o=Object.assign({},t);return e&&e.editConfig&&Object.assign(o,e.editConfig),s.config&&Object.assign(o,s.config),i&&(i.editConfig&&Object.assign(o,i.editConfig),"font-size"===o.editSize&&(o.lockRatio=!0),"resize-rotate"===i.pointType&&(o.around||(o.around="center"),a(o.lockRatio)&&(o.lockRatio=!0))),r(o.dragLimitAnimate)&&(o.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=o}})}],t.Editor.prototype,"mergeConfig",void 0),te([kp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Qa?i:new Qa(i),t.multiple&&dg(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Ep(Ep.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Ep(Ep.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),te([kp(function(t,e){t.emitEvent(new Ep(Ep.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),t.Editor=te([Oo(Rg,["editBox","editTool","emitEvent"])],t.Editor);class Lg{static registerInnerEditor(){mg.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 t.Group,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)}}t.EditTool=class extends Lg{static registerEditTool(){mg.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()}},t.EditTool=te([_g()],t.EditTool);const{left:Cg,right:Og}=t.Direction9,{move:Ag,copy:Dg,toNumberPoints:Mg}=Z;t.LineEditTool=class extends t.EditTool{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===Cg;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=Mg(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?(Ag(t,o,r),s&&Ag(e,-o,-r)):(s&&Ag(t,-o,-r),Ag(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),Dg(s[7],i),Dg(e[7],i),Dg(s[3],a),Dg(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Cg||t===Og,s[t].visible=a,e[t].visible=!r&&a}},t.LineEditTool=te([_g()],t.LineEditTool);const{M:Ig,L:Fg,C:Wg,Q:zg,Z:Ug,N:Hg,D:Ng,X:Yg,G:Xg,F:Vg,O:Gg,P:jg,U:Kg}=ye,Zg={scale(t,e,i){if(!t)return;let s,n=0,o=t.length;for(;n<o;)switch(s=t[n],s){case Ig:case Fg:qg(t,e,i,n,1),n+=3;break;case Wg:qg(t,e,i,n,3),n+=7;break;case zg:qg(t,e,i,n,2),n+=5;break;case Ug:n+=1;break;case Hg:qg(t,e,i,n,2),n+=5;break;case Ng:qg(t,e,i,n,2),n+=9;break;case Yg:qg(t,e,i,n,2),n+=6;break;case Xg:qg(t,e,i,n,2),n+=9;break;case Vg:qg(t,e,i,n,2),n+=5;break;case Gg:t[n]=Xg,t.splice(n+4,0,t[n+3],0),qg(t,e,i,n,2),n+=9,o+=2;break;case jg:t[n]=Vg,t.splice(n+4,0,t[n+3]),qg(t,e,i,n,2),n+=5,o+=1;break;case Kg:qg(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:qg}=Zg,Jg=W.get(),{topLeft:$g,top:Qg,topRight:t_,right:e_,bottom:i_,left:s_}=t.Direction9;function n_(t,e,i){t.pathInputed?r_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function o_(t,e,i,s){let n=e;if(!r(s)){const o=t.__layout;let{width:r,height:a}=o.boxBounds;switch(r*=i-e,a*=e-i,s){case Qg:case i_:n=i,o.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case s_:case e_:o.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case $g:case t_:o.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const o=t.__,{padding:a}=o;a&&(t.padding=p(a)?a.map(t=>t*n):a*n),o.__autoWidth||(t.width*=n),o.__autoHeight||(t.height*=n)}function r_(t,e,i){Zg.scale(t.__.path,e,i),t.path=t.__.path}function a_(t,e,i){const{points:s}=t;g(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):Zg.scalePoints(s,e,i),t.points=s}function h_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Jg.a=e,Jg.d=i,s[t].transform(Jg,!0)}const l_=t.Leaf.prototype;l_.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))},l_.__scaleResize=function(t,e){n_(this,t,e)},l_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},l_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.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)o_(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),n_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){r_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?r_(this,t,e):this.points?a_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?r_(this,t,e):this.points?a_(this,t,e):n_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){h_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||n_(this,t,e),i&&h_(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),Gt.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,Jn),t.UI.addAttr("editConfig",void 0,Jn),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),Jn),t.UI.addAttr("editInner","PathEditor",Jn),t.Group.addAttr("editInner","",Jn),t.Text.addAttr("editInner","TextEditor",Jn),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const d_={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},c_={top:"flex-start",middle:"center",bottom:"flex-end"},u_={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function p_(t,e,i){const{style:s}=t,{fill:n,padding:o,textWrap:a,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";p(e)&&(e=e[0]);if(g(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(h(t)?t:t.color);break;default:r(e.r)||(i=Bh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,g(d)?(c=d.type,d.color&&(s.textDecorationColor=Bh.string(d.color))):c=d,s.textDecoration=u_[c],s.textTransform=d_[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=c_[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===a||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===a?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=p(o)?o.map(t=>t*i+"px").join(" "):(o||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}function g_(e,i,s){__(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{Go.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function __(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&m.assign(i,e),m.assign(t.config,i,t.userConfig)}t.TextEditor=class extends Lg{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:o}=n;n.contentEditable="true",o.position="fixed",o.transformOrigin="left top",o.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:r}=e.app;(this.inBody=r instanceof HTMLCanvasElement)?document.body.appendChild(n):r.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.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),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}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:p,f:g}=new it(t.worldTransform).scale(1/e).translateInner(n,o),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${p},${g})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||p_(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)}},t.TextEditor=te([fg()],t.TextEditor),Vt.add("text-editor","editor");const f_=Wt.get("LeaferTypeCreator"),m_={list:{},register(t,e){y_[t]&&f_.repeat(t),y_[t]=e},run(t,e){const i=y_[t];i&&i(e)}},{list:y_,register:v_}=m_;v_("viewport",g_),v_("custom",function(t){g_(t,null,!0)}),v_("design",function(t){g_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),v_("document",function(t){g_(t,{zoom:{min:1},move:{scroll:"limit"}})});const w_={getData(t){const e=t[0],i=t[1],s=Z.getCenter(e.from,i.from),n=Z.getCenter(e.to,i.to),o={x:n.x-s.x,y:n.y-s.y},r=Z.getDistance(e.from,i.from);return{move:o,scale:Z.getDistance(e.to,i.to)/r,rotation:Z.getRotation(e.from,i.from,e.to,i.to),center:n}}},{abs:x_,max:b_}=Math,{sign:E_,within:k_}=E,S_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const o=x_(s),r=x_(n);return o>50&&(s=b_(50,o/3)*E_(s)),r>50&&(n=b_(50,r/3)*E_(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,i){let s,n=1,{zoomMode:o,zoomSpeed:r}=i;const a=t.deltaY||t.deltaX;if(o?(s="mouse"===o||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){r=k_(r,0,1);const e=t.deltaY?i.delta.y:i.delta.x,s=k_(1-x_(a)/(4*e)*r,.5,2);n=a>0?s:1/s}return n}};class B_{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),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:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const T_=t.Leafer.prototype,P_=new At,R_=new tt;function L_(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function C_(t,e){return Object.assign(Object.assign({},e),{scale:t})}T_.initType=function(t){m_.run(t,this)},T_.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(R_.set(t,e),s){const t=!0===s?"":s;t.includes("x")?R_.y=0:t.includes("y")?R_.x=0:Math.abs(R_.x)>Math.abs(R_.y)?R_.y=0:R_.x=0,i&&t.includes("limit")&&(P_.set(this.__world).addPoint(this.zoomLayer),cl.getValidMove(P_,this.canvas.bounds,"inner",R_,!0),t.includes("x")?R_.y=0:t.includes("y")&&(R_.x=0))}return{x:n?0:R_.x,y:n?0:R_.y}},T_.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 O_=bd.prototype;O_.createTransformer=function(){this.transformer=new B_(this)},O_.move=function(t){this.transformer.move(t)},O_.zoom=function(t){this.transformer.zoom(t)},O_.rotate=function(t){this.transformer.rotate(t)},O_.transformEnd=function(){this.transformer.transformEnd()},O_.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):S_.getScale(t,e);if(1!==o)this.zoom(C_(o,t));else{const s=e.getMove?e.getMove(t,e):S_.getMove(t,e);i.snap&&Z.round(s),this.move(L_(s,t))}},O_.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:o}=w_.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(C_(n,t)),this.move(L_(i,t))};const A_=ud.prototype,{abs:D_}=Math;function M_(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}A_.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=D_(i),o=D_(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?d(a)?a:.95:r)>h?e=h/n:o*e>h&&(e=h/o),t=Object.assign({},t),Z.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},A_.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},A_.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},A_.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=Rt.maxX(r),d=Rt.maxY(r),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,Z.move(i,c,u),Z.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},A_.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),_(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:o}=this,r=this.canvas.bounds.clone().shrink(a(n)?30:n),l=new At,c={x:r.x+r.width/2,y:r.y+r.height/2};let u;const{x:f,y:m,scaleX:y,scaleY:v}=o.__;if(h(t))switch(t){case"in":u=M_(y,"in");break;case"out":u=M_(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new At(this.boxBounds)).height=0;break;case"fit-height":(t=new At(this.boxBounds)).width=0}else d(t)&&(u=t/y);if(u)u=this.getValidScale(u),o.scaleOfWorld(c,u,u,!1,s);else if(g(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=p(t);if(n||t.tag){const e=n?t:[t];l.setListWithFn(e,tr.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,r);l.set(o.getWorldBounds(e))}const{width:a,height:h}=l;let d=r.x-l.x,c=r.y-l.y;return i?(d+=Math.max((r.width-a)/2,0),c+=Math.max((r.height-h)/2,0)):(u=this.getValidScale(Math.min(r.width/a,r.height/h)),d+=(r.width-a*u)/2,c+=(r.height-h*u)/2,Z.scaleOf(e,l,u),l.scaleOf(l,u),e.scaleX*=u,e.scaleY*=u),"x"===i?c=0:"y"===i&&(d=0),Z.move(e,d,c),l.move(d,c),o.set(e,s),l}return o.worldBoxBounds};class I_ extends t.Group{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&&m.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;h(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{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 At(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,p=l<1,{scrollXBar:g,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,p?_.width+6:2,u?g.height+6:2,2]);g.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:p})}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:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Dr.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 F_ extends nl{setText(t){this._text=t,this.__htmlChanged=!0}}t.HTMLText=class extends t.Image{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)}},te([ko(F_)],t.HTMLText.prototype,"__",void 0),te([so("")],t.HTMLText.prototype,"text",void 0),te([Jn("TextEditor")],t.HTMLText.prototype,"editInner",void 0),te([po(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=te([Ao()],t.HTMLText),Vt.add("html");class W_ extends Zh{}function z_(t){return Kn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,lo(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Ph.register(t,e)}},te([ko(W_)],t.Arrow.prototype,"__",void 0),te([z_("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=te([Ao()],t.Arrow);const{M:U_,L:H_,C:N_,Q:Y_,O:X_}=ye,{rotate:V_,copyFrom:G_,scale:j_}=Z,K_={},Z_={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 U_:case H_:q_(t,l+1,e,i,s,n,o,r),l+=3;break;case N_:for(h=1;h<6;h+=2)q_(t,l+h,e,i,s,n,o,r);l+=7;break;case Y_:for(h=1;h<4;h+=2)q_(t,l+h,e,i,s,n,o,r);l+=5;break;case X_: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){Z_.layout(t,0,0,1,1,e,i)}};function q_(t,e,i,s,n,o,r,a){G_(K_,t[e],t[e+1]),r&&V_(K_,r,a),n&&j_(K_,n,o),t[e]=i+K_.x,t[e+1]=s+K_.y}const{layout:J_,rotate:$_}=Z_,{getAngle:Q_}=Z,tf={x:-.5},ef={connect:tf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},sf={connect:tf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},nf={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]},of={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]},rf={offset:tf,path:[...nf.path],dashPath:[1,-2.5,0,2,-1,0]};$_(rf.path,180,{x:-1.5,y:0});const af={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},hf={connect:{x:.5},path:[...af.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},lf={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]},df={path:[...lf.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},cf=m.clone(lf),uf=m.clone(df);$_(cf.path,45),$_(uf.path,45);const pf={angle:ef,"angle-side":sf,arrow:of,triangle:nf,"triangle-flip":rf,circle:hf,"circle-line":af,square:df,"square-line":lf,diamond:uf,"diamond-line":cf,mark:{offset:tf,path:[1,0,-2,2,0,2]}};function gf(t,e,i,s,n,o,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;g(e)?e.type?(h=e.scale,a=pf[e.type]):a=e:a=pf[e];const{offset:c,connect:u,path:p,dashPath:_}=a;let f=u?u.x:0,m=c?c.x:0;const y=[...p];return r&&_&&y.push(..._),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&J_(y,0,0,h,h),m&&J_(y,m,0),J_(y,s.x,s.y,n,n,Q_(i,s)),o.x=(f+m)*n,y}const{M:_f,L:ff,C:mf,Q:yf,Z:vf,N:wf,D:xf,X:bf,G:Ef,F:kf,O:Sf,P:Bf,U:Tf}=ye,{copy:Pf,copyFrom:Rf,getDistancePoint:Lf}=Z,Cf={},Of={},Af={},Df={},Mf={},If={list:pf,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 _f:case ff:(c<2||l+6>=d)&&(Rf(Mf,o[l+1],o[l+2]),!c&&u&&Pf(Of,Mf)),l+=3;break;case mf:(1===c||l+7>=d-3)&&Ff(o,Df,Mf,l+3),l+=7;break;case yf:(1===c||l+5>=d-3)&&Ff(o,Df,Mf,l+1),l+=5;break;case vf:return;case wf:l+=5;break;case xf:l+=9;break;case bf:l+=6;break;case Ef:l+=9;break;case kf:l+=5;break;case Sf:l+=7;break;case Bf:l+=4;break;case Tf:(1===c||l+6>=d-3)&&(Ff(o,Df,Mf,l+1),l+6!==d&&(Mf.x-=(Mf.x-Df.x)/10,Mf.y-=(Mf.y-Df.y)/10)),l+=6}if(c++,1===c&&h!==_f)return;if(2===c&&u&&Pf(Af,h===ff?Mf:Df),l===d){const r=t.__.__pathForRender=a?[...o]:o,d=t.__.__pathForArrow=[];if(u){const i=gf(t,e,Af,Of,s,Cf,!!n);n?d.push(...i):r.push(...i),Cf.x&&(Lf(Of,Af,-Cf.x,!0),r[1]=Af.x,r[2]=Af.y)}if(i&&"none"!==i){const e=gf(t,i,Df,Mf,s,Cf,!!n);if(n?d.push(...e):r.push(...e),Cf.x){let t;switch(Lf(Mf,Df,-Cf.x,!0),h){case ff:t=l-3+1;break;case mf:t=l-7+5;break;case yf:t=l-5+3;break;case Tf:t=l-6+3}t&&Wf(r,Df,t)}}}else Pf(Df,Mf)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Ff(t,e,i,s){Rf(e,t[s],t[s+1]),Rf(i,t[s+2],t[s+3])}function Wf(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),t.UI.addAttr("startArrow","none",z_),t.UI.addAttr("endArrow","none",z_),Object.assign(Ph,If),Object.assign(Rh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});t.Flow=class extends t.Box{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}},te([ko(class extends Gh{})],t.Flow.prototype,"__",void 0),te([to("x")],t.Flow.prototype,"flow",void 0),t.Flow=te([Ao()],t.Flow);const zf={},Uf={"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"},Hf={"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 Nf(t,e,i){const s=t.__,{contentBounds:n}=t.__layout;ut.toPoint(i,e,n,zf),e.x=s.__autoWidth?n.x:zf.x,e.y=s.__autoHeight?n.y:zf.y}const{move:Yf}=Z;function Xf(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)),Yf(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Vf(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 Gf={};function jf(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:o,__autoHeight:r}=t.__,a=n&&(e?!o:!r);return g(i)?(Gf.xGap=i.x||0,Gf.yGap=i.y||0):Gf.xGap=Gf.yGap=u(i),Gf.isAutoXGap=h(Gf.xGap)&&!o,Gf.isAutoYGap=h(Gf.yGap)&&!r,Gf.complex=a||"top-left"!==s||t.__hasGrow||Gf.isAutoXGap||Gf.isAutoYGap,Gf.wrap=a,Gf.complex&&(Gf.isFitXGap="fit"===Gf.xGap&&!o,Gf.isFitYGap="fit"===Gf.yGap&&!r,g(s)?(Gf.contentAlign=s.content||"top-left",Gf.rowXAlign=s.x||"from",Gf.rowYAlign=s.y||"from"):(Gf.contentAlign=s,Gf.rowXAlign=Uf[s],Gf.rowYAlign=Hf[s])),Gf}function Kf(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Zf(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 qf(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Jf}=E;function $f(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=Qf(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=Qf(t,o=t.__flowBounds,o.width+n),e-=n-r,i-=s})}(h,a,l)}}function Qf(t,e,i){const{widthRange:s,lockRatio:n}=t.__,o=s?Jf(i,s):i,r=o/e.width;return t.scaleResize(r,n?r:1),e.width=o,i-o}const{within:tm}=E;function em(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=im(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=im(t,o=t.__flowBounds,o.height+n),e-=n-r,i-=s})}(h,a,l)}}function im(t,e,i){const{heightRange:s,lockRatio:n}=t.__,o=s?tm(i,s):i,r=o/e.height;return t.scaleResize(n?r:1,r),e.height=o,i-o}const{move:sm}=Z;function nm(t,e){const i="width",{children:s,itemBox:n}=t,o=jf(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:[]},p=d?0:h;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=qf(g,n),r?(g.__flowBounds=_,y||(y=Kf(m,p)),a&&y.count&&y.width+_.width>x&&(y.grow?$f(t,y,x,e):d&&Zf(y,i,x,c),Vf(u,y,i),y=Kf(m,p)),f=_.width,g.__widthGrow&&(y.grow+=g.__widthGrow,f=0,g.__.widthRange&&(y.hasRangeSize=!0)),g.__heightGrow&&im(g,_,b),y.width+=y.count?f+p:f,y.height=Math.max(y.height,_.height),y.count++):(sm(g,v-_.x,w-_.y),v+=_.width+p));if(r&&y){const{isAutoYGap:s,isFitYGap:n,contentAlign:r,rowXAlign:h,rowYAlign:p}=o;y.count&&(y.grow?$f(t,y,x,e):d&&Zf(y,i,x,c),a&&Vf(u,y,i)),a?(s?Zf(u,"height",b,n):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Nf(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Uf[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],Xf(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,p,e)):(Nf(t,y,r),Xf(t,y,0,y.y,p,e))}}const{move:om}=Z;function rm(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)),om(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:am}=Z;function hm(t,e){const i="height",{children:s,itemBox:n}=t,o=jf(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:[]},p=d?0:l;let g,_,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let o=0,h=s.length;o<h;o++)g=s[m=e?h-1-o:o],g.__.inFlow&&0!==g.__.visible&&(_=qf(g,n),r?(g.__flowBounds=_,y||(y=Kf(m,p)),a&&y.count&&y.height+_.height>b&&(y.grow&&em(t,y,b,e),d&&Zf(y,i,b,c),Vf(u,y,i),y=Kf(m,p)),f=_.height,g.__heightGrow&&(y.grow+=g.__heightGrow,f=0,g.__.heightRange&&(y.hasRangeSize=!0)),g.__widthGrow&&Qf(g,_,x),y.height+=y.count?f+p:f,y.width=Math.max(y.width,_.width),y.count++):(am(g,v-_.x,w-_.y),w+=_.height+p));if(r&&y){const{isAutoXGap:s,isFitXGap:n,contentAlign:r,rowXAlign:l,rowYAlign:p}=o;y.count&&(y.grow&&em(t,y,b,e),d&&Zf(y,i,b,c),a&&Vf(u,y,i)),a?(s?Zf(u,"width",x,n):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Nf(t,e,i);const{list:n}=e;if(n.length>1&&(s||(s=Hf[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,p),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],rm(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Nf(t,y,r),rm(t,y,y.x,0,l,e))}}function lm(t){return Kn(t,t=>({set(e){const i=d(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)&&oo(this)}}))}Vt.add("flow","resize");const dm=t.Box.prototype,{__updateBoxBounds:cm}=t.Group.prototype;t.UI.addAttr("flow",!1,to),t.UI.addAttr("gap",0,so),t.UI.addAttr("flowAlign","top-left",so),t.UI.addAttr("flowWrap",!1,so),t.UI.addAttr("itemBox","box",so),t.UI.addAttr("inFlow",!0,so),t.UI.addAttr("autoWidth",void 0,lm),t.UI.addAttr("autoHeight",void 0,lm),t.UI.addAttr("autoBox",void 0,so);const{copyAndSpread:um}=Rt;dm.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:nm(this);break;case"y":hm(this);break;case"x-reverse":nm(this,!0);break;case"y-reverse":hm(this,!0)}t&&(this.leafer.created=!0)},dm.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),um(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},dm.__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():cm.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&&um(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:pm,sin:gm,pow:_m,sqrt:fm,abs:mm,ceil:ym,floor:vm,round:wm,PI:xm}=Math,bm=5*xm,Em=1.70158,km=2.5949095,Sm=7.5625,Bm=2.75;function Tm(t){return e=>_m(e,t)}function Pm(t){return e=>1-_m(1-e,t)}function Rm(t){return e=>e<.5?.5*_m(2*e,t):1-.5*_m(2-2*e,t)}function Lm(t){return t<1/Bm?Sm*t*t:t<2/Bm?Sm*(t-=1.5/Bm)*t+.75:t<2.5/Bm?Sm*(t-=2.25/Bm)*t+.9375:Sm*(t-=2.625/Bm)*t+.984375}function Cm(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=Om(c,t,i)-o,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(mm(l)<1e-6));e++)c-=d/l;return n[r]=Om(c,e,s)}}function Om(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 h(t)?e[t||"ease"]:g(t)?e[t.name].apply(e,p(t.value)?t.value:[t.value]):e.ease},register(t,e){Am.list[t]=e},list:{linear:t=>t,ease:Cm(.25,.1,.25,1),"ease-in":Cm(.42,0,1,1),"ease-out":Cm(0,0,.58,1),"ease-in-out":Cm(.42,0,.58,1),"sine-in":t=>1-pm(t*xm*.5),"sine-out":t=>gm(t*xm*.5),"sine-in-out":t=>.5*(1-pm(t*xm)),"quad-in":Tm(2),"quad-out":Pm(2),"quad-in-out":Rm(2),"cubic-in":Tm(3),"cubic-out":Pm(3),"cubic-in-out":Rm(3),"quart-in":Tm(4),"quart-out":Pm(4),"quart-in-out":Rm(4),"quint-in":Tm(5),"quint-out":Pm(5),"quint-in-out":Rm(5),"expo-in":t=>t?_m(2,10*t-10):0,"expo-out":t=>1===t?1:1-_m(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*_m(2,2*t*10-10):.5*(2-_m(2,10-2*t*10)),"circ-in":t=>1-fm(1-_m(t,2)),"circ-out":t=>fm(1-_m(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-fm(1-_m(2*t,2))):.5*(fm(1-_m(2-2*t,2))+1),"back-in":t=>((Em+1)*t-Em)*t*t,"back-out":t=>(t-=1)*t*((Em+1)*t+Em)+1,"back-in-out":t=>t<.5?(t*=2)*t*((km+1)*t-km)*.5:.5*((t=2*t-2)*t*((km+1)*t+km)+2),"elastic-in":t=>0===t||1===t?t:-_m(2,10*(t-1))*gm((t-1.1)*bm),"elastic-out":t=>0===t||1===t?t:_m(2,-10*t)*gm((t-.1)*bm)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-_m(2,10*((t*=2)-1))*gm((t-1.1)*bm)*.5:_m(2,10*(1-(t*=2)))*gm((t-1.1)*bm)*.5+1,"bounce-in":t=>1-Lm(1-t),"bounce-out":Lm,"bounce-in-out":t=>t<.5?.5*(1-Lm(1-2*t)):.5*(1+Lm(2*t-1)),"cubic-bezier":Cm,steps:function(t,e="floor"){return i=>("floor"===e?vm(i*t):"ceil"===e?ym(i*t):wm(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 Mm{}Mm.CREATED="created",Mm.PLAY="play",Mm.PAUSE="pause",Mm.STOP="stop",Mm.SEEK="seek",Mm.UPDATE="update",Mm.COMPLETED="completed";t.Animate=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&&d(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=p(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(Mm.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Mm.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Mm.STOP))}seek(t){this.destroyed||(g(t)&&(t=Th.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(Mm.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,o=!(n>1)||this.join;let a,h,l,c,u,p=0,g=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=o?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:o,loop:r}=h;o&&(l.swing=d(o)?o:2,u=2*l.swing-1),r&&(l.loop=u=d(r)?r:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,g+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,g+=s*u),n&&(l.easingFn=Am.get(n))}if(!l.autoDuration&&r(l.duration)&&(n>1?s>0||o?g+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}g?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*g),this.allocateTime((this.duration-p)/g)):p&&this.changeDuration(p),this.emitType(Mm.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:o}=this;for(let a in e)r(s[a])&&(s[a]=n[a]=e===i?i[a]:o[a]),t.beforeStyle[a]=r(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],r(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(),e.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(Mm.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={}),Ih.setBetweenStyle(r,s,n,e,t,o,i),this.setStyle(r)}this.emitType(Mm.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 d(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)}},te([Dm("ease")],t.Animate.prototype,"easing",void 0),te([Dm(0)],t.Animate.prototype,"delay",void 0),te([Dm(.2)],t.Animate.prototype,"duration",void 0),te([Dm("auto")],t.Animate.prototype,"ending",void 0),te([Dm(!1)],t.Animate.prototype,"reverse",void 0),te([Dm(!1)],t.Animate.prototype,"swing",void 0),te([Dm(!1)],t.Animate.prototype,"loop",void 0),te([Dm(0)],t.Animate.prototype,"loopDelay",void 0),te([Dm(1)],t.Animate.prototype,"speed",void 0),te([Dm(!0)],t.Animate.prototype,"autoplay",void 0),te([Dm()],t.Animate.prototype,"join",void 0),te([Dm()],t.Animate.prototype,"attrs",void 0),t.Animate=te([Oo(Qr)],t.Animate),t.AnimateList=class extends t.Animate{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(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(Mm.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Mm.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Mm.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Mm.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Mm.COMPLETED:this.completed&&this.emitType(t);break;case Mm.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)}},t.AnimateList=te([Oo(Qr)],t.AnimateList);const Im={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"},Fm=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Wm=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,zm=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Um=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Hm=parseInt,Nm=parseFloat,{round:Ym}=Math;let Xm={},Vm=0;function Gm(t){let e,i,s,n=1;switch(t.length){case 9:e=Hm(t.slice(1,3),16),i=Hm(t.slice(3,5),16),s=Hm(t.slice(5,7),16),n=Hm(t.slice(7,9),16)/255;break;case 7:e=Hm(t.slice(1,3),16),i=Hm(t.slice(3,5),16),s=Hm(t.slice(5,7),16);break;case 5:e=Hm(t[1]+t[1],16),i=Hm(t[2]+t[2],16),s=Hm(t[3]+t[3],16),n=Hm(t[4]+t[4],16)/255;break;case 4:e=Hm(t[1]+t[1],16),i=Hm(t[2]+t[2],16),s=Hm(t[3]+t[3],16);break;case 3:e=i=s=Hm(t[1]+t[2],16);break;case 2:e=i=s=Hm(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const jm=1/6,Km=.5,Zm=2/3,qm=1/3;function Jm(t,e,i){return i<0?i++:i>1&&i--,i<jm?t+6*(e-t)*i:i<Km?e:i<Zm?t+(e-t)*(Zm-i)*6:t}function $m(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=Jm(a,s,t+qm),o=Jm(a,s,t),r=Jm(a,s,t-qm)}return{r:Ym(255*n),g:Ym(255*o),b:Ym(255*r),a:s}}Vt.add("color"),Bh.object=function(t,e){let i,s=!r(e)&&e<1;if(h(t)){const e=Xm[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Gm(t);break;case"R":case"r":"("===t[4]&&Wm.test(t)?i=function(t){const e=Wm.exec(t);return{r:Hm(e[1]),g:Hm(e[2]),b:Hm(e[3]),a:Nm(e[4])}}(t):"("===t[3]&&Fm.test(t)&&(i=function(t){const e=Fm.exec(t);return{r:Hm(e[1]),g:Hm(e[2]),b:Hm(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Um.test(t)?i=function(t){const e=Um.exec(t);return $m(Nm(e[1]),Nm(e[2]),Nm(e[3]),Nm(e[4]))}(t):"("===t[3]&&zm.test(t)&&(i=function(t){const e=zm.exec(t);return $m(Nm(e[1]),Nm(e[2]),Nm(e[3]),1)}(t))}if(!i){const e=Im[t.toLowerCase()];e&&(i=Gm("#"+e))}i&&(Vm++,Vm>1e4&&(Xm={},Vm=0),Xm[t]=Object.assign({},i))}}else g(t)&&(r(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:Qm}=Math,{fourNumber:ty}=E,ey={fill:ry,stroke:ry,cornerRadius:(t,e,i)=>d(t)&&d(e)?ny(t,e,i):(t=ty(t),e=ty(e),t.map((t,s)=>ny(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,o=ny(s,n,i,1);return s<n?e.substring(0,o):t.substring(0,o)}return d(t)||d(e)?E.float(ny(t,e,i),Math.max(sy(t),sy(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return Ih.setBetweenStyle(n,t,e,n,i,s),n},shadow:ay,innerShadow:ay},iy={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?ny(t,e,i):t},number:ny,color:oy,setBetweenStyle:function(t,e,i,s,n,o,r){let a,h,l;const{list:d,value:c}=Ih;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 sy(t){const e=String(t).split(".")[1];return e?e.length:0}function ny(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?Qm(n):n}function oy(t,e,i){t=Bh.object(t),e=Bh.object(e);const s=ny(t.r,e.r,i,1)+","+ny(t.g,e.g,i,1)+","+ny(t.b,e.b,i,1),n=ny(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function ry(t,e,i){return h(t)&&h(e)?oy(t,e,i):e}function ay(t,e,i){return p(t)||p(e)?e:(e=e||{},{x:ny((t=t||{}).x,e.x,i),y:ny(t.y,e.y,i),blur:ny(t.blur,e.blur,i),spread:ny(t.spread,e.spread,i),color:oy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),Mh.canAnimate=!0,Object.assign(Ih.list,ey),Object.assign(Ih,iy);const hy=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,Jn),t.UI.addAttr("transition",!0,Jn),t.UI.addAttr("transitionOut",void 0,Jn),hy.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))},hy.animate=function(e,i,s,n){if(r(e))return this.__animate;let o=p(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,o.toStyle);const a=this.__animate;return a&&(o instanceof t.AnimateList?o.list.unshift(a):o=new t.AnimateList(this,[a,o])),this.__animate=o},hy.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},hy.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Mm.COMPLETED,e)};const ly=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],dy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:cy}=Math,{getDerivative:uy}=Ve,py={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<ly.length;h++)l=f*(1+ly[h]),d=f*(1-ly[h]),c=uy(l,t,i,n,r),u=uy(l,e,s,o,a),p=uy(d,t,i,n,r),g=uy(d,e,s,o,a),_+=dy[h]*(cy(c*c+u*u)+cy(p*p+g*g));return _*f},getRotation(t,e,i,s,n,o,r,a,h){const l=uy(t,e,s,o,a),d=uy(t,i,n,r,h);return Math.atan2(d,l)/S},getT(t,e,i,s,n,o,r,a,h,l,d=1){let c=0,u=1,p=t/e,g=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>g;)gy(i,s,n,o,r,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},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,p=d*n+e*r,g=d*o+e*a,_=d*c+e*p,f=d*u+e*g,m=d*_+e*(d*p+e*(d*r+e*h)),y=d*f+e*(d*g+e*(d*a+e*l));t.push(ye.C,c,u,_,f,m,y)}},{getDistance:gy}=py,{M:_y,L:fy,C:my,Z:yy}=ye,vy={},wy={},xy={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case _y:case fy:xy.transformPoints(t,e,s,1),s+=3;break;case my:xy.transformPoints(t,e,s,3),s+=7;break;case yy:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,o=n+2*s;n<o;n+=2)vy.x=t[n],vy.y=t[n+1],W.toOuterPoint(e,vy),t[n]=vy.x,t[n+1]=vy.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 _y:case fy:i=t[a+1],s=t[a+2],e=n===fy&&a>0?Z.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case my:i=t[a+5],s=t[a+6],e=py.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 yy: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=Th.number(e,t.total);let o,r,a,h,l,d,c,u,p,g=0,_={},f=0,m=0,y=0,v=0;const w=n.length;for(;f<w;){switch(h=n[f],h){case _y:case fy:if(r=n[f+1],a=n[f+2],o=s[m],g+o>=e||!t.total)return f||(y=r,v=a),wy.x=y,wy.y=v,_.x=r,_.y=a,Z.getDistancePoint(wy,_,e-g,!0),_.rotation=Z.getAngle(wy,_),_;y=r,v=a,f+=3;break;case my:if(r=n[f+5],a=n[f+6],o=s[m],g+o>=e)return l=n[f+1],d=n[f+2],c=n[f+3],u=n[f+4],p=py.getT(e-g,o,y,v,l,d,c,u,r,a,i),Ve.getPointAndSet(p,y,v,l,d,c,u,r,a,_),_.rotation=py.getRotation(p,y,v,l,d,c,u,r,a),_;y=r,v=a,f+=7;break;case yy:f+=1;default:o=0}m++,g+=o}return _},getDistancePath(t,e,i){const{segments:s,data:n}=t,o=[];e=Th.number(e,t.total);let r,a,h,l,d,c,u,p,g,_=0,f={},m=0,y=0,v=0,w=0;const x=n.length;for(;m<x;){switch(l=n[m],l){case _y:case fy:if(a=n[m+1],h=n[m+2],r=s[y],_+r>=e||!t.total)return m||(v=a,w=h),wy.x=v,wy.y=w,f.x=a,f.y=h,Z.getDistancePoint(wy,f,e-_,!0),o.push(l,f.x,f.y),o;v=a,w=h,m+=3,o.push(l,v,w);break;case my:if(d=n[m+1],c=n[m+2],u=n[m+3],p=n[m+4],a=n[m+5],h=n[m+6],r=s[y],_+r>=e)return g=py.getT(e-_,r,v,w,d,c,u,p,a,h,i),py.cut(o,g,v,w,d,c,u,p,a,h),o;v=a,w=h,m+=7,o.push(l,d,c,u,p,a,h);break;case yy:m+=1,o.push(l);default:r=0}y++,_+=r}return o}};function by(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Ih.register("motion",function(t,e,i,s){return g(t)&&(t=Th.number(t,s.getMotionTotal())),g(e)&&(e=Th.number(e,s.getMotionTotal())),Ih.number(t||0,e||0,i)}),Ih.register("motionRotation",function(t,e,i){return Ih.number(t,e,i)});const Ey=t.UI.prototype,{updateMatrix:ky,updateAllMatrix:Sy}=Go,{updateBounds:By}=nr;function Ty(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Ry(t);i.total&&(t.__.__pathForRender=xy.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Sy(t),By(t,t)):ky(t));i&&(t.leafer.created=!0)}}function Py(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 Ry(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=xy.getMotionPathData(t.getPath(!0,!0))}function Ly(t,e){return Kn(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Mh.setStyleName(this,e,i):Mh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Cy(t){return Kn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Oy(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 Ay(t,e){g(e)||(e=void 0),Iy(t,e,"in")}function Dy(t,e){const{normalStyle:i}=t;g(e)||(e=void 0),i&&(e||(e=i),Iy(t,e,"out"))}t.UI.addAttr("motionPath",void 0,by),t.UI.addAttr("motionPrecision",1,by),t.UI.addAttr("motion",void 0,by),t.UI.addAttr("motionRotation",!0,by),Ey.getMotionPathData=function(){return Ry(Py(this))},Ey.getMotionPoint=function(t){const e=Py(this),i=Ry(e);if(!i.total)return{};const s=xy.getDistancePoint(i,t,e.motionPrecision);W.toOuterPoint(e.localTransform,s);const{motionRotation:n}=this;return!1===n?delete s.rotation:d(n)&&(s.rotation+=n),s},Ey.getMotionTotal=function(){return this.getMotionPathData().total},Ey.__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],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Ty(t))}else Ty(this)};const My={};function Iy(t,e,i){const{normalStyle:s}=t;e||(e=My),e.scale&&(E.assignScale(e,e.scale),delete e.scale),e!==My&&Mh.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const o=n?function(t,e){const i=zy(e,t),s=t.animate();s&&zy(i,t,s.fromStyle);return i}(t,e):void 0;Mh.canAnimate&&Fy(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const r=Fy(t);if(r){const{animation:s}=r;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(r,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete r.animation}t.normalStyle=Wy(r,t),t.set(r,"temp")}else t.normalStyle=void 0;if(n){const e=Wy(o,t);t.set(o,"temp"),t.animate([o,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Fy(t){let e;const i={},s=Oy(t),n=s?t.state||s.state:t.state,o=n&&t.states[n];o&&Mh.isState(n,t,s)&&(e=Uy(i,o));const r=i.selectedStyle||t.selectedStyle;r&&Mh.isSelected(t,s)&&(e=Uy(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Mh.isPlacehold(t,s)&&(e=Uy(i,a)),Mh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Uy(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&Mh.isFocus(t,s)&&(e=Uy(i,n));const o=i.hoverStyle||t.hoverStyle;o&&Mh.isHover(t,s)&&(e=Uy(i,o));const r=i.pressStyle||t.pressStyle;r&&Mh.isPress(t,s)&&(e=Uy(i,r))}return e?i:void 0}function Wy(t,e,i,s){const n=i?t:{},o=i||t;for(let t in o)s&&Mh.animateExcludes[t]||(n[t]=e[t]);return n}function zy(t,e,i){return Wy(t,e,i,!0)}function Uy(t,e){return Object.assign(t,e),!0}function Hy(t,e){const i=t[e];i&&Ay(t,i),t.button&&Yy(t.children,e)}function Ny(t,e,i){i||(i=t.states[e]),Ay(t,i),t.button&&Yy(t.children,null,e)}function Yy(t,e,i){if(!t)return;let s,n;for(let o=0,a=t.length;o<a;o++){if(s=t[o],e){switch(n=!0,e){case"hoverStyle":Mh.isHover(s)&&(n=!1);break;case"pressStyle":Mh.isPress(s)&&(n=!1);break;case"focusStyle":Mh.isFocus(s)&&(n=!1)}n&&Hy(s,e)}else r(i)||Ny(s,i);s.isBranch&&Yy(s.children,e,i)}}function Xy(t,e){const i=t[e];i&&Dy(t,i),t.button&&Gy(t.children,e)}function Vy(t,e,i){Dy(t,i),t.button&&Gy(t.children,null,e)}function Gy(t,e,i){if(!t)return;let s;for(let n=0,o=t.length;n<o;n++)s=t[n],e?Xy(s,e):r(i)||Vy(s,i),s.isBranch&&Gy(s.children,e,i)}function jy(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const o=Oy(e,i);o&&(s=n[t](o))}return s}function Ky(t,e,i){let s=e[t];if(!s&&i){const n=Oy(e,i);n&&(s=n[t])}return s}Vt.add("state"),Mh.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},Mh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=Oy(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},Mh.isSelected=function(t,e){return Ky("selected",t,e)},Mh.isDisabled=function(t,e){return Ky("disabled",t,e)},Mh.isFocus=function(t,e){return jy("isFocus",t,e)},Mh.isHover=function(t,e){return jy("isHover",t,e)},Mh.isPress=function(t,e){return jy("isPress",t,e)},Mh.isPlacehold=function(t,e){return t.__.__isPlacehold},Mh.isDrag=function(t,e){return jy("isDrag",t,e)},Mh.setStyleName=function(t,e,i){i?Ny(t,e,t[e]):Vy(t,e,t[e])},Mh.set=function(t,e){const i=t.states[e];i?Ny(t,e,i):Vy(t,e,i)},Mh.getStyle=Fy,Mh.updateStyle=Iy,Mh.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:Hy(e,"hoverStyle");break;case t.PointerEvent.LEAVE:Xy(e,"hoverStyle");break;case t.PointerEvent.DOWN:Hy(e,"pressStyle");break;case t.PointerEvent.UP:Xy(e,"pressStyle")}};const Zy=t.UI.prototype;t.UI.addAttr("selected",!1,Ly,"selectedStyle"),t.UI.addAttr("disabled",!1,Ly,"disabledStyle"),t.UI.addAttr("states",{},Cy),t.UI.addAttr("state","",Ly),t.UI.addAttr("normalStyle",void 0,Jn),t.UI.addAttr("hoverStyle",void 0,Cy),t.UI.addAttr("pressStyle",void 0,Cy),t.UI.addAttr("focusStyle",void 0,Cy),t.UI.addAttr("selectedStyle",void 0,Cy),t.UI.addAttr("disabledStyle",void 0,Cy),t.UI.addAttr("placeholderStyle",void 0,Cy),t.UI.addAttr("button",!1,Jn),Zy.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?Hy(this,"focusStyle"):Xy(this,"focusStyle")})},Zy.updateState=function(){Mh.updateStyle(this,void 0,"in")};const qy=t.Text.prototype,Jy="text";Vn(qy,Jy,Object.assign(Object.assign({},Gn(qy,Jy)),{set(t){const e=this,i=e.text;e.__setAttr(Jy,t)&&(oo(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class $y extends Yh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}t.Robot=class extends t.UI{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;p(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),!r(t))if(d(t))this.now=t;else if(g(t)){const e=p(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=Wn.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&&(d(o)?{width:o,height:o}:o)||(r>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new kr(kr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),r(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()}},te([ko($y)],t.Robot.prototype,"__",void 0),te([so()],t.Robot.prototype,"robot",void 0),te([Jn()],t.Robot.prototype,"actions",void 0),te([Jn("")],t.Robot.prototype,"action",void 0),te([po(0)],t.Robot.prototype,"now",void 0),te([Jn(12)],t.Robot.prototype,"FPS",void 0),te([Jn(!0)],t.Robot.prototype,"loop",void 0),t.Robot=te([Ao()],t.Robot),Vt.add("robot");const{Yes:Qy,NoAndSkip:tv,YesAndSkip:ev}=t.Answer,iv={},sv={},nv={};class ov{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"#":iv.id=t.substring(1),t=iv;break;case".":sv.className=t.substring(1),t=sv;break;default:nv.tag=t,t=nv}case"object":if(r(t.id)){if(t.tag){const{tag:s}=t,n=p(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?m.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&&Go.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===Qy||o===ev){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<tv&&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_(wr.REMOVE,this.__onRemoveChild,this),this.target.on_(br.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 rv=t.UI.prototype;function av(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Gt.selector())}rv.find=function(t,e){return av(this).getBy(t,this,!1,e)},rv.findOne=function(t,e){return av(this).getBy(t,this,!0,e)},Vt.add("find"),Gt.finder=function(t){return new ov(t)};const{setPoint:hv,addPoint:lv,toBounds:dv}=nt;const cv={syncExport(t,i,s){let n;Dh.running=!0;try{const o=Ln.fileType(i),a=i.includes(".");s=Ln.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===o)a&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!a||t.toJSON(s.json)};else if("svg"===o)a&&l(h(t.toSVG(),"svg"),i),n={data:!!a||t.toSVG()};else{let o,a,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:p}=t,{slice:g,clip:_,trim:f,screenshot:m,padding:y,onCanvas:v}=s,w=r(s.smooth)?!u||u.config.smooth:s.smooth,x=s.contextSettings||(u?u.config.contextSettings:void 0),b=c&&m&&r(s.fill)?t.fill:s.fill,k=Ln.isOpaqueImage(i)||b,S=new it;if(m)o=!0===m?c?u.canvas.bounds:t.worldRenderBounds:m;else{let e=s.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,e){case"inner":S.set(d);break;case"local":S.set(d).divide(t.localTransform),h/=t.scaleX,l/=t.scaleY;break;case"world":h=1,l=1;break;case"page":e=u||t;default:S.set(d).divide(t.getTransform(e));const i=e.worldTransform;h/=h/i.scaleX,l/=l/i.scaleY}o=t.getBounds("render",e)}const B={scaleX:1,scaleY:1};E.getScaleData(s.scale,s.size,o,B);let T=s.pixelRatio||1,{x:P,y:R,width:L,height:C}=new At(o).scale(B.scaleX,B.scaleY);_&&(P+=_.x,R+=_.y,L=_.width,C=_.height);const O={exporting:!0,matrix:S.scale(1/B.scaleX,1/B.scaleY).invert().translate(-P,-R).withScale(1/h*B.scaleX,1/l*B.scaleY)};let A,D=Gt.canvas({width:Math.floor(L),height:Math.floor(C),pixelRatio:T,smooth:w,contextSettings:x});g&&(A=t,A.__worldOpacity=0,t=u||t,O.bounds=D.bounds),D.save();const M=p&&!r(b),I=t.get("fill");if(M&&(t.fill=""),e.render(t,D,O),M&&(t.fill=I),D.restore(),A&&A.__updateWorldOpacity(),f){a=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?lv(r,n,o):hv(r={},n,o)),a++;const h=new At;return r&&(dv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(D);const t=D,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:T};D=Gt.canvas(s),D.copyWorld(t,a,s),t.destroy()}if(y){const[t,e,i,s]=E.fourNumber(y),n=D,{width:o,height:r}=n;D=Gt.canvas({width:o+s+e,height:r+t+i,pixelRatio:T}),D.copyWorld(n,n.bounds,{x:s,y:t,width:o,height:r}),n.destroy()}k&&D.fillWorld(D.bounds,b||"#FFFFFF","destination-over"),v&&v(D);n={data:"canvas"===i?D:D.export(i,s),width:D.pixelWidth,height:D.pixelHeight,renderBounds:o,trimBounds:a};const F=u&&u.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return Dh.running=!1,n},export(t,i,s){return Dh.running=!0,function(t){uv||(uv=new Dn);return new Promise(e=>{uv.add(()=>ee(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(o=>{const r=()=>ee(this,void 0,void 0,function*(){if(!In.isComplete)return e.requestRender(r);const a=Dh.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),o()});t.updateLayout(),pv(t);const{leafer:a}=t;a?a.waitViewCompleted(r):r()}))}};let uv;function pv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>pv(t))}const gv=_e.prototype,_v=Wt.get("@leafer-in/export");return gv.export=function(t,e){const{quality:i,blob:s}=Ln.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},gv.toBlob=function(t,i){return new Promise(s=>{e.origin.canvasToBolb(this.view,t,i).then(t=>{s(t)}).catch(t=>{_v.error(t),s(null)})})},gv.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},gv.saveAs=function(t,i){return new Promise(s=>{e.origin.canvasSaveAs(this.view,t,i).then(()=>{s(!0)}).catch(t=>{_v.error(t),s(!1)})})},Vt.add("export"),Object.assign(Dh,cv),t.UI.prototype.export=function(t,e){return Dh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Dh.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}}),Vt.add("bright"),t.UI.addAttr("bright",!1,go),t.AlignHelper=ut,t.AnimateEasing=Am,t.AnimateEvent=Mm,t.AroundHelper=lt,t.ArrowData=W_,t.AutoBounds=Mt,t.BezierHelper=Ve,t.Bounds=At,t.BoundsEvent=Sr,t.BoundsHelper=Rt,t.BoxData=Gh,t.BranchHelper=nr,t.BranchRender=va,t.CanvasData=ol,t.CanvasManager=Qt,t.ChildEvent=wr,t.ColorConvert=Bh,t.Creator=Gt,t.Cursor=Ed,t.DataHelper=m,t.Debug=Wt,t.DragBoundsHelper=cl,t.Dragger=ud,t.EditBox=ng,t.EditDataHelper=qp,t.EditPoint=eg,t.EditSelect=Wp,t.EditSelectHelper=Dp,t.EditToolCreator=mg,t.EditorEvent=Ep,t.EditorGroupEvent=wg,t.EditorHelper=pg,t.EditorMoveEvent=Sg,t.EditorRotateEvent=Tg,t.EditorScaleEvent=Bg,t.EditorSkewEvent=Pg,t.Effect=Oh,t.EllipseData=Jh,t.EllipseHelper=ti,t.Event=vr,t.EventCreator=Jt,t.Eventer=Nr,t.Export=Dh,t.FileHelper=Ln,t.Filter=Ah,t.Finder=ov,t.FrameData=Kh,t.GroupData=Vh,t.HTMLTextData=F_,t.HighBezierHelper=py,t.HighCurveHelper=xy,t.HitCanvasManager=kd,t.ImageData=nl,t.ImageEvent=kr,t.ImageManager=Wn,t.IncrementId=i,t.InnerEditor=Lg,t.InnerEditorEvent=vg,t.InteractionBase=bd,t.InteractionHelper=rd,t.Keyboard=td,t.LayoutEvent=Ar,t.Layouter=fh,t.LeafBounds=fa,t.LeafBoundsHelper=tr,t.LeafData=v,t.LeafDataProxy=ea,t.LeafEventer=Qr,t.LeafHelper=Go,t.LeafLayout=yr,t.LeafLevelList=th,t.LeafList=Qa,t.LeafMatrix=ha,t.LeafRender=ma,t.LeaferCanvas=eh,t.LeaferCanvasBase=_e,t.LeaferData=jh,t.LeaferEvent=Mr,t.LeaferImage=Xn,t.LeaferTypeCreator=m_,t.LineData=Zh,t.MathHelper=E,t.Matrix=it,t.MatrixHelper=W,t.MultiTouchHelper=w_,t.MyDragEvent=od,t.MyImage=Kl,t.MyPointerEvent=sd,t.NeedConvertToCanvasCommandMap=we,t.OneRadian=S,t.PI2=B,t.PI_2=T,t.Paint=Rh,t.PaintGradient=Ch,t.PaintImage=Lh,t.PathArrow=Ph,t.PathArrowModule=If,t.PathBounds=yn,t.PathCommandDataHelper=as,t.PathCommandMap=ye,t.PathConvert=Wi,t.PathCorner=Sn,t.PathCreator=ks,t.PathData=tl,t.PathDrawer=zs,t.PathHelper=fe,t.PathMatrixHelper=Z_,t.PathNumberCommandLengthMap=ke,t.PathNumberCommandMap=Ee,t.PathScaler=Zg,t.PenData=el,t.Picker=wh,t.Platform=e,t.Plugin=Vt,t.Point=tt,t.PointHelper=Z,t.PointerButton=ed,t.PolygonData=$h,t.PropertyEvent=br,t.RectData=qh,t.RectHelper=Se,t.RectRender=fl,t.RenderEvent=Dr,t.Renderer=yh,t.ResizeEvent=Cr,t.Resource=In,t.RobotData=$y,t.Run=Nt,t.ScrollBar=I_,t.SelectArea=Ap,t.Selector=xh,t.StarData=Qh,t.State=Mh,t.StringNumberMap=It,t.Stroker=Op,t.TaskItem=An,t.TaskProcessor=Dn,t.TextConvert=Sh,t.TextData=sl,t.TransformTool=Rg,t.Transformer=B_,t.Transition=Ih,t.TwoPointBoundsHelper=nt,t.UIBounds=rl,t.UICreator=Kt,t.UIData=Yh,t.UIEvent=id,t.UIRender=gl,t.UnitConvert=Th,t.WaitHelper=hr,t.WatchEvent=Or,t.Watcher=oh,t.WheelEventHelper=S_,t.addViewport=g_,t.addViewportConfig=__,t.affectRenderBoundsType=uo,t.affectStrokeBoundsType=ho,t.arrowType=z_,t.attr=Zn,t.autoLayoutType=to,t.boundsType=so,t.canvasPatch=Rn,t.canvasSizeAttrs=ge,t.createAttr=function(t){return(e,i)=>{Vn(e,i,jn(i,t))}},t.createDescriptor=jn,t.cursorType=Eo,t.dataProcessor=ko,t.dataType=Jn,t.decorateLeafAttr=Kn,t.defineDataProcessor=So,t.defineKey=Vn,t.defineLeafAttr=qn,t.dimType=go,t.doBoundsType=oo,t.doStrokeType=lo,t.effectType=bh,t.emptyData=o,t.eraserType=xo,t.extraPropertyEventMap=Er,t.getBoundsData=R,t.getDescriptor=Gn,t.getMatrixData=L,t.getPointData=P,t.hitType=bo,t.isArray=p,t.isData=_,t.isEmptyData=f,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=g,t.isString=h,t.isUndefined=r,t.layoutProcessor=function(t){return(e,i)=>{Vn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Ur,t.maskType=wo,t.motionPathType=by,t.naturalBoundsType=no,t.opacityType=_o,t.path=Bn,t.pathInputType=ro,t.pathType=ao,t.pen=Tn,t.positionType=$n,t.registerEditTool=_g,t.registerInnerEditor=fg,t.registerUI=Ao,t.registerUIEvent=Do,t.resizeType=Eh,t.rewrite=Ro,t.rewriteAble=Lo,t.rotationType=io,t.scaleResize=n_,t.scaleResizeFontSize=o_,t.scaleResizeGroup=h_,t.scaleResizePath=r_,t.scaleResizePoints=a_,t.scaleType=eo,t.scrollType=Qn,t.sortType=vo,t.stateStyleType=Cy,t.stateType=Ly,t.strokeType=co,t.surfaceType=po,t.tempBounds=Dt,t.tempMatrix=st,t.tempPoint=et,t.tryToNumber=u,t.useCanvas=sh,t.useModule=Oo,t.version="1.9.7",t.visibleType=fo,t.zoomLayerType=kh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=worker.min.js.map