@leafer/miniapp 1.9.5 → 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
- const t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const o={};function n(t){return void 0===t}function r(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return _(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return y(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&y(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{n(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!n(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]=n(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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!n(t))){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:v,pow:w,PI:x}=Math,b={within:(t,e,i)=>(_(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(u(t))switch(t.length){case 4:i=n(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),b.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=n(e)?1e12:w(10,e);return-0===(t=v(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,o=(l(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&b.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:k,randColor:t=>`rgba(${k(255)},${k(255)},${k(255)},${t||1})`};function k(t){return Math.round(Math.random()*t)}const E=x/180,S=2*x,B=x/2;function R(){return{x:0,y:0}}function T(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:P,cos:O,acos:L,sqrt:A}=Math,{float:M}=b,D={};function F(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const I={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:F(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:C,getWorld:F,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},scaleOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.scaleOfInner(t,D,i,s)},scaleOfInner(t,e,i,s=i){W.translateInner(t,e.x,e.y),W.scale(t,i,s),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=O(e*=E),a=P(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){W.toInnerPoint(t,e,D),W.rotateOfInner(t,D,i)},rotateOfInner(t,e,i){W.translateInner(t,e.x,e.y),W.rotate(t,i),W.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=E,t.a=s+n*i,t.b=o+r*i),e&&(e*=E,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.skewOfInner(t,D,i,s)},skewOfInner(t,e,i,s=0){W.translateInner(t,e.x,e.y),W.skew(t,i,s),W.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,o){const{e:r,f:a}=t;if(i||(i=t),n(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,s,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(n(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*E,r=O(n),a=P(n);if(s||o){const e=s*E,i=o*E;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&W.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=A(o*o+n*n),c=t/d;const e=o/d;u=n>0?L(e):-L(e)}else{c=A(r*r+a*a),d=t/c;const e=r/c;u=B-(a>0?L(-e):-L(e))}const e=M(O(u)),i=P(u);d=M(d),c=M(c),_=e?M((r/c+i)/e/E,9):0,p=e?M((n/d-i)/e/E,9):0,u=M(u/E)}else d=o,c=a,u=_=p=0;return(e=i||e)&&(g+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=A(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){W.set(t)}},W=I,{toInnerPoint:z,toOuterPoint:N}=I,{sin:Y,cos:X,abs:H,sqrt:V,atan2:j,min:U,round:G}=Math,K={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=n(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(t.y)},move(t,e,i){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=q.defaultPoint);const s=X(e*=E),o=Y(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=q;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return J(i,t),N(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return J(i,t),q.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){z(e,t,i)},toOuterOf(t,e,i){N(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>Z(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=H(i-t),n=H(s-e);return V(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>U(Z(t,e,i,s),Z(i,s,o,n)),getAngle:(t,e)=>Q(t,e)/E,getRotation:(t,e,i,s)=>(s||(s=e),q.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/E),getRadianFrom(t,e,i,s,o,r,a,h){n(a)&&(a=i,h=s);const l=t-i,d=e-s,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>j(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=Q(t,e);return(e=s?e:{}).x=t.x+X(o)*i,e.y=t.y+Y(o)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=K,{getDistanceFrom:Z,copy:J,getAtan2:Q}=q;class ${constructor(t,e){this.set(t,e)}set(t,e){return _(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new $(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new $(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new $(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new $;class et{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return _(t)?I.copy(this,t):I.set(this,t,e,i,s,o,n),this}setWith(t){return I.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new et(this)}translate(t,e){return I.translate(this,t,e),this}translateInner(t,e){return I.translateInner(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleWith(t,e){return I.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return I.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return I.scaleOfInner(this,t,e,i),this}rotate(t){return I.rotate(this,t),this}rotateOfOuter(t,e){return I.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return I.rotateOfInner(this,t,e),this}skew(t,e){return I.skew(this,t,e),this}skewOfOuter(t,e,i){return I.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return I.skewOfInner(this,t,e,i),this}multiply(t){return I.multiply(this,t),this}multiplyParent(t){return I.multiplyParent(this,t),this}divide(t){return I.divide(this,t),this}divideParent(t){return I.divideParent(this,t),this}invert(){return I.invert(this),this}invertWith(){return I.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){I.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){I.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return I.setLayout(this,t,e,i),this}getLayout(t,e,i){return I.getLayout(this,t,e,i)}withScale(t,e){return I.withScale(this,t,e)}reset(){I.reset(this)}}const it=new et,st={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,o){ot(t,e,i),ot(t,e+s,i+o)},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}=st;var nt,rt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(nt||(nt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(rt||(rt={}));const at=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,i,s,o,n){const r=lt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),ht.toPoint(t,e,i,!0),i)};function lt(t){return a(t)?at[rt[t]]:t}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,o,n){dt(t,i,s,o,e,n)}},{tempPointBounds:ut,setPoint:_t,addPoint:pt,toBounds:gt}=st,{toOuterPoint:ft}=I,{float:yt,fourNumber:mt}=b,{floor:vt,ceil:wt}=Math;let xt,bt,kt,Et;const St={},Bt={},Rt={},Tt={tempBounds:Rt,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(u(i)){const e=mt(i);s?Ct.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ct.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ct.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ot(e,t):e=t,i?(e.offsetX=-(Ct.maxX(i)-t.x),e.offsetY=-(Ct.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||K.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){K.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ct.copy(Rt,t),Ct.toOuterOf(Rt,e),Rt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o}=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),o>0?(i.height=t.height*o,i.y=e.f+t.y*o):(i.height=t.height*-o,i.y=e.f+t.y*o-i.height)}else St.x=t.x,St.y=t.y,ft(e,St,Bt),_t(ut,Bt.x,Bt.y),St.x=t.x+t.width,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),St.y=t.y+t.height,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),St.x=t.x,ft(e,St,Bt),pt(ut,Bt.x,Bt.y),gt(ut,i)},toInnerOf(t,e,i){i||(i=t),Ct.move(i,-e.e,-e.f),Ct.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ct.getFitScale(t,e));return new et(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,n){n||(n=e),a(s)&&(s=Ct.getFitScale(t,e,"cover"===s)),Rt.width=o?e.width*=s:e.width*s,Rt.height=o?e.height*=s:e.height*s,ct.toPoint(i,Rt,t,n,!0,!0)},getSpread(t,e,i){const s={};return Ct.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ct.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ct.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=i>t.y?wt(t.height+i-t.y):wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,i){xt=t.x+t.width,bt=t.y+t.height,kt=e.x,Et=e.y,i||(kt+=e.width,Et+=e.height),xt=xt>kt?xt:kt,bt=bt>Et?bt:Et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=bt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ct.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ct.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Ot(t,o)):Pt(t,o));n&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ut,t.x,t.y):pt(ut,t.x,t.y)),gt(ut,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Pt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=K.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=K.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ct.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ct.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ct.tempToOuterOf(e,i)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return xt=s+n,bt=o+r,kt=t.x+t.width,Et=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,xt=xt<kt?xt:kt,bt=bt<Et?bt:Et,n=xt-s,r=bt-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){Ct.copy(t,Ct.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Ct.set(t)}},Ct=Tt,{add:Pt,copy:Ot}=Ct;class Lt{get minX(){return Tt.minX(this)}get minY(){return Tt.minY(this)}get maxX(){return Tt.maxX(this)}get maxY(){return Tt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Tt.copy(this,t):Tt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Lt(this)}move(t,e){return Tt.move(this,t,e),this}scale(t,e,i){return Tt.scale(this,t,e,i),this}scaleOf(t,e,i){return Tt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Tt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Tt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Tt.getFitMatrix(this,t,e)}put(t,e,i){Tt.put(this,t,e,i)}spread(t,e){return Tt.spread(this,t,e),this}shrink(t,e){return Tt.shrink(this,t,e),this}ceil(){return Tt.ceil(this),this}unsign(){return Tt.unsign(this),this}float(t){return Tt.float(this,t),this}add(t){return Tt.add(this,t),this}addList(t){return Tt.setList(this,t,!0),this}setList(t){return Tt.setList(this,t),this}addListWithFn(t,e){return Tt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Tt.setListWithFn(this,t,e),this}setPoint(t){return Tt.setPoint(this,t),this}setPoints(t){return Tt.setPoints(this,t),this}addPoint(t){return Tt.addPoint(this,t),this}getPoints(){return Tt.getPoints(this)}hitPoint(t,e){return Tt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Tt.hitRadiusPoint(this,t,e)}hit(t,e){return Tt.hit(this,t,e)}includes(t,e){return Tt.includes(this,t,e)}intersect(t,e){return Tt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Tt.getIntersectData(this,t,e))}isSame(t){return Tt.isSame(this,t)}isEmpty(){return Tt.isEmpty(this)}reset(){Tt.reset(this)}}const At=new Lt;class Mt{constructor(t,e,i,s,o,n){_(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Lt(o,e,n||t.width-o-i,r||t.height-e-s)}}const Dt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Ft}=b;class It{constructor(t){this.repeatMap={},this.name=t}static get(t){return new It(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const i=Ft();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===It.showBounds,o=t.__nowWorld,n=Ft();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(zt.enable){if(zt.filterList.length&&zt.filterList.every(t=>t!==this.name))return;if(zt.excludeList.length&&zt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){zt.enable&&this.warn(...t)}warn(...t){zt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Wt(t){return t?a(t)&&(t=[t]):t=[],t}It.filterList=[],It.excludeList=[],It.showWarn=!0;const zt=It,Nt=It.get("RunTime"),Yt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Xt.currentId=Xt.idMap[s]=i?performance.now():Date.now(),Xt.currentName=Xt.nameMap[s]=t,Xt.nameToIdMap[t]=s,s},end(t,e){const i=Xt.idMap[t],s=Xt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Xt.idMap[t]=Xt.nameMap[t]=Xt.nameToIdMap[s]=void 0,Nt.log(s,o,"ms")},endOfName(t,e){const i=Xt.nameToIdMap[t];n(i)||Xt.end(i,e)}},Xt=Yt,Ht=[],Vt={list:{},add(t,...e){this.list[t]=!0,Ht.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(()=>Ht.forEach(t=>Vt.has(t,!0)));const jt={editor:t=>Vt.need("editor")},Ut=It.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&Ut.repeat(e),Kt[e]=t},get(t,e,i,s,o,r){Kt[t]||Ut.error("not register "+t);const a=new Kt[t](e);return n(i)||(a.x=i,s&&(a.y=s),o&&(a.width=o),r&&(a.height=r)),a}},{list:Kt}=Gt,qt=It.get("EventCreator"),Zt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(Jt[e]&&qt.repeat(e),Jt[e]=t)})},changeName(t,e){const i=Jt[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,Jt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Jt[t](...e)},{nameList:Jt}=Zt;class 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,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=jt.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function $t(t,e,i,s){var o,n=arguments.length,r=n<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--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function te(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ee(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ie=[];function se(){return(t,e)=>{ie.push(e)}}const oe=[];let ne=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||oe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};$t([ee("imageSmoothingEnabled")],ne.prototype,"smooth",void 0),$t([ee("imageSmoothingQuality")],ne.prototype,"smoothLevel",void 0),$t([ee("globalAlpha")],ne.prototype,"opacity",void 0),$t([ee()],ne.prototype,"fillStyle",void 0),$t([ee()],ne.prototype,"strokeStyle",void 0),$t([ee("lineWidth")],ne.prototype,"strokeWidth",void 0),$t([ee("lineCap")],ne.prototype,"strokeCap",void 0),$t([ee("lineJoin")],ne.prototype,"strokeJoin",void 0),$t([ee("lineDashOffset")],ne.prototype,"dashOffset",void 0),$t([ee()],ne.prototype,"miterLimit",void 0),$t([ee()],ne.prototype,"shadowBlur",void 0),$t([ee()],ne.prototype,"shadowColor",void 0),$t([ee()],ne.prototype,"shadowOffsetX",void 0),$t([ee()],ne.prototype,"shadowOffsetY",void 0),$t([ee()],ne.prototype,"filter",void 0),$t([ee()],ne.prototype,"font",void 0),$t([ee()],ne.prototype,"fontKerning",void 0),$t([ee()],ne.prototype,"fontStretch",void 0),$t([ee()],ne.prototype,"fontVariantCaps",void 0),$t([ee()],ne.prototype,"textAlign",void 0),$t([ee()],ne.prototype,"textBaseline",void 0),$t([ee()],ne.prototype,"textRendering",void 0),$t([ee()],ne.prototype,"wordSpacing",void 0),$t([ee()],ne.prototype,"letterSpacing",void 0),$t([ee()],ne.prototype,"direction",void 0),$t([se()],ne.prototype,"setTransform",null),$t([se()],ne.prototype,"resetTransform",null),$t([se()],ne.prototype,"getTransform",null),$t([se()],ne.prototype,"save",null),$t([se()],ne.prototype,"restore",null),$t([se()],ne.prototype,"translate",null),$t([se()],ne.prototype,"scale",null),$t([se()],ne.prototype,"rotate",null),$t([se()],ne.prototype,"fill",null),$t([se()],ne.prototype,"stroke",null),$t([se()],ne.prototype,"clip",null),$t([se()],ne.prototype,"fillRect",null),$t([se()],ne.prototype,"strokeRect",null),$t([se()],ne.prototype,"clearRect",null),$t([se()],ne.prototype,"beginPath",null),$t([se()],ne.prototype,"moveTo",null),$t([se()],ne.prototype,"lineTo",null),$t([se()],ne.prototype,"bezierCurveTo",null),$t([se()],ne.prototype,"quadraticCurveTo",null),$t([se()],ne.prototype,"closePath",null),$t([se()],ne.prototype,"arc",null),$t([se()],ne.prototype,"arcTo",null),$t([se()],ne.prototype,"ellipse",null),$t([se()],ne.prototype,"rect",null),$t([se()],ne.prototype,"roundRect",null),$t([se()],ne.prototype,"createConicGradient",null),$t([se()],ne.prototype,"createLinearGradient",null),$t([se()],ne.prototype,"createPattern",null),$t([se()],ne.prototype,"createRadialGradient",null),$t([se()],ne.prototype,"fillText",null),$t([se()],ne.prototype,"measureText",null),$t([se()],ne.prototype,"strokeText",null);const{copy:re,multiplyParent:ae}=I,{round:he}=Math,le=new Lt,de=new Lt,ce={width:1,height:1,pixelRatio:1},ue=["width","height","pixelRatio"];class _e extends ne{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(i,s){super(),this.size={},this.worldTransform={},i||(i=ce),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:o,height:n,pixelRatio:r}=i;this.autoLayout=!o||!n,this.size.pixelRatio=r||t.devicePixelRatio,this.config=i,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,ue),ue.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&ae(t,e,o),o.a=t.a*i,o.b=t.b*i,o.c=t.c*i,o.d=t.d*i,o.e=t.e*i,o.f=t.f*i,s&&(t.half&&t.half*i%2?(o.e=he(o.e-.5)+.5,o.f=he(o.f-.5)+.5):(o.e=he(o.e),o.f=he(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),n(e.dashPattern)||(o=e.dashPattern),n(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=o,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),i=de):i=le,this.drawImage(t.view,le.x,le.y,le.width,le.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Tt.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),this.drawImage(t.view,le.x,le.y,le.width,le.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(le.x,le.y,le.width,le.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,le.x,le.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(de,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,o=this.manager?this.manager.get(i):jt.canvas(Object.assign({},i));return o.save(),t&&(re(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ge={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},fe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},ge),ye={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},me={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},ve=Object.assign(Object.assign({},me),ge),we=fe,xe={};for(let t in we)xe[we[t]]=t;const be={};for(let t in we)be[we[t]]=ye[t];const ke={drawRoundRect(t,e,i,s,o,n){const r=b.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Ee,cos:Se,hypot:Be,atan2:Re,ceil:Te,abs:Ce,PI:Pe,sqrt:Oe,pow:Le}=Math,{setPoint:Ae,addPoint:Me}=st,{set:De,toNumberPoints:Fe}=K,{M:Ie,L:We,C:ze,Q:Ne,Z:Ye}=fe,Xe={},He={points(t,e,i,s){let o=Fe(e);if(t.push(Ie,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,_,p,g,f,y=o.length;const m=!0===i?.5:i;s&&(o=[o[y-2],o[y-1],...o,o[0],o[1],o[2],o[3]],y=o.length);for(let i=2;i<y-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],p=Oe(Le(r-e,2)+Le(a-n,2)),g=Oe(Le(h-r,2)+Le(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=r-p*h,c=a-p*l,2===i?s||t.push(Ne,d,c,r,a):t.push(ze,u,_,d,c,r,a),u=r+g*h,_=a+g*l);s||t.push(Ne,u,_,o[y-2],o[y-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(We,o[e],o[e+1]);s&&t.push(Ye)},rect(t,e,i,s,o){pe.creator.path=t,pe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){pe.creator.path=[],ke.drawRoundRect(pe.creator,e,i,s,o,n),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,_=n-s,p=r-o;let g=Re(u,c),f=Re(p,_);const y=Be(c,u),m=Be(_,p);let v=f-g;if(v<0&&(v+=S),y<1e-12||m<1e-12||v<1e-12||Ce(v-Pe)<1e-12)return t&&t.push(We,s,o),h&&(Ae(h,e,i),Me(h,s,o)),d&&De(d,e,i),void(l&&De(l,s,o));const w=c*p-_*u<0,x=w?-1:1,b=a/Se(v/2),k=s+b*Se(g+v/2+B*x),R=o+b*Ee(g+v/2+B*x);return g-=B*x,f-=B*x,Ue(t,k,R,a,a,0,g/E,f/E,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>Ue(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*E,_=Ee(u),p=Se(u);let g=r*E,f=a*E;g>Pe&&(g-=S),f<0&&(f+=S);let y=f-g;y<0?y+=S:y>S&&(y-=S),h&&(y-=S);const m=Te(Ce(y/B)),v=y/m,w=Ee(v/4),x=8/3*w*w/Ee(v/2);f=g+v;let b,k,R,T,C,P,O,L,A=Se(g),M=Ee(g),D=R=p*s*A-_*o*M,F=T=_*s*A+p*o*M,I=e+R,W=i+T;t&&t.push(t.length?We:Ie,I,W),l&&Ae(l,I,W),c&&De(c,I,W);for(let n=0;n<m;n++)b=Se(f),k=Ee(f),R=p*s*b-_*o*k,T=_*s*b+p*o*k,C=e+D-x*(p*s*M+_*o*A),P=i+F-x*(_*s*M-p*o*A),O=e+R+x*(p*s*k+_*o*b),L=i+T+x*(_*s*k-p*o*b),t&&t.push(ze,C,P,O,L,e+R,i+T),l&&je(e+D,i+F,C,P,O,L,e+R,i+T,l,!0),D=R,F=T,A=b,M=k,g=f,f+=v;d&&De(d,e+R,i+T)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(ze,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){je(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Me(h,t,e):Ae(h,t,e),Me(h,r,a);for(let l=0,c=d.length;l<c;l++)Ve(d[l],t,e,i,s,o,n,r,a,Xe),Me(h,Xe.x,Xe.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*a,l.y=c*i+u*o+_*r+p*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return Ve(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:Ve,toTwoPointBounds:je,ellipse:Ue}=He,{sin:Ge,cos:Ke,sqrt:qe,atan2:Ze}=Math,{ellipse:Je}=He,Qe={ellipticalArc(e,i,s,o,n,r,a,h,l,d,c){const u=(l-i)/2,_=(d-s)/2,p=r*E,g=Ge(p),f=Ke(p),y=-f*u-g*_,m=-f*_+g*u,v=o*o,w=n*n,x=m*m,b=y*y,k=v*w-v*x-w*b;let B=0;if(k<0){const t=qe(1-k/(v*w));o*=t,n*=t}else B=(a===h?-1:1)*qe(k/(v*x+w*b));const R=B*o*m/n,T=-B*n*y/o,C=Ze((m-T)/n,(y-R)/o),P=Ze((-m-T)/n,(-y-R)/o);let O=P-C;0===h&&O>0?O-=S:1===h&&O<0&&(O+=S);const L=i+u+f*R-g*T,A=s+_+g*R+f*T,M=O<0?1:0;c||t.ellipseToCurve?Je(e,L,A,o,n,r,C/E,P/E,M):o!==n||r?e.push(fe.G,L,A,o,n,r,C/E,P/E,M):e.push(fe.O,L,A,o,C/E,P/E,M)}},{M:$e,m:ti,L:ei,l:ii,H:si,h:oi,V:ni,v:ri,C:ai,c:hi,S:li,s:di,Q:ci,q:ui,T:_i,t:pi,A:gi,a:fi,Z:yi,z:mi,N:vi,D:wi,X:xi,G:bi,F:ki,O:Ei,P:Si,U:Bi}=fe,{rect:Ri,roundRect:Ti,arcTo:Ci,arc:Pi,ellipse:Oi,quadraticCurveTo:Li}=He,{ellipticalArc:Ai}=Qe,Mi=It.get("PathConvert"),Di={},Fi={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=be[s],a+=s===o?" ":xe[s];for(let s=1;s<i;s++)a+=b.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?ve:me;for(let e=0,h=t.length;e<h;e++)s=t[e],Dt[s]?("."===s&&(Ii.dot&&(Wi(r,n),n=""),Ii.dot++),"0"===n&&"."!==s&&(Wi(r,n),n=""),n+=s):fe[s]?(n&&(Wi(r,n),n=""),Ii.name=fe[s],Ii.length=ye[s],Ii.index=0,Wi(r,Ii.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&Wi(r,n),n=s):n&&(Wi(r,n),n=""),o=s;return n&&Wi(r,n),i?Fi.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(o=t[c],o){case ti:t[c+1]+=a,t[c+2]+=h;case $e:a=t[c+1],h=t[c+2],_.push($e,a,h),c+=3;break;case oi:t[c+1]+=a;case si:a=t[c+1],_.push(ei,a,h),c+=2;break;case ri:t[c+1]+=h;case ni:h=t[c+1],_.push(ei,a,h),c+=2;break;case ii:t[c+1]+=a,t[c+2]+=h;case ei:a=t[c+1],h=t[c+2],_.push(ei,a,h),c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=li;case li:r=n===ai||n===li,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],_.push(ai,l,d,i,s,a,h),c+=5;break;case hi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=ai;case ai:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(ai,t[c+1],t[c+2],i,s,a,h),c+=7;break;case pi:t[c+1]+=a,t[c+2]+=h,o=_i;case _i:r=n===ci||n===_i,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Li(_,a,h,i,s,t[c+1],t[c+2]):_.push(ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ui:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=ci;case ci:i=t[c+1],s=t[c+2],e?Li(_,a,h,i,s,t[c+3],t[c+4]):_.push(ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case fi:t[c+6]+=a,t[c+7]+=h;case gi:Ai(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case mi:case yi:_.push(yi),c++;break;case vi:a=t[c+1],h=t[c+2],e?Ri(_,a,h,t[c+3],t[c+4]):zi(_,t,c,5),c+=5;break;case wi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):zi(_,t,c,9),c+=9;break;case xi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],t[c+5]):zi(_,t,c,6),c+=6;break;case bi:Oi(e?_:zi(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Di),a=Di.x,h=Di.y,c+=9;break;case ki:e?Oi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):zi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ei:Pi(e?_:zi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Di),a=Di.x,h=Di.y,c+=7;break;case Si:e?Pi(_,t[c+1],t[c+2],t[c+3],0,360,!1):zi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Bi:Ci(e?_:zi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Di),a=Di.x,h=Di.y,c+=6;break;default:return Mi.error(`command: ${o} [index:${c}]`,t),_}n=o}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push($e,t.x,t.y);break;case"L":e.push(ei,t.x,t.y);break;case"C":e.push(ai,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(yi)}}),e},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){Ii.index===Ii.length&&(Ii.index=1,t.push(Ii.name)),t.push(Number(e)),Ii.index++,Ii.dot=0}},{current:Ii,pushData:Wi,copyData:zi}=Fi,{M:Ni,L:Yi,C:Xi,Q:Hi,Z:Vi,N:ji,D:Ui,X:Gi,G:Ki,F:qi,O:Zi,P:Ji,U:Qi}=fe,{getMinDistanceFrom:$i,getRadianFrom:ts}=K,{tan:es,min:is,abs:ss}=Math,os={},ns={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,o,n,r){t.push(Xi,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(Hi,e,i,s,o)},closePath(t){t.push(Vi)},rect(t,e,i,s,o){t.push(ji,e,i,s,o)},roundRect(t,e,i,s,o,n){if(l(n))t.push(Gi,e,i,s,o,n);else{const r=b.fourNumber(n);r?t.push(Ui,e,i,s,o,...r):t.push(ji,e,i,s,o)}},ellipse(t,e,i,s,o,n,a,h,l){r(n)?t.push(qi,e,i,s,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(Ki,e,i,s,o,n,a,h,l?1:0))},arc(t,e,i,s,o,n,a){r(o)?t.push(Ji,e,i,s):(r(n)&&(n=360),t.push(Zi,e,i,s,o,n,a?1:0))},arcTo(t,e,i,s,o,r,a,h){if(!n(a)){const t=$i(a,h,e,i,s,o);r=is(r,is(t/2,t/2*ss(es(ts(a,h,e,i,s,o)/2))))}t.push(Qi,e,i,s,o,r)},drawEllipse(t,e,i,s,o,n,a,h,l){He.ellipse(null,e,i,s,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,os),t.push(Ni,os.x,os.y),rs(t,e,i,s,o,n,a,h,l)},drawArc(t,e,i,s,o,n,a){He.arc(null,e,i,s,r(o)?0:o,r(n)?360:n,a,null,null,os),t.push(Ni,os.x,os.y),as(t,e,i,s,o,n,a)},drawPoints(t,e,i,s){He.points(t,e,i,s)}},{ellipse:rs,arc:as}=ns,{moveTo:hs,lineTo:ls,quadraticCurveTo:ds,bezierCurveTo:cs,closePath:us,beginPath:_s,rect:ps,roundRect:gs,ellipse:fs,arc:ys,arcTo:ms,drawEllipse:vs,drawArc:ws,drawPoints:xs}=ns;class bs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?pe.parse(t):t:[],this}beginPath(){return _s(this.__path),this.paint(),this}moveTo(t,e){return hs(this.__path,t,e),this.paint(),this}lineTo(t,e){return ls(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return cs(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return ds(this.__path,t,e,i,s),this.paint(),this}closePath(){return us(this.__path),this.paint(),this}rect(t,e,i,s){return ps(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return gs(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return fs(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return ys(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return ms(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return vs(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return ws(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:ks,L:Es,C:Ss,Q:Bs,Z:Rs,N:Ts,D:Cs,X:Ps,G:Os,F:Ls,O:As,P:Ms,U:Ds}=fe,Fs=It.get("PathDrawer"),Is={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case ks:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Es:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ss:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Bs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Rs:t.closePath(),s+=1;break;case Ts:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Cs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Ps:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Os:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*E,e[s+6]*E,e[s+7]*E,e[s+8]),s+=9;break;case Ls:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,S,!1),s+=5;break;case As:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*E,e[s+5]*E,e[s+6]),s+=7;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],0,S,!1),s+=4;break;case Ds:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Fs.error(`command: ${i} [index:${s}]`,e)}}},{M:Ws,L:zs,C:Ns,Q:Ys,Z:Xs,N:Hs,D:Vs,X:js,G:Us,F:Gs,O:Ks,P:qs,U:Zs}=fe,{toTwoPointBounds:Js,toTwoPointBoundsByQuadraticCurve:Qs,arcTo:$s,arc:to,ellipse:eo}=He,{addPointBounds:io,copy:so,addPoint:oo,setPoint:no,addBounds:ro,toBounds:ao}=st,ho=It.get("PathBounds");let lo,co,uo;const _o={},po={},go={},fo={toBounds(t,e){fo.toTwoPointBounds(t,po),ao(po,e)},toTwoPointBounds(t,e){if(!t||!t.length)return no(e,0,0);let i,s,o,n,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?no(e,h,l):no(e,t[a+1],t[a+2])),r){case Ws:case zs:h=t[a+1],l=t[a+2],oo(e,h,l),a+=3;break;case Ns:o=t[a+5],n=t[a+6],Js(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,_o),io(e,_o),h=o,l=n,a+=7;break;case Ys:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],Qs(h,l,i,s,o,n,_o),io(e,_o),h=o,l=n,a+=5;break;case Xs:a+=1;break;case Hs:h=t[a+1],l=t[a+2],ro(e,h,l,t[a+3],t[a+4]),a+=5;break;case Vs:case js:h=t[a+1],l=t[a+2],ro(e,h,l,t[a+3],t[a+4]),a+=r===Vs?9:6;break;case Us:eo(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],_o,go),0===a?so(e,_o):io(e,_o),h=go.x,l=go.y,a+=9;break;case Gs:h=t[a+1],l=t[a+2],co=t[a+3],uo=t[a+4],ro(e,h-co,l-uo,2*co,2*uo),h+=co,a+=5;break;case Ks:to(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],_o,go),0===a?so(e,_o):io(e,_o),h=go.x,l=go.y,a+=7;break;case qs:h=t[a+1],l=t[a+2],lo=t[a+3],ro(e,h-lo,l-lo,2*lo,2*lo),h+=lo,a+=4;break;case Zs:$s(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],_o,go),0===a?so(e,_o):io(e,_o),h=go.x,l=go.y,a+=6;break;default:return void ho.error(`command: ${r} [index:${a}]`,t)}}},{M:yo,L:mo,Z:vo}=fe,{getCenterX:wo,getCenterY:xo}=K,{arcTo:bo}=ns,ko={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;r<g;){switch(s=t[r],s){case yo:l=_=t[r+1],d=p=t[r+2],r+=3,t[r]===mo?(c=t[r+1],u=t[r+2],f.push(yo,wo(l,c),xo(d,u))):f.push(yo,l,d);break;case mo:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case mo:bo(f,a,h,t[r+1],t[r+2],e,_,p);break;case vo:bo(f,a,h,l,d,e,_,p);break;default:f.push(mo,a,h)}_=a,p=h;break;case vo:o!==vo&&(bo(f,l,d,c,u,e,_,p),f.push(vo)),r+=1;break;default:n=be[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==vo&&(f[1]=l,f[2]=d),f}};function Eo(t){return new bs(t)}const So=Eo();pe.creator=Eo(),pe.parse=Fi.parse,pe.convertToCanvasData=Fi.toCanvasData;const{drawRoundRect:Bo}=ke;function Ro(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){Bo(this,t,e,i,s,o)})}(t)}const To={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=Co.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{}}}},Co=To;Co.alphaPixelTypes.forEach(t=>Co.upperCaseTypeMap[t]=t.toUpperCase());const Po=It.get("TaskProcessor");class Oo{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Po.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Lo{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e){let i,s,o,r;const a=new Oo(t);return a.parent=this,l(e)?r=e:e&&(s=e.parallel,i=e.start,o=e.time,r=e.delay),o&&(a.time=o),!1===s&&(a.parallel=!1),n(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Ao=It.get("Resource"),Mo={tasker:new Lo,map:{},get isComplete(){return Do.tasker.isComplete},set(t,e){Do.map[t]&&Ao.repeat(t),Do.map[t]=e},get:t=>Do.map[t],remove(t){const e=Do.map[t];e&&(e.destroy&&e.destroy(),delete Do.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=jt.image(s)),Do.set(t,e),e},destroy(){Do.map={}}},Do=Mo,Fo={maxRecycled:10,recycledList:[],patternTasker:new Lo,get(t){let e=Mo.get(t.url);return e||Mo.set(t.url,e=jt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Io.recycledList.push(t)})},clearRecycled(){const t=Io.recycledList;t.length>Io.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Mo.remove(t.url)),t.length=0)},hasAlphaPixel:t=>To.alphaPixelTypes.some(e=>Io.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:"+To.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+To.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Io.recycledList=[]}},Io=Fo,{IMAGE:Wo,create:zo}=e,{floor:No,max:Yo}=Math;class Xo{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=zo(Wo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Fo.isFormat("svg",t)&&(this.isSVG=!0),Fo.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),Mo.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,i,s,o,n,r,a){if(e||(e=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=t.origin.createCanvas(Yo(No(e+(n||0)),1),Yo(No(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=void 0)}catch(t){}return o&&f.stintSet(o,"transform",s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Ho(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Vo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function jo(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function Uo(t,e){return(i,s)=>Ko(i,s,t,e&&e(s))}function Go(t){return t}function Ko(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Ho(t,e,Object.assign(o,s||{})),kn(t,e,i)}function qo(t){return Uo(t)}function Zo(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Jo(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function Qo(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),on(this))}}))}function $o(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function tn(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function en(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i,e)&&on(this)}}))}function sn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(on(this),this.__.__removeNaturalSize())}}))}function on(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function nn(t){return Uo(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),on(this)}}))}const rn=en;function an(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i)&&(hn(this),e&&(this.__.__useStroke=!0))}}))}function hn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&on(t)}const ln=an;function dn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function cn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function un(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&pn(this)}}))}function _n(t){return Uo(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>gn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");gn(this,t,e,i),this.mask&&pn(this)}}))}function pn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function gn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||on(t))}function fn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function yn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function mn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function vn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===It.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function wn(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function xn(t){return(e,i)=>{Ho(e,"__DataProcessor",{get:()=>t})}}function bn(t){return(e,i)=>{Ho(e,"__LayoutProcessor",{get:()=>t})}}function kn(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=jo(e,i);if(n(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(_(i)){const t=g(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];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[o];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=Vo(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),Ho(s,e,a)}const En=new It("rewrite"),Sn=[],Bn=["destroy","constructor"];function Rn(t){return(e,i)=>{Sn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Tn(){return t=>{Cn()}}function Cn(t){Sn.length&&(Sn.forEach(e=>{t&&En.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Sn.length=0)}function Pn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Bn.includes(s)||e&&e.includes(s)))if(t.prototype){Vo(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function On(){return t=>{Gt.register(t)}}function Ln(){return t=>{Zt.register(t)}}setTimeout(()=>Cn(!0));const{copy:An,toInnerPoint:Mn,toOuterPoint:Dn,scaleOfOuter:Fn,rotateOfOuter:In,skewOfOuter:Wn,multiplyParent:zn,divideParent:Nn,getLayout:Yn}=I,Xn={},{round:Hn}=Math,Vn={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Gn(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)Un(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++)Kn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Kn(t),t.__updateChange()},updateAllChange(t){if(Zn(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)qn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,i,s,o,n,r){o||(o=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,o,e.__nowWorld,n,r):i.copyWorldToInner(s,o,e.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,o){const n=_(e)?Object.assign({},e):{x:e,y:i};s?Dn(t.localTransform,n,n,!0):t.parent&&Mn(t.parent.scrollWorldTransform,n,n,!0),jn.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Hn(e),i=Hn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){jn.zoomOfLocal(t,Jn(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if(l(s)||(s&&(n=s),s=i),An(Xn,r),Fn(Xn,e,i,s),jn.hasHighPosition(t))jn.setTransform(t,Xn,o,n);else{const e=t.x+Xn.e-r.e,a=t.y+Xn.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){jn.rotateOfLocal(t,Jn(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;An(Xn,o),In(Xn,e,i),jn.hasHighPosition(t)?jn.setTransform(t,Xn,!1,s):t.set({x:t.x+Xn.e-o.e,y:t.y+Xn.f-o.f,rotation:b.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){jn.skewOfLocal(t,Jn(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){An(Xn,t.__localMatrix),Wn(Xn,e,i,s),jn.setTransform(t,Xn,o,n)},transformWorld(t,e,i,s){An(Xn,t.worldTransform),zn(Xn,e),t.parent&&Nn(Xn,t.parent.scrollWorldTransform),jn.setTransform(t,Xn,i,s)},transform(t,e,i,s){An(Xn,t.localTransform),zn(Xn,e),jn.setTransform(t,Xn,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&jn.getInnerOrigin(t,o.origin),r=Yn(e,n,o.around&&jn.getInnerOrigin(t,o.around));if(jn.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Tt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=jn.getInnerOrigin(t,o.origin);K.move(r,n.x-s.x,n.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 Fn(i,jn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(jn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(An(Xn,t.worldTransform),Nn(Xn,e.scrollWorldTransform),i?Xn:Object.assign({},Xn)),drop(t,e,i,s){t.setTransform(jn.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||jn.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const o=i.x*s,n=i.y*s;i.x-=o,i.y-=n,e.move(o,n),t.requestRender(()=>jn.animateMove(e,i,s))}}},jn=Vn,{updateAllMatrix:Un,updateMatrix:Gn,updateAllWorldOpacity:Kn,updateAllChange:qn,updateChange:Zn}=jn;function Jn(t,e){return t.updateLayout(),t.parent?K.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Qn={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 $n;function tr(t,e){return e||($n=0),t.__.mask&&($n=1),$n<0?null:($n&&($n=-1),!0)}const{updateBounds:er}=Vn,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,o=i.length;s<o;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&&n(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++)or(e[t],e)},updateBounds(t,e){const i=[t];or(t,i),nr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)er(s[t]);e&&e===i||er(i)}}},{pushAllChildBranch:sr,pushAllBranchStack:or,updateBoundsByBranchStack:nr}=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}=Vn,{toOuterOf:lr,getPoints:dr,copy:cr}=Tt,ur="_localContentBounds",_r="_worldContentBounds",pr="_worldBoxBounds",gr="_worldStrokeBounds";class fr{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return lr(this.contentBounds,this.leaf.__localMatrix,this[ur]||(this[ur]={})),this[ur]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return lr(this.contentBounds,this.leaf.__world,this[_r]||(this[_r]={})),this[_r]}get worldBoxBounds(){return lr(this.boxBounds,this.leaf.__world,this[pr]||(this[pr]={})),this[pr]}get worldStrokeBounds(){return lr(this.strokeBounds,this.leaf.__world,this[gr]||(this[gr]={})),this[gr]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:e}=this,{leafer:i}=e;if(e.isApp)return hr(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return I.defaultMatrix;case"page":t=e.zoomLayer;default:return ar(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=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},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=I.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=ar(s,e,!0)}if(r||(r=I.getLayout(n)),cr(r,a),K.copy(r,o),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 o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return n(o)||s.forEach(t=>i.innerToWorld(t,null,!1,o)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class yr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class mr extends yr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}mr.ADD="child.add",mr.REMOVE="child.remove",mr.CREATED="created",mr.MOUNTED="mounted",mr.UNMOUNTED="unmounted",mr.DESTROY="destroy";const vr="property.scroll";class wr extends yr{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}wr.CHANGE="property.change",wr.LEAFER_CHANGE="property.leafer_change",wr.SCROLL=vr;const xr={scrollX:vr,scrollY:vr};class br extends yr{constructor(t,e){super(t),Object.assign(this,e)}}br.LOAD="image.load",br.LOADED="image.loaded",br.ERROR="image.error";class kr extends yr{static checkHas(t,e,i){"on"===i?e===Rr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Er)||t.hasEvent(Sr)||t.hasEvent(Br),t.__hasWorldEvent=t.hasEvent(Rr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Er,t),"inner"===e&&t.emit(Sr,t)),t.emit(Br,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Rr,this)}}kr.RESIZE="bounds.resize",kr.INNER="bounds.inner",kr.LOCAL="bounds.local",kr.WORLD="bounds.world";const{RESIZE:Er,INNER:Sr,LOCAL:Br,WORLD:Rr}=kr,Tr={};[Er,Sr,Br,Rr].forEach(t=>Tr[t]=1);class Cr extends yr{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){_(t)?(super(Cr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Cr.RESIZE="resize";class Pr extends yr{constructor(t,e){super(t),this.data=e}}Pr.REQUEST="watch.request",Pr.DATA="watch.data";class Or extends yr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Or.REQUEST="layout.request",Or.START="layout.start",Or.BEFORE="layout.before",Or.LAYOUT="layout",Or.AFTER="layout.after",Or.AGAIN="layout.again",Or.END="layout.end";class Lr extends yr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Lr.REQUEST="render.request",Lr.CHILD_START="render.child_start",Lr.CHILD_END="render.child_end",Lr.START="render.start",Lr.BEFORE="render.before",Lr.RENDER="render",Lr.AFTER="render.after",Lr.AGAIN="render.again",Lr.END="render.end",Lr.NEXT="render.next";class Ar extends yr{}Ar.START="leafer.start",Ar.BEFORE_READY="leafer.before_ready",Ar.READY="leafer.ready",Ar.AFTER_READY="leafer.after_ready",Ar.VIEW_READY="leafer.view_ready",Ar.VIEW_COMPLETED="leafer.view_completed",Ar.STOP="leafer.stop",Ar.RESTART="leafer.restart",Ar.END="leafer.end",Ar.TRANSFORM="leafer.transform",Ar.MOVE="leafer.move",Ar.SCALE="leafer.scale",Ar.ROTATE="leafer.rotate",Ar.SKEW="leafer.skew";const{MOVE:Mr,SCALE:Dr,ROTATE:Fr,SKEW:Ir}=Ar,Wr={x:Mr,y:Mr,scaleX:Dr,scaleY:Dr,rotation:Fr,skewX:Ir,skewY:Ir},zr={};class Nr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=Yr(this,s,!0),h=a(t)?t.split(" "):t,l=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(n=r[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):r[t]=[l],Tr[t]&&kr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=Yr(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],Tr[t]&&kr.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Zt.has(t)&&(e=Zt.get(t,{type:t,target:this,current:this}));const s=Yr(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}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,o=i&&i[t],r=s&&s[t];return!!(n(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Yr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:zr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:zr)}}const{on:Xr,on_:Hr,off:Vr,off_:jr,once:Ur,emit:Gr,emitEvent:Kr,hasEvent:qr,destroy:Zr}=Nr.prototype,Jr={on:Xr,on_:Hr,off:Vr,off_:jr,once:Ur,emit:Gr,emitEvent:Kr,hasEvent:qr,destroyEventer:Zr},Qr=It.get("setAttr"),$r={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||n(e)||(Qr.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new wr(wr.LEAFER_CHANGE,this,t,s,e));const i=Wr[t];i&&(this.emitEvent(new Ar(i,this)),this.emitEvent(new Ar(Ar.TRANSFORM,this)))}this.emitPropertyEvent(wr.CHANGE,t,s,e);const i=xr[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new wr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||n(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ta,multiplyParent:ea,translateInner:ia,defaultWorld:sa}=I,{toPoint:oa,tempPoint:na}=ht,ra={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;ea(this.__local||e,t?t.__scrollWorld||t.__world:sa,i,!!e.affectScaleOrRotation,o),s&&ia(Object.assign(s,i),o.scrollX,o.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)&&(oa(i.around||i.origin,t.boxBounds,na),ia(e,-na.x,-na.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:aa,updateAllMatrix:ha}=Vn,{updateBounds:la}=ir,{toOuterOf:da,copyAndSpread:ca,copy:ua}=Tt,{toBounds:_a}=fo,pa={__updateWorldBounds(){const t=this.__layout;da(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&kr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&kr.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),da(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){da(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){da(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?_a(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ha(this),la(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ha(this),la(this,this))):aa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ca(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?ca(e.renderBounds,e.boxBounds,e.renderSpread):ua(e.renderBounds,e.strokeBounds)}},ga={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),Vn.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);It.showBounds&&It.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:fa}=Qn,ya={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)fa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)fa(i[s],e)||i[s].__clip(t,e)}}},ma={},{LEAF:va,create:wa}=e,{toInnerPoint:xa,toOuterPoint:ba,multiplyParent:ka}=I,{toOuterOf:Ea}=Tt,{copy:Sa,move:Ba}=K,{moveLocal:Ra,zoomOfLocal:Ta,rotateOfLocal:Ca,skewOfLocal:Pa,moveWorld:Oa,zoomOfWorld:La,rotateOfWorld:Aa,skewOfWorld:Ma,transform:Da,transformWorld:Fa,setTransform:Ia,getFlipTransform:Wa,getLocalOrigin:za,getRelativeWorld:Na,drop:Ya}=Vn;let Xa=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return fr}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=wa(va),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(mr.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(mr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(mr.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(mr.MOUNTED)):this.__emitLifeEvent(mr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return ka(i,t.matrix,e,void 0,i),Ea(this.__layout.renderBounds,e,e),e.half!==i.half&&(e.half=i.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Fo.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),ma.scaleX=i,ma.scaleY=s,ma}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?Na(this,e):this.worldTransform,o=i?t:{};return Ea(t,s,o),o}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 o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ba(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ba(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}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 o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Ia(this,t,e,i)}transform(t,e,i){Da(this,t,e,i)}move(t,e,i){Ra(this,t,e,i)}moveInner(t,e,i){Oa(this,t,e,!0,i)}scaleOf(t,e,i,s,o){Ta(this,za(this,t),e,i,s,o)}rotateOf(t,e,i){Ca(this,za(this,t),e,i)}skewOf(t,e,i,s,o){Pa(this,za(this,t),e,i,s,o)}transformWorld(t,e,i){Fa(this,t,e,i)}moveWorld(t,e,i){Oa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){La(this,t,e,i,s,o)}rotateOfWorld(t,e){Aa(this,t,e)}skewOfWorld(t,e,i,s,o){Ma(this,t,e,i,s,o)}flip(t,e){Da(this,Wa(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Vt.need("path")}getMotionPoint(t){return Vt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){Ya(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):kn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=en),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new mr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(mr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};Xa=$t([Pn($r),Pn(ra),Pn(pa),Pn(Jr),Pn(ga)],Xa);const{setListWithFn:Ha}=Tt,{sort:Va}=ir,{localBoxBounds:ja,localStrokeBounds:Ua,localRenderBounds:Ga,maskLocalBoxBounds:Ka,maskLocalStrokeBounds:qa,maskLocalRenderBounds:Za}=Qn,Ja=new It("Branch");let Qa=class extends Xa{__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){Ha(e||this.__layout.boxBounds,this.children,this.__hasMask?Ka:ja)}__updateStrokeBounds(t){Ha(t||this.__layout.strokeBounds,this.children,this.__hasMask?qa:Ua)}__updateRenderBounds(t){Ha(t||this.__layout.renderBounds,this.children,this.__hasMask?Za:Ga)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(Va),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ja.warn("add self or destroyed");const i=n(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Gt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(mr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(mr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(mr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(mr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new mr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};Qa=$t([Pn(ya)],Qa);class $a{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:i}=this;n(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(n(i[t.innerId])){const{list:s}=this;for(let t=e,o=s.length;t<o;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,o=e.length;s<o;s++)n(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;n(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 $a;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class th{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const eh="1.9.5";class ih extends _e{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?(a(i)?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:s,pixelRatio:o}=this.config,n={width:i||e.width,height:s||e.height,pixelRatio:o};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,l(o)?[o]:o)}),Ro(this.context.__proto__))}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,i){this.resizeListener||(this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};f.copyAttrs(e,this,ue),this.resize(t),n(this.width)||this.resizeListener(new Cr(t,e))}}const{mineType:sh,fileType:oh}=To;function nh(e,i){t.origin={createCanvas:(t,e,s)=>{const o={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(o):i.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(sh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let o=e.toDataURL(sh(oh(i)),s);return o=o.substring(o.indexOf("64,")+3),t.origin.download(o,i)},download:(e,s)=>new Promise((o,n)=>{let r;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,r=!0);const a=i.getFileSystemManager();a.writeFile({filePath:s,data:e,encoding:"base64",success(){r?t.miniapp.saveToAlbum(s).then(()=>{a.unlink({filePath:s}),o()}):o()},fail(t){n(t)}})}),loadImage:e=>new Promise((i,s)=>{const o=t.canvas.view.createImage();o.onload=()=>{i(o)},o.onerror=t=>{s(t)},o.src=t.image.getRealURL(e)}),noRepeat:"repeat-x"},t.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=jt.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(jt,{canvas:(t,e)=>new ih(t,e),image:t=>new Xo(t)}),t.name="miniapp",t.requestRender=function(e){const{view:i}=t.renderCanvas||t.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},Ho(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new $a;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 $a,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Lr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===mr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Pr(Pr.DATA,{updatedList:this.updatedList})),this.__updatedList=new $a,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[wr.CHANGE,this.__onAttrChange,this],[[mr.ADD,mr.REMOVE],this.__onChildEvent,this],[Pr.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:ah,updateBounds:hh,updateChange:lh}=Vn,{pushAllChildBranch:dh,pushAllParent:ch}=ir;const{worldBounds:uh}=Qn;class _h{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,u(t)&&(t=new $a(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,uh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,uh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:ph,updateAllChange:gh}=Vn,fh=It.get("Layouter");class yh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new th,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Or.START),this.layoutOnce(),t.emitEvent(new Or(Or.END,this.layoutedBlocks,this.times))}catch(t){fh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?fh.warn("layouting"):this.times>3?fh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Pr.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Yt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=Or,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Or(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(ah(t,!0),e.add(t),t.isBranch&&dh(t,e),ch(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ch(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||hh(s[t])}hh(i)}})}(this.__levelList),function(t){t.list.forEach(lh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Or(n,a,this.times)),i.emitEvent(new Or(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Yt.end(e)}fullLayout(){const t=Yt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=Or,n=this.getBlocks(new $a(e));e.emitEvent(new Or(i,n,this.times)),yh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Or(s,n,this.times)),e.emitEvent(new Or(o,n,this.times)),this.addBlocks(n),Yt.end(t)}static fullLayout(t){ph(t,!0),t.isBranch?ir.updateBounds(t):Vn.updateBounds(t),gh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new _h([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new _h(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Or.REQUEST,this.layout,this],[Or.AGAIN,this.layoutAgain,this],[Pr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const mh=It.get("Renderer");class vh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Or.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Lr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Lr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Lr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,mh.log(e.innerName,"---\x3e");try{this.emitRender(Lr.START),this.renderOnce(t),this.emitRender(Lr.END,this.totalBounds),Fo.clearRecycled()}catch(t){this.rendering=!1,mh.error(t)}mh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return mh.warn("rendering");if(this.times>3)return mh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Lr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Lr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Lr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Lr.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Yt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new Lt(s);i.save(),s.spread(vh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),i.restore(),Yt.end(e)}fullRender(){const t=Yt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Yt.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),o=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),It.showRepaint&&It.drawRepaint(i,t),this.target.__render(i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const e=1e3/(Date.now()-i),{maxFPS:o}=this.config;if(o&&e>o-.5)return t.requestRender(s);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Lt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||mh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Lr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Lr.REQUEST,this.update,this],[Or.END,this.__onLayoutEnd,this],[Lr.AGAIN,this.renderAgain,this],[Cr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}vh.clipSpread=10;const{hitRadiusPoint:wh}=Tt;class xh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new $a(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o),h=o?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 $a;if(t.length){let e;const{x:o,y:n}=this.point,r={x:o,y:n,radiusX:0,radiusY:0};for(let o=0,n=t.length;o<n;o++)if(e=t[o],(i||Vn.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Vn.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=>Vn.worldHittable(t))}getPath(t){const e=new $a;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 $a;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new $a,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||wh(i.__world,o),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)):s&&this.hitChild(i,o))}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,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class bh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new xh(this.target=t,this),this.finder=jt.finder&&jt.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Vt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function kh(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Eh(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Sh(){return(t,e)=>{const i="_"+e;Ho(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Bh(t){return(e,i)=>{Ho(e,i,jo(i,t))}}Object.assign(jt,{watcher:(t,e)=>new rh(t,e),layouter:(t,e)=>new yh(t,e),renderer:(t,e,i)=>new vh(t,e,i),selector:(t,e)=>new bh(t,e)}),t.layout=yh.fullLayout;const Rh={},Th={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Ch={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Ph={},Oh={},Lh={},Ah={},Mh={},Dh={apply(){Vt.need("filter")}},Fh={},Ih={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Wh={list:{},register(t,e){Wh.list[t]=e},get:t=>Wh.list[t]},{parse:zh,objectToCanvasData:Nh}=Fi,{stintSet:Yh}=f,{hasTransparent:Xh}=Th,Hh={},Vh=It.get("UIData");class jh extends m{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,Vh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Vh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Yh(this,"__isTransparentFill",Xh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Yh(this,"__isTransparentStroke",Xh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?zh(t):Nh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Uh(this,"shadow",t)}setInnerShadow(t){Uh(this,"innerShadow",t)}setFilter(t){Uh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Oh.compute("fill",this.__leaf),e&&Oh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Hh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Hh))}__removePaint(t,e){e&&this.__removeInput(t),Lh.recycleImage(t,this),"fill"===t?(Yh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Yh(this,"__isAlphaPixelStroke",void 0),Yh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Uh(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class Gh extends jh{}class Kh extends Gh{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class qh extends Gh{__getInputData(t,e){const i=super.__getInputData(t,e);return ue.forEach(t=>delete i[t]),i}}class Zh extends Kh{}class Jh extends jh{get __usePathBox(){return this.points||this.__pathInputed}}class Qh extends jh{get __boxStroke(){return!this.__pathInputed}}class $h extends jh{get __boxStroke(){return!this.__pathInputed}}class tl extends Jh{}class el extends jh{}class il extends jh{get __pathInputed(){return 2}}class sl extends Gh{}const ol={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class nl extends jh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=ol[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Gt.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange(),n.renderChanged&&o.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class rl 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 al 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 hl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=Math.max(n.__layout.strokeSpread=n.__updateStrokeSpread(),t),e=n.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),s&&(t=Math.max(t,s)),n&&(t+=Dh.getSpread(n)),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)),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},ll={getValidMove(t,e,i,s,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;o||(s=Object.assign({},s));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==i?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),u&&"outer"!==i?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=b.float(s.x),s.y=b.float(s.y),s},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&dl.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),dl.axisMove(t,e)}},dl=ll,{stintSet:cl}=f,ul={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);cl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),cl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;cl(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),cl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){_l(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Oh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Mh.shadow(this,t,h),a&&(s.__isStrokes?Oh.strokes(n,this,t):Oh.stroke(n,this,t)),o&&(s.__isFills?Oh.fills(o,this,t):Oh.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&Mh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Oh.strokes(n,this,t):Oh.stroke(n,this,t)),c&&Dh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Oh.strokes(n,this,t):Oh.stroke(n,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Th.string(e.color))}o&&(s.__isFills?Oh.fills(o,this,t):Oh.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Oh.strokes(n,this,t):Oh.stroke(n,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:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Oh.fills(s,this,t):Oh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Oh.strokes(o,this,t):Oh.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:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Oh.stroke(o,t,e),s&&Oh.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&Oh.stroke(o,t,e)}const pl={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),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,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var gl;let fl=gl=class extends Xa{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){b.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return So.set(this.path=t||[]),t||this.__drawPathByBox(So),So}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Vt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Vt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(So.set(i=[]),this.__drawPathByBox(So)),t?Fi.toCanvasData(i,!0):i}getPathString(t,e,i){return Fi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Fh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?ko.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?Is.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,l(n)?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Oh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),Vt.need("animate")}killAnimate(t,e){}export(t,e){return Vt.need("export")}syncExport(t,e){return Vt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),gl.one(e)}static one(t,e,i,s,o){return Gt.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){On()(this)}static registerData(t){xn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};$t([xn(jh)],fl.prototype,"__",void 0),$t([Sh()],fl.prototype,"zoomLayer",void 0),$t([qo("")],fl.prototype,"id",void 0),$t([qo("")],fl.prototype,"name",void 0),$t([qo("")],fl.prototype,"className",void 0),$t([cn("pass-through")],fl.prototype,"blendMode",void 0),$t([un(1)],fl.prototype,"opacity",void 0),$t([_n(!0)],fl.prototype,"visible",void 0),$t([cn(!1)],fl.prototype,"locked",void 0),$t([cn(!1)],fl.prototype,"dim",void 0),$t([cn(!1)],fl.prototype,"dimskip",void 0),$t([fn(0)],fl.prototype,"zIndex",void 0),$t([yn(!1)],fl.prototype,"mask",void 0),$t([mn(!1)],fl.prototype,"eraser",void 0),$t([Zo(0,!0)],fl.prototype,"x",void 0),$t([Zo(0,!0)],fl.prototype,"y",void 0),$t([en(100,!0)],fl.prototype,"width",void 0),$t([en(100,!0)],fl.prototype,"height",void 0),$t([$o(1,!0)],fl.prototype,"scaleX",void 0),$t([$o(1,!0)],fl.prototype,"scaleY",void 0),$t([tn(0,!0)],fl.prototype,"rotation",void 0),$t([tn(0,!0)],fl.prototype,"skewX",void 0),$t([tn(0,!0)],fl.prototype,"skewY",void 0),$t([Zo(0,!0)],fl.prototype,"offsetX",void 0),$t([Zo(0,!0)],fl.prototype,"offsetY",void 0),$t([Jo(0,!0)],fl.prototype,"scrollX",void 0),$t([Jo(0,!0)],fl.prototype,"scrollY",void 0),$t([Qo()],fl.prototype,"origin",void 0),$t([Qo()],fl.prototype,"around",void 0),$t([qo(!1)],fl.prototype,"lazy",void 0),$t([sn(1)],fl.prototype,"pixelRatio",void 0),$t([dn(0)],fl.prototype,"renderSpread",void 0),$t([nn()],fl.prototype,"path",void 0),$t([rn()],fl.prototype,"windingRule",void 0),$t([rn(!0)],fl.prototype,"closed",void 0),$t([en(0)],fl.prototype,"padding",void 0),$t([en(!1)],fl.prototype,"lockRatio",void 0),$t([en()],fl.prototype,"widthRange",void 0),$t([en()],fl.prototype,"heightRange",void 0),$t([qo(!1)],fl.prototype,"draggable",void 0),$t([qo()],fl.prototype,"dragBounds",void 0),$t([qo("auto")],fl.prototype,"dragBoundsType",void 0),$t([qo(!1)],fl.prototype,"editable",void 0),$t([vn(!0)],fl.prototype,"hittable",void 0),$t([vn("path")],fl.prototype,"hitFill",void 0),$t([ln("path")],fl.prototype,"hitStroke",void 0),$t([vn(!1)],fl.prototype,"hitBox",void 0),$t([vn(!0)],fl.prototype,"hitChildren",void 0),$t([vn(!0)],fl.prototype,"hitSelf",void 0),$t([vn()],fl.prototype,"hitRadius",void 0),$t([wn("")],fl.prototype,"cursor",void 0),$t([cn()],fl.prototype,"fill",void 0),$t([ln(void 0,!0)],fl.prototype,"stroke",void 0),$t([ln("inside")],fl.prototype,"strokeAlign",void 0),$t([ln(1,!0)],fl.prototype,"strokeWidth",void 0),$t([ln(!1)],fl.prototype,"strokeWidthFixed",void 0),$t([ln("none")],fl.prototype,"strokeCap",void 0),$t([ln("miter")],fl.prototype,"strokeJoin",void 0),$t([ln()],fl.prototype,"dashPattern",void 0),$t([ln(0)],fl.prototype,"dashOffset",void 0),$t([ln(10)],fl.prototype,"miterLimit",void 0),$t([rn(0)],fl.prototype,"cornerRadius",void 0),$t([rn()],fl.prototype,"cornerSmoothing",void 0),$t([kh()],fl.prototype,"shadow",void 0),$t([kh()],fl.prototype,"innerShadow",void 0),$t([kh()],fl.prototype,"blur",void 0),$t([kh()],fl.prototype,"backgroundBlur",void 0),$t([kh()],fl.prototype,"grayscale",void 0),$t([kh()],fl.prototype,"filter",void 0),$t([cn()],fl.prototype,"placeholderColor",void 0),$t([qo(100)],fl.prototype,"placeholderDelay",void 0),$t([qo({})],fl.prototype,"data",void 0),$t([Rn(Xa.prototype.reset)],fl.prototype,"reset",null),fl=gl=$t([Pn(hl),Pn(ul),Tn()],fl);let yl=class extends fl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var ml;$t([xn(Gh)],yl.prototype,"__",void 0),$t([en(0)],yl.prototype,"width",void 0),$t([en(0)],yl.prototype,"height",void 0),yl=$t([Pn(Qa),On()],yl);const vl=It.get("Leafer");let wl=ml=class extends yl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Mo.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),ml.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const o=this.canvas=jt.canvas(s);this.__controllers.push(this.renderer=jt.renderer(this,o,s),this.watcher=jt.watcher(this,s),this.layouter=jt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=jt.selector(this),this.interaction=jt.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=jt.hitCanvasManager()),this.canvasManager=new Qt,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),rr.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Ar.RESTART):this.emitLeafer(Ar.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Ar.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,ue);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=f.copyAttrs({},this.canvas,ue);e.resize(t),this.updateLazyBounds(),this.__onResize(new Cr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ue),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Mt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ue.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ue.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=f.copyAttrs({},s,ue);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){rr.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Ar.VIEW_COMPLETED),rr.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return Vt.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Ar(t,this))}__listenEvents(){const t=Yt.start("FirstCreate "+this.innerName);this.once([[Ar.START,()=>Yt.end(t)],[Or.START,this.updateLazyBounds,this],[Lr.START,this.__onCreated,this],[Lr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Pr.DATA,this.__onWatchData,this],[Or.END,this.__onLayoutEnd,this],[Lr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ml.list.remove(this);try{this.stop(),this.emitLeafer(Ar.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Fo.clearRecycled()},100)}catch(t){vl.error(t)}}};t?e():setTimeout(e)}};wl.list=new $a,$t([xn(qh)],wl.prototype,"__",void 0),$t([en()],wl.prototype,"pixelRatio",void 0),wl=ml=$t([On()],wl);let xl=class extends fl{get __tag(){return"Rect"}};$t([xn(Qh)],xl.prototype,"__",void 0),xl=$t([Pn(pl),Tn(),On()],xl);const{add:bl,includes:kl,scroll:El}=Tt,Sl=xl.prototype,Bl=yl.prototype;let Rl=class extends yl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:n}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(bl(a,n),El(a,i)),this.__updateRectRenderBounds(),t=!kl(n,a),t&&"show"===r&&bl(o,a)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};$t([xn(Kh)],Rl.prototype,"__",void 0),$t([en(100)],Rl.prototype,"width",void 0),$t([en(100)],Rl.prototype,"height",void 0),$t([qo(!1)],Rl.prototype,"resizeChildren",void 0),$t([dn("show")],Rl.prototype,"overflow",void 0),$t([Rn(Sl.__updateStrokeSpread)],Rl.prototype,"__updateStrokeSpread",null),$t([Rn(Sl.__updateRenderSpread)],Rl.prototype,"__updateRectRenderSpread",null),$t([Rn(Sl.__updateBoxBounds)],Rl.prototype,"__updateRectBoxBounds",null),$t([Rn(Sl.__updateStrokeBounds)],Rl.prototype,"__updateStrokeBounds",null),$t([Rn(Sl.__updateRenderBounds)],Rl.prototype,"__updateRectRenderBounds",null),$t([Rn(Sl.__updateChange)],Rl.prototype,"__updateRectChange",null),$t([Rn(Sl.__render)],Rl.prototype,"__renderRect",null),$t([Rn(Bl.__render)],Rl.prototype,"__renderGroup",null),Rl=$t([Tn(),On()],Rl);let Tl=class extends Rl{get __tag(){return"Frame"}get isFrame(){return!0}};$t([xn(Zh)],Tl.prototype,"__",void 0),$t([cn("#FFFFFF")],Tl.prototype,"fill",void 0),$t([dn("hide")],Tl.prototype,"overflow",void 0),Tl=$t([On()],Tl);const{moveTo:Cl,closePath:Pl,ellipse:Ol}=ns;let Ll=class extends fl{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&Ol(h,r,a,r*s,a*s,0,o,n,!1),Ol(h,r,a,r,a,0,n,o,!0),s<1&&Pl(h)):(s<1&&(Ol(h,r,a,r*s,a*s),Cl(h,e,a)),Ol(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(Cl(h,r,a),Ol(h,r,a,r,a,0,o,n,!1),Pl(h)):Ol(h,r,a,r,a)}};$t([xn($h)],Ll.prototype,"__",void 0),$t([rn(0)],Ll.prototype,"innerRadius",void 0),$t([rn(0)],Ll.prototype,"startAngle",void 0),$t([rn(0)],Ll.prototype,"endAngle",void 0),Ll=$t([On()],Ll);const{moveTo:Al,lineTo:Ml,drawPoints:Dl}=ns,{rotate:Fl,getAngle:Il,getDistance:Wl,defaultPoint:zl}=K;let Nl=class extends fl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Fl(i,e),i}set toPoint(t){this.width=Wl(zl,t),this.rotation=Il(zl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Dl(e,t.points,t.curve,t.closed):(Al(e,0,0),Ml(e,this.width,0))}};$t([xn(Jh)],Nl.prototype,"__",void 0),$t([an("center")],Nl.prototype,"strokeAlign",void 0),$t([en(0)],Nl.prototype,"height",void 0),$t([rn()],Nl.prototype,"points",void 0),$t([rn(0)],Nl.prototype,"curve",void 0),$t([rn(!1)],Nl.prototype,"closed",void 0),Nl=$t([On()],Nl);const{sin:Yl,cos:Xl,PI:Hl}=Math,{moveTo:Vl,lineTo:jl,closePath:Ul,drawPoints:Gl}=ns,Kl=Nl.prototype;let ql=class extends fl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Gl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,n=i/2,r=s/2;Vl(e,n,0);for(let t=1;t<o;t++)jl(e,n+n*Yl(2*t*Hl/o),r-r*Xl(2*t*Hl/o));Ul(e)}}__updateRenderPath(){}__updateBoxBounds(){}};$t([xn(tl)],ql.prototype,"__",void 0),$t([rn(3)],ql.prototype,"sides",void 0),$t([rn()],ql.prototype,"points",void 0),$t([rn(0)],ql.prototype,"curve",void 0),$t([Rn(Kl.__updateRenderPath)],ql.prototype,"__updateRenderPath",null),$t([Rn(Kl.__updateBoxBounds)],ql.prototype,"__updateBoxBounds",null),ql=$t([Tn(),On()],ql);const{sin:Zl,cos:Jl,PI:Ql}=Math,{moveTo:$l,lineTo:td,closePath:ed}=ns;let id=class extends fl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];$l(r,o,0);for(let t=1;t<2*i;t++)td(r,o+(t%2==0?o:o*s)*Zl(t*Ql/i),n-(t%2==0?n:n*s)*Jl(t*Ql/i));ed(r)}};$t([xn(el)],id.prototype,"__",void 0),$t([rn(5)],id.prototype,"corners",void 0),$t([rn(.382)],id.prototype,"innerRadius",void 0),id=$t([On()],id);let sd=class extends xl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};$t([xn(rl)],sd.prototype,"__",void 0),$t([en("")],sd.prototype,"url",void 0),sd=$t([On()],sd);const od=sd;let nd=class extends xl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=jt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Xo({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 o=new et(t.worldTransform).invert(),n=new et;e&&n.translate(e.x,e.y),i&&(l(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.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()}};$t([xn(al)],nd.prototype,"__",void 0),$t([Eh(100)],nd.prototype,"width",void 0),$t([Eh(100)],nd.prototype,"height",void 0),$t([Eh(1)],nd.prototype,"pixelRatio",void 0),$t([Eh(!0)],nd.prototype,"smooth",void 0),$t([qo(!1)],nd.prototype,"safeResize",void 0),$t([Eh()],nd.prototype,"contextSettings",void 0),nd=$t([On()],nd);const{copyAndSpread:rd,includes:ad,spread:hd,setList:ld}=Tt;let dd=class extends fl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Ch.number(e,o),t.__letterSpacing=Ch.number(i,o),t.__padding=l?b.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Rh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&hd(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!ad(h,a)),this.isOverflow?(ld(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;rd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};$t([xn(nl)],dd.prototype,"__",void 0),$t([en(0)],dd.prototype,"width",void 0),$t([en(0)],dd.prototype,"height",void 0),$t([cn()],dd.prototype,"boxStyle",void 0),$t([qo(!1)],dd.prototype,"resizeFontSize",void 0),$t([cn("#000000")],dd.prototype,"fill",void 0),$t([an("outside")],dd.prototype,"strokeAlign",void 0),$t([vn("all")],dd.prototype,"hitFill",void 0),$t([en("")],dd.prototype,"text",void 0),$t([en("")],dd.prototype,"placeholder",void 0),$t([en("caption")],dd.prototype,"fontFamily",void 0),$t([en(12)],dd.prototype,"fontSize",void 0),$t([en("normal")],dd.prototype,"fontWeight",void 0),$t([en(!1)],dd.prototype,"italic",void 0),$t([en("none")],dd.prototype,"textCase",void 0),$t([en("none")],dd.prototype,"textDecoration",void 0),$t([en(0)],dd.prototype,"letterSpacing",void 0),$t([en({type:"percent",value:1.5})],dd.prototype,"lineHeight",void 0),$t([en(0)],dd.prototype,"paraIndent",void 0),$t([en(0)],dd.prototype,"paraSpacing",void 0),$t([en("x")],dd.prototype,"writingMode",void 0),$t([en("left")],dd.prototype,"textAlign",void 0),$t([en("top")],dd.prototype,"verticalAlign",void 0),$t([en(!0)],dd.prototype,"autoSizeAlign",void 0),$t([en("normal")],dd.prototype,"textWrap",void 0),$t([en("show")],dd.prototype,"textOverflow",void 0),$t([cn(!1)],dd.prototype,"textEditing",void 0),dd=$t([On()],dd);let cd=class extends fl{get __tag(){return"Path"}};$t([xn(il)],cd.prototype,"__",void 0),$t([an("center")],cd.prototype,"strokeAlign",void 0),cd=$t([On()],cd);let ud=class extends yl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new cd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};$t([xn(sl)],ud.prototype,"__",void 0),$t([(t,e)=>{Ho(t,e,{get(){return this.__path}})}],ud.prototype,"path",void 0),ud=$t([Pn(bs,["set","path","paint"]),On()],ud);let _d=class extends wl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&jt.editor(o,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new wl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),n(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ue),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Or.END,this.__onReady,this],[Lr.START,this.__onCreated,this],[Lr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Lr.END,this.__onChildRenderEnd,this))}};_d=$t([On()],_d);const pd={},gd={isHoldSpaceKey:()=>gd.isHold("Space"),isHold:t=>pd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){pd[t]||(pd[t]=!0)},setUpCode(t){pd[t]=!1}},fd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class yd extends yr{get spaceKey(){return gd.isHoldSpaceKey()}get left(){return fd.left(this)}get right(){return fd.right(this)}get middle(){return fd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return gd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){Zt.changeName(t,e)}}let md=class extends yd{};md.POINTER="pointer",md.BEFORE_DOWN="pointer.before_down",md.BEFORE_MOVE="pointer.before_move",md.BEFORE_UP="pointer.before_up",md.DOWN="pointer.down",md.MOVE="pointer.move",md.UP="pointer.up",md.OVER="pointer.over",md.OUT="pointer.out",md.ENTER="pointer.enter",md.LEAVE="pointer.leave",md.TAP="tap",md.DOUBLE_TAP="double_tap",md.CLICK="click",md.DOUBLE_CLICK="double_click",md.LONG_PRESS="long_press",md.LONG_TAP="long_tap",md.MENU="pointer.menu",md.MENU_TAP="pointer.menu_tap",md=$t([Ln()],md);const vd=md,wd={};let xd=class extends md{static setList(t){this.list=t instanceof $a?t:new $a(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const o=t.getLocalPoint(i,null,!0);return K.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),ll.axisMove(t,o),o}static limitMove(t,e){ll.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(wd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(wd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(wd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Tt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Tt.unsign(i),i}assignMove(t){wd.x=t?this.totalX:this.moveX,wd.y=t?this.totalY:this.moveY}};xd.BEFORE_DRAG="drag.before_drag",xd.START="drag.start",xd.DRAG="drag",xd.END="drag.end",xd.OVER="drag.over",xd.OUT="drag.out",xd.ENTER="drag.enter",xd.LEAVE="drag.leave",xd=$t([Ln()],xd);const bd=xd;let kd=class extends md{static setList(t){xd.setList(t)}static setData(t){xd.setData(t)}};kd.DROP="drop",kd=$t([Ln()],kd);let Ed=class extends xd{};Ed.BEFORE_MOVE="move.before_move",Ed.START="move.start",Ed.MOVE="move",Ed.END="move.end",Ed=$t([Ln()],Ed);let Sd=class extends md{};Sd.BEFORE_ROTATE="rotate.before_rotate",Sd.START="rotate.start",Sd.ROTATE="rotate",Sd.END="rotate.end",Sd=$t([Ln()],Sd);let Bd=class extends xd{};Bd.SWIPE="swipe",Bd.LEFT="swipe.left",Bd.RIGHT="swipe.right",Bd.UP="swipe.up",Bd.DOWN="swipe.down",Bd=$t([Ln()],Bd);let Rd=class extends md{};Rd.BEFORE_ZOOM="zoom.before_zoom",Rd.START="zoom.start",Rd.ZOOM="zoom",Rd.END="zoom.end",Rd=$t([Ln()],Rd);let Td=class extends yd{};Td.BEFORE_DOWN="key.before_down",Td.BEFORE_UP="key.before_up",Td.DOWN="key.down",Td.HOLD="key.hold",Td.UP="key.up",Td=$t([Ln()],Td);const Cd={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Bd.UP:t>45&&t<135?Bd.DOWN:t<=45&&t>=-45?Bd.RIGHT:Bd.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Pd.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:n(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 $a,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>Vn.draggable(t)||!t.isLeafer&&t.hasEvent(xd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Pd=Cd,Od=new $a,{getDragEventData:Ld,getDropEventData:Ad,getSwipeEventData:Md}=Cd;class Dd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Ld(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=xd.list||this.draggableList||Od;return this.dragging&&(s?t?Od:new $a(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Ed.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&fd.left(t),this.dragging&&(this.interaction.emit(xd.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],Vn.draggable(e)){this.draggableList=new $a(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=Ld(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(Ed.BEFORE_MOVE,this.dragData),e.emit(Ed.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(xd.BEFORE_DRAG,this.dragData),e.emit(xd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:n}=e.p,r=!n||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=xd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},r||s);n&&!s&&t?Vn.animateMove(e,h,l(n)?n:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(xd.OUT,t,i),e.emit(xd.OVER,t,s)):e.emit(xd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(xd.LEAVE,t,i,s),e.emit(xd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=Ld(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Ed.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(xd.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(K.getDistance(e,t)>o.config.pointer.swipeDistance){const t=Md(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Ad(t,e,xd.data);s.path=i,this.interaction.emit(kd.DROP,s),this.interaction.emit(xd.LEAVE,t,i)}dragReset(){xd.list=xd.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Fd=It.get("emit");const Id=["move","zoom","rotate","key"];function Wd(t,e,i,s,o){if(Id.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Nd(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&zd(n,e,i,s,o)}}function zd(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!Nd(t,o)&&(Ih.updateEventStyle&&!s&&Ih.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=Zt.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function Nd(t,e){return e&&e.has(t)}const Yd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Xd,pathCanDrag:Hd,pathHasOutside:Vd}=Cd;class jd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&fd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&fd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&gd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Yd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new $a(t),this.createTransformer(),this.dragger=new Dd(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(fd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(md.BEFORE_DOWN,t),this.emit(md.DOWN,t),fd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=fd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&fd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(md.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=K.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(md.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;fd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(md.BEFORE_UP,t),this.emit(md.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(md.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(md.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Td.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,gd.setDownCode(e),this.emit(Td.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Td.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Td.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,gd.setUpCode(e),this.emit(Td.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new $a),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(md.OUT,t,i),this.emit(md.OVER,t,e)):this.emit(md.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(md.LEAVE,t,i,e),this.emit(md.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(md.LEAVE,t),this.dragger.dragging&&this.emit(kd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[md.DOUBLE_TAP,md.DOUBLE_CLICK].some(e=>Xd(t.path,e));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Vd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Hd(t.path))&&!Vd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:md.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,o=s.length;t<o&&(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:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.height/i.height,this.p.snap&&K.round(s),s}emitTap(t){this.emit(md.TAP,t),this.emit(md.CLICK,t)}emitDoubleTap(t){this.emit(md.DOUBLE_TAP,t),this.emit(md.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(md.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(md.LONG_TAP,t),(Xd(t.path,md.LONG_TAP)||Xd(t.path,md.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Lt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Cr.RESIZE,this.__onResize,this)],t.once(Ar.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],zd(o,t,e,!0,s))return;o.isApp&&Wd(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&Wd(o,t,e,!1,s),zd(o,t,e,!1,s))return}catch(t){Fd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Ud{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ud.custom={};class Gd extends Qt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new $a,this.pixelList=new $a}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),jt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),jt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=jt.selector())};const{toInnerRadiusPointOf:Kd,copy:qd,setRadius:Zd}=K,{hitRadiusPoint:Jd,hitPoint:Qd}=Tt,$d={},tc={},ec=Xa.prototype;ec.hit=function(e,i=0){this.updateLayout(),qd(tc,e),Zd(tc,i);const s=this.__world;return!!(i?Jd(s,tc):Qd(s,tc))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},tc),i,{target:this}):this.__hitWorld(tc))},ec.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(qd($d,t),Zd(t=$d,e.hitRadius)),Kd(t,i,$d),e.hitBox||o){if(Tt.hitRadiusPoint(s.boxBounds,$d))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit($d)},ec.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},ec.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},ec.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},ec.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ic=new et,sc=fl.prototype;sc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,o=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,n=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=o||n;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,r=a.hitScale=At.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=At.set(e).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Fo.patternLocked=!0,this.__renderShape(a,{matrix:ic.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!o,ignoreStroke:!n}),Fo.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},sc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const oc=fl.prototype,nc=xl.prototype,rc=Rl.prototype;nc.__updateHitCanvas=rc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?oc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},nc.__hitFill=rc.__hitFill=function(t){return this.__hitCanvas?oc.__hitFill.call(this,t):Tt.hitRadiusPoint(this.__layout.boxBounds,t)},dd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.width,e<i?i:e))},yl.prototype.pick=function(e,i){return i||(i=o),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const ac=_e.prototype;ac.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},ac.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},ac.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),At.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(At.x,At.y,At.width||1,At.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const hc={convertTouch(t,e){const i=hc.getTouch(t),s=Cd.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class lc extends jd{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return n(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=hc.getTouch(t);this.pointerDown(hc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=hc.getTouch(t);this.pointerMove(hc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=hc.getTouch(t);this.pointerUp(hc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Cd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function dc(t,e){const i=t.__,{rows:s,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,n)))}}function cc(t,e){t.__.__font?dc(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function uc(t,e,i){switch(e.__.strokeAlign){case"center":_c(t,1,e,i);break;case"inside":pc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?_c(t,2,e,i):pc(t,"outside",e,i)}}function _c(t,e,i,s){const o=i.__;_(t)?fc(t,e,!0,i,s):(s.setStroke(t,o.__strokeWidth*e,o),gc(i,s))}function pc(t,e,i,s){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,_c(t,2,i,o),o.blendMode="outside"===e?"destination-out":"destination-in",dc(i,o),o.blendMode="normal",Vn.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}function gc(t,e){let i,s=t.__.__textDrawData;const{rows:o,decorationY:n}=s;for(let t=0,s=o.length;t<s;t++)i=o[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(n){const{decorationHeight:t}=s;o.forEach(i=>n.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function fc(t,e,i,s,o){let n;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||o.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!Lh.checkImage(s,o,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?o.setStroke(n.style,r.__getRealStrokeWidth(t)*e,r,t):o.setStroke(n.style,r.__strokeWidth*e,r)}else o.strokeStyle=n.style;n.blendMode?(o.saveBlendMode(n.blendMode),i?gc(s,o):o.stroke(),o.restoreBlendMode()):i?gc(s,o):o.stroke()}}function yc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)uc(t,e,i);else switch(s.strokeAlign){case"center":mc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),mc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)mc(t,2,e,i);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),mc(t,2,e,n),n.clipUI(s),n.clearWorld(o),Vn.copyCanvasByWorld(e,i,n),n.recycle(e.__nowWorld)}}(t,e,i)}}function mc(t,e,i,s){const o=i.__;_(t)?fc(t,e,!1,i,s):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Oh.strokeArrow(t,i,s)}const{getSpread:vc,getOuterOf:wc,getByMove:xc,getIntersectData:bc}=Tt;let kc;const{stintSet:Ec}=f,{hasTransparent:Sc}=Th;function Bc(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout;switch(e.type){case"image":s=Lh.image(i,t,e,o,!kc||!kc[e.url]);break;case"linear":s=Ah.linearGradient(e,o);break;case"radial":s=Ah.radialGradient(e,o);break;case"angular":s=Ah.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:Th.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:Th.string(e)})}if(s){if(a(s.style)&&Sc(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 Rc={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];u(a)||(a=[a]),kc=Lh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=Bc(t,a[o],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)&&(o=!0),n=!0),"fill"===t?(Ec(i,"__isAlphaPixelFill",o),Ec(i,"__isTransparentFill",n)):(Ec(i,"__isAlphaPixelStroke",o),Ec(i,"__isTransparentStroke",n),Ec(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,cc(e,i)},fills:function(t,e,i){let s;for(let o=0,n=t.length;o<n;o++){if(s=t[o],s.image){if(Lh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&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:o}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&o>1)&&i.scale(1/t,1/o)}s.blendMode&&(i.blendMode=s.blendMode),cc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),cc(e,i),i.restoreBlendMode()):cc(e,i)}},fillPathOrText:cc,fillText:dc,stroke:yc,strokes:function(t,e,i){yc(t,e,i)},strokeText:uc,drawTextStroke:gc,shape:function(e,i,s){const o=i.getSameCanvas(),n=e.__nowWorld,r=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=e.getRenderScaleData(!0);if(r.includes(n))c=o,a=d=n;else{const{renderShapeSpread:o}=e.__layout;let p;if(t.fullImageShadow)p=n;else{const t=o?vc(r,u===_?o*u:[o*_,o*u]):r;p=bc(t,n)}l=r.getFitMatrix(p);let{a:g,d:f}=l;l.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,s),u*=g,_*=f),d=wc(n,l),a=xc(d,-l.e,-l.f);const y=s.matrix;y?(h=new et(l),h.multiply(y),g*=y.scaleX,f*=y.scaleY):h=l,h.withScale(g,f),s=Object.assign(Object.assign({},s),{matrix:h})}return e.__renderShape(o,s),{canvas:o,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let Tc={},Cc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Pc,rotateOfOuter:Oc,translate:Lc,scaleOfOuter:Ac,multiplyParent:Mc,scale:Dc,rotate:Fc,skew:Ic}=I;function Wc(t,e,i,s,o,n,r){const a=Pc();Lc(a,e.x+i,e.y+s),Dc(a,o,n),r&&Oc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function zc(t,e,i,s,o,n,r,a,h){const l=Pc();Yc(l,e,i,s,o,n,r,a),h&&(Cc.a=e.width/h.width,Cc.d=e.height/h.height,Mc(l,Cc)),t.transform=l}function Nc(t,e,i,s,o,n,r,a,h,l,d,c){const u=Pc();if(c)Yc(u,e,o,n,r,a,h,l);else{if(h)if("center"===d)Oc(u,{x:i/2,y:s/2},h);else switch(Fc(u,h),h){case 90:Lc(u,s,0);break;case 180:Lc(u,i,s);break;case 270:Lc(u,0,i)}Tc.x=e.x+o,Tc.y=e.y+n,Lc(u,Tc.x,Tc.y),r&&Ac(u,Tc,r,a)}t.transform=u}function Yc(t,e,i,s,o,n,r,a){r&&Fc(t,r),a&&Ic(t,a.x,a.y),o&&Dc(t,o,n),Lc(t,e.x+i,e.y+s)}const{get:Xc,translate:Hc}=I,Vc=new Lt,jc={},Uc={};function Gc(t,e,i,s){const{changeful:o,sync:n,scaleFixed:r}=i;o&&(t.changeful=o),n&&(t.sync=n),r&&(t.scaleFixed=r),t.data=Kc(i,s,e)}function Kc(t,e,i){t.padding&&(e=Vc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===o,w={mode:r},x="center"!==h&&(u||0)%180==90;let k,E;switch(Tt.set(Uc,0,0,x?o:s,x?s:o),r&&"cover"!==r&&"fit"!==r?((d||c)&&(b.getScaleData(d,c,i,jc),k=jc.scaleX,E=jc.scaleY),(h||y||f)&&(k&&Tt.scale(Uc,k,E,!0),h&&ct.toPoint(h,Uc,e,Uc,!0,!0))):v&&!u||(k=E=Tt.getFitScale(e,Uc,"fit"!==r),Tt.put(e,i,h,k,!1,Uc),Tt.scale(Uc,k,E,!0)),l&&K.move(Uc,l),r){case"stretch":v||(s=e.width,o=e.height);break;case"normal":case"clip":(Uc.x||Uc.y||k||g||u||p)&&zc(w,e,Uc.x,Uc.y,k,E,u,p,t.clipSize);break;case"repeat":(!v||k||u||p)&&Nc(w,e,s,o,Uc.x,Uc.y,k,E,u,p,h,t.freeTransform),f||(w.repeat="repeat");const i=_(f);(y||i)&&(w.gap=function(t,e,i,s,o){let n,r;_(t)?(n=t.x,r=t.y):n=r=t;return{x:qc(n,i,o.width,e&&e.x),y:qc(r,s,o.height,e&&e.y)}}(y,i&&f,Uc.width,Uc.height,e));break;default:k&&Wc(w,e,Uc.x,Uc.y,k,E,u)}return w.transform||(e.x||e.y)&&(w.transform=Xc(),Hc(w.transform,e.x,e.y)),k&&"stretch"!==r&&(w.scaleX=k,w.scaleY=E),w.width=s,w.height=o,n&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function qc(t,e,i,s){const o=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let Zc,Jc=new Lt;const{isSame:Qc}=Tt;function $c(t,e,i,s,o,n){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 o.data||Gc(o,s,i,n),!0}function tu(t,e){su(t,br.LOAD,e)}function eu(t,e){su(t,br.LOADED,e)}function iu(t,e,i){e.error=i,t.forceUpdate("surface"),su(t,br.ERROR,e)}function su(t,e,i){t.hasEvent(e)&&t.emitEvent(new br(e,i))}function ou(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:nu,scale:ru,copy:au}=I,{floor:hu,ceil:lu,max:du,abs:cu}=Math;function uu(e,i,s){let{scaleX:o,scaleY:n}=e.getRenderScaleData(!0,i.scaleFixed);const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:g,repeat:f,gap:y}=h;o*=s,n*=s,_&&(_=cu(_),p=cu(p),d=nu(),au(d,g),ru(d,1/_,1/p),o*=_,n*=p),c*=o,u*=n;const m=c*u;if(!f&&m>t.image.maxCacheSize)return!1;let v=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/lu(t))}else{const t=a.width*a.height;v>t&&(v=t)}m>v&&(l=Math.sqrt(m/v)),l&&(o/=l,n/=l,c/=l,u/=l),_&&(o/=_,n/=p);const w=y&&y.x*o,x=y&&y.y*n;if(g||1!==o||1!==n){const t=c+(w||0),e=u+(x||0);o/=t/du(hu(t),1),n/=e/du(hu(e),1),d||(d=nu(),g&&au(d,g)),ru(d,1/o,1/n)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,e.leafer&&e.leafer.config.smooth),k=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,i);return i.style=k,i.patternId=r,!0}}const _u={image:function(t,e,i,s,o){let n,r;const a=Fo.get(i);return Zc&&i===Zc.paint&&Qc(s,Zc.boxBounds)?n=Zc.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),Zc=a.use>1?{leafPaint:n,paint:i,boxBounds:Jc.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?($c(t,e,i,a,n,s),o&&(tu(t,r),eu(t,r))):a.error?o&&iu(t,r,a.error):(o&&(ou(t,!0),tu(t,r)),n.loadId=a.load(()=>{ou(t,!1),t.destroyed||($c(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),eu(t,r)),n.loadId=void 0},e=>{ou(t,!1),iu(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(e,i,s,o){const{scaleX:n,scaleY:r}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!Fh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||"miniapp"===t.name&&Cr.isResizing(e)||Fh.running)){let{width:e,height:i}=h;e*=n*a,i*=r*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||Fh.running?uu(e,s,a):s.patternTask||(s.patternTask=Fo.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&uu(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:uu,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,Fo.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createData:Gc,getPatternData:Kc,fillOrFitMode:Wc,clipMode:zc,repeatMode:Nc},{toPoint:pu}=ht,{hasTransparent:gu}=Th,fu={},yu={};function mu(t,e,i,s){if(i){let o,n,r,h;for(let t=0,l=i.length;t<l;t++)o=i[t],a(o)?(r=t/(l-1),n=Th.string(o,s)):(r=o.offset,n=Th.string(o.color,s)),e.addColorStop(r,n),!h&&gu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:vu,getDistance:wu}=K,{get:xu,rotateOfOuter:bu,scaleOfOuter:ku}=I,{toPoint:Eu}=ht,Su={},Bu={};function Ru(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=vu(e,i);n=xu(),o?(ku(n,e,r/a*(s||1),1),bu(n,e,t+90)):(ku(n,e,1,r/a*(s||1)),bu(n,e,t))}return n}const{getDistance:Tu}=K,{toPoint:Cu}=ht,Pu={},Ou={};const Lu={linearGradient:function(e,i){let{from:s,to:o,type:n,opacity:r}=e;pu(s||"top",i,fu),pu(o||"bottom",i,yu);const a=t.canvas.createLinearGradient(fu.x,fu.y,yu.x,yu.y),h={type:n,style:a};return mu(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Eu(s||"center",i,Su),Eu(o||"bottom",i,Bu);const h=t.canvas.createRadialGradient(Su.x,Su.y,0,Su.x,Su.y,wu(Su,Bu)),l={type:n,style:h};mu(l,h,e.stops,r);const d=Ru(i,Su,Bu,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Cu(s||"center",i,Pu),Cu(o||"bottom",i,Ou);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Pu.x,Pu.y):t.canvas.createRadialGradient(Pu.x,Pu.y,0,Pu.x,Pu.y,Tu(Pu,Ou)),l={type:n,style:h};mu(l,h,e.stops,r);const d=Ru(i,Pu,Ou,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Ru},{copy:Au,toOffsetOutBounds:Mu}=Tt,Du={},Fu={};function Iu(e,i,s,o){const{bounds:n,shapeBounds:r}=o;if(t.fullImageShadow){if(Au(Du,e.bounds),Du.x+=i.x-r.x,Du.y+=i.y-r.y,s){const{fitMatrix:t}=o;Du.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),Du.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),Du.width*=s,Du.height*=s}e.copyWorld(o.canvas,e.bounds,Du)}else s&&(Au(Du,i),Du.x-=i.width/2*(s-1),Du.y-=i.height/2*(s-1),Du.width*=s,Du.height*=s),e.copyWorld(o.canvas,r,s?Du:i)}const{toOffsetOutBounds:Wu}=Tt,zu={};const Nu={shadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Mu(l,Fu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Fu.offsetX+a.x*c*f,Fu.offsetY+a.y*u*f,a.blur*c*f,Th.string(a.color)),o=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Iu(_,Fu,o,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),s=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),Vn.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Wu(l,zu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(zu.offsetX+a.x*c*f,zu.offsetY+a.y*u*f,a.blur*c*f),o=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Iu(_,zu,o,i),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Th.string(a.color),"source-in"),Vn.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:Yu}=Qn;let Xu;function Hu(t,e,i,s,o,n,r,a){switch(e){case"grayscale":Xu||(Xu=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);ju(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":ju(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function Vu(t){return t.getSameCanvas(!1,!0)}function ju(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}yl.prototype.__renderMask=function(t,e){let i,s,o,n,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&&(Hu(this,r,t,o,s,n,void 0,!0),s=o=null),n=i.__.opacity,Xu=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=Vu(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=Vu(t)),o||(o=Vu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||Yu(i,e)||i.__render(t,e);continue}const d=1===n&&i.__.__blendMode;d&&Hu(this,r,t,o,s,n,void 0,!1),Yu(i,e)||i.__render(o||t,e),d&&Hu(this,r,t,o,s,n,d,!1)}Hu(this,r,t,o,s,n,void 0,!0)};const Uu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Gu=Uu+"_#~&*+\\=|≮≯≈≠=…",Ku=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 qu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Zu=qu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ju=qu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Qu=qu(Uu),$u=qu(Gu),t_=qu("- —/~|┆·");var e_;!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"}(e_||(e_={}));const{Letter:i_,Single:s_,Before:o_,After:n_,Symbol:r_,Break:a_}=e_;function h_(t){return Zu[t]?i_:t_[t]?a_:Ju[t]?o_:Qu[t]?n_:$u[t]?r_:Ku.test(t)?s_:i_}const l_={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function d_(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:c_}=l_,{Letter:u_,Single:__,Before:p_,After:g_,Symbol:f_,Break:y_}=e_;let m_,v_,w_,x_,b_,k_,E_,S_,B_,R_,T_,C_,P_,O_,L_,A_,M_,D_=[];function F_(t,e){B_&&!S_&&(S_=B_),m_.data.push({char:t,width:e}),w_+=e}function I_(){x_+=w_,m_.width=w_,v_.words.push(m_),m_={data:[]},w_=0}function W_(){O_&&(L_.paraNumber++,v_.paraStart=!0,O_=!1),B_&&(v_.startCharSize=S_,v_.endCharSize=B_,S_=0),v_.width=x_,A_.width?c_(v_):M_&&z_(),D_.push(v_),v_={words:[]},x_=0}function z_(){x_>(L_.maxWidth||0)&&(L_.maxWidth=x_)}const{top:N_,right:Y_,bottom:X_,left:H_}=nt;function V_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const j_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,o=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(n?(s=d[H_],n-=d[Y_]+d[H_]):i.autoSizeAlign||(s=d[H_]),r?(o=d[N_],r-=d[N_]+d[X_]):i.autoSizeAlign||(o=d[N_]));const c={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){L_=e,D_=e.rows,A_=e.bounds,M_=!A_.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=A_;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;O_=!0,T_=null,S_=E_=B_=w_=x_=0,m_={data:[]},v_={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)k_=i[s],"\n"===k_?(w_&&I_(),v_.paraEnd=!0,W_(),O_=!0):(R_=h_(k_),R_===u_&&"none"!==r&&(k_=d_(k_,r,!w_)),E_=a.measureText(k_).width,o&&(o<0&&(B_=E_),E_+=o),C_=R_===__&&(T_===__||T_===u_)||T_===__&&R_!==g_,P_=!(R_!==p_&&R_!==__||T_!==f_&&T_!==g_),b_=O_&&n?h-n:h,t&&h&&x_+w_+E_>b_&&(e?(w_&&I_(),x_&&W_()):(P_||(P_=R_===u_&&T_==g_),C_||P_||R_===y_||R_===p_||R_===__||w_+E_>b_?(w_&&I_(),x_&&W_()):x_&&W_()))," "===k_&&!0!==O_&&x_+w_===0||(R_===y_?(" "===k_&&w_&&I_(),F_(k_,E_),I_()):C_||P_?(w_&&I_(),F_(k_,E_)):F_(k_,E_)),T_=R_);w_&&I_(),x_&&W_(),D_.length>0&&(D_[D_.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{L_.paraNumber++,x_=a.measureText(t).width,D_.push({x:n||0,text:t,width:x_,paraStart:!0}),M_&&z_()})}(c,e,i),d&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":V_(e,"x",t[H_]);break;case"right":V_(e,"x",-t[Y_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":V_(e,"y",t[N_]);break;case"bottom":V_(e,"y",-t[X_])}}(d,c,i,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*o+(c?c*(t.paraNumber-1):0),m=r;if(h&&y>f)y=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,w,x,b=g||u?g:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(m+=c),v.y=m,m+=n,t.overflow>r&&m>y&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===o||"both"===o)&&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"!==o||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,n),c.overflow&&function(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,s,n),"none"!==h&&function(t,e){let i;const{fontSize:s,textDecoration:o}=e;switch(t.decorationHeight=s/11,_(o)?(i=o.type,o.color&&(t.decorationColor=Th.string(o.color))):i=o,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const U_={string:function(t,e){const i=l(e)&&e<1;if(a(t)){if(!i||!Th.object)return t;t=Th.object(t)}let s=n(t.a)?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};Object.assign(Rh,j_),Object.assign(Th,U_),Object.assign(Oh,Rc),Object.assign(Lh,_u),Object.assign(Ah,Lu),Object.assign(Mh,Nu),Object.assign(jt,{interaction:(t,e,i,s)=>new lc(t,e,i,s),hitCanvas:(t,e)=>new ih(t,e),hitCanvasManager:()=>new Gd}),wl.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&nh(0,wx)}catch(t){}function G_(t){return t?u(t)?t:[t]:[]}class K_ extends yr{get list(){return G_(this.value)}get oldList(){return G_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function q_(t){return(e,i)=>{const s="_"+i;Ho(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){if(this.config){const t="target"===i;if(t){u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(_(i))e=i;else if(!1===i)return}}const s=t?K_.BEFORE_SELECT:K_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new K_(s,{editor:this,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}K_.BEFORE_SELECT="editor.before_select",K_.SELECT="editor.select",K_.AFTER_SELECT="editor.after_select",K_.BEFORE_HOVER="editor.before_hover",K_.HOVER="editor.hover";const{abs:Z_}=Math,{copy:J_,scale:Q_}=I,{setListWithFn:$_}=Tt,{worldBounds:tp}=Qn,ep={a:1,b:0,c:0,d:1,e:0,f:0},ip={x:0,y:0,width:0,height:0};class sp extends fl{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?($_(ip,e,tp),t&&this.set(t),this.set(ip),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:n,strokeWidth:r,fill:h}=o,{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=Z_(c.scaleX),l=Z_(c.scaleY);if(J_(ep,c),ep.half=r%2,i!==l){Q_(ep,1/i,1/l),t.setWorld(ep,e.matrix),t.beginPath(),o.strokeWidth=r;const{x:n,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,a*l,h*i,d*l)}else t.setWorld(ep,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/Z_(c.scaleX);n&&(a(n)?Oh.stroke(n,this,t):Oh.strokes(n,this,t)),h&&(a(h)?Oh.fill(h,this,t):Oh.fills(h,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}$t([q_(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],sp.prototype,"target",void 0);class op extends yl{constructor(t){super(t),this.strokeArea=new xl({strokeAlign:"center"}),this.fillArea=new xl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const np={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return rp([t],i,e),i}};function rp(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.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)&&o.hitSelf&&e.push(s)}s.isBranch&&rp(s.children,e,i)}}const{findOne:ap,findByBounds:hp}=np;class lp extends yl{get dragging(){return!!this.originList}get running(){const{editor:t}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector}get isMoveMode(){return this.app&&this.app.interaction.moveMode}constructor(t){super(),this.hoverStroker=new sp,this.targetStroker=new sp,this.bounds=new Lt,this.selectArea=new op,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:o}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},o||{}))}}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:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},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(),o=new $a(hp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.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)&&!ap(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new $a(this.editor.editBox.rect)};return ap(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):ap(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[K_.HOVER,this.onHover,this],[K_.SELECT,this.onSelect,this]]),e.on_([[md.MOVE,this.onPointerMove,this],[md.BEFORE_DOWN,this.onBeforeDown,this],[md.TAP,this.onTap,this],[xd.START,this.onDragStart,this,!0],[xd.DRAG,this.onDrag,this],[xd.END,this.onDragEnd,this],[Ed.MOVE,this.onAutoMove,this],[[Rd.ZOOM,Ed.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:dp,top:cp,topRight:up,right:_p,bottomRight:pp,bottom:gp,bottomLeft:fp,left:yp}=rt,{toPoint:mp}=ht,{within:vp,sign:wp}=b,xp={getScaleData(t,e,i,s,o,n,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:p,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;n&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=wp(v),b=wp(w),k=a?v:x*u.width/y,E=a?w:b*u.height/m;s.x*=a?v:x,s.y*=a?w:b;const S=(-s.y+m)/m,B=(s.x+y)/y,R=(s.y+m)/m,T=(-s.x+y)/y;switch(i){case cp:c=S,h="bottom";break;case _p:d=B,h="left";break;case gp:c=R,h="top";break;case yp:d=T,h="right";break;case dp:c=S,d=T,h="bottom-right";break;case up:c=S,d=B,h="bottom-left";break;case pp:c=R,d=B,h="top-left";break;case fp:c=R,d=T,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case cp:case gp:t=c;break;case yp:case _p:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const C=1!==d,P=1!==c;if(C&&(d/=k),P&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(mp(n||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new Lt(t.__localBoxBounds);if(Tt.includes(new Lt(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Tt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,o=t.height/i.height;C&&(d*=s),P&&(c*=o)}}if(C&&_){const e=u.width*t.scaleX;d=vp(e*d,_)/e}if(P&&p){const e=u.height*t.scaleY;c=vp(e*c,p)/e}return C&&Math.abs(d*f.width)<1&&(d=wp(d)/f.width),P&&Math.abs(c*f.height)<1&&(c=wp(c)/f.height),o&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case dp:n="bottom-right";break;case up:n="bottom-left";break;case pp:n="top-left";break;case fp:n="top-right";break;default:n="center"}return mp(o||n,t.boxBounds,r,!0),{origin:r,rotation:K.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case cp:case dp:n={x:.5,y:0},o="bottom",a=1;break;case gp:case pp:n={x:.5,y:1},o="top",a=1;break;case yp:case fp:n={x:0,y:.5},o="right",h=1;break;case _p:case up:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,mp(s||o,t,r,!0);const c=K.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.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 yp:t=_p;break;case dp:t=up;break;case fp:t=pp;break;case _p:t=yp;break;case up:t=dp;break;case pp:t=fp}if(i)switch(t){case cp:t=gp;break;case dp:t=fp;break;case up:t=pp;break;case gp:t=cp;break;case fp:t=dp;break;case pp:t=up}return t}},bp={};function kp(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:_,rotateable:p,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&p&&(t.isHoldRotateKey(e)||!_)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?o?u:n?d:c:y?u:f?d:c;h+=45*(xp.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(b.formatRotation(h,!0)/2);const{url:v,x:w,y:x}=m,k=v+h;bp[k]?i.cursor=bp[k]:bp[k]=i.cursor={url:Sp(v,h),x:w,y:x}}function Ep(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Sp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Bp extends Rl{constructor(t){super(t),this.useFastShadow=!0}}const Rp=["top","right","bottom","left"],Tp=void 0;class Cp extends yl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}constructor(t){super(),this.view=new yl,this.rect=new Rl({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Bp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new yl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new Bp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Bp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Bp({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:n}=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=n[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;o.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:r,strokeWidth:a,editConfig:Tp},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}]),Ep(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,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:o,rotation:n,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:o,circle:n,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{middlePoint:c,resizeable:u,rotateable:_,hideOnSmall:p,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Tt.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=l(p)?p:10,w=g&&!(p&&e<y&&f<y);let x,b,k,E={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,E),b=a[i],x=h[i],b.set(E),x.set(E),b.visible=w&&!(!u&&!_),x.visible=w&&_&&u&&!m,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=b.visible&&!v,b.visible=x.visible=w&&!!c,(i+1)/2%2?(k.width=e,p&&2*b.width>e&&(b.visible=!1)):(k.height=f,p&&2*b.width>f&&(b.visible=!1)));n.visible=w&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||g})),r.visible=w&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=Rp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=Rp.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?xp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:Tp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:o}=this,{target:n}=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)),o.x=t.x,o.y=t.y,o.point={x:n.x,y:n.y},o.bounds=Object.assign({},n.getLayoutBounds("box","local")),o.rotation=n.rotation,i&&i.includes("resize")&&(Cr.resizingKeys=s.leafList.keys)}onDragEnd(t){this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds&&this.transformTool.onMove(t),this.dragPoint=null,this.resetDoing();const{name:e,pointType:i}=t.current;"rect"===e&&(this.editor.opacity=1),i&&i.includes("resize")&&(Cr.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t),Ep(this);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t),kp(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onMoveEnd(t){this.moving&&this.transformTool.onMove(t),this.resetDoing()}onScale(t){this.canGesture&&(t.stop(),a(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){kp(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const o=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=o;break;case"ArrowUp":s=-o;break;case"ArrowLeft":e=-o;break;case"ArrowRight":e=o}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof dd)||t.find(t=>t instanceof dd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e;const s=[[xd.START,this.onDragStart,this],[xd.DRAG,this.onDrag,this],[xd.END,this.onDragEnd,this],[md.LEAVE,()=>{this.enterPoint=null}]];"circle"!==t.name&&s.push([md.ENTER,e=>{this.enterPoint=t,kp(this,e)}]),this.__eventIds.push(t.on_(s))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[xd.START,this.onDragStart,this],[xd.DRAG,this.onDrag,this],[xd.END,this.onDragEnd,this],[md.ENTER,()=>Ep(this)],[md.DOUBLE_TAP,this.onDoubleTap,this],[md.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[Td.HOLD,Td.UP],this.onKey,this],[Td.DOWN,this.onArrow,this],[Ed.BEFORE_MOVE,this.onMove,this,!0],[Rd.BEFORE_ZOOM,this.onScale,this,!0],[Sd.BEFORE_ROTATE,this.onRotate,this,!0],[Ed.END,this.onMoveEnd,this],[Rd.END,this.resetDoing,this],[Sd.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Pp={x:0,y:0,width:1e5,height:1e5};class Op extends fl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Pp),Object.assign(this.__world,Pp)}__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 Lp='\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"/>',Ap={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${Lp}\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${Lp}\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${Lp}\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},Mp=new Lt;function Dp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Mp.setListWithFn(i,t=>t.getBounds("box","page")),0===Mp.width&&(Mp.width=.1),0===Mp.height&&(Mp.height=.1),e.reset(Mp.get())}),s.add(e)}const Fp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Ip=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Wp={group(t,e,i){t.sort(Ip);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new yl(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(Fp);const r=new et(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},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(Fp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Ip),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},zp=It.get("EditToolCreator");function Np(){return t=>{Xp.register(t)}}const Yp=Np,Xp={list:{},register(t){const{tag:e}=t.prototype;Hp[e]&&zp.repeat(e),Hp[e]=t},get:(t,e)=>new Hp[t](e)},{list:Hp}=Xp;class Vp extends K_{constructor(t,e){super(t,e)}}Vp.BEFORE_OPEN="innerEditor.before_open",Vp.OPEN="innerEditor.open",Vp.BEFORE_CLOSE="innerEditor.before_close",Vp.CLOSE="innerEditor.close";class jp extends K_{constructor(t,e){super(t,e)}}jp.BEFORE_GROUP="editor.before_group",jp.GROUP="editor.group",jp.BEFORE_UNGROUP="editor.before_ungroup",jp.UNGROUP="editor.ungroup",jp.BEFORE_OPEN="editor.before_open_group",jp.OPEN="editor.open_group",jp.BEFORE_CLOSE="editor.before_close_group",jp.CLOSE="editor.close_group";const{updateMatrix:Up}=Vn,Gp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Kp="top-left";class qp extends xl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(wr.CHANGE,e=>{if(this.checkChange&&Gp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,Up(this.parent),Up(this);const a=new et(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Up(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(Kp,n);break;case"scaleX":t.scaleOf(Kp,n,1);break;case"scaleY":t.scaleOf(Kp,1,n);break;case"skewX":t.skewOf(Kp,n,0);break;case"skewY":t.skewOf(Kp,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Zp extends K_{constructor(t,e){super(t,e)}}Zp.BEFORE_MOVE="editor.before_move",Zp.MOVE="editor.move";class Jp extends K_{constructor(t,e){super(t,e)}}Jp.BEFORE_SCALE="editor.before_scale",Jp.SCALE="editor.scale";class Qp extends K_{constructor(t,e){super(t,e)}}Qp.BEFORE_ROTATE="editor.before_rotate",Qp.ROTATE="editor.rotate";class $p extends K_{constructor(t,e){super(t,e)}}$p.BEFORE_SKEW="editor.before_skew",$p.SKEW="editor.skew";class tg{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:n}=i;const r=t.type===Ed.END||t.type===xd.END,h=a(e.draggable),d=!n||r||h;if(t instanceof Ed)o=t.getLocalMove(e),d&&xd.limitMove(e,o);else{const i={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),o=xd.getValidMove(e,s.point,i,d)}(o.x||o.y)&&(n&&!h&&r?Vn.animateMove(this,o,l(n)?n:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let{around:n,lockRatio:r,flipable:a,editSize:h}=i;if(t instanceof Rd)this.scaleOf(e.getBoxPoint(t),t.scale,t.scale);else{const{direction:i}=t.current;(t.shiftKey||e.lockRatio)&&(r=!0);const l=xp.getScaleData(e,o.bounds,i,t.getInnerTotal(e),r,xp.getAround(n,t.altKey),a,!s||"scale"===h);this.editTool&&this.editTool.onScaleWithDrag?(l.drag=t,this.scaleWithDrag(l)):this.scaleOf(l.origin,l.scaleX,l.scaleY)}}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r}=i,{direction:a}=t.current;let h,l;if(t instanceof Sd)l=t.rotation,h=n?ht.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=xp.getRotateData(e,a,t,s,t.shiftKey?null:n||e.around||e.origin||o||"center");l=s.rotation+i.rotation-e.rotation,h=i.origin}l=b.float(b.getGapRotation(l,r,e.rotation),2),l&&this.rotateOf(h,l)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=xp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),xp.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;_(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(_(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Zp(Zp.BEFORE_MOVE,h));const l=new Zp(Zp.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:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Jp(Jp.BEFORE_SCALE,t));const n=new Jp(Jp.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if(_(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.scaleOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Jp(Jp.BEFORE_SCALE,c));const u=new Jp(Jp.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new et(Vn.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Jp(Jp.BEFORE_SCALE,r));const a=new Jp(Jp.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new Qp(Qp.BEFORE_ROTATE,d));const c=new Qp(Qp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if(_(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.skewOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new $p($p.BEFORE_SKEW,c));const u=new $p($p.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(Vn.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new et(e.worldTransform);return t(),new et(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let eg=class extends yl{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new $a,this.openedGroupList=new $a,this.simulateTarget=new qp(this),this.editBox=new Cp(this),this.editToolList={},this.selector=new lp(this),this.editMask=new Op(this),this.targetEventIds=[];let i=f.clone(Ap);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Vt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Dp(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(a(s))e=s;else if(!1===s)return}if(Xp.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||Xp.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(jp.BEFORE_GROUP),this.target=Wp.group(this.list,this.element,t),this.emitGroupEvent(jp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(jp.BEFORE_UNGROUP,t)),this.target=Wp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(jp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(jp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(jp.OPEN,t)}closeGroup(t){this.emitGroupEvent(jp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(jp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Vn.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 jp(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(a(i))s=i;else if(!1===i)return}Xp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||Xp.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(Vp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Vp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Vp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Vp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Vp(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&&(Wp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Wp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Lr.START,this.onRenderStart,this),i&&i.on_(wr.SCROLL,this.onChildScroll,this),t.on_(Lr.CHILD_START,this.onAppRenderStart,this)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};$t([(t,e)=>{Ho(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:o}=this,a=Object.assign({},t);return e&&e.editConfig&&Object.assign(a,e.editConfig),s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),n(a.dragLimitAnimate)&&(a.dragLimitAnimate=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],eg.prototype,"mergeConfig",void 0),$t([q_(function(t,e){t.emitEvent(new K_(K_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],eg.prototype,"hoverTarget",void 0),$t([q_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof $a?i:new $a(i),t.multiple&&Dp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new K_(K_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new K_(K_.AFTER_SELECT,s))})],eg.prototype,"target",void 0),eg=$t([Pn(tg,["editBox","editTool","emitEvent"])],eg);class ig{static registerInnerEditor(){Xp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new yl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let sg=class extends ig{static registerEditTool(){Xp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,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()}};sg=$t([Np()],sg);const{left:og,right:ng}=rt,{move:rg,copy:ag,toNumberPoints:hg}=K;let lg=class extends sg{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===og;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.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=hg(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(rg(t,n,r),s&&rg(e,-n,-r)):(s&&rg(t,-n,-r),rg(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),ag(s[7],i),ag(e[7],i),ag(s[3],a),ag(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===og||t===ng,s[t].visible=a,e[t].visible=!r&&a}};lg=$t([Np()],lg);const{M:dg,L:cg,C:ug,Q:_g,Z:pg,N:gg,D:fg,X:yg,G:mg,F:vg,O:wg,P:xg,U:bg}=fe,kg={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case dg:case cg:Eg(t,e,i,o,1),o+=3;break;case ug:Eg(t,e,i,o,3),o+=7;break;case _g:Eg(t,e,i,o,2),o+=5;break;case pg:o+=1;break;case gg:Eg(t,e,i,o,2),o+=5;break;case fg:Eg(t,e,i,o,2),o+=9;break;case yg:Eg(t,e,i,o,2),o+=6;break;case mg:Eg(t,e,i,o,2),o+=9;break;case vg:Eg(t,e,i,o,2),o+=5;break;case wg:t[o]=mg,t.splice(o+4,0,t[o+3],0),Eg(t,e,i,o,2),o+=9,n+=2;break;case xg:t[o]=vg,t.splice(o+4,0,t[o+3]),Eg(t,e,i,o,2),o+=5,n+=1;break;case bg:Eg(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:Eg}=kg,Sg=I.get(),{topLeft:Bg,top:Rg,topRight:Tg,right:Cg,bottom:Pg,left:Og}=rt;function Lg(t,e,i){t.pathInputed?Mg(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Ag(t,e,i,s){let o=e;if(!n(s)){const n=t.__layout;let{width:r,height:a}=n.boxBounds;switch(r*=i-e,a*=e-i,s){case Rg:case Pg:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Og:case Cg:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Bg:case Tg:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function Mg(t,e,i){kg.scale(t.__.path,e,i),t.path=t.__.path}function Dg(t,e,i){const{points:s}=t;_(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):kg.scalePoints(s,e,i),t.points=s}function Fg(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Sg.a=e,Sg.d=i,s[t].transform(Sg,!0)}const Ig=Xa.prototype;function Wg(t,e,i){zg(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Ed.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(Ed.END,e=>{Vn.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(Rd.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function zg(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}Ig.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))},Ig.__scaleResize=function(t,e){Lg(this,t,e)},Ig.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Ig.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},dd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)Ag(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),Lg(this,t,e)}},cd.prototype.__scaleResize=function(t,e){Mg(this,t,e)},Nl.prototype.__scaleResize=function(t,e){this.pathInputed?Mg(this,t,e):this.points?Dg(this,t,e):this.width*=t},ql.prototype.__scaleResize=function(t,e){this.pathInputed?Mg(this,t,e):this.points?Dg(this,t,e):Lg(this,t,e)},yl.prototype.__scaleResize=function(t,e){Fg(this,t,e)},Rl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Lg(this,t,e),i&&Fg(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),jt.editor=function(t,e){const i=new eg(t);return e&&e.sky.add(e.editor=i),i},Rl.addAttr("textBox",!1,qo),fl.addAttr("editConfig",void 0,qo),fl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),qo),fl.addAttr("editInner","PathEditor",qo),yl.addAttr("editInner","",qo),dd.addAttr("editInner","TextEditor",qo),fl.setEditConfig=function(t){this.changeAttr("editConfig",t)},fl.setEditOuter=function(t){this.changeAttr("editOuter",t)},fl.setEditInner=function(t){this.changeAttr("editInner",t)};const Ng=It.get("LeaferTypeCreator"),Yg={list:{},register(t,e){Xg[t]&&Ng.repeat(t),Xg[t]=e},run(t,e){const i=Xg[t];i&&i(e)}},{list:Xg,register:Hg}=Yg;Hg("viewport",Wg),Hg("custom",function(t){Wg(t,null,!0)}),Hg("design",function(t){Wg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Hg("document",function(t){Wg(t,{zoom:{min:1},move:{scroll:"limit"}})});const Vg={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),o=K.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=K.getDistance(e.from,i.from);return{move:n,scale:K.getDistance(e.to,i.to)/r,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:o}}},{abs:jg,max:Ug}=Math,{sign:Gg,within:Kg}=b,qg={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=jg(s),r=jg(o);return n>50&&(s=Ug(50,n/3)*Gg(s)),r>50&&(o=Ug(50,r/3)*Gg(o)),{x:-s*i*2,y:-o*i*2}},getScale(e,i){let s,o=1,{zoomMode:n,zoomSpeed:r}=i;const a=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=Kg(r,0,1);const t=e.deltaY?i.delta.y:i.delta.x,s=Kg(1-jg(a)/(4*t)*r,.5,2);o=a>0?s:1/s}return o}};class Zg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Ed.START,this.moveData)),t.path=this.moveData.path,e.emit(Ed.BEFORE_MOVE,t),e.emit(Ed.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Rd.START,this.zoomData)),t.path=this.zoomData.path,e.emit(Rd.BEFORE_ZOOM,t),e.emit(Rd.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Sd.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Sd.BEFORE_ROTATE,t),e.emit(Sd.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Ed.END,e),i&&t.emit(Rd.END,i),s&&t.emit(Sd.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Jg=wl.prototype,Qg=new Lt,$g=new $;function tf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function ef(t,e){return Object.assign(Object.assign({},e),{scale:t})}Jg.initType=function(t){Yg.run(t,this)},Jg.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if($g.set(t,e),s){const t=!0===s?"":s;t.includes("x")?$g.y=0:t.includes("y")?$g.x=0:Math.abs($g.x)>Math.abs($g.y)?$g.y=0:$g.x=0,i&&t.includes("limit")&&(Qg.set(this.__world).addPoint(this.zoomLayer),ll.getValidMove(Qg,this.canvas.bounds,"inner",$g,!0),t.includes("x")?$g.y=0:t.includes("y")&&($g.x=0))}return{x:o?0:$g.x,y:o?0:$g.y}},Jg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const sf=jd.prototype;sf.createTransformer=function(){this.transformer=new Zg(this)},sf.move=function(t){this.transformer.move(t)},sf.zoom=function(t){this.transformer.zoom(t)},sf.rotate=function(t){this.transformer.rotate(t)},sf.transformEnd=function(){this.transformer.transformEnd()},sf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):qg.getScale(t,e);if(1!==n)this.zoom(ef(n,t));else{const s=e.getMove?e.getMove(t,e):qg.getMove(t,e);i.snap&&K.round(s),this.move(tf(s,t))}},sf.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:o,center:n}=Vg.getData(e);Object.assign(t,n),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(ef(o,t)),this.move(tf(i,t))};const of=Dd.prototype,{abs:nf}=Math;function rf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}of.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=nf(i),n=nf(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(o>r||n>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;o*(e=e?l(a)?a:.95:r)>h?e=h/o:n*e>h&&(e=h/n),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},of.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},of.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},of.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Tt.maxX(r),d=Tt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let _=0,p=0;this.autoMoveTimer=setInterval(()=>{_+=c,p+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:p,moveType:"drag"})),e.pointerMoveReal(t)},10)},of.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),wl.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),p(e)?(o=e.padding,i=e.scroll,s=e.transition):o=e;const{zoomLayer:n}=this,h=this.canvas.bounds.clone().shrink(r(o)?30:o),d=new Lt,c={x:h.x+h.width/2,y:h.y+h.height/2};let g;const{x:f,y:y,scaleX:m,scaleY:v}=n.__;if(a(t))switch(t){case"in":g=rf(m,"in");break;case"out":g=rf(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Lt(this.boxBounds)).height=0;break;case"fit-height":(t=new Lt(this.boxBounds)).width=0}else l(t)&&(g=t/m);if(g)g=this.getValidScale(g),n.scaleOfWorld(c,g,g,!1,s);else if(_(t)){const e={x:f,y:y,scaleX:m,scaleY:v},o=u(t);if(o||t.tag){const e=o?t:[t];d.setListWithFn(e,Qn.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,h);d.set(n.getWorldBounds(e))}const{width:r,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-r)/2,0),c+=Math.max((h.height-a)/2,0)):(g=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*g)/2,c+=(h.height-a*g)/2,K.scaleOf(e,d,g),d.scaleOf(d,g),e.scaleX*=g,e.scaleY*=g),"x"===i?c=0:"y"===i&&(l=0),K.move(e,l,c),d.move(l,c),n.set(e,s),d}return n.worldBoxBounds};class af extends yl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Rl,this.scrollYBar=new Rl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Lt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,_=l<1,{scrollXBar:p,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=r.shrink([2,_?g.width+6:2,u?p.height+6:2,2]);p.set({x:f+m*d,y:y+v+2,width:Math.max(m*h,e),visible:u}),g.set({x:f+m+2,y:y+v*c,height:Math.max(v*l,e),visible:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(xd.DRAG,this.onDrag,this),e.on_(xd.DRAG,this.onDrag,this),t.on_(xd.END,this.onDragEnd,this),e.on_(xd.END,this.onDragEnd,this),this.target.on_(Lr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Cr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Vt.add("scroll");class hf extends Jh{}function lf(t){return Uo(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,hn(this)}}}))}let df=class extends Nl{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Ph.register(t,e)}};$t([xn(hf)],df.prototype,"__",void 0),$t([lf("angle")],df.prototype,"endArrow",void 0),df=$t([On()],df);const{M:cf,L:uf,C:_f,Q:pf,O:gf}=fe,{rotate:ff,copyFrom:yf,scale:mf}=K,vf={},wf={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case cf:case uf:xf(t,l+1,e,i,s,o,n,r),l+=3;break;case _f:for(h=1;h<6;h+=2)xf(t,l+h,e,i,s,o,n,r);l+=7;break;case pf:for(h=1;h<4;h+=2)xf(t,l+h,e,i,s,o,n,r);l+=5;break;case gf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){wf.layout(t,0,0,1,1,e,i)}};function xf(t,e,i,s,o,n,r,a){yf(vf,t[e],t[e+1]),r&&ff(vf,r,a),o&&mf(vf,o,n),t[e]=i+vf.x,t[e+1]=s+vf.y}const{layout:bf,rotate:kf}=wf,{getAngle:Ef}=K,Sf={x:-.5},Bf={connect:Sf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Rf={connect:Sf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Tf={connect:Sf,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]},Cf={connect:Sf,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]},Pf={offset:Sf,path:[...Tf.path],dashPath:[1,-2.5,0,2,-1,0]};kf(Pf.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]},Lf={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]},Mf={path:[...Af.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Df=f.clone(Af),Ff=f.clone(Mf);kf(Df.path,45),kf(Ff.path,45);const If={angle:Bf,"angle-side":Rf,arrow:Cf,triangle:Tf,"triangle-flip":Pf,circle:Lf,"circle-line":Of,square:Mf,"square-line":Af,diamond:Ff,"diamond-line":Df,mark:{offset:Sf,path:[1,0,-2,2,0,2]}};function Wf(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;_(e)?e.type?(h=e.scale,a=If[e.type]):a=e:a=If[e];const{offset:c,connect:u,path:p,dashPath:g}=a;let f=u?u.x:0,y=c?c.x:0;const m=[...p];return r&&g&&m.push(...g),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?y+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(y+=c.bevelJoin)),h&&bf(m,0,0,h,h),y&&bf(m,y,0),bf(m,s.x,s.y,o,o,Ef(i,s)),n.x=(f+y)*o,m}const{M:zf,L:Nf,C:Yf,Q:Xf,Z:Hf,N:Vf,D:jf,X:Uf,G:Gf,F:Kf,O:qf,P:Zf,U:Jf}=fe,{copy:Qf,copyFrom:$f,getDistancePoint:ty}=K,ey={},iy={},sy={},oy={},ny={},ry={list:If,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case zf:case Nf:(c<2||l+6>=d)&&($f(ny,n[l+1],n[l+2]),!c&&u&&Qf(iy,ny)),l+=3;break;case Yf:(1===c||l+7>=d-3)&&ay(n,oy,ny,l+3),l+=7;break;case Xf:(1===c||l+5>=d-3)&&ay(n,oy,ny,l+1),l+=5;break;case Hf:return;case Vf:l+=5;break;case jf:l+=9;break;case Uf:l+=6;break;case Gf:l+=9;break;case Kf:l+=5;break;case qf:l+=7;break;case Zf:l+=4;break;case Jf:(1===c||l+6>=d-3)&&(ay(n,oy,ny,l+1),l+6!==d&&(ny.x-=(ny.x-oy.x)/10,ny.y-=(ny.y-oy.y)/10)),l+=6}if(c++,1===c&&h!==zf)return;if(2===c&&u&&Qf(sy,h===Nf?ny:oy),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=Wf(t,e,sy,iy,s,ey,!!o);o?d.push(...i):r.push(...i),ey.x&&(ty(iy,sy,-ey.x,!0),r[1]=sy.x,r[2]=sy.y)}if(i&&"none"!==i){const e=Wf(t,i,oy,ny,s,ey,!!o);if(o?d.push(...e):r.push(...e),ey.x){let t;switch(ty(ny,oy,-ey.x,!0),h){case Nf:t=l-3+1;break;case Yf:t=l-7+5;break;case Xf:t=l-5+3;break;case Jf:t=l-6+3}t&&hy(r,oy,t)}}}else Qf(oy,ny)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function ay(t,e,i,s){$f(e,t[s],t[s+1]),$f(i,t[s+2],t[s+3])}function hy(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),fl.addAttr("startArrow","none",lf),fl.addAttr("endArrow","none",lf),Object.assign(Ph,ry),Object.assign(Oh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let ly=class extends Rl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};$t([xn(class extends Kh{})],ly.prototype,"__",void 0),$t([Qo("x")],ly.prototype,"flow",void 0),ly=$t([On()],ly);const dy={},cy={"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"},uy={"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 _y(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;ct.toPoint(i,e,o,dy),e.x=s.__autoWidth?o.x:dy.x,e.y=s.__autoHeight?o.y:dy.y}const{move:py}=K;function gy(t,e,i,s,o,n){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[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),py(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function fy(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 yy={};function my(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,h=o&&(e?!n:!r);return _(i)?(yy.xGap=i.x||0,yy.yGap=i.y||0):yy.xGap=yy.yGap=c(i),yy.isAutoXGap=a(yy.xGap)&&!n,yy.isAutoYGap=a(yy.yGap)&&!r,yy.complex=h||"top-left"!==s||t.__hasGrow||yy.isAutoXGap||yy.isAutoYGap,yy.wrap=h,yy.complex&&(yy.isFitXGap="fit"===yy.xGap&&!n,yy.isFitYGap="fit"===yy.yGap&&!r,_(s)?(yy.contentAlign=s.content||"top-left",yy.rowXAlign=s.x||"from",yy.rowYAlign=s.y||"from"):(yy.contentAlign=s,yy.rowXAlign=cy[s],yy.rowYAlign=uy[s])),yy}function vy(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function wy(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function xy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:by}=b;function ky(t,e,i,s){let o,n,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++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=Ey(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=Ey(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function Ey(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?by(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:Sy}=b;function By(t,e,i,s){let o,n,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++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=Ry(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=Ry(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function Ry(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?Sy(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:Ty}=K;function Cy(t,e){const i="width",{children:s,itemBox:o}=t,n=my(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:h;let p,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)p=s[y=e?h-1-n:n],p.__.inFlow&&0!==p.__.visible&&(g=xy(p,o),r?(p.__flowBounds=g,m||(m=vy(y,_)),a&&m.count&&m.width+g.width>x&&(m.grow?ky(t,m,x,e):d&&wy(m,i,x,c),fy(u,m,i),m=vy(y,_)),f=g.width,p.__widthGrow&&(m.grow+=p.__widthGrow,f=0,p.__.widthRange&&(m.hasRangeSize=!0)),p.__heightGrow&&Ry(p,g,b),m.width+=m.count?f+_:f,m.height=Math.max(m.height,g.height),m.count++):(Ty(p,v-g.x,w-g.y),v+=g.width+_));if(r&&m){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:_}=n;m.count&&(m.grow?ky(t,m,x,e):d&&wy(m,i,x,c),a&&fy(u,m,i)),a?(s?wy(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){_y(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=cy[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],gy(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,_,e)):(_y(t,m,r),gy(t,m,0,m.y,_,e))}}const{move:Py}=K;function Oy(t,e,i,s,o,n){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[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),Py(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Ly}=K;function Ay(t,e){const i="height",{children:s,itemBox:o}=t,n=my(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:l;let p,g,f,y,m,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)p=s[y=e?h-1-n:n],p.__.inFlow&&0!==p.__.visible&&(g=xy(p,o),r?(p.__flowBounds=g,m||(m=vy(y,_)),a&&m.count&&m.height+g.height>b&&(m.grow&&By(t,m,b,e),d&&wy(m,i,b,c),fy(u,m,i),m=vy(y,_)),f=g.height,p.__heightGrow&&(m.grow+=p.__heightGrow,f=0,p.__.heightRange&&(m.hasRangeSize=!0)),p.__widthGrow&&Ey(p,g,x),m.height+=m.count?f+_:f,m.width=Math.max(m.width,g.width),m.count++):(Ly(p,v-g.x,w-g.y),w+=g.height+_));if(r&&m){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:_}=n;m.count&&(m.grow&&By(t,m,b,e),d&&wy(m,i,b,c),a&&fy(u,m,i)),a?(s?wy(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){_y(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=uy[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,_),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],Oy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(_y(t,m,r),Oy(t,m,m.x,0,l,e))}}function My(t){return Uo(t,t=>({set(e){const i=l(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&on(this)}}))}Vt.add("flow","resize");const Dy=Rl.prototype,{__updateBoxBounds:Fy}=yl.prototype;fl.addAttr("flow",!1,Qo),fl.addAttr("gap",0,en),fl.addAttr("flowAlign","top-left",en),fl.addAttr("flowWrap",!1,en),fl.addAttr("itemBox","box",en),fl.addAttr("inFlow",!0,en),fl.addAttr("autoWidth",void 0,My),fl.addAttr("autoHeight",void 0,My),fl.addAttr("autoBox",void 0,en);const{copyAndSpread:Iy}=Tt;Dy.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Cy(this);break;case"y":Ay(this);break;case"x-reverse":Cy(this,!0);break;case"y-reverse":Ay(this,!0)}t&&(this.leafer.created=!0)},Dy.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Iy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Dy.__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():Fy.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&&Iy(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:Wy,sin:zy,pow:Ny,sqrt:Yy,abs:Xy,ceil:Hy,floor:Vy,round:jy,PI:Uy}=Math,Gy=5*Uy,Ky=1.70158,qy=2.5949095,Zy=7.5625,Jy=2.75;function Qy(t){return e=>Ny(e,t)}function $y(t){return e=>1-Ny(1-e,t)}function tm(t){return e=>e<.5?.5*Ny(2*e,t):1-.5*Ny(2-2*e,t)}function em(t){return t<1/Jy?Zy*t*t:t<2/Jy?Zy*(t-=1.5/Jy)*t+.75:t<2.5/Jy?Zy*(t-=2.25/Jy)*t+.9375:Zy*(t-=2.625/Jy)*t+.984375}function im(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=sm(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Xy(l)<1e-6));e++)c-=d/l;return o[r]=sm(c,e,s)}}function sm(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const om={get(t){const{list:e}=om;return a(t)?e[t||"ease"]:_(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){om.list[t]=e},list:{linear:t=>t,ease:im(.25,.1,.25,1),"ease-in":im(.42,0,1,1),"ease-out":im(0,0,.58,1),"ease-in-out":im(.42,0,.58,1),"sine-in":t=>1-Wy(t*Uy*.5),"sine-out":t=>zy(t*Uy*.5),"sine-in-out":t=>.5*(1-Wy(t*Uy)),"quad-in":Qy(2),"quad-out":$y(2),"quad-in-out":tm(2),"cubic-in":Qy(3),"cubic-out":$y(3),"cubic-in-out":tm(3),"quart-in":Qy(4),"quart-out":$y(4),"quart-in-out":tm(4),"quint-in":Qy(5),"quint-out":$y(5),"quint-in-out":tm(5),"expo-in":t=>t?Ny(2,10*t-10):0,"expo-out":t=>1===t?1:1-Ny(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*Ny(2,2*t*10-10):.5*(2-Ny(2,10-2*t*10)),"circ-in":t=>1-Yy(1-Ny(t,2)),"circ-out":t=>Yy(1-Ny(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Yy(1-Ny(2*t,2))):.5*(Yy(1-Ny(2-2*t,2))+1),"back-in":t=>((Ky+1)*t-Ky)*t*t,"back-out":t=>(t-=1)*t*((Ky+1)*t+Ky)+1,"back-in-out":t=>t<.5?(t*=2)*t*((qy+1)*t-qy)*.5:.5*((t=2*t-2)*t*((qy+1)*t+qy)+2),"elastic-in":t=>0===t||1===t?t:-Ny(2,10*(t-1))*zy((t-1.1)*Gy),"elastic-out":t=>0===t||1===t?t:Ny(2,-10*t)*zy((t-.1)*Gy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-Ny(2,10*((t*=2)-1))*zy((t-1.1)*Gy)*.5:Ny(2,10*(1-(t*=2)))*zy((t-1.1)*Gy)*.5+1,"bounce-in":t=>1-em(1-t),"bounce-out":em,"bounce-in-out":t=>t<.5?.5*(1-em(1-2*t)):.5*(1+em(2*t-1)),"cubic-bezier":im,steps:function(t,e="floor"){return i=>("floor"===e?Vy(i*t):"ceil"===e?Hy(i*t):jy(i*t))/t}}};function nm(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 rm{}rm.CREATED="created",rm.PLAY="play",rm.PAUSE="pause",rm.STOP="stop",rm.SEEK="seek",rm.UPDATE="update",rm.COMPLETED="completed";let am=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:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&l(o)&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:o,attrs:n}=this;this.easingFn=om.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.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(rm.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(rm.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(rm.STOP))}seek(t){this.destroyed||(_(t)&&(t=Ch.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(rm.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:o}=i,r=!(o>1)||this.join;let a,h,d,c,u,_=0,p=0;o>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<o;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:r}=h;n&&(d.swing=l(n)?n:2,u=2*d.swing-1),r&&(d.loop=u=l(r)?r:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,p+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,p+=s*u),o&&(d.easingFn=om.get(o))}if(!d.autoDuration&&n(d.duration)&&(o>1?s>0||r?p+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}p?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*p),this.allocateTime((this.duration-_)/p)):_&&this.changeDuration(_),this.emitType(rm.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:o,target:r}=this;for(let a in e)n(s[a])&&(s[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=n(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let o=0;o<s;o++)e=i[o],n(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(rm.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,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Wh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(rm.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return l(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};$t([nm("ease")],am.prototype,"easing",void 0),$t([nm(0)],am.prototype,"delay",void 0),$t([nm(.2)],am.prototype,"duration",void 0),$t([nm("auto")],am.prototype,"ending",void 0),$t([nm(!1)],am.prototype,"reverse",void 0),$t([nm(!1)],am.prototype,"swing",void 0),$t([nm(!1)],am.prototype,"loop",void 0),$t([nm(0)],am.prototype,"loopDelay",void 0),$t([nm(1)],am.prototype,"speed",void 0),$t([nm(!0)],am.prototype,"autoplay",void 0),$t([nm()],am.prototype,"join",void 0),$t([nm()],am.prototype,"attrs",void 0),am=$t([Pn(Jr)],am);let hm=class extends am{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new am(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(rm.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(rm.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(rm.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(rm.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case rm.COMPLETED:this.completed&&this.emitType(t);break;case rm.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)}};hm=$t([Pn(Jr)],hm);const lm={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"},dm=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,cm=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,um=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,_m=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,pm=parseInt,gm=parseFloat,{round:fm}=Math;let ym={},mm=0;function vm(t){let e,i,s,o=1;switch(t.length){case 9:e=pm(t.slice(1,3),16),i=pm(t.slice(3,5),16),s=pm(t.slice(5,7),16),o=pm(t.slice(7,9),16)/255;break;case 7:e=pm(t.slice(1,3),16),i=pm(t.slice(3,5),16),s=pm(t.slice(5,7),16);break;case 5:e=pm(t[1]+t[1],16),i=pm(t[2]+t[2],16),s=pm(t[3]+t[3],16),o=pm(t[4]+t[4],16)/255;break;case 4:e=pm(t[1]+t[1],16),i=pm(t[2]+t[2],16),s=pm(t[3]+t[3],16);break;case 3:e=i=s=pm(t[1]+t[2],16);break;case 2:e=i=s=pm(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const wm=1/6,xm=.5,bm=2/3,km=1/3;function Em(t,e,i){return i<0?i++:i>1&&i--,i<wm?t+6*(e-t)*i:i<xm?e:i<bm?t+(e-t)*(bm-i)*6:t}function Sm(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=Em(a,s,t+km),n=Em(a,s,t),r=Em(a,s,t-km)}return{r:fm(255*o),g:fm(255*n),b:fm(255*r),a:s}}Vt.add("color"),Th.object=function(t,e){let i,s=!n(e)&&e<1;if(a(t)){const e=ym[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=vm(t);break;case"R":case"r":"("===t[4]&&cm.test(t)?i=function(t){const e=cm.exec(t);return{r:pm(e[1]),g:pm(e[2]),b:pm(e[3]),a:gm(e[4])}}(t):"("===t[3]&&dm.test(t)&&(i=function(t){const e=dm.exec(t);return{r:pm(e[1]),g:pm(e[2]),b:pm(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&_m.test(t)?i=function(t){const e=_m.exec(t);return Sm(gm(e[1]),gm(e[2]),gm(e[3]),gm(e[4]))}(t):"("===t[3]&&um.test(t)&&(i=function(t){const e=um.exec(t);return Sm(gm(e[1]),gm(e[2]),gm(e[3]),1)}(t))}if(!i){const e=lm[t.toLowerCase()];e&&(i=vm("#"+e))}i&&(mm++,mm>1e4&&(ym={},mm=0),ym[t]=Object.assign({},i))}}else _(t)&&(n(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:Bm}=Math,{fourNumber:Rm}=b,Tm={fill:Am,stroke:Am,cornerRadius:(t,e,i)=>l(t)&&l(e)?Om(t,e,i):(t=Rm(t),e=Rm(e),t.map((t,s)=>Om(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,o=e.length,n=Om(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return l(t)||l(e)?b.float(Om(t,e,i),Math.max(Pm(t),Pm(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return Wh.setBetweenStyle(o,t,e,o,i,s),o},shadow:Mm,innerShadow:Mm},Cm={value:function(t,e,i){const s=l(t),o=l(e);return s&&o?t+(e-t)*i:o||s?Om(t,e,i):t},number:Om,color:Lm,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=Wh;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,o,n)))}};function Pm(t){const e=String(t).split(".")[1];return e?e.length:0}function Om(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?Bm(o):o}function Lm(t,e,i){t=Th.object(t),e=Th.object(e);const s=Om(t.r,e.r,i,1)+","+Om(t.g,e.g,i,1)+","+Om(t.b,e.b,i,1),o=Om(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function Am(t,e,i){return a(t)&&a(e)?Lm(t,e,i):e}function Mm(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Om((t=t||{}).x,e.x,i),y:Om(t.y,e.y,i),blur:Om(t.blur,e.blur,i),spread:Om(t.spread,e.spread,i),color:Lm(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),Ih.canAnimate=!0,Object.assign(Wh.list,Tm),Object.assign(Wh,Cm);const Dm=fl.prototype;fl.addAttr("animation",void 0,function(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),fl.addAttr("animationOut",void 0,qo),fl.addAttr("transition",!0,qo),fl.addAttr("transitionOut",void 0,qo),Dm.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))},Dm.animate=function(t,e,i,s){if(n(t))return this.__animate;let o=u(t)&&!e&&i?new hm(this,t,s):new am(this,t,e,s);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof hm?o.list.unshift(r):o=new hm(this,[r,o])),this.__animate=o},Dm.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof hm&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Dm.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(rm.COMPLETED,e)};const Fm=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Im=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Wm}=Math,{getDerivative:zm}=He,Nm={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,_,p,g=0,f=h/2;for(let h=0;h<Fm.length;h++)l=f*(1+Fm[h]),d=f*(1-Fm[h]),c=zm(l,t,i,o,r),u=zm(l,e,s,n,a),_=zm(d,t,i,o,r),p=zm(d,e,s,n,a),g+=Im[h]*(Wm(c*c+u*u)+Wm(_*_+p*p));return g*f},getRotation(t,e,i,s,o,n,r,a,h){const l=zm(t,e,s,n,a),d=zm(t,i,o,r,h);return Math.atan2(d,l)/E},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,_=t/e,p=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>p;)Ym(i,s,o,n,r,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,_=d*o+e*r,p=d*n+e*a,g=d*c+e*_,f=d*u+e*p,y=d*g+e*(d*_+e*(d*r+e*h)),m=d*f+e*(d*p+e*(d*a+e*l));t.push(fe.C,c,u,g,f,y,m)}},{getDistance:Ym}=Nm,{M:Xm,L:Hm,C:Vm,Z:jm}=fe,Um={},Gm={},Km={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Xm:case Hm:Km.transformPoints(t,e,s,1),s+=3;break;case Vm:Km.transformPoints(t,e,s,3),s+=7;break;case jm:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Um.x=t[o],Um.y=t[o+1],I.toOuterPoint(e,Um),t[o]=Um.x,t[o+1]=Um.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Xm:case Hm:i=t[a+1],s=t[a+2],e=o===Hm&&a>0?K.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Vm:i=t[a+5],s=t[a+6],e=Nm.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 jm:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=Ch.number(e,t.total);let n,r,a,h,l,d,c,u,_,p=0,g={},f=0,y=0,m=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Xm:case Hm:if(r=o[f+1],a=o[f+2],n=s[y],p+n>=e||!t.total)return f||(m=r,v=a),Gm.x=m,Gm.y=v,g.x=r,g.y=a,K.getDistancePoint(Gm,g,e-p,!0),g.rotation=K.getAngle(Gm,g),g;m=r,v=a,f+=3;break;case Vm:if(r=o[f+5],a=o[f+6],n=s[y],p+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],_=Nm.getT(e-p,n,m,v,l,d,c,u,r,a,i),He.getPointAndSet(_,m,v,l,d,c,u,r,a,g),g.rotation=Nm.getRotation(_,m,v,l,d,c,u,r,a),g;m=r,v=a,f+=7;break;case jm:f+=1;default:n=0}y++,p+=n}return g},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Ch.number(e,t.total);let r,a,h,l,d,c,u,_,p,g=0,f={},y=0,m=0,v=0,w=0;const x=o.length;for(;y<x;){switch(l=o[y],l){case Xm:case Hm:if(a=o[y+1],h=o[y+2],r=s[m],g+r>=e||!t.total)return y||(v=a,w=h),Gm.x=v,Gm.y=w,f.x=a,f.y=h,K.getDistancePoint(Gm,f,e-g,!0),n.push(l,f.x,f.y),n;v=a,w=h,y+=3,n.push(l,v,w);break;case Vm:if(d=o[y+1],c=o[y+2],u=o[y+3],_=o[y+4],a=o[y+5],h=o[y+6],r=s[m],g+r>=e)return p=Nm.getT(e-g,r,v,w,d,c,u,_,a,h,i),Nm.cut(n,p,v,w,d,c,u,_,a,h),n;v=a,w=h,y+=7,n.push(l,d,c,u,_,a,h);break;case jm:y+=1,n.push(l);default:r=0}m++,g+=r}return n}};function qm(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Wh.register("motion",function(t,e,i,s){return _(t)&&(t=Ch.number(t,s.getMotionTotal())),_(e)&&(e=Ch.number(e,s.getMotionTotal())),Wh.number(t||0,e||0,i)}),Wh.register("motionRotation",function(t,e,i){return Wh.number(t,e,i)});const Zm=fl.prototype,{updateMatrix:Jm,updateAllMatrix:Qm}=Vn,{updateBounds:$m}=ir;function tv(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=iv(t);i.total&&(t.__.__pathForRender=Km.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Qm(t),$m(t,t)):Jm(t));i&&(t.leafer.created=!0)}}function ev(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 iv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Km.getMotionPathData(t.getPath(!0,!0))}function sv(t,e){return Uo(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?Ih.setStyleName(this,e,i):Ih.set(this,i):this.__layout.stateStyleChanged=!0}}))}function ov(t){return Uo(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function nv(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 rv(t,e){_(e)||(e=void 0),lv(t,e,"in")}function av(t,e){const{normalStyle:i}=t;_(e)||(e=void 0),i&&(e||(e=i),lv(t,e,"out"))}fl.addAttr("motionPath",void 0,qm),fl.addAttr("motionPrecision",1,qm),fl.addAttr("motion",void 0,qm),fl.addAttr("motionRotation",!0,qm),Zm.getMotionPathData=function(){return iv(ev(this))},Zm.getMotionPoint=function(t){const e=ev(this),i=iv(e);if(!i.total)return{};const s=Km.getDistancePoint(i,t,e.motionPrecision);I.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:l(o)&&(s.rotation+=o),s},Zm.getMotionTotal=function(){return this.getMotionPathData().total},Zm.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),tv(t))}else tv(this)};const hv={};function lv(t,e,i){const{normalStyle:s}=t;e||(e=hv),e.scale&&(b.assignScale(e,e.scale),delete e.scale),e!==hv&&Ih.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=uv(e,t),s=t.animate();s&&uv(i,t,s.fromStyle);return i}(t,e):void 0;Ih.canAnimate&&dv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=dv(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=cv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=cv(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function dv(t){let e;const i={},s=nv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&Ih.isState(o,t,s)&&(e=_v(i,n));const r=i.selectedStyle||t.selectedStyle;r&&Ih.isSelected(t,s)&&(e=_v(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&Ih.isPlacehold(t,s)&&(e=_v(i,a)),Ih.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=_v(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&Ih.isFocus(t,s)&&(e=_v(i,o));const n=i.hoverStyle||t.hoverStyle;n&&Ih.isHover(t,s)&&(e=_v(i,n));const r=i.pressStyle||t.pressStyle;r&&Ih.isPress(t,s)&&(e=_v(i,r))}return e?i:void 0}function cv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&Ih.animateExcludes[t]||(o[t]=e[t]);return o}function uv(t,e,i){return cv(t,e,i,!0)}function _v(t,e){return Object.assign(t,e),!0}function pv(t,e){const i=t[e];i&&rv(t,i),t.button&&fv(t.children,e)}function gv(t,e,i){i||(i=t.states[e]),rv(t,i),t.button&&fv(t.children,null,e)}function fv(t,e,i){if(!t)return;let s,o;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(o=!0,e){case"hoverStyle":Ih.isHover(s)&&(o=!1);break;case"pressStyle":Ih.isPress(s)&&(o=!1);break;case"focusStyle":Ih.isFocus(s)&&(o=!1)}o&&pv(s,e)}else n(i)||gv(s,i);s.isBranch&&fv(s.children,e,i)}}function yv(t,e){const i=t[e];i&&av(t,i),t.button&&vv(t.children,e)}function mv(t,e,i){av(t,i),t.button&&vv(t.children,null,e)}function vv(t,e,i){if(!t)return;let s;for(let o=0,r=t.length;o<r;o++)s=t[o],e?yv(s,e):n(i)||mv(s,i),s.isBranch&&vv(s.children,e,i)}function wv(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=nv(e,i);n&&(s=o[t](n))}return s}function xv(t,e,i){let s=e[t];if(!s&&i){const o=nv(e,i);o&&(s=o[t])}return s}Vt.add("state"),Ih.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},Ih.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=nv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},Ih.isSelected=function(t,e){return xv("selected",t,e)},Ih.isDisabled=function(t,e){return xv("disabled",t,e)},Ih.isFocus=function(t,e){return wv("isFocus",t,e)},Ih.isHover=function(t,e){return wv("isHover",t,e)},Ih.isPress=function(t,e){return wv("isPress",t,e)},Ih.isPlacehold=function(t,e){return t.__.__isPlacehold},Ih.isDrag=function(t,e){return wv("isDrag",t,e)},Ih.setStyleName=function(t,e,i){i?gv(t,e,t[e]):mv(t,e,t[e])},Ih.set=function(t,e){const i=t.states[e];i?gv(t,e,i):mv(t,e,i)},Ih.getStyle=dv,Ih.updateStyle=lv,Ih.updateEventStyle=function(t,e){switch(e){case md.ENTER:pv(t,"hoverStyle");break;case md.LEAVE:yv(t,"hoverStyle");break;case md.DOWN:pv(t,"pressStyle");break;case md.UP:yv(t,"pressStyle")}};const bv=fl.prototype;fl.addAttr("selected",!1,sv,"selectedStyle"),fl.addAttr("disabled",!1,sv,"disabledStyle"),fl.addAttr("states",{},ov),fl.addAttr("state","",sv),fl.addAttr("normalStyle",void 0,qo),fl.addAttr("hoverStyle",void 0,ov),fl.addAttr("pressStyle",void 0,ov),fl.addAttr("focusStyle",void 0,ov),fl.addAttr("selectedStyle",void 0,ov),fl.addAttr("disabledStyle",void 0,ov),fl.addAttr("placeholderStyle",void 0,ov),fl.addAttr("button",!1,qo),bv.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?pv(this,"focusStyle"):yv(this,"focusStyle")})},bv.updateState=function(){Ih.updateStyle(this,void 0,"in")};const kv=dd.prototype,Ev="text";Ho(kv,Ev,Object.assign(Object.assign({},Vo(kv,Ev)),{set(t){const e=this,i=e.text;e.__setAttr(Ev,t)&&(on(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Sv extends jh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Bv=class extends fl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!n(t))if(l(t))this.now=t;else if(_(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Fo.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:o,size:n,total:r}=e,{width:a,height:h}=n&&(l(n)?{width:n,height:n}:n)||(r>1?this:t);let d=o?o.x:0,c=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new br(br.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:o}=this;o&&(o.FPS&&(i=o.FPS),n(o.loop)||(s=o.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:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};$t([xn(Sv)],Bv.prototype,"__",void 0),$t([en()],Bv.prototype,"robot",void 0),$t([qo()],Bv.prototype,"actions",void 0),$t([qo("")],Bv.prototype,"action",void 0),$t([cn(0)],Bv.prototype,"now",void 0),$t([qo(12)],Bv.prototype,"FPS",void 0),$t([qo(!0)],Bv.prototype,"loop",void 0),Bv=$t([On()],Bv),Vt.add("robot");const{Yes:Rv,NoAndSkip:Tv,YesAndSkip:Cv}=s,Pv={},Ov={},Lv={};class Av{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 o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":Pv.id=t.substring(1),t=Pv;break;case".":Ov.className=t.substring(1),t=Ov;break;default:Lv.tag=t,t=Lv}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,o=u(s);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Vn.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 o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===Rv||n===Cv){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<Tv&&this.eachFind(o.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(mr.REMOVE,this.__onRemoveChild,this),this.target.on_(wr.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const Mv=fl.prototype;function Dv(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=jt.selector())}Mv.find=function(t,e){return Dv(this).getBy(t,this,!1,e)},Mv.findOne=function(t,e){return Dv(this).getBy(t,this,!0,e)},Vt.add("find"),jt.finder=function(t){return new Av(t)};const{setPoint:Fv,addPoint:Iv,toBounds:Wv}=st;const zv={syncExport(e,i,s){let o;Fh.running=!0;try{const r=To.fileType(i),a=i.includes(".");s=To.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===r)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),o={data:!!a||e.toJSON(s.json)};else if("svg"===r)a&&l(h(e.toSVG(),"svg"),i),o={data:!!a||e.toSVG()};else{let t,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=e,{slice:_,clip:p,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=n(s.smooth)?!c||c.config.smooth:s.smooth,w=s.contextSettings||(c?c.config.contextSettings:void 0),x=d&&f&&n(s.fill)?e.fill:s.fill,k=To.isOpaqueImage(i)||x,E=new et;if(f)t=!0===f?d?c.canvas.bounds:e.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":E.set(l);break;case"local":E.set(l).divide(e.localTransform),a/=e.scaleX,h/=e.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||e;default:E.set(l).divide(e.getTransform(i));const t=i.worldTransform;a/=a/t.scaleX,h/=h/t.scaleY}t=e.getBounds("render",i)}const S={scaleX:1,scaleY:1};b.getScaleData(s.scale,s.size,t,S);let B=s.pixelRatio||1,{x:R,y:T,width:C,height:P}=new Lt(t).scale(S.scaleX,S.scaleY);p&&(R+=p.x,T+=p.y,C=p.width,P=p.height);const O={exporting:!0,matrix:E.scale(1/S.scaleX,1/S.scaleY).invert().translate(-R,-T).withScale(1/a*S.scaleX,1/h*S.scaleY)};let L,A=jt.canvas({width:Math.floor(C),height:Math.floor(P),pixelRatio:B,smooth:v,contextSettings:w});if(_&&(L=e,L.__worldOpacity=0,e=c||e,O.bounds=A.bounds),A.save(),u&&!n(x)){const t=e.get("fill");e.fill="",e.__render(A,O),e.fill=t}else e.__render(A,O);if(A.restore(),L&&L.__updateWorldOpacity(),g){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?Iv(r,o,n):Fv(r={},o,n)),a++;const h=new Lt;return r&&(Wv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=jt.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(y){const[t,e,i,s]=b.fourNumber(y),o=A,{width:n,height:r}=o;A=jt.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}k&&A.fillWorld(A.bounds,x||"#FFFFFF","destination-over"),m&&m(A);o={data:"canvas"===i?A:A.export(i,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:t,trimBounds:r}}}catch(t){o={data:"",error:t}}return Fh.running=!1,o},export(e,i,s){return Fh.running=!0,function(t){Nv||(Nv=new Lo);return new Promise(e=>{Nv.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(o=>new Promise(n=>{const r=()=>te(this,void 0,void 0,function*(){if(!Mo.isComplete)return t.requestRender(r);const a=Fh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()});e.updateLayout(),Yv(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))}};let Nv;function Yv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Yv(t))}const Xv=_e.prototype,Hv=It.get("@leafer-in/export");Xv.export=function(t,e){const{quality:i,blob:s}=To.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Xv.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{Hv.error(t),s(null)})})},Xv.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Xv.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{Hv.error(t),s(!1)})})},Vt.add("export"),Object.assign(Fh,zv),fl.prototype.export=function(t,e){return Fh.export(this,t,e)},fl.prototype.syncExport=function(t,e){return Fh.syncExport(this,t,e)},Vt.add("filter"),Object.assign(Dh,{list:{},register(t,e){Dh.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach(t=>{r=Dh.list[t.type],r&&r.apply(t,e,i,s,o,n)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Dh.list[t.type],e&&(i+=e.getSpread(t))}),i}});export{ct as AlignHelper,am as Animate,om as AnimateEasing,rm as AnimateEvent,hm as AnimateList,s as Answer,_d as App,ht as AroundHelper,df as Arrow,hf as ArrowData,Mt as AutoBounds,He as BezierHelper,Lt as Bounds,kr as BoundsEvent,Tt as BoundsHelper,Rl as Box,Kh as BoxData,Qa as Branch,ir as BranchHelper,ya as BranchRender,nd as Canvas,al as CanvasData,Qt as CanvasManager,mr as ChildEvent,Th as ColorConvert,jt as Creator,Ud as Cursor,f as DataHelper,It as Debug,nt as Direction4,rt as Direction9,ll as DragBoundsHelper,xd as DragEvent,Dd as Dragger,kd as DropEvent,Cp as EditBox,xp as EditDataHelper,Bp as EditPoint,lp as EditSelect,np as EditSelectHelper,sg as EditTool,Xp as EditToolCreator,eg as Editor,K_ as EditorEvent,jp as EditorGroupEvent,Wp as EditorHelper,Zp as EditorMoveEvent,Qp as EditorRotateEvent,Jp as EditorScaleEvent,$p as EditorSkewEvent,Mh as Effect,Ll as Ellipse,$h as EllipseData,Qe as EllipseHelper,yr as Event,Zt as EventCreator,Nr as Eventer,Fh as Export,To as FileHelper,Dh as Filter,Av as Finder,ly as Flow,Tl as Frame,Zh as FrameData,yl as Group,Gh as GroupData,Nm as HighBezierHelper,Km as HighCurveHelper,Gd as HitCanvasManager,sd as Image,rl as ImageData,br as ImageEvent,Fo as ImageManager,e as IncrementId,ig as InnerEditor,Vp as InnerEditorEvent,lc as Interaction,jd as InteractionBase,Cd as InteractionHelper,Td as KeyEvent,gd as Keyboard,Or as LayoutEvent,yh as Layouter,Xa as Leaf,pa as LeafBounds,Qn as LeafBoundsHelper,m as LeafData,$r as LeafDataProxy,Jr as LeafEventer,Vn as LeafHelper,fr as LeafLayout,th as LeafLevelList,$a as LeafList,ra as LeafMatrix,ga as LeafRender,wl as Leafer,ih as LeaferCanvas,_e as LeaferCanvasBase,qh as LeaferData,Ar as LeaferEvent,Xo as LeaferImage,Yg as LeaferTypeCreator,Nl as Line,Jh as LineData,lg as LineEditTool,b as MathHelper,et as Matrix,I as MatrixHelper,Ed as MoveEvent,Vg as MultiTouchHelper,bd as MyDragEvent,od as MyImage,vd as MyPointerEvent,me as NeedConvertToCanvasCommandMap,E as OneRadian,S as PI2,B as PI_2,Oh as Paint,Ah as PaintGradient,Lh as PaintImage,cd as Path,Ph as PathArrow,ry as PathArrowModule,fo as PathBounds,ns as PathCommandDataHelper,fe as PathCommandMap,Fi as PathConvert,ko as PathCorner,bs as PathCreator,il as PathData,Is as PathDrawer,pe as PathHelper,wf as PathMatrixHelper,be as PathNumberCommandLengthMap,xe as PathNumberCommandMap,kg as PathScaler,ud as Pen,sl as PenData,xh as Picker,t as Platform,Vt as Plugin,$ as Point,K as PointHelper,fd as PointerButton,md as PointerEvent,ql as Polygon,tl as PolygonData,wr as PropertyEvent,xl as Rect,Qh as RectData,ke as RectHelper,pl as RectRender,Lr as RenderEvent,vh as Renderer,Cr as ResizeEvent,Mo as Resource,Bv as Robot,Sv as RobotData,Sd as RotateEvent,Yt as Run,af as ScrollBar,op as SelectArea,bh as Selector,id as Star,el as StarData,Ih as State,Dt as StringNumberMap,sp as Stroker,Bd as SwipeEvent,Oo as TaskItem,Lo as TaskProcessor,dd as Text,Rh as TextConvert,nl as TextData,tg as TransformTool,Zg as Transformer,Wh as Transition,st as TwoPointBoundsHelper,fl as UI,hl as UIBounds,Gt as UICreator,jh as UIData,yd as UIEvent,ul as UIRender,Ch as UnitConvert,rr as WaitHelper,Pr as WatchEvent,rh as Watcher,qg as WheelEventHelper,Rd as ZoomEvent,Wg as addViewport,zg as addViewportConfig,dn as affectRenderBoundsType,an as affectStrokeBoundsType,lf as arrowType,Go as attr,Qo as autoLayoutType,en as boundsType,Ro as canvasPatch,ue as canvasSizeAttrs,Bh as createAttr,jo as createDescriptor,wn as cursorType,xn as dataProcessor,qo as dataType,Uo as decorateLeafAttr,kn as defineDataProcessor,Ho as defineKey,Ko as defineLeafAttr,on as doBoundsType,hn as doStrokeType,kh as effectType,o as emptyData,mn as eraserType,xr as extraPropertyEventMap,T as getBoundsData,Vo as getDescriptor,C as getMatrixData,R as getPointData,vn as hitType,u as isArray,p as isData,g as isEmptyData,h as isFinite,r as isNull,l as isNumber,_ as isObject,a as isString,n as isUndefined,bn as layoutProcessor,Wr as leaferTransformAttrMap,yn as maskType,qm as motionPathType,sn as naturalBoundsType,un as opacityType,Eo as path,nn as pathInputType,rn as pathType,So as pen,Zo as positionType,Np as registerEditTool,Yp as registerInnerEditor,On as registerUI,Ln as registerUIEvent,Eh as resizeType,Rn as rewrite,Tn as rewriteAble,tn as rotationType,Lg as scaleResize,Ag as scaleResizeFontSize,Fg as scaleResizeGroup,Mg as scaleResizePath,Dg as scaleResizePoints,$o as scaleType,Jo as scrollType,fn as sortType,ov as stateStyleType,sv as stateType,ln as strokeType,cn as surfaceType,At as tempBounds,it as tempMatrix,tt as tempPoint,c as tryToNumber,nh as useCanvas,Pn as useModule,eh as version,_n as visibleType,Sh as zoomLayerType};
1
+ const t={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(e){const{prefix:i,suffix:s}=t.image;return!s||e.startsWith("data:")||e.startsWith("blob:")||(e+=(e.includes("?")?"&":"?")+s),i&&"/"===e[0]&&(e=i+e),e}}},e={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=e;var s;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(s||(s={}));const o={};function n(t){return void 0===t}function r(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;function c(t){return"string"==typeof t&&d.test(t)?+t:t}const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function g(t){return _(t)&&!u(t)}function p(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(m(e,t),m(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return m(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&m(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{n(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:m}=f;class y{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!n(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]=n(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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let o in this)if("_"!==o[0]&&(t=this["_"+o],!n(t))){if("path"===o&&!this.__pathInputed)continue;e=s?s[o]:void 0,i[o]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:v,pow:w,PI:x}=Math,b={within:(t,e,i)=>(_(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(u(t))switch(t.length){case 4:i=n(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),b.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=n(e)?1e12:w(10,e);return-0===(t=v(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(l(e)?e:e.width||0)/i.width,o=(l(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&b.assignScale(s,t);return s},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:k,randColor:t=>`rgba(${k(255)},${k(255)},${k(255)},${t||1})`};function k(t){return Math.round(Math.random()*t)}const E=x/180,S=2*x,B=x/2;function T(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:O,cos:P,acos:L,sqrt:A}=Math,{float:M}=b,D={};function F(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const I={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:F(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:C,getWorld:F,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},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){W.toInnerPoint(t,e,D),W.scaleOfInner(t,D,i,s)},scaleOfInner(t,e,i,s=i){W.translateInner(t,e.x,e.y),W.scale(t,i,s),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=P(e*=E),a=O(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){W.toInnerPoint(t,e,D),W.rotateOfInner(t,D,i)},rotateOfInner(t,e,i){W.translateInner(t,e.x,e.y),W.rotate(t,i),W.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=E,t.a=s+n*i,t.b=o+r*i),e&&(e*=E,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){W.toInnerPoint(t,e,D),W.skewOfInner(t,D,i,s)},skewOfInner(t,e,i,s=0){W.translateInner(t,e.x,e.y),W.skew(t,i,s),W.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,s,o){const{e:r,f:a}=t;if(i||(i=t),n(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:r,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,o&&(i.scaleX=e.scaleX*o.scaleX,i.scaleY=e.scaleY*o.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,o&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,s,o){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(n(o)&&(o=e.rotation||e.skewX||e.skewY),o){const{rotation:i,skewX:s,skewY:o}=e,n=i*E,r=P(n),a=O(n);if(s||o){const e=s*E,i=o*E;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&W.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,_,g,p=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=A(o*o+n*n),c=t/d;const e=o/d;u=n>0?L(e):-L(e)}else{c=A(r*r+a*a),d=t/c;const e=r/c;u=B-(a>0?L(-e):-L(e))}const e=M(P(u)),i=O(u);d=M(d),c=M(c),_=e?M((r/c+i)/e/E,9):0,g=e?M((n/d-i)/e/E,9):0,u=M(u/E)}else d=o,c=a,u=_=g=0;return(e=i||e)&&(p+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:g}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=A(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){W.set(t)}},W=I,{toInnerPoint:z,toOuterPoint:N}=I,{sin:Y,cos:X,abs:H,sqrt:V,atan2:j,min:U,round:G}=Math,K={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=n(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(t.y)},move(t,e,i){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=q.defaultPoint);const s=X(e*=E),o=Y(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=q;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=q;return J(i,t),N(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=q;return J(i,t),q.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){z(e,t,i)},toOuterOf(t,e,i){N(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>Z(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=H(i-t),n=H(s-e);return V(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>U(Z(t,e,i,s),Z(i,s,o,n)),getAngle:(t,e)=>Q(t,e)/E,getRotation:(t,e,i,s)=>(s||(s=e),q.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/E),getRadianFrom(t,e,i,s,o,r,a,h){n(a)&&(a=i,h=s);const l=t-i,d=e-s,c=o-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>j(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const o=Q(t,e);return(e=s?e:{}).x=t.x+X(o)*i,e.y=t.y+Y(o)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){q.reset(t)}},q=K,{getDistanceFrom:Z,copy:J,getAtan2:Q}=q;class ${constructor(t,e){this.set(t,e)}set(t,e){return _(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new $(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new $(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new $(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new $;class et{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return _(t)?I.copy(this,t):I.set(this,t,e,i,s,o,n),this}setWith(t){return I.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new et(this)}translate(t,e){return I.translate(this,t,e),this}translateInner(t,e){return I.translateInner(this,t,e),this}scale(t,e){return I.scale(this,t,e),this}scaleWith(t,e){return I.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return I.pixelScale(this,t),this}scaleOfOuter(t,e,i){return I.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return I.scaleOfInner(this,t,e,i),this}rotate(t){return I.rotate(this,t),this}rotateOfOuter(t,e){return I.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return I.rotateOfInner(this,t,e),this}skew(t,e){return I.skew(this,t,e),this}skewOfOuter(t,e,i){return I.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return I.skewOfInner(this,t,e,i),this}multiply(t){return I.multiply(this,t),this}multiplyParent(t){return I.multiplyParent(this,t),this}divide(t){return I.divide(this,t),this}divideParent(t){return I.divideParent(this,t),this}invert(){return I.invert(this),this}invertWith(){return I.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){I.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){I.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return I.setLayout(this,t,e,i),this}getLayout(t,e,i){return I.getLayout(this,t,e,i)}withScale(t,e){return I.withScale(this,t,e)}reset(){I.reset(this)}}const it=new et,st={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,o){ot(t,e,i),ot(t,e+s,i+o)},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}=st;var nt,rt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(nt||(nt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(rt||(rt={}));const at=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,i,s,o,n){const r=lt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),ht.toPoint(t,e,i,!0),i)};function lt(t){return a(t)?at[rt[t]]:t}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,o,n){dt(t,i,s,o,e,n)}},{tempPointBounds:ut,setPoint:_t,addPoint:gt,toBounds:pt}=st,{toOuterPoint:ft}=I,{float:mt,fourNumber:yt}=b,{floor:vt,ceil:wt}=Math;let xt,bt,kt,Et;const St={},Bt={},Tt={},Rt={tempBounds:Tt,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(u(i)){const e=yt(i);s?Ct.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Ct.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Ct.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Pt(e,t):e=t,i?(e.offsetX=-(Ct.maxX(i)-t.x),e.offsetY=-(Ct.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||K.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){K.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Ct.copy(Tt,t),Ct.toOuterOf(Tt,e),Tt),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o}=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),o>0?(i.height=t.height*o,i.y=e.f+t.y*o):(i.height=t.height*-o,i.y=e.f+t.y*o-i.height)}else St.x=t.x,St.y=t.y,ft(e,St,Bt),_t(ut,Bt.x,Bt.y),St.x=t.x+t.width,ft(e,St,Bt),gt(ut,Bt.x,Bt.y),St.y=t.y+t.height,ft(e,St,Bt),gt(ut,Bt.x,Bt.y),St.x=t.x,ft(e,St,Bt),gt(ut,Bt.x,Bt.y),pt(ut,i)},toInnerOf(t,e,i){i||(i=t),Ct.move(i,-e.e,-e.f),Ct.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Ct.getFitScale(t,e));return new et(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,n){n||(n=e),a(s)&&(s=Ct.getFitScale(t,e,"cover"===s)),Tt.width=o?e.width*=s:e.width*s,Tt.height=o?e.height*=s:e.height*s,ct.toPoint(i,Tt,t,n,!0,!0)},getSpread(t,e,i){const s={};return Ct.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Ct.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Ct.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?wt(t.width+e-t.x):wt(t.width),t.height=i>t.y?wt(t.height+i-t.y):wt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=mt(t.x,e),t.y=mt(t.y,e),t.width=mt(t.width,e),t.height=mt(t.height,e)},add(t,e,i){xt=t.x+t.width,bt=t.y+t.height,kt=e.x,Et=e.y,i||(kt+=e.width,Et+=e.height),xt=xt>kt?xt:kt,bt=bt>Et?bt:Et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=bt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Ct.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Ct.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Pt(t,o)):Ot(t,o));n&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?_t(ut,t.x,t.y):gt(ut,t.x,t.y)),pt(ut,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Ot(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=K.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=K.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Ct.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Ct.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Ct.tempToOuterOf(e,i)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return xt=s+n,bt=o+r,kt=t.x+t.width,Et=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,xt=xt<kt?xt:kt,bt=bt<Et?bt:Et,n=xt-s,r=bt-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){Ct.copy(t,Ct.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Ct.set(t)}},Ct=Rt,{add:Ot,copy:Pt}=Ct;class Lt{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 _(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 Lt(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 Lt(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const At=new Lt;class Mt{constructor(t,e,i,s,o,n){_(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Lt(o,e,n||t.width-o-i,r||t.height-e-s)}}const Dt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Ft}=b;class It{constructor(t){this.repeatMap={},this.name=t}static get(t){return new It(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const i=Ft();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===It.showBounds,o=t.__nowWorld,n=Ft();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(zt.enable){if(zt.filterList.length&&zt.filterList.every(t=>t!==this.name))return;if(zt.excludeList.length&&zt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){zt.enable&&this.warn(...t)}warn(...t){zt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Wt(t){return t?a(t)&&(t=[t]):t=[],t}It.filterList=[],It.excludeList=[],It.showWarn=!0;const zt=It,Nt=It.get("RunTime"),Yt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,i){const s=e.create(e.RUNTIME);return Xt.currentId=Xt.idMap[s]=i?performance.now():Date.now(),Xt.currentName=Xt.nameMap[s]=t,Xt.nameToIdMap[t]=s,s},end(t,e){const i=Xt.idMap[t],s=Xt.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;Xt.idMap[t]=Xt.nameMap[t]=Xt.nameToIdMap[s]=void 0,Nt.log(s,o,"ms")},endOfName(t,e){const i=Xt.nameToIdMap[t];n(i)||Xt.end(i,e)}},Xt=Yt,Ht=[],Vt={list:{},add(t,...e){this.list[t]=!0,Ht.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(()=>Ht.forEach(t=>Vt.has(t,!0)));const jt={editor:t=>Vt.need("editor")},Ut=It.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&Ut.repeat(e),Kt[e]=t},get(t,e,i,s,o,r){Kt[t]||Ut.error("not register "+t);const a=new Kt[t](e);return n(i)||(a.x=i,s&&(a.y=s),o&&(a.width=o),r&&(a.height=r)),a}},{list:Kt}=Gt,qt=It.get("EventCreator"),Zt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],a(e)&&(Jt[e]&&qt.repeat(e),Jt[e]=t)})},changeName(t,e){const i=Jt[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,Jt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Jt[t](...e)},{nameList:Jt}=Zt;class 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,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=jt.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function $t(t,e,i,s){var o,n=arguments.length,r=n<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--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function te(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function ee(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ie=[];function se(){return(t,e)=>{ie.push(e)}}const oe=[];let ne=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||oe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};$t([ee("imageSmoothingEnabled")],ne.prototype,"smooth",void 0),$t([ee("imageSmoothingQuality")],ne.prototype,"smoothLevel",void 0),$t([ee("globalAlpha")],ne.prototype,"opacity",void 0),$t([ee()],ne.prototype,"fillStyle",void 0),$t([ee()],ne.prototype,"strokeStyle",void 0),$t([ee("lineWidth")],ne.prototype,"strokeWidth",void 0),$t([ee("lineCap")],ne.prototype,"strokeCap",void 0),$t([ee("lineJoin")],ne.prototype,"strokeJoin",void 0),$t([ee("lineDashOffset")],ne.prototype,"dashOffset",void 0),$t([ee()],ne.prototype,"miterLimit",void 0),$t([ee()],ne.prototype,"shadowBlur",void 0),$t([ee()],ne.prototype,"shadowColor",void 0),$t([ee()],ne.prototype,"shadowOffsetX",void 0),$t([ee()],ne.prototype,"shadowOffsetY",void 0),$t([ee()],ne.prototype,"filter",void 0),$t([ee()],ne.prototype,"font",void 0),$t([ee()],ne.prototype,"fontKerning",void 0),$t([ee()],ne.prototype,"fontStretch",void 0),$t([ee()],ne.prototype,"fontVariantCaps",void 0),$t([ee()],ne.prototype,"textAlign",void 0),$t([ee()],ne.prototype,"textBaseline",void 0),$t([ee()],ne.prototype,"textRendering",void 0),$t([ee()],ne.prototype,"wordSpacing",void 0),$t([ee()],ne.prototype,"letterSpacing",void 0),$t([ee()],ne.prototype,"direction",void 0),$t([se()],ne.prototype,"setTransform",null),$t([se()],ne.prototype,"resetTransform",null),$t([se()],ne.prototype,"getTransform",null),$t([se()],ne.prototype,"save",null),$t([se()],ne.prototype,"restore",null),$t([se()],ne.prototype,"translate",null),$t([se()],ne.prototype,"scale",null),$t([se()],ne.prototype,"rotate",null),$t([se()],ne.prototype,"fill",null),$t([se()],ne.prototype,"stroke",null),$t([se()],ne.prototype,"clip",null),$t([se()],ne.prototype,"fillRect",null),$t([se()],ne.prototype,"strokeRect",null),$t([se()],ne.prototype,"clearRect",null),$t([se()],ne.prototype,"beginPath",null),$t([se()],ne.prototype,"moveTo",null),$t([se()],ne.prototype,"lineTo",null),$t([se()],ne.prototype,"bezierCurveTo",null),$t([se()],ne.prototype,"quadraticCurveTo",null),$t([se()],ne.prototype,"closePath",null),$t([se()],ne.prototype,"arc",null),$t([se()],ne.prototype,"arcTo",null),$t([se()],ne.prototype,"ellipse",null),$t([se()],ne.prototype,"rect",null),$t([se()],ne.prototype,"roundRect",null),$t([se()],ne.prototype,"createConicGradient",null),$t([se()],ne.prototype,"createLinearGradient",null),$t([se()],ne.prototype,"createPattern",null),$t([se()],ne.prototype,"createRadialGradient",null),$t([se()],ne.prototype,"fillText",null),$t([se()],ne.prototype,"measureText",null),$t([se()],ne.prototype,"strokeText",null);const{copy:re,multiplyParent:ae,pixelScale:he}=I,{round:le}=Math,de=new Lt,ce=new Lt,ue={width:1,height:1,pixelRatio:1},_e=["width","height","pixelRatio"];class ge extends ne{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(i,s){super(),this.size={},this.worldTransform={},i||(i=ue),this.manager=s,this.innerId=e.create(e.CNAVAS);const{width:o,height:n,pixelRatio:r}=i;this.autoLayout=!o||!n,this.size.pixelRatio=r||t.devicePixelRatio,this.config=i,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,_e),_e.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&ae(t,e,o),he(t,i,o),s&&(t.half&&t.half*i%2?(o.e=le(o.e-.5)+.5,o.f=le(o.f-.5)+.5):(o.e=le(o.e),o.f=le(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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:o,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),n(e.dashPattern)||(o=e.dashPattern),n(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=o,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),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,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Rt.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),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,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(de.x,de.y,de.width,de.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,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,o=this.manager?this.manager.get(i):jt.canvas(Object.assign({},i));return o.save(),t&&(re(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},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 ke={};for(let t in xe)ke[xe[t]]=ye[t];const Ee={drawRoundRect(t,e,i,s,o,n){const r=b.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;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:Re,ceil:Ce,abs:Oe,PI:Pe,sqrt:Le,pow:Ae}=Math,{setPoint:Me,addPoint:De}=st,{set:Fe,toNumberPoints:Ie}=K,{M:We,L:ze,C:Ne,Q:Ye,Z:Xe}=me,He={},Ve={points(t,e,i,s){let o=Ie(e);if(t.push(We,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,_,g,p,f,m=o.length;const y=!0===i?.5:i;s&&(o=[o[m-2],o[m-1],...o,o[0],o[1],o[2],o[3]],m=o.length);for(let i=2;i<m-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],g=Le(Ae(r-e,2)+Ae(a-n,2)),p=Le(Ae(h-r,2)+Ae(l-a,2)),(g||p)&&(f=g+p,g=y*g/f,p=y*p/f,h-=e,l-=n,d=r-g*h,c=a-g*l,2===i?s||t.push(Ye,d,c,r,a):t.push(Ne,u,_,d,c,r,a),u=r+p*h,_=a+p*l);s||t.push(Ye,u,_,o[m-2],o[m-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(ze,o[e],o[e+1]);s&&t.push(Xe)},rect(t,e,i,s,o){pe.creator.path=t,pe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){pe.creator.path=[],Ee.drawRoundRect(pe.creator,e,i,s,o,n),t.push(...pe.convertToCanvasData(pe.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,_=n-s,g=r-o;let p=Re(u,c),f=Re(g,_);const m=Te(c,u),y=Te(_,g);let v=f-p;if(v<0&&(v+=S),m<1e-12||y<1e-12||v<1e-12||Oe(v-Pe)<1e-12)return t&&t.push(ze,s,o),h&&(Me(h,e,i),De(h,s,o)),d&&Fe(d,e,i),void(l&&Fe(l,s,o));const w=c*g-_*u<0,x=w?-1:1,b=a/Be(v/2),k=s+b*Be(p+v/2+B*x),T=o+b*Se(p+v/2+B*x);return p-=B*x,f-=B*x,Ge(t,k,T,a,a,0,p/E,f/E,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>Ge(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*E,_=Se(u),g=Be(u);let p=r*E,f=a*E;p>Pe&&(p-=S),f<0&&(f+=S);let m=f-p;m<0?m+=S:m>S&&(m-=S),h&&(m-=S);const y=Ce(Oe(m/B)),v=m/y,w=Se(v/4),x=8/3*w*w/Se(v/2);f=p+v;let b,k,T,R,C,O,P,L,A=Be(p),M=Se(p),D=T=g*s*A-_*o*M,F=R=_*s*A+g*o*M,I=e+T,W=i+R;t&&t.push(t.length?ze:We,I,W),l&&Me(l,I,W),c&&Fe(c,I,W);for(let n=0;n<y;n++)b=Be(f),k=Se(f),T=g*s*b-_*o*k,R=_*s*b+g*o*k,C=e+D-x*(g*s*M+_*o*A),O=i+F-x*(_*s*M-g*o*A),P=e+T+x*(g*s*k+_*o*b),L=i+R+x*(_*s*k-g*o*b),t&&t.push(Ne,C,O,P,L,e+T,i+R),l&&Ue(e+D,i+F,C,O,P,L,e+T,i+R,l,!0),D=T,F=R,A=b,M=k,p=f,f+=v;d&&Fe(d,e+T,i+R)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(Ne,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){Ue(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,_,g,p,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-_/u,0<g&&g<1&&d.push(g)}else m=u*u-4*_*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?De(h,t,e):Me(h,t,e),De(h,r,a);for(let l=0,c=d.length;l<c;l++)je(d[l],t,e,i,s,o,n,r,a,He),De(h,He.x,He.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,g=t*t*t;l.x=c*e+u*s+_*n+g*a,l.y=c*i+u*o+_*r+g*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return je(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:je,toTwoPointBounds:Ue,ellipse:Ge}=Ve,{sin:Ke,cos:qe,sqrt:Ze,atan2:Je}=Math,{ellipse:Qe}=Ve,$e={ellipticalArc(e,i,s,o,n,r,a,h,l,d,c){const u=(l-i)/2,_=(d-s)/2,g=r*E,p=Ke(g),f=qe(g),m=-f*u-p*_,y=-f*_+p*u,v=o*o,w=n*n,x=y*y,b=m*m,k=v*w-v*x-w*b;let B=0;if(k<0){const t=Ze(1-k/(v*w));o*=t,n*=t}else B=(a===h?-1:1)*Ze(k/(v*x+w*b));const T=B*o*y/n,R=-B*n*m/o,C=Je((y-R)/n,(m-T)/o),O=Je((-y-R)/n,(-m-T)/o);let P=O-C;0===h&&P>0?P-=S:1===h&&P<0&&(P+=S);const L=i+u+f*T-p*R,A=s+_+p*T+f*R,M=P<0?1:0;c||t.ellipseToCurve?Qe(e,L,A,o,n,r,C/E,O/E,M):o!==n||r?e.push(me.G,L,A,o,n,r,C/E,O/E,M):e.push(me.O,L,A,o,C/E,O/E,M)}},{M:ti,m:ei,L:ii,l:si,H:oi,h:ni,V:ri,v:ai,C:hi,c:li,S:di,s:ci,Q:ui,q:_i,T:gi,t:pi,A:fi,a:mi,Z:yi,z:vi,N:wi,D:xi,X:bi,G:ki,F:Ei,O:Si,P:Bi,U:Ti}=me,{rect:Ri,roundRect:Ci,arcTo:Oi,arc:Pi,ellipse:Li,quadraticCurveTo:Ai}=Ve,{ellipticalArc:Mi}=$e,Di=It.get("PathConvert"),Fi={},Ii={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=ke[s],a+=s===o?" ":be[s];for(let s=1;s<i;s++)a+=b.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?we:ve;for(let e=0,h=t.length;e<h;e++)s=t[e],Dt[s]?("."===s&&(Wi.dot&&(zi(r,n),n=""),Wi.dot++),"0"===n&&"."!==s&&(zi(r,n),n=""),n+=s):me[s]?(n&&(zi(r,n),n=""),Wi.name=me[s],Wi.length=ye[s],Wi.index=0,zi(r,Wi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&zi(r,n),n=s):n&&(zi(r,n),n=""),o=s;return n&&zi(r,n),i?Ii.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(o=t[c],o){case ei:t[c+1]+=a,t[c+2]+=h;case ti:a=t[c+1],h=t[c+2],_.push(ti,a,h),c+=3;break;case ni:t[c+1]+=a;case oi:a=t[c+1],_.push(ii,a,h),c+=2;break;case ai:t[c+1]+=h;case ri:h=t[c+1],_.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],_.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,o=di;case di:r=n===hi||n===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],_.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,o=hi;case hi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(hi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case pi:t[c+1]+=a,t[c+2]+=h,o=gi;case gi:r=n===ui||n===gi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Ai(_,a,h,i,s,t[c+1],t[c+2]):_.push(ui,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case _i:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=ui;case ui:i=t[c+1],s=t[c+2],e?Ai(_,a,h,i,s,t[c+3],t[c+4]):_.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:Mi(_,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:_.push(yi),c++;break;case wi:a=t[c+1],h=t[c+2],e?Ri(_,a,h,t[c+3],t[c+4]):Ni(_,t,c,5),c+=5;break;case xi:a=t[c+1],h=t[c+2],e?Ci(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ni(_,t,c,9),c+=9;break;case bi:a=t[c+1],h=t[c+2],e?Ci(_,a,h,t[c+3],t[c+4],t[c+5]):Ni(_,t,c,6),c+=6;break;case ki:Li(e?_:Ni(_,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 Ei:e?Li(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ni(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Si:Pi(e?_:Ni(_,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 Bi:e?Pi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ni(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ti:Oi(e?_:Ni(_,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 Di.error(`command: ${o} [index:${c}]`,t),_}n=o}return _},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 o=i,n=i+s;o<n;o++)t.push(e[o])},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:zi,copyData:Ni}=Ii,{M:Yi,L:Xi,C:Hi,Q:Vi,Z:ji,N:Ui,D:Gi,X:Ki,G:qi,F:Zi,O:Ji,P:Qi,U:$i}=me,{getMinDistanceFrom:ts,getRadianFrom:es}=K,{tan:is,min:ss,abs:os}=Math,ns={},rs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Yi,e,i)},lineTo(t,e,i){t.push(Xi,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(Hi,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(Vi,e,i,s,o)},closePath(t){t.push(ji)},rect(t,e,i,s,o){t.push(Ui,e,i,s,o)},roundRect(t,e,i,s,o,n){if(l(n))t.push(Ki,e,i,s,o,n);else{const r=b.fourNumber(n);r?t.push(Gi,e,i,s,o,...r):t.push(Ui,e,i,s,o)}},ellipse(t,e,i,s,o,n,a,h,l){r(n)?t.push(Zi,e,i,s,o):(r(a)&&(a=0),r(h)&&(h=360),t.push(qi,e,i,s,o,n,a,h,l?1:0))},arc(t,e,i,s,o,n,a){r(o)?t.push(Qi,e,i,s):(r(n)&&(n=360),t.push(Ji,e,i,s,o,n,a?1:0))},arcTo(t,e,i,s,o,r,a,h){if(!n(a)){const t=ts(a,h,e,i,s,o);r=ss(r,ss(t/2,t/2*os(is(es(a,h,e,i,s,o)/2))))}t.push($i,e,i,s,o,r)},drawEllipse(t,e,i,s,o,n,a,h,l){Ve.ellipse(null,e,i,s,o,r(n)?0:n,r(a)?0:a,r(h)?360:h,l,null,null,ns),t.push(Yi,ns.x,ns.y),as(t,e,i,s,o,n,a,h,l)},drawArc(t,e,i,s,o,n,a){Ve.arc(null,e,i,s,r(o)?0:o,r(n)?360:n,a,null,null,ns),t.push(Yi,ns.x,ns.y),hs(t,e,i,s,o,n,a)},drawPoints(t,e,i,s){Ve.points(t,e,i,s)}},{ellipse:as,arc:hs}=rs,{moveTo:ls,lineTo:ds,quadraticCurveTo:cs,bezierCurveTo:us,closePath:_s,beginPath:gs,rect:ps,roundRect:fs,ellipse:ms,arc:ys,arcTo:vs,drawEllipse:ws,drawArc:xs,drawPoints:bs}=rs;class ks{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?pe.parse(t):t:[],this}beginPath(){return 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,o,n){return us(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return cs(this.__path,t,e,i,s),this.paint(),this}closePath(){return _s(this.__path),this.paint(),this}rect(t,e,i,s){return ps(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return fs(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return ms(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return ys(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return vs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return ws(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return xs(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return bs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Es,L:Ss,C:Bs,Q:Ts,Z:Rs,N:Cs,D:Os,X:Ps,G:Ls,F:As,O:Ms,P:Ds,U:Fs}=me,Is=It.get("PathDrawer"),Ws={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Es: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 Rs:t.closePath(),s+=1;break;case Cs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Os: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 Ps:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ls:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*E,e[s+6]*E,e[s+7]*E,e[s+8]),s+=9;break;case As:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,S,!1),s+=5;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*E,e[s+5]*E,e[s+6]),s+=7;break;case Ds:t.arc(e[s+1],e[s+2],e[s+3],0,S,!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 Is.error(`command: ${i} [index:${s}]`,e)}}},{M:zs,L:Ns,C:Ys,Q:Xs,Z:Hs,N:Vs,D:js,X:Us,G:Gs,F:Ks,O:qs,P:Zs,U:Js}=me,{toTwoPointBounds:Qs,toTwoPointBoundsByQuadraticCurve:$s,arcTo:to,arc:eo,ellipse:io}=Ve,{addPointBounds:so,copy:oo,addPoint:no,setPoint:ro,addBounds:ao,toBounds:ho}=st,lo=It.get("PathBounds");let co,uo,_o;const go={},po={},fo={},mo={toBounds(t,e){mo.toTwoPointBounds(t,po),ho(po,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ro(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===Hs||r===Ys||r===Xs?ro(e,h,l):ro(e,t[a+1],t[a+2])),r){case zs:case Ns:h=t[a+1],l=t[a+2],no(e,h,l),a+=3;break;case Ys:o=t[a+5],n=t[a+6],Qs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,go),so(e,go),h=o,l=n,a+=7;break;case Xs:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],$s(h,l,i,s,o,n,go),so(e,go),h=o,l=n,a+=5;break;case Hs:a+=1;break;case Vs:h=t[a+1],l=t[a+2],ao(e,h,l,t[a+3],t[a+4]),a+=5;break;case js:case Us:h=t[a+1],l=t[a+2],ao(e,h,l,t[a+3],t[a+4]),a+=r===js?9:6;break;case Gs:io(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],go,fo),0===a?oo(e,go):so(e,go),h=fo.x,l=fo.y,a+=9;break;case Ks:h=t[a+1],l=t[a+2],uo=t[a+3],_o=t[a+4],ao(e,h-uo,l-_o,2*uo,2*_o),h+=uo,a+=5;break;case qs:eo(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],go,fo),0===a?oo(e,go):so(e,go),h=fo.x,l=fo.y,a+=7;break;case Zs:h=t[a+1],l=t[a+2],co=t[a+3],ao(e,h-co,l-co,2*co,2*co),h+=co,a+=4;break;case Js:to(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],go,fo),0===a?oo(e,go):so(e,go),h=fo.x,l=fo.y,a+=6;break;default:return void lo.error(`command: ${r} [index:${a}]`,t)}}},{M:yo,L:vo,Z:wo}=me,{getCenterX:xo,getCenterY:bo}=K,{arcTo:ko}=rs,Eo={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,g=0;const p=t.length,f=[];for(;r<p;){switch(s=t[r],s){case yo:l=_=t[r+1],d=g=t[r+2],r+=3,t[r]===vo?(c=t[r+1],u=t[r+2],f.push(yo,xo(l,c),bo(d,u))):f.push(yo,l,d);break;case vo:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case vo:ko(f,a,h,t[r+1],t[r+2],e,_,g);break;case wo:ko(f,a,h,l,d,e,_,g);break;default:f.push(vo,a,h)}_=a,g=h;break;case wo:o!==wo&&(ko(f,l,d,c,u,e,_,g),f.push(wo)),r+=1;break;default:n=ke[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==wo&&(f[1]=l,f[2]=d),f}};function So(t){return new ks(t)}const Bo=So();pe.creator=So(),pe.parse=Ii.parse,pe.convertToCanvasData=Ii.toCanvasData;const{drawRoundRect:To}=Ee;function Ro(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){To(this,t,e,i,s,o)})}(t)}const Co={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=Oo.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{}}}},Oo=Co;Oo.alphaPixelTypes.forEach(t=>Oo.upperCaseTypeMap[t]=t.toUpperCase());const Po=It.get("TaskProcessor");class Lo{constructor(t){this.parallel=!0,this.time=1,this.id=e.create(e.TASK),this.task=t}run(){return te(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Po.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ao{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e){let i,s,o,r;const a=new Lo(t);return a.parent=this,l(e)?r=e:e&&(s=e.parallel,i=e.start,o=e.time,r=e.delay),o&&(a.time=o),!1===s&&(a.parallel=!1),n(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Mo=It.get("Resource"),Do={tasker:new Ao,map:{},get isComplete(){return Fo.tasker.isComplete},set(t,e){Fo.map[t]&&Mo.repeat(t),Fo.map[t]=e},get:t=>Fo.map[t],remove(t){const e=Fo.map[t];e&&(e.destroy&&e.destroy(),delete Fo.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return a(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=jt.image(s)),Fo.set(t,e),e},destroy(){Fo.map={}}},Fo=Do,Io={maxRecycled:10,recycledList:[],patternTasker:new Ao,get(t){let e=Do.get(t.url);return e||Do.set(t.url,e=jt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Wo.recycledList.push(t)})},clearRecycled(){const t=Wo.recycledList;t.length>Wo.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Do.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Co.alphaPixelTypes.some(e=>Wo.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:"+Co.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Co.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Wo.recycledList=[]}},Wo=Io,{IMAGE:zo,create:No}=e,{floor:Yo,max:Xo}=Math;class Ho{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=No(zo),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Io.isFormat("svg",t)&&(this.isSVG=!0),Io.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(e,i){if(!this.loading){this.loading=!0;let{loadImage:e,loadImageWithProgress:i}=t.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(e=i),Do.tasker.add(()=>te(this,void 0,void 0,function*(){return yield e(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(e,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(e,i,s,o,n,r,a){if(e||(e=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=t.origin.createCanvas(Xo(Yo(e+(n||0)),1),Xo(Yo(i+(r||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,e,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(e,i,s,o){const n=t.canvas.createPattern(e,i);try{s&&n.setTransform&&(n.setTransform(s),s=void 0)}catch(t){}return o&&f.stintSet(o,"transform",s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Vo(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function jo(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Uo(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function Go(t,e){return(i,s)=>qo(i,s,t,e&&e(s))}function Ko(t){return t}function qo(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Vo(t,e,Object.assign(o,s||{})),Sn(t,e,i)}function Zo(t){return Go(t)}function Jo(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Qo(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function $o(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),nn(this))}}))}function tn(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function en(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function sn(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i,e)&&nn(this)}}))}function on(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(nn(this),this.__.__removeNaturalSize())}}))}function nn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function rn(t){return Go(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),nn(this)}}))}const an=sn;function hn(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i)&&(ln(this),e&&(this.__.__useStroke=!0))}}))}function ln(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&nn(t)}const dn=hn;function cn(t){return Go(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function un(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function _n(t){return Go(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;f.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function gn(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&fn(this)}}))}function pn(t){return Go(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>mn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");mn(this,t,e,i),this.mask&&fn(this)}}))}function fn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function mn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||nn(t))}function yn(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function vn(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function wn(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function xn(t){return Go(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===It.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function bn(t){return Go(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function kn(t){return(e,i)=>{Vo(e,"__DataProcessor",{get:()=>t})}}function En(t){return(e,i)=>{Vo(e,"__LayoutProcessor",{get:()=>t})}}function Sn(t,e,i){const s=t.__DataProcessor.prototype,o="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Uo(e,i);if(n(i))a.get=function(){return this[o]};else if("function"==typeof i)a.get=function(){const t=this[o];return null==t?i(this.__leaf):t};else if(_(i)){const t=p(i);a.get=function(){const e=this[o];return null==e?this[o]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[o];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[o];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=jo(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),Vo(s,e,a)}const Bn=new It("rewrite"),Tn=[],Rn=["destroy","constructor"];function Cn(t){return(e,i)=>{Tn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function On(){return t=>{Pn()}}function Pn(t){Tn.length&&(Tn.forEach(e=>{t&&Bn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Tn.length=0)}function Ln(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Rn.includes(s)||e&&e.includes(s)))if(t.prototype){jo(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function An(){return t=>{Gt.register(t)}}function Mn(){return t=>{Zt.register(t)}}setTimeout(()=>Pn(!0));const{copy:Dn,toInnerPoint:Fn,toOuterPoint:In,scaleOfOuter:Wn,rotateOfOuter:zn,skewOfOuter:Nn,multiplyParent:Yn,divideParent:Xn,getLayout:Hn}=I,Vn={},{round:jn}=Math,Un={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),qn(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)Kn(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++)Zn(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Zn(t),t.__updateChange()},updateAllChange(t){if(Qn(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Jn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(e,i,s,o,n,r){o||(o=e.__nowWorld),e.__worldFlipped||t.fullImageShadow?i.copyWorldByReset(s,o,e.__nowWorld,n,r):i.copyWorldToInner(s,o,e.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,o){const n=_(e)?Object.assign({},e):{x:e,y:i};s?In(t.localTransform,n,n,!0):t.parent&&Fn(t.parent.scrollWorldTransform,n,n,!0),Gn.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){_(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=jn(e),i=jn(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){Gn.zoomOfLocal(t,$n(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if(l(s)||(s&&(n=s),s=i),Dn(Vn,r),Wn(Vn,e,i,s),Gn.hasHighPosition(t))Gn.setTransform(t,Vn,o,n);else{const e=t.x+Vn.e-r.e,a=t.y+Vn.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){Gn.rotateOfLocal(t,$n(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;Dn(Vn,o),zn(Vn,e,i),Gn.hasHighPosition(t)?Gn.setTransform(t,Vn,!1,s):t.set({x:t.x+Vn.e-o.e,y:t.y+Vn.f-o.f,rotation:b.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){Gn.skewOfLocal(t,$n(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){Dn(Vn,t.__localMatrix),Nn(Vn,e,i,s),Gn.setTransform(t,Vn,o,n)},transformWorld(t,e,i,s){Dn(Vn,t.worldTransform),Yn(Vn,e),t.parent&&Xn(Vn,t.parent.scrollWorldTransform),Gn.setTransform(t,Vn,i,s)},transform(t,e,i,s){Dn(Vn,t.localTransform),Yn(Vn,e),Gn.setTransform(t,Vn,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&Gn.getInnerOrigin(t,o.origin),r=Hn(e,n,o.around&&Gn.getInnerOrigin(t,o.around));if(Gn.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Gn.getInnerOrigin(t,o.origin);K.move(r,n.x-s.x,n.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 Wn(i,Gn.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(Gn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Dn(Vn,t.worldTransform),Xn(Vn,e.scrollWorldTransform),i?Vn:Object.assign({},Vn)),drop(t,e,i,s){t.setTransform(Gn.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||Gn.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(e,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)e.move(i);else{const o=i.x*s,n=i.y*s;i.x-=o,i.y-=n,e.move(o,n),t.requestRender(()=>Gn.animateMove(e,i,s))}}},Gn=Un,{updateAllMatrix:Kn,updateMatrix:qn,updateAllWorldOpacity:Zn,updateAllChange:Jn,updateChange:Qn}=Gn;function $n(t,e){return t.updateLayout(),t.parent?K.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}=Un,or={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,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),nr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&n(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 o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)sr(s[t]);e&&e===i||sr(i)}}},{pushAllChildBranch:nr,pushAllBranchStack:rr,updateBoundsByBranchStack:ar}=or,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}=Un,{toOuterOf:cr,getPoints:ur,copy:_r}=Rt,gr="_localContentBounds",pr="_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[pr]||(this[pr]={})),this[pr]}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:e}=this,{leafer:i}=e;if(e.isApp)return dr(e);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=e;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,t.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return I.defaultMatrix;case"page":t=e.zoomLayer;default:return 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 Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=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},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=I.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=lr(s,e,!0)}if(r||(r=I.getLayout(n)),_r(r,a),K.copy(r,o),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 o;switch(e){case"world":o=null;break;case"local":o=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:o=e}return n(o)||s.forEach(t=>i.innerToWorld(t,null,!1,o)),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&&t.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&t.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&t.event.stop(this.origin)}}class 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,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}br.CHANGE="property.change",br.LEAFER_CHANGE="property.leafer_change",br.SCROLL=xr;const kr={scrollX:xr,scrollY:xr};class Er extends vr{constructor(t,e){super(t),Object.assign(this,e)}}Er.LOAD="image.load",Er.LOADED="image.loaded",Er.ERROR="image.error";class Sr extends vr{static checkHas(t,e,i){"on"===i?e===Cr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Br)||t.hasEvent(Tr)||t.hasEvent(Rr),t.__hasWorldEvent=t.hasEvent(Cr))}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(Rr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Cr,this)}}Sr.RESIZE="bounds.resize",Sr.INNER="bounds.inner",Sr.LOCAL="bounds.local",Sr.WORLD="bounds.world";const{RESIZE:Br,INNER:Tr,LOCAL:Rr,WORLD:Cr}=Sr,Or={};[Br,Tr,Rr,Cr].forEach(t=>Or[t]=1);class Pr 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){_(t)?(super(Pr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Pr.RESIZE="resize";class Lr extends vr{constructor(t,e){super(t),this.data=e}}Lr.REQUEST="watch.request",Lr.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 Mr extends vr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Mr.REQUEST="render.request",Mr.CHILD_START="render.child_start",Mr.CHILD_END="render.child_end",Mr.START="render.start",Mr.BEFORE="render.before",Mr.RENDER="render",Mr.AFTER="render.after",Mr.AGAIN="render.again",Mr.END="render.end",Mr.NEXT="render.next";class Dr extends vr{}Dr.START="leafer.start",Dr.BEFORE_READY="leafer.before_ready",Dr.READY="leafer.ready",Dr.AFTER_READY="leafer.after_ready",Dr.VIEW_READY="leafer.view_ready",Dr.VIEW_COMPLETED="leafer.view_completed",Dr.STOP="leafer.stop",Dr.RESTART="leafer.restart",Dr.END="leafer.end",Dr.UPDATE_MODE="leafer.update_mode",Dr.TRANSFORM="leafer.transform",Dr.MOVE="leafer.move",Dr.SCALE="leafer.scale",Dr.ROTATE="leafer.rotate",Dr.SKEW="leafer.skew";const{MOVE:Fr,SCALE:Ir,ROTATE:Wr,SKEW:zr}=Dr,Nr={x:Fr,y:Fr,scaleX:Ir,scaleY:Ir,rotation:Wr,skewX:zr,skewY:zr},Yr={};class Xr{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,n;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const r=Hr(this,s,!0),h=a(t)?t.split(" "):t,l=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(n=r[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):r[t]=[l],Or[t]&&Sr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=a(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=Hr(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],Or[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):u(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));_(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&Zt.has(t)&&(e=Zt.get(t,{type:t,target:this,current:this}));const s=Hr(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}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,o=i&&i[t],r=s&&s[t];return!!(n(e)?o||r:e?r:o)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Hr(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Yr)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Yr)}}const{on:Vr,on_:jr,off:Ur,off_:Gr,once:Kr,emit:qr,emitEvent:Zr,hasEvent:Jr,destroy:Qr}=Xr.prototype,$r={on:Vr,on_:jr,off:Ur,off_:Gr,once:Kr,emit:qr,emitEvent:Zr,hasEvent:Jr,destroyEventer:Qr},ta=It.get("setAttr"),ea={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||h(e)||n(e)||(ta.warn(this.innerName,t,e),e=void 0),_(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new br(br.LEAFER_CHANGE,this,t,s,e));const i=Nr[t];i&&(this.emitEvent(new Dr(i,this)),this.emitEvent(new Dr(Dr.TRANSFORM,this)))}this.emitPropertyEvent(br.CHANGE,t,s,e);const i=kr[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new br(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||n(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ia,multiplyParent:sa,translateInner:oa,defaultWorld:na}=I,{toPoint:ra,tempPoint:aa}=ht,ha={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;sa(this.__local||e,t?t.__scrollWorld||t.__world:na,i,!!e.affectScaleOrRotation,o),s&&oa(Object.assign(s,i),o.scrollX,o.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),oa(e,-aa.x,-aa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:la,updateAllMatrix:da}=Un,{updateBounds:ca}=or,{toOuterOf:ua,copyAndSpread:_a,copy:ga}=Rt,{toBounds:pa}=mo,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?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(),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;_a(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?_a(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),Un.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);It.showBounds&&It.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds: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 o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)ya(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)ya(i[s],e)||i[s].__clip(t,e)}}},wa={},{LEAF:xa,create:ba}=e,{toInnerPoint:ka,toOuterPoint:Ea,multiplyParent:Sa}=I,{toOuterOf:Ba}=Rt,{copy:Ta,move:Ra}=K,{moveLocal:Ca,zoomOfLocal:Oa,rotateOfLocal:Pa,skewOfLocal:La,moveWorld:Aa,zoomOfWorld:Ma,rotateOfWorld:Da,skewOfWorld:Fa,transform:Ia,transformWorld:Wa,setTransform:za,getFlipTransform:Na,getLocalOrigin:Ya,getRelativeWorld:Xa,drop:Ha}=Un;let Va=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 y}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){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(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}=Io.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?Xa(this,e):this.worldTransform,o=i?t:{};return Ba(t,s,o),o}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),ka(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ea(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 o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ra(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ra(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}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 o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}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){Ia(this,t,e,i)}move(t,e,i){Ca(this,t,e,i)}moveInner(t,e,i){Aa(this,t,e,!0,i)}scaleOf(t,e,i,s,o){Oa(this,Ya(this,t),e,i,s,o)}rotateOf(t,e,i){Pa(this,Ya(this,t),e,i)}skewOf(t,e,i,s,o){La(this,Ya(this,t),e,i,s,o)}transformWorld(t,e,i){Wa(this,t,e,i)}moveWorld(t,e,i){Aa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){Ma(this,t,e,i,s,o)}rotateOfWorld(t,e){Da(this,t,e)}skewOfWorld(t,e,i,s,o){Fa(this,t,e,i,s,o)}flip(t,e){Ia(this,Na(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):Sn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=sn),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)}};Va=$t([Ln(ea),Ln(ha),Ln(fa),Ln($r),Ln(ma)],Va);const{setListWithFn:ja}=Rt,{sort:Ua}=or,{localBoxBounds:Ga,localStrokeBounds:Ka,localRenderBounds:qa,maskLocalBoxBounds:Za,maskLocalStrokeBounds:Ja,maskLocalRenderBounds:Qa}=tr,$a=new It("Branch");let th=class extends Va{__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){ja(e||this.__layout.boxBounds,this.children,this.__hasMask?Za:Ga)}__updateStrokeBounds(t){ja(t||this.__layout.strokeBounds,this.children,this.__hasMask?Ja:Ka)}__updateRenderBounds(t){ja(t||this.__layout.renderBounds,this.children,this.__hasMask?Qa:qa)}__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(Ua),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return $a.warn("add self or destroyed");const i=n(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=Gt.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(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)):n(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)}};th=$t([Ln(va)],th);class eh{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:i}=this;n(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(n(i[t.innerId])){const{list:s}=this;for(let t=e,o=s.length;t<o;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,o=e.length;s<o;s++)n(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;n(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 eh;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 ih{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const sh="1.9.7";class oh extends ge{get allowBackgroundColor(){return!1}init(){const{config:e}=this;let i=e.view||e.canvas;i?(a(i)?("#"!==i[0]&&(i="#"+i),this.viewSelect=t.miniapp.select(i)):i.fields?this.viewSelect=i:this.initView(i),this.viewSelect&&t.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(e){e?this.view=e.view||e:(e={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:i,height:s,pixelRatio:o}=this.config,n={width:i||e.width,height:s||e.height,pixelRatio:o};this.resize(n),this.context&&(this.viewSelect&&(t.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,l(o)?[o]:o)}),Ro(this.context.__proto__))}__createView(){this.view=t.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(e){this.viewSelect&&t.miniapp.getBounds(this.viewSelect).then(t=>{this.clientBounds=t,e&&e()})}startAutoLayout(e,i){this.resizeListener||(this.resizeListener=i,e&&(this.checkSize=this.checkSize.bind(this),t.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,t.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};f.copyAttrs(e,this,_e),this.resize(t),n(this.width)||this.resizeListener(new Pr(t,e))}}const{mineType:nh,fileType:rh}=Co;function ah(e,i){t.origin={createCanvas:(t,e,s)=>{const o={type:"2d",width:t,height:e};return i.createOffscreenCanvas?i.createOffscreenCanvas(o):i.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(nh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(e,i,s)=>{let o=e.toDataURL(nh(rh(i)),s);return o=o.substring(o.indexOf("64,")+3),t.origin.download(o,i)},download:(e,s)=>new Promise((o,n)=>{let r;s.includes("/")||(s=`${i.env.USER_DATA_PATH}/`+s,r=!0);const a=i.getFileSystemManager();a.writeFile({filePath:s,data:e,encoding:"base64",success(){r?t.miniapp.saveToAlbum(s).then(()=>{a.unlink({filePath:s}),o()}):o()},fail(t){n(t)}})}),loadImage:e=>new Promise((i,s)=>{const o=t.canvas.view.createImage();o.onload=()=>{i(o)},o.onerror=t=>{s(t)},o.src=t.image.getRealURL(e)}),noRepeat:"repeat-x"},t.miniapp={select:t=>i.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(e=>{i.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}}):i.authorize({scope:"scope.writePhotosAlbum",success:()=>{i.saveImageToPhotosAlbum({filePath:t,success(){e(!0)}})},fail:()=>{}})}})}),onWindowResize(t){i.onWindowResize(t)},offWindowResize(t){i.offWindowResize(t)}},t.event={stopDefault(t){},stopNow(t){},stop(t){}},t.canvas=jt.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(jt,{canvas:(t,e)=>new oh(t,e),image:t=>new Ho(t)}),t.name="miniapp",t.requestRender=function(e){const{view:i}=t.renderCanvas||t.canvas;i.requestAnimationFrame?i.requestAnimationFrame(e):setTimeout(e,16)},Vo(t,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class hh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new eh;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 eh,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Mr.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 Lr(Lr.DATA,{updatedList:this.updatedList})),this.__updatedList=new eh,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],[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:lh,updateBounds:dh,updateChange:ch}=Un,{pushAllChildBranch:uh,pushAllParent:_h}=or;const{worldBounds:gh}=tr;class ph{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,u(t)&&(t=new eh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,gh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,gh),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:fh,updateAllChange:mh}=Un,yh=It.get("Layouter");class vh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ih,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Ar.START),this.layoutOnce(),t.emitEvent(new Ar(Ar.END,this.layoutedBlocks,this.times))}catch(t){yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?yh.warn("layouting"):this.times>3?yh.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=Yt.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=Ar,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Ar(o,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?(lh(t,!0),e.add(t),t.isBranch&&uh(t,e),_h(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),_h(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;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||dh(s[t])}dh(i)}})}(this.__levelList),function(t){t.list.forEach(ch)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Ar(n,a,this.times)),i.emitEvent(new Ar(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Yt.end(e)}fullLayout(){const t=Yt.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=Ar,n=this.getBlocks(new eh(e));e.emitEvent(new Ar(i,n,this.times)),vh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Ar(s,n,this.times)),e.emitEvent(new Ar(o,n,this.times)),this.addBlocks(n),Yt.end(t)}static fullLayout(t){fh(t,!0),t.isBranch?or.updateBounds(t):Un.updateBounds(t),mh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ph([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ph(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],[Lr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const wh=It.get("Renderer");class xh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Ar.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Mr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Mr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Mr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,wh.log(e.innerName,"---\x3e");try{this.emitRender(Mr.START),this.renderOnce(t),this.emitRender(Mr.END,this.totalBounds),Io.clearRecycled()}catch(t){this.rendering=!1,wh.error(t)}wh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return wh.warn("rendering");if(this.times>3)return wh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Mr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Mr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Mr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Mr.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Yt.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new Lt(s);i.save(),s.spread(xh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),i.restore(),Yt.end(e)}fullRender(){const t=Yt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Yt.end(t)}__render(e,i){const{canvas:s}=this,o=e.includes(this.target.__world),n=o?{includes:o}:{bounds:e,includes:o};this.needFill&&s.fillWorld(e,this.config.fill),It.showRepaint&&It.drawRepaint(s,e),t.render(this.target,s,n),this.renderBounds=i=i||e,this.renderOptions=n,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 Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const e=1e3/(Date.now()-i),{maxFPS:o}=this.config;if(o&&e>o-.5)return t.requestRender(s);this.FPS=Math.min(120,Math.ceil(e)),this.requestTime=0,this.checkRender()};t.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Lt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||wh.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 Mr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Mr.REQUEST,this.update,this],[Ar.END,this.__onLayoutEnd,this],[Mr.AGAIN,this.renderAgain,this],[Pr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}xh.clipSpread=10;const{hitRadiusPoint:bh}=Rt;class kh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new eh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o),h=o?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 eh;if(t.length){let e;const{x:o,y:n}=this.point,r={x:o,y:n,radiusX:0,radiusY:0};for(let o=0,n=t.length;o<n;o++)if(e=t[o],(i||Un.worldHittable(e))&&(this.hitChild(e,r),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Un.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=>Un.worldHittable(t))}getPath(t){const e=new eh;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 eh;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 eh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)i=t[n],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||bh(i.__world,o),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)):s&&this.hitChild(i,o))}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,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.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 Eh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new kh(this.target=t,this),this.finder=jt.finder&&jt.finder()}getByPoint(e,i,s){const{target:o,picker:n}=this;return t.backgrounder&&o&&o.updateLayout(),n.getByPoint(e,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Vt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Sh(t){return Go(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Bh(t){return Go(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Th(){return(t,e)=>{const i="_"+e;Vo(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Rh(t){return(e,i)=>{Vo(e,i,Uo(i,t))}}Object.assign(jt,{watcher:(t,e)=>new hh(t,e),layouter:(t,e)=>new vh(t,e),renderer:(t,e,i)=>new xh(t,e,i),selector:(t,e)=>new Eh(t,e)}),t.layout=vh.fullLayout,t.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new eh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Ch={},Oh={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}},Ph={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Lh={},Ah={},Mh={},Dh={},Fh={},Ih={apply(){Vt.need("filter")}},Wh={},zh={setStyleName:()=>Vt.need("state"),set:()=>Vt.need("state")},Nh={list:{},register(t,e){Nh.list[t]=e},get:t=>Nh.list[t]},{parse:Yh,objectToCanvasData:Xh}=Ii,{stintSet:Hh}=f,{hasTransparent:Vh}=Oh,jh={},Uh=It.get("UIData");class Gh extends y{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,Uh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Uh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Hh(this,"__isTransparentFill",Vh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):_(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Hh(this,"__isTransparentStroke",Vh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):_(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&_(t[0])?(this.__setInput("path",t),this._path=e?Yh(t):Xh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Kh(this,"shadow",t)}setInnerShadow(t){Kh(this,"innerShadow",t)}setFilter(t){Kh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Ah.compute("fill",this.__leaf),e&&Ah.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=jh)):(this.__isStrokes=!0,this._stroke||(this._stroke=jh))}__removePaint(t,e){e&&this.__removeInput(t),Mh.recycleImage(t,this),"fill"===t?(Hh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Hh(this,"__isAlphaPixelStroke",void 0),Hh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Kh(t,e,i){t.__setInput(e,i),u(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class qh extends Gh{}class Zh extends qh{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 qh{__getInputData(t,e){const i=super.__getInputData(t,e);return _e.forEach(t=>delete i[t]),i}}class Qh extends Zh{}class $h extends Gh{get __usePathBox(){return this.points||this.__pathInputed}}class tl extends Gh{get __boxStroke(){return!this.__pathInputed}}class el extends Gh{get __boxStroke(){return!this.__pathInputed}}class il extends $h{}class sl extends Gh{}class ol extends Gh{get __pathInputed(){return 2}}class nl extends qh{}const rl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class al extends Gh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=rl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=Gt.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class hl extends tl{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 ll extends tl{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 dl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=Math.max(n.__layout.strokeSpread=n.__updateStrokeSpread(),t),e=n.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__;e&&(t=Fh.getShadowSpread(this,e)),s&&(t=Math.max(t,s)),n&&(t+=Ih.getSpread(n)),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)),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{float:cl}=b,ul=new Lt,_l=new Lt,gl=new Lt,pl={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&fl.getValidMove(t.__localBoxBounds,fl.getDragBounds(t),s,e,!0),fl.axisMove(t,e)},limitScaleOf(t,e,i){const{dragBounds:s,dragBoundsType:o}=t;s&&fl.getValidScaleOf(t.__localBoxBounds,fl.getDragBounds(t),o,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,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),fl.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),fl.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=cl(s.x),s.y=cl(s.y),s},getValidScaleOf(t,e,i,s,o,n){let r,a;return n||(o=Object.assign({},o)),ul.set(t).scaleOf(s,o.x,o.y).unsign(),_l.set(ul).add(e),gl.set(ul).intersect(e),r=fl.isInnerMode(t,e,i,"width")?_l.width/ul.width:gl.width/ul.width,a=fl.isInnerMode(t,e,i,"height")?_l.height/ul.height:gl.height/ul.height,o.x=cl(gl.width)?o.x*r:1,o.y=cl(gl.height)?o.y*a:1,o}},fl=pl,{stintSet:ml}=f,yl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);ml(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),ml(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;ml(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Fh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),ml(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){vl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Ah.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Fh.shadow(this,t,h),a&&(s.__isStrokes?Ah.strokes(n,this,t):Ah.stroke(n,this,t)),o&&(s.__isFills?Ah.fills(o,this,t):Ah.fill(o,this,t)),r&&this.__drawAfterFill(t,e),d&&Fh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Ah.strokes(n,this,t):Ah.stroke(n,this,t)),c&&Ih.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Ah.strokes(n,this,t):Ah.stroke(n,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Oh.string(e.color))}o&&(s.__isFills?Ah.fills(o,this,t):Ah.fill(o,this,t)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Ah.strokes(n,this,t):Ah.stroke(n,this,t))}}else s.__pathInputed?vl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Ah.fills(s,this,t):Ah.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Ah.strokes(o,this,t):Ah.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 vl(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Ah.stroke(o,t,e),s&&Ah.fill(s,t,e),n&&t.__drawAfterFill(e,i),o&&!r&&Ah.stroke(o,t,e)}const wl={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),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,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var xl;let bl=xl=class extends Va{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){b.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Bo.set(this.path=t||[]),t||this.__drawPathByBox(Bo),Bo}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Vt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Vt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Bo.set(i=[]),this.__drawPathByBox(Bo)),t?Ii.toCanvasData(i,!0):i}getPathString(t,e,i){return Ii.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Wh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Eo.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Lh.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:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,l(n)?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e){Ah.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),Vt.need("animate")}killAnimate(t,e){}export(t,e){return Vt.need("export")}syncExport(t,e){return Vt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),xl.one(e)}static one(t,e,i,s,o){return Gt.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){An()(this)}static registerData(t){kn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};$t([kn(Gh)],bl.prototype,"__",void 0),$t([Th()],bl.prototype,"zoomLayer",void 0),$t([Zo("")],bl.prototype,"id",void 0),$t([Zo("")],bl.prototype,"name",void 0),$t([Zo("")],bl.prototype,"className",void 0),$t([un("pass-through")],bl.prototype,"blendMode",void 0),$t([gn(1)],bl.prototype,"opacity",void 0),$t([pn(!0)],bl.prototype,"visible",void 0),$t([un(!1)],bl.prototype,"locked",void 0),$t([_n(!1)],bl.prototype,"dim",void 0),$t([_n(!1)],bl.prototype,"dimskip",void 0),$t([yn(0)],bl.prototype,"zIndex",void 0),$t([vn(!1)],bl.prototype,"mask",void 0),$t([wn(!1)],bl.prototype,"eraser",void 0),$t([Jo(0,!0)],bl.prototype,"x",void 0),$t([Jo(0,!0)],bl.prototype,"y",void 0),$t([sn(100,!0)],bl.prototype,"width",void 0),$t([sn(100,!0)],bl.prototype,"height",void 0),$t([tn(1,!0)],bl.prototype,"scaleX",void 0),$t([tn(1,!0)],bl.prototype,"scaleY",void 0),$t([en(0,!0)],bl.prototype,"rotation",void 0),$t([en(0,!0)],bl.prototype,"skewX",void 0),$t([en(0,!0)],bl.prototype,"skewY",void 0),$t([Jo(0,!0)],bl.prototype,"offsetX",void 0),$t([Jo(0,!0)],bl.prototype,"offsetY",void 0),$t([Qo(0,!0)],bl.prototype,"scrollX",void 0),$t([Qo(0,!0)],bl.prototype,"scrollY",void 0),$t([$o()],bl.prototype,"origin",void 0),$t([$o()],bl.prototype,"around",void 0),$t([Zo(!1)],bl.prototype,"lazy",void 0),$t([on(1)],bl.prototype,"pixelRatio",void 0),$t([cn(0)],bl.prototype,"renderSpread",void 0),$t([rn()],bl.prototype,"path",void 0),$t([an()],bl.prototype,"windingRule",void 0),$t([an(!0)],bl.prototype,"closed",void 0),$t([sn(0)],bl.prototype,"padding",void 0),$t([sn(!1)],bl.prototype,"lockRatio",void 0),$t([sn()],bl.prototype,"widthRange",void 0),$t([sn()],bl.prototype,"heightRange",void 0),$t([Zo(!1)],bl.prototype,"draggable",void 0),$t([Zo()],bl.prototype,"dragBounds",void 0),$t([Zo("auto")],bl.prototype,"dragBoundsType",void 0),$t([Zo(!1)],bl.prototype,"editable",void 0),$t([xn(!0)],bl.prototype,"hittable",void 0),$t([xn("path")],bl.prototype,"hitFill",void 0),$t([dn("path")],bl.prototype,"hitStroke",void 0),$t([xn(!1)],bl.prototype,"hitBox",void 0),$t([xn(!0)],bl.prototype,"hitChildren",void 0),$t([xn(!0)],bl.prototype,"hitSelf",void 0),$t([xn()],bl.prototype,"hitRadius",void 0),$t([bn("")],bl.prototype,"cursor",void 0),$t([un()],bl.prototype,"fill",void 0),$t([dn(void 0,!0)],bl.prototype,"stroke",void 0),$t([dn("inside")],bl.prototype,"strokeAlign",void 0),$t([dn(1,!0)],bl.prototype,"strokeWidth",void 0),$t([dn(!1)],bl.prototype,"strokeWidthFixed",void 0),$t([dn("none")],bl.prototype,"strokeCap",void 0),$t([dn("miter")],bl.prototype,"strokeJoin",void 0),$t([dn()],bl.prototype,"dashPattern",void 0),$t([dn(0)],bl.prototype,"dashOffset",void 0),$t([dn(10)],bl.prototype,"miterLimit",void 0),$t([an(0)],bl.prototype,"cornerRadius",void 0),$t([an()],bl.prototype,"cornerSmoothing",void 0),$t([Sh()],bl.prototype,"shadow",void 0),$t([Sh()],bl.prototype,"innerShadow",void 0),$t([Sh()],bl.prototype,"blur",void 0),$t([Sh()],bl.prototype,"backgroundBlur",void 0),$t([Sh()],bl.prototype,"grayscale",void 0),$t([Sh()],bl.prototype,"filter",void 0),$t([un()],bl.prototype,"placeholderColor",void 0),$t([Zo(100)],bl.prototype,"placeholderDelay",void 0),$t([Zo({})],bl.prototype,"data",void 0),$t([Cn(Va.prototype.reset)],bl.prototype,"reset",null),bl=xl=$t([Ln(dl),Ln(yl),On()],bl);let kl=class extends bl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var El;$t([kn(qh)],kl.prototype,"__",void 0),$t([sn(0)],kl.prototype,"width",void 0),$t([sn(0)],kl.prototype,"height",void 0),kl=$t([Ln(th),An()],kl);const Sl=It.get("Leafer");let Bl=El=class extends kl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Do.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),El.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const o=this.canvas=jt.canvas(s);this.__controllers.push(this.renderer=jt.renderer(this,o,s),this.watcher=jt.watcher(this,s),this.layouter=jt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=jt.selector(this),this.interaction=jt.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=jt.hitCanvasManager()),this.canvasManager=new Qt,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),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(Dr.RESTART):this.emitLeafer(Dr.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(Dr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=f.copyAttrs({},t,_e);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=f.copyAttrs({},this.canvas,_e);e.resize(t),this.updateLazyBounds(),this.__onResize(new Pr(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,_e),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&&(_e.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(Dr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&_e.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=f.copyAttrs({},s,_e);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__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(Dr.BEFORE_READY),this.emitLeafer(Dr.READY),this.emitLeafer(Dr.AFTER_READY),hr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Dr.VIEW_READY),hr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}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(Dr.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 Dr(t,this))}__listenEvents(){const t=Yt.start("FirstCreate "+this.innerName);this.once([[Dr.START,()=>Yt.end(t)],[Ar.START,this.updateLazyBounds,this],[Mr.START,this.__onCreated,this],[Mr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Lr.DATA,this.__onWatchData,this],[Ar.END,this.__onLayoutEnd,this],[Mr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){El.list.remove(this);try{this.stop(),this.emitLeafer(Dr.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(()=>{Io.clearRecycled()},100)}catch(t){Sl.error(t)}}};t?e():setTimeout(e)}};Bl.list=new eh,$t([kn(Jh)],Bl.prototype,"__",void 0),$t([sn()],Bl.prototype,"pixelRatio",void 0),$t([Zo("normal")],Bl.prototype,"mode",void 0),Bl=El=$t([An()],Bl);let Tl=class extends bl{get __tag(){return"Rect"}};$t([kn(tl)],Tl.prototype,"__",void 0),Tl=$t([Ln(wl),On(),An()],Tl);const{add:Rl,includes:Cl,scroll:Ol}=Rt,Pl=Tl.prototype,Ll=kl.prototype;let Al=class extends kl{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:o,boxBounds:n}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r.includes("scroll"))&&(Rl(a,n),Ol(a,i)),this.__updateRectRenderBounds(),t=!Cl(n,a),t&&"show"===r&&Rl(o,a)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}};$t([kn(Zh)],Al.prototype,"__",void 0),$t([sn(100)],Al.prototype,"width",void 0),$t([sn(100)],Al.prototype,"height",void 0),$t([Zo(!1)],Al.prototype,"resizeChildren",void 0),$t([cn("show")],Al.prototype,"overflow",void 0),$t([Cn(Pl.__updateStrokeSpread)],Al.prototype,"__updateStrokeSpread",null),$t([Cn(Pl.__updateRenderSpread)],Al.prototype,"__updateRectRenderSpread",null),$t([Cn(Pl.__updateBoxBounds)],Al.prototype,"__updateRectBoxBounds",null),$t([Cn(Pl.__updateStrokeBounds)],Al.prototype,"__updateStrokeBounds",null),$t([Cn(Pl.__updateRenderBounds)],Al.prototype,"__updateRectRenderBounds",null),$t([Cn(Pl.__updateChange)],Al.prototype,"__updateRectChange",null),$t([Cn(Pl.__render)],Al.prototype,"__renderRect",null),$t([Cn(Ll.__render)],Al.prototype,"__renderGroup",null),Al=$t([On(),An()],Al);let Ml=class extends Al{get __tag(){return"Frame"}get isFrame(){return!0}};$t([kn(Qh)],Ml.prototype,"__",void 0),$t([un("#FFFFFF")],Ml.prototype,"fill",void 0),$t([cn("hide")],Ml.prototype,"overflow",void 0),Ml=$t([An()],Ml);const{moveTo:Dl,closePath:Fl,ellipse:Il}=rs;let Wl=class extends bl{get __tag(){return"Ellipse"}__updatePath(){const{width:e,height:i,innerRadius:s,startAngle:o,endAngle:n}=this.__,r=e/2,a=i/2,h=this.__.path=[];s?(o||n?(s<1&&Il(h,r,a,r*s,a*s,0,o,n,!1),Il(h,r,a,r,a,0,n,o,!0),s<1&&Fl(h)):(s<1&&(Il(h,r,a,r*s,a*s),Dl(h,e,a)),Il(h,r,a,r,a,0,360,0,!0)),t.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||n?(Dl(h,r,a),Il(h,r,a,r,a,0,o,n,!1),Fl(h)):Il(h,r,a,r,a)}};$t([kn(el)],Wl.prototype,"__",void 0),$t([an(0)],Wl.prototype,"innerRadius",void 0),$t([an(0)],Wl.prototype,"startAngle",void 0),$t([an(0)],Wl.prototype,"endAngle",void 0),Wl=$t([An()],Wl);const{sin:zl,cos:Nl,PI:Yl}=Math,{moveTo:Xl,lineTo:Hl,closePath:Vl,drawPoints:jl}=rs;let Ul=class extends bl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)jl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,n=i/2,r=s/2;Xl(e,n,0);for(let t=1;t<o;t++)Hl(e,n+n*zl(2*t*Yl/o),r-r*Nl(2*t*Yl/o));Vl(e)}}};$t([kn(il)],Ul.prototype,"__",void 0),$t([an(3)],Ul.prototype,"sides",void 0),$t([an()],Ul.prototype,"points",void 0),$t([an(0)],Ul.prototype,"curve",void 0),Ul=$t([On(),An()],Ul);const{sin:Gl,cos:Kl,PI:ql}=Math,{moveTo:Zl,lineTo:Jl,closePath:Ql}=rs;let $l=class extends bl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];Zl(r,o,0);for(let t=1;t<2*i;t++)Jl(r,o+(t%2==0?o:o*s)*Gl(t*ql/i),n-(t%2==0?n:n*s)*Kl(t*ql/i));Ql(r)}};$t([kn(sl)],$l.prototype,"__",void 0),$t([an(5)],$l.prototype,"corners",void 0),$t([an(.382)],$l.prototype,"innerRadius",void 0),$l=$t([An()],$l);const{moveTo:td,lineTo:ed,drawPoints:id}=rs,{rotate:sd,getAngle:od,getDistance:nd,defaultPoint:rd}=K;let ad=class extends bl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&sd(i,e),i}set toPoint(t){this.width=nd(rd,t),this.rotation=od(rd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?id(e,t.points,t.curve,t.closed):(td(e,0,0),ed(e,this.width,0))}};$t([kn($h)],ad.prototype,"__",void 0),$t([hn("center")],ad.prototype,"strokeAlign",void 0),$t([sn(0)],ad.prototype,"height",void 0),$t([an()],ad.prototype,"points",void 0),$t([an(0)],ad.prototype,"curve",void 0),$t([an(!1)],ad.prototype,"closed",void 0),ad=$t([An()],ad);let hd=class extends Tl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}};$t([kn(hl)],hd.prototype,"__",void 0),$t([sn("")],hd.prototype,"url",void 0),hd=$t([An()],hd);const ld=hd;let dd=class extends Tl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=jt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Ho({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Er(Er.LOADED,{image:t}))})}draw(t,e,i,s){const o=new et(t.worldTransform).invert(),n=new et;e&&n.translate(e.x,e.y),i&&(l(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.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()}};$t([kn(ll)],dd.prototype,"__",void 0),$t([Bh(100)],dd.prototype,"width",void 0),$t([Bh(100)],dd.prototype,"height",void 0),$t([Bh(1)],dd.prototype,"pixelRatio",void 0),$t([Bh(!0)],dd.prototype,"smooth",void 0),$t([Zo(!1)],dd.prototype,"safeResize",void 0),$t([Bh()],dd.prototype,"contextSettings",void 0),dd=$t([An()],dd);const{copyAndSpread:cd,includes:ud,spread:_d,setList:gd}=Rt;let pd=class extends bl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Ph.number(e,o),t.__letterSpacing=Ph.number(i,o),t.__padding=l?b.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Ch.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&_d(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!ud(h,a)),this.isOverflow?(gd(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;cd(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()}};$t([kn(al)],pd.prototype,"__",void 0),$t([sn(0)],pd.prototype,"width",void 0),$t([sn(0)],pd.prototype,"height",void 0),$t([un()],pd.prototype,"boxStyle",void 0),$t([Zo(!1)],pd.prototype,"resizeFontSize",void 0),$t([un("#000000")],pd.prototype,"fill",void 0),$t([hn("outside")],pd.prototype,"strokeAlign",void 0),$t([xn("all")],pd.prototype,"hitFill",void 0),$t([sn("")],pd.prototype,"text",void 0),$t([sn("")],pd.prototype,"placeholder",void 0),$t([sn("caption")],pd.prototype,"fontFamily",void 0),$t([sn(12)],pd.prototype,"fontSize",void 0),$t([sn("normal")],pd.prototype,"fontWeight",void 0),$t([sn(!1)],pd.prototype,"italic",void 0),$t([sn("none")],pd.prototype,"textCase",void 0),$t([sn("none")],pd.prototype,"textDecoration",void 0),$t([sn(0)],pd.prototype,"letterSpacing",void 0),$t([sn({type:"percent",value:1.5})],pd.prototype,"lineHeight",void 0),$t([sn(0)],pd.prototype,"paraIndent",void 0),$t([sn(0)],pd.prototype,"paraSpacing",void 0),$t([sn("x")],pd.prototype,"writingMode",void 0),$t([sn("left")],pd.prototype,"textAlign",void 0),$t([sn("top")],pd.prototype,"verticalAlign",void 0),$t([sn(!0)],pd.prototype,"autoSizeAlign",void 0),$t([sn("normal")],pd.prototype,"textWrap",void 0),$t([sn("show")],pd.prototype,"textOverflow",void 0),$t([un(!1)],pd.prototype,"textEditing",void 0),pd=$t([An()],pd);let fd=class extends bl{get __tag(){return"Path"}};$t([kn(ol)],fd.prototype,"__",void 0),$t([hn("center")],fd.prototype,"strokeAlign",void 0),fd=$t([An()],fd);let md=class extends kl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new fd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};$t([kn(nl)],md.prototype,"__",void 0),$t([(t,e)=>{Vo(t,e,{get(){return this.__path}})}],md.prototype,"path",void 0),md=$t([Ln(ks,["set","path","paint"]),An()],md);let yd=class extends Bl{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:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&jt.editor(o,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Bl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),n(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,_e),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Ar.END,this.__onReady,this],[Mr.START,this.__onCreated,this],[Mr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Mr.END,this.__onChildRenderEnd,this))}};yd=$t([An()],yd);const vd={},wd={isHoldSpaceKey:()=>wd.isHold("Space"),isHold:t=>vd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){vd[t]||(vd[t]=!0)},setUpCode(t){vd[t]=!1}},xd={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 bd extends vr{get spaceKey(){return wd.isHoldSpaceKey()}get left(){return xd.left(this)}get right(){return xd.right(this)}get middle(){return xd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return wd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){Zt.changeName(t,e)}}let kd=class extends bd{};kd.POINTER="pointer",kd.BEFORE_DOWN="pointer.before_down",kd.BEFORE_MOVE="pointer.before_move",kd.BEFORE_UP="pointer.before_up",kd.DOWN="pointer.down",kd.MOVE="pointer.move",kd.UP="pointer.up",kd.OVER="pointer.over",kd.OUT="pointer.out",kd.ENTER="pointer.enter",kd.LEAVE="pointer.leave",kd.TAP="tap",kd.DOUBLE_TAP="double_tap",kd.CLICK="click",kd.DOUBLE_CLICK="double_click",kd.LONG_PRESS="long_press",kd.LONG_TAP="long_tap",kd.MENU="pointer.menu",kd.MENU_TAP="pointer.menu_tap",kd=$t([Mn()],kd);const Ed=kd,Sd={};let Bd=class extends kd{static setList(t){this.list=t instanceof eh?t:new eh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const o=t.getLocalPoint(i,null,!0);return K.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),pl.axisMove(t,o),o}static limitMove(t,e){pl.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Sd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Sd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Sd,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){Sd.x=t?this.totalX:this.moveX,Sd.y=t?this.totalY:this.moveY}};Bd.BEFORE_DRAG="drag.before_drag",Bd.START="drag.start",Bd.DRAG="drag",Bd.END="drag.end",Bd.OVER="drag.over",Bd.OUT="drag.out",Bd.ENTER="drag.enter",Bd.LEAVE="drag.leave",Bd=$t([Mn()],Bd);const Td=Bd;let Rd=class extends kd{static setList(t){Bd.setList(t)}static setData(t){Bd.setData(t)}};Rd.DROP="drop",Rd=$t([Mn()],Rd);let Cd=class extends Bd{};Cd.BEFORE_MOVE="move.before_move",Cd.START="move.start",Cd.MOVE="move",Cd.END="move.end",Cd=$t([Mn()],Cd);let Od=class extends kd{};Od.BEFORE_ROTATE="rotate.before_rotate",Od.START="rotate.start",Od.ROTATE="rotate",Od.END="rotate.end",Od=$t([Mn()],Od);let Pd=class extends Bd{};Pd.SWIPE="swipe",Pd.LEFT="swipe.left",Pd.RIGHT="swipe.right",Pd.UP="swipe.up",Pd.DOWN="swipe.down",Pd=$t([Mn()],Pd);let Ld=class extends kd{};Ld.BEFORE_ZOOM="zoom.before_zoom",Ld.START="zoom.start",Ld.ZOOM="zoom",Ld.END="zoom.end",Ld=$t([Mn()],Ld);let Ad=class extends bd{};Ad.BEFORE_DOWN="key.before_down",Ad.BEFORE_UP="key.before_up",Ad.DOWN="key.down",Ad.HOLD="key.hold",Ad.UP="key.up",Ad=$t([Mn()],Ad);const Md={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?Pd.UP:t>45&&t<135?Pd.DOWN:t<=45&&t>=-45?Pd.RIGHT:Pd.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:Dd.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:n(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 eh,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>Un.draggable(t)||!t.isLeafer&&t.hasEvent(Bd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Dd=Md,Fd=new eh,{getDragEventData:Id,getDropEventData:Wd,getSwipeEventData:zd}=Md;class Nd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Id(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Bd.list||this.draggableList||Fd;return this.dragging&&(s?t?Fd:new eh(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(Cd.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&xd.left(t),this.dragging&&(this.interaction.emit(Bd.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],Un.draggable(e)){this.draggableList=new eh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=Id(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(this.dragData.moveType="drag",e.emit(Cd.BEFORE_MOVE,this.dragData),e.emit(Cd.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(Bd.BEFORE_DRAG,this.dragData),e.emit(Bd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:n}=e.p,r=!n||!!t;s.forEach(e=>{if(e.draggable){const s=a(e.draggable),h=Bd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},r||s);n&&!s&&t?Un.animateMove(e,h,l(n)?n:.3):e.move(h)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Bd.OUT,t,i),e.emit(Bd.OVER,t,s)):e.emit(Bd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Bd.LEAVE,t,i,s),e.emit(Bd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=Id(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(Cd.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Bd.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(K.getDistance(e,t)>o.config.pointer.swipeDistance){const t=zd(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=Wd(t,e,Bd.data);s.path=i,this.interaction.emit(Rd.DROP,s),this.interaction.emit(Bd.LEAVE,t,i)}dragReset(){Bd.list=Bd.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 Yd=It.get("emit");const Xd=["move","zoom","rotate","key"];function Hd(t,e,i,s,o){if(Xd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!jd(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&Vd(n,e,i,s,o)}}function Vd(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!jd(t,o)&&(zh.updateEventStyle&&!s&&zh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=Zt.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function jd(t,e){return e&&e.has(t)}const Ud={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:Gd,pathCanDrag:Kd,pathHasOutside:qd}=Md;class Zd{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&&xd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&xd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&wd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=f.clone(Ud),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new eh(t),this.createTransformer(),this.dragger=new Nd(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(xd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(kd.BEFORE_DOWN,t),this.emit(kd.DOWN,t),xd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=xd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&xd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(kd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=K.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(kd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;xd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(kd.BEFORE_UP,t),this.emit(kd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(kd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(kd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(Ad.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,wd.setDownCode(e),this.emit(Ad.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Ad.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(Ad.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,wd.setUpCode(e),this.emit(Ad.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new eh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(kd.OUT,t,i),this.emit(kd.OVER,t,e)):this.emit(kd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(kd.LEAVE,t,i,e),this.emit(kd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(kd.LEAVE,t),this.dragger.dragging&&this.emit(Rd.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[kd.DOUBLE_TAP,kd.DOUBLE_CLICK].some(e=>Gd(t.path,e));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(e,i){const{hitRadius:s,through:o}=this.p,{bottomList:n,target:r}=this;t.backgrounder||e.origin||r&&r.updateLayout();const a=this.selector.getByPoint(e,s,Object.assign({bottomList:n,name:e.type},i||{through:o}));return a.throughPath&&(e.throughPath=a.throughPath),e.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!qd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Kd(t.path))&&!qd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:kd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,o=s.length;t<o&&(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:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.height/i.height,this.p.snap&&K.round(s),s}emitTap(t){this.emit(kd.TAP,t),this.emit(kd.CLICK,t)}emitDoubleTap(t){this.emit(kd.DOUBLE_TAP,t),this.emit(kd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(kd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(kd.LONG_TAP,t),(Gd(t.path,kd.LONG_TAP)||Gd(t.path,kd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Lt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(l(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Pr.RESIZE,this.__onResize,this)],t.once(Dr.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 o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],Vd(o,t,e,!0,s))return;o.isApp&&Hd(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&Hd(o,t,e,!1,s),Vd(o,t,e,!1,s))return}catch(t){Yd.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 Jd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Jd.custom={};class Qd extends Qt{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new eh,this.pixelList=new eh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),jt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),jt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}t.getSelector=function(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=jt.selector())};const{toInnerRadiusPointOf:$d,copy:tc,setRadius:ec}=K,{hitRadiusPoint:ic,hitPoint:sc}=Rt,oc={},nc={},rc=Va.prototype;rc.hit=function(e,i=0){this.updateLayout(),tc(nc,e),ec(nc,i);const s=this.__world;return!!(i?ic(s,nc):sc(s,nc))&&(this.isBranch?t.getSelector(this).hitPoint(Object.assign({},nc),i,{target:this}):this.__hitWorld(nc))},rc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(tc(oc,t),ec(t=oc,e.hitRadius)),$d(t,i,oc),e.hitBox||o){if(Rt.hitRadiusPoint(s.boxBounds,oc))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(oc)},rc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},rc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},rc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},rc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ac=new et,hc=bl.prototype;hc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const e=this.leafer||this.parent&&this.parent.leafer;if(!e)return;const i=this.__,{hitCanvasManager:s}=e,o=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,n=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,r=o||n;this.__hitCanvas||(this.__hitCanvas=r?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,s=t.image.hitCanvasSize,r=a.hitScale=At.set(0,0,s,s).getFitMatrix(e).a,{x:h,y:l,width:d,height:c}=At.set(e).scale(r);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Io.patternLocked=!0,this.__renderShape(a,{matrix:ac.setWith(this.__world).scaleWith(1/r).invertWith().translate(-h,-l),ignoreFill:!o,ignoreStroke:!n}),Io.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},hc.__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:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const lc=bl.prototype,dc=Tl.prototype,cc=Al.prototype;dc.__updateHitCanvas=cc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?lc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},dc.__hitFill=cc.__hitFill=function(t){return this.__hitCanvas?lc.__hitFill.call(this,t):Rt.hitRadiusPoint(this.__layout.boxBounds,t)},pd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.width,e<i?i:e))},kl.prototype.pick=function(e,i){return i||(i=o),this.updateLayout(),t.getSelector(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const uc=ge.prototype;uc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},uc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},uc.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),At.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(At.x,At.y,At.width||1,At.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const _c={convertTouch(t,e){const i=_c.getTouch(t),s=Md.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class gc extends Zd{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return n(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=_c.getTouch(t);this.pointerDown(_c.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=_c.getTouch(t);this.pointerMove(_c.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=_c.getTouch(t);this.pointerUp(_c.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Md.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function pc(t,e){const i=t.__,{rows:s,decorationY:o}=i.__textDrawData;let n;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)n=s[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(o){const{decorationColor:t,decorationHeight:n}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>o.forEach(i=>e.fillRect(t.x,t.y+i,t.width,n)))}}function fc(t,e){t.__.__font?pc(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function mc(t,e,i){switch(e.__.strokeAlign){case"center":yc(t,1,e,i);break;case"inside":vc(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?yc(t,2,e,i):vc(t,"outside",e,i)}}function yc(t,e,i,s){const o=i.__;_(t)?xc(t,e,!0,i,s):(s.setStroke(t,o.__strokeWidth*e,o),wc(i,s))}function vc(t,e,i,s){const o=s.getSameCanvas(!0,!0);o.font=i.__.__font,yc(t,2,i,o),o.blendMode="outside"===e?"destination-out":"destination-in",pc(i,o),o.blendMode="normal",Un.copyCanvasByWorld(i,s,o),o.recycle(i.__nowWorld)}function wc(t,e){let i,s=t.__.__textDrawData;const{rows:o,decorationY:n}=s;for(let t=0,s=o.length;t<s;t++)i=o[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(n){const{decorationHeight:t}=s;o.forEach(i=>n.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function xc(t,e,i,s,o){let n;const r=s.__,{__hasMultiStrokeStyle:a}=r;a||o.setStroke(void 0,r.__strokeWidth*e,r);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!Mh.checkImage(s,o,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?o.setStroke(n.style,r.__getRealStrokeWidth(t)*e,r,t):o.setStroke(n.style,r.__strokeWidth*e,r)}else o.strokeStyle=n.style;n.blendMode?(o.saveBlendMode(n.blendMode),i?wc(s,o):o.stroke(),o.restoreBlendMode()):i?wc(s,o):o.stroke()}}function bc(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)mc(t,e,i);else switch(s.strokeAlign){case"center":kc(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),kc(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)kc(t,2,e,i);else{const{renderBounds:o}=e.__layout,n=i.getSameCanvas(!0,!0);e.__drawRenderPath(n),kc(t,2,e,n),n.clipUI(s),n.clearWorld(o),Un.copyCanvasByWorld(e,i,n),n.recycle(e.__nowWorld)}}(t,e,i)}}function kc(t,e,i,s){const o=i.__;_(t)?xc(t,e,!1,i,s):(s.setStroke(t,o.__strokeWidth*e,o),s.stroke()),o.__useArrow&&Ah.strokeArrow(t,i,s)}const{getSpread:Ec,getOuterOf:Sc,getByMove:Bc,getIntersectData:Tc}=Rt;let Rc;const{stintSet:Cc}=f,{hasTransparent:Oc}=Oh;function Pc(t,e,i){if(!_(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:o}=i.__layout;switch(e.type){case"image":s=Mh.image(i,t,e,o,!Rc||!Rc[e.url]);break;case"linear":s=Dh.linearGradient(e,o);break;case"radial":s=Dh.radialGradient(e,o);break;case"angular":s=Dh.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:Oh.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:Oh.string(e)})}if(s){if(a(s.style)&&Oc(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 Lc={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];u(a)||(a=[a]),Rc=Mh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=Pc(t,a[o],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)&&(o=!0),n=!0),"fill"===t?(Cc(i,"__isAlphaPixelFill",o),Cc(i,"__isTransparentFill",n)):(Cc(i,"__isAlphaPixelStroke",o),Cc(i,"__isTransparentStroke",n),Cc(i,"__hasMultiStrokeStyle",r))},fill:function(t,e,i){i.fillStyle=t,fc(e,i)},fills:function(t,e,i){let s;for(let o=0,n=t.length;o<n;o++){if(s=t[o],s.image){if(Mh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!o&&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:o}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&o>1)&&i.scale(1/t,1/o)}s.blendMode&&(i.blendMode=s.blendMode),fc(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),fc(e,i),i.restoreBlendMode()):fc(e,i)}},fillPathOrText:fc,fillText:pc,stroke:bc,strokes:function(t,e,i){bc(t,e,i)},strokeText:mc,drawTextStroke:wc,shape:function(e,i,s){const o=i.getSameCanvas(),n=e.__nowWorld,r=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=e.getRenderScaleData(!0);if(r.includes(n))c=o,a=d=n;else{const{renderShapeSpread:o}=e.__layout;let g;if(t.fullImageShadow)g=n;else{const t=o?Ec(r,u===_?o*u:[o*_,o*u]):r;g=Tc(t,n)}l=r.getFitMatrix(g);let{a:p,d:f}=l;l.a<1&&(c=i.getSameCanvas(),e.__renderShape(c,s),u*=p,_*=f),d=Sc(n,l),a=Bc(d,-l.e,-l.f);const m=s.matrix;m?(h=new et(l),h.multiply(m),p*=m.scaleX,f*=m.scaleY):h=l,h.withScale(p,f),s=Object.assign(Object.assign({},s),{matrix:h})}return e.__renderShape(o,s),{canvas:o,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let Ac={},Mc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Dc,rotateOfOuter:Fc,translate:Ic,scaleOfOuter:Wc,multiplyParent:zc,scale:Nc,rotate:Yc,skew:Xc}=I;function Hc(t,e,i,s,o,n,r){const a=Dc();Ic(a,e.x+i,e.y+s),Nc(a,o,n),r&&Fc(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a}function Vc(t,e,i,s,o,n,r,a,h){const l=Dc();Uc(l,e,i,s,o,n,r,a),h&&(Mc.a=e.width/h.width,Mc.d=e.height/h.height,zc(l,Mc)),t.transform=l}function jc(t,e,i,s,o,n,r,a,h,l,d,c){const u=Dc();if(c)Uc(u,e,o,n,r,a,h,l);else{if(h)if("center"===d)Fc(u,{x:i/2,y:s/2},h);else switch(Yc(u,h),h){case 90:Ic(u,s,0);break;case 180:Ic(u,i,s);break;case 270:Ic(u,0,i)}Ac.x=e.x+o,Ac.y=e.y+n,Ic(u,Ac.x,Ac.y),r&&Wc(u,Ac,r,a)}t.transform=u}function Uc(t,e,i,s,o,n,r,a){r&&Yc(t,r),a&&Xc(t,a.x,a.y),o&&Nc(t,o,n),Ic(t,e.x+i,e.y+s)}const{get:Gc,translate:Kc}=I,qc=new Lt,Zc={},Jc={};function Qc(t,e,i,s){const{changeful:o,sync:n,scaleFixed:r}=i;o&&(t.changeful=o),n&&(t.sync=n),r&&(t.scaleFixed=r),t.data=$c(i,s,e)}function $c(t,e,i){t.padding&&(e=qc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:o}=i;const{opacity:n,mode:r,align:h,offset:l,scale:d,size:c,rotation:u,skew:g,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:r},x="center"!==h&&(u||0)%180==90;let k,E;switch(Rt.set(Jc,0,0,x?o:s,x?s:o),r&&"cover"!==r&&"fit"!==r?((d||c)&&(b.getScaleData(d,c,i,Zc),k=Zc.scaleX,E=Zc.scaleY),(h||m||f)&&(k&&Rt.scale(Jc,k,E,!0),h&&ct.toPoint(h,Jc,e,Jc,!0,!0))):v&&!u||(k=E=Rt.getFitScale(e,Jc,"fit"!==r),Rt.put(e,i,h,k,!1,Jc),Rt.scale(Jc,k,E,!0)),l&&K.move(Jc,l),r){case"stretch":v||(s=e.width,o=e.height);break;case"normal":case"clip":(Jc.x||Jc.y||k||p||u||g)&&Vc(w,e,Jc.x,Jc.y,k,E,u,g,t.clipSize);break;case"repeat":(!v||k||u||g)&&jc(w,e,s,o,Jc.x,Jc.y,k,E,u,g,h,t.freeTransform),f||(w.repeat="repeat");const i=_(f);(m||i)&&(w.gap=function(t,e,i,s,o){let n,r;_(t)?(n=t.x,r=t.y):n=r=t;return{x:tu(n,i,o.width,e&&e.x),y:tu(r,s,o.height,e&&e.y)}}(m,i&&f,Jc.width,Jc.height,e));break;default:k&&Hc(w,e,Jc.x,Jc.y,k,E,u)}return w.transform||(e.x||e.y)&&(w.transform=Gc(),Kc(w.transform,e.x,e.y)),k&&"stretch"!==r&&(w.scaleX=k,w.scaleY=E),w.width=s,w.height=o,n&&(w.opacity=n),y&&(w.filters=y),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function tu(t,e,i,s){const o=a(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let eu,iu=new Lt;const{isSame:su}=Rt;function ou(t,e,i,s,o,n){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 o.data||Qc(o,s,i,n),!0}function nu(t,e){hu(t,Er.LOAD,e)}function ru(t,e){hu(t,Er.LOADED,e)}function au(t,e,i){e.error=i,t.forceUpdate("surface"),hu(t,Er.ERROR,e)}function hu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Er(e,i))}function lu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:du,scale:cu,copy:uu}=I,{floor:_u,ceil:gu,max:pu,abs:fu}=Math;function mu(e,i,s){let{scaleX:o,scaleY:n}=e.getRenderScaleData(!0,i.scaleFixed);const r=o+"-"+n+"-"+s;if(i.patternId===r||e.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:_,scaleY:g,transform:p,repeat:f,gap:m}=h;o*=s,n*=s,_&&(_=fu(_),g=fu(g),d=du(),uu(d,p),cu(d,1/_,1/g),o*=_,n*=g),c*=o,u*=n;const y=c*u;if(!f&&y>t.image.maxCacheSize)return!1;let v=t.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/gu(t))}else{const t=a.width*a.height;v>t&&(v=t)}y>v&&(l=Math.sqrt(y/v)),l&&(o/=l,n/=l,c/=l,u/=l),_&&(o/=_,n/=g);const w=m&&m.x*o,x=m&&m.y*n;if(p||1!==o||1!==n){const t=c+(w||0),e=u+(x||0);o/=t/pu(_u(t),1),n/=e/pu(_u(e),1),d||(d=du(),p&&uu(d,p)),cu(d,1/o,1/n)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,x,e.leafer&&e.leafer.config.smooth),k=a.getPattern(b,f||t.origin.noRepeat||"no-repeat",d,i);return i.style=k,i.patternId=r,!0}}const yu={image:function(t,e,i,s,o){let n,r;const a=Io.get(i);return eu&&i===eu.paint&&su(s,eu.boxBounds)?n=eu.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),eu=a.use>1?{leafPaint:n,paint:i,boxBounds:iu.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(ou(t,e,i,a,n,s),o&&(nu(t,r),ru(t,r))):a.error?o&&au(t,r,a.error):(o&&(lu(t,!0),nu(t,r)),n.loadId=a.load(()=>{lu(t,!1),t.destroyed||(ou(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),ru(t,r)),n.loadId=void 0},e=>{lu(t,!1),au(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(e,i,s,o){const{scaleX:n,scaleY:r}=e.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===n+"-"+r+"-"+a&&!Wh.running)return!1;if(o)if(h.repeat)o=!1;else if(!(s.changeful||"miniapp"===t.name&&Pr.isResizing(e)||Wh.running)){let{width:e,height:i}=h;e*=n*a,i*=r*a,h.scaleX&&(e*=h.scaleX,i*=h.scaleY),o=e*i>t.image.maxCacheSize}return o?(e.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(e,i,s,h),!0):(!s.style||s.sync||Wh.running?mu(e,s,a):s.patternTask||(s.patternTask=Io.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(e.__nowWorld)&&mu(e,s,a),e.forceUpdate("surface")}),300)),!1)},createPattern:mu,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,Io.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],u(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createData:Qc,getPatternData:$c,fillOrFitMode:Hc,clipMode:Vc,repeatMode:jc},{toPoint:vu}=ht,{hasTransparent:wu}=Oh,xu={},bu={};function ku(t,e,i,s){if(i){let o,n,r,h;for(let t=0,l=i.length;t<l;t++)o=i[t],a(o)?(r=t/(l-1),n=Oh.string(o,s)):(r=o.offset,n=Oh.string(o.color,s)),e.addColorStop(r,n),!h&&wu(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Eu,getDistance:Su}=K,{get:Bu,rotateOfOuter:Tu,scaleOfOuter:Ru}=I,{toPoint:Cu}=ht,Ou={},Pu={};function Lu(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Eu(e,i);n=Bu(),o?(Ru(n,e,r/a*(s||1),1),Tu(n,e,t+90)):(Ru(n,e,1,r/a*(s||1)),Tu(n,e,t))}return n}const{getDistance:Au}=K,{toPoint:Mu}=ht,Du={},Fu={};const Iu={linearGradient:function(e,i){let{from:s,to:o,type:n,opacity:r}=e;vu(s||"top",i,xu),vu(o||"bottom",i,bu);const a=t.canvas.createLinearGradient(xu.x,xu.y,bu.x,bu.y),h={type:n,style:a};return ku(h,a,e.stops,r),h},radialGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Cu(s||"center",i,Ou),Cu(o||"bottom",i,Pu);const h=t.canvas.createRadialGradient(Ou.x,Ou.y,0,Ou.x,Ou.y,Su(Ou,Pu)),l={type:n,style:h};ku(l,h,e.stops,r);const d=Lu(i,Ou,Pu,a,!0);return d&&(l.transform=d),l},conicGradient:function(e,i){let{from:s,to:o,type:n,opacity:r,stretch:a}=e;Mu(s||"center",i,Du),Mu(o||"bottom",i,Fu);const h=t.conicGradientSupport?t.canvas.createConicGradient(0,Du.x,Du.y):t.canvas.createRadialGradient(Du.x,Du.y,0,Du.x,Du.y,Au(Du,Fu)),l={type:n,style:h};ku(l,h,e.stops,r);const d=Lu(i,Du,Fu,a||1,t.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Lu},{copy:Wu,toOffsetOutBounds:zu}=Rt,Nu={},Yu={};function Xu(e,i,s,o){const{bounds:n,shapeBounds:r}=o;if(t.fullImageShadow){if(Wu(Nu,e.bounds),Nu.x+=i.x-r.x,Nu.y+=i.y-r.y,s){const{fitMatrix:t}=o;Nu.x-=(n.x+(t?t.e:0)+n.width/2)*(s-1),Nu.y-=(n.y+(t?t.f:0)+n.height/2)*(s-1),Nu.width*=s,Nu.height*=s}e.copyWorld(o.canvas,e.bounds,Nu)}else s&&(Wu(Nu,i),Nu.x-=i.width/2*(s-1),Nu.y-=i.height/2*(s-1),Nu.width*=s,Nu.height*=s),e.copyWorld(o.canvas,r,s?Nu:i)}const{toOffsetOutBounds:Hu}=Rt,Vu={};const ju={shadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),g=a.length-1;zu(l,Yu),a.forEach((a,p)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Yu.offsetX+a.x*c*f,Yu.offsetY+a.y*u*f,a.blur*c*f,Oh.string(a.color)),o=a.spread?1+2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Xu(_,Yu,o,i),s=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),s=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(i.canvas,d,l,"destination-out")),Fh.isTransformShadow(a)?Fh.renderTransformShadow(t,e,_,s,a):Un.copyCanvasByWorld(t,e,_,s,a.blendMode),g&&p<g&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n,__layout:r}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),g=a.length-1;Hu(l,Vu),a.forEach((a,p)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Vu.offsetX+a.x*c*f,Vu.offsetY+a.y*u*f,a.blur*c*f),o=a.spread?1-2*a.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0))*f:0,Xu(_,Vu,o,i),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,l,"source-out"),s=l),_.fillWorld(s,Oh.string(a.color),"source-in"),Un.copyCanvasByWorld(t,e,_,s,a.blendMode),g&&p<g&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},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:Uu}=tr;let Gu;function Ku(t,e,i,s,o,n,r,a){switch(e){case"grayscale":Gu||(Gu=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);Zu(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":Zu(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function qu(t){return t.getSameCanvas(!1,!0)}function Zu(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}kl.prototype.__renderMask=function(t,e){let i,s,o,n,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&&(Ku(this,r,t,o,s,n,void 0,!0),s=o=null),n=i.__.opacity,Gu=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=qu(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=qu(t)),o||(o=qu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||Uu(i,e)||i.__render(t,e);continue}const d=1===n&&i.__.__blendMode;d&&Ku(this,r,t,o,s,n,void 0,!1),Uu(i,e)||i.__render(o||t,e),d&&Ku(this,r,t,o,s,n,d,!1)}Ku(this,r,t,o,s,n,void 0,!0)};const Ju=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Qu=Ju+"_#~&*+\\=|≮≯≈≠=…",$u=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 t_(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const e_=t_("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),i_=t_("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),s_=t_(Ju),o_=t_(Qu),n_=t_("- —/~|┆·");var r_;!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"}(r_||(r_={}));const{Letter:a_,Single:h_,Before:l_,After:d_,Symbol:c_,Break:u_}=r_;function __(t){return e_[t]?a_:n_[t]?u_:i_[t]?l_:s_[t]?d_:o_[t]?c_:$u.test(t)?h_:a_}const g_={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function p_(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:f_}=g_,{Letter:m_,Single:y_,Before:v_,After:w_,Symbol:x_,Break:b_}=r_;let k_,E_,S_,B_,T_,R_,C_,O_,P_,L_,A_,M_,D_,F_,I_,W_,z_,N_=[];function Y_(t,e){P_&&!O_&&(O_=P_),k_.data.push({char:t,width:e}),S_+=e}function X_(){B_+=S_,k_.width=S_,E_.words.push(k_),k_={data:[]},S_=0}function H_(){F_&&(I_.paraNumber++,E_.paraStart=!0,F_=!1),P_&&(E_.startCharSize=O_,E_.endCharSize=P_,O_=0),E_.width=B_,W_.width?f_(E_):z_&&V_(),N_.push(E_),E_={words:[]},B_=0}function V_(){B_>(I_.maxWidth||0)&&(I_.maxWidth=B_)}const{top:j_,right:U_,bottom:G_,left:K_}=nt;function q_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const Z_={getDrawData:function(e,i){a(e)||(e=String(e));let s=0,o=0,n=i.__getInput("width")||0,r=i.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=i;d&&(n?(s=d[K_],n-=d[U_]+d[K_]):i.autoSizeAlign||(s=d[K_]),r?(o=d[j_],r-=d[j_]+d[G_]):i.autoSizeAlign||(o=d[j_]));const c={bounds:{x:s,y:o,width:n,height:r},rows:[],paraNumber:0,font:t.canvas.font=l};return function(e,i,s){I_=e,N_=e.rows,W_=e.bounds,z_=!W_.width&&!s.autoSizeAlign;const{__letterSpacing:o,paraIndent:n,textCase:r}=s,{canvas:a}=t,{width:h,height:l}=W_;if(h||l||o||"none"!==r){const t="none"!==s.textWrap,e="break"===s.textWrap;F_=!0,A_=null,O_=C_=P_=S_=B_=0,k_={data:[]},E_={words:[]},o&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)R_=i[s],"\n"===R_?(S_&&X_(),E_.paraEnd=!0,H_(),F_=!0):(L_=__(R_),L_===m_&&"none"!==r&&(R_=p_(R_,r,!S_)),C_=a.measureText(R_).width,o&&(o<0&&(P_=C_),C_+=o),M_=L_===y_&&(A_===y_||A_===m_)||A_===y_&&L_!==w_,D_=!(L_!==v_&&L_!==y_||A_!==x_&&A_!==w_),T_=F_&&n?h-n:h,t&&h&&B_+S_+C_>T_&&(e?(S_&&X_(),B_&&H_()):(D_||(D_=L_===m_&&A_==w_),M_||D_||L_===b_||L_===v_||L_===y_||S_+C_>T_?(S_&&X_(),B_&&H_()):B_&&H_()))," "===R_&&!0!==F_&&B_+S_===0||(L_===b_?(" "===R_&&S_&&X_(),Y_(R_,C_),X_()):M_||D_?(S_&&X_(),Y_(R_,C_)):Y_(R_,C_)),A_=L_);S_&&X_(),B_&&H_(),N_.length>0&&(N_[N_.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{I_.paraNumber++,B_=a.measureText(t).width,N_.push({x:n||0,text:t,width:B_,paraStart:!0}),z_&&V_()})}(c,e,i),d&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":q_(e,"x",t[K_]);break;case"right":q_(e,"x",-t[U_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":q_(e,"y",t[j_]);break;case"bottom":q_(e,"y",-t[G_])}}(d,c,i,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:g,width:p,height:f}=s,m=n*o+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,n),o>1&&(t.overflow=o);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=p||u?p:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=_,v.width<p||v.width>p&&!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+=n,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&&p&&p<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:o,paraIndent:n,letterSpacing:r}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=i&&("justify"===o||"both"===o)&&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"!==o||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,n),c.overflow&&function(e,i,s,o){if(!o)return;const{rows:n,overflow:r}=e;let{textOverflow:a}=i;if(n.splice(r),a&&"show"!==a){let e,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?t.canvas.measureText(a).width:0,d=s+o-l;("none"===i.textWrap?n:[n[r-1]]).forEach(t=>{if(t.isOverflow&&t.data){let i=t.data.length-1;for(let s=i;s>-1&&(e=t.data[s],h=e.x+e.width,!(s===i&&h<d));s--){if(h<d&&" "!==e.char||!s){t.data.splice(s+1),t.width-=e.width;break}t.width-=e.width}t.width+=l,t.data.push({char:a,x:h}),t.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(t)}})}}(c,i,s,n),"none"!==h&&function(t,e){let i,s=0;const{fontSize:o,textDecoration:n}=e;switch(t.decorationHeight=o/11,_(n)?(i=n.type,n.color&&(t.decorationColor=Oh.string(n.color)),n.offset&&(s=Math.min(.3*o,Math.max(n.offset,.15*-o)))):i=n,i){case"under":t.decorationY=[.15*o+s];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+s,.35*-o]}}(c,i),c}};const J_={string:function(t,e){const i=l(e)&&e<1;if(a(t)){if(!i||!Oh.object)return t;t=Oh.object(t)}let s=n(t.a)?1:t.a;i&&(s*=e);const o=t.r+","+t.g+","+t.b;return 1===s?"rgb("+o+")":"rgba("+o+","+s+")"}};Object.assign(Ch,Z_),Object.assign(Oh,J_),Object.assign(Ah,Lc),Object.assign(Mh,yu),Object.assign(Dh,Iu),Object.assign(Fh,ju),Object.assign(jt,{interaction:(t,e,i,s)=>new gc(t,e,i,s),hitCanvas:(t,e)=>new oh(t,e),hitCanvasManager:()=>new Qd}),Bl.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&ah(0,wx)}catch(t){}function Q_(t){return t?u(t)?t:[t]:[]}class $_ extends vr{get list(){return Q_(this.value)}get oldList(){return Q_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function tg(t){return(e,i)=>{const s="_"+i;Vo(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){const n=this;if(n.config){const t="target"===i;if(t){n.setDimOthers(!1),n.setBright(!1),u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),n.single&&(n.element.syncEventer=null);const{beforeSelect:t}=n.config;if(t){const i=t({target:e});if(_(i))e=i;else if(!1===i)return}}const s=t?$_.BEFORE_SELECT:$_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new $_(s,{editor:n,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}$_.BEFORE_SELECT="editor.before_select",$_.SELECT="editor.select",$_.AFTER_SELECT="editor.after_select",$_.BEFORE_HOVER="editor.before_hover",$_.HOVER="editor.hover";const{abs:eg}=Math,{copy:ig,scale:sg}=I,{setListWithFn:og}=Rt,{worldBounds:ng}=tr,rg={a:1,b:0,c:0,d:1,e:0,f:0},ag={x:0,y:0,width:0,height:0};class hg extends bl{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?(og(ag,e,ng),t&&this.set(t),this.set(ag),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:n,strokeWidth:r,fill:h}=o,{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=eg(c.scaleX),l=eg(c.scaleY);if(ig(rg,c),rg.half=r%2,i!==l){sg(rg,1/i,1/l),t.setWorld(rg,e.matrix),t.beginPath(),o.strokeWidth=r;const{x:n,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,a*l,h*i,d*l)}else t.setWorld(rg,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=r/eg(c.scaleX);n&&(a(n)?Ah.stroke(n,this,t):Ah.strokes(n,this,t)),h&&(a(h)?Ah.fill(h,this,t):Ah.fills(h,this,t))}}o.strokeWidth=r}}destroy(){this.target=null,super.destroy()}}$t([tg(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],hg.prototype,"target",void 0);class lg extends kl{constructor(t){super(t),this.strokeArea=new Tl({strokeAlign:"center"}),this.fillArea=new Tl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const dg={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return cg([t],i,e),i}};function cg(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.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)&&o.hitSelf&&e.push(s)}s.isBranch&&cg(s.children,e,i)}}const{findOne:ug,findByBounds:_g}=dg;class gg extends kl{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 hg,this.targetStroker=new hg,this.bounds=new Lt,this.selectArea=new lg,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:o}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},o||{}))}}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:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},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(),o=new eh(_g(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.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)&&!ug(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new eh(this.editor.editBox.rect)};return ug(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):ug(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[$_.HOVER,this.onHover,this],[$_.SELECT,this.onSelect,this]]),e.on_([[kd.MOVE,this.onPointerMove,this],[kd.BEFORE_DOWN,this.onBeforeDown,this],[kd.TAP,this.onTap,this],[Bd.START,this.onDragStart,this,!0],[Bd.DRAG,this.onDrag,this],[Bd.END,this.onDragEnd,this],[Cd.MOVE,this.onAutoMove,this],[[Ld.ZOOM,Cd.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:pg,top:fg,topRight:mg,right:yg,bottomRight:vg,bottom:wg,bottomLeft:xg,left:bg}=rt,{toPoint:kg}=ht,{within:Eg,sign:Sg}=b,Bg={getScaleData(t,e,i,s,o,n,r,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:_,heightRange:g,dragBounds:p,worldBoxBounds:f}=t,{width:m,height:y}=e;n&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,w=t.scaleY/e.scaleY,x=Sg(v),b=Sg(w),k=a?v:x*u.width/m,E=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,R=(-s.x+m)/m;switch(i){case fg:c=S,h="bottom";break;case yg:d=B,h="left";break;case wg:c=T,h="top";break;case bg:d=R,h="right";break;case pg:c=S,d=R,h="bottom-right";break;case mg:c=S,d=B,h="bottom-left";break;case vg:c=T,d=B,h="top-left";break;case xg:c=T,d=R,h="top-right"}if(o)if("corner"===o&&i%2)o=!1;else{let t;switch(i){case fg:case wg:t=c;break;case bg:case yg:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const C=1!==d,O=1!==c;if(C&&(d/=k),O&&(c/=E),!r){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(kg(n||h,u,l,!0),p){const e={x:d,y:c};pl.limitScaleOf(t,l,e),d=e.x,c=e.y}if(C&&_){const e=u.width*t.scaleX;d=Eg(e*d,_)/e}if(O&&g){const e=u.height*t.scaleY;c=Eg(e*c,g)/e}return C&&Math.abs(d*f.width)<1&&(d=Sg(d)/f.width),O&&Math.abs(c*f.height)<1&&(c=Sg(c)/f.height),o&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case pg:n="bottom-right";break;case mg:n="bottom-left";break;case vg:n="top-left";break;case xg:n="top-right";break;default:n="center"}return kg(o||n,t.boxBounds,r,!0),{origin:r,rotation:K.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case fg:case pg:n={x:.5,y:0},o="bottom",a=1;break;case wg:case vg:n={x:.5,y:1},o="top",a=1;break;case bg:case xg:n={x:0,y:.5},o="right",h=1;break;case yg:case mg:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,kg(s||o,t,r,!0);const c=K.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.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 bg:t=yg;break;case pg:t=mg;break;case xg:t=vg;break;case yg:t=bg;break;case mg:t=pg;break;case vg:t=xg}if(i)switch(t){case fg:t=wg;break;case pg:t=xg;break;case mg:t=vg;break;case wg:t=fg;break;case xg:t=pg;break;case vg:t=mg}return t}},Tg={};function Rg(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return Cg(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:_,moveable:g,resizeable:p,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)||!p)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?o?_:n?c:u:v?_:y?c:u;h+=45*(Bg.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(b.formatRotation(h,!0)/2);const{url:x,x:k,y:E}=w,S=x+h;Tg[S]?i.cursor=Tg[S]:Tg[S]=i.cursor={url:Og(x,h),x:k,y:E}}function Cg(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Og(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Pg extends Al{constructor(t){super(t),this.useFastShadow=!0}}const Lg=["top","right","bottom","left"],Ag=void 0;class Mg extends kl{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return a(t)||a(e)||a(i)}constructor(t){super(),this.view=new kl,this.rect=new Pg({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Pg({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new kl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,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 Pg({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Pg({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new Pg({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:o,resizePoints:n,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=n[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||{}));o.set(this.getPointStyle(e.circle||e.rotatePoint||d[0])),s.set(Object.assign({stroke:a,strokeWidth:h,editConfig:Ag},e.rect||{}));const _=i&&this.transformTool.editTool;s.hittable=!_,s.syncEventer=_&&this.editor,_&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),Cg(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,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:o,rotation:n,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:o,circle:n,buttons:r,resizePoints:a,rotatePoints:h,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:_,rotateable:g,hideOnSmall:p,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=l(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,w,k,E={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,E),w=a[i],v=h[i],w.set(E),v.set(E),w.visible=y&&!(!_&&!g),v.visible=y&&g&&_&&!x,i%2&&(k=d[(i-1)/2],k.set(E),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));n.visible=y&&g&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=Lg.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=Lg.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Bg.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:Ag};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:o}=this,{target:n}=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)),o.x=t.x,o.y=t.y,o.point={x:n.x,y:n.y},o.bounds=Object.assign({},n.getLayoutBounds("box","local")),o.rotation=n.rotation,i&&i.includes("resize")&&(Pr.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")&&(Pr.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t)}Rg(this,t)}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),a(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onMoveEnd(t){this.moving&&this.transformTool.onMove(t),this.resetDoing()}onScale(t){this.canGesture&&(t.stop(),a(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),a(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Rg(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const o=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=o;break;case"ArrowUp":s=-o;break;case"ArrowLeft":e=-o;break;case"ArrowRight":e=o}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof pd)||t.find(t=>t instanceof pd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[Bd.START,this.onDragStart,this],[Bd.DRAG,this.onDrag,this],[Bd.END,this.onDragEnd,this],[kd.ENTER,e=>{this.enterPoint=t,Rg(this,e)}],[kd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[kd.DOUBLE_TAP,this.onDoubleTap,this],[kd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[Ad.HOLD,Ad.UP],this.onKey,this],[Ad.DOWN,this.onArrow,this],[Cd.BEFORE_MOVE,this.onMove,this,!0],[Ld.BEFORE_ZOOM,this.onScale,this,!0],[Od.BEFORE_ROTATE,this.onRotate,this,!0],[Cd.END,this.onMoveEnd,this],[Ld.END,this.resetDoing,this],[Od.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Dg={x:0,y:0,width:1e5,height:1e5};class Fg extends bl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Dg),Object.assign(this.__world,Dg)}__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 Ig='\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"/>',Wg={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${Ig}\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${Ig}\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${Ig}\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},zg=new Lt;function Ng(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{zg.setListWithFn(i,t=>t.getBounds("box","page")),0===zg.width&&(zg.width=.1),0===zg.height&&(zg.height=.1),e.reset(zg.get())}),s.add(e)}const Yg=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Xg=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Hg={group(t,e,i){t.sort(Xg);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new kl(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(Yg);const r=new et(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},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(Yg),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Xg),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},Vg=It.get("EditToolCreator");function jg(){return t=>{Gg.register(t)}}const Ug=jg,Gg={list:{},register(t){const{tag:e}=t.prototype;Kg[e]&&Vg.repeat(e),Kg[e]=t},get:(t,e)=>new Kg[t](e)},{list:Kg}=Gg;class qg extends $_{constructor(t,e){super(t,e)}}qg.BEFORE_OPEN="innerEditor.before_open",qg.OPEN="innerEditor.open",qg.BEFORE_CLOSE="innerEditor.before_close",qg.CLOSE="innerEditor.close";class Zg extends $_{constructor(t,e){super(t,e)}}Zg.BEFORE_GROUP="editor.before_group",Zg.GROUP="editor.group",Zg.BEFORE_UNGROUP="editor.before_ungroup",Zg.UNGROUP="editor.ungroup",Zg.BEFORE_OPEN="editor.before_open_group",Zg.OPEN="editor.open_group",Zg.BEFORE_CLOSE="editor.before_close_group",Zg.CLOSE="editor.close_group";const{updateMatrix:Jg}=Un,Qg={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},$g="top-left";class tp extends Tl{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&&Qg[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,Jg(this.parent),Jg(this);const a=new et(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Jg(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf($g,n);break;case"scaleX":t.scaleOf($g,n,1);break;case"scaleY":t.scaleOf($g,1,n);break;case"skewX":t.skewOf($g,n,0);break;case"skewY":t.skewOf($g,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class ep extends $_{constructor(t,e){super(t,e)}}ep.BEFORE_MOVE="editor.before_move",ep.MOVE="editor.move";class ip extends $_{constructor(t,e){super(t,e)}}ip.BEFORE_SCALE="editor.before_scale",ip.SCALE="editor.scale";class sp extends $_{constructor(t,e){super(t,e)}}sp.BEFORE_ROTATE="editor.before_rotate",sp.ROTATE="editor.rotate";class op extends $_{constructor(t,e){super(t,e)}}op.BEFORE_SKEW="editor.before_skew",op.SKEW="editor.skew";class np{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:n}=i;const r=t.type===Cd.END||t.type===Bd.END,h=a(e.draggable),d=!n||r||h;if(t instanceof Cd)o=t.getLocalMove(e),d&&Bd.limitMove(e,o);else{const i={x:t.totalX,y:t.totalY};t.shiftKey&&(Math.abs(i.x)>Math.abs(i.y)?i.y=0:i.x=0),o=Bd.getValidMove(e,s.point,i,d)}(o.x||o.y)&&(n&&!h&&r?Un.animateMove(this,o,l(n)?n:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let{around:n,lockRatio:r,flipable:a,editSize:h}=i;if(t instanceof Ld)this.scaleOf(e.getBoxPoint(t),t.scale,t.scale);else{const{direction:i}=t.current;(t.shiftKey||e.lockRatio)&&(r=!0);const l=Bg.getScaleData(e,o.bounds,i,t.getInnerTotal(e),r,Bg.getAround(n,t.altKey),a,!s||"scale"===h);this.editTool&&this.editTool.onScaleWithDrag?(l.drag=t,this.scaleWithDrag(l)):this.scaleOf(l.origin,l.scaleX,l.scaleY)}}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r}=i,{direction:a}=t.current;let h,l;if(t instanceof Od)l=t.rotation,h=n?ht.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=Bg.getRotateData(e,a,t,s,t.shiftKey?null:n||e.around||e.origin||o||"center");l=s.rotation+i.rotation-e.rotation,h=i.origin}l=b.float(b.getGapRotation(l,r,e.rotation),2),l&&this.rotateOf(h,l)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=Bg.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Bg.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;_(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(_(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new ep(ep.BEFORE_MOVE,h));const l=new ep(ep.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:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new ip(ip.BEFORE_SCALE,t));const n=new ip(ip.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if(_(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.scaleOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new ip(ip.BEFORE_SCALE,c));const u=new ip(ip.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new et(Un.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new ip(ip.BEFORE_SCALE,r));const a=new ip(ip.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(l(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new sp(sp.BEFORE_ROTATE,d));const c=new sp(sp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if(_(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.skewOf(t,e,i))),c={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new op(op.BEFORE_SKEW,c));const u=new op(op.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(Un.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new et(e.worldTransform);return t(),new et(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let rp=class extends kl{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 eh,this.openedGroupList=new eh,this.simulateTarget=new tp(this),this.editBox=new Mg(this),this.editToolList={},this.selector=new gg(this),this.editMask=new Fg(this),this.targetEventIds=[];let i=f.clone(Wg);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Vt.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?u(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>f.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&&Ng(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(a(s))e=s;else if(!1===s)return}if(Gg.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||Gg.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(Zg.BEFORE_GROUP),this.target=Hg.group(this.list,this.element,t),this.emitGroupEvent(Zg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Zg.BEFORE_UNGROUP,t)),this.target=Hg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Zg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Zg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Zg.OPEN,t)}closeGroup(t){this.emitGroupEvent(Zg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Zg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Un.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 Zg(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(a(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(a(i))s=i;else if(!1===i)return}Gg.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||Gg.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(qg.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(qg.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(qg.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(qg.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new qg(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&&(Hg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Hg.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_(Mr.START,this.onRenderStart,this),i&&i.on_(br.SCROLL,this.onChildScroll,this),t.on_(Mr.CHILD_START,this.onAppRenderStart,this),t.on_(Dr.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())}};$t([(t,e)=>{Vo(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:o}=this,a=Object.assign({},t);return e&&e.editConfig&&Object.assign(a,e.editConfig),s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),n(a.dragLimitAnimate)&&(a.dragLimitAnimate=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],rp.prototype,"mergeConfig",void 0),$t([tg(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof eh?i:new eh(i),t.multiple&&Ng(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new $_($_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new $_($_.AFTER_SELECT,s))})],rp.prototype,"target",void 0),$t([tg(function(t,e){t.emitEvent(new $_($_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],rp.prototype,"hoverTarget",void 0),rp=$t([Ln(np,["editBox","editTool","emitEvent"])],rp);class ap{static registerInnerEditor(){Gg.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 kl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let hp=class extends ap{static registerEditTool(){Gg.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,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()}};hp=$t([jg()],hp);const{left:lp,right:dp}=rt,{move:cp,copy:up,toNumberPoints:_p}=K;let gp=class extends hp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===lp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.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=_p(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(cp(t,n,r),s&&cp(e,-n,-r)):(s&&cp(t,-n,-r),cp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),up(s[7],i),up(e[7],i),up(s[3],a),up(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===lp||t===dp,s[t].visible=a,e[t].visible=!r&&a}};gp=$t([jg()],gp);const{M:pp,L:fp,C:mp,Q:yp,Z:vp,N:wp,D:xp,X:bp,G:kp,F:Ep,O:Sp,P:Bp,U:Tp}=me,Rp={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case pp:case fp:Cp(t,e,i,o,1),o+=3;break;case mp:Cp(t,e,i,o,3),o+=7;break;case yp:Cp(t,e,i,o,2),o+=5;break;case vp:o+=1;break;case wp:Cp(t,e,i,o,2),o+=5;break;case xp:Cp(t,e,i,o,2),o+=9;break;case bp:Cp(t,e,i,o,2),o+=6;break;case kp:Cp(t,e,i,o,2),o+=9;break;case Ep:Cp(t,e,i,o,2),o+=5;break;case Sp:t[o]=kp,t.splice(o+4,0,t[o+3],0),Cp(t,e,i,o,2),o+=9,n+=2;break;case Bp:t[o]=Ep,t.splice(o+4,0,t[o+3]),Cp(t,e,i,o,2),o+=5,n+=1;break;case Tp:Cp(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:Cp}=Rp,Op=I.get(),{topLeft:Pp,top:Lp,topRight:Ap,right:Mp,bottom:Dp,left:Fp}=rt;function Ip(t,e,i){t.pathInputed?zp(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Wp(t,e,i,s){let o=e;if(!n(s)){const n=t.__layout;let{width:r,height:a}=n.boxBounds;switch(r*=i-e,a*=e-i,s){case Lp:case Dp:o=i,n.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case Fp:case Mp:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Pp:case Ap:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=o;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*o):a*o),r.__autoWidth||(t.width*=o),r.__autoHeight||(t.height*=o)}function zp(t,e,i){Rp.scale(t.__.path,e,i),t.path=t.__.path}function Np(t,e,i){const{points:s}=t;_(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):Rp.scalePoints(s,e,i),t.points=s}function Yp(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)Op.a=e,Op.d=i,s[t].transform(Op,!0)}const Xp=Va.prototype;function Hp(t,e,i){Vp(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(Cd.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(Cd.END,e=>{Un.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(Ld.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function Vp(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}Xp.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))},Xp.__scaleResize=function(t,e){Ip(this,t,e)},Xp.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Xp.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},pd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)Wp(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),Ip(this,t,e)}},fd.prototype.__scaleResize=function(t,e){zp(this,t,e)},ad.prototype.__scaleResize=function(t,e){this.pathInputed?zp(this,t,e):this.points?Np(this,t,e):this.width*=t},Ul.prototype.__scaleResize=function(t,e){this.pathInputed?zp(this,t,e):this.points?Np(this,t,e):Ip(this,t,e)},kl.prototype.__scaleResize=function(t,e){Yp(this,t,e)},Al.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Ip(this,t,e),i&&Yp(this,t,e)},Vt.add("resize"),Vt.add("editor","resize"),jt.editor=function(t,e){const i=new rp(t);return e&&e.sky.add(e.editor=i),i},Al.addAttr("textBox",!1,Zo),bl.addAttr("editConfig",void 0,Zo),bl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),Zo),bl.addAttr("editInner","PathEditor",Zo),kl.addAttr("editInner","",Zo),pd.addAttr("editInner","TextEditor",Zo),bl.setEditConfig=function(t){this.changeAttr("editConfig",t)},bl.setEditOuter=function(t){this.changeAttr("editOuter",t)},bl.setEditInner=function(t){this.changeAttr("editInner",t)};const jp=It.get("LeaferTypeCreator"),Up={list:{},register(t,e){Gp[t]&&jp.repeat(t),Gp[t]=e},run(t,e){const i=Gp[t];i&&i(e)}},{list:Gp,register:Kp}=Up;Kp("viewport",Hp),Kp("custom",function(t){Hp(t,null,!0)}),Kp("design",function(t){Hp(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),Kp("document",function(t){Hp(t,{zoom:{min:1},move:{scroll:"limit"}})});const qp={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),o=K.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=K.getDistance(e.from,i.from);return{move:n,scale:K.getDistance(e.to,i.to)/r,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:o}}},{abs:Zp,max:Jp}=Math,{sign:Qp,within:$p}=b,tf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=Zp(s),r=Zp(o);return n>50&&(s=Jp(50,n/3)*Qp(s)),r>50&&(o=Jp(50,r/3)*Qp(o)),{x:-s*i*2,y:-o*i*2}},getScale(e,i){let s,o=1,{zoomMode:n,zoomSpeed:r}=i;const a=e.deltaY||e.deltaX;if(n?(s="mouse"===n||!e.deltaX&&(t.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(e.shiftKey||e.metaKey||e.ctrlKey)&&(s=!0)):s=!e.shiftKey&&(e.metaKey||e.ctrlKey),s){r=$p(r,0,1);const t=e.deltaY?i.delta.y:i.delta.x,s=$p(1-Zp(a)/(4*t)*r,.5,2);o=a>0?s:1/s}return o}};class ef{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Cd.START,this.moveData)),t.path=this.moveData.path,e.emit(Cd.BEFORE_MOVE,t),e.emit(Cd.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Ld.START,this.zoomData)),t.path=this.zoomData.path,e.emit(Ld.BEFORE_ZOOM,t),e.emit(Ld.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(Od.START,this.rotateData)),t.path=this.rotateData.path,e.emit(Od.BEFORE_ROTATE,t),e.emit(Od.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(Cd.END,e),i&&t.emit(Ld.END,i),s&&t.emit(Od.END,s),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const sf=Bl.prototype,of=new Lt,nf=new $;function rf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function af(t,e){return Object.assign(Object.assign({},e),{scale:t})}sf.initType=function(t){Up.run(t,this)},sf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if(nf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?nf.y=0:t.includes("y")?nf.x=0:Math.abs(nf.x)>Math.abs(nf.y)?nf.y=0:nf.x=0,i&&t.includes("limit")&&(of.set(this.__world).addPoint(this.zoomLayer),pl.getValidMove(of,this.canvas.bounds,"inner",nf,!0),t.includes("x")?nf.y=0:t.includes("y")&&(nf.x=0))}return{x:o?0:nf.x,y:o?0:nf.y}},sf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const hf=Zd.prototype;hf.createTransformer=function(){this.transformer=new ef(this)},hf.move=function(t){this.transformer.move(t)},hf.zoom=function(t){this.transformer.zoom(t)},hf.rotate=function(t){this.transformer.rotate(t)},hf.transformEnd=function(){this.transformer.transformEnd()},hf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):tf.getScale(t,e);if(1!==n)this.zoom(af(n,t));else{const s=e.getMove?e.getMove(t,e):tf.getMove(t,e);i.snap&&K.round(s),this.move(rf(s,t))}},hf.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:o,center:n}=qp.getData(e);Object.assign(t,n),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(af(o,t)),this.move(rf(i,t))};const lf=Nd.prototype,{abs:df}=Math;function cf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}lf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=df(i),n=df(s),r=e?1:.1,a=this.canAnimate&&this.moving&&(o>r||n>r)&&this.interaction.m.dragAnimate;if(a){const r="touch"===t.pointerType?3:1,h=70;o*(e=e?l(a)?a:.95:r)>h?e=h/o:n*e>h&&(e=h/n),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},lf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},lf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},lf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Rt.maxX(r),d=Rt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let _=0,g=0;this.autoMoveTimer=setInterval(()=>{_+=c,g+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:_,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},lf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Vt.add("viewport"),Vt.add("view"),Bl.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),g(e)?(o=e.padding,i=e.scroll,s=e.transition):o=e;const{zoomLayer:n}=this,h=this.canvas.bounds.clone().shrink(r(o)?30:o),d=new Lt,c={x:h.x+h.width/2,y:h.y+h.height/2};let p;const{x:f,y:m,scaleX:y,scaleY:v}=n.__;if(a(t))switch(t){case"in":p=cf(y,"in");break;case"out":p=cf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Lt(this.boxBounds)).height=0;break;case"fit-height":(t=new Lt(this.boxBounds)).width=0}else l(t)&&(p=t/y);if(p)p=this.getValidScale(p),n.scaleOfWorld(c,p,p,!1,s);else if(_(t)){const e={x:f,y:m,scaleX:y,scaleY:v},o=u(t);if(o||t.tag){const e=o?t:[t];d.setListWithFn(e,tr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,h);d.set(n.getWorldBounds(e))}const{width:r,height:a}=d;let l=h.x-d.x,c=h.y-d.y;return i?(l+=Math.max((h.width-r)/2,0),c+=Math.max((h.height-a)/2,0)):(p=this.getValidScale(Math.min(h.width/r,h.height/a)),l+=(h.width-r*p)/2,c+=(h.height-a*p)/2,K.scaleOf(e,d,p),d.scaleOf(d,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(l=0),K.move(e,l,c),d.move(l,c),n.set(e,s),d}return n.worldBoxBounds};class uf extends kl{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;a(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Al,this.scrollYBar=new Al),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Lt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,_=l<1,{scrollXBar:g,scrollYBar:p}=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}),p.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:_})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Bd.DRAG,this.onDrag,this),e.on_(Bd.DRAG,this.onDrag,this),t.on_(Bd.END,this.onDragEnd,this),e.on_(Bd.END,this.onDragEnd,this),this.target.on_(Mr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Pr.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 $h{}function gf(t){return Go(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,ln(this)}}}))}let pf=class extends ad{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Lh.register(t,e)}};$t([kn(_f)],pf.prototype,"__",void 0),$t([gf("angle")],pf.prototype,"endArrow",void 0),pf=$t([An()],pf);const{M:ff,L:mf,C:yf,Q:vf,O:wf}=me,{rotate:xf,copyFrom:bf,scale:kf}=K,Ef={},Sf={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case ff:case mf:Bf(t,l+1,e,i,s,o,n,r),l+=3;break;case yf:for(h=1;h<6;h+=2)Bf(t,l+h,e,i,s,o,n,r);l+=7;break;case vf:for(h=1;h<4;h+=2)Bf(t,l+h,e,i,s,o,n,r);l+=5;break;case wf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){Sf.layout(t,0,0,1,1,e,i)}};function Bf(t,e,i,s,o,n,r,a){bf(Ef,t[e],t[e+1]),r&&xf(Ef,r,a),o&&kf(Ef,o,n),t[e]=i+Ef.x,t[e+1]=s+Ef.y}const{layout:Tf,rotate:Rf}=Sf,{getAngle:Cf}=K,Of={x:-.5},Pf={connect:Of,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Lf={connect:Of,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Af={connect:Of,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},Mf={connect:Of,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},Df={offset:Of,path:[...Af.path],dashPath:[1,-2.5,0,2,-1,0]};Rf(Df.path,180,{x:-1.5,y:0});const Ff={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},If={connect:{x:.5},path:[...Ff.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Wf={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},zf={path:[...Wf.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Nf=f.clone(Wf),Yf=f.clone(zf);Rf(Nf.path,45),Rf(Yf.path,45);const Xf={angle:Pf,"angle-side":Lf,arrow:Mf,triangle:Af,"triangle-flip":Df,circle:If,"circle-line":Ff,square:zf,"square-line":Wf,diamond:Yf,"diamond-line":Nf,mark:{offset:Of,path:[1,0,-2,2,0,2]}};function Hf(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;_(e)?e.type?(h=e.scale,a=Xf[e.type]):a=e:a=Xf[e];const{offset:c,connect:u,path:g,dashPath:p}=a;let f=u?u.x:0,m=c?c.x:0;const y=[...g];return r&&p&&y.push(...p),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?m+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(m+=c.bevelJoin)),h&&Tf(y,0,0,h,h),m&&Tf(y,m,0),Tf(y,s.x,s.y,o,o,Cf(i,s)),n.x=(f+m)*o,y}const{M:Vf,L:jf,C:Uf,Q:Gf,Z:Kf,N:qf,D:Zf,X:Jf,G:Qf,F:$f,O:tm,P:em,U:im}=me,{copy:sm,copyFrom:om,getDistancePoint:nm}=K,rm={},am={},hm={},lm={},dm={},cm={list:Xf,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case Vf:case jf:(c<2||l+6>=d)&&(om(dm,n[l+1],n[l+2]),!c&&u&&sm(am,dm)),l+=3;break;case Uf:(1===c||l+7>=d-3)&&um(n,lm,dm,l+3),l+=7;break;case Gf:(1===c||l+5>=d-3)&&um(n,lm,dm,l+1),l+=5;break;case Kf:return;case qf:l+=5;break;case Zf:l+=9;break;case Jf:l+=6;break;case Qf:l+=9;break;case $f:l+=5;break;case tm:l+=7;break;case em:l+=4;break;case im:(1===c||l+6>=d-3)&&(um(n,lm,dm,l+1),l+6!==d&&(dm.x-=(dm.x-lm.x)/10,dm.y-=(dm.y-lm.y)/10)),l+=6}if(c++,1===c&&h!==Vf)return;if(2===c&&u&&sm(hm,h===jf?dm:lm),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=Hf(t,e,hm,am,s,rm,!!o);o?d.push(...i):r.push(...i),rm.x&&(nm(am,hm,-rm.x,!0),r[1]=hm.x,r[2]=hm.y)}if(i&&"none"!==i){const e=Hf(t,i,lm,dm,s,rm,!!o);if(o?d.push(...e):r.push(...e),rm.x){let t;switch(nm(dm,lm,-rm.x,!0),h){case jf:t=l-3+1;break;case Uf:t=l-7+5;break;case Gf:t=l-5+3;break;case im:t=l-6+3}t&&_m(r,lm,t)}}}else sm(lm,dm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function um(t,e,i,s){om(e,t[s],t[s+1]),om(i,t[s+2],t[s+3])}function _m(t,e,i){t[i]=e.x,t[i+1]=e.y}Vt.add("arrow"),bl.addAttr("startArrow","none",gf),bl.addAttr("endArrow","none",gf),Object.assign(Lh,cm),Object.assign(Ah,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let gm=class extends Al{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};$t([kn(class extends Zh{})],gm.prototype,"__",void 0),$t([$o("x")],gm.prototype,"flow",void 0),gm=$t([An()],gm);const pm={},fm={"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"},mm={"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 ym(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;ct.toPoint(i,e,o,pm),e.x=s.__autoWidth?o.x:pm.x,e.y=s.__autoHeight?o.y:pm.y}const{move:vm}=K;function wm(t,e,i,s,o,n){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[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),vm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function xm(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 bm={};function km(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:n,__autoHeight:r}=t.__,h=o&&(e?!n:!r);return _(i)?(bm.xGap=i.x||0,bm.yGap=i.y||0):bm.xGap=bm.yGap=c(i),bm.isAutoXGap=a(bm.xGap)&&!n,bm.isAutoYGap=a(bm.yGap)&&!r,bm.complex=h||"top-left"!==s||t.__hasGrow||bm.isAutoXGap||bm.isAutoYGap,bm.wrap=h,bm.complex&&(bm.isFitXGap="fit"===bm.xGap&&!n,bm.isFitYGap="fit"===bm.yGap&&!r,_(s)?(bm.contentAlign=s.content||"top-left",bm.rowXAlign=s.x||"from",bm.rowYAlign=s.y||"from"):(bm.contentAlign=s,bm.rowXAlign=fm[s],bm.rowYAlign=mm[s])),bm}function Em(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function Sm(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function Bm(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:Tm}=b;function Rm(t,e,i,s){let o,n,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++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=Cm(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=Cm(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function Cm(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?Tm(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:Om}=b;function Pm(t,e,i,s){let o,n,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++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=Lm(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=Lm(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function Lm(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?Om(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:Am}=K;function Mm(t,e){const i="width",{children:s,itemBox:o}=t,n=km(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:h;let g,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)g=s[m=e?h-1-n:n],g.__.inFlow&&0!==g.__.visible&&(p=Bm(g,o),r?(g.__flowBounds=p,y||(y=Em(m,_)),a&&y.count&&y.width+p.width>x&&(y.grow?Rm(t,y,x,e):d&&Sm(y,i,x,c),xm(u,y,i),y=Em(m,_)),f=p.width,g.__widthGrow&&(y.grow+=g.__widthGrow,f=0,g.__.widthRange&&(y.hasRangeSize=!0)),g.__heightGrow&&Lm(g,p,b),y.width+=y.count?f+_:f,y.height=Math.max(y.height,p.height),y.count++):(Am(g,v-p.x,w-p.y),v+=p.width+_));if(r&&y){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:_}=n;y.count&&(y.grow?Rm(t,y,x,e):d&&Sm(y,i,x,c),a&&xm(u,y,i)),a?(s?Sm(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){ym(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=fm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],wm(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,_,e)):(ym(t,y,r),wm(t,y,0,y.y,_,e))}}const{move:Dm}=K;function Fm(t,e,i,s,o,n){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[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),Dm(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:Im}=K;function Wm(t,e){const i="height",{children:s,itemBox:o}=t,n=km(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},_=d?0:l;let g,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)g=s[m=e?h-1-n:n],g.__.inFlow&&0!==g.__.visible&&(p=Bm(g,o),r?(g.__flowBounds=p,y||(y=Em(m,_)),a&&y.count&&y.height+p.height>b&&(y.grow&&Pm(t,y,b,e),d&&Sm(y,i,b,c),xm(u,y,i),y=Em(m,_)),f=p.height,g.__heightGrow&&(y.grow+=g.__heightGrow,f=0,g.__.heightRange&&(y.hasRangeSize=!0)),g.__widthGrow&&Cm(g,p,x),y.height+=y.count?f+_:f,y.width=Math.max(y.width,p.width),y.count++):(Im(g,v-p.x,w-p.y),w+=p.height+_));if(r&&y){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:_}=n;y.count&&(y.grow&&Pm(t,y,b,e),d&&Sm(y,i,b,c),a&&xm(u,y,i)),a?(s?Sm(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){ym(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=mm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,_),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],Fm(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(ym(t,y,r),Fm(t,y,y.x,0,l,e))}}function zm(t){return Go(t,t=>({set(e){const i=l(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&nn(this)}}))}Vt.add("flow","resize");const Nm=Al.prototype,{__updateBoxBounds:Ym}=kl.prototype;bl.addAttr("flow",!1,$o),bl.addAttr("gap",0,sn),bl.addAttr("flowAlign","top-left",sn),bl.addAttr("flowWrap",!1,sn),bl.addAttr("itemBox","box",sn),bl.addAttr("inFlow",!0,sn),bl.addAttr("autoWidth",void 0,zm),bl.addAttr("autoHeight",void 0,zm),bl.addAttr("autoBox",void 0,sn);const{copyAndSpread:Xm}=Rt;Nm.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:Mm(this);break;case"y":Wm(this);break;case"x-reverse":Mm(this,!0);break;case"y-reverse":Wm(this,!0)}t&&(this.leafer.created=!0)},Nm.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),Xm(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},Nm.__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():Ym.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&&Xm(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:Hm,sin:Vm,pow:jm,sqrt:Um,abs:Gm,ceil:Km,floor:qm,round:Zm,PI:Jm}=Math,Qm=5*Jm,$m=1.70158,ty=2.5949095,ey=7.5625,iy=2.75;function sy(t){return e=>jm(e,t)}function oy(t){return e=>1-jm(1-e,t)}function ny(t){return e=>e<.5?.5*jm(2*e,t):1-.5*jm(2-2*e,t)}function ry(t){return t<1/iy?ey*t*t:t<2/iy?ey*(t-=1.5/iy)*t+.75:t<2.5/iy?ey*(t-=2.25/iy)*t+.9375:ey*(t-=2.625/iy)*t+.984375}function ay(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=hy(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Gm(l)<1e-6));e++)c-=d/l;return o[r]=hy(c,e,s)}}function hy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const ly={get(t){const{list:e}=ly;return a(t)?e[t||"ease"]:_(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){ly.list[t]=e},list:{linear:t=>t,ease:ay(.25,.1,.25,1),"ease-in":ay(.42,0,1,1),"ease-out":ay(0,0,.58,1),"ease-in-out":ay(.42,0,.58,1),"sine-in":t=>1-Hm(t*Jm*.5),"sine-out":t=>Vm(t*Jm*.5),"sine-in-out":t=>.5*(1-Hm(t*Jm)),"quad-in":sy(2),"quad-out":oy(2),"quad-in-out":ny(2),"cubic-in":sy(3),"cubic-out":oy(3),"cubic-in-out":ny(3),"quart-in":sy(4),"quart-out":oy(4),"quart-in-out":ny(4),"quint-in":sy(5),"quint-out":oy(5),"quint-in-out":ny(5),"expo-in":t=>t?jm(2,10*t-10):0,"expo-out":t=>1===t?1:1-jm(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*jm(2,2*t*10-10):.5*(2-jm(2,10-2*t*10)),"circ-in":t=>1-Um(1-jm(t,2)),"circ-out":t=>Um(1-jm(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Um(1-jm(2*t,2))):.5*(Um(1-jm(2-2*t,2))+1),"back-in":t=>(($m+1)*t-$m)*t*t,"back-out":t=>(t-=1)*t*(($m+1)*t+$m)+1,"back-in-out":t=>t<.5?(t*=2)*t*((ty+1)*t-ty)*.5:.5*((t=2*t-2)*t*((ty+1)*t+ty)+2),"elastic-in":t=>0===t||1===t?t:-jm(2,10*(t-1))*Vm((t-1.1)*Qm),"elastic-out":t=>0===t||1===t?t:jm(2,-10*t)*Vm((t-.1)*Qm)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-jm(2,10*((t*=2)-1))*Vm((t-1.1)*Qm)*.5:jm(2,10*(1-(t*=2)))*Vm((t-1.1)*Qm)*.5+1,"bounce-in":t=>1-ry(1-t),"bounce-out":ry,"bounce-in-out":t=>t<.5?.5*(1-ry(1-2*t)):.5*(1+ry(2*t-1)),"cubic-bezier":ay,steps:function(t,e="floor"){return i=>("floor"===e?qm(i*t):"ceil"===e?Km(i*t):Zm(i*t))/t}}};function dy(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 cy{}cy.CREATED="created",cy.PLAY="play",cy.PAUSE="pause",cy.STOP="stop",cy.SEEK="seek",cy.UPDATE="update",cy.COMPLETED="completed";let uy=class extends Xr{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:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&l(o)&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:o,attrs:n}=this;this.easingFn=ly.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.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(cy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(cy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(cy.STOP))}seek(t){this.destroyed||(_(t)&&(t=Ph.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(cy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:o}=i,r=!(o>1)||this.join;let a,h,d,c,u,_=0,g=0;o>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<o;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),d={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:r}=h;n&&(d.swing=l(n)?n:2,u=2*d.swing-1),r&&(d.loop=u=l(r)?r:2),t?(d.duration=t,_+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,g+=e*u),i?(d.delay=i,_+=i*u):s&&(d.autoDelay=s,g+=s*u),o&&(d.easingFn=ly.get(o))}if(!d.autoDuration&&n(d.duration)&&(o>1?s>0||r?g+=u:d.duration=0:d.duration=this.duration),o>1)this.setBefore(d,c,a);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}a=c,e.push(d)}g?((this.duration<=_||!s||!s.duration)&&this.changeDuration(_+.2*g),this.allocateTime((this.duration-_)/g)):_&&this.changeDuration(_),this.emitType(cy.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:o,target:r}=this;for(let a in e)n(s[a])&&(s[a]=o[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=n(i[a])?o[a]:i[a],o[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let o=0;o<s;o++)e=i[o],n(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),t.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(cy.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,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),Nh.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(cy.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return l(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};$t([dy("ease")],uy.prototype,"easing",void 0),$t([dy(0)],uy.prototype,"delay",void 0),$t([dy(.2)],uy.prototype,"duration",void 0),$t([dy("auto")],uy.prototype,"ending",void 0),$t([dy(!1)],uy.prototype,"reverse",void 0),$t([dy(!1)],uy.prototype,"swing",void 0),$t([dy(!1)],uy.prototype,"loop",void 0),$t([dy(0)],uy.prototype,"loopDelay",void 0),$t([dy(1)],uy.prototype,"speed",void 0),$t([dy(!0)],uy.prototype,"autoplay",void 0),$t([dy()],uy.prototype,"join",void 0),$t([dy()],uy.prototype,"attrs",void 0),uy=$t([Ln($r)],uy);let _y=class extends uy{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new uy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(cy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(cy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(cy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(cy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case cy.COMPLETED:this.completed&&this.emitType(t);break;case cy.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)}};_y=$t([Ln($r)],_y);const gy={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"},py=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,fy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,my=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,yy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,vy=parseInt,wy=parseFloat,{round:xy}=Math;let by={},ky=0;function Ey(t){let e,i,s,o=1;switch(t.length){case 9:e=vy(t.slice(1,3),16),i=vy(t.slice(3,5),16),s=vy(t.slice(5,7),16),o=vy(t.slice(7,9),16)/255;break;case 7:e=vy(t.slice(1,3),16),i=vy(t.slice(3,5),16),s=vy(t.slice(5,7),16);break;case 5:e=vy(t[1]+t[1],16),i=vy(t[2]+t[2],16),s=vy(t[3]+t[3],16),o=vy(t[4]+t[4],16)/255;break;case 4:e=vy(t[1]+t[1],16),i=vy(t[2]+t[2],16),s=vy(t[3]+t[3],16);break;case 3:e=i=s=vy(t[1]+t[2],16);break;case 2:e=i=s=vy(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const Sy=1/6,By=.5,Ty=2/3,Ry=1/3;function Cy(t,e,i){return i<0?i++:i>1&&i--,i<Sy?t+6*(e-t)*i:i<By?e:i<Ty?t+(e-t)*(Ty-i)*6:t}function Oy(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=Cy(a,s,t+Ry),n=Cy(a,s,t),r=Cy(a,s,t-Ry)}return{r:xy(255*o),g:xy(255*n),b:xy(255*r),a:s}}Vt.add("color"),Oh.object=function(t,e){let i,s=!n(e)&&e<1;if(a(t)){const e=by[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=Ey(t);break;case"R":case"r":"("===t[4]&&fy.test(t)?i=function(t){const e=fy.exec(t);return{r:vy(e[1]),g:vy(e[2]),b:vy(e[3]),a:wy(e[4])}}(t):"("===t[3]&&py.test(t)&&(i=function(t){const e=py.exec(t);return{r:vy(e[1]),g:vy(e[2]),b:vy(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&yy.test(t)?i=function(t){const e=yy.exec(t);return Oy(wy(e[1]),wy(e[2]),wy(e[3]),wy(e[4]))}(t):"("===t[3]&&my.test(t)&&(i=function(t){const e=my.exec(t);return Oy(wy(e[1]),wy(e[2]),wy(e[3]),1)}(t))}if(!i){const e=gy[t.toLowerCase()];e&&(i=Ey("#"+e))}i&&(ky++,ky>1e4&&(by={},ky=0),by[t]=Object.assign({},i))}}else _(t)&&(n(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:Py}=Math,{fourNumber:Ly}=b,Ay={fill:Wy,stroke:Wy,cornerRadius:(t,e,i)=>l(t)&&l(e)?Fy(t,e,i):(t=Ly(t),e=Ly(e),t.map((t,s)=>Fy(t,e[s],i))),text(t,e,i){if(a(t)&&a(e)){const s=t.length,o=e.length,n=Fy(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return l(t)||l(e)?b.float(Fy(t,e,i),Math.max(Dy(t),Dy(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return Nh.setBetweenStyle(o,t,e,o,i,s),o},shadow:zy,innerShadow:zy},My={value:function(t,e,i){const s=l(t),o=l(e);return s&&o?t+(e-t)*i:o||s?Fy(t,e,i):t},number:Fy,color:Iy,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=Nh;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,o,n)))}};function Dy(t){const e=String(t).split(".")[1];return e?e.length:0}function Fy(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?Py(o):o}function Iy(t,e,i){t=Oh.object(t),e=Oh.object(e);const s=Fy(t.r,e.r,i,1)+","+Fy(t.g,e.g,i,1)+","+Fy(t.b,e.b,i,1),o=Fy(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function Wy(t,e,i){return a(t)&&a(e)?Iy(t,e,i):e}function zy(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Fy((t=t||{}).x,e.x,i),y:Fy(t.y,e.y,i),blur:Fy(t.blur,e.blur,i),spread:Fy(t.spread,e.spread,i),color:Iy(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}Vt.add("animate","color"),zh.canAnimate=!0,Object.assign(Nh.list,Ay),Object.assign(Nh,My);const Ny=bl.prototype;bl.addAttr("animation",void 0,function(t){return Go(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),bl.addAttr("animationOut",void 0,Zo),bl.addAttr("transition",!0,Zo),bl.addAttr("transitionOut",void 0,Zo),Ny.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))},Ny.animate=function(t,e,i,s){if(n(t))return this.__animate;let o=u(t)&&!e&&i?new _y(this,t,s):new uy(this,t,e,s);this.killAnimate(i,o.toStyle);const r=this.__animate;return r&&(o instanceof _y?o.list.unshift(r):o=new _y(this,[r,o])),this.__animate=o},Ny.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof _y&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},Ny.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(cy.COMPLETED,e)};const Yy=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Xy=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Hy}=Math,{getDerivative:Vy}=Ve,jy={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,_,g,p=0,f=h/2;for(let h=0;h<Yy.length;h++)l=f*(1+Yy[h]),d=f*(1-Yy[h]),c=Vy(l,t,i,o,r),u=Vy(l,e,s,n,a),_=Vy(d,t,i,o,r),g=Vy(d,e,s,n,a),p+=Xy[h]*(Hy(c*c+u*u)+Hy(_*_+g*g));return p*f},getRotation(t,e,i,s,o,n,r,a,h){const l=Vy(t,e,s,n,a),d=Vy(t,i,o,r,h);return Math.atan2(d,l)/E},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,_=t/e,g=d/e/3;if(_>=1)return 1;if(_<=0)return 0;for(;u-c>g;)Uy(i,s,o,n,r,a,h,l,_)<t?c=_:u=_,_=(c+u)/2;return _},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,_=d*o+e*r,g=d*n+e*a,p=d*c+e*_,f=d*u+e*g,m=d*p+e*(d*_+e*(d*r+e*h)),y=d*f+e*(d*g+e*(d*a+e*l));t.push(me.C,c,u,p,f,m,y)}},{getDistance:Uy}=jy,{M:Gy,L:Ky,C:qy,Z:Zy}=me,Jy={},Qy={},$y={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Gy:case Ky:$y.transformPoints(t,e,s,1),s+=3;break;case qy:$y.transformPoints(t,e,s,3),s+=7;break;case Zy:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Jy.x=t[o],Jy.y=t[o+1],I.toOuterPoint(e,Jy),t[o]=Jy.x,t[o+1]=Jy.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Gy:case Ky:i=t[a+1],s=t[a+2],e=o===Ky&&a>0?K.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case qy:i=t[a+5],s=t[a+6],e=jy.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 Zy:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=Ph.number(e,t.total);let n,r,a,h,l,d,c,u,_,g=0,p={},f=0,m=0,y=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Gy:case Ky:if(r=o[f+1],a=o[f+2],n=s[m],g+n>=e||!t.total)return f||(y=r,v=a),Qy.x=y,Qy.y=v,p.x=r,p.y=a,K.getDistancePoint(Qy,p,e-g,!0),p.rotation=K.getAngle(Qy,p),p;y=r,v=a,f+=3;break;case qy:if(r=o[f+5],a=o[f+6],n=s[m],g+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],_=jy.getT(e-g,n,y,v,l,d,c,u,r,a,i),Ve.getPointAndSet(_,y,v,l,d,c,u,r,a,p),p.rotation=jy.getRotation(_,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Zy:f+=1;default:n=0}m++,g+=n}return p},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Ph.number(e,t.total);let r,a,h,l,d,c,u,_,g,p=0,f={},m=0,y=0,v=0,w=0;const x=o.length;for(;m<x;){switch(l=o[m],l){case Gy:case Ky:if(a=o[m+1],h=o[m+2],r=s[y],p+r>=e||!t.total)return m||(v=a,w=h),Qy.x=v,Qy.y=w,f.x=a,f.y=h,K.getDistancePoint(Qy,f,e-p,!0),n.push(l,f.x,f.y),n;v=a,w=h,m+=3,n.push(l,v,w);break;case qy:if(d=o[m+1],c=o[m+2],u=o[m+3],_=o[m+4],a=o[m+5],h=o[m+6],r=s[y],p+r>=e)return g=jy.getT(e-p,r,v,w,d,c,u,_,a,h,i),jy.cut(n,g,v,w,d,c,u,_,a,h),n;v=a,w=h,m+=7,n.push(l,d,c,u,_,a,h);break;case Zy:m+=1,n.push(l);default:r=0}y++,p+=r}return n}};function tv(t){return Go(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!r(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}Vt.add("motion-path"),Nh.register("motion",function(t,e,i,s){return _(t)&&(t=Ph.number(t,s.getMotionTotal())),_(e)&&(e=Ph.number(e,s.getMotionTotal())),Nh.number(t||0,e||0,i)}),Nh.register("motionRotation",function(t,e,i){return Nh.number(t,e,i)});const ev=bl.prototype,{updateMatrix:iv,updateAllMatrix:sv}=Un,{updateBounds:ov}=or;function nv(t){const{motion:e,leaferIsCreated:i}=t;if(!r(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=av(t);i.total&&(t.__.__pathForRender=$y.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(sv(t),ov(t,t)):iv(t));i&&(t.leafer.created=!0)}}function rv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function av(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=$y.getMotionPathData(t.getPath(!0,!0))}function hv(t,e){return Go(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?zh.setStyleName(this,e,i):zh.set(this,i):this.__layout.stateStyleChanged=!0}}))}function lv(t){return Go(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function dv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function cv(t,e){_(e)||(e=void 0),gv(t,e,"in")}function uv(t,e){const{normalStyle:i}=t;_(e)||(e=void 0),i&&(e||(e=i),gv(t,e,"out"))}bl.addAttr("motionPath",void 0,tv),bl.addAttr("motionPrecision",1,tv),bl.addAttr("motion",void 0,tv),bl.addAttr("motionRotation",!0,tv),ev.getMotionPathData=function(){return av(rv(this))},ev.getMotionPoint=function(t){const e=rv(this),i=av(e);if(!i.total)return{};const s=$y.getDistancePoint(i,t,e.motionPrecision);I.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:l(o)&&(s.rotation+=o),s},ev.getMotionTotal=function(){return this.getMotionPathData().total},ev.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],r(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),nv(t))}else nv(this)};const _v={};function gv(t,e,i){const{normalStyle:s}=t;e||(e=_v),e.scale&&(b.assignScale(e,e.scale),delete e.scale),e!==_v&&zh.canAnimate||(i=null);let o=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&r(i[s])&&r(e[s])&&(s="transition");return r(e[s])?i[s]:e[s]}(i,e,t);const n=o?function(t,e){const i=mv(e,t),s=t.animate();s&&mv(i,t,s.fromStyle);return i}(t,e):void 0;zh.canAnimate&&pv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=pv(t);if(a){const{animation:s}=a;if(s){const n=t.animate(s,void 0,"animation",!0);Object.assign(a,n.endingStyle),"in"!==i||e.animation!==s?n.kill():o=!1,delete a.animation}t.normalStyle=fv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(o){const e=fv(n,t);t.set(n,"temp"),t.animate([n,e],o,"transition",!0)}t.__layout.stateStyleChanged=!1}function pv(t){let e;const i={},s=dv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&zh.isState(o,t,s)&&(e=yv(i,n));const r=i.selectedStyle||t.selectedStyle;r&&zh.isSelected(t,s)&&(e=yv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&zh.isPlacehold(t,s)&&(e=yv(i,a)),zh.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=yv(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&zh.isFocus(t,s)&&(e=yv(i,o));const n=i.hoverStyle||t.hoverStyle;n&&zh.isHover(t,s)&&(e=yv(i,n));const r=i.pressStyle||t.pressStyle;r&&zh.isPress(t,s)&&(e=yv(i,r))}return e?i:void 0}function fv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&zh.animateExcludes[t]||(o[t]=e[t]);return o}function mv(t,e,i){return fv(t,e,i,!0)}function yv(t,e){return Object.assign(t,e),!0}function vv(t,e){const i=t[e];i&&cv(t,i),t.button&&xv(t.children,e)}function wv(t,e,i){i||(i=t.states[e]),cv(t,i),t.button&&xv(t.children,null,e)}function xv(t,e,i){if(!t)return;let s,o;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(o=!0,e){case"hoverStyle":zh.isHover(s)&&(o=!1);break;case"pressStyle":zh.isPress(s)&&(o=!1);break;case"focusStyle":zh.isFocus(s)&&(o=!1)}o&&vv(s,e)}else n(i)||wv(s,i);s.isBranch&&xv(s.children,e,i)}}function bv(t,e){const i=t[e];i&&uv(t,i),t.button&&Ev(t.children,e)}function kv(t,e,i){uv(t,i),t.button&&Ev(t.children,null,e)}function Ev(t,e,i){if(!t)return;let s;for(let o=0,r=t.length;o<r;o++)s=t[o],e?bv(s,e):n(i)||kv(s,i),s.isBranch&&Ev(s.children,e,i)}function Sv(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=dv(e,i);n&&(s=o[t](n))}return s}function Bv(t,e,i){let s=e[t];if(!s&&i){const o=dv(e,i);o&&(s=o[t])}return s}Vt.add("state"),zh.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},zh.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=dv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},zh.isSelected=function(t,e){return Bv("selected",t,e)},zh.isDisabled=function(t,e){return Bv("disabled",t,e)},zh.isFocus=function(t,e){return Sv("isFocus",t,e)},zh.isHover=function(t,e){return Sv("isHover",t,e)},zh.isPress=function(t,e){return Sv("isPress",t,e)},zh.isPlacehold=function(t,e){return t.__.__isPlacehold},zh.isDrag=function(t,e){return Sv("isDrag",t,e)},zh.setStyleName=function(t,e,i){i?wv(t,e,t[e]):kv(t,e,t[e])},zh.set=function(t,e){const i=t.states[e];i?wv(t,e,i):kv(t,e,i)},zh.getStyle=pv,zh.updateStyle=gv,zh.updateEventStyle=function(t,e){switch(e){case kd.ENTER:vv(t,"hoverStyle");break;case kd.LEAVE:bv(t,"hoverStyle");break;case kd.DOWN:vv(t,"pressStyle");break;case kd.UP:bv(t,"pressStyle")}};const Tv=bl.prototype;bl.addAttr("selected",!1,hv,"selectedStyle"),bl.addAttr("disabled",!1,hv,"disabledStyle"),bl.addAttr("states",{},lv),bl.addAttr("state","",hv),bl.addAttr("normalStyle",void 0,Zo),bl.addAttr("hoverStyle",void 0,lv),bl.addAttr("pressStyle",void 0,lv),bl.addAttr("focusStyle",void 0,lv),bl.addAttr("selectedStyle",void 0,lv),bl.addAttr("disabledStyle",void 0,lv),bl.addAttr("placeholderStyle",void 0,lv),bl.addAttr("button",!1,Zo),Tv.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?vv(this,"focusStyle"):bv(this,"focusStyle")})},Tv.updateState=function(){zh.updateStyle(this,void 0,"in")};const Rv=pd.prototype,Cv="text";Vo(Rv,Cv,Object.assign(Object.assign({},jo(Rv,Cv)),{set(t){const e=this,i=e.text;e.__setAttr(Cv,t)&&(nn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class Ov extends Gh{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let Pv=class extends bl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!n(t))if(l(t))this.now=t;else if(_(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=Io.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:o,size:n,total:r}=e,{width:a,height:h}=n&&(l(n)?{width:n,height:n}:n)||(r>1?this:t);let d=o?o.x:0,c=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:a,height:h},d+a>=t.width?(d=0,c+=h):d+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Er(Er.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:o}=this;o&&(o.FPS&&(i=o.FPS),n(o.loop)||(s=o.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:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};$t([kn(Ov)],Pv.prototype,"__",void 0),$t([sn()],Pv.prototype,"robot",void 0),$t([Zo()],Pv.prototype,"actions",void 0),$t([Zo("")],Pv.prototype,"action",void 0),$t([un(0)],Pv.prototype,"now",void 0),$t([Zo(12)],Pv.prototype,"FPS",void 0),$t([Zo(!0)],Pv.prototype,"loop",void 0),Pv=$t([An()],Pv),Vt.add("robot");const{Yes:Lv,NoAndSkip:Av,YesAndSkip:Mv}=s,Dv={},Fv={},Iv={};class Wv{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const o=this.getByInnerId(t,e);return i?o:o?[o]:[];case"string":switch(t[0]){case"#":Dv.id=t.substring(1),t=Dv;break;case".":Fv.className=t.substring(1),t=Fv;break;default:Iv.tag=t,t=Iv}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,o=u(s);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Un.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 o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===Lv||n===Mv){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<Av&&this.eachFind(o.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 zv=bl.prototype;function Nv(e){return e.leafer?e.leafer.selector:t.selector||(t.selector=jt.selector())}zv.find=function(t,e){return Nv(this).getBy(t,this,!1,e)},zv.findOne=function(t,e){return Nv(this).getBy(t,this,!0,e)},Vt.add("find"),jt.finder=function(t){return new Wv(t)};const{setPoint:Yv,addPoint:Xv,toBounds:Hv}=st;const Vv={syncExport(e,i,s){let o;Wh.running=!0;try{const r=Co.fileType(i),a=i.includes(".");s=Co.getExportOptions(s);const{toURL:h}=t,{download:l}=t.origin;if("json"===r)a&&l(h(JSON.stringify(e.toJSON(s.json)),"text"),i),o={data:!!a||e.toJSON(s.json)};else if("svg"===r)a&&l(h(e.toSVG(),"svg"),i),o={data:!!a||e.toSVG()};else{let r,a,h=1,l=1;const{worldTransform:d,isLeafer:c,leafer:u,isFrame:_}=e,{slice:g,clip:p,trim:f,screenshot:m,padding:y,onCanvas:v}=s,w=n(s.smooth)?!u||u.config.smooth:s.smooth,x=s.contextSettings||(u?u.config.contextSettings:void 0),k=c&&m&&n(s.fill)?e.fill:s.fill,E=Co.isOpaqueImage(i)||k,S=new et;if(m)r=!0===m?c?u.canvas.bounds:e.worldRenderBounds:m;else{let t=s.relative||(c?"inner":"local");switch(h=d.scaleX,l=d.scaleY,t){case"inner":S.set(d);break;case"local":S.set(d).divide(e.localTransform),h/=e.scaleX,l/=e.scaleY;break;case"world":h=1,l=1;break;case"page":t=u||e;default:S.set(d).divide(e.getTransform(t));const i=t.worldTransform;h/=h/i.scaleX,l/=l/i.scaleY}r=e.getBounds("render",t)}const B={scaleX:1,scaleY:1};b.getScaleData(s.scale,s.size,r,B);let T=s.pixelRatio||1,{x:R,y:C,width:O,height:P}=new Lt(r).scale(B.scaleX,B.scaleY);p&&(R+=p.x,C+=p.y,O=p.width,P=p.height);const L={exporting:!0,matrix:S.scale(1/B.scaleX,1/B.scaleY).invert().translate(-R,-C).withScale(1/h*B.scaleX,1/l*B.scaleY)};let A,M=jt.canvas({width:Math.floor(O),height:Math.floor(P),pixelRatio:T,smooth:w,contextSettings:x});g&&(A=e,A.__worldOpacity=0,e=u||e,L.bounds=M.bounds),M.save();const D=_&&!n(k),F=e.get("fill");if(D&&(e.fill=""),t.render(e,M,L),D&&(e.fill=F),M.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 o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?Xv(r,o,n):Yv(r={},o,n)),a++;const h=new Lt;return r&&(Hv(r,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=a,s={x:0,y:0,width:e,height:i,pixelRatio:T};M=jt.canvas(s),M.copyWorld(t,a,s),t.destroy()}if(y){const[t,e,i,s]=b.fourNumber(y),o=M,{width:n,height:r}=o;M=jt.canvas({width:n+s+e,height:r+t+i,pixelRatio:T}),M.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}E&&M.fillWorld(M.bounds,k||"#FFFFFF","destination-over"),v&&v(M);o={data:"canvas"===i?M:M.export(i,s),width:M.pixelWidth,height:M.pixelHeight,renderBounds:r,trimBounds:a};const I=u&&u.app;I&&I.canvasManager&&I.canvasManager.clearRecycled()}}catch(t){o={data:"",error:t}}return Wh.running=!1,o},export(e,i,s){return Wh.running=!0,function(t){jv||(jv=new Ao);return new Promise(e=>{jv.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(o=>new Promise(n=>{const r=()=>te(this,void 0,void 0,function*(){if(!Do.isComplete)return t.requestRender(r);const a=Wh.syncExport(e,i,s);a.data instanceof Promise&&(a.data=yield a.data),o(a),n()});e.updateLayout(),Uv(e);const{leafer:a}=e;a?a.waitViewCompleted(r):r()}))}};let jv;function Uv(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Uv(t))}const Gv=ge.prototype,Kv=It.get("@leafer-in/export");Gv.export=function(t,e){const{quality:i,blob:s}=Co.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Gv.toBlob=function(e,i){return new Promise(s=>{t.origin.canvasToBolb(this.view,e,i).then(t=>{s(t)}).catch(t=>{Kv.error(t),s(null)})})},Gv.toDataURL=function(e,i){return t.origin.canvasToDataURL(this.view,e,i)},Gv.saveAs=function(e,i){return new Promise(s=>{t.origin.canvasSaveAs(this.view,e,i).then(()=>{s(!0)}).catch(t=>{Kv.error(t),s(!1)})})},Vt.add("export"),Object.assign(Wh,Vv),bl.prototype.export=function(t,e){return Wh.export(this,t,e)},bl.prototype.syncExport=function(t,e){return Wh.syncExport(this,t,e)},Vt.add("filter"),Object.assign(Ih,{list:{},register(t,e){Ih.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach(t=>{r=Ih.list[t.type],r&&r.apply(t,e,i,s,o,n)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Ih.list[t.type],e&&(i+=e.getSpread(t))}),i}}),Vt.add("bright"),bl.addAttr("bright",!1,_n);export{ct as AlignHelper,uy as Animate,ly as AnimateEasing,cy as AnimateEvent,_y as AnimateList,s as Answer,yd as App,ht as AroundHelper,pf as Arrow,_f as ArrowData,Mt as AutoBounds,Ve as BezierHelper,Lt as Bounds,Sr as BoundsEvent,Rt as BoundsHelper,Al as Box,Zh as BoxData,th as Branch,or as BranchHelper,va as BranchRender,dd as Canvas,ll as CanvasData,Qt as CanvasManager,wr as ChildEvent,Oh as ColorConvert,jt as Creator,Jd as Cursor,f as DataHelper,It as Debug,nt as Direction4,rt as Direction9,pl as DragBoundsHelper,Bd as DragEvent,Nd as Dragger,Rd as DropEvent,Mg as EditBox,Bg as EditDataHelper,Pg as EditPoint,gg as EditSelect,dg as EditSelectHelper,hp as EditTool,Gg as EditToolCreator,rp as Editor,$_ as EditorEvent,Zg as EditorGroupEvent,Hg as EditorHelper,ep as EditorMoveEvent,sp as EditorRotateEvent,ip as EditorScaleEvent,op as EditorSkewEvent,Fh as Effect,Wl as Ellipse,el as EllipseData,$e as EllipseHelper,vr as Event,Zt as EventCreator,Xr as Eventer,Wh as Export,Co as FileHelper,Ih as Filter,Wv as Finder,gm as Flow,Ml as Frame,Qh as FrameData,kl as Group,qh as GroupData,jy as HighBezierHelper,$y as HighCurveHelper,Qd as HitCanvasManager,hd as Image,hl as ImageData,Er as ImageEvent,Io as ImageManager,e as IncrementId,ap as InnerEditor,qg as InnerEditorEvent,gc as Interaction,Zd as InteractionBase,Md as InteractionHelper,Ad as KeyEvent,wd as Keyboard,Ar as LayoutEvent,vh as Layouter,Va as Leaf,fa as LeafBounds,tr as LeafBoundsHelper,y as LeafData,ea as LeafDataProxy,$r as LeafEventer,Un as LeafHelper,yr as LeafLayout,ih as LeafLevelList,eh as LeafList,ha as LeafMatrix,ma as LeafRender,Bl as Leafer,oh as LeaferCanvas,ge as LeaferCanvasBase,Jh as LeaferData,Dr as LeaferEvent,Ho as LeaferImage,Up as LeaferTypeCreator,ad as Line,$h as LineData,gp as LineEditTool,b as MathHelper,et as Matrix,I as MatrixHelper,Cd as MoveEvent,qp as MultiTouchHelper,Td as MyDragEvent,ld as MyImage,Ed as MyPointerEvent,ve as NeedConvertToCanvasCommandMap,E as OneRadian,S as PI2,B as PI_2,Ah as Paint,Dh as PaintGradient,Mh as PaintImage,fd as Path,Lh as PathArrow,cm as PathArrowModule,mo as PathBounds,rs as PathCommandDataHelper,me as PathCommandMap,Ii as PathConvert,Eo as PathCorner,ks as PathCreator,ol as PathData,Ws as PathDrawer,pe as PathHelper,Sf as PathMatrixHelper,ke as PathNumberCommandLengthMap,be as PathNumberCommandMap,Rp as PathScaler,md as Pen,nl as PenData,kh as Picker,t as Platform,Vt as Plugin,$ as Point,K as PointHelper,xd as PointerButton,kd as PointerEvent,Ul as Polygon,il as PolygonData,br as PropertyEvent,Tl as Rect,tl as RectData,Ee as RectHelper,wl as RectRender,Mr as RenderEvent,xh as Renderer,Pr as ResizeEvent,Do as Resource,Pv as Robot,Ov as RobotData,Od as RotateEvent,Yt as Run,uf as ScrollBar,lg as SelectArea,Eh as Selector,$l as Star,sl as StarData,zh as State,Dt as StringNumberMap,hg as Stroker,Pd as SwipeEvent,Lo as TaskItem,Ao as TaskProcessor,pd as Text,Ch as TextConvert,al as TextData,np as TransformTool,ef as Transformer,Nh as Transition,st as TwoPointBoundsHelper,bl as UI,dl as UIBounds,Gt as UICreator,Gh as UIData,bd as UIEvent,yl as UIRender,Ph as UnitConvert,hr as WaitHelper,Lr as WatchEvent,hh as Watcher,tf as WheelEventHelper,Ld as ZoomEvent,Hp as addViewport,Vp as addViewportConfig,cn as affectRenderBoundsType,hn as affectStrokeBoundsType,gf as arrowType,Ko as attr,$o as autoLayoutType,sn as boundsType,Ro as canvasPatch,_e as canvasSizeAttrs,Rh as createAttr,Uo as createDescriptor,bn as cursorType,kn as dataProcessor,Zo as dataType,Go as decorateLeafAttr,Sn as defineDataProcessor,Vo as defineKey,qo as defineLeafAttr,_n as dimType,nn as doBoundsType,ln as doStrokeType,Sh as effectType,o as emptyData,wn as eraserType,kr as extraPropertyEventMap,R as getBoundsData,jo as getDescriptor,C as getMatrixData,T as getPointData,xn as hitType,u as isArray,g as isData,p as isEmptyData,h as isFinite,r as isNull,l as isNumber,_ as isObject,a as isString,n as isUndefined,En as layoutProcessor,Nr as leaferTransformAttrMap,vn as maskType,tv as motionPathType,on as naturalBoundsType,gn as opacityType,So as path,rn as pathInputType,an as pathType,Bo as pen,Jo as positionType,jg as registerEditTool,Ug as registerInnerEditor,An as registerUI,Mn as registerUIEvent,Bh as resizeType,Cn as rewrite,On as rewriteAble,en as rotationType,Ip as scaleResize,Wp as scaleResizeFontSize,Yp as scaleResizeGroup,zp as scaleResizePath,Np as scaleResizePoints,tn as scaleType,Qo as scrollType,yn as sortType,lv as stateStyleType,hv as stateType,dn as strokeType,un as surfaceType,At as tempBounds,it as tempMatrix,tt as tempPoint,c as tryToNumber,ah as useCanvas,Ln as useModule,sh as version,pn as visibleType,Th as zoomLayerType};
2
2
  //# sourceMappingURL=miniapp.module.min.js.map