@leafer-editor/worker 1.9.3 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i;var n;t.Answer=void 0,(n=t.Answer||(t.Answer={}))[n.No=0]="No",n[n.Yes=1]="Yes",n[n.NoAndSkip=2]="NoAndSkip",n[n.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function _(t){return p(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return y(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&y(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:v,pow:x,PI:w}=Math,E={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(u(t))switch(t.length){case 4:i=o(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),E.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:x(10,e);return-0===(t=v(t*i)/i)?0:t},getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&E.assignScale(s,t);return s},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:b,randColor:t=>`rgba(${b(255)},${b(255)},${b(255)},${t||1})`};function b(t){return Math.round(Math.random()*t)}const k=w/180,B=2*w,S=w/2;function T(){return{x:0,y:0}}function P(){return{x:0,y:0,width:0,height:0}}function L(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:R,cos:C,acos:O,sqrt:M}=Math,{float:D}=E,I={};function A(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const W={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:A(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:L,getWorld:A,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){F.toInnerPoint(t,e,I),F.scaleOfInner(t,I,i,s)},scaleOfInner(t,e,i,s=i){F.translateInner(t,e.x,e.y),F.scale(t,i,s),F.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=C(e*=k),a=R(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){F.toInnerPoint(t,e,I),F.rotateOfInner(t,I,i)},rotateOfInner(t,e,i){F.translateInner(t,e.x,e.y),F.rotate(t,i),F.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=k,t.a=s+r*i,t.b=n+o*i),e&&(e*=k,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){F.toInnerPoint(t,e,I),F.skewOfInner(t,I,i,s)},skewOfInner(t,e,i,s=0){F.translateInner(t,e.x,e.y),F.skew(t,i,s),F.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){F.multiply(t,F.tempInvert(e))},divideParent(t,e){F.multiplyParent(t,F.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=F;return F.copy(e,t),F.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*k,o=C(r),a=R(r);if(s||n){const e=s*k,i=n*k;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&F.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=M(n*n+r*r),c=t/d;const e=n/d;u=r>0?O(e):-O(e)}else{c=M(o*o+a*a),d=t/c;const e=o/c;u=S-(a>0?O(-e):-O(e))}const e=D(C(u)),i=R(u);d=D(d),c=D(c),p=e?D((o/c+i)/e/k,9):0,_=e?D((r/d-i)/e/k,9):0,u=D(u/k)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=M(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){F.set(t)}},F=W,{toInnerPoint:z,toOuterPoint:H}=W,{sin:U,cos:N,abs:Y,sqrt:X,atan2:V,min:G,round:j}=Math,K={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?j(t.x-.5)+.5:j(t.x),t.y=e?j(t.y-.5)+.5:j(t.y)},move(t,e,i){p(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=Z.defaultPoint);const s=N(e*=k),n=U(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=Z;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=Z;return J(i,t),H(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=Z;return J(i,t),Z.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){z(e,t,i)},toOuterOf(t,e,i){H(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=Y(i-t),r=Y(s-e);return X(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>G(q(t,e,i,s),q(i,s,n,r)),getAngle:(t,e)=>$(t,e)/k,getRotation:(t,e,i,s)=>(s||(s=e),Z.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/k),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>V(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=$(t,e);return(e=s?e:{}).x=t.x+N(n)*i,e.y=t.y+U(n)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){Z.reset(t)}},Z=K,{getDistanceFrom:q,copy:J,getAtan2:$}=Z;class Q{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Q(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new Q(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new Q(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new Q;class et{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?W.copy(this,t):W.set(this,t,e,i,s,n,r),this}setWith(t){return W.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new et(this)}translate(t,e){return W.translate(this,t,e),this}translateInner(t,e){return W.translateInner(this,t,e),this}scale(t,e){return W.scale(this,t,e),this}scaleWith(t,e){return W.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return W.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return W.scaleOfInner(this,t,e,i),this}rotate(t){return W.rotate(this,t),this}rotateOfOuter(t,e){return W.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return W.rotateOfInner(this,t,e),this}skew(t,e){return W.skew(this,t,e),this}skewOfOuter(t,e,i){return W.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return W.skewOfInner(this,t,e,i),this}multiply(t){return W.multiply(this,t),this}multiplyParent(t){return W.multiplyParent(this,t),this}divide(t){return W.divide(this,t),this}divideParent(t){return W.divideParent(this,t),this}invert(){return W.invert(this),this}invertWith(){return W.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){W.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){W.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return W.setLayout(this,t,e,i),this}getLayout(t,e,i){return W.getLayout(this,t,e,i)}withScale(t,e){return W.withScale(this,t,e)}reset(){W.reset(this)}}const it=new et,st={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){nt(t,e,i),nt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:nt}=st;var rt,ot;t.Direction4=void 0,(rt=t.Direction4||(t.Direction4={}))[rt.top=0]="top",rt[rt.right=1]="right",rt[rt.bottom=2]="bottom",rt[rt.left=3]="left",t.Direction9=void 0,(ot=t.Direction9||(t.Direction9={}))[ot.topLeft=0]="topLeft",ot[ot.top=1]="top",ot[ot.topRight=2]="topRight",ot[ot.right=3]="right",ot[ot.bottomRight=4]="bottomRight",ot[ot.bottom=5]="bottom",ot[ot.bottomLeft=6]="bottomLeft",ot[ot.left=7]="left",ot[ot.center=8]="center",ot[ot["top-left"]=0]="top-left",ot[ot["top-right"]=2]="top-right",ot[ot["bottom-right"]=4]="bottom-right",ot[ot["bottom-left"]=6]="bottom-left";const at=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,i,s,n,r){const o=lt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),ht.toPoint(t,e,i,!0),i)};function lt(e){return h(e)?at[t.Direction9[e]]:e}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,n,r){dt(t,i,s,n,e,r)}},{tempPointBounds:ut,setPoint:pt,addPoint:_t,toBounds:gt}=st,{toOuterPoint:ft}=W,{float:yt,fourNumber:mt}=E,{floor:vt,ceil:xt}=Math;let wt,Et,bt,kt;const Bt={},St={},Tt={},Pt={tempBounds:Tt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=mt(i);s?Lt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Lt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Lt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Lt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ct(e,t):e=t,i?(e.offsetX=-(Lt.maxX(i)-t.x),e.offsetY=-(Lt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Lt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||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)=>(Lt.copy(Tt,t),Lt.toOuterOf(Tt,e),Tt),getOuterOf:(t,e)=>(t=Object.assign({},t),Lt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else Bt.x=t.x,Bt.y=t.y,ft(e,Bt,St),pt(ut,St.x,St.y),Bt.x=t.x+t.width,ft(e,Bt,St),_t(ut,St.x,St.y),Bt.y=t.y+t.height,ft(e,Bt,St),_t(ut,St.x,St.y),Bt.x=t.x,ft(e,Bt,St),_t(ut,St.x,St.y),gt(ut,i)},toInnerOf(t,e,i){i||(i=t),Lt.move(i,-e.e,-e.f),Lt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Lt.getFitScale(t,e));return new et(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=Lt.getFitScale(t,e,"cover"===s)),Tt.width=n?e.width*=s:e.width*s,Tt.height=n?e.height*=s:e.height*s,ct.toPoint(i,Tt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Lt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Lt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Lt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?xt(t.width+e-t.x):xt(t.width),t.height=i>t.y?xt(t.height+i-t.y):xt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,i){wt=t.x+t.width,Et=t.y+t.height,bt=e.x,kt=e.y,i||(bt+=e.width,kt+=e.height),wt=wt>bt?wt:bt,Et=Et>kt?Et:kt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=wt-t.x,t.height=Et-t.y},addList(t,e){Lt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Lt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Lt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Ct(t,n)):Rt(t,n));r&&Lt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?pt(ut,t.x,t.y):_t(ut,t.x,t.y)),gt(ut,t)},setPoint(t,e){Lt.set(t,e.x,e.y)},addPoint(t,e){Rt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=K.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=K.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Lt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Lt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Lt.tempToOuterOf(e,i)),!Lt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return wt=s+r,Et=n+o,bt=t.x+t.width,kt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,wt=wt<bt?wt:bt,Et=Et<kt?Et:kt,r=wt-s,o=Et-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Lt.copy(t,Lt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Lt.set(t)}},Lt=Pt,{add:Rt,copy:Ct}=Lt;class Ot{get minX(){return Pt.minX(this)}get minY(){return Pt.minY(this)}get maxX(){return Pt.maxX(this)}get maxY(){return Pt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Pt.copy(this,t):Pt.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 Ot(this)}move(t,e){return Pt.move(this,t,e),this}scale(t,e,i){return Pt.scale(this,t,e,i),this}scaleOf(t,e,i){return Pt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Pt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Pt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Pt.getFitMatrix(this,t,e)}put(t,e,i){Pt.put(this,t,e,i)}spread(t,e){return Pt.spread(this,t,e),this}shrink(t,e){return Pt.shrink(this,t,e),this}ceil(){return Pt.ceil(this),this}unsign(){return Pt.unsign(this),this}float(t){return Pt.float(this,t),this}add(t){return Pt.add(this,t),this}addList(t){return Pt.setList(this,t,!0),this}setList(t){return Pt.setList(this,t),this}addListWithFn(t,e){return Pt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Pt.setListWithFn(this,t,e),this}setPoint(t){return Pt.setPoint(this,t),this}setPoints(t){return Pt.setPoints(this,t),this}addPoint(t){return Pt.addPoint(this,t),this}getPoints(){return Pt.getPoints(this)}hitPoint(t,e){return Pt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Pt.hitRadiusPoint(this,t,e)}hit(t,e){return Pt.hit(this,t,e)}includes(t,e){return Pt.includes(this,t,e)}intersect(t,e){return Pt.intersect(this,t,e),this}getIntersect(t,e){return new Ot(Pt.getIntersectData(this,t,e))}isSame(t){return Pt.isSame(this,t)}isEmpty(){return Pt.isEmpty(this)}reset(){Pt.reset(this)}}const Mt=new Ot;class Dt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Ot(n,e,r||t.width-n-i,o||t.height-e-s)}}const It={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:At}=E;class Wt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Wt(t)}static set filter(t){this.filterList=Ft(t)}static set exclude(t){this.excludeList=Ft(t)}static drawRepaint(t,e){const i=At();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Wt.showBounds,n=t.__nowWorld,r=At();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}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 Ft(t){return t?h(t)&&(t=[t]):t=[],t}Wt.filterList=[],Wt.excludeList=[],Wt.showWarn=!0;const zt=Wt,Ht=Wt.get("RunTime"),Ut={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Nt.currentId=Nt.idMap[s]=e?performance.now():Date.now(),Nt.currentName=Nt.nameMap[s]=t,Nt.nameToIdMap[t]=s,s},end(t,e){const i=Nt.idMap[t],s=Nt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Nt.idMap[t]=Nt.nameMap[t]=Nt.nameToIdMap[s]=void 0,Ht.log(s,n,"ms")},endOfName(t,e){const i=Nt.nameToIdMap[t];o(i)||Nt.end(i,e)}},Nt=Ut,Yt=[],Xt={list:{},add(t,...e){this.list[t]=!0,Yt.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(()=>Yt.forEach(t=>Xt.has(t,!0)));const Vt={editor:t=>Xt.need("editor")},Gt=Wt.get("UICreator"),jt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&Gt.repeat(e),Kt[e]=t},get(t,e,i,s,n,r){Kt[t]||Gt.error("not register "+t);const a=new Kt[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:Kt}=jt,Zt=Wt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(Jt[e]&&Zt.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}=qt;class $t{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=Vt.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function Qt(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function te(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function ee(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ie=[];function se(){return(t,e)=>{ie.push(e)}}const ne=[];class re{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ne)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}Qt([ee("imageSmoothingEnabled")],re.prototype,"smooth",void 0),Qt([ee("imageSmoothingQuality")],re.prototype,"smoothLevel",void 0),Qt([ee("globalAlpha")],re.prototype,"opacity",void 0),Qt([ee()],re.prototype,"fillStyle",void 0),Qt([ee()],re.prototype,"strokeStyle",void 0),Qt([ee("lineWidth")],re.prototype,"strokeWidth",void 0),Qt([ee("lineCap")],re.prototype,"strokeCap",void 0),Qt([ee("lineJoin")],re.prototype,"strokeJoin",void 0),Qt([ee("lineDashOffset")],re.prototype,"dashOffset",void 0),Qt([ee()],re.prototype,"miterLimit",void 0),Qt([ee()],re.prototype,"shadowBlur",void 0),Qt([ee()],re.prototype,"shadowColor",void 0),Qt([ee()],re.prototype,"shadowOffsetX",void 0),Qt([ee()],re.prototype,"shadowOffsetY",void 0),Qt([ee()],re.prototype,"filter",void 0),Qt([ee()],re.prototype,"font",void 0),Qt([ee()],re.prototype,"fontKerning",void 0),Qt([ee()],re.prototype,"fontStretch",void 0),Qt([ee()],re.prototype,"fontVariantCaps",void 0),Qt([ee()],re.prototype,"textAlign",void 0),Qt([ee()],re.prototype,"textBaseline",void 0),Qt([ee()],re.prototype,"textRendering",void 0),Qt([ee()],re.prototype,"wordSpacing",void 0),Qt([ee()],re.prototype,"letterSpacing",void 0),Qt([ee()],re.prototype,"direction",void 0),Qt([se()],re.prototype,"setTransform",null),Qt([se()],re.prototype,"resetTransform",null),Qt([se()],re.prototype,"getTransform",null),Qt([se()],re.prototype,"save",null),Qt([se()],re.prototype,"restore",null),Qt([se()],re.prototype,"translate",null),Qt([se()],re.prototype,"scale",null),Qt([se()],re.prototype,"rotate",null),Qt([se()],re.prototype,"fill",null),Qt([se()],re.prototype,"stroke",null),Qt([se()],re.prototype,"clip",null),Qt([se()],re.prototype,"fillRect",null),Qt([se()],re.prototype,"strokeRect",null),Qt([se()],re.prototype,"clearRect",null),Qt([se()],re.prototype,"beginPath",null),Qt([se()],re.prototype,"moveTo",null),Qt([se()],re.prototype,"lineTo",null),Qt([se()],re.prototype,"bezierCurveTo",null),Qt([se()],re.prototype,"quadraticCurveTo",null),Qt([se()],re.prototype,"closePath",null),Qt([se()],re.prototype,"arc",null),Qt([se()],re.prototype,"arcTo",null),Qt([se()],re.prototype,"ellipse",null),Qt([se()],re.prototype,"rect",null),Qt([se()],re.prototype,"roundRect",null),Qt([se()],re.prototype,"createConicGradient",null),Qt([se()],re.prototype,"createLinearGradient",null),Qt([se()],re.prototype,"createPattern",null),Qt([se()],re.prototype,"createRadialGradient",null),Qt([se()],re.prototype,"fillText",null),Qt([se()],re.prototype,"measureText",null),Qt([se()],re.prototype,"strokeText",null);const{copy:oe,multiplyParent:ae}=W,{round:he}=Math,le=new Ot,de=new Ot,ce={width:1,height:1,pixelRatio:1},ue=["width","height","pixelRatio"];class pe extends re{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,s){super(),this.size={},this.worldTransform={},t||(t=ce),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:r,pixelRatio:o}=t;this.autoLayout=!n||!r,this.size.pixelRatio=o||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,ue),ue.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Ot(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&ae(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=he(n.e-.5)+.5,n.f=he(n.f-.5)+.5):(n.e=he(n.e),n.f=he(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=de):i=le,this.drawImage(t.view,le.x,le.y,le.width,le.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Pt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,le.x,le.y,le.width,le.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r=!0){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(le.x,le.y,le.width,le.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,le.x,le.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(de,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):Vt.canvas(Object.assign({},i));return n.save(),t&&(oe(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const _e={creator:{},parse(t,e){},convertToCanvasData(t,e){}},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),xe=fe,we={};for(let t in xe)we[xe[t]]=t;const Ee={};for(let t in xe)Ee[xe[t]]=ye[t];const be={drawRoundRect(t,e,i,s,n,r){const o=E.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:ke,cos:Be,atan2:Se,ceil:Te,abs:Pe,PI:Le,sqrt:Re,pow:Ce}=Math,{setPoint:Oe,addPoint:Me}=st,{set:De,toNumberPoints:Ie}=K,{M:Ae,L:We,C:Fe,Q:ze,Z:He}=fe,Ue={},Ne={points(t,e,i,s){let n=Ie(e);if(t.push(Ae,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=Re(Ce(o-e,2)+Ce(a-r,2)),g=Re(Ce(h-o,2)+Ce(l-a,2)),(_||g)&&(f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=r,d=o-_*h,c=a-_*l,2===i?s||t.push(ze,d,c,o,a):t.push(Fe,u,p,d,c,o,a),u=o+g*h,p=a+g*l);s||t.push(ze,u,p,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(We,n[e],n[e+1]);s&&t.push(He)},rect(t,e,i,s,n){_e.creator.path=t,_e.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){_e.creator.path=[],be.drawRoundRect(_e.creator,e,i,s,n,r),t.push(..._e.convertToCanvasData(_e.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,_=o-n;let g=Se(u,c),f=Se(_,p),y=f-g;if(y<0&&(y+=B),y===Le||Pe(c+u)<1e-12||Pe(p+_)<1e-12)return t&&t.push(We,s,n),h&&(Oe(h,e,i),Me(h,s,n)),d&&De(d,e,i),void(l&&De(l,s,n));const m=c*_-p*u<0,v=m?-1:1,x=a/Be(y/2),w=s+x*Be(g+y/2+S*v),E=n+x*ke(g+y/2+S*v);return g-=S*v,f-=S*v,Ve(t,w,E,a,a,0,g/k,f/k,m,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>Ve(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*k,p=ke(u),_=Be(u);let g=o*k,f=a*k;g>Le&&(g-=B),f<0&&(f+=B);let y=f-g;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Te(Pe(y/S)),v=y/m,x=ke(v/4),w=8/3*x*x/ke(v/2);f=g+v;let E,b,T,P,L,R,C,O,M=Be(g),D=ke(g),I=T=_*s*M-p*n*D,A=P=p*s*M+_*n*D,W=e+T,F=i+P;t&&t.push(t.length?We:Ae,W,F),l&&Oe(l,W,F),c&&De(c,W,F);for(let r=0;r<m;r++)E=Be(f),b=ke(f),T=_*s*E-p*n*b,P=p*s*E+_*n*b,L=e+I-w*(_*s*D+p*n*M),R=i+A-w*(p*s*D-_*n*M),C=e+T+w*(_*s*b+p*n*E),O=i+P+w*(p*s*b-_*n*E),t&&t.push(Fe,L,R,C,O,e+T,i+P),l&&Xe(e+I,i+A,L,R,C,O,e+T,i+P,l,!0),I=T,A=P,M=E,D=b,g=f,f+=v;d&&De(d,e+T,i+P)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(Fe,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){Xe(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,x=i,w=n,E=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,E=a),c=-3*v+9*x-9*w+3*E,u=6*v-12*x+6*w,p=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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):Oe(h,t,e),Me(h,o,a);for(let l=0,c=d.length;l<c;l++)Ye(d[l],t,e,i,s,n,r,o,a,Ue),Me(h,Ue.x,Ue.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return Ye(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:Ye,toTwoPointBounds:Xe,ellipse:Ve}=Ne,{sin:Ge,cos:je,sqrt:Ke,atan2:Ze}=Math,{ellipse:qe}=Ne,Je={ellipticalArc(t,i,s,n,r,o,a,h,l,d,c){const u=(l-i)/2,p=(d-s)/2,_=o*k,g=Ge(_),f=je(_),y=-f*u-g*p,m=-f*p+g*u,v=n*n,x=r*r,w=m*m,E=y*y,b=v*x-v*w-x*E;let S=0;if(b<0){const t=Ke(1-b/(v*x));n*=t,r*=t}else S=(a===h?-1:1)*Ke(b/(v*w+x*E));const T=S*n*m/r,P=-S*r*y/n,L=Ze((m-P)/r,(y-T)/n),R=Ze((-m-P)/r,(-y-T)/n);let C=R-L;0===h&&C>0?C-=B:1===h&&C<0&&(C+=B);const O=i+u+f*T-g*P,M=s+p+g*T+f*P,D=C<0?1:0;c||e.ellipseToCurve?qe(t,O,M,n,r,o,L/k,R/k,D):n!==r||o?t.push(fe.G,O,M,n,r,o,L/k,R/k,D):t.push(fe.O,O,M,n,L/k,R/k,D)}},{M:$e,m:Qe,L:ti,l:ei,H:ii,h:si,V:ni,v:ri,C:oi,c:ai,S:hi,s:li,Q:di,q:ci,T:ui,t:pi,A:_i,a:gi,Z:fi,z:yi,N:mi,D:vi,X:xi,G:wi,F:Ei,O:bi,P:ki,U:Bi}=fe,{rect:Si,roundRect:Ti,arcTo:Pi,arc:Li,ellipse:Ri,quadraticCurveTo:Ci}=Ne,{ellipticalArc:Oi}=Je,Mi=Wt.get("PathConvert"),Di={},Ii={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ee[s],a+=s===n?" ":we[s];for(let s=1;s<i;s++)a+=E.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?ve:me;for(let e=0,h=t.length;e<h;e++)s=t[e],It[s]?("."===s&&(Ai.dot&&(Wi(o,r),r=""),Ai.dot++),"0"===r&&"."!==s&&(Wi(o,r),r=""),r+=s):fe[s]?(r&&(Wi(o,r),r=""),Ai.name=fe[s],Ai.length=ye[s],Ai.index=0,Wi(o,Ai.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&Wi(o,r),r=s):r&&(Wi(o,r),r=""),n=s;return r&&Wi(o,r),i?Ii.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case Qe:t[c+1]+=a,t[c+2]+=h;case $e:a=t[c+1],h=t[c+2],p.push($e,a,h),c+=3;break;case si:t[c+1]+=a;case ii:a=t[c+1],p.push(ti,a,h),c+=2;break;case ri:t[c+1]+=h;case ni:h=t[c+1],p.push(ti,a,h),c+=2;break;case ei:t[c+1]+=a,t[c+2]+=h;case ti:a=t[c+1],h=t[c+2],p.push(ti,a,h),c+=3;break;case li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=hi;case hi:o=r===oi||r===hi,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(oi,l,d,i,s,a,h),c+=5;break;case ai:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=oi;case oi:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(oi,t[c+1],t[c+2],i,s,a,h),c+=7;break;case pi:t[c+1]+=a,t[c+2]+=h,n=ui;case ui:o=r===di||r===ui,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Ci(p,a,h,i,s,t[c+1],t[c+2]):p.push(di,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ci:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=di;case di:i=t[c+1],s=t[c+2],e?Ci(p,a,h,i,s,t[c+3],t[c+4]):p.push(di,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case gi:t[c+6]+=a,t[c+7]+=h;case _i:Oi(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case yi:case fi:p.push(fi),c++;break;case mi:a=t[c+1],h=t[c+2],e?Si(p,a,h,t[c+3],t[c+4]):Fi(p,t,c,5),c+=5;break;case vi:a=t[c+1],h=t[c+2],e?Ti(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Fi(p,t,c,9),c+=9;break;case xi:a=t[c+1],h=t[c+2],e?Ti(p,a,h,t[c+3],t[c+4],t[c+5]):Fi(p,t,c,6),c+=6;break;case wi:Ri(e?p:Fi(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Di),a=Di.x,h=Di.y,c+=9;break;case Ei:e?Ri(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Fi(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case bi:Li(e?p:Fi(p,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 ki:e?Li(p,t[c+1],t[c+2],t[c+3],0,360,!1):Fi(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Bi:Pi(e?p:Fi(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Di),a=Di.x,h=Di.y,c+=6;break;default:return Mi.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push($e,t.x,t.y);break;case"L":e.push(ti,t.x,t.y);break;case"C":e.push(oi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(di,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(fi)}}),e},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){Ai.index===Ai.length&&(Ai.index=1,t.push(Ai.name)),t.push(Number(e)),Ai.index++,Ai.dot=0}},{current:Ai,pushData:Wi,copyData:Fi}=Ii,{M:zi,L:Hi,C:Ui,Q:Ni,Z:Yi,N:Xi,D:Vi,X:Gi,G:ji,F:Ki,O:Zi,P:qi,U:Ji}=fe,{getMinDistanceFrom:$i,getRadianFrom:Qi}=K,{tan:ts,min:es,abs:is}=Math,ss={},ns={beginPath(t){t.length=0},moveTo(t,e,i){t.push(zi,e,i)},lineTo(t,e,i){t.push(Hi,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(Ui,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(Ni,e,i,s,n)},closePath(t){t.push(Yi)},rect(t,e,i,s,n){t.push(Xi,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(Gi,e,i,s,n,r);else{const o=E.fourNumber(r);o?t.push(Vi,e,i,s,n,...o):t.push(Xi,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){a(r)?t.push(Ki,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(ji,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(qi,e,i,s):(a(r)&&(r=360),t.push(Zi,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h){if(!o(a)){const t=$i(a,h,e,i,s,n);r=es(r,es(t/2,t/2*is(ts(Qi(a,h,e,i,s,n)/2))))}t.push(Ji,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){Ne.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,ss),t.push(zi,ss.x,ss.y),rs(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){Ne.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,ss),t.push(zi,ss.x,ss.y),os(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){Ne.points(t,e,i,s)}},{ellipse:rs,arc:os}=ns,{moveTo:as,lineTo:hs,quadraticCurveTo:ls,bezierCurveTo:ds,closePath:cs,beginPath:us,rect:ps,roundRect:_s,ellipse:gs,arc:fs,arcTo:ys,drawEllipse:ms,drawArc:vs,drawPoints:xs}=ns;class ws{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?_e.parse(t):t:[],this}beginPath(){return us(this.__path),this.paint(),this}moveTo(t,e){return as(this.__path,t,e),this.paint(),this}lineTo(t,e){return hs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return ds(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return cs(this.__path),this.paint(),this}rect(t,e,i,s){return ps(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return _s(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return gs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return fs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return ys(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return ms(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return vs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return xs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Es,L:bs,C:ks,Q:Bs,Z:Ss,N:Ts,D:Ps,X:Ls,G:Rs,F:Cs,O:Os,P:Ms,U:Ds}=fe,Is=Wt.get("PathDrawer"),As={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Es:t.moveTo(e[s+1],e[s+2]),s+=3;break;case bs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case ks: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 Ss: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 Ps: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 Ls:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Rs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*k,e[s+6]*k,e[s+7]*k,e[s+8]),s+=9;break;case Cs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,B,!1),s+=5;break;case Os:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*k,e[s+5]*k,e[s+6]),s+=7;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],0,B,!1),s+=4;break;case Ds: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:Ws,L:Fs,C:zs,Q:Hs,Z:Us,N:Ns,D:Ys,X:Xs,G:Vs,F:Gs,O:js,P:Ks,U:Zs}=fe,{toTwoPointBounds:qs,toTwoPointBoundsByQuadraticCurve:Js,arcTo:$s,arc:Qs,ellipse:tn}=Ne,{addPointBounds:en,copy:sn,addPoint:nn,setPoint:rn,addBounds:on,toBounds:an}=st,hn=Wt.get("PathBounds");let ln,dn,cn;const un={},pn={},_n={},gn={toBounds(t,e){gn.toTwoPointBounds(t,pn),an(pn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return rn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Us||o===zs||o===Hs?rn(e,h,l):rn(e,t[a+1],t[a+2])),o){case Ws:case Fs:h=t[a+1],l=t[a+2],nn(e,h,l),a+=3;break;case zs:n=t[a+5],r=t[a+6],qs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,un),en(e,un),h=n,l=r,a+=7;break;case Hs:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],Js(h,l,i,s,n,r,un),en(e,un),h=n,l=r,a+=5;break;case Us:a+=1;break;case Ns:h=t[a+1],l=t[a+2],on(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ys:case Xs:h=t[a+1],l=t[a+2],on(e,h,l,t[a+3],t[a+4]),a+=o===Ys?9:6;break;case Vs:tn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],un,_n),0===a?sn(e,un):en(e,un),h=_n.x,l=_n.y,a+=9;break;case Gs:h=t[a+1],l=t[a+2],dn=t[a+3],cn=t[a+4],on(e,h-dn,l-cn,2*dn,2*cn),h+=dn,a+=5;break;case js:Qs(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],un,_n),0===a?sn(e,un):en(e,un),h=_n.x,l=_n.y,a+=7;break;case Ks:h=t[a+1],l=t[a+2],ln=t[a+3],on(e,h-ln,l-ln,2*ln,2*ln),h+=ln,a+=4;break;case Zs:$s(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],un,_n),0===a?sn(e,un):en(e,un),h=_n.x,l=_n.y,a+=6;break;default:return void hn.error(`command: ${o} [index:${a}]`,t)}}},{M:fn,L:yn,Z:mn}=fe,{getCenterX:vn,getCenterY:xn}=K,{arcTo:wn}=ns,En={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=0;const g=t.length,f=[];for(;o<g;){switch(s=t[o],s){case fn:l=p=t[o+1],d=_=t[o+2],o+=3,t[o]===yn?(c=t[o+1],u=t[o+2],f.push(fn,vn(l,c),xn(d,u))):f.push(fn,l,d);break;case yn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case yn:wn(f,a,h,t[o+1],t[o+2],e,p,_);break;case mn:wn(f,a,h,l,d,e,p,_);break;default:f.push(yn,a,h)}p=a,_=h;break;case mn:n!==mn&&(wn(f,l,d,c,u,e,p,_),f.push(mn)),o+=1;break;default:r=Ee[s];for(let e=0;e<r;e++)f.push(t[o+e]);o+=r}n=s}return s!==mn&&(f[1]=l,f[2]=d),f}};_e.creator=new ws,_e.parse=Ii.parse,_e.convertToCanvasData=Ii.toCanvasData;const bn=new ws,{drawRoundRect:kn}=be;function Bn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){kn(this,t,e,i,s,n)})}(t)}const Sn={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=Tn.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{}}}},Tn=Sn;Tn.alphaPixelTypes.forEach(t=>Tn.upperCaseTypeMap[t]=t.toUpperCase());const Pn=Wt.get("TaskProcessor");class Ln{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.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){Pn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Rn{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e){let i,s,n,r;const a=new Ln(t);return a.parent=this,d(e)?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),o(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Cn=Wt.get("Resource"),On={tasker:new Rn,map:{},get isComplete(){return Mn.tasker.isComplete},set(t,e){Mn.map[t]&&Cn.repeat(t),Mn.map[t]=e},get:t=>Mn.map[t],remove(t){const e=Mn.map[t];e&&(e.destroy&&e.destroy(),delete Mn.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Vt.image(s)),Mn.set(t,e),e},destroy(){Mn.map={}}},Mn=On,Dn={maxRecycled:10,recycledList:[],patternTasker:new Rn,get(t){let e=On.get(t.url);return e||On.set(t.url,e=Vt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||In.recycledList.push(t)})},clearRecycled(){const t=In.recycledList;t.length>In.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&On.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Sn.alphaPixelTypes.some(e=>In.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Sn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Sn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){In.recycledList=[]}},In=Dn,{IMAGE:An,create:Wn}=i,{floor:Fn,max:zn}=Math;class Hn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Wn(An),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Dn.isFormat("svg",t)&&(this.isSVG=!0),Dn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),On.tasker.add(()=>te(this,void 0,void 0,function*(){return yield t(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,i,s,n,r,o){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const a=e.origin.createCanvas(zn(Fn(t+(r||0)),1),zn(Fn(i+(o||0)),1)),h=a.getContext("2d");return s&&(h.globalAlpha=s),h.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,i,s,n){const r=e.canvas.createPattern(t,i);try{s&&r.setTransform&&(r.setTransform(s),s=void 0)}catch(t){}return n&&f.stintSet(n,"transform",s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Un(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Nn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Yn(t,e){const i="_"+t;return{get(){const t=this[i];return o(t)?e:t},set(t){this[i]=t}}}function Xn(t,e){return(i,s)=>Gn(i,s,t,e&&e(s))}function Vn(t){return t}function Gn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Un(t,e,Object.assign(n,s||{})),vr(t,e,i)}function jn(t){return Xn(t)}function Kn(t,e){return Xn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Zn(t,e){return Xn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function qn(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),er(this))}}))}function Jn(t,e){return Xn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function $n(t,e){return Xn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Qn(t,e){return Xn(t,t=>({set(i){this.__setAttr(t,i,e)&&er(this)}}))}function tr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(er(this),this.__.__removeNaturalSize())}}))}function er(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function ir(t){return Xn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),er(this)}}))}const sr=Qn;function nr(t,e){return Xn(t,t=>({set(i){this.__setAttr(t,i)&&(rr(this),e&&(this.__.__useStroke=!0))}}))}function rr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&er(t)}const or=nr;function ar(t){return Xn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function hr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function lr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&cr(this)}}))}function dr(t){return Xn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>ur(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");ur(this,t,e,i),this.mask&&cr(this)}}))}function cr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function ur(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||er(t))}function pr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function _r(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function gr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function fr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Wt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function yr(t){return Xn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function mr(t){return(e,i)=>{Un(e,"__DataProcessor",{get:()=>t})}}function vr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Yn(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){let t=this[n];return void 0===t?i(this.__leaf):t};else if(p(i)){const t=g(i);a.get=function(){let e=this[n];return void 0===e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(void 0===t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(void 0===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=Nn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),Un(s,e,a)}const xr=new Wt("rewrite"),wr=[],Er=["destroy","constructor"];function br(t){return(e,i)=>{wr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function kr(){return t=>{Br()}}function Br(t){wr.length&&(wr.forEach(e=>{t&&xr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),wr.length=0)}function Sr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Er.includes(s)||e&&e.includes(s)))if(t.prototype){Nn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Tr(){return t=>{jt.register(t)}}function Pr(){return t=>{qt.register(t)}}setTimeout(()=>Br(!0));const{copy:Lr,toInnerPoint:Rr,toOuterPoint:Cr,scaleOfOuter:Or,rotateOfOuter:Mr,skewOfOuter:Dr,multiplyParent:Ir,divideParent:Ar,getLayout:Wr}=W,Fr={},{round:zr}=Math,Hr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Yr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Nr(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++)Xr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Xr(t),t.__updateChange()},updateAllChange(t){if(Gr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)Vr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,i,s,n,r,o){n||(n=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,n,t.__nowWorld,r,o):i.copyWorldToInner(s,n,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,n){const r=p(e)?Object.assign({},e):{x:e,y:i};s?Cr(t.localTransform,r,r,!0):t.parent&&Rr(t.parent.scrollWorldTransform,r,r,!0),Ur.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){p(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=zr(e),i=zr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){Ur.zoomOfLocal(t,jr(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(d(s)||(s&&(r=s),s=i),Lr(Fr,o),Or(Fr,e,i,s),Ur.hasHighPosition(t))Ur.setTransform(t,Fr,n,r);else{const e=t.x+Fr.e-o.e,a=t.y+Fr.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Ur.rotateOfLocal(t,jr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Lr(Fr,n),Mr(Fr,e,i),Ur.hasHighPosition(t)?Ur.setTransform(t,Fr,!1,s):t.set({x:t.x+Fr.e-n.e,y:t.y+Fr.f-n.f,rotation:E.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){Ur.skewOfLocal(t,jr(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Lr(Fr,t.__localMatrix),Dr(Fr,e,i,s),Ur.setTransform(t,Fr,n,r)},transformWorld(t,e,i,s){Lr(Fr,t.worldTransform),Ir(Fr,e),t.parent&&Ar(Fr,t.parent.scrollWorldTransform),Ur.setTransform(t,Fr,i,s)},transform(t,e,i,s){Lr(Fr,t.localTransform),Ir(Fr,e),Ur.setTransform(t,Fr,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&Ur.getInnerOrigin(t,n.origin),o=Wr(e,r,n.around&&Ur.getInnerOrigin(t,n.around));if(Ur.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Pt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Ur.getInnerOrigin(t,n.origin);K.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Or(i,Ur.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(Ur.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Lr(Fr,t.worldTransform),Ar(Fr,e.scrollWorldTransform),i?Fr:Object.assign({},Fr)),drop(t,e,i,s){t.setTransform(Ur.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||Ur.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)t.move(i);else{const n=i.x*s,r=i.y*s;i.x-=n,i.y-=r,t.move(n,r),e.requestRender(()=>Ur.animateMove(t,i,s))}}},Ur=Hr,{updateAllMatrix:Nr,updateMatrix:Yr,updateAllWorldOpacity:Xr,updateAllChange:Vr,updateChange:Gr}=Ur;function jr(t,e){return t.parent?K.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Kr={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)=>qr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>qr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>qr(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 Zr;function qr(t,e){return e||(Zr=0),t.__.mask&&(Zr=1),Zr<0?null:(Zr&&(Zr=-1),!0)}const{updateBounds:Jr}=Hr,$r={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),Qr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)to(e[t],e)},updateBounds(t,e){const i=[t];to(t,i),eo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Jr(s[t]);e&&e===i||Jr(i)}}},{pushAllChildBranch:Qr,pushAllBranchStack:to,updateBoundsByBranchStack:eo}=$r,io={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:so,updateBounds:no}=Hr,{toOuterOf:ro,getPoints:oo,copy:ao}=Pt,ho="_localContentBounds",lo="_worldContentBounds",co="_worldBoxBounds",uo="_worldStrokeBounds";class po{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 ro(this.contentBounds,this.leaf.__localMatrix,this[ho]||(this[ho]={})),this[ho]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ro(this.contentBounds,this.leaf.__world,this[lo]||(this[lo]={})),this[lo]}get worldBoxBounds(){return ro(this.boxBounds,this.leaf.__world,this[co]||(this[co]={})),this[co]}get worldStrokeBounds(){return ro(this.strokeBounds,this.leaf.__world,this[uo]||(this[uo]={})),this[uo]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:i}=t;if(t.isApp)return no(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return W.defaultMatrix;case"page":t=e.zoomLayer;default:return so(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 Ot(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=W.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=so(s,e,!0)}if(o||(o=W.getLayout(r)),ao(o,a),K.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=oo(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.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.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 _o{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class go extends _o{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}go.ADD="child.add",go.REMOVE="child.remove",go.CREATED="created",go.MOUNTED="mounted",go.UNMOUNTED="unmounted",go.DESTROY="destroy";const fo="property.scroll";class yo extends _o{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}yo.CHANGE="property.change",yo.LEAFER_CHANGE="property.leafer_change",yo.SCROLL=fo;const mo={scrollX:fo,scrollY:fo};class vo extends _o{constructor(t,e){super(t),Object.assign(this,e)}}vo.LOAD="image.load",vo.LOADED="image.loaded",vo.ERROR="image.error";class xo extends _o{static checkHas(t,e,i){"on"===i?e===ko?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(wo)||t.hasEvent(Eo)||t.hasEvent(bo),t.__hasWorldEvent=t.hasEvent(ko))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(wo,t),"inner"===e&&t.emit(Eo,t)),t.emit(bo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(ko,this)}}xo.RESIZE="bounds.resize",xo.INNER="bounds.inner",xo.LOCAL="bounds.local",xo.WORLD="bounds.world";const{RESIZE:wo,INNER:Eo,LOCAL:bo,WORLD:ko}=xo,Bo={};[wo,Eo,bo,ko].forEach(t=>Bo[t]=1);class So extends _o{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){p(t)?(super(So.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}So.RESIZE="resize";class To extends _o{constructor(t,e){super(t),this.data=e}}To.REQUEST="watch.request",To.DATA="watch.data";class Po extends _o{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Po.REQUEST="layout.request",Po.START="layout.start",Po.BEFORE="layout.before",Po.LAYOUT="layout",Po.AFTER="layout.after",Po.AGAIN="layout.again",Po.END="layout.end";class Lo extends _o{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Lo.REQUEST="render.request",Lo.CHILD_START="render.child_start",Lo.CHILD_END="render.child_end",Lo.START="render.start",Lo.BEFORE="render.before",Lo.RENDER="render",Lo.AFTER="render.after",Lo.AGAIN="render.again",Lo.END="render.end",Lo.NEXT="render.next";class Ro extends _o{}Ro.START="leafer.start",Ro.BEFORE_READY="leafer.before_ready",Ro.READY="leafer.ready",Ro.AFTER_READY="leafer.after_ready",Ro.VIEW_READY="leafer.view_ready",Ro.VIEW_COMPLETED="leafer.view_completed",Ro.STOP="leafer.stop",Ro.RESTART="leafer.restart",Ro.END="leafer.end",Ro.TRANSFORM="leafer.transform",Ro.MOVE="leafer.move",Ro.SCALE="leafer.scale",Ro.ROTATE="leafer.rotate",Ro.SKEW="leafer.skew";const{MOVE:Co,SCALE:Oo,ROTATE:Mo,SKEW:Do}=Ro,Io={x:Co,y:Co,scaleX:Oo,scaleY:Oo,rotation:Mo,skewX:Do,skewY:Do},Ao={};class Wo{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=Fo(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],Bo[t]&&xo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=Fo(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],Bo[t]&&xo.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]));p(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const s=Fo(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Fo(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Ao)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Ao)}}const{on:zo,on_:Ho,off:Uo,off_:No,once:Yo,emit:Xo,emitEvent:Vo,hasEvent:Go,destroy:jo}=Wo.prototype,Ko={on:zo,on_:Ho,off:Uo,off_:No,once:Yo,emit:Xo,emitEvent:Vo,hasEvent:Go,destroyEventer:jo},Zo=Wt.get("setAttr"),qo={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||o(e)||(Zo.warn(this.innerName,t,e),e=void 0),p(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new yo(yo.LEAFER_CHANGE,this,t,s,e));const i=Io[t];i&&(this.emitEvent(new Ro(i,this)),this.emitEvent(new Ro(Ro.TRANSFORM,this)))}this.emitPropertyEvent(yo.CHANGE,t,s,e);const i=mo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new yo(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Jo,multiplyParent:$o,translateInner:Qo,defaultWorld:ta}=W,{toPoint:ea,tempPoint:ia}=ht,sa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;$o(this.__local||e,t?t.__scrollWorld||t.__world:ta,i,!!e.affectScaleOrRotation,n),s&&Qo(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Jo(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)&&(ea(i.around||i.origin,t.boxBounds,ia),Qo(e,-ia.x,-ia.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:na,updateAllMatrix:ra}=Hr,{updateBounds:oa}=$r,{toOuterOf:aa,copyAndSpread:ha,copy:la}=Pt,{toBounds:da}=gn,ca={__updateWorldBounds(){const t=this.__layout;aa(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&xo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&xo.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(),aa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){aa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){aa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__pathInputed?da(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ra(this),oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ra(this),oa(this,this))):na(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;ha(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?ha(e.renderBounds,e.boxBounds,e.renderSpread):la(e.renderBounds,e.strokeBounds)}},ua={__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),Hr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Wt.showBounds&&Wt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:pa}=Kr,_a={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)pa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)pa(i[s],e)||i[s].__clip(t,e)}}},ga={},{LEAF:fa,create:ya}=i,{toInnerPoint:ma,toOuterPoint:va,multiplyParent:xa}=W,{toOuterOf:wa}=Pt,{copy:Ea,move:ba}=K,{moveLocal:ka,zoomOfLocal:Ba,rotateOfLocal:Sa,skewOfLocal:Ta,moveWorld:Pa,zoomOfWorld:La,rotateOfWorld:Ra,skewOfWorld:Ca,transform:Oa,transformWorld:Ma,setTransform:Da,getFlipTransform:Ia,getLocalOrigin:Aa,getRelativeWorld:Wa,drop:Fa}=Hr;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return po}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=ya(fa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(go.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(go.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(go.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(go.MOUNTED)):this.__emitLifeEvent(go.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return xa(i,t.matrix,e,void 0,i),wa(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}=Dn.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),ga.scaleX=i,ga.scaleY=s,ga}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?Wa(this,e):this.worldTransform,n=i?t:{};return wa(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ea(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ea(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),ma(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){va(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return ba(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return ba(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Da(this,t,e,i)}transform(t,e,i){Oa(this,t,e,i)}move(t,e,i){ka(this,t,e,i)}moveInner(t,e,i){Pa(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Ba(this,Aa(this,t),e,i,s,n)}rotateOf(t,e,i){Sa(this,Aa(this,t),e,i)}skewOf(t,e,i,s,n){Ta(this,Aa(this,t),e,i,s,n)}transformWorld(t,e,i){Ma(this,t,e,i)}moveWorld(t,e,i){Pa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){La(this,t,e,i,s,n)}rotateOfWorld(t,e){Ra(this,t,e)}skewOfWorld(t,e,i,s,n){Ca(this,t,e,i,s,n)}flip(t,e){Oa(this,Ia(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 Xt.need("path")}getMotionPoint(t){return Xt.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){Fa(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):vr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Qn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new go(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(go.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=Qt([Sr(qo),Sr(sa),Sr(ca),Sr(Ko),Sr(ua)],t.Leaf);const{setListWithFn:za}=Pt,{sort:Ha}=$r,{localBoxBounds:Ua,localStrokeBounds:Na,localRenderBounds:Ya,maskLocalBoxBounds:Xa,maskLocalStrokeBounds:Va,maskLocalRenderBounds:Ga}=Kr,ja=new Wt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){za(e||this.__layout.boxBounds,this.children,this.__hasMask?Xa:Ua)}__updateStrokeBounds(t){za(t||this.__layout.strokeBounds,this.children,this.__hasMask?Va:Na)}__updateRenderBounds(t){za(t||this.__layout.renderBounds,this.children,this.__hasMask?Ga:Ya)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(Ha),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ja.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=jt.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(go.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(go.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(go.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(go.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new go(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=Qt([Sr(_a)],t.Branch);class Ka{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new Ka;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 Za{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class qa extends pe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Bn(OffscreenCanvasRenderingContext2D.prototype),Bn(Path2D.prototype);const{mineType:Ja}=Sn;function $a(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Ja(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Ja(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=Vt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Vt,{canvas:(t,e)=>new qa(t,e),image:t=>new Hn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Un(e,"devicePixelRatio",{get:()=>1});const{userAgent:Qa}=navigator;Qa.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),Qa.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Qa.indexOf("Mac")>-1?e.os="Mac":Qa.indexOf("Linux")>-1&&(e.os="Linux");class th{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ka;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 Ka,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(Lo.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===go.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 To(To.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ka,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[yo.CHANGE,this.__onAttrChange,this],[[go.ADD,go.REMOVE],this.__onChildEvent,this],[To.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:eh,updateBounds:ih,updateChange:sh}=Hr,{pushAllChildBranch:nh,pushAllParent:rh}=$r;const{worldBounds:oh}=Kr;class ah{constructor(t){this.updatedBounds=new Ot,this.beforeBounds=new Ot,this.afterBounds=new Ot,u(t)&&(t=new Ka(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,oh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,oh),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:hh,updateAllChange:lh}=Hr,dh=Wt.get("Layouter");class ch{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Za,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(Po.START),this.layoutOnce(),t.emitEvent(new Po(Po.END,this.layoutedBlocks,this.times))}catch(t){dh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?dh.warn("layouting"):this.times>3?dh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(To.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=Ut.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=Po,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Po(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(eh(t,!0),e.add(t),t.isBranch&&nh(t,e),rh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),rh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||ih(s[t])}ih(i)}})}(this.__levelList),function(t){t.list.forEach(sh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Po(r,a,this.times)),i.emitEvent(new Po(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Ut.end(e)}fullLayout(){const t=Ut.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Po,r=this.getBlocks(new Ka(e));e.emitEvent(new Po(i,r,this.times)),ch.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Po(s,r,this.times)),e.emitEvent(new Po(n,r,this.times)),this.addBlocks(r),Ut.end(t)}static fullLayout(t){hh(t,!0),t.isBranch?$r.updateBounds(t):Hr.updateBounds(t),lh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new ah([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new ah(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_([[Po.REQUEST,this.layout,this],[Po.AGAIN,this.layoutAgain,this],[To.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const uh=Wt.get("Renderer");class ph{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,i&&(this.config=f.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(Po.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Lo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Lo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Lo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Ot,uh.log(e.innerName,"---\x3e");try{this.emitRender(Lo.START),this.renderOnce(t),this.emitRender(Lo.END,this.totalBounds),Dn.clearRecycled()}catch(t){this.rendering=!1,uh.error(t)}uh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return uh.warn("rendering");if(this.times>3)return uh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Ot,this.renderOptions={},t)this.emitRender(Lo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Lo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Lo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Lo.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=Ut.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Ot(s);i.save(),s.spread(ph.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),Ut.end(e)}fullRender(){const t=Ut.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Ut.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Wt.showRepaint&&Wt.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Ot;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now();e.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-i))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Ot(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 Ot(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||uh.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 Lo(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Lo.REQUEST,this.update,this],[Po.END,this.__onLayoutEnd,this],[Lo.AGAIN,this.renderAgain,this],[So.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}ph.clipSpread=10;const{hitRadiusPoint:_h}=Pt;class gh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ka(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):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 Ka;if(t.length){let e;const{x:n,y:r}=this.point,o={x:n,y:r,radiusX:0,radiusY:0};for(let n=0,r=t.length;n<r;n++)if(e=t[n],(i||Hr.worldHittable(e))&&(this.hitChild(e,o),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Hr.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=>Hr.worldHittable(t))}getPath(t){const e=new Ka;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 Ka;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 Ka,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let r=t.length-1;r>-1;r--)i=t[r],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||_h(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class fh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new gh(this.target=t,this),this.finder=Vt.finder&&Vt.finder()}getByPoint(t,i,s){const{target:n,picker:r}=this;return e.backgrounder&&n&&n.updateLayout(),r.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Xt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function yh(t){return Xn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function mh(t){return Xn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function vh(){return(t,e)=>{const i="_"+e;Un(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(Vt,{watcher:(t,e)=>new th(t,e),layouter:(t,e)=>new ch(t,e),renderer:(t,e,i)=>new ph(t,e,i),selector:(t,e)=>new fh(t,e)}),e.layout=ch.fullLayout;const xh={},wh={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}},Eh={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},bh={},kh={},Bh={},Sh={},Th={},Ph={apply(){Xt.need("filter")}},Lh={},Rh={setStyleName:()=>Xt.need("state"),set:()=>Xt.need("state")},Ch={list:{},register(t,e){Ch.list[t]=e},get:t=>Ch.list[t]},{parse:Oh,objectToCanvasData:Mh}=Ii,{stintSet:Dh}=f,{hasTransparent:Ih}=wh,Ah={},Wh=Wt.get("UIData");class Fh 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,Wh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Wh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(Dh(this,"__isTransparentFill",Ih(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):p(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(Dh(this,"__isTransparentStroke",Ih(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):p(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&p(t[0])?(this.__setInput("path",t),this._path=e?Oh(t):Mh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){zh(this,"shadow",t)}setInnerShadow(t){zh(this,"innerShadow",t)}setFilter(t){zh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&kh.compute("fill",this.__leaf),e&&kh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Ah)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ah))}__removePaint(t,e){e&&this.__removeInput(t),Bh.recycleImage(t,this),"fill"===t?(Dh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Dh(this,"__isAlphaPixelStroke",void 0),Dh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function zh(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 Hh extends Fh{}class Uh extends Hh{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 Nh extends Hh{__getInputData(t,e){const i=super.__getInputData(t,e);return ue.forEach(t=>delete i[t]),i}}class Yh extends Uh{}class Xh extends Fh{}class Vh extends Fh{get __boxStroke(){return!this.__pathInputed}}class Gh extends Fh{get __boxStroke(){return!this.__pathInputed}}class jh extends Fh{}class Kh extends Fh{}class Zh extends Fh{get __pathInputed(){return 2}}class qh extends Hh{}const Jh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class $h extends Fh{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=Jh[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=jt.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange(),r.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Qh extends Vh{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 tl extends Vh{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 el={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=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)),r&&(t+=Ph.getSpread(r)),o&&(t+=o);let a=t=Math.ceil(t);return i&&i.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),n&&(a=Math.max(a,n)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},il={getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;n||(s=Object.assign({},s));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==i?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),u&&"outer"!==i?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=E.float(s.x),s.y=E.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&&sl.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),sl.axisMove(t,e)}},sl=il,{stintSet:nl}=f,rl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);nl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),nl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;nl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),nl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){ol(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=kh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Th.shadow(this,t,h),a&&(s.__isStrokes?kh.strokes(r,this,t):kh.stroke(r,this,t)),n&&(s.__isFills?kh.fills(n,this,t):kh.fill(n,this,t)),o&&this.__drawAfterFill(t,e),d&&Th.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?kh.strokes(r,this,t):kh.stroke(r,this,t)),c&&Ph.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?kh.strokes(r,this,t):kh.stroke(r,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,wh.string(e.color))}n&&(s.__isFills?kh.fills(n,this,t):kh.fill(n,this,t)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?kh.strokes(r,this,t):kh.stroke(r,this,t))}}else s.__pathInputed?ol(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?kh.fills(s,this,t):kh.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?kh.strokes(n,this,t):kh.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 ol(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&kh.stroke(n,t,e),s&&kh.fill(s,t,e),r&&t.__drawAfterFill(e,i),n&&!o&&kh.stroke(n,t,e)}const al={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var hl,ll;t.UI=hl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){E.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return bn.set(this.path=t||[]),t||this.__drawPathByBox(bn),bn}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Xt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Xt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(bn.set(i=[]),this.__drawPathByBox(bn)),t?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||Lh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?En.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&bh.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?As.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,d(r)?[r]:r)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){kh.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return Xt.need("animate")}killAnimate(t,e){}export(t,e){return Xt.need("export")}syncExport(t,e){return Xt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),hl.one(e)}static one(t,e,i,s,n){return jt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Tr()(this)}static registerData(t){mr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},Qt([mr(Fh)],t.UI.prototype,"__",void 0),Qt([vh()],t.UI.prototype,"zoomLayer",void 0),Qt([jn("")],t.UI.prototype,"id",void 0),Qt([jn("")],t.UI.prototype,"name",void 0),Qt([jn("")],t.UI.prototype,"className",void 0),Qt([hr("pass-through")],t.UI.prototype,"blendMode",void 0),Qt([lr(1)],t.UI.prototype,"opacity",void 0),Qt([dr(!0)],t.UI.prototype,"visible",void 0),Qt([hr(!1)],t.UI.prototype,"locked",void 0),Qt([hr(!1)],t.UI.prototype,"dim",void 0),Qt([hr(!1)],t.UI.prototype,"dimskip",void 0),Qt([pr(0)],t.UI.prototype,"zIndex",void 0),Qt([_r(!1)],t.UI.prototype,"mask",void 0),Qt([gr(!1)],t.UI.prototype,"eraser",void 0),Qt([Kn(0,!0)],t.UI.prototype,"x",void 0),Qt([Kn(0,!0)],t.UI.prototype,"y",void 0),Qt([Qn(100,!0)],t.UI.prototype,"width",void 0),Qt([Qn(100,!0)],t.UI.prototype,"height",void 0),Qt([Jn(1,!0)],t.UI.prototype,"scaleX",void 0),Qt([Jn(1,!0)],t.UI.prototype,"scaleY",void 0),Qt([$n(0,!0)],t.UI.prototype,"rotation",void 0),Qt([$n(0,!0)],t.UI.prototype,"skewX",void 0),Qt([$n(0,!0)],t.UI.prototype,"skewY",void 0),Qt([Kn(0,!0)],t.UI.prototype,"offsetX",void 0),Qt([Kn(0,!0)],t.UI.prototype,"offsetY",void 0),Qt([Zn(0,!0)],t.UI.prototype,"scrollX",void 0),Qt([Zn(0,!0)],t.UI.prototype,"scrollY",void 0),Qt([qn()],t.UI.prototype,"origin",void 0),Qt([qn()],t.UI.prototype,"around",void 0),Qt([jn(!1)],t.UI.prototype,"lazy",void 0),Qt([tr(1)],t.UI.prototype,"pixelRatio",void 0),Qt([ar(0)],t.UI.prototype,"renderSpread",void 0),Qt([ir()],t.UI.prototype,"path",void 0),Qt([sr()],t.UI.prototype,"windingRule",void 0),Qt([sr(!0)],t.UI.prototype,"closed",void 0),Qt([Qn(0)],t.UI.prototype,"padding",void 0),Qt([Qn(!1)],t.UI.prototype,"lockRatio",void 0),Qt([Qn()],t.UI.prototype,"widthRange",void 0),Qt([Qn()],t.UI.prototype,"heightRange",void 0),Qt([jn(!1)],t.UI.prototype,"draggable",void 0),Qt([jn()],t.UI.prototype,"dragBounds",void 0),Qt([jn("auto")],t.UI.prototype,"dragBoundsType",void 0),Qt([jn(!1)],t.UI.prototype,"editable",void 0),Qt([fr(!0)],t.UI.prototype,"hittable",void 0),Qt([fr("path")],t.UI.prototype,"hitFill",void 0),Qt([or("path")],t.UI.prototype,"hitStroke",void 0),Qt([fr(!1)],t.UI.prototype,"hitBox",void 0),Qt([fr(!0)],t.UI.prototype,"hitChildren",void 0),Qt([fr(!0)],t.UI.prototype,"hitSelf",void 0),Qt([fr()],t.UI.prototype,"hitRadius",void 0),Qt([yr("")],t.UI.prototype,"cursor",void 0),Qt([hr()],t.UI.prototype,"fill",void 0),Qt([or(void 0,!0)],t.UI.prototype,"stroke",void 0),Qt([or("inside")],t.UI.prototype,"strokeAlign",void 0),Qt([or(1,!0)],t.UI.prototype,"strokeWidth",void 0),Qt([or(!1)],t.UI.prototype,"strokeWidthFixed",void 0),Qt([or("none")],t.UI.prototype,"strokeCap",void 0),Qt([or("miter")],t.UI.prototype,"strokeJoin",void 0),Qt([or()],t.UI.prototype,"dashPattern",void 0),Qt([or(0)],t.UI.prototype,"dashOffset",void 0),Qt([or(10)],t.UI.prototype,"miterLimit",void 0),Qt([sr(0)],t.UI.prototype,"cornerRadius",void 0),Qt([sr()],t.UI.prototype,"cornerSmoothing",void 0),Qt([yh()],t.UI.prototype,"shadow",void 0),Qt([yh()],t.UI.prototype,"innerShadow",void 0),Qt([yh()],t.UI.prototype,"blur",void 0),Qt([yh()],t.UI.prototype,"backgroundBlur",void 0),Qt([yh()],t.UI.prototype,"grayscale",void 0),Qt([yh()],t.UI.prototype,"filter",void 0),Qt([hr()],t.UI.prototype,"placeholderColor",void 0),Qt([jn(100)],t.UI.prototype,"placeholderDelay",void 0),Qt([jn({})],t.UI.prototype,"data",void 0),Qt([br(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=hl=Qt([Sr(el),Sr(rl),kr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},Qt([mr(Hh)],t.Group.prototype,"__",void 0),Qt([Qn(0)],t.Group.prototype,"width",void 0),Qt([Qn(0)],t.Group.prototype,"height",void 0),t.Group=Qt([Sr(t.Branch),Tr()],t.Group);const dl=Wt.get("Leafer");t.Leafer=ll=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&On.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),ll.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const n=this.canvas=Vt.canvas(s);this.__controllers.push(this.renderer=Vt.renderer(this,n,s),this.watcher=Vt.watcher(this,s),this.layouter=Vt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(s,e),this.view=n.view,e||(this.selector=Vt.selector(this),this.interaction=Vt.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Vt.hitCanvasManager()),this.canvasManager=new $t,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),io.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(Ro.RESTART):this.emitLeafer(Ro.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(Ro.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 Ot(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 So(t,i))}__onResize(t){this.emitEvent(t),f.copyAttrs(this.__,t,ue),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new Dt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ue.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ue.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const i=f.copyAttrs({},this.canvas,ue);i[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(i)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Ro.BEFORE_READY),this.emitLeafer(Ro.READY),this.emitLeafer(Ro.AFTER_READY),io.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Ro.VIEW_READY),io.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){io.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(Ro.VIEW_COMPLETED),io.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 Xt.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 Ro(t,this))}__listenEvents(){const t=Ut.start("FirstCreate "+this.innerName);this.once([[Ro.START,()=>Ut.end(t)],[Po.START,this.updateLazyBounds,this],[Lo.START,this.__onCreated,this],[Lo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[To.DATA,this.__onWatchData,this],[Po.END,this.__onLayoutEnd,this],[Lo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ll.list.remove(this);try{this.stop(),this.emitLeafer(Ro.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Dn.clearRecycled()},100)}catch(t){dl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ka,Qt([mr(Nh)],t.Leafer.prototype,"__",void 0),Qt([Qn()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=ll=Qt([Tr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},Qt([mr(Vh)],t.Rect.prototype,"__",void 0),t.Rect=Qt([Sr(al),kr(),Tr()],t.Rect);const{add:cl,includes:ul,scroll:pl}=Pt,_l=t.Rect.prototype,gl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;if(this.children.length){const e=this.__,i=this.__layout,{renderBounds:s,boxBounds:n}=i,r=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(r),e.overflow.includes("scroll")&&(cl(r,n),pl(r,e)),this.__updateRectRenderBounds(),t=!ul(n,r),t&&"show"===e.overflow&&cl(s,r)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll()}__updateRectRenderBounds(){}__updateWorldBounds(){this.hasScroller&&this.__updateScroll(),super.__updateWorldBounds()}__checkScroll(){}__updateScroll(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},Qt([mr(Uh)],t.Box.prototype,"__",void 0),Qt([Qn(100)],t.Box.prototype,"width",void 0),Qt([Qn(100)],t.Box.prototype,"height",void 0),Qt([jn(!1)],t.Box.prototype,"resizeChildren",void 0),Qt([ar("show")],t.Box.prototype,"overflow",void 0),Qt([br(_l.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),Qt([br(_l.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),Qt([br(_l.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),Qt([br(_l.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),Qt([br(_l.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),Qt([br(_l.__updateChange)],t.Box.prototype,"__updateRectChange",null),Qt([br(_l.__render)],t.Box.prototype,"__renderRect",null),Qt([br(gl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=Qt([kr(),Tr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},Qt([mr(Yh)],t.Frame.prototype,"__",void 0),Qt([hr("#FFFFFF")],t.Frame.prototype,"fill",void 0),Qt([ar("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=Qt([Tr()],t.Frame);const{moveTo:fl,closePath:yl,ellipse:ml}=ns;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:r}=this.__,o=t/2,a=i/2,h=this.__.path=[];s?(n||r?(s<1&&ml(h,o,a,o*s,a*s,0,n,r,!1),ml(h,o,a,o,a,0,r,n,!0),s<1&&yl(h)):(s<1&&(ml(h,o,a,o*s,a*s),fl(h,t,a)),ml(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||r?(fl(h,o,a),ml(h,o,a,o,a,0,n,r,!1),yl(h)):ml(h,o,a,o,a)}},Qt([mr(Gh)],t.Ellipse.prototype,"__",void 0),Qt([sr(0)],t.Ellipse.prototype,"innerRadius",void 0),Qt([sr(0)],t.Ellipse.prototype,"startAngle",void 0),Qt([sr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=Qt([Tr()],t.Ellipse);const{moveTo:vl,lineTo:xl,drawPoints:wl}=ns,{rotate:El,getAngle:bl,getDistance:kl,defaultPoint:Bl}=K,{toBounds:Sl}=gn;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&El(i,e),i}set toPoint(t){this.width=kl(Bl,t),this.rotation=bl(Bl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?wl(e,t.points,!1,t.closed):(vl(e,0,0),xl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(wl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&bh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?Sl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},Qt([mr(Xh)],t.Line.prototype,"__",void 0),Qt([nr("center")],t.Line.prototype,"strokeAlign",void 0),Qt([Qn(0)],t.Line.prototype,"height",void 0),Qt([sr()],t.Line.prototype,"points",void 0),Qt([sr(0)],t.Line.prototype,"curve",void 0),Qt([sr(!1)],t.Line.prototype,"closed",void 0),t.Line=Qt([Tr()],t.Line);const{sin:Tl,cos:Pl,PI:Ll}=Math,{moveTo:Rl,lineTo:Cl,closePath:Ol,drawPoints:Ml}=ns,Dl=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Ml(t,this.__.points,!1,!0);else{const{width:e,height:i,sides:s}=this.__,n=e/2,r=i/2;Rl(t,n,0);for(let e=1;e<s;e++)Cl(t,n+n*Tl(2*e*Ll/s),r-r*Pl(2*e*Ll/s));Ol(t)}}__updateRenderPath(){}__updateBoxBounds(){}},Qt([mr(jh)],t.Polygon.prototype,"__",void 0),Qt([sr(3)],t.Polygon.prototype,"sides",void 0),Qt([sr()],t.Polygon.prototype,"points",void 0),Qt([sr(0)],t.Polygon.prototype,"curve",void 0),Qt([br(Dl.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),Qt([br(Dl.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=Qt([kr(),Tr()],t.Polygon);const{sin:Il,cos:Al,PI:Wl}=Math,{moveTo:Fl,lineTo:zl,closePath:Hl}=ns;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];Fl(o,n,0);for(let t=1;t<2*i;t++)zl(o,n+(t%2==0?n:n*s)*Il(t*Wl/i),r-(t%2==0?r:r*s)*Al(t*Wl/i));Hl(o)}},Qt([mr(Kh)],t.Star.prototype,"__",void 0),Qt([sr(5)],t.Star.prototype,"corners",void 0),Qt([sr(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=Qt([Tr()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}constructor(t){super(t)}},Qt([mr(Qh)],t.Image.prototype,"__",void 0),Qt([Qn("")],t.Image.prototype,"url",void 0),t.Image=Qt([Tr()],t.Image);const Ul=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Vt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Hn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new vo(vo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new et(t.worldTransform).invert(),r=new et;e&&r.translate(e.x,e.y),i&&(d(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},Qt([mr(tl)],t.Canvas.prototype,"__",void 0),Qt([mh(100)],t.Canvas.prototype,"width",void 0),Qt([mh(100)],t.Canvas.prototype,"height",void 0),Qt([mh(1)],t.Canvas.prototype,"pixelRatio",void 0),Qt([mh(!0)],t.Canvas.prototype,"smooth",void 0),Qt([jn(!1)],t.Canvas.prototype,"safeResize",void 0),Qt([mh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=Qt([Tr()],t.Canvas);const{copyAndSpread:Nl,includes:Yl,spread:Xl,setList:Vl}=Pt;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Eh.number(e,n),t.__letterSpacing=Eh.number(i,n),t.__padding=l?E.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=xh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Xl(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Yl(h,a)),this.isOverflow?(Vl(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;Nl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},Qt([mr($h)],t.Text.prototype,"__",void 0),Qt([Qn(0)],t.Text.prototype,"width",void 0),Qt([Qn(0)],t.Text.prototype,"height",void 0),Qt([hr()],t.Text.prototype,"boxStyle",void 0),Qt([jn(!1)],t.Text.prototype,"resizeFontSize",void 0),Qt([hr("#000000")],t.Text.prototype,"fill",void 0),Qt([nr("outside")],t.Text.prototype,"strokeAlign",void 0),Qt([fr("all")],t.Text.prototype,"hitFill",void 0),Qt([Qn("")],t.Text.prototype,"text",void 0),Qt([Qn("")],t.Text.prototype,"placeholder",void 0),Qt([Qn("caption")],t.Text.prototype,"fontFamily",void 0),Qt([Qn(12)],t.Text.prototype,"fontSize",void 0),Qt([Qn("normal")],t.Text.prototype,"fontWeight",void 0),Qt([Qn(!1)],t.Text.prototype,"italic",void 0),Qt([Qn("none")],t.Text.prototype,"textCase",void 0),Qt([Qn("none")],t.Text.prototype,"textDecoration",void 0),Qt([Qn(0)],t.Text.prototype,"letterSpacing",void 0),Qt([Qn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),Qt([Qn(0)],t.Text.prototype,"paraIndent",void 0),Qt([Qn(0)],t.Text.prototype,"paraSpacing",void 0),Qt([Qn("x")],t.Text.prototype,"writingMode",void 0),Qt([Qn("left")],t.Text.prototype,"textAlign",void 0),Qt([Qn("top")],t.Text.prototype,"verticalAlign",void 0),Qt([Qn(!0)],t.Text.prototype,"autoSizeAlign",void 0),Qt([Qn("normal")],t.Text.prototype,"textWrap",void 0),Qt([Qn("show")],t.Text.prototype,"textOverflow",void 0),Qt([hr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=Qt([Tr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},Qt([mr(Zh)],t.Path.prototype,"__",void 0),Qt([nr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=Qt([Tr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},Qt([mr(qh)],t.Pen.prototype,"__",void 0),Qt([(t,e)=>{Un(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=Qt([Sr(ws,["set","path","paint"]),Tr()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&Vt.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ue),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Po.END,this.__onReady,this],[Lo.START,this.__onCreated,this],[Lo.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Lo.END,this.__onChildRenderEnd,this))}},t.App=Qt([Tr()],t.App);const Gl={},jl={isHoldSpaceKey:()=>jl.isHold("Space"),isHold:t=>Gl[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Gl[t]||(Gl[t]=!0)},setUpCode(t){Gl[t]=!1}},Kl={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 Zl extends _o{get spaceKey(){return jl.isHoldSpaceKey()}get left(){return Kl.left(this)}get right(){return Kl.right(this)}get middle(){return Kl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return jl.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){qt.changeName(t,e)}}t.PointerEvent=class extends Zl{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=Qt([Pr()],t.PointerEvent);const ql=t.PointerEvent,Jl={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof Ka?t:new Ka(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return K.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),il.axisMove(t,n),n}static limitMove(t,e){il.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Jl,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Jl,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Jl,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 Pt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Pt.unsign(i),i}assignMove(t){Jl.x=t?this.totalX:this.moveX,Jl.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=Qt([Pr()],t.DragEvent);const $l=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=Qt([Pr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=Qt([Pr()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=Qt([Pr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=Qt([Pr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=Qt([Pr()],t.ZoomEvent),t.KeyEvent=class extends Zl{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=Qt([Pr()],t.KeyEvent);const Ql={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:td.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new Ka,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>Hr.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},td=Ql,ed=new Ka,{getDragEventData:id,getDropEventData:sd,getSwipeEventData:nd}=Ql;class rd{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(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||ed;return this.dragging&&(n?e?ed:new Ka(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&Kl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],Hr.draggable(e)){this.draggableList=new Ka(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=id(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:o}=i.p,a=!o||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},a||n);o&&!n&&e?Hr.animateMove(i,l,d(o)?o:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=id(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(K.getDistance(e,t)>n.config.pointer.swipeDistance){const t=nd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=sd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const od=Wt.get("emit");const ad=["move","zoom","rotate","key"];function hd(t,e,i,s,n){if(ad.some(t=>e.startsWith(t))&&t.__.hitChildren&&!dd(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&ld(r,e,i,s,n)}}function ld(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!dd(t,n)&&(Rh.updateEventStyle&&!s&&Rh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=qt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function dd(t,e){return e&&e.has(t)}const cd={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:ud,pathCanDrag:pd,pathHasOutside:_d}=Ql;class gd{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&&Kl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Kl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&jl.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(cd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ka(t),this.createTransformer(),this.dragger=new rd(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Kl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),Kl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Kl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Kl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=K.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;Kl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,jl.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,jl.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new Ka),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>ud(e.path,t));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:r,target:o}=this;e.backgrounder||t.origin||o&&o.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:r,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!_d(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!pd(t.path))&&!_d(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&K.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(ud(e.path,t.PointerEvent.LONG_TAP)||ud(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Ot(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(So.RESIZE,this.__onResize,this)],t.once(Ro.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],ld(n,t,e,!0,s))return;n.isApp&&hd(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&hd(n,t,e,!1,s),ld(n,t,e,!1,s))return}catch(t){od.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 fd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}fd.custom={};class yd extends $t{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ka,this.pixelList=new Ka}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Vt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Vt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}e.getSelector=function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Vt.selector())};const{toInnerRadiusPointOf:md,copy:vd,setRadius:xd}=K,{hitRadiusPoint:wd,hitPoint:Ed}=Pt,bd={},kd={},Bd=t.Leaf.prototype;Bd.hit=function(t,i=0){this.updateLayout(),vd(kd,t),xd(kd,i);const s=this.__world;return!!(i?wd(s,kd):Ed(s,kd))&&(this.isBranch?e.getSelector(this).hitPoint(Object.assign({},kd),i,{target:this}):this.__hitWorld(kd))},Bd.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(vd(bd,t),xd(t=bd,e.hitRadius)),md(t,i,bd),e.hitBox||n){if(Pt.hitRadiusPoint(s.boxBounds,bd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(bd)},Bd.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Bd.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Bd.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Bd.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Sd=new et,Td=t.UI.prototype;Td.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.leafer||this.parent&&this.parent.leafer;if(!t)return;const i=this.__,{hitCanvasManager:s}=t,n=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,r=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,o=n||r;this.__hitCanvas||(this.__hitCanvas=o?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(o){const{renderBounds:t}=this.__layout,s=e.image.hitCanvasSize,o=a.hitScale=Mt.set(0,0,s,s).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=Mt.set(t).scale(o);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),Dn.patternLocked=!0,this.__renderShape(a,{matrix:Sd.setWith(this.__world).scaleWith(1/o).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!r}),Dn.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},Td.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Pd=t.UI.prototype,Ld=t.Rect.prototype,Rd=t.Box.prototype;Ld.__updateHitCanvas=Rd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Pd.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Ld.__hitFill=Rd.__hitFill=function(t){return this.__hitCanvas?Pd.__hitFill.call(this,t):Pt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,i){return i||(i=r),this.updateLayout(),e.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Cd=pe.prototype;function Od(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let r;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)r=s[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(n){const{decorationColor:t,decorationHeight:r}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,r)))}}function Md(t,e){t.__.__font?Od(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Dd(t,e,i){switch(e.__.strokeAlign){case"center":Id(t,1,e,i);break;case"inside":Ad(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Id(t,2,e,i):Ad(t,"outside",e,i)}}function Id(t,e,i,s){const n=i.__;p(t)?Fd(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Wd(i,s))}function Ad(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Id(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",Od(i,n),n.blendMode="normal",Hr.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Wd(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(r){const{decorationHeight:t}=s;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function Fd(t,e,i,s,n){let r;const o=s.__,{__hasMultiStrokeStyle:a}=o;a||n.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,l=t.length;h<l;h++)if(r=t[h],(!r.image||!Bh.checkImage(s,n,r,!1))&&r.style){if(a){const{strokeStyle:t}=r;t?n.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(r.style,o.__strokeWidth*e,o)}else n.strokeStyle=r.style;r.blendMode?(n.saveBlendMode(r.blendMode),i?Wd(s,n):n.stroke(),n.restoreBlendMode()):i?Wd(s,n):n.stroke()}}function zd(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Dd(t,e,i);else switch(s.strokeAlign){case"center":Hd(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Hd(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Hd(t,2,e,i);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Hd(t,2,e,r),r.clipUI(s),r.clearWorld(n),Hr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i)}}function Hd(t,e,i,s){const n=i.__;p(t)?Fd(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&kh.strokeArrow(t,i,s)}Cd.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Cd.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Cd.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Mt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Mt.x,Mt.y,Mt.width||1,Mt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Ud,getOuterOf:Nd,getByMove:Yd,getIntersectData:Xd}=Pt;let Vd;const{stintSet:Gd}=f,{hasTransparent:jd}=wh;function Kd(t,e,i){if(!p(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Bh.image(i,t,e,n,!Vd||!Vd[e.url]);break;case"linear":s=Sh.linearGradient(e,n);break;case"radial":s=Sh.radialGradient(e,n);break;case"angular":s=Sh.conicGradient(e,n);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:wh.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:wh.string(e)})}if(s){if(h(s.style)&&jd(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 Zd={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),Vd=Bh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Kd(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(Gd(i,"__isAlphaPixelFill",n),Gd(i,"__isTransparentFill",r)):(Gd(i,"__isAlphaPixelStroke",n),Gd(i,"__isTransparentStroke",r),Gd(i,"__hasMultiStrokeStyle",o))},fill:function(t,e,i){i.fillStyle=t,Md(e,i)},fills:function(t,e,i){let s;for(let n=0,r=t.length;n<r;n++){if(s=t[n],s.image){if(Bh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),Md(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Md(e,i),i.restoreBlendMode()):Md(e,i)}},fillPathOrText:Md,fillText:Od,stroke:zd,strokes:function(t,e,i){zd(t,e,i)},strokeText:Dd,drawTextStroke:Wd,shape:function(t,i,s){const n=i.getSameCanvas(),r=t.__nowWorld,o=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:p}=t.getRenderScaleData(!0);if(o.includes(r))c=n,a=d=r;else{const{renderShapeSpread:n}=t.__layout;let _;if(e.fullImageShadow)_=r;else{const t=n?Ud(o,u===p?n*u:[n*p,n*u]):o;_=Xd(t,r)}l=o.getFitMatrix(_);let{a:g,d:f}=l;l.a<1&&(c=i.getSameCanvas(),t.__renderShape(c,s),u*=g,p*=f),d=Nd(r,l),a=Yd(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 t.__renderShape(n,s),{canvas:n,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:p}}};let qd={},Jd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:$d,rotateOfOuter:Qd,translate:tc,scaleOfOuter:ec,multiplyParent:ic,scale:sc,rotate:nc,skew:rc}=W;function oc(t,e,i,s,n,r,o){const a=$d();tc(a,e.x+i,e.y+s),sc(a,n,r),o&&Qd(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function ac(t,e,i,s,n,r,o,a,h){const l=$d();lc(l,e,i,s,n,r,o,a),h&&(Jd.a=e.width/h.width,Jd.d=e.height/h.height,ic(l,Jd)),t.transform=l}function hc(t,e,i,s,n,r,o,a,h,l,d,c){const u=$d();if(c)lc(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Qd(u,{x:i/2,y:s/2},h);else switch(nc(u,h),h){case 90:tc(u,s,0);break;case 180:tc(u,i,s);break;case 270:tc(u,0,i)}qd.x=e.x+n,qd.y=e.y+r,tc(u,qd.x,qd.y),o&&ec(u,qd,o,a)}t.transform=u}function lc(t,e,i,s,n,r,o,a){o&&nc(t,o),a&&rc(t,a.x,a.y),n&&sc(t,n,r),tc(t,e.x+i,e.y+s)}const{get:dc,translate:cc}=W,uc=new Ot,pc={},_c={};function gc(t,e,i,s){const{changeful:n,sync:r,scaleFixed:o}=i;n&&(t.changeful=n),r&&(t.sync=r),o&&(t.scaleFixed=o),t.data=fc(i,s,e)}function fc(t,e,i){t.padding&&(e=uc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:r,mode:o,align:a,offset:l,scale:d,size:c,rotation:u,skew:_,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,x={mode:o},w="center"!==a&&(u||0)%180==90;let b,k;switch(Pt.set(_c,0,0,w?n:s,w?s:n),o&&"cover"!==o&&"fit"!==o?((d||c)&&(E.getScaleData(d,c,i,pc),b=pc.scaleX,k=pc.scaleY),(a||y||f)&&(b&&Pt.scale(_c,b,k,!0),a&&ct.toPoint(a,_c,e,_c,!0,!0))):v&&!u||(b=k=Pt.getFitScale(e,_c,"fit"!==o),Pt.put(e,i,a,b,!1,_c),Pt.scale(_c,b,k,!0)),l&&K.move(_c,l),o){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(_c.x||_c.y||b||g||u||_)&&ac(x,e,_c.x,_c.y,b,k,u,_,t.clipSize);break;case"repeat":(!v||b||u||_)&&hc(x,e,s,n,_c.x,_c.y,b,k,u,_,a,t.freeTransform),f||(x.repeat="repeat");const i=p(f);(y||i)&&(x.gap=function(t,e,i,s,n){let r,o;p(t)?(r=t.x,o=t.y):r=o=t;return{x:yc(r,i,n.width,e&&e.x),y:yc(o,s,n.height,e&&e.y)}}(y,i&&f,_c.width,_c.height,e));break;default:b&&oc(x,e,_c.x,_c.y,b,k,u)}return x.transform||(e.x||e.y)&&(x.transform=dc(),cc(x.transform,e.x,e.y)),b&&"stretch"!==o&&(x.scaleX=b,x.scaleY=k),x.width=s,x.height=n,r&&(x.opacity=r),m&&(x.filters=m),f&&(x.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x}function yc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let mc,vc=new Ot;const{isSame:xc}=Pt;function wc(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||gc(n,s,i,r),!0}function Ec(t,e){Bc(t,vo.LOAD,e)}function bc(t,e){Bc(t,vo.LOADED,e)}function kc(t,e,i){e.error=i,t.forceUpdate("surface"),Bc(t,vo.ERROR,e)}function Bc(t,e,i){t.hasEvent(e)&&t.emitEvent(new vo(e,i))}function Sc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Tc,scale:Pc,copy:Lc}=W,{floor:Rc,max:Cc,abs:Oc}=Math;function Mc(t,i,s){let{scaleX:n,scaleY:r}=t.getRenderScaleData(!0,i.scaleFixed);const o=n+"-"+r+"-"+s;if(i.patternId===o||t.destroyed)return!1;{const{image:t,data:a}=i;let h,l,{width:d,height:c,scaleX:u,scaleY:p,transform:_,repeat:g,gap:f}=a;n*=s,r*=s;const y=f&&f.x*n,m=f&&f.y*r;u&&(u=Oc(u),p=Oc(p),l=Tc(),Lc(l,_),Pc(l,1/u,1/p),n*=u,r*=p),d*=n,c*=r;const v=d*c;if(!g&&v>e.image.maxCacheSize)return!1;let x=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;x>e&&(x=e)}if(v>x&&(h=Math.sqrt(v/x)),h&&(n/=h,r/=h,d/=h,c/=h),u&&(n/=u,r/=p),(_||1!==n||1!==r)&&(l||(l=Tc(),_&&Lc(l,_)),Pc(l,1/n,1/r)),l){const t=d+(y||0),e=c+(m||0);Pc(l,t/Cc(Rc(t),1),e/Cc(Rc(e),1))}const w=t.getCanvas(d,c,a.opacity,a.filters,y,m),E=t.getPattern(w,g||e.origin.noRepeat||"no-repeat",l,i);return i.style=E,i.patternId=o,!0}}const Dc={image:function(t,e,i,s,n){let r,o;const a=Dn.get(i);return mc&&i===mc.paint&&xc(s,mc.boxBounds)?r=mc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),mc=a.use>1?{leafPaint:r,paint:i,boxBounds:vc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(wc(t,e,i,a,r,s),n&&(Ec(t,o),bc(t,o))):a.error?n&&kc(t,o,a.error):(n&&(Sc(t,!0),Ec(t,o)),r.loadId=a.load(()=>{Sc(t,!1),t.destroyed||(wc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),bc(t,o)),r.loadId=void 0},e=>{Sc(t,!1),kc(t,o,e),r.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,i,s,n){const{scaleX:r,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+a&&!Lh.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&So.isResizing(t)||Lh.running)){let{width:t,height:i}=h;t*=r*a,i*=o*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,h),!0):(!s.style||s.sync||Lh.running?Mc(t,s,a):s.patternTask||(s.patternTask=Dn.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Mc(t,s,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Mc,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,Dn.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createData:gc,getPatternData:fc,fillOrFitMode:oc,clipMode:ac,repeatMode:hc},{toPoint:Ic}=ht,{hasTransparent:Ac}=wh,Wc={},Fc={};function zc(t,e,i,s){if(i){let n,r,o,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(o=t/(l-1),r=wh.string(n,s)):(o=n.offset,r=wh.string(n.color,s)),e.addColorStop(o,r),!a&&Ac(r)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Hc,getDistance:Uc}=K,{get:Nc,rotateOfOuter:Yc,scaleOfOuter:Xc}=W,{toPoint:Vc}=ht,Gc={},jc={};function Kc(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Hc(e,i);r=Nc(),n?(Xc(r,e,o/a*(s||1),1),Yc(r,e,t+90)):(Xc(r,e,1,o/a*(s||1)),Yc(r,e,t))}return r}const{getDistance:Zc}=K,{toPoint:qc}=ht,Jc={},$c={};const Qc={linearGradient:function(t,i){let{from:s,to:n,type:r,opacity:o}=t;Ic(s||"top",i,Wc),Ic(n||"bottom",i,Fc);const a=e.canvas.createLinearGradient(Wc.x,Wc.y,Fc.x,Fc.y),h={type:r,style:a};return zc(h,a,t.stops,o),h},radialGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,stretch:a}=t;Vc(s||"center",i,Gc),Vc(n||"bottom",i,jc);const h=e.canvas.createRadialGradient(Gc.x,Gc.y,0,Gc.x,Gc.y,Uc(Gc,jc)),l={type:r,style:h};zc(l,h,t.stops,o);const d=Kc(i,Gc,jc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,stretch:a}=t;qc(s||"center",i,Jc),qc(n||"bottom",i,$c);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Jc.x,Jc.y):e.canvas.createRadialGradient(Jc.x,Jc.y,0,Jc.x,Jc.y,Zc(Jc,$c)),l={type:r,style:h};zc(l,h,t.stops,o);const d=Kc(i,Jc,$c,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Kc},{copy:tu,toOffsetOutBounds:eu}=Pt,iu={},su={};function nu(t,i,s,n){const{bounds:r,shapeBounds:o}=n;if(e.fullImageShadow){if(tu(iu,t.bounds),iu.x+=i.x-o.x,iu.y+=i.y-o.y,s){const{fitMatrix:t}=n;iu.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),iu.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),iu.width*=s,iu.height*=s}t.copyWorld(n.canvas,t.bounds,iu)}else s&&(tu(iu,i),iu.x-=i.width/2*(s-1),iu.y-=i.height/2*(s-1),iu.width*=s,iu.height*=s),t.copyWorld(n.canvas,o,s?iu:i)}const{toOffsetOutBounds:ru}=Pt,ou={};const au={shadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;eu(l,su),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(su.offsetX+a.x*c*f,su.offsetY+a.y*u*f,a.blur*c*f,wh.string(a.color)),n=a.spread?1+2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0))*f:0,nu(p,su,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,r,"copy"),s=r),h?p.copyWorld(h,r,r,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),Hr.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;ru(l,ou),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(ou.offsetX+a.x*c*f,ou.offsetY+a.y*u*f,a.blur*c*f),n=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0))*f:0,nu(p,ou,n,i),p.restore(),h?(p.copyWorld(p,l,r,"copy"),p.copyWorld(h,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,wh.string(a.color),"source-in"),Hr.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:hu}=Kr;let lu;function du(t,e,i,s,n,r,o,a){switch(e){case"grayscale":lu||(lu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);uu(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":uu(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function cu(t){return t.getSameCanvas(!1,!0)}function uu(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(du(this,o,t,n,s,r,void 0,!0),s=n=null),r=i.__.opacity,lu=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=cu(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=cu(t)),n||(n=cu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||hu(i,e)||i.__render(t,e);continue}const d=1===r&&i.__.__blendMode;d&&du(this,o,t,n,s,r,void 0,!1),hu(i,e)||i.__render(n||t,e),d&&du(this,o,t,n,s,r,d,!1)}du(this,o,t,n,s,r,void 0,!0)};const pu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",_u=pu+"_#~&*+\\=|≮≯≈≠=…",gu=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 fu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const yu=fu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),mu=fu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),vu=fu(pu),xu=fu(_u),wu=fu("- —/~|┆·");var Eu;!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"}(Eu||(Eu={}));const{Letter:bu,Single:ku,Before:Bu,After:Su,Symbol:Tu,Break:Pu}=Eu;function Lu(t){return yu[t]?bu:wu[t]?Pu:mu[t]?Bu:vu[t]?Su:xu[t]?Tu:gu.test(t)?ku:bu}const Ru={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Cu(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:Ou}=Ru,{Letter:Mu,Single:Du,Before:Iu,After:Au,Symbol:Wu,Break:Fu}=Eu;let zu,Hu,Uu,Nu,Yu,Xu,Vu,Gu,ju,Ku,Zu,qu,Ju,$u,Qu,tp,ep,ip=[];function sp(t,e){ju&&!Gu&&(Gu=ju),zu.data.push({char:t,width:e}),Uu+=e}function np(){Nu+=Uu,zu.width=Uu,Hu.words.push(zu),zu={data:[]},Uu=0}function rp(){$u&&(Qu.paraNumber++,Hu.paraStart=!0,$u=!1),ju&&(Hu.startCharSize=Gu,Hu.endCharSize=ju,Gu=0),Hu.width=Nu,tp.width?Ou(Hu):ep&&op(),ip.push(Hu),Hu={words:[]},Nu=0}function op(){Nu>(Qu.maxWidth||0)&&(Qu.maxWidth=Nu)}const{top:ap,right:hp,bottom:lp,left:dp}=t.Direction4;function cp(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const up={getDrawData:function(t,i){h(t)||(t=String(t));let s=0,n=0,r=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:a,__font:l,__padding:d}=i;d&&(r?(s=d[dp],r-=d[hp]+d[dp]):i.autoSizeAlign||(s=d[dp]),o?(n=d[ap],o-=d[ap]+d[lp]):i.autoSizeAlign||(n=d[ap]));const c={bounds:{x:s,y:n,width:r,height:o},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){Qu=t,ip=t.rows,tp=t.bounds,ep=!tp.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:o}=s,{canvas:a}=e,{width:h,height:l}=tp;if(h||l||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;$u=!0,Zu=null,Gu=Vu=ju=Uu=Nu=0,zu={data:[]},Hu={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)Xu=i[s],"\n"===Xu?(Uu&&np(),Hu.paraEnd=!0,rp(),$u=!0):(Ku=Lu(Xu),Ku===Mu&&"none"!==o&&(Xu=Cu(Xu,o,!Uu)),Vu=a.measureText(Xu).width,n&&(n<0&&(ju=Vu),Vu+=n),qu=Ku===Du&&(Zu===Du||Zu===Mu)||Zu===Du&&Ku!==Au,Ju=!(Ku!==Iu&&Ku!==Du||Zu!==Wu&&Zu!==Au),Yu=$u&&r?h-r:h,t&&h&&Nu+Uu+Vu>Yu&&(e?(Uu&&np(),Nu&&rp()):(Ju||(Ju=Ku===Mu&&Zu==Au),qu||Ju||Ku===Fu||Ku===Iu||Ku===Du||Uu+Vu>Yu?(Uu&&np(),Nu&&rp()):Nu&&rp()))," "===Xu&&!0!==$u&&Nu+Uu===0||(Ku===Fu?(" "===Xu&&Uu&&np(),sp(Xu,Vu),np()):qu||Ju?(Uu&&np(),sp(Xu,Vu)):sp(Xu,Vu)),Zu=Ku);Uu&&np(),Nu&&rp(),ip.length>0&&(ip[ip.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{Qu.paraNumber++,Nu=a.measureText(t).width,ip.push({x:r||0,text:t,width:Nu,paraStart:!0}),ep&&op()})}(c,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":cp(e,"x",t[dp]);break;case"right":cp(e,"x",-t[hp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":cp(e,"y",t[ap]);break;case"bottom":cp(e,"y",-t[lp])}}(d,c,i,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,x,w,E=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(E-v.width)/2;break;case"right":v.x+=E-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,r),c.overflow&&function(t,i,s,n){if(!n)return;const{rows:r,overflow:o}=t;let{textOverflow:a}=i;if(r.splice(o),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,i,s,r),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,p(n)?(i=n.type,n.color&&(t.decorationColor=wh.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const pp={string:function(t,e){const i=d(e)&&e<1;if(h(t)){if(!i||!wh.object)return t;t=wh.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function _p(t){return t?u(t)?t:[t]:[]}Object.assign(xh,up),Object.assign(wh,pp),Object.assign(kh,Zd),Object.assign(Bh,Dc),Object.assign(Sh,Qc),Object.assign(Th,au),Object.assign(Vt,{interaction:(t,e,i,s)=>new gd(t,e,i,s),hitCanvas:(t,e)=>new qa(t,e),hitCanvasManager:()=>new yd}),$a();class gp extends _o{get list(){return _p(this.value)}get oldList(){return _p(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function fp(t){return(e,i)=>{const s="_"+i;Un(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){if(this.config){const t="target"===i;if(t){u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(p(i))e=i;else if(!1===i)return}}const s=t?gp.BEFORE_SELECT:gp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new gp(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}gp.BEFORE_SELECT="editor.before_select",gp.SELECT="editor.select",gp.AFTER_SELECT="editor.after_select",gp.BEFORE_HOVER="editor.before_hover",gp.HOVER="editor.hover";const{abs:yp}=Math,{copy:mp,scale:vp}=W,{setListWithFn:xp}=Pt,{worldBounds:wp}=Kr,Ep={a:1,b:0,c:0,d:1,e:0,f:0},bp={x:0,y:0,width:0,height:0};class kp extends t.UI{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(xp(bp,e,wp),t&&this.set(t),this.set(bp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:o,fill:a}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=yp(c.scaleX),l=yp(c.scaleY);if(mp(Ep,c),Ep.half=o%2,i!==l){vp(Ep,1/i,1/l),t.setWorld(Ep,e.matrix),t.beginPath(),n.strokeWidth=o;const{x:r,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(r*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),n.strokeWidth=o/yp(c.scaleX);r&&(h(r)?kh.stroke(r,this,t):kh.strokes(r,this,t)),a&&(h(a)?kh.fill(a,this,t):kh.fills(a,this,t))}}n.strokeWidth=o}}destroy(){this.target=null,super.destroy()}}Qt([fp(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],kp.prototype,"target",void 0);class Bp extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Sp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Tp([t],i,e),i}};function Tp(t,e,i){let s,n;for(let r=0,o=t.length;r<o;r++)if(s=t[r],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&Tp(s.children,e,i)}}const{findOne:Pp,findByBounds:Lp}=Sp;class Rp extends t.Group{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 kp,this.targetStroker=new kp,this.bounds=new Ot,this.selectArea=new Bp,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:n}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},n||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new Ka(Lp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Pp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new Ka(this.editor.editBox.rect)};return Pp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Pp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[gp.HOVER,this.onHover,this],[gp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Cp,top:Op,topRight:Mp,right:Dp,bottomRight:Ip,bottom:Ap,bottomLeft:Wp,left:Fp}=t.Direction9,{toPoint:zp}=ht,{within:Hp}=E,Up={getScaleData(t,e,i,s,n,r,o,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:_,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;r&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,x=t.scaleY/e.scaleY,w=v<0?-1:1,E=x<0?-1:1,b=a?v:w*u.width/y,k=a?x:E*u.height/m;s.x*=a?v:w,s.y*=a?x:E;const B=(-s.y+m)/m,S=(s.x+y)/y,T=(s.y+m)/m,P=(-s.x+y)/y;switch(i){case Op:c=B,h="bottom";break;case Dp:d=S,h="left";break;case Ap:c=T,h="top";break;case Fp:d=P,h="right";break;case Cp:c=B,d=P,h="bottom-right";break;case Mp:c=B,d=S,h="bottom-left";break;case Ip:c=T,d=S,h="top-left";break;case Wp:c=T,d=P,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case Op:case Ap:t=c;break;case Fp:case Dp:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const L=1!==d,R=1!==c;if(L&&(d/=b),R&&(c/=k),!o){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(zp(r||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new Ot(t.__localBoxBounds);if(Pt.includes(new Ot(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Pt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;L&&(d*=s),R&&(c*=n)}}if(L&&p){const e=u.width*t.scaleX;d=Hp(e*d,p)/e}if(R&&_){const e=u.height*t.scaleY;c=Hp(e*c,_)/e}return L&&Math.abs(d*f.width)<1&&(d=(d<0?-1:1)/f.width),R&&Math.abs(c*f.height)<1&&(c=(c<0?-1:1)/f.height),n&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case Cp:r="bottom-right";break;case Mp:r="bottom-left";break;case Ip:r="top-left";break;case Wp:r="top-right";break;default:r="center"}return zp(n||r,t.boxBounds,o,!0),{origin:o,rotation:K.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case Op:case Cp:r={x:.5,y:0},n="bottom",a=1;break;case Ap:case Ip:r={x:.5,y:1},n="top",a=1;break;case Fp:case Wp:r={x:0,y:.5},n="right",h=1;break;case Dp:case Mp:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,zp(s||n,t,o,!0);const c=K.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,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 Fp:t=Dp;break;case Cp:t=Mp;break;case Wp:t=Ip;break;case Dp:t=Fp;break;case Mp:t=Cp;break;case Ip:t=Wp}if(i)switch(t){case Op:t=Ap;break;case Cp:t=Wp;break;case Mp:t=Ip;break;case Ap:t=Op;break;case Wp:t=Cp;break;case Ip:t=Mp}return t}},Np={};function Yp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:p,rotateable:_,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&_&&(t.isHoldRotateKey(e)||!p)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?n?u:r?d:c:y?u:f?d:c;h+=45*(Up.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(E.formatRotation(h,!0)/2);const{url:v,x:x,y:w}=m,b=v+h;Np[b]?i.cursor=Np[b]:Np[b]=i.cursor={url:Vp(v,h),x:x,y:w}}function Xp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Vp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Gp extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const jp=["top","right","bottom","left"],Kp=void 0;class Zp extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return h(t)||h(e)||h(i)}constructor(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Gp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:r,resizeLines:o,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 Gp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Gp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new Gp({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...r,a,h,l,...o,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:r}=this,{stroke:o,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;this.visible=!t.locked;for(let t=0;t<8;t++)d=r[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;n.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:o,strokeWidth:a,editConfig:Kp},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}]),Xp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:n,circle:r,buttons:o,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{middlePoint:c,resizeable:u,rotateable:p,hideOnSmall:_,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Pt.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=d(_)?_:10,x=g&&!(_&&e<y&&f<y);let w,E,b,k={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,k),E=a[i],w=h[i],E.set(k),w.set(k),E.visible=x&&!(!u&&!p),w.visible=x&&p&&u&&!m,i%2&&(b=l[(i-1)/2],b.set(k),b.visible=E.visible&&!v,E.visible=w.visible=x&&!!c,(i+1)/2%2?(b.width=e,_&&2*E.width>e&&(E.visible=!1)):(b.height=f,_&&2*E.width>f&&(E.visible=!1)));r.visible=x&&p&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||g})),o.visible=x&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=jp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=jp.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?Up.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:Kp};return t?Object.assign(o,t):o}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:n}=this,{target:r}=this,{moveable:o,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(o&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||this.isHoldRotateKey(t)||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),n.x=t.x,n.y=t.y,n.point={x:r.x,y:r.y},n.bounds=Object.assign({},r.getLayoutBounds("box","local")),n.rotation=r.rotation,i&&i.includes("resize")&&(So.resizingKeys=s.leafList.keys)}onDragEnd(t){this.moving&&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")&&(So.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t),Xp(this);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&e.onSkew(t),Yp(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),h(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onMoveEnd(t){this.moving&&this.transformTool.onMove(t),this.resetDoing()}onScale(t){this.canGesture&&(t.stop(),h(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),h(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Yp(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":e=-n;break;case"ArrowRight":e=n}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i;const n=[[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]];"circle"!==e.name&&n.push([t.PointerEvent.ENTER,t=>{this.enterPoint=e,Yp(this,t)}]),this.__eventIds.push(e.on_(n))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,()=>Xp(this)],[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[t.MoveEvent.END,this.onMoveEnd,this],[t.ZoomEvent.END,this.resetDoing,this],[t.RotateEvent.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const qp={x:0,y:0,width:1e5,height:1e5};class Jp extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,qp),Object.assign(this.__world,qp)}__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 $p='\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"/>',Qp={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${$p}\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${$p}\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${$p}\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},t_=new Ot;function e_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{t_.setListWithFn(i,t=>t.getBounds("box","page")),0===t_.width&&(t_.width=.1),0===t_.height&&(t_.height=.1),e.reset(t_.get())}),s.add(e)}const i_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),s_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),n_={group(e,i,s){e.sort(s_);const{app:n,parent:r}=e[0];let o;o=s&&s.add?s:new t.Group(s),r.addAt(o,r.children.indexOf(e[0])),e.sort(i_);const a=new et(i.worldTransform);return a.divideParent(r.scrollWorldTransform),o.setTransform(a),o.editable=!0,o.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(o)),n.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(i_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(s_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},r_=Wt.get("EditToolCreator");function o_(){return t=>{h_.register(t)}}const a_=o_,h_={list:{},register(t){const{tag:e}=t.prototype;l_[e]&&r_.repeat(e),l_[e]=t},get:(t,e)=>new l_[t](e)},{list:l_}=h_;class d_ extends gp{constructor(t,e){super(t,e)}}d_.BEFORE_OPEN="innerEditor.before_open",d_.OPEN="innerEditor.open",d_.BEFORE_CLOSE="innerEditor.before_close",d_.CLOSE="innerEditor.close";class c_ extends gp{constructor(t,e){super(t,e)}}c_.BEFORE_GROUP="editor.before_group",c_.GROUP="editor.group",c_.BEFORE_UNGROUP="editor.before_ungroup",c_.UNGROUP="editor.ungroup",c_.BEFORE_OPEN="editor.before_open_group",c_.OPEN="editor.open_group",c_.BEFORE_CLOSE="editor.before_close_group",c_.CLOSE="editor.close_group";const{updateMatrix:u_}=Hr,p_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},__="top-left";class g_ extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(yo.CHANGE,e=>{if(this.checkChange&&p_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,u_(this.parent),u_(this);const a=new et(this.__world);switch(o[i]=s,this.__layout.rotationChange(),u_(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(__,r);break;case"scaleX":t.scaleOf(__,r,1);break;case"scaleY":t.scaleOf(__,1,r);break;case"skewX":t.skewOf(__,r,0);break;case"skewY":t.skewOf(__,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class f_ extends gp{constructor(t,e){super(t,e)}}f_.BEFORE_MOVE="editor.before_move",f_.MOVE="editor.move";class y_ extends gp{constructor(t,e){super(t,e)}}y_.BEFORE_SCALE="editor.before_scale",y_.SCALE="editor.scale";class m_ extends gp{constructor(t,e){super(t,e)}}m_.BEFORE_ROTATE="editor.before_rotate",m_.ROTATE="editor.rotate";class v_ extends gp{constructor(t,e){super(t,e)}}v_.BEFORE_SKEW="editor.before_skew",v_.SKEW="editor.skew";class x_{onMove(e){const{target:i,mergeConfig:s,dragStartData:n,app:r}=this.editBox;let a,{dragLimitAnimate:l}=s;o(l)&&(l=r&&r.config.pointer.dragLimitAnimate);const c=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,u=h(i.draggable),p=!l||c||u;if(e instanceof t.MoveEvent)a=e.getLocalMove(i),p&&t.DragEvent.limitMove(i,a);else{const s={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),a=t.DragEvent.getValidMove(i,n.point,s,p)}(a.x||a.y)&&(l&&!u&&c?Hr.animateMove(this,a,d(l)?l:.3):this.move(a))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:r}=this.editBox;let{around:o,lockRatio:a,flipable:h,editSize:l}=s;if(e instanceof t.ZoomEvent)this.scaleOf(i.getBoxPoint(e),e.scale,e.scale);else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(a=!0);const s=Up.getScaleData(i,r.bounds,t,e.getInnerTotal(i),a,Up.getAround(o,e.altKey),h,!n||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(s.drag=e,this.scaleWithDrag(s)):this.scaleOf(s.origin,s.scaleX,s.scaleY)}}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:r,rotateAround:o,rotateGap:a}=s,{direction:h}=e.current;let l,d;if(e instanceof t.RotateEvent)d=e.rotation,l=o?ht.getPoint(o,i.boxBounds):i.getBoxPoint(e);else{const t=Up.getRotateData(i,h,e,n,e.shiftKey?null:o||i.around||i.origin||r||"center");d=n.rotation+t.rotation-i.rotation,l=t.origin}d=E.float(E.getGapRotation(d,a,i.rotation),2),d&&this.rotateOf(l,d)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=Up.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Up.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;p(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({target:i,x:t,y:e});if(p(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:r,moveX:a.x,moveY:a.y};this.emitEvent(new f_(f_.BEFORE_MOVE,h));const l=new f_(f_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new y_(y_.BEFORE_SCALE,t));const r=new y_(y_.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(p(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new y_(y_.BEFORE_SCALE,c));const u=new y_(y_.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new et(Hr.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new y_(y_.BEFORE_SCALE,o));const a=new y_(y_.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({target:i,origin:t,rotation:e});if(d(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),l={target:i,editor:r,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new m_(m_.BEFORE_ROTATE,l));const c=new m_(m_.ROTATE,l);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(p(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new v_(v_.BEFORE_SKEW,c));const u=new v_(v_.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(Hr.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)}}t.Editor=class extends t.Group{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new Ka,this.openedGroupList=new Ka,this.simulateTarget=new g_(this),this.editBox=new Zp(this),this.editToolList={},this.selector=new Rp(this),this.editMask=new Jp(this),this.targetEventIds=[];let i=f.clone(Qp);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Xt.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&&e_(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(h(s))e=s;else if(!1===s)return}if(h_.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||h_.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(c_.BEFORE_GROUP),this.target=n_.group(this.list,this.element,t),this.emitGroupEvent(c_.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(c_.BEFORE_UNGROUP,t)),this.target=n_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(c_.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(c_.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(c_.OPEN,t)}closeGroup(t){this.emitGroupEvent(c_.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(c_.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Hr.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 c_(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(h(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(h(i))s=i;else if(!1===i)return}h_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||h_.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(d_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(d_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(d_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(d_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new d_(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&&(n_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(n_.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_(Lo.START,this.onRenderStart,this),i&&i.on_(yo.SCROLL,this.onChildScroll,this),t.on_(Lo.CHILD_START,this.onAppRenderStart,this)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},Qt([(t,e)=>{Un(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s}=this,n=Object.assign({},t);return e&&e.editConfig&&Object.assign(n,e.editConfig),s.config&&Object.assign(n,s.config),i&&(i.editConfig&&Object.assign(n,i.editConfig),"font-size"===n.editSize&&(n.lockRatio=!0),"resize-rotate"===i.pointType&&(n.around||(n.around="center"),a(n.lockRatio)&&(n.lockRatio=!0))),this.mergedConfig=n}})}],t.Editor.prototype,"mergeConfig",void 0),Qt([fp(function(t,e){t.emitEvent(new gp(gp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),Qt([fp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof Ka?i:new Ka(i),t.multiple&&e_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new gp(gp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new gp(gp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),t.Editor=Qt([Sr(x_,["editBox","editTool","emitEvent"])],t.Editor);class w_{static registerInnerEditor(){h_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}t.EditTool=class extends w_{static registerEditTool(){h_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=Qt([o_()],t.EditTool);const{left:E_,right:b_}=t.Direction9,{move:k_,copy:B_,toNumberPoints:S_}=K;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,r=t.target,o=i===E_;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.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=S_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:r,y:o}=n;i?(k_(t,r,o),s&&k_(e,-r,-o)):(s&&k_(t,-r,-o),k_(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),B_(s[7],i),B_(e[7],i),B_(s[3],a),B_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===E_||t===b_,s[t].visible=a,e[t].visible=!o&&a}},t.LineEditTool=Qt([o_()],t.LineEditTool);const{M:T_,L:P_,C:L_,Q:R_,Z:C_,N:O_,D:M_,X:D_,G:I_,F:A_,O:W_,P:F_,U:z_}=fe,H_={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case T_:case P_:U_(t,e,i,n,1),n+=3;break;case L_:U_(t,e,i,n,3),n+=7;break;case R_:U_(t,e,i,n,2),n+=5;break;case C_:n+=1;break;case O_:U_(t,e,i,n,2),n+=5;break;case M_:U_(t,e,i,n,2),n+=9;break;case D_:U_(t,e,i,n,2),n+=6;break;case I_:U_(t,e,i,n,2),n+=9;break;case A_:U_(t,e,i,n,2),n+=5;break;case W_:t[n]=I_,t.splice(n+4,0,t[n+3],0),U_(t,e,i,n,2),n+=9,r+=2;break;case F_:t[n]=A_,t.splice(n+4,0,t[n+3]),U_(t,e,i,n,2),n+=5,r+=1;break;case z_:U_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:U_}=H_,N_=W.get(),{topLeft:Y_,top:X_,topRight:V_,right:G_,bottom:j_,left:K_}=t.Direction9;function Z_(t,e,i){t.pathInputed?q_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function q_(t,e,i){H_.scale(t.__.path,e,i),t.path=t.__.path}function J_(t,e,i){const{points:s}=t;p(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):H_.scalePoints(s,e,i),t.points=s}function $_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)N_.a=e,N_.d=i,s[t].transform(N_,!0)}const Q_=t.Leaf.prototype;function tg(e,i,s){eg(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{Hr.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function eg(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)}Q_.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))},Q_.__scaleResize=function(t,e){Z_(this,t,e)},Q_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},Q_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,r=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||r&&"font-size"===n.mergedConfig.editSize)!function(t,e,i,s){let n=e;if(!o(s)){const r=t.__layout;let{width:o,height:a}=r.boxBounds;switch(o*=i-e,a*=e-i,s){case X_:case j_:n=i,r.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case K_:case G_:r.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case Y_:case V_:r.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}(this,t,e,r&&r.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),Z_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){q_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?q_(this,t,e):this.points?J_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?q_(this,t,e):this.points?J_(this,t,e):Z_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){$_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||Z_(this,t,e),i&&$_(this,t,e)},Xt.add("resize"),Xt.add("editor","resize"),Vt.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,jn),t.UI.addAttr("editConfig",void 0,jn),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),jn),t.UI.addAttr("editInner","PathEditor",jn),t.Group.addAttr("editInner","",jn),t.Text.addAttr("editInner","TextEditor",jn),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const ig=Wt.get("LeaferTypeCreator"),sg={list:{},register(t,e){ng[t]&&ig.repeat(t),ng[t]=e},run(t,e){const i=ng[t];i&&i(e)}},{list:ng,register:rg}=sg;rg("viewport",tg),rg("custom",function(t){tg(t,null,!0)}),rg("design",function(t){tg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),rg("document",function(t){tg(t,{zoom:{min:1},move:{scroll:"limit"}})});const og={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),n=K.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=K.getDistance(e.from,i.from);return{move:r,scale:K.getDistance(e.to,i.to)/o,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:n}}},ag={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;return t.shiftKey&&!s&&(s=n,n=0),s>50&&(s=Math.max(50,s/3)),n>50&&(n=Math.max(50,n/3)),{x:-s*i*2,y:-n*i*2}},getScale(t,i){let s,n=1,{zoomMode:r,zoomSpeed:o}=i;const a=t.deltaY||t.deltaX;if(r?(s="mouse"===r||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){o=E.within(o,0,1);n=1-a/(4*(t.deltaY?i.delta.y:i.delta.x))*o,n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}};class hg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const lg=t.Leafer.prototype,dg=new Ot,cg=new Q;function ug(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function pg(t,e){return Object.assign(Object.assign({},e),{scale:t})}lg.initType=function(t){sg.run(t,this)},lg.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(cg.set(t,e),s){const t=!0===s?"":s;t.includes("x")?cg.y=0:t.includes("y")?cg.x=0:Math.abs(cg.x)>Math.abs(cg.y)?cg.y=0:cg.x=0,i&&t.includes("limit")&&(dg.set(this.__world).addPoint(this.zoomLayer),il.getValidMove(dg,this.canvas.bounds,"inner",cg,!0),t.includes("x")?cg.y=0:t.includes("y")&&(cg.x=0))}return{x:n?0:cg.x,y:n?0:cg.y}},lg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const _g=gd.prototype;_g.createTransformer=function(){this.transformer=new hg(this)},_g.move=function(t){this.transformer.move(t)},_g.zoom=function(t){this.transformer.zoom(t)},_g.rotate=function(t){this.transformer.rotate(t)},_g.transformEnd=function(){this.transformer.transformEnd()},_g.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const r=e.getScale?e.getScale(t,e):ag.getScale(t,e);if(1!==r)this.zoom(pg(r,t));else{const s=e.getMove?e.getMove(t,e):ag.getMove(t,e);i.snap&&K.round(s),this.move(ug(s,t))}},_g.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:r}=og.getData(e);Object.assign(t,r),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(pg(n,t)),this.move(ug(i,t))};const gg=rd.prototype,{abs:fg}=Math;function yg(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}gg.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=fg(i),r=fg(s),o=e?1:.1,a=this.canAnimate&&this.moving&&(n>o||r>o)&&this.interaction.m.dragAnimate;if(a){const o="touch"===t.pointerType?3:1,h=70;n*(e=e?d(a)?a:.95:o)>h?e=h/n:r*e>h&&(e=h/r),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},gg.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},gg.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},gg.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Pt.maxX(o),d=Pt.maxY(o),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,_=0;this.autoMoveTimer=setInterval(()=>{p+=c,_+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},gg.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Xt.add("viewport"),Xt.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),_(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:r}=this,o=this.canvas.bounds.clone().shrink(a(n)?30:n),l=new Ot,c={x:o.x+o.width/2,y:o.y+o.height/2};let g;const{x:f,y:y,scaleX:m,scaleY:v}=r.__;if(h(t))switch(t){case"in":g=yg(m,"in");break;case"out":g=yg(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Ot(this.boxBounds)).height=0;break;case"fit-height":(t=new Ot(this.boxBounds)).width=0}else d(t)&&(g=t/m);if(g)g=this.getValidScale(g),r.scaleOfWorld(c,g,g,!1,s);else if(p(t)){const e={x:f,y:y,scaleX:m,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];l.setListWithFn(e,Kr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,o);l.set(r.getWorldBounds(e))}const{width:a,height:h}=l;let d=o.x-l.x,c=o.y-l.y;return i?(d+=Math.max((o.width-a)/2,0),c+=Math.max((o.height-h)/2,0)):(g=this.getValidScale(Math.min(o.width/a,o.height/h)),d+=(o.width-a*g)/2,c+=(o.height-h*g)/2,K.scaleOf(e,l,g),l.scaleOf(l,g),e.scaleX*=g,e.scaleY*=g),"x"===i?c=0:"y"===i&&(d=0),K.move(e,d,c),l.move(d,c),r.set(e,s),l}return r.worldBoxBounds};class mg extends t.Group{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;h(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new Ot(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:_,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=o.shrink([2,p?g.width+6:2,u?_.height+6:2,2]);_.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:p})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Lo.BEFORE,()=>this.update(!0)),this.target.leafer.on_(So.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Xt.add("scroll");class vg extends Xh{}function xg(t){return Xn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,rr(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}},Qt([mr(vg)],t.Arrow.prototype,"__",void 0),Qt([xg("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=Qt([Tr()],t.Arrow);const{M:wg,L:Eg,C:bg,Q:kg,O:Bg}=fe,{rotate:Sg,copyFrom:Tg,scale:Pg}=K,Lg={},Rg={layout(t,e,i,s,n,r,o){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case wg:case Eg:Cg(t,l+1,e,i,s,n,r,o),l+=3;break;case bg:for(h=1;h<6;h+=2)Cg(t,l+h,e,i,s,n,r,o);l+=7;break;case kg:for(h=1;h<4;h+=2)Cg(t,l+h,e,i,s,n,r,o);l+=5;break;case Bg:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){Rg.layout(t,0,0,1,1,e,i)}};function Cg(t,e,i,s,n,r,o,a){Tg(Lg,t[e],t[e+1]),o&&Sg(Lg,o,a),n&&Pg(Lg,n,r),t[e]=i+Lg.x,t[e+1]=s+Lg.y}const{layout:Og,rotate:Mg}=Rg,{getAngle:Dg}=K,Ig={x:-.5},Ag={connect:Ig,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Wg={connect:Ig,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Fg={connect:Ig,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]},zg={connect:Ig,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]},Hg={offset:Ig,path:[...Fg.path],dashPath:[1,-2.5,0,2,-1,0]};Mg(Hg.path,180,{x:-1.5,y:0});const Ug={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Ng={connect:{x:.5},path:[...Ug.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Yg={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]},Xg={path:[...Yg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Vg=f.clone(Yg),Gg=f.clone(Xg);Mg(Vg.path,45),Mg(Gg.path,45);const jg={angle:Ag,"angle-side":Wg,arrow:zg,triangle:Fg,"triangle-flip":Hg,circle:Ng,"circle-line":Ug,square:Xg,"square-line":Yg,diamond:Gg,"diamond-line":Vg,mark:{offset:Ig,path:[1,0,-2,2,0,2]}};function Kg(t,e,i,s,n,r,o){const{strokeCap:a,strokeJoin:h}=t.__,{offset:l,connect:d,path:c,dashPath:u}=p(e)?e:jg[e];let _=d?d.x:0,g=l?l.x:0;const f=[...c];return o&&u&&f.push(...u),"none"!==a&&(_-=.5),l&&("round"===h&&l.roundJoin?g+=l.roundJoin:"bevel"===h&&l.bevelJoin&&(g+=l.bevelJoin)),g&&Og(f,g,0),Og(f,s.x,s.y,n,n,Dg(i,s)),r.x=(_+g)*n,f}const{M:Zg,L:qg,C:Jg,Q:$g,Z:Qg,N:tf,D:ef,X:sf,G:nf,F:rf,O:of,P:af,U:hf}=fe,{copy:lf,copyFrom:df,getDistancePoint:cf}=K,uf={},pf={},_f={},gf={},ff={},yf={list:jg,addArrows(t,e){const{startArrow:i,endArrow:s,strokeWidth:n,dashPattern:r,__pathForRender:o}=t.__;let a,h=0,l=o.length,d=0,c=i&&"none"!==i;for(;h<l;){switch(a=o[h],a){case Zg:case qg:(d<2||h+6>=l)&&(df(ff,o[h+1],o[h+2]),!d&&c&&lf(pf,ff)),h+=3;break;case Jg:1!==d&&h+7!==l||mf(o,gf,ff,h+3),h+=7;break;case $g:1!==d&&h+5!==l||mf(o,gf,ff,h+1),h+=5;break;case Qg:return;case tf:h+=5;break;case ef:h+=9;break;case sf:h+=6;break;case nf:h+=9;break;case rf:h+=5;break;case of:h+=7;break;case af:h+=4;break;case hf:1!==d&&h+6!==l||mf(o,gf,ff,h+1),h+=6}if(d++,1===d&&a!==Zg)return;if(2===d&&c&&lf(_f,a===qg?ff:gf),h===l){const l=t.__.__pathForRender=e?[...o]:o,d=t.__.__pathForArrow=[];if(c){const e=Kg(t,i,_f,pf,n,uf,!!r);r?d.push(...e):l.push(...e),uf.x&&(cf(pf,_f,-uf.x,!0),l[1]=_f.x,l[2]=_f.y)}if(s&&"none"!==s){const e=Kg(t,s,gf,ff,n,uf,!!r);if(r?d.push(...e):l.push(...e),uf.x){let t;switch(cf(ff,gf,-uf.x,!0),a){case qg:t=h-3+1;break;case Jg:t=h-7+5;break;case $g:t=h-5+3;break;case hf:t=h-6+3}t&&vf(l,gf,t)}}}else lf(gf,ff)}}};function mf(t,e,i,s){df(e,t[s],t[s+1]),df(i,t[s+2],t[s+3])}function vf(t,e,i){t[i]=e.x,t[i+1]=e.y}Xt.add("arrow"),t.UI.addAttr("startArrow","none",xg),t.UI.addAttr("endArrow","none",xg),Object.assign(bh,yf),Object.assign(kh,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:xf,NoAndSkip:wf,YesAndSkip:Ef}=t.Answer,bf={},kf={},Bf={};class Sf{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":bf.id=t.substring(1),t=bf;break;case".":kf.className=t.substring(1),t=kf;break;default:Bf.tag=t,t=Bf}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Hr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),r===xf||r===Ef){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<wf&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(go.REMOVE,this.__onRemoveChild,this),this.target.on_(yo.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 Tf=t.UI.prototype;function Pf(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Vt.selector())}Tf.find=function(t,e){return Pf(this).getBy(t,this,!1,e)},Tf.findOne=function(t,e){return Pf(this).getBy(t,this,!0,e)},Xt.add("find"),Vt.finder=function(t){return new Sf(t)};const{setPoint:Lf,addPoint:Rf,toBounds:Cf}=st;const Of={syncExport(t,i,s){let n;Lh.running=!0;try{const r=Sn.fileType(i),a=i.includes(".");s=Sn.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===r)a&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!a||t.toJSON(s.json)};else if("svg"===r)a&&l(h(t.toSVG(),"svg"),i),n={data:!!a||t.toSVG()};else{let e,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:_,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=o(s.smooth)?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),w=d&&f&&o(s.fill)?t.fill:s.fill,b=Sn.isOpaqueImage(i)||w,k=new et;if(f)e=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||t;default:k.set(l).divide(t.getTransform(i));const e=i.worldTransform;a/=a/e.scaleX,h/=h/e.scaleY}e=t.getBounds("render",i)}const B={scaleX:1,scaleY:1};E.getScaleData(s.scale,s.size,e,B);let S=s.pixelRatio||1,{x:T,y:P,width:L,height:R}=new Ot(e).scale(B.scaleX,B.scaleY);_&&(T+=_.x,P+=_.y,L=_.width,R=_.height);const C={exporting:!0,matrix:k.scale(1/B.scaleX,1/B.scaleY).invert().translate(-T,-P).withScale(1/a*B.scaleX,1/h*B.scaleY)};let O,M=Vt.canvas({width:Math.floor(L),height:Math.floor(R),pixelRatio:S,smooth:v,contextSettings:x});if(p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=M.bounds),M.save(),u&&!o(w)){const e=t.get("fill");t.fill="",t.__render(M,C),t.fill=e}else t.__render(M,C);if(M.restore(),O&&O.__updateWorldOpacity(),g){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?Rf(o,n,r):Lf(o={},n,r)),a++;const h=new Ot;return o&&(Cf(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:S};M=Vt.canvas(s),M.copyWorld(t,r,s),t.destroy()}if(y){const[t,e,i,s]=E.fourNumber(y),n=M,{width:r,height:o}=n;M=Vt.canvas({width:r+s+e,height:o+t+i,pixelRatio:S}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}b&&M.fillWorld(M.bounds,w||"#FFFFFF","destination-over"),m&&m(M);n={data:"canvas"===i?M:M.export(i,s),width:M.pixelWidth,height:M.pixelHeight,renderBounds:e,trimBounds:r}}}catch(t){n={data:"",error:t}}return Lh.running=!1,n},export(t,i,s){return Lh.running=!0,function(t){Mf||(Mf=new Rn);return new Promise(e=>{Mf.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(r=>{const o=()=>te(this,void 0,void 0,function*(){if(!On.isComplete)return e.requestRender(o);const a=Lh.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),r()});t.updateLayout(),Df(t);const{leafer:a}=t;a?a.waitViewCompleted(o):o()}))}};let Mf;function Df(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Df(t))}const If=pe.prototype,Af=Wt.get("@leafer-in/export");If.export=function(t,e){const{quality:i,blob:s}=Sn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},If.toBlob=function(t,i){return new Promise(s=>{e.origin.canvasToBolb(this.view,t,i).then(t=>{s(t)}).catch(t=>{Af.error(t),s(null)})})},If.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},If.saveAs=function(t,i){return new Promise(s=>{e.origin.canvasSaveAs(this.view,t,i).then(()=>{s(!0)}).catch(t=>{Af.error(t),s(!1)})})},Xt.add("export"),Object.assign(Lh,Of),t.UI.prototype.export=function(t,e){return Lh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Lh.syncExport(this,t,e)};const Wf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Ff={top:"flex-start",middle:"center",bottom:"flex-end"},zf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Hf(t,e,i){const{style:s}=t,{fill:n,padding:r,textWrap:a,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(p(e))switch(e.type){case"solid":i=wh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=wh.string(h(t)?t:t.color);break;default:o(e.r)||(i=wh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,p(d)?(c=d.type,d.color&&(s.textDecorationColor=wh.string(d.color))):c=d,s.textDecoration=zf[c],s.textTransform=Wf[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Ff[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===a||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===a?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(r)?r.map(t=>t*i+"px").join(" "):(r||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}t.TextEditor=class extends w_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:r}=n;n.contentEditable="true",r.position="fixed",r.transformOrigin="left top",r.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:o}=e.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(n):o.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth&&(i+=20,o.autoSizeAlign))switch(o.textAlign){case"center":n=-i/2;break;case"right":n=-i}if(o.__autoHeight&&(s+=20,o.autoSizeAlign))switch(o.verticalAlign){case"middle":r=-s/2;break;case"bottom":r=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:_}=new et(t.worldTransform).scale(1/e).translateInner(n,r),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${p},${_})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||Hf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}},t.TextEditor=Qt([a_()],t.TextEditor),Xt.add("text-editor","editor");class Uf extends Qh{setText(t){this._text=t,this.__htmlChanged=!0}}return t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}},Qt([mr(Uf)],t.HTMLText.prototype,"__",void 0),Qt([Qn("")],t.HTMLText.prototype,"text",void 0),Qt([jn("TextEditor")],t.HTMLText.prototype,"editInner",void 0),Qt([hr(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=Qt([Tr()],t.HTMLText),Xt.add("html"),t.AlignHelper=ct,t.AroundHelper=ht,t.ArrowData=vg,t.AutoBounds=Dt,t.BezierHelper=Ne,t.Bounds=Ot,t.BoundsEvent=xo,t.BoundsHelper=Pt,t.BoxData=Uh,t.BranchHelper=$r,t.BranchRender=_a,t.CanvasData=tl,t.CanvasManager=$t,t.ChildEvent=go,t.ColorConvert=wh,t.Creator=Vt,t.Cursor=fd,t.DataHelper=f,t.Debug=Wt,t.DragBoundsHelper=il,t.Dragger=rd,t.EditBox=Zp,t.EditDataHelper=Up,t.EditPoint=Gp,t.EditSelect=Rp,t.EditSelectHelper=Sp,t.EditToolCreator=h_,t.EditorEvent=gp,t.EditorGroupEvent=c_,t.EditorHelper=n_,t.EditorMoveEvent=f_,t.EditorRotateEvent=m_,t.EditorScaleEvent=y_,t.EditorSkewEvent=v_,t.Effect=Th,t.EllipseData=Gh,t.EllipseHelper=Je,t.Event=_o,t.EventCreator=qt,t.Eventer=Wo,t.Export=Lh,t.FileHelper=Sn,t.Filter=Ph,t.Finder=Sf,t.FrameData=Yh,t.GroupData=Hh,t.HTMLTextData=Uf,t.HitCanvasManager=yd,t.ImageData=Qh,t.ImageEvent=vo,t.ImageManager=Dn,t.IncrementId=i,t.InnerEditor=w_,t.InnerEditorEvent=d_,t.InteractionBase=gd,t.InteractionHelper=Ql,t.Keyboard=jl,t.LayoutEvent=Po,t.Layouter=ch,t.LeafBounds=ca,t.LeafBoundsHelper=Kr,t.LeafData=m,t.LeafDataProxy=qo,t.LeafEventer=Ko,t.LeafHelper=Hr,t.LeafLayout=po,t.LeafLevelList=Za,t.LeafList=Ka,t.LeafMatrix=sa,t.LeafRender=ua,t.LeaferCanvas=qa,t.LeaferCanvasBase=pe,t.LeaferData=Nh,t.LeaferEvent=Ro,t.LeaferImage=Hn,t.LeaferTypeCreator=sg,t.LineData=Xh,t.MathHelper=E,t.Matrix=et,t.MatrixHelper=W,t.MultiTouchHelper=og,t.MyDragEvent=$l,t.MyImage=Ul,t.MyPointerEvent=ql,t.NeedConvertToCanvasCommandMap=me,t.OneRadian=k,t.PI2=B,t.PI_2=S,t.Paint=kh,t.PaintGradient=Sh,t.PaintImage=Bh,t.PathArrow=bh,t.PathArrowModule=yf,t.PathBounds=gn,t.PathCommandDataHelper=ns,t.PathCommandMap=fe,t.PathConvert=Ii,t.PathCorner=En,t.PathCreator=ws,t.PathData=Zh,t.PathDrawer=As,t.PathHelper=_e,t.PathMatrixHelper=Rg,t.PathNumberCommandLengthMap=Ee,t.PathNumberCommandMap=we,t.PenData=qh,t.Picker=gh,t.Platform=e,t.Plugin=Xt,t.Point=Q,t.PointHelper=K,t.PointerButton=Kl,t.PolygonData=jh,t.PropertyEvent=yo,t.RectData=Vh,t.RectHelper=be,t.RectRender=al,t.RenderEvent=Lo,t.Renderer=ph,t.ResizeEvent=So,t.Resource=On,t.Run=Ut,t.ScrollBar=mg,t.SelectArea=Bp,t.Selector=fh,t.StarData=Kh,t.State=Rh,t.StringNumberMap=It,t.Stroker=kp,t.TaskItem=Ln,t.TaskProcessor=Rn,t.TextConvert=xh,t.TextData=$h,t.TransformTool=x_,t.Transformer=hg,t.Transition=Ch,t.TwoPointBoundsHelper=st,t.UIBounds=el,t.UICreator=jt,t.UIData=Fh,t.UIEvent=Zl,t.UIRender=rl,t.UnitConvert=Eh,t.WaitHelper=io,t.WatchEvent=To,t.Watcher=th,t.WheelEventHelper=ag,t.addViewport=tg,t.addViewportConfig=eg,t.affectRenderBoundsType=ar,t.affectStrokeBoundsType=nr,t.arrowType=xg,t.attr=Vn,t.autoLayoutType=qn,t.boundsType=Qn,t.canvasPatch=Bn,t.canvasSizeAttrs=ue,t.createAttr=function(t){return(e,i)=>{Un(e,i,Yn(i,t))}},t.createDescriptor=Yn,t.cursorType=yr,t.dataProcessor=mr,t.dataType=jn,t.decorateLeafAttr=Xn,t.defineDataProcessor=vr,t.defineKey=Un,t.defineLeafAttr=Gn,t.doBoundsType=er,t.doStrokeType=rr,t.effectType=yh,t.emptyData=r,t.eraserType=gr,t.extraPropertyEventMap=mo,t.getBoundsData=P,t.getDescriptor=Nn,t.getMatrixData=L,t.getPointData=T,t.hitType=fr,t.isArray=u,t.isData=_,t.isEmptyData=g,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=p,t.isString=h,t.isUndefined=o,t.layoutProcessor=function(t){return(e,i)=>{Un(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Io,t.maskType=_r,t.naturalBoundsType=tr,t.opacityType=lr,t.pathInputType=ir,t.pathType=sr,t.pen=bn,t.positionType=Kn,t.registerEditTool=o_,t.registerInnerEditor=a_,t.registerUI=Tr,t.registerUIEvent=Pr,t.resizeType=mh,t.rewrite=br,t.rewriteAble=kr,t.rotationType=$n,t.scaleType=Jn,t.scrollType=Zn,t.sortType=pr,t.strokeType=or,t.surfaceType=hr,t.tempBounds=Mt,t.tempMatrix=it,t.tempPoint=tt,t.tryToNumber=function(t){return"string"==typeof t&&c.test(t)?+t:t},t.useCanvas=$a,t.useModule=Sr,t.version="1.9.3",t.visibleType=dr,t.zoomLayerType=vh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
1
+ var LeaferUI=function(t){"use strict";const e={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i;var n;t.Answer=void 0,(n=t.Answer||(t.Answer={}))[n.No=0]="No",n[n.Yes=1]="Yes",n[n.NoAndSkip=2]="NoAndSkip",n[n.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function _(t){return p(t)&&!u(t)}function g(t){return"{}"===JSON.stringify(t)}const f={default:(t,e)=>(y(e,t),y(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return y(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&y(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:y}=f;class m{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{round:v,pow:x,PI:w}=Math,E={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber(t,e){let i;if(u(t))switch(t.length){case 4:i=o(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),E.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=o(e)?1e12:x(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=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&E.assignScale(s,t);return s},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:b,randColor:t=>`rgba(${b(255)},${b(255)},${b(255)},${t||1})`};function b(t){return Math.round(Math.random()*t)}const k=w/180,B=2*w,T=w/2;function S(){return{x:0,y:0}}function P(){return{x:0,y:0,width:0,height:0}}function L(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:R,cos:C,acos:O,sqrt:M}=Math,{float:D}=E,I={};function A(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const W={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:A(),tempMatrix:{},set(t,e=1,i=0,s=0,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},get:L,getWorld:A,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){F.toInnerPoint(t,e,I),F.scaleOfInner(t,I,i,s)},scaleOfInner(t,e,i,s=i){F.translateInner(t,e.x,e.y),F.scale(t,i,s),F.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=C(e*=k),a=R(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){F.toInnerPoint(t,e,I),F.rotateOfInner(t,I,i)},rotateOfInner(t,e,i){F.translateInner(t,e.x,e.y),F.rotate(t,i),F.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=k,t.a=s+r*i,t.b=n+o*i),e&&(e*=k,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){F.toInnerPoint(t,e,I),F.skewOfInner(t,I,i,s)},skewOfInner(t,e,i,s=0){F.translateInner(t,e.x,e.y),F.skew(t,i,s),F.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){F.multiply(t,F.tempInvert(e))},divideParent(t,e){F.multiplyParent(t,F.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=F;return F.copy(e,t),F.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*k,o=C(r),a=R(r);if(s||n){const e=s*k,i=n*k;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&F.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=M(n*n+r*r),c=t/d;const e=n/d;u=r>0?O(e):-O(e)}else{c=M(o*o+a*a),d=t/c;const e=o/c;u=T-(a>0?O(-e):-O(e))}const e=D(C(u)),i=R(u);d=D(d),c=D(c),p=e?D((o/c+i)/e/k,9):0,_=e?D((r/d-i)/e/k,9):0,u=D(u/k)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=M(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){F.set(t)}},F=W,{toInnerPoint:z,toOuterPoint:H}=W,{sin:U,cos:N,abs:Y,sqrt:X,atan2:V,min:G,round:j}=Math,K={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=o(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?j(t.x-.5)+.5:j(t.x),t.y=e?j(t.y-.5)+.5:j(t.y)},move(t,e,i){p(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=Z.defaultPoint);const s=N(e*=k),n=U(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=Z;return J(i,t),z(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=Z;return J(i,t),H(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=Z;return J(i,t),Z.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),z(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){z(e,t,i)},toOuterOf(t,e,i){H(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=Y(i-t),r=Y(s-e);return X(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>G(q(t,e,i,s),q(i,s,n,r)),getAngle:(t,e)=>$(t,e)/k,getRotation:(t,e,i,s)=>(s||(s=e),Z.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/k),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>V(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const n=$(t,e);return(e=s?e:{}).x=t.x+N(n)*i,e.y=t.y+U(n)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){Z.reset(t)}},Z=K,{getDistanceFrom:q,copy:J,getAtan2:$}=Z;class Q{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?K.copy(this,t):K.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new Q(this)}move(t,e){return K.move(this,t,e),this}scale(t,e){return K.scale(this,t,e),this}scaleOf(t,e,i){return K.scaleOf(this,t,e,i),this}rotate(t,e){return K.rotate(this,t,e),this}rotateOf(t,e){return K.rotate(this,e,t),this}getRotation(t,e,i){return K.getRotation(this,t,e,i)}toInnerOf(t,e){return K.toInnerOf(this,t,e),this}toOuterOf(t,e){return K.toOuterOf(this,t,e),this}getCenter(t){return new Q(K.getCenter(this,t))}getDistance(t){return K.getDistance(this,t)}getDistancePoint(t,e,i){return new Q(K.getDistancePoint(this,t,e,i))}getAngle(t){return K.getAngle(this,t)}getAtan2(t){return K.getAtan2(this,t)}reset(){return K.reset(this),this}}const tt=new Q;class et{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?W.copy(this,t):W.set(this,t,e,i,s,n,r),this}setWith(t){return W.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new et(this)}translate(t,e){return W.translate(this,t,e),this}translateInner(t,e){return W.translateInner(this,t,e),this}scale(t,e){return W.scale(this,t,e),this}scaleWith(t,e){return W.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return W.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return W.scaleOfInner(this,t,e,i),this}rotate(t){return W.rotate(this,t),this}rotateOfOuter(t,e){return W.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return W.rotateOfInner(this,t,e),this}skew(t,e){return W.skew(this,t,e),this}skewOfOuter(t,e,i){return W.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return W.skewOfInner(this,t,e,i),this}multiply(t){return W.multiply(this,t),this}multiplyParent(t){return W.multiplyParent(this,t),this}divide(t){return W.divide(this,t),this}divideParent(t){return W.divideParent(this,t),this}invert(){return W.invert(this),this}invertWith(){return W.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){W.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){W.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return W.setLayout(this,t,e,i),this}getLayout(t,e,i){return W.getLayout(this,t,e,i)}withScale(t,e){return W.withScale(this,t,e)}reset(){W.reset(this)}}const it=new et,st={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){nt(t,e,i),nt(t,e+s,i+n)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:nt}=st;var rt,ot;t.Direction4=void 0,(rt=t.Direction4||(t.Direction4={}))[rt.top=0]="top",rt[rt.right=1]="right",rt[rt.bottom=2]="bottom",rt[rt.left=3]="left",t.Direction9=void 0,(ot=t.Direction9||(t.Direction9={}))[ot.topLeft=0]="topLeft",ot[ot.top=1]="top",ot[ot.topRight=2]="topRight",ot[ot.right=3]="right",ot[ot.bottomRight=4]="bottomRight",ot[ot.bottom=5]="bottom",ot[ot.bottomLeft=6]="bottomLeft",ot[ot.left=7]="left",ot[ot.center=8]="center",ot[ot["top-left"]=0]="top-left",ot[ot["top-right"]=2]="top-right",ot[ot["bottom-right"]=4]="bottom-right",ot[ot["bottom-left"]=6]="bottom-left";const at=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];at.forEach(t=>t.type="percent");const ht={directionData:at,tempPoint:{},get:lt,toPoint(t,e,i,s,n,r){const o=lt(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),ht.toPoint(t,e,i,!0),i)};function lt(e){return h(e)?at[t.Direction9[e]]:e}const{toPoint:dt}=ht,ct={toPoint(t,e,i,s,n,r){dt(t,i,s,n,e,r)}},{tempPointBounds:ut,setPoint:pt,addPoint:_t,toBounds:gt}=st,{toOuterPoint:ft}=W,{float:yt,fourNumber:mt}=E,{floor:vt,ceil:xt}=Math;let wt,Et,bt,kt;const Bt={},Tt={},St={},Pt={tempBounds:St,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=mt(i);s?Lt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Lt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Lt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Lt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ct(e,t):e=t,i?(e.offsetX=-(Lt.maxX(i)-t.x),e.offsetY=-(Lt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Lt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||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)=>(Lt.copy(St,t),Lt.toOuterOf(St,e),St),getOuterOf:(t,e)=>(t=Object.assign({},t),Lt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=e.f+t.y*n):(i.height=t.height*-n,i.y=e.f+t.y*n-i.height)}else Bt.x=t.x,Bt.y=t.y,ft(e,Bt,Tt),pt(ut,Tt.x,Tt.y),Bt.x=t.x+t.width,ft(e,Bt,Tt),_t(ut,Tt.x,Tt.y),Bt.y=t.y+t.height,ft(e,Bt,Tt),_t(ut,Tt.x,Tt.y),Bt.x=t.x,ft(e,Bt,Tt),_t(ut,Tt.x,Tt.y),gt(ut,i)},toInnerOf(t,e,i){i||(i=t),Lt.move(i,-e.e,-e.f),Lt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Lt.getFitScale(t,e));return new et(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=Lt.getFitScale(t,e,"cover"===s)),St.width=n?e.width*=s:e.width*s,St.height=n?e.height*=s:e.height*s,ct.toPoint(i,St,t,r,!0,!0)},getSpread(t,e,i){const s={};return Lt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Lt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Lt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=vt(t.x),t.y=vt(t.y),t.width=e>t.x?xt(t.width+e-t.x):xt(t.width),t.height=i>t.y?xt(t.height+i-t.y):xt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=yt(t.x,e),t.y=yt(t.y,e),t.width=yt(t.width,e),t.height=yt(t.height,e)},add(t,e,i){wt=t.x+t.width,Et=t.y+t.height,bt=e.x,kt=e.y,i||(bt+=e.width,kt+=e.height),wt=wt>bt?wt:bt,Et=Et>kt?Et:kt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=wt-t.x,t.height=Et-t.y},addList(t,e){Lt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Lt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Lt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Ct(t,n)):Rt(t,n));r&&Lt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?pt(ut,t.x,t.y):_t(ut,t.x,t.y)),gt(ut,t)},setPoint(t,e){Lt.set(t,e.x,e.y)},addPoint(t,e){Rt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},hitRadiusPoint:(t,e,i)=>(i&&(e=K.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=K.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Lt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Lt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Lt.tempToOuterOf(e,i)),!Lt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return wt=s+r,Et=n+o,bt=t.x+t.width,kt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,wt=wt<bt?wt:bt,Et=Et<kt?Et:kt,r=wt-s,o=Et-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Lt.copy(t,Lt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Lt.set(t)}},Lt=Pt,{add:Rt,copy:Ct}=Lt;class Ot{get minX(){return Pt.minX(this)}get minY(){return Pt.minY(this)}get maxX(){return Pt.maxX(this)}get maxY(){return Pt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Pt.copy(this,t):Pt.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 Ot(this)}move(t,e){return Pt.move(this,t,e),this}scale(t,e,i){return Pt.scale(this,t,e,i),this}scaleOf(t,e,i){return Pt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Pt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Pt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Pt.getFitMatrix(this,t,e)}put(t,e,i){Pt.put(this,t,e,i)}spread(t,e){return Pt.spread(this,t,e),this}shrink(t,e){return Pt.shrink(this,t,e),this}ceil(){return Pt.ceil(this),this}unsign(){return Pt.unsign(this),this}float(t){return Pt.float(this,t),this}add(t){return Pt.add(this,t),this}addList(t){return Pt.setList(this,t,!0),this}setList(t){return Pt.setList(this,t),this}addListWithFn(t,e){return Pt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Pt.setListWithFn(this,t,e),this}setPoint(t){return Pt.setPoint(this,t),this}setPoints(t){return Pt.setPoints(this,t),this}addPoint(t){return Pt.addPoint(this,t),this}getPoints(){return Pt.getPoints(this)}hitPoint(t,e){return Pt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Pt.hitRadiusPoint(this,t,e)}hit(t,e){return Pt.hit(this,t,e)}includes(t,e){return Pt.includes(this,t,e)}intersect(t,e){return Pt.intersect(this,t,e),this}getIntersect(t,e){return new Ot(Pt.getIntersectData(this,t,e))}isSame(t){return Pt.isSame(this,t)}isEmpty(){return Pt.isEmpty(this)}reset(){Pt.reset(this)}}const Mt=new Ot;class Dt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new Ot(n,e,r||t.width-n-i,o||t.height-e-s)}}const It={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:At}=E;class Wt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Wt(t)}static set filter(t){this.filterList=Ft(t)}static set exclude(t){this.excludeList=Ft(t)}static drawRepaint(t,e){const i=At();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Wt.showBounds,n=t.__nowWorld,r=At();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}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 Ft(t){return t?h(t)&&(t=[t]):t=[],t}Wt.filterList=[],Wt.excludeList=[],Wt.showWarn=!0;const zt=Wt,Ht=Wt.get("RunTime"),Ut={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Nt.currentId=Nt.idMap[s]=e?performance.now():Date.now(),Nt.currentName=Nt.nameMap[s]=t,Nt.nameToIdMap[t]=s,s},end(t,e){const i=Nt.idMap[t],s=Nt.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;Nt.idMap[t]=Nt.nameMap[t]=Nt.nameToIdMap[s]=void 0,Ht.log(s,n,"ms")},endOfName(t,e){const i=Nt.nameToIdMap[t];o(i)||Nt.end(i,e)}},Nt=Ut,Yt=[],Xt={list:{},add(t,...e){this.list[t]=!0,Yt.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(()=>Yt.forEach(t=>Xt.has(t,!0)));const Vt={editor:t=>Xt.need("editor")},Gt=Wt.get("UICreator"),jt={list:{},register(t){const{__tag:e}=t.prototype;Kt[e]&&Gt.repeat(e),Kt[e]=t},get(t,e,i,s,n,r){Kt[t]||Gt.error("not register "+t);const a=new Kt[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:Kt}=jt,Zt=Wt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(Jt[e]&&Zt.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}=qt;class $t{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=Vt.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function Qt(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function te(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function ee(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ie=[];function se(){return(t,e)=>{ie.push(e)}}const ne=[];class re{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ne)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ie.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}Qt([ee("imageSmoothingEnabled")],re.prototype,"smooth",void 0),Qt([ee("imageSmoothingQuality")],re.prototype,"smoothLevel",void 0),Qt([ee("globalAlpha")],re.prototype,"opacity",void 0),Qt([ee()],re.prototype,"fillStyle",void 0),Qt([ee()],re.prototype,"strokeStyle",void 0),Qt([ee("lineWidth")],re.prototype,"strokeWidth",void 0),Qt([ee("lineCap")],re.prototype,"strokeCap",void 0),Qt([ee("lineJoin")],re.prototype,"strokeJoin",void 0),Qt([ee("lineDashOffset")],re.prototype,"dashOffset",void 0),Qt([ee()],re.prototype,"miterLimit",void 0),Qt([ee()],re.prototype,"shadowBlur",void 0),Qt([ee()],re.prototype,"shadowColor",void 0),Qt([ee()],re.prototype,"shadowOffsetX",void 0),Qt([ee()],re.prototype,"shadowOffsetY",void 0),Qt([ee()],re.prototype,"filter",void 0),Qt([ee()],re.prototype,"font",void 0),Qt([ee()],re.prototype,"fontKerning",void 0),Qt([ee()],re.prototype,"fontStretch",void 0),Qt([ee()],re.prototype,"fontVariantCaps",void 0),Qt([ee()],re.prototype,"textAlign",void 0),Qt([ee()],re.prototype,"textBaseline",void 0),Qt([ee()],re.prototype,"textRendering",void 0),Qt([ee()],re.prototype,"wordSpacing",void 0),Qt([ee()],re.prototype,"letterSpacing",void 0),Qt([ee()],re.prototype,"direction",void 0),Qt([se()],re.prototype,"setTransform",null),Qt([se()],re.prototype,"resetTransform",null),Qt([se()],re.prototype,"getTransform",null),Qt([se()],re.prototype,"save",null),Qt([se()],re.prototype,"restore",null),Qt([se()],re.prototype,"translate",null),Qt([se()],re.prototype,"scale",null),Qt([se()],re.prototype,"rotate",null),Qt([se()],re.prototype,"fill",null),Qt([se()],re.prototype,"stroke",null),Qt([se()],re.prototype,"clip",null),Qt([se()],re.prototype,"fillRect",null),Qt([se()],re.prototype,"strokeRect",null),Qt([se()],re.prototype,"clearRect",null),Qt([se()],re.prototype,"beginPath",null),Qt([se()],re.prototype,"moveTo",null),Qt([se()],re.prototype,"lineTo",null),Qt([se()],re.prototype,"bezierCurveTo",null),Qt([se()],re.prototype,"quadraticCurveTo",null),Qt([se()],re.prototype,"closePath",null),Qt([se()],re.prototype,"arc",null),Qt([se()],re.prototype,"arcTo",null),Qt([se()],re.prototype,"ellipse",null),Qt([se()],re.prototype,"rect",null),Qt([se()],re.prototype,"roundRect",null),Qt([se()],re.prototype,"createConicGradient",null),Qt([se()],re.prototype,"createLinearGradient",null),Qt([se()],re.prototype,"createPattern",null),Qt([se()],re.prototype,"createRadialGradient",null),Qt([se()],re.prototype,"fillText",null),Qt([se()],re.prototype,"measureText",null),Qt([se()],re.prototype,"strokeText",null);const{copy:oe,multiplyParent:ae}=W,{round:he}=Math,le=new Ot,de=new Ot,ce={width:1,height:1,pixelRatio:1},ue=["width","height","pixelRatio"];class pe extends re{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,s){super(),this.size={},this.worldTransform={},t||(t=ce),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:n,height:r,pixelRatio:o}=t;this.autoLayout=!n||!r,this.size.pixelRatio=o||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;f.copyAttrs(s,t,ue),ue.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Ot(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&ae(t,e,n),n.a=t.a*i,n.b=t.b*i,n.c=t.c*i,n.d=t.d*i,n.e=t.e*i,n.f=t.f*i,s&&(t.half&&t.half*i%2?(n.e=he(n.e-.5)+.5,n.f=he(n.f-.5)+.5):(n.e=he(n.e),n.f=he(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=de):i=le,this.drawImage(t.view,le.x,le.y,le.width,le.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,n=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Pt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,le.x,le.y,le.width,le.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r=!0){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(le.x,le.y,le.width,le.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,le.x,le.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(le.x,le.y,le.width,le.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(le.x,le.y,le.width,le.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(le.x,le.y,le.width,le.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(le,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(de,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):Vt.canvas(Object.assign({},i));return n.save(),t&&(oe(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const _e={creator:{},parse(t,e){},convertToCanvasData(t,e){}},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),xe=fe,we={};for(let t in xe)we[xe[t]]=t;const Ee={};for(let t in xe)Ee[xe[t]]=ye[t];const be={drawRoundRect(t,e,i,s,n,r){const o=E.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:ke,cos:Be,hypot:Te,atan2:Se,ceil:Pe,abs:Le,PI:Re,sqrt:Ce,pow:Oe}=Math,{setPoint:Me,addPoint:De}=st,{set:Ie,toNumberPoints:Ae}=K,{M:We,L:Fe,C:ze,Q:He,Z:Ue}=fe,Ne={},Ye={points(t,e,i,s){let n=Ae(e);if(t.push(We,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y=n.length;const m=!0===i?.5:i;s&&(n=[n[y-2],n[y-1],...n,n[0],n[1],n[2],n[3]],y=n.length);for(let i=2;i<y-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=Ce(Oe(o-e,2)+Oe(a-r,2)),g=Ce(Oe(h-o,2)+Oe(l-a,2)),(_||g)&&(f=_+g,_=m*_/f,g=m*g/f,h-=e,l-=r,d=o-_*h,c=a-_*l,2===i?s||t.push(He,d,c,o,a):t.push(ze,u,p,d,c,o,a),u=o+g*h,p=a+g*l);s||t.push(He,u,p,n[y-2],n[y-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(Fe,n[e],n[e+1]);s&&t.push(Ue)},rect(t,e,i,s,n){_e.creator.path=t,_e.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){_e.creator.path=[],be.drawRoundRect(_e.creator,e,i,s,n,r),t.push(..._e.convertToCanvasData(_e.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,_=o-n;let g=Se(u,c),f=Se(_,p);const y=Te(c,u),m=Te(p,_);let v=f-g;if(v<0&&(v+=B),y<1e-12||m<1e-12||v<1e-12||Le(v-Re)<1e-12)return t&&t.push(Fe,s,n),h&&(Me(h,e,i),De(h,s,n)),d&&Ie(d,e,i),void(l&&Ie(l,s,n));const x=c*_-p*u<0,w=x?-1:1,E=a/Be(v/2),b=s+E*Be(g+v/2+T*w),S=n+E*ke(g+v/2+T*w);return g-=T*w,f-=T*w,Ge(t,b,S,a,a,0,g/k,f/k,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>Ge(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*k,p=ke(u),_=Be(u);let g=o*k,f=a*k;g>Re&&(g-=B),f<0&&(f+=B);let y=f-g;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Pe(Le(y/T)),v=y/m,x=ke(v/4),w=8/3*x*x/ke(v/2);f=g+v;let E,b,S,P,L,R,C,O,M=Be(g),D=ke(g),I=S=_*s*M-p*n*D,A=P=p*s*M+_*n*D,W=e+S,F=i+P;t&&t.push(t.length?Fe:We,W,F),l&&Me(l,W,F),c&&Ie(c,W,F);for(let r=0;r<m;r++)E=Be(f),b=ke(f),S=_*s*E-p*n*b,P=p*s*E+_*n*b,L=e+I-w*(_*s*D+p*n*M),R=i+A-w*(p*s*D-_*n*M),C=e+S+w*(_*s*b+p*n*E),O=i+P+w*(p*s*b-_*n*E),t&&t.push(ze,L,R,C,O,e+S,i+P),l&&Ve(e+I,i+A,L,R,C,O,e+S,i+P,l,!0),I=S,A=P,M=E,D=b,g=f,f+=v;d&&Ie(d,e+S,i+P)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ze,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){Ve(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,x=i,w=n,E=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,E=a),c=-3*v+9*x-9*w+3*E,u=6*v-12*x+6*w,p=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?De(h,t,e):Me(h,t,e),De(h,o,a);for(let l=0,c=d.length;l<c;l++)Xe(d[l],t,e,i,s,n,r,o,a,Ne),De(h,Ne.x,Ne.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return Xe(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)}},{getPointAndSet:Xe,toTwoPointBounds:Ve,ellipse:Ge}=Ye,{sin:je,cos:Ke,sqrt:Ze,atan2:qe}=Math,{ellipse:Je}=Ye,$e={ellipticalArc(t,i,s,n,r,o,a,h,l,d,c){const u=(l-i)/2,p=(d-s)/2,_=o*k,g=je(_),f=Ke(_),y=-f*u-g*p,m=-f*p+g*u,v=n*n,x=r*r,w=m*m,E=y*y,b=v*x-v*w-x*E;let T=0;if(b<0){const t=Ze(1-b/(v*x));n*=t,r*=t}else T=(a===h?-1:1)*Ze(b/(v*w+x*E));const S=T*n*m/r,P=-T*r*y/n,L=qe((m-P)/r,(y-S)/n),R=qe((-m-P)/r,(-y-S)/n);let C=R-L;0===h&&C>0?C-=B:1===h&&C<0&&(C+=B);const O=i+u+f*S-g*P,M=s+p+g*S+f*P,D=C<0?1:0;c||e.ellipseToCurve?Je(t,O,M,n,r,o,L/k,R/k,D):n!==r||o?t.push(fe.G,O,M,n,r,o,L/k,R/k,D):t.push(fe.O,O,M,n,L/k,R/k,D)}},{M:Qe,m:ti,L:ei,l:ii,H:si,h:ni,V:ri,v:oi,C:ai,c:hi,S:li,s:di,Q:ci,q:ui,T:pi,t:_i,A:gi,a:fi,Z:yi,z:mi,N:vi,D:xi,X:wi,G:Ei,F:bi,O:ki,P:Bi,U:Ti}=fe,{rect:Si,roundRect:Pi,arcTo:Li,arc:Ri,ellipse:Ci,quadraticCurveTo:Oi}=Ye,{ellipticalArc:Mi}=$e,Di=Wt.get("PathConvert"),Ii={},Ai={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ee[s],a+=s===n?" ":we[s];for(let s=1;s<i;s++)a+=E.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?ve:me;for(let e=0,h=t.length;e<h;e++)s=t[e],It[s]?("."===s&&(Wi.dot&&(Fi(o,r),r=""),Wi.dot++),"0"===r&&"."!==s&&(Fi(o,r),r=""),r+=s):fe[s]?(r&&(Fi(o,r),r=""),Wi.name=fe[s],Wi.length=ye[s],Wi.index=0,Fi(o,Wi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&Fi(o,r),r=s):r&&(Fi(o,r),r=""),n=s;return r&&Fi(o,r),i?Ai.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case ti:t[c+1]+=a,t[c+2]+=h;case Qe:a=t[c+1],h=t[c+2],p.push(Qe,a,h),c+=3;break;case ni:t[c+1]+=a;case si:a=t[c+1],p.push(ei,a,h),c+=2;break;case oi:t[c+1]+=h;case ri:h=t[c+1],p.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],p.push(ei,a,h),c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=li;case li:o=r===ai||r===li,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(ai,l,d,i,s,a,h),c+=5;break;case hi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=ai;case ai:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(ai,t[c+1],t[c+2],i,s,a,h),c+=7;break;case _i:t[c+1]+=a,t[c+2]+=h,n=pi;case pi:o=r===ci||r===pi,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Oi(p,a,h,i,s,t[c+1],t[c+2]):p.push(ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ui:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=ci;case ci:i=t[c+1],s=t[c+2],e?Oi(p,a,h,i,s,t[c+3],t[c+4]):p.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:Mi(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case mi:case yi:p.push(yi),c++;break;case vi:a=t[c+1],h=t[c+2],e?Si(p,a,h,t[c+3],t[c+4]):zi(p,t,c,5),c+=5;break;case xi:a=t[c+1],h=t[c+2],e?Pi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):zi(p,t,c,9),c+=9;break;case wi:a=t[c+1],h=t[c+2],e?Pi(p,a,h,t[c+3],t[c+4],t[c+5]):zi(p,t,c,6),c+=6;break;case Ei:Ci(e?p:zi(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Ii),a=Ii.x,h=Ii.y,c+=9;break;case bi:e?Ci(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):zi(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ki:Ri(e?p:zi(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ii),a=Ii.x,h=Ii.y,c+=7;break;case Bi:e?Ri(p,t[c+1],t[c+2],t[c+3],0,360,!1):zi(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ti:Li(e?p:zi(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ii),a=Ii.x,h=Ii.y,c+=6;break;default:return Di.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Qe,t.x,t.y);break;case"L":e.push(ei,t.x,t.y);break;case"C":e.push(ai,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ci,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(yi)}}),e},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){Wi.index===Wi.length&&(Wi.index=1,t.push(Wi.name)),t.push(Number(e)),Wi.index++,Wi.dot=0}},{current:Wi,pushData:Fi,copyData:zi}=Ai,{M:Hi,L:Ui,C:Ni,Q:Yi,Z:Xi,N:Vi,D:Gi,X:ji,G:Ki,F:Zi,O:qi,P:Ji,U:$i}=fe,{getMinDistanceFrom:Qi,getRadianFrom:ts}=K,{tan:es,min:is,abs:ss}=Math,ns={},rs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Hi,e,i)},lineTo(t,e,i){t.push(Ui,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(Ni,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(Yi,e,i,s,n)},closePath(t){t.push(Xi)},rect(t,e,i,s,n){t.push(Vi,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(ji,e,i,s,n,r);else{const o=E.fourNumber(r);o?t.push(Gi,e,i,s,n,...o):t.push(Vi,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){a(r)?t.push(Zi,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(Ki,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(Ji,e,i,s):(a(r)&&(r=360),t.push(qi,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h){if(!o(a)){const t=Qi(a,h,e,i,s,n);r=is(r,is(t/2,t/2*ss(es(ts(a,h,e,i,s,n)/2))))}t.push($i,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){Ye.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,ns),t.push(Hi,ns.x,ns.y),os(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){Ye.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,ns),t.push(Hi,ns.x,ns.y),as(t,e,i,s,n,r,o)},drawPoints(t,e,i,s){Ye.points(t,e,i,s)}},{ellipse:os,arc:as}=rs,{moveTo:hs,lineTo:ls,quadraticCurveTo:ds,bezierCurveTo:cs,closePath:us,beginPath:ps,rect:_s,roundRect:gs,ellipse:fs,arc:ys,arcTo:ms,drawEllipse:vs,drawArc:xs,drawPoints:ws}=rs;class Es{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?_e.parse(t):t:[],this}beginPath(){return ps(this.__path),this.paint(),this}moveTo(t,e){return hs(this.__path,t,e),this.paint(),this}lineTo(t,e){return ls(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return cs(this.__path,t,e,i,s,n,r),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 _s(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return gs(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return fs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return ys(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return ms(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return vs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return xs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:bs,L:ks,C:Bs,Q:Ts,Z:Ss,N:Ps,D:Ls,X:Rs,G:Cs,F:Os,O:Ms,P:Ds,U:Is}=fe,As=Wt.get("PathDrawer"),Ws={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case bs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case ks:t.lineTo(e[s+1],e[s+2]),s+=3;break;case 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 Ss:t.closePath(),s+=1;break;case Ps:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ls:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Rs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Cs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*k,e[s+6]*k,e[s+7]*k,e[s+8]),s+=9;break;case Os:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,B,!1),s+=5;break;case Ms:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*k,e[s+5]*k,e[s+6]),s+=7;break;case Ds:t.arc(e[s+1],e[s+2],e[s+3],0,B,!1),s+=4;break;case Is:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void As.error(`command: ${i} [index:${s}]`,e)}}},{M:Fs,L:zs,C:Hs,Q:Us,Z:Ns,N:Ys,D:Xs,X:Vs,G:Gs,F:js,O:Ks,P:Zs,U:qs}=fe,{toTwoPointBounds:Js,toTwoPointBoundsByQuadraticCurve:$s,arcTo:Qs,arc:tn,ellipse:en}=Ye,{addPointBounds:sn,copy:nn,addPoint:rn,setPoint:on,addBounds:an,toBounds:hn}=st,ln=Wt.get("PathBounds");let dn,cn,un;const pn={},_n={},gn={},fn={toBounds(t,e){fn.toTwoPointBounds(t,_n),hn(_n,e)},toTwoPointBounds(t,e){if(!t||!t.length)return on(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===Ns||o===Hs||o===Us?on(e,h,l):on(e,t[a+1],t[a+2])),o){case Fs:case zs:h=t[a+1],l=t[a+2],rn(e,h,l),a+=3;break;case Hs:n=t[a+5],r=t[a+6],Js(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,pn),sn(e,pn),h=n,l=r,a+=7;break;case Us:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],$s(h,l,i,s,n,r,pn),sn(e,pn),h=n,l=r,a+=5;break;case Ns:a+=1;break;case Ys:h=t[a+1],l=t[a+2],an(e,h,l,t[a+3],t[a+4]),a+=5;break;case Xs:case Vs:h=t[a+1],l=t[a+2],an(e,h,l,t[a+3],t[a+4]),a+=o===Xs?9:6;break;case Gs:en(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],pn,gn),0===a?nn(e,pn):sn(e,pn),h=gn.x,l=gn.y,a+=9;break;case js:h=t[a+1],l=t[a+2],cn=t[a+3],un=t[a+4],an(e,h-cn,l-un,2*cn,2*un),h+=cn,a+=5;break;case Ks:tn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],pn,gn),0===a?nn(e,pn):sn(e,pn),h=gn.x,l=gn.y,a+=7;break;case Zs:h=t[a+1],l=t[a+2],dn=t[a+3],an(e,h-dn,l-dn,2*dn,2*dn),h+=dn,a+=4;break;case qs:Qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],pn,gn),0===a?nn(e,pn):sn(e,pn),h=gn.x,l=gn.y,a+=6;break;default:return void ln.error(`command: ${o} [index:${a}]`,t)}}},{M:yn,L:mn,Z:vn}=fe,{getCenterX:xn,getCenterY:wn}=K,{arcTo:En}=rs,bn={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=0;const g=t.length,f=[];for(;o<g;){switch(s=t[o],s){case yn:l=p=t[o+1],d=_=t[o+2],o+=3,t[o]===mn?(c=t[o+1],u=t[o+2],f.push(yn,xn(l,c),wn(d,u))):f.push(yn,l,d);break;case mn:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case mn:En(f,a,h,t[o+1],t[o+2],e,p,_);break;case vn:En(f,a,h,l,d,e,p,_);break;default:f.push(mn,a,h)}p=a,_=h;break;case vn:n!==vn&&(En(f,l,d,c,u,e,p,_),f.push(vn)),o+=1;break;default:r=Ee[s];for(let e=0;e<r;e++)f.push(t[o+e]);o+=r}n=s}return s!==vn&&(f[1]=l,f[2]=d),f}};function kn(t){return new Es(t)}const Bn=kn();_e.creator=kn(),_e.parse=Ai.parse,_e.convertToCanvasData=Ai.toCanvasData;const{drawRoundRect:Tn}=be;function Sn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Tn(this,t,e,i,s,n)})}(t)}const Pn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Ln.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Ln=Pn;Ln.alphaPixelTypes.forEach(t=>Ln.upperCaseTypeMap[t]=t.toUpperCase());const Rn=Wt.get("TaskProcessor");class Cn{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.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){Rn.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class On{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&f.assign(this.config,t),this.empty()}add(t,e){let i,s,n,r;const a=new Cn(t);return a.parent=this,d(e)?r=e:e&&(s=e.parallel,i=e.start,n=e.time,r=e.delay),n&&(a.time=n),!1===s&&(a.parallel=!1),o(r)?this.push(a,i):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,i))},r)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let i=this.index;i<e&&(t=this.list[i],t.parallel);i++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Mn=Wt.get("Resource"),Dn={tasker:new On,map:{},get isComplete(){return In.tasker.isComplete},set(t,e){In.map[t]&&Mn.repeat(t),In.map[t]=e},get:t=>In.map[t],remove(t){const e=In.map[t];e&&(e.destroy&&e.destroy(),delete In.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=Vt.image(s)),In.set(t,e),e},destroy(){In.map={}}},In=Dn,An={maxRecycled:10,recycledList:[],patternTasker:new On,get(t){let e=Dn.get(t.url);return e||Dn.set(t.url,e=Vt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Wn.recycledList.push(t)})},clearRecycled(){const t=Wn.recycledList;t.length>Wn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Dn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Pn.alphaPixelTypes.some(e=>Wn.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Pn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Pn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Wn.recycledList=[]}},Wn=An,{IMAGE:Fn,create:zn}=i,{floor:Hn,max:Un}=Math;class Nn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=zn(Fn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}An.isFormat("svg",t)&&(this.isSVG=!0),An.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,i){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:i}=e.origin,s=this.config.showProgress&&i&&this.onProgress.bind(this);s&&(t=i),Dn.tasker.add(()=>te(this,void 0,void 0,function*(){return yield t(this.url,s).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,i),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,i,s,n,r,o,a){if(t||(t=this.width),i||(i=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const h=e.origin.createCanvas(Un(Hn(t+(r||0)),1),Un(Hn(i+(o||0)),1)),l=h.getContext("2d");return s&&(l.globalAlpha=s),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,t,i),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,i,s,n){const r=e.canvas.createPattern(t,i);try{s&&r.setTransform&&(r.setTransform(s),s=void 0)}catch(t){}return n&&f.stintSet(n,"transform",s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Yn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function Xn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Vn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function Gn(t,e){return(i,s)=>Kn(i,s,t,e&&e(s))}function jn(t){return t}function Kn(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Yn(t,e,Object.assign(n,s||{})),wr(t,e,i)}function Zn(t){return Gn(t)}function qn(t,e){return Gn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Jn(t,e){return Gn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function $n(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),sr(this))}}))}function Qn(t,e){return Gn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function tr(t,e){return Gn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function er(t,e){return Gn(t,t=>({set(i){this.__setAttr(t,i,e)&&sr(this)}}))}function ir(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(sr(this),this.__.__removeNaturalSize())}}))}function sr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function nr(t){return Gn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),sr(this)}}))}const rr=er;function or(t,e){return Gn(t,t=>({set(i){this.__setAttr(t,i)&&(ar(this),e&&(this.__.__useStroke=!0))}}))}function ar(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&sr(t)}const hr=or;function lr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function dr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function cr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&pr(this)}}))}function ur(t){return Gn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>_r(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");_r(this,t,e,i),this.mask&&pr(this)}}))}function pr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function _r(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||sr(t))}function gr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function fr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function yr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function mr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Wt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function vr(t){return Gn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function xr(t){return(e,i)=>{Yn(e,"__DataProcessor",{get:()=>t})}}function wr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Vn(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(p(i)){const t=g(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:f.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,d=s;for(;!l&&d;)l=Xn(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),Yn(s,e,a)}const Er=new Wt("rewrite"),br=[],kr=["destroy","constructor"];function Br(t){return(e,i)=>{br.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Tr(){return t=>{Sr()}}function Sr(t){br.length&&(br.forEach(e=>{t&&Er.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),br.length=0)}function Pr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(kr.includes(s)||e&&e.includes(s)))if(t.prototype){Xn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Lr(){return t=>{jt.register(t)}}function Rr(){return t=>{qt.register(t)}}setTimeout(()=>Sr(!0));const{copy:Cr,toInnerPoint:Or,toOuterPoint:Mr,scaleOfOuter:Dr,rotateOfOuter:Ir,skewOfOuter:Ar,multiplyParent:Wr,divideParent:Fr,getLayout:zr}=W,Hr={},{round:Ur}=Math,Nr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),Vr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)Xr(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++)Gr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Gr(t),t.__updateChange()},updateAllChange(t){if(Kr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)jr(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,i,s,n,r,o){n||(n=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?i.copyWorldByReset(s,n,t.__nowWorld,r,o):i.copyWorldToInner(s,n,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,n){const r=p(e)?Object.assign({},e):{x:e,y:i};s?Mr(t.localTransform,r,r,!0):t.parent&&Or(t.parent.scrollWorldTransform,r,r,!0),Yr.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){p(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Ur(e),i=Ur(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){Yr.zoomOfLocal(t,Zr(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(d(s)||(s&&(r=s),s=i),Cr(Hr,o),Dr(Hr,e,i,s),Yr.hasHighPosition(t))Yr.setTransform(t,Hr,n,r);else{const e=t.x+Hr.e-o.e,a=t.y+Hr.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){Yr.rotateOfLocal(t,Zr(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Cr(Hr,n),Ir(Hr,e,i),Yr.hasHighPosition(t)?Yr.setTransform(t,Hr,!1,s):t.set({x:t.x+Hr.e-n.e,y:t.y+Hr.f-n.f,rotation:E.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){Yr.skewOfLocal(t,Zr(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Cr(Hr,t.__localMatrix),Ar(Hr,e,i,s),Yr.setTransform(t,Hr,n,r)},transformWorld(t,e,i,s){Cr(Hr,t.worldTransform),Wr(Hr,e),t.parent&&Fr(Hr,t.parent.scrollWorldTransform),Yr.setTransform(t,Hr,i,s)},transform(t,e,i,s){Cr(Hr,t.localTransform),Wr(Hr,e),Yr.setTransform(t,Hr,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&Yr.getInnerOrigin(t,n.origin),o=zr(e,r,n.around&&Yr.getInnerOrigin(t,n.around));if(Yr.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Pt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=Yr.getInnerOrigin(t,n.origin);K.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Dr(i,Yr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>K.tempToOuterOf(Yr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return ht.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Cr(Hr,t.worldTransform),Fr(Hr,e.scrollWorldTransform),i?Hr:Object.assign({},Hr)),drop(t,e,i,s){t.setTransform(Yr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||Yr.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,i,s=.3){if(i.x||i.y)if(Math.abs(i.x)<1&&Math.abs(i.y)<1)t.move(i);else{const n=i.x*s,r=i.y*s;i.x-=n,i.y-=r,t.move(n,r),e.requestRender(()=>Yr.animateMove(t,i,s))}}},Yr=Nr,{updateAllMatrix:Xr,updateMatrix:Vr,updateAllWorldOpacity:Gr,updateAllChange:jr,updateChange:Kr}=Yr;function Zr(t,e){return t.updateLayout(),t.parent?K.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const qr={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)=>$r(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>$r(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>$r(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 Jr;function $r(t,e){return e||(Jr=0),t.__.mask&&(Jr=1),Jr<0?null:(Jr&&(Jr=-1),!0)}const{updateBounds:Qr}=Nr,to={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),eo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)io(e[t],e)},updateBounds(t,e){const i=[t];io(t,i),so(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Qr(s[t]);e&&e===i||Qr(i)}}},{pushAllChildBranch:eo,pushAllBranchStack:io,updateBoundsByBranchStack:so}=to,no={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:ro,updateBounds:oo}=Nr,{toOuterOf:ao,getPoints:ho,copy:lo}=Pt,co="_localContentBounds",uo="_worldContentBounds",po="_worldBoxBounds",_o="_worldStrokeBounds";class go{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 ao(this.contentBounds,this.leaf.__localMatrix,this[co]||(this[co]={})),this[co]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ao(this.contentBounds,this.leaf.__world,this[uo]||(this[uo]={})),this[uo]}get worldBoxBounds(){return ao(this.boxBounds,this.leaf.__world,this[po]||(this[po]={})),this[po]}get worldStrokeBounds(){return ao(this.strokeBounds,this.leaf.__world,this[_o]||(this[_o]={})),this[_o]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:i}=t;if(t.isApp)return oo(t);if(i)i.ready?i.watcher.changed&&i.layouter.layout():i.start();else{let i=t;for(;i.parent&&!i.parent.leafer;)i=i.parent;const s=i;if(s.__fullLayouting)return;s.__fullLayouting=!0,e.layout(s),delete s.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return W.defaultMatrix;case"page":t=e.zoomLayer;default:return ro(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 Ot(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=W.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=ro(s,e,!0)}if(o||(o=W.getLayout(r)),lo(o,a),K.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=ho(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class fo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class yo extends fo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}yo.ADD="child.add",yo.REMOVE="child.remove",yo.CREATED="created",yo.MOUNTED="mounted",yo.UNMOUNTED="unmounted",yo.DESTROY="destroy";const mo="property.scroll";class vo extends fo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}vo.CHANGE="property.change",vo.LEAFER_CHANGE="property.leafer_change",vo.SCROLL=mo;const xo={scrollX:mo,scrollY:mo};class wo extends fo{constructor(t,e){super(t),Object.assign(this,e)}}wo.LOAD="image.load",wo.LOADED="image.loaded",wo.ERROR="image.error";class Eo extends fo{static checkHas(t,e,i){"on"===i?e===To?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(bo)||t.hasEvent(ko)||t.hasEvent(Bo),t.__hasWorldEvent=t.hasEvent(To))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(bo,t),"inner"===e&&t.emit(ko,t)),t.emit(Bo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(To,this)}}Eo.RESIZE="bounds.resize",Eo.INNER="bounds.inner",Eo.LOCAL="bounds.local",Eo.WORLD="bounds.world";const{RESIZE:bo,INNER:ko,LOCAL:Bo,WORLD:To}=Eo,So={};[bo,ko,Bo,To].forEach(t=>So[t]=1);class Po extends fo{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){p(t)?(super(Po.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Po.RESIZE="resize";class Lo extends fo{constructor(t,e){super(t),this.data=e}}Lo.REQUEST="watch.request",Lo.DATA="watch.data";class Ro extends fo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Ro.REQUEST="layout.request",Ro.START="layout.start",Ro.BEFORE="layout.before",Ro.LAYOUT="layout",Ro.AFTER="layout.after",Ro.AGAIN="layout.again",Ro.END="layout.end";class Co extends fo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Co.REQUEST="render.request",Co.CHILD_START="render.child_start",Co.CHILD_END="render.child_end",Co.START="render.start",Co.BEFORE="render.before",Co.RENDER="render",Co.AFTER="render.after",Co.AGAIN="render.again",Co.END="render.end",Co.NEXT="render.next";class Oo extends fo{}Oo.START="leafer.start",Oo.BEFORE_READY="leafer.before_ready",Oo.READY="leafer.ready",Oo.AFTER_READY="leafer.after_ready",Oo.VIEW_READY="leafer.view_ready",Oo.VIEW_COMPLETED="leafer.view_completed",Oo.STOP="leafer.stop",Oo.RESTART="leafer.restart",Oo.END="leafer.end",Oo.TRANSFORM="leafer.transform",Oo.MOVE="leafer.move",Oo.SCALE="leafer.scale",Oo.ROTATE="leafer.rotate",Oo.SKEW="leafer.skew";const{MOVE:Mo,SCALE:Do,ROTATE:Io,SKEW:Ao}=Oo,Wo={x:Mo,y:Mo,scaleX:Do,scaleY:Do,rotation:Io,skewX:Ao,skewY:Ao},Fo={};class zo{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=Ho(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],So[t]&&Eo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=Ho(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],So[t]&&Eo.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]));p(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const s=Ho(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Ho(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Fo)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Fo)}}const{on:Uo,on_:No,off:Yo,off_:Xo,once:Vo,emit:Go,emitEvent:jo,hasEvent:Ko,destroy:Zo}=zo.prototype,qo={on:Uo,on_:No,off:Yo,off_:Xo,once:Vo,emit:Go,emitEvent:jo,hasEvent:Ko,destroyEventer:Zo},Jo=Wt.get("setAttr"),$o={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||o(e)||(Jo.warn(this.innerName,t,e),e=void 0),p(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new vo(vo.LEAFER_CHANGE,this,t,s,e));const i=Wo[t];i&&(this.emitEvent(new Oo(i,this)),this.emitEvent(new Oo(Oo.TRANSFORM,this)))}this.emitPropertyEvent(vo.CHANGE,t,s,e);const i=xo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new vo(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Qo,multiplyParent:ta,translateInner:ea,defaultWorld:ia}=W,{toPoint:sa,tempPoint:na}=ht,ra={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ta(this.__local||e,t?t.__scrollWorld||t.__world:ia,i,!!e.affectScaleOrRotation,n),s&&ea(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Qo(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)&&(sa(i.around||i.origin,t.boxBounds,na),ea(e,-na.x,-na.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:oa,updateAllMatrix:aa}=Nr,{updateBounds:ha}=to,{toOuterOf:la,copyAndSpread:da,copy:ca}=Pt,{toBounds:ua}=fn,pa={__updateWorldBounds(){const t=this.__layout;la(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Eo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Eo.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(),la(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){la(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){la(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?ua(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(),aa(this),ha(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(aa(this),ha(this,this))):oa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;da(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?da(e.renderBounds,e.boxBounds,e.renderSpread):ca(e.renderBounds,e.strokeBounds)}},_a={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),Nr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Wt.showBounds&&Wt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:ga}=qr,fa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.dim?e.dimOpacity=!0===i.dim?.2:i.dim:i.dimskip&&e.dimOpacity&&(e.dimOpacity=0),i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)ga(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)ga(i[s],e)||i[s].__clip(t,e)}}},ya={},{LEAF:ma,create:va}=i,{toInnerPoint:xa,toOuterPoint:wa,multiplyParent:Ea}=W,{toOuterOf:ba}=Pt,{copy:ka,move:Ba}=K,{moveLocal:Ta,zoomOfLocal:Sa,rotateOfLocal:Pa,skewOfLocal:La,moveWorld:Ra,zoomOfWorld:Ca,rotateOfWorld:Oa,skewOfWorld:Ma,transform:Da,transformWorld:Ia,setTransform:Aa,getFlipTransform:Wa,getLocalOrigin:Fa,getRelativeWorld:za,drop:Ha}=Nr;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return m}get __LayoutProcessor(){return go}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=va(ma),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(yo.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(yo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(yo.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(yo.MOUNTED)):this.__emitLifeEvent(yo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ea(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}=An.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),ya.scaleX=i,ya.scaleY=s,ya}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?za(this,e):this.worldTransform,n=i?t:{};return ba(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&ka(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&ka(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),xa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){wa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Ba(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Ba(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Aa(this,t,e,i)}transform(t,e,i){Da(this,t,e,i)}move(t,e,i){Ta(this,t,e,i)}moveInner(t,e,i){Ra(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Sa(this,Fa(this,t),e,i,s,n)}rotateOf(t,e,i){Pa(this,Fa(this,t),e,i)}skewOf(t,e,i,s,n){La(this,Fa(this,t),e,i,s,n)}transformWorld(t,e,i){Ia(this,t,e,i)}moveWorld(t,e,i){Ra(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Ca(this,t,e,i,s,n)}rotateOfWorld(t,e){Oa(this,t,e)}skewOfWorld(t,e,i,s,n){Ma(this,t,e,i,s,n)}flip(t,e){Da(this,Wa(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Xt.need("path")}getMotionPoint(t){return Xt.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):wr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=er),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new yo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(yo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=Qt([Pr($o),Pr(ra),Pr(pa),Pr(qo),Pr(_a)],t.Leaf);const{setListWithFn:Ua}=Pt,{sort:Na}=to,{localBoxBounds:Ya,localStrokeBounds:Xa,localRenderBounds:Va,maskLocalBoxBounds:Ga,maskLocalStrokeBounds:ja,maskLocalRenderBounds:Ka}=qr,Za=new Wt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){Ua(e||this.__layout.boxBounds,this.children,this.__hasMask?Ga:Ya)}__updateStrokeBounds(t){Ua(t||this.__layout.strokeBounds,this.children,this.__hasMask?ja:Xa)}__updateRenderBounds(t){Ua(t||this.__layout.renderBounds,this.children,this.__hasMask?Ka:Va)}__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(Na),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Za.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});t=jt.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(yo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(yo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(yo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(yo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new yo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=Qt([Pr(fa)],t.Branch);class qa{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new qa;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Ja{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class $a extends pe{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=e.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Sn(OffscreenCanvasRenderingContext2D.prototype),Sn(Path2D.prototype);const{mineType:Qa}=Pn;function th(t,i){e.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:Qa(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:Qa(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((i,s)=>{let n=new XMLHttpRequest;n.open("GET",e.image.getRealURL(t),!0),n.responseType="blob",n.onload=()=>{createImageBitmap(n.response).then(t=>{i(t)}).catch(t=>{s(t)})},n.onerror=t=>s(t),n.send()})},e.canvas=Vt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Vt,{canvas:(t,e)=>new $a(t,e),image:t=>new Nn(t)}),e.name="web",e.isWorker=!0,e.backgrounder=!0,e.requestRender=function(t){requestAnimationFrame(t)},Yn(e,"devicePixelRatio",{get:()=>1});const{userAgent:eh}=navigator;eh.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),eh.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):eh.indexOf("Mac")>-1?e.os="Mac":eh.indexOf("Linux")>-1&&(e.os="Linux");class ih{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new qa;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new qa,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Co.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===yo.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 Lo(Lo.DATA,{updatedList:this.updatedList})),this.__updatedList=new qa,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[vo.CHANGE,this.__onAttrChange,this],[[yo.ADD,yo.REMOVE],this.__onChildEvent,this],[Lo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:sh,updateBounds:nh,updateChange:rh}=Nr,{pushAllChildBranch:oh,pushAllParent:ah}=to;const{worldBounds:hh}=qr;class lh{constructor(t){this.updatedBounds=new Ot,this.beforeBounds=new Ot,this.afterBounds=new Ot,u(t)&&(t=new qa(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,hh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,hh),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:dh,updateAllChange:ch}=Nr,uh=Wt.get("Layouter");class ph{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Ja,this.target=t,e&&(this.config=f.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(Ro.START),this.layoutOnce(),t.emitEvent(new Ro(Ro.END,this.layoutedBlocks,this.times))}catch(t){uh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?uh.warn("layouting"):this.times>3?uh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Lo.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=Ut.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=Ro,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Ro(n,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(sh(t,!0),e.add(t),t.isBranch&&oh(t,e),ah(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),ah(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||nh(s[t])}nh(i)}})}(this.__levelList),function(t){t.list.forEach(rh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Ro(r,a,this.times)),i.emitEvent(new Ro(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Ut.end(e)}fullLayout(){const t=Ut.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Ro,r=this.getBlocks(new qa(e));e.emitEvent(new Ro(i,r,this.times)),ph.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Ro(s,r,this.times)),e.emitEvent(new Ro(n,r,this.times)),this.addBlocks(r),Ut.end(t)}static fullLayout(t){dh(t,!0),t.isBranch?to.updateBounds(t):Nr.updateBounds(t),ch(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new lh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new lh(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_([[Ro.REQUEST,this.layout,this],[Ro.AGAIN,this.layoutAgain,this],[Lo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const _h=Wt.get("Renderer");class gh{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(Ro.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Co.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Co.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Co.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Ot,_h.log(e.innerName,"---\x3e");try{this.emitRender(Co.START),this.renderOnce(t),this.emitRender(Co.END,this.totalBounds),An.clearRecycled()}catch(t){this.rendering=!1,_h.error(t)}_h.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return _h.warn("rendering");if(this.times>3)return _h.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Ot,this.renderOptions={},t)this.emitRender(Co.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Co.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Co.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Co.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=Ut.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Ot(s);i.save(),s.spread(gh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),Ut.end(e)}fullRender(){const t=Ut.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Ut.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Wt.showRepaint&&Wt.drawRepaint(i,t),this.target.__render(i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Ot;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const i=this.requestTime=Date.now(),s=()=>{const t=1e3/(Date.now()-i),{maxFPS:n}=this.config;if(n&&t>n-.5)return e.requestRender(s);this.FPS=Math.min(120,Math.ceil(t)),this.requestTime=0,this.checkRender()};e.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Ot(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 Ot(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||_h.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Co(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Co.REQUEST,this.update,this],[Ro.END,this.__onLayoutEnd,this],[Co.AGAIN,this.renderAgain,this],[Po.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}gh.clipSpread=10;const{hitRadiusPoint:fh}=Pt;class yh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new qa(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i){const s=this.findList=new qa;if(t.length){let e;const{x:n,y:r}=this.point,o={x:n,y:r,radiusX:0,radiusY:0};for(let n=0,r=t.length;n<r;n++)if(e=t[n],(i||Nr.worldHittable(e))&&(this.hitChild(e,o),s.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&Nr.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=>Nr.worldHittable(t))}getPath(t){const e=new qa;for(;t;)e.add(t),t=t.parent;return this.target&&e.add(this.target),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new qa;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren);t--);return s}getThroughPath(t){const e=new qa,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:n}=this;for(let r=t.length-1;r>-1;r--)i=t[r],!i.__.visible||e&&!i.__.mask||(s=!!i.__.hitRadius||fh(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class mh{constructor(t,e){this.config={},e&&(this.config=f.default(e,this.config)),this.picker=new yh(this.target=t,this),this.finder=Vt.finder&&Vt.finder()}getByPoint(t,i,s){const{target:n,picker:r}=this;return e.backgrounder&&n&&n.updateLayout(),r.getByPoint(t,i,s)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):Xt.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function vh(t){return Gn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function xh(t){return Gn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function wh(){return(t,e)=>{const i="_"+e;Yn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(Vt,{watcher:(t,e)=>new ih(t,e),layouter:(t,e)=>new ph(t,e),renderer:(t,e,i)=>new gh(t,e,i),selector:(t,e)=>new mh(t,e)}),e.layout=ph.fullLayout;const Eh={},bh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},kh={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},Bh={},Th={},Sh={},Ph={},Lh={},Rh={apply(){Xt.need("filter")}},Ch={},Oh={setStyleName:()=>Xt.need("state"),set:()=>Xt.need("state")},Mh={list:{},register(t,e){Mh.list[t]=e},get:t=>Mh.list[t]},{parse:Dh,objectToCanvasData:Ih}=Ai,{stintSet:Ah}=f,{hasTransparent:Wh}=bh,Fh={},zh=Wt.get("UIData");class Hh 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,zh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,zh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(Ah(this,"__isTransparentFill",Wh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):p(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(Ah(this,"__isTransparentStroke",Wh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):p(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&p(t[0])?(this.__setInput("path",t),this._path=e?Dh(t):Ih(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&&Th.compute("fill",this.__leaf),e&&Th.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Fh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Fh))}__removePaint(t,e){e&&this.__removeInput(t),Sh.recycleImage(t,this),"fill"===t?(Ah(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ah(this,"__isAlphaPixelStroke",void 0),Ah(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 Nh extends Hh{}class Yh extends Nh{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 Xh extends Nh{__getInputData(t,e){const i=super.__getInputData(t,e);return ue.forEach(t=>delete i[t]),i}}class Vh extends Yh{}class Gh extends Hh{get __usePathBox(){return this.points||this.__pathInputed}}class jh extends Hh{get __boxStroke(){return!this.__pathInputed}}class Kh extends Hh{get __boxStroke(){return!this.__pathInputed}}class Zh extends Gh{}class qh extends Hh{}class Jh extends Hh{get __pathInputed(){return 2}}class $h extends Nh{}const Qh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class tl extends Hh{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=Qh[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=jt.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange(),r.renderChanged&&n.renderChange(),i.__updateChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class el extends jh{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 il extends jh{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 sl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Math.max(r.__layout.strokeSpread=r.__updateStrokeSpread(),t),e=r.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=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)),r&&(t+=Rh.getSpread(r)),o&&(t+=o);let a=t=Math.ceil(t);return i&&i.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),n&&(a=Math.max(a,n)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},nl={getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;n||(s=Object.assign({},s));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==i?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),u&&"outer"!==i?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=E.float(s.x),s.y=E.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&&rl.getValidMove(t.__localBoxBounds,"parent"===i?t.parent.boxBounds:i,s,e,!0),rl.axisMove(t,e)}},rl=nl,{stintSet:ol}=f,al={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);ol(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),ol(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;ol(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),ol(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){hl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Th.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Lh.shadow(this,t,h),a&&(s.__isStrokes?Th.strokes(r,this,t):Th.stroke(r,this,t)),n&&(s.__isFills?Th.fills(n,this,t):Th.fill(n,this,t)),o&&this.__drawAfterFill(t,e),d&&Lh.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?Th.strokes(r,this,t):Th.stroke(r,this,t)),c&&Rh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Th.strokes(r,this,t):Th.stroke(r,this,t)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,bh.string(e.color))}n&&(s.__isFills?Th.fills(n,this,t):Th.fill(n,this,t)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?Th.strokes(r,this,t):Th.stroke(r,this,t))}}else s.__pathInputed?hl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Th.fills(s,this,t):Th.fill("#000000",this,t)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Th.strokes(n,this,t):Th.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function hl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Th.stroke(n,t,e),s&&Th.fill(s,t,e),r&&t.__drawAfterFill(e,i),n&&!o&&Th.stroke(n,t,e)}const ll={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var dl,cl;t.UI=dl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){E.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Bn.set(this.path=t||[]),t||this.__drawPathByBox(Bn),Bn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Xt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Xt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Bn.set(i=[]),this.__drawPathByBox(Bn)),t?Ai.toCanvasData(i,!0):i}getPathString(t,e,i){return Ai.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Ch.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?bn.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Bh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Ws.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,d(r)?[r]:r)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e){Th.fill(this.__.placeholderColor,this,t)}animate(t,e,i,s){return this.set(t),Xt.need("animate")}killAnimate(t,e){}export(t,e){return Xt.need("export")}syncExport(t,e){return Xt.need("export")}clone(t){const e=f.clone(this.toJSON());return t&&Object.assign(e,t),dl.one(e)}static one(t,e,i,s,n){return jt.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Lr()(this)}static registerData(t){xr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},Qt([xr(Hh)],t.UI.prototype,"__",void 0),Qt([wh()],t.UI.prototype,"zoomLayer",void 0),Qt([Zn("")],t.UI.prototype,"id",void 0),Qt([Zn("")],t.UI.prototype,"name",void 0),Qt([Zn("")],t.UI.prototype,"className",void 0),Qt([dr("pass-through")],t.UI.prototype,"blendMode",void 0),Qt([cr(1)],t.UI.prototype,"opacity",void 0),Qt([ur(!0)],t.UI.prototype,"visible",void 0),Qt([dr(!1)],t.UI.prototype,"locked",void 0),Qt([dr(!1)],t.UI.prototype,"dim",void 0),Qt([dr(!1)],t.UI.prototype,"dimskip",void 0),Qt([gr(0)],t.UI.prototype,"zIndex",void 0),Qt([fr(!1)],t.UI.prototype,"mask",void 0),Qt([yr(!1)],t.UI.prototype,"eraser",void 0),Qt([qn(0,!0)],t.UI.prototype,"x",void 0),Qt([qn(0,!0)],t.UI.prototype,"y",void 0),Qt([er(100,!0)],t.UI.prototype,"width",void 0),Qt([er(100,!0)],t.UI.prototype,"height",void 0),Qt([Qn(1,!0)],t.UI.prototype,"scaleX",void 0),Qt([Qn(1,!0)],t.UI.prototype,"scaleY",void 0),Qt([tr(0,!0)],t.UI.prototype,"rotation",void 0),Qt([tr(0,!0)],t.UI.prototype,"skewX",void 0),Qt([tr(0,!0)],t.UI.prototype,"skewY",void 0),Qt([qn(0,!0)],t.UI.prototype,"offsetX",void 0),Qt([qn(0,!0)],t.UI.prototype,"offsetY",void 0),Qt([Jn(0,!0)],t.UI.prototype,"scrollX",void 0),Qt([Jn(0,!0)],t.UI.prototype,"scrollY",void 0),Qt([$n()],t.UI.prototype,"origin",void 0),Qt([$n()],t.UI.prototype,"around",void 0),Qt([Zn(!1)],t.UI.prototype,"lazy",void 0),Qt([ir(1)],t.UI.prototype,"pixelRatio",void 0),Qt([lr(0)],t.UI.prototype,"renderSpread",void 0),Qt([nr()],t.UI.prototype,"path",void 0),Qt([rr()],t.UI.prototype,"windingRule",void 0),Qt([rr(!0)],t.UI.prototype,"closed",void 0),Qt([er(0)],t.UI.prototype,"padding",void 0),Qt([er(!1)],t.UI.prototype,"lockRatio",void 0),Qt([er()],t.UI.prototype,"widthRange",void 0),Qt([er()],t.UI.prototype,"heightRange",void 0),Qt([Zn(!1)],t.UI.prototype,"draggable",void 0),Qt([Zn()],t.UI.prototype,"dragBounds",void 0),Qt([Zn("auto")],t.UI.prototype,"dragBoundsType",void 0),Qt([Zn(!1)],t.UI.prototype,"editable",void 0),Qt([mr(!0)],t.UI.prototype,"hittable",void 0),Qt([mr("path")],t.UI.prototype,"hitFill",void 0),Qt([hr("path")],t.UI.prototype,"hitStroke",void 0),Qt([mr(!1)],t.UI.prototype,"hitBox",void 0),Qt([mr(!0)],t.UI.prototype,"hitChildren",void 0),Qt([mr(!0)],t.UI.prototype,"hitSelf",void 0),Qt([mr()],t.UI.prototype,"hitRadius",void 0),Qt([vr("")],t.UI.prototype,"cursor",void 0),Qt([dr()],t.UI.prototype,"fill",void 0),Qt([hr(void 0,!0)],t.UI.prototype,"stroke",void 0),Qt([hr("inside")],t.UI.prototype,"strokeAlign",void 0),Qt([hr(1,!0)],t.UI.prototype,"strokeWidth",void 0),Qt([hr(!1)],t.UI.prototype,"strokeWidthFixed",void 0),Qt([hr("none")],t.UI.prototype,"strokeCap",void 0),Qt([hr("miter")],t.UI.prototype,"strokeJoin",void 0),Qt([hr()],t.UI.prototype,"dashPattern",void 0),Qt([hr(0)],t.UI.prototype,"dashOffset",void 0),Qt([hr(10)],t.UI.prototype,"miterLimit",void 0),Qt([rr(0)],t.UI.prototype,"cornerRadius",void 0),Qt([rr()],t.UI.prototype,"cornerSmoothing",void 0),Qt([vh()],t.UI.prototype,"shadow",void 0),Qt([vh()],t.UI.prototype,"innerShadow",void 0),Qt([vh()],t.UI.prototype,"blur",void 0),Qt([vh()],t.UI.prototype,"backgroundBlur",void 0),Qt([vh()],t.UI.prototype,"grayscale",void 0),Qt([vh()],t.UI.prototype,"filter",void 0),Qt([dr()],t.UI.prototype,"placeholderColor",void 0),Qt([Zn(100)],t.UI.prototype,"placeholderDelay",void 0),Qt([Zn({})],t.UI.prototype,"data",void 0),Qt([Br(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=dl=Qt([Pr(sl),Pr(al),Tr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},Qt([xr(Nh)],t.Group.prototype,"__",void 0),Qt([er(0)],t.Group.prototype,"width",void 0),Qt([er(0)],t.Group.prototype,"height",void 0),t.Group=Qt([Pr(t.Branch),Lr()],t.Group);const ul=Wt.get("Leafer");t.Leafer=cl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Dn.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),cl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,f.assign(s,t));const n=this.canvas=Vt.canvas(s);this.__controllers.push(this.renderer=Vt.renderer(this,n,s),this.watcher=Vt.watcher(this,s),this.layouter=Vt.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=Vt.selector(this),this.interaction=Vt.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Vt.hitCanvasManager()),this.canvasManager=new $t,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),no.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(Oo.RESTART):this.emitLeafer(Oo.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(Oo.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 Ot(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 Po(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 Dt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ue.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ue.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=f.copyAttrs({},s,ue);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Oo.BEFORE_READY),this.emitLeafer(Oo.READY),this.emitLeafer(Oo.AFTER_READY),no.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Oo.VIEW_READY),no.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){no.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(Oo.VIEW_COMPLETED),no.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 Xt.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 Oo(t,this))}__listenEvents(){const t=Ut.start("FirstCreate "+this.innerName);this.once([[Oo.START,()=>Ut.end(t)],[Ro.START,this.updateLazyBounds,this],[Co.START,this.__onCreated,this],[Co.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Lo.DATA,this.__onWatchData,this],[Ro.END,this.__onLayoutEnd,this],[Co.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){cl.list.remove(this);try{this.stop(),this.emitLeafer(Oo.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(()=>{An.clearRecycled()},100)}catch(t){ul.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new qa,Qt([xr(Xh)],t.Leafer.prototype,"__",void 0),Qt([er()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=cl=Qt([Lr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},Qt([xr(jh)],t.Rect.prototype,"__",void 0),t.Rect=Qt([Pr(ll),Tr(),Lr()],t.Rect);const{add:pl,includes:_l,scroll:gl}=Pt,fl=t.Rect.prototype,yl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o.includes("scroll"))&&(pl(a,r),gl(a,i)),this.__updateRectRenderBounds(),t=!_l(r,a),t&&"show"===o&&pl(n,a)}else this.__updateRectRenderBounds();f.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},Qt([xr(Yh)],t.Box.prototype,"__",void 0),Qt([er(100)],t.Box.prototype,"width",void 0),Qt([er(100)],t.Box.prototype,"height",void 0),Qt([Zn(!1)],t.Box.prototype,"resizeChildren",void 0),Qt([lr("show")],t.Box.prototype,"overflow",void 0),Qt([Br(fl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),Qt([Br(fl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),Qt([Br(fl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),Qt([Br(fl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),Qt([Br(fl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),Qt([Br(fl.__updateChange)],t.Box.prototype,"__updateRectChange",null),Qt([Br(fl.__render)],t.Box.prototype,"__renderRect",null),Qt([Br(yl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=Qt([Tr(),Lr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},Qt([xr(Vh)],t.Frame.prototype,"__",void 0),Qt([dr("#FFFFFF")],t.Frame.prototype,"fill",void 0),Qt([lr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=Qt([Lr()],t.Frame);const{moveTo:ml,closePath:vl,ellipse:xl}=rs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:i,innerRadius:s,startAngle:n,endAngle:r}=this.__,o=t/2,a=i/2,h=this.__.path=[];s?(n||r?(s<1&&xl(h,o,a,o*s,a*s,0,n,r,!1),xl(h,o,a,o,a,0,r,n,!0),s<1&&vl(h)):(s<1&&(xl(h,o,a,o*s,a*s),ml(h,t,a)),xl(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):n||r?(ml(h,o,a),xl(h,o,a,o,a,0,n,r,!1),vl(h)):xl(h,o,a,o,a)}},Qt([xr(Kh)],t.Ellipse.prototype,"__",void 0),Qt([rr(0)],t.Ellipse.prototype,"innerRadius",void 0),Qt([rr(0)],t.Ellipse.prototype,"startAngle",void 0),Qt([rr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=Qt([Lr()],t.Ellipse);const{moveTo:wl,lineTo:El,drawPoints:bl}=rs,{rotate:kl,getAngle:Bl,getDistance:Tl,defaultPoint:Sl}=K;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&kl(i,e),i}set toPoint(t){this.width=Tl(Sl,t),this.rotation=Bl(Sl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?bl(e,t.points,t.curve,t.closed):(wl(e,0,0),El(e,this.width,0))}},Qt([xr(Gh)],t.Line.prototype,"__",void 0),Qt([or("center")],t.Line.prototype,"strokeAlign",void 0),Qt([er(0)],t.Line.prototype,"height",void 0),Qt([rr()],t.Line.prototype,"points",void 0),Qt([rr(0)],t.Line.prototype,"curve",void 0),Qt([rr(!1)],t.Line.prototype,"closed",void 0),t.Line=Qt([Lr()],t.Line);const{sin:Pl,cos:Ll,PI:Rl}=Math,{moveTo:Cl,lineTo:Ol,closePath:Ml,drawPoints:Dl}=rs,Il=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Dl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;Cl(e,r,0);for(let t=1;t<n;t++)Ol(e,r+r*Pl(2*t*Rl/n),o-o*Ll(2*t*Rl/n));Ml(e)}}__updateRenderPath(){}__updateBoxBounds(){}},Qt([xr(Zh)],t.Polygon.prototype,"__",void 0),Qt([rr(3)],t.Polygon.prototype,"sides",void 0),Qt([rr()],t.Polygon.prototype,"points",void 0),Qt([rr(0)],t.Polygon.prototype,"curve",void 0),Qt([Br(Il.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),Qt([Br(Il.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=Qt([Tr(),Lr()],t.Polygon);const{sin:Al,cos:Wl,PI:Fl}=Math,{moveTo:zl,lineTo:Hl,closePath:Ul}=rs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];zl(o,n,0);for(let t=1;t<2*i;t++)Hl(o,n+(t%2==0?n:n*s)*Al(t*Fl/i),r-(t%2==0?r:r*s)*Wl(t*Fl/i));Ul(o)}},Qt([xr(qh)],t.Star.prototype,"__",void 0),Qt([rr(5)],t.Star.prototype,"corners",void 0),Qt([rr(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=Qt([Lr()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return u(t)&&t[0].image}},Qt([xr(el)],t.Image.prototype,"__",void 0),Qt([er("")],t.Image.prototype,"url",void 0),t.Image=Qt([Lr()],t.Image);const Nl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Vt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Nn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new wo(wo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new et(t.worldTransform).invert(),r=new et;e&&r.translate(e.x,e.y),i&&(d(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},Qt([xr(il)],t.Canvas.prototype,"__",void 0),Qt([xh(100)],t.Canvas.prototype,"width",void 0),Qt([xh(100)],t.Canvas.prototype,"height",void 0),Qt([xh(1)],t.Canvas.prototype,"pixelRatio",void 0),Qt([xh(!0)],t.Canvas.prototype,"smooth",void 0),Qt([Zn(!1)],t.Canvas.prototype,"safeResize",void 0),Qt([xh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=Qt([Lr()],t.Canvas);const{copyAndSpread:Yl,includes:Xl,spread:Vl,setList:Gl}=Pt;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=kh.number(e,n),t.__letterSpacing=kh.number(i,n),t.__padding=l?E.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Eh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Vl(a,i/2),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),f.stintSet(this,"isOverflow",!Xl(h,a)),this.isOverflow?(Gl(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;Yl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},Qt([xr(tl)],t.Text.prototype,"__",void 0),Qt([er(0)],t.Text.prototype,"width",void 0),Qt([er(0)],t.Text.prototype,"height",void 0),Qt([dr()],t.Text.prototype,"boxStyle",void 0),Qt([Zn(!1)],t.Text.prototype,"resizeFontSize",void 0),Qt([dr("#000000")],t.Text.prototype,"fill",void 0),Qt([or("outside")],t.Text.prototype,"strokeAlign",void 0),Qt([mr("all")],t.Text.prototype,"hitFill",void 0),Qt([er("")],t.Text.prototype,"text",void 0),Qt([er("")],t.Text.prototype,"placeholder",void 0),Qt([er("caption")],t.Text.prototype,"fontFamily",void 0),Qt([er(12)],t.Text.prototype,"fontSize",void 0),Qt([er("normal")],t.Text.prototype,"fontWeight",void 0),Qt([er(!1)],t.Text.prototype,"italic",void 0),Qt([er("none")],t.Text.prototype,"textCase",void 0),Qt([er("none")],t.Text.prototype,"textDecoration",void 0),Qt([er(0)],t.Text.prototype,"letterSpacing",void 0),Qt([er({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),Qt([er(0)],t.Text.prototype,"paraIndent",void 0),Qt([er(0)],t.Text.prototype,"paraSpacing",void 0),Qt([er("x")],t.Text.prototype,"writingMode",void 0),Qt([er("left")],t.Text.prototype,"textAlign",void 0),Qt([er("top")],t.Text.prototype,"verticalAlign",void 0),Qt([er(!0)],t.Text.prototype,"autoSizeAlign",void 0),Qt([er("normal")],t.Text.prototype,"textWrap",void 0),Qt([er("show")],t.Text.prototype,"textOverflow",void 0),Qt([dr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=Qt([Lr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},Qt([xr(Jh)],t.Path.prototype,"__",void 0),Qt([or("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=Qt([Lr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},Qt([xr($h)],t.Pen.prototype,"__",void 0),Qt([(t,e)=>{Yn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=Qt([Pr(Es,["set","path","paint"]),Lr()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&Vt.editor(n,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),o(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&f.assign(e,t),this.autoLayout&&f.copyAttrs(e,this,ue),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Ro.END,this.__onReady,this],[Co.START,this.__onCreated,this],[Co.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Co.END,this.__onChildRenderEnd,this))}},t.App=Qt([Lr()],t.App);const jl={},Kl={isHoldSpaceKey:()=>Kl.isHold("Space"),isHold:t=>jl[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){jl[t]||(jl[t]=!0)},setUpCode(t){jl[t]=!1}},Zl={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 ql extends fo{get spaceKey(){return Kl.isHoldSpaceKey()}get left(){return Zl.left(this)}get right(){return Zl.right(this)}get middle(){return Zl.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Kl.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){qt.changeName(t,e)}}t.PointerEvent=class extends ql{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=Qt([Rr()],t.PointerEvent);const Jl=t.PointerEvent,$l={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof qa?t:new qa(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return K.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),nl.axisMove(t,n),n}static limitMove(t,e){nl.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint($l,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint($l,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint($l,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 Pt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Pt.unsign(i),i}assignMove(t){$l.x=t?this.totalX:this.moveX,$l.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=Qt([Rr()],t.DragEvent);const Ql=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=Qt([Rr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=Qt([Rr()],t.MoveEvent),t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=Qt([Rr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=Qt([Rr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=Qt([Rr()],t.ZoomEvent),t.KeyEvent=class extends ql{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=Qt([Rr()],t.KeyEvent);const td={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:ed.getSwipeDirection(K.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:o(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new qa,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>Nr.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},ed=td,id=new qa,{getDragEventData:sd,getDropEventData:nd,getSwipeEventData:rd}=td;class od{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=sd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||id;return this.dragging&&(n?e?id:new qa(i?[...s.list,...s.dragHoverExclude]:s.list):r)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&Zl.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],Nr.draggable(e)){this.draggableList=new qa(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=sd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:o}=i.p,a=!o||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},a||n);o&&!n&&e?Nr.animateMove(i,l,d(o)?o:.3):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=sd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(K.getDistance(e,t)>n.config.pointer.swipeDistance){const t=rd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=nd(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const ad=Wt.get("emit");const hd=["move","zoom","rotate","key"];function ld(t,e,i,s,n){if(hd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!cd(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&dd(r,e,i,s,n)}}function dd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!cd(t,n)&&(Oh.updateEventStyle&&!s&&Oh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=qt.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function cd(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:pd,pathCanDrag:_d,pathHasOutside:gd}=td;class fd{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&&Zl.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Zl.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Kl.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 qa(t),this.createTransformer(),this.dragger=new od(this),s&&(this.config=f.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Zl.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),Zl.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Zl.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Zl.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=K.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;Zl.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,Kl.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,Kl.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new qa),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>pd(e.path,t));n<i.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,i){const{hitRadius:s,through:n}=this.p,{bottomList:r,target:o}=this;e.backgrounder||t.origin||o&&o.updateLayout();const a=this.selector.getByPoint(t,s,Object.assign({bottomList:r,name:t.type},i||{through:n}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!gd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!_d(t.path))&&!gd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,n=s.length;t<n&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&&K.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(pd(e.path,t.PointerEvent.LONG_TAP)||pd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Ot(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Po.RESIZE,this.__onResize,this)],t.once(Oo.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],dd(n,t,e,!0,s))return;n.isApp&&ld(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&ld(n,t,e,!1,s),dd(n,t,e,!1,s))return}catch(t){ad.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 yd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}yd.custom={};class md extends $t{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new qa,this.pixelList=new qa}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),Vt.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),Vt.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}e.getSelector=function(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Vt.selector())};const{toInnerRadiusPointOf:vd,copy:xd,setRadius:wd}=K,{hitRadiusPoint:Ed,hitPoint:bd}=Pt,kd={},Bd={},Td=t.Leaf.prototype;Td.hit=function(t,i=0){this.updateLayout(),xd(Bd,t),wd(Bd,i);const s=this.__world;return!!(i?Ed(s,Bd):bd(s,Bd))&&(this.isBranch?e.getSelector(this).hitPoint(Object.assign({},Bd),i,{target:this}):this.__hitWorld(Bd))},Td.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(xd(kd,t),wd(t=kd,e.hitRadius)),vd(t,i,kd),e.hitBox||n){if(Pt.hitRadiusPoint(s.boxBounds,kd))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(kd)},Td.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Td.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Td.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Td.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Sd=new et,Pd=t.UI.prototype;Pd.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const t=this.leafer||this.parent&&this.parent.leafer;if(!t)return;const i=this.__,{hitCanvasManager:s}=t,n=(i.__isAlphaPixelFill||i.__isCanvas)&&"pixel"===i.hitFill,r=i.__isAlphaPixelStroke&&"pixel"===i.hitStroke,o=n||r;this.__hitCanvas||(this.__hitCanvas=o?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const a=this.__hitCanvas;if(o){const{renderBounds:t}=this.__layout,s=e.image.hitCanvasSize,o=a.hitScale=Mt.set(0,0,s,s).getFitMatrix(t).a,{x:h,y:l,width:d,height:c}=Mt.set(t).scale(o);a.resize({width:d,height:c,pixelRatio:1}),a.clear(),An.patternLocked=!0,this.__renderShape(a,{matrix:Sd.setWith(this.__world).scaleWith(1/o).invertWith().translate(-h,-l),ignoreFill:!n,ignoreStroke:!r}),An.patternLocked=!1,a.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(a),a.setStrokeOptions(i)},Pd.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Ld=t.UI.prototype,Rd=t.Rect.prototype,Cd=t.Box.prototype;Rd.__updateHitCanvas=Cd.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ld.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Rd.__hitFill=Cd.__hitFill=function(t){return this.__hitCanvas?Ld.__hitFill.call(this,t):Pt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,i){return i||(i=r),this.updateLayout(),e.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const Od=pe.prototype;function Md(t,e){const i=t.__,{rows:s,decorationY:n}=i.__textDrawData;let r;i.__isPlacehold&&i.placeholderColor&&(e.fillStyle=i.placeholderColor);for(let t=0,i=s.length;t<i;t++)r=s[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach(t=>{e.fillText(t.char,t.x,r.y)});if(n){const{decorationColor:t,decorationHeight:r}=i.__textDrawData;t&&(e.fillStyle=t),s.forEach(t=>n.forEach(i=>e.fillRect(t.x,t.y+i,t.width,r)))}}function Dd(t,e){t.__.__font?Md(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Id(t,e,i){switch(e.__.strokeAlign){case"center":Ad(t,1,e,i);break;case"inside":Wd(t,"inside",e,i);break;case"outside":e.__.__fillAfterStroke?Ad(t,2,e,i):Wd(t,"outside",e,i)}}function Ad(t,e,i,s){const n=i.__;p(t)?zd(t,e,!0,i,s):(s.setStroke(t,n.__strokeWidth*e,n),Fd(i,s))}function Wd(t,e,i,s){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Ad(t,2,i,n),n.blendMode="outside"===e?"destination-out":"destination-in",Md(i,n),n.blendMode="normal",Nr.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}function Fd(t,e){let i,s=t.__.__textDrawData;const{rows:n,decorationY:r}=s;for(let t=0,s=n.length;t<s;t++)i=n[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach(t=>{e.strokeText(t.char,t.x,i.y)});if(r){const{decorationHeight:t}=s;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}}function zd(t,e,i,s,n){let r;const o=s.__,{__hasMultiStrokeStyle:a}=o;a||n.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,l=t.length;h<l;h++)if(r=t[h],(!r.image||!Sh.checkImage(s,n,r,!1))&&r.style){if(a){const{strokeStyle:t}=r;t?n.setStroke(r.style,o.__getRealStrokeWidth(t)*e,o,t):n.setStroke(r.style,o.__strokeWidth*e,o)}else n.strokeStyle=r.style;r.blendMode?(n.saveBlendMode(r.blendMode),i?Fd(s,n):n.stroke(),n.restoreBlendMode()):i?Fd(s,n):n.stroke()}}function Hd(t,e,i){const s=e.__;if(s.__strokeWidth)if(s.__font)Id(t,e,i);else switch(s.strokeAlign){case"center":Ud(t,1,e,i);break;case"inside":!function(t,e,i){i.save(),i.clipUI(e),Ud(t,2,e,i),i.restore()}(t,e,i);break;case"outside":!function(t,e,i){const s=e.__;if(s.__fillAfterStroke)Ud(t,2,e,i);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Ud(t,2,e,r),r.clipUI(s),r.clearWorld(n),Nr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i)}}function Ud(t,e,i,s){const n=i.__;p(t)?zd(t,e,!1,i,s):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Th.strokeArrow(t,i,s)}Od.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Od.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Od.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Mt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Mt.x,Mt.y,Mt.width||1,Mt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const{getSpread:Nd,getOuterOf:Yd,getByMove:Xd,getIntersectData:Vd}=Pt;let Gd;const{stintSet:jd}=f,{hasTransparent:Kd}=bh;function Zd(t,e,i){if(!p(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout;switch(e.type){case"image":s=Sh.image(i,t,e,n,!Gd||!Gd[e.url]);break;case"linear":s=Ph.linearGradient(e,n);break;case"radial":s=Ph.radialGradient(e,n);break;case"angular":s=Ph.conicGradient(e,n);break;case"solid":const{type:r,color:a,opacity:h}=e;s={type:r,style:bh.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:bh.string(e)})}if(s){if(h(s.style)&&Kd(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 qd={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),Gd=Sh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Zd(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length&&s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(jd(i,"__isAlphaPixelFill",n),jd(i,"__isTransparentFill",r)):(jd(i,"__isAlphaPixelStroke",n),jd(i,"__isTransparentStroke",r),jd(i,"__hasMultiStrokeStyle",o))},fill:function(t,e,i){i.fillStyle=t,Dd(e,i)},fills:function(t,e,i){let s;for(let n=0,r=t.length;n<r;n++){if(s=t[n],s.image){if(Sh.checkImage(e,i,s,!e.__.__font))continue;if(!s.style){!n&&s.image.isPlacehold&&e.drawImagePlaceholder(i,s.image);continue}}if(i.fillStyle=s.style,s.transform||s.scaleFixed){if(i.save(),s.transform&&i.transform(s.transform),s.scaleFixed){const{scaleX:t,scaleY:n}=e.getRenderScaleData(!0);(!0===s.scaleFixed||"zoom-in"===s.scaleFixed&&t>1&&n>1)&&i.scale(1/t,1/n)}s.blendMode&&(i.blendMode=s.blendMode),Dd(e,i),i.restore()}else s.blendMode?(i.saveBlendMode(s.blendMode),Dd(e,i),i.restoreBlendMode()):Dd(e,i)}},fillPathOrText:Dd,fillText:Md,stroke:Hd,strokes:function(t,e,i){Hd(t,e,i)},strokeText:Id,drawTextStroke:Fd,shape:function(t,i,s){const n=i.getSameCanvas(),r=t.__nowWorld,o=i.bounds;let a,h,l,d,c,{scaleX:u,scaleY:p}=t.getRenderScaleData(!0);if(o.includes(r))c=n,a=d=r;else{const{renderShapeSpread:n}=t.__layout;let _;if(e.fullImageShadow)_=r;else{const t=n?Nd(o,u===p?n*u:[n*p,n*u]):o;_=Vd(t,r)}l=o.getFitMatrix(_);let{a:g,d:f}=l;l.a<1&&(c=i.getSameCanvas(),t.__renderShape(c,s),u*=g,p*=f),d=Yd(r,l),a=Xd(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 t.__renderShape(n,s),{canvas:n,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:p}}};let Jd={},$d={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Qd,rotateOfOuter:tc,translate:ec,scaleOfOuter:ic,multiplyParent:sc,scale:nc,rotate:rc,skew:oc}=W;function ac(t,e,i,s,n,r,o){const a=Qd();ec(a,e.x+i,e.y+s),nc(a,n,r),o&&tc(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function hc(t,e,i,s,n,r,o,a,h){const l=Qd();dc(l,e,i,s,n,r,o,a),h&&($d.a=e.width/h.width,$d.d=e.height/h.height,sc(l,$d)),t.transform=l}function lc(t,e,i,s,n,r,o,a,h,l,d,c){const u=Qd();if(c)dc(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)tc(u,{x:i/2,y:s/2},h);else switch(rc(u,h),h){case 90:ec(u,s,0);break;case 180:ec(u,i,s);break;case 270:ec(u,0,i)}Jd.x=e.x+n,Jd.y=e.y+r,ec(u,Jd.x,Jd.y),o&&ic(u,Jd,o,a)}t.transform=u}function dc(t,e,i,s,n,r,o,a){o&&rc(t,o),a&&oc(t,a.x,a.y),n&&nc(t,n,r),ec(t,e.x+i,e.y+s)}const{get:cc,translate:uc}=W,pc=new Ot,_c={},gc={};function fc(t,e,i,s){const{changeful:n,sync:r,scaleFixed:o}=i;n&&(t.changeful=n),r&&(t.sync=r),o&&(t.scaleFixed=o),t.data=yc(i,s,e)}function yc(t,e,i){t.padding&&(e=pc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:s,height:n}=i;const{opacity:r,mode:o,align:a,offset:l,scale:d,size:c,rotation:u,skew:_,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===n,x={mode:o},w="center"!==a&&(u||0)%180==90;let b,k;switch(Pt.set(gc,0,0,w?n:s,w?s:n),o&&"cover"!==o&&"fit"!==o?((d||c)&&(E.getScaleData(d,c,i,_c),b=_c.scaleX,k=_c.scaleY),(a||y||f)&&(b&&Pt.scale(gc,b,k,!0),a&&ct.toPoint(a,gc,e,gc,!0,!0))):v&&!u||(b=k=Pt.getFitScale(e,gc,"fit"!==o),Pt.put(e,i,a,b,!1,gc),Pt.scale(gc,b,k,!0)),l&&K.move(gc,l),o){case"stretch":v||(s=e.width,n=e.height);break;case"normal":case"clip":(gc.x||gc.y||b||g||u||_)&&hc(x,e,gc.x,gc.y,b,k,u,_,t.clipSize);break;case"repeat":(!v||b||u||_)&&lc(x,e,s,n,gc.x,gc.y,b,k,u,_,a,t.freeTransform),f||(x.repeat="repeat");const i=p(f);(y||i)&&(x.gap=function(t,e,i,s,n){let r,o;p(t)?(r=t.x,o=t.y):r=o=t;return{x:mc(r,i,n.width,e&&e.x),y:mc(o,s,n.height,e&&e.y)}}(y,i&&f,gc.width,gc.height,e));break;default:b&&ac(x,e,gc.x,gc.y,b,k,u)}return x.transform||(e.x||e.y)&&(x.transform=cc(),uc(x.transform,e.x,e.y)),b&&"stretch"!==o&&(x.scaleX=b,x.scaleY=k),x.width=s,x.height=n,r&&(x.opacity=r),m&&(x.filters=m),f&&(x.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x}function mc(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let vc,xc=new Ot;const{isSame:wc}=Pt;function Ec(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||fc(n,s,i,r),!0}function bc(t,e){Tc(t,wo.LOAD,e)}function kc(t,e){Tc(t,wo.LOADED,e)}function Bc(t,e,i){e.error=i,t.forceUpdate("surface"),Tc(t,wo.ERROR,e)}function Tc(t,e,i){t.hasEvent(e)&&t.emitEvent(new wo(e,i))}function Sc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Pc,scale:Lc,copy:Rc}=W,{floor:Cc,ceil:Oc,max:Mc,abs:Dc}=Math;function Ic(t,i,s){let{scaleX:n,scaleY:r}=t.getRenderScaleData(!0,i.scaleFixed);const o=n+"-"+r+"-"+s;if(i.patternId===o||t.destroyed)return!1;{const{image:a,data:h}=i;let l,d,{width:c,height:u,scaleX:p,scaleY:_,transform:g,repeat:f,gap:y}=h;n*=s,r*=s,p&&(p=Dc(p),_=Dc(_),d=Pc(),Rc(d,g),Lc(d,1/p,1/_),n*=p,r*=_),c*=n,u*=r;const m=c*u;if(!f&&m>e.image.maxCacheSize)return!1;let v=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Oc(t))}else{const t=a.width*a.height;v>t&&(v=t)}m>v&&(l=Math.sqrt(m/v)),l&&(n/=l,r/=l,c/=l,u/=l),p&&(n/=p,r/=_);const x=y&&y.x*n,w=y&&y.y*r;if(g||1!==n||1!==r){const t=c+(x||0),e=u+(w||0);n/=t/Mc(Cc(t),1),r/=e/Mc(Cc(e),1),d||(d=Pc(),g&&Rc(d,g)),Lc(d,1/n,1/r)}const E=a.getCanvas(c,u,h.opacity,h.filters,x,w,t.leafer&&t.leafer.config.smooth),b=a.getPattern(E,f||e.origin.noRepeat||"no-repeat",d,i);return i.style=b,i.patternId=o,!0}}const Ac={image:function(t,e,i,s,n){let r,o;const a=An.get(i);return vc&&i===vc.paint&&wc(s,vc.boxBounds)?r=vc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),vc=a.use>1?{leafPaint:r,paint:i,boxBounds:xc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Ec(t,e,i,a,r,s),n&&(bc(t,o),kc(t,o))):a.error?n&&Bc(t,o,a.error):(n&&(Sc(t,!0),bc(t,o)),r.loadId=a.load(()=>{Sc(t,!1),t.destroyed||(Ec(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),kc(t,o)),r.loadId=void 0},e=>{Sc(t,!1),Bc(t,o,e),r.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,i,s,n){const{scaleX:r,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed),{pixelRatio:a}=i,{data:h}=s;if(!h||s.patternId===r+"-"+o+"-"+a&&!Ch.running)return!1;if(n)if(h.repeat)n=!1;else if(!(s.changeful||"miniapp"===e.name&&Po.isResizing(t)||Ch.running)){let{width:t,height:i}=h;t*=r*a,i*=o*a,h.scaleX&&(t*=h.scaleX,i*=h.scaleY),n=t*i>e.image.maxCacheSize}return n?(t.__.__isFastShadow&&(i.fillStyle=s.style||"#000",i.fill()),function(t,e,i,s){e.save(),e.clipUI(t),i.blendMode&&(e.blendMode=i.blendMode);s.opacity&&(e.opacity*=s.opacity);s.transform&&e.transform(s.transform);e.drawImage(i.image.getFull(s.filters),0,0,s.width,s.height),e.restore()}(t,i,s,h),!0):(!s.style||s.sync||Ch.running?Ic(t,s,a):s.patternTask||(s.patternTask=An.patternTasker.add(()=>te(this,void 0,void 0,function*(){s.patternTask=null,i.bounds.hit(t.__nowWorld)&&Ic(t,s,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Ic,recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,An.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createData:fc,getPatternData:yc,fillOrFitMode:ac,clipMode:hc,repeatMode:lc},{toPoint:Wc}=ht,{hasTransparent:Fc}=bh,zc={},Hc={};function Uc(t,e,i,s){if(i){let n,r,o,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(o=t/(l-1),r=bh.string(n,s)):(o=n.offset,r=bh.string(n.color,s)),e.addColorStop(o,r),!a&&Fc(r)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Nc,getDistance:Yc}=K,{get:Xc,rotateOfOuter:Vc,scaleOfOuter:Gc}=W,{toPoint:jc}=ht,Kc={},Zc={};function qc(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Nc(e,i);r=Xc(),n?(Gc(r,e,o/a*(s||1),1),Vc(r,e,t+90)):(Gc(r,e,1,o/a*(s||1)),Vc(r,e,t))}return r}const{getDistance:Jc}=K,{toPoint:$c}=ht,Qc={},tu={};const eu={linearGradient:function(t,i){let{from:s,to:n,type:r,opacity:o}=t;Wc(s||"top",i,zc),Wc(n||"bottom",i,Hc);const a=e.canvas.createLinearGradient(zc.x,zc.y,Hc.x,Hc.y),h={type:r,style:a};return Uc(h,a,t.stops,o),h},radialGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,stretch:a}=t;jc(s||"center",i,Kc),jc(n||"bottom",i,Zc);const h=e.canvas.createRadialGradient(Kc.x,Kc.y,0,Kc.x,Kc.y,Yc(Kc,Zc)),l={type:r,style:h};Uc(l,h,t.stops,o);const d=qc(i,Kc,Zc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,i){let{from:s,to:n,type:r,opacity:o,stretch:a}=t;$c(s||"center",i,Qc),$c(n||"bottom",i,tu);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Qc.x,Qc.y):e.canvas.createRadialGradient(Qc.x,Qc.y,0,Qc.x,Qc.y,Jc(Qc,tu)),l={type:r,style:h};Uc(l,h,t.stops,o);const d=qc(i,Qc,tu,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:qc},{copy:iu,toOffsetOutBounds:su}=Pt,nu={},ru={};function ou(t,i,s,n){const{bounds:r,shapeBounds:o}=n;if(e.fullImageShadow){if(iu(nu,t.bounds),nu.x+=i.x-o.x,nu.y+=i.y-o.y,s){const{fitMatrix:t}=n;nu.x-=(r.x+(t?t.e:0)+r.width/2)*(s-1),nu.y-=(r.y+(t?t.f:0)+r.height/2)*(s-1),nu.width*=s,nu.height*=s}t.copyWorld(n.canvas,t.bounds,nu)}else s&&(iu(nu,i),nu.x-=i.width/2*(s-1),nu.y-=i.height/2*(s-1),nu.width*=s,nu.height*=s),t.copyWorld(n.canvas,o,s?nu:i)}const{toOffsetOutBounds:au}=Pt,hu={};const lu={shadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;su(l,ru),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(ru.offsetX+a.x*c*f,ru.offsetY+a.y*u*f,a.blur*c*f,bh.string(a.color)),n=a.spread?1+2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0))*f:0,ou(p,ru,n,i),s=l,a.box&&(p.restore(),p.save(),h&&(p.copyWorld(p,l,r,"copy"),s=r),h?p.copyWorld(h,r,r,"destination-out"):p.copyWorld(i.canvas,d,l,"destination-out")),Nr.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=a.length-1;au(l,hu),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(hu.offsetX+a.x*c*f,hu.offsetY+a.y*u*f,a.blur*c*f),n=a.spread?1-2*a.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0))*f:0,ou(p,hu,n,i),p.restore(),h?(p.copyWorld(p,l,r,"copy"),p.copyWorld(h,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,l,"source-out"),s=l),p.fillWorld(s,bh.string(a.color),"source-in"),Nr.copyCanvasByWorld(t,e,p,s,a.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:du}=qr;let cu;function uu(t,e,i,s,n,r,o,a){switch(e){case"grayscale":cu||(cu=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);_u(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":_u(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function pu(t){return t.getSameCanvas(!1,!0)}function _u(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(uu(this,o,t,n,s,r,void 0,!0),s=n=null),r=i.__.opacity,cu=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=pu(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=pu(t)),n||(n=pu(t)),i.__render(s,e)),"clipping"!==a&&"clipping-path"!==a||du(i,e)||i.__render(t,e);continue}const d=1===r&&i.__.__blendMode;d&&uu(this,o,t,n,s,r,void 0,!1),du(i,e)||i.__render(n||t,e),d&&uu(this,o,t,n,s,r,d,!1)}uu(this,o,t,n,s,r,void 0,!0)};const gu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",fu=gu+"_#~&*+\\=|≮≯≈≠=…",yu=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 mu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const vu=mu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),xu=mu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),wu=mu(gu),Eu=mu(fu),bu=mu("- —/~|┆·");var ku;!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"}(ku||(ku={}));const{Letter:Bu,Single:Tu,Before:Su,After:Pu,Symbol:Lu,Break:Ru}=ku;function Cu(t){return vu[t]?Bu:bu[t]?Ru:xu[t]?Su:wu[t]?Pu:Eu[t]?Lu:yu.test(t)?Tu:Bu}const Ou={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Mu(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:Du}=Ou,{Letter:Iu,Single:Au,Before:Wu,After:Fu,Symbol:zu,Break:Hu}=ku;let Uu,Nu,Yu,Xu,Vu,Gu,ju,Ku,Zu,qu,Ju,$u,Qu,tp,ep,ip,sp,np=[];function rp(t,e){Zu&&!Ku&&(Ku=Zu),Uu.data.push({char:t,width:e}),Yu+=e}function op(){Xu+=Yu,Uu.width=Yu,Nu.words.push(Uu),Uu={data:[]},Yu=0}function ap(){tp&&(ep.paraNumber++,Nu.paraStart=!0,tp=!1),Zu&&(Nu.startCharSize=Ku,Nu.endCharSize=Zu,Ku=0),Nu.width=Xu,ip.width?Du(Nu):sp&&hp(),np.push(Nu),Nu={words:[]},Xu=0}function hp(){Xu>(ep.maxWidth||0)&&(ep.maxWidth=Xu)}const{top:lp,right:dp,bottom:cp,left:up}=t.Direction4;function pp(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const _p={getDrawData:function(t,i){h(t)||(t=String(t));let s=0,n=0,r=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:a,__font:l,__padding:d}=i;d&&(r?(s=d[up],r-=d[dp]+d[up]):i.autoSizeAlign||(s=d[up]),o?(n=d[lp],o-=d[lp]+d[cp]):i.autoSizeAlign||(n=d[lp]));const c={bounds:{x:s,y:n,width:r,height:o},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,i,s){ep=t,np=t.rows,ip=t.bounds,sp=!ip.width&&!s.autoSizeAlign;const{__letterSpacing:n,paraIndent:r,textCase:o}=s,{canvas:a}=e,{width:h,height:l}=ip;if(h||l||n||"none"!==o){const t="none"!==s.textWrap,e="break"===s.textWrap;tp=!0,Ju=null,Ku=ju=Zu=Yu=Xu=0,Uu={data:[]},Nu={words:[]},n&&(i=[...i]);for(let s=0,l=i.length;s<l;s++)Gu=i[s],"\n"===Gu?(Yu&&op(),Nu.paraEnd=!0,ap(),tp=!0):(qu=Cu(Gu),qu===Iu&&"none"!==o&&(Gu=Mu(Gu,o,!Yu)),ju=a.measureText(Gu).width,n&&(n<0&&(Zu=ju),ju+=n),$u=qu===Au&&(Ju===Au||Ju===Iu)||Ju===Au&&qu!==Fu,Qu=!(qu!==Wu&&qu!==Au||Ju!==zu&&Ju!==Fu),Vu=tp&&r?h-r:h,t&&h&&Xu+Yu+ju>Vu&&(e?(Yu&&op(),Xu&&ap()):(Qu||(Qu=qu===Iu&&Ju==Fu),$u||Qu||qu===Hu||qu===Wu||qu===Au||Yu+ju>Vu?(Yu&&op(),Xu&&ap()):Xu&&ap()))," "===Gu&&!0!==tp&&Xu+Yu===0||(qu===Hu?(" "===Gu&&Yu&&op(),rp(Gu,ju),op()):$u||Qu?(Yu&&op(),rp(Gu,ju)):rp(Gu,ju)),Ju=qu);Yu&&op(),Xu&&ap(),np.length>0&&(np[np.length-1].paraEnd=!0)}else i.split("\n").forEach(t=>{ep.paraNumber++,Xu=a.measureText(t).width,np.push({x:r||0,text:t,width:Xu,paraStart:!0}),sp&&hp()})}(c,t,i),d&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":pp(e,"x",t[up]);break;case"right":pp(e,"x",-t[dp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":pp(e,"y",t[lp]);break;case"bottom":pp(e,"y",-t[cp])}}(d,c,i,r,o),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,x,w,E=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(E-v.width)/2;break;case"right":v.x+=E-v.width}v.paraStart&&c&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(c,i),function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,letterSpacing:o}=e;let a,h,l,d,c,u;s.forEach(t=>{t.words&&(l=r&&t.paraStart?r:0,u=t.words.length,h=i&&("justify"===n||"both"===n)&&u>1?(i-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,i)=>{1===d?(c={char:"",x:a},a=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,i,s){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==n||i===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,i,r),c.overflow&&function(t,i,s,n){if(!n)return;const{rows:r,overflow:o}=t;let{textOverflow:a}=i;if(r.splice(o),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=s+n-l;("none"===i.textWrap?r:[r[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],h=t.x+t.width,!(s===i&&h<d));s--){if(h<d&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,i,s,r),"none"!==a&&function(t,e){let i;const{fontSize:s,textDecoration:n}=e;switch(t.decorationHeight=s/11,p(n)?(i=n.type,n.color&&(t.decorationColor=bh.string(n.color))):i=n,i){case"under":t.decorationY=[.15*s];break;case"delete":t.decorationY=[.35*-s];break;case"under-delete":t.decorationY=[.15*s,.35*-s]}}(c,i),c}};const gp={string:function(t,e){const i=d(e)&&e<1;if(h(t)){if(!i||!bh.object)return t;t=bh.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};function fp(t){return t?u(t)?t:[t]:[]}Object.assign(Eh,_p),Object.assign(bh,gp),Object.assign(Th,qd),Object.assign(Sh,Ac),Object.assign(Ph,eu),Object.assign(Lh,lu),Object.assign(Vt,{interaction:(t,e,i,s)=>new fd(t,e,i,s),hitCanvas:(t,e)=>new $a(t,e),hitCanvasManager:()=>new md}),th();class yp extends fo{get list(){return fp(this.value)}get oldList(){return fp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function mp(t){return(e,i)=>{const s="_"+i;Yn(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){if(this.config){const t="target"===i;if(t){u(e)&&e.length>1&&e[0].locked&&e.splice(0,1),this.single&&(this.element.syncEventer=null);const{beforeSelect:t}=this.config;if(t){const i=t({target:e});if(p(i))e=i;else if(!1===i)return}}const s=t?yp.BEFORE_SELECT:yp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new yp(s,{editor:this,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}yp.BEFORE_SELECT="editor.before_select",yp.SELECT="editor.select",yp.AFTER_SELECT="editor.after_select",yp.BEFORE_HOVER="editor.before_hover",yp.HOVER="editor.hover";const{abs:vp}=Math,{copy:xp,scale:wp}=W,{setListWithFn:Ep}=Pt,{worldBounds:bp}=qr,kp={a:1,b:0,c:0,d:1,e:0,f:0},Bp={x:0,y:0,width:0,height:0};class Tp extends t.UI{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(Ep(Bp,e,bp),t&&this.set(t),this.set(Bp),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:o,fill:a}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=vp(c.scaleX),l=vp(c.scaleY);if(xp(kp,c),kp.half=o%2,i!==l){wp(kp,1/i,1/l),t.setWorld(kp,e.matrix),t.beginPath(),n.strokeWidth=o;const{x:r,y:a,width:h,height:d}=s.__layout.boxBounds;t.rect(r*i,a*l,h*i,d*l)}else t.setWorld(kp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=o/vp(c.scaleX);r&&(h(r)?Th.stroke(r,this,t):Th.strokes(r,this,t)),a&&(h(a)?Th.fill(a,this,t):Th.fills(a,this,t))}}n.strokeWidth=o}}destroy(){this.target=null,super.destroy()}}Qt([mp(function(t){const e=t.target;t.list=e?u(e)?e:[e]:[]})],Tp.prototype,"target",void 0);class Sp extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const Pp={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return Lp([t],i,e),i}};function Lp(t,e,i){let s,n;for(let r=0,o=t.length;r<o;r++)if(s=t[r],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&Lp(s.children,e,i)}}const{findOne:Rp,findByBounds:Cp}=Pp;class Op extends t.Group{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 Tp,this.targetStroker=new Tp,this.bounds=new Ot,this.selectArea=new Sp,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{stroke:e,strokeWidth:i,hover:s,hoverStyle:n}=t.mergeConfig;this.hoverStroker.setTarget(s?this.editor.hoverTarget:null,Object.assign({stroke:e,strokeWidth:i},n||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(e.target=null)}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new qa(Cp(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!Rp(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new qa(this.editor.editBox.rect)};return Rp(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):Rp(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[yp.HOVER,this.onHover,this],[yp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Mp,top:Dp,topRight:Ip,right:Ap,bottomRight:Wp,bottom:Fp,bottomLeft:zp,left:Hp}=t.Direction9,{toPoint:Up}=ht,{within:Np,sign:Yp}=E,Xp={getScaleData(t,e,i,s,n,r,o,a){let h,l={},d=1,c=1;const{boxBounds:u,widthRange:p,heightRange:_,dragBounds:g,worldBoxBounds:f}=t,{width:y,height:m}=e;r&&(s.x*=2,s.y*=2);const v=t.scaleX/e.scaleX,x=t.scaleY/e.scaleY,w=Yp(v),E=Yp(x),b=a?v:w*u.width/y,k=a?x:E*u.height/m;s.x*=a?v:w,s.y*=a?x:E;const B=(-s.y+m)/m,T=(s.x+y)/y,S=(s.y+m)/m,P=(-s.x+y)/y;switch(i){case Dp:c=B,h="bottom";break;case Ap:d=T,h="left";break;case Fp:c=S,h="top";break;case Hp:d=P,h="right";break;case Mp:c=B,d=P,h="bottom-right";break;case Ip:c=B,d=T,h="bottom-left";break;case Wp:c=S,d=T,h="top-left";break;case zp:c=S,d=P,h="top-right"}if(n)if("corner"===n&&i%2)n=!1;else{let t;switch(i){case Dp:case Fp:t=c;break;case Hp:case Ap:t=d;break;default:t=Math.sqrt(Math.abs(d*c))}d=d<0?-t:t,c=c<0?-t:t}const L=1!==d,R=1!==c;if(L&&(d/=b),R&&(c/=k),!o){const{worldTransform:e}=t;d<0&&(d=1/u.width/e.scaleX),c<0&&(c=1/u.height/e.scaleY)}if(Up(r||h,u,l,!0),g){const e="parent"===g?t.parent.boxBounds:g,i=new Ot(t.__localBoxBounds);if(Pt.includes(new Ot(e).spread(.1),i)&&(i.scaleOf(t.getLocalPointByInner(l),d,c),!Pt.includes(e,i))){const t=i.getIntersect(e),s=t.width/i.width,n=t.height/i.height;L&&(d*=s),R&&(c*=n)}}if(L&&p){const e=u.width*t.scaleX;d=Np(e*d,p)/e}if(R&&_){const e=u.height*t.scaleY;c=Np(e*c,_)/e}return L&&Math.abs(d*f.width)<1&&(d=Yp(d)/f.width),R&&Math.abs(c*f.height)<1&&(c=Yp(c)/f.height),n&&d!==c&&(c=d=Math.min(d,c)),{origin:l,scaleX:d,scaleY:c,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case Mp:r="bottom-right";break;case Ip:r="bottom-left";break;case Wp:r="top-left";break;case zp:r="top-right";break;default:r="center"}return Up(n||r,t.boxBounds,o,!0),{origin:o,rotation:K.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case Dp:case Mp:r={x:.5,y:0},n="bottom",a=1;break;case Fp:case Wp:r={x:.5,y:1},n="top",a=1;break;case Hp:case zp:r={x:0,y:.5},n="right",h=1;break;case Ap:case Ip:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,Up(s||n,t,o,!0);const c=K.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,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 Hp:t=Ap;break;case Mp:t=Ip;break;case zp:t=Wp;break;case Ap:t=Hp;break;case Ip:t=Mp;break;case Wp:t=zp}if(i)switch(t){case Dp:t=Fp;break;case Mp:t=zp;break;case Ip:t=Wp;break;case Fp:t=Dp;break;case zp:t=Mp;break;case Wp:t=Ip}return t}},Vp={};function Gp(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("circle"===i.name)return;if("button"===i.pointType)return void(i.cursor||(i.cursor="pointer"));let{rotation:h}=t;const{pointType:l}=i,{resizeCursor:d,rotateCursor:c,skewCursor:u,resizeable:p,rotateable:_,skewable:g}=t.mergeConfig;let f=l.includes("resize");f&&_&&(t.isHoldRotateKey(e)||!p)&&(f=!1);const y=g&&!f&&("resize-line"===i.name||"skew"===l),m=s?n?u:r?d:c:y?u:f?d:c;h+=45*(Xp.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(E.formatRotation(h,!0)/2);const{url:v,x:x,y:w}=m,b=v+h;Vp[b]?i.cursor=Vp[b]:Vp[b]=i.cursor={url:Kp(v,h),x:x,y:w}}function jp(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Kp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Zp extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const qp=["top","right","bottom","left"],Jp=void 0;class $p extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.visible&&this.view.visible}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return h(t)||h(e)||h(i)}constructor(e){super(),this.view=new t.Group,this.rect=new t.Box({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Zp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:r,resizeLines:o,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 Zp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Zp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new Zp({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),s.addMany(...r,a,h,l,...o,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:r}=this,{stroke:o,strokeWidth:a}=e,h=this.getPointsStyle(),l=this.getMiddlePointsStyle();let d;this.visible=!t.locked;for(let t=0;t<8;t++)d=r[t],d.set(this.getPointStyle(t%2?l[(t-1)/2%l.length]:h[t/2%h.length])),d.rotation=(t-(t%2?1:0))/2*90;n.set(this.getPointStyle(e.circle||e.rotatePoint||h[0])),s.set(Object.assign({stroke:o,strokeWidth:a,editConfig:Jp},e.rect||{}));const c=i&&this.transformTool.editTool;s.hittable=!c,s.syncEventer=c&&this.editor,c&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),jp(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editMask:e}=this.editor,{mergeConfig:i,single:s,rect:n,circle:r,buttons:o,resizePoints:a,rotatePoints:h,resizeLines:l}=this,{middlePoint:c,resizeable:u,rotateable:p,hideOnSmall:_,editBox:g,mask:f,spread:y,hideRotatePoints:m,hideResizeLines:v}=i;if(e.visible=!!f||0,y&&Pt.spread(t,y),this.view.worldOpacity){const{width:e,height:f}=t,y=d(_)?_:10,x=g&&!(_&&e<y&&f<y);let w,E,b,k={};for(let i=0;i<8;i++)ht.toPoint(ht.directionData[i],t,k),E=a[i],w=h[i],E.set(k),w.set(k),E.visible=x&&!(!u&&!p),w.visible=x&&p&&u&&!m,i%2&&(b=l[(i-1)/2],b.set(k),b.visible=E.visible&&!v,E.visible=w.visible=x&&!!c,(i+1)/2%2?(b.width=e,_&&2*E.width>e&&(E.visible=!1)):(b.height=f,_&&2*E.width>f&&(E.visible=!1)));r.visible=x&&p&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||g})),o.visible=x&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=qp.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=qp.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?Xp.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:Jp};return t?Object.assign(o,t):o}getPointsStyle(){const{point:t}=this.mergedConfig;return u(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return u(t)?t:t?[t]:this.getPointsStyle()}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{editor:s,dragStartData:n}=this,{target:r}=this,{moveable:o,resizeable:a,rotateable:h,skewable:l,hideOnMove:d}=this.mergeConfig;"rect"===e.name?(o&&(this.moving=!0),s.opacity=d?0:1):(i.includes("rotate")||this.isHoldRotateKey(t)||!a?(h&&(this.rotating=!0),"resize-rotate"===i?a&&(this.resizing=!0):"resize-line"===e.name&&(l&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&a&&(this.resizing=!0),"skew"===i&&l&&(this.skewing=!0)),n.x=t.x,n.y=t.y,n.point={x:r.x,y:r.y},n.bounds=Object.assign({},r.getLayoutBounds("box","local")),n.rotation=r.rotation,i&&i.includes("resize")&&(Po.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")&&(Po.resizingKeys=null)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t),jp(this);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&e.onSkew(t),Gp(this,t)}}resetDoing(){this.canUse&&(this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1)}onMove(t){this.canGesture&&"drag"!==t.moveType&&(t.stop(),h(this.mergeConfig.moveable)&&(this.gesturing=this.moving=!0,this.transformTool.onMove(t)))}onMoveEnd(t){this.moving&&this.transformTool.onMove(t),this.resetDoing()}onScale(t){this.canGesture&&(t.stop(),h(this.mergeConfig.resizeable)&&(this.gesturing=this.resizing=!0,this.transformTool.onScale(t)))}onRotate(t){this.canGesture&&(t.stop(),h(this.mergeConfig.rotateable)&&(this.gesturing=this.rotating=!0,this.transformTool.onRotate(t)))}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Gp(this,t)}onArrow(t){const{editor:e,transformTool:i}=this;if(this.canUse&&e.editing&&this.mergeConfig.keyEvent){let e=0,s=0;const n=t.shiftKey?10:1;switch(t.code){case"ArrowDown":s=n;break;case"ArrowUp":s=-n;break;case"ArrowLeft":e=-n;break;case"ArrowRight":e=n}(e||s)&&i.move(e,s)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i;const n=[[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]];"circle"!==e.name&&n.push([t.PointerEvent.ENTER,t=>{this.enterPoint=e,Gp(this,t)}]),this.__eventIds.push(e.on_(n))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,()=>jp(this)],[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[t.MoveEvent.BEFORE_MOVE,this.onMove,this,!0],[t.ZoomEvent.BEFORE_ZOOM,this.onScale,this,!0],[t.RotateEvent.BEFORE_ROTATE,this.onRotate,this,!0],[t.MoveEvent.END,this.onMoveEnd,this],[t.ZoomEvent.END,this.resetDoing,this],[t.RotateEvent.END,this.resetDoing,this]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Qp={x:0,y:0,width:1e5,height:1e5};class t_ extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Qp),Object.assign(this.__world,Qp)}__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 e_='\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"/>',i_={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${e_}\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${e_}\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${e_}\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},s_=new Ot;function n_(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{s_.setListWithFn(i,t=>t.getBounds("box","page")),0===s_.width&&(s_.width=.1),0===s_.height&&(s_.height=.1),e.reset(s_.get())}),s.add(e)}const r_=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),o_=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),a_={group(e,i,s){e.sort(o_);const{app:n,parent:r}=e[0];let o;o=s&&s.add?s:new t.Group(s),r.addAt(o,r.children.indexOf(e[0])),e.sort(r_);const a=new et(i.worldTransform);return a.divideParent(r.scrollWorldTransform),o.setTransform(a),o.editable=!0,o.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(o)),n.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(r_),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(o_),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},h_=Wt.get("EditToolCreator");function l_(){return t=>{c_.register(t)}}const d_=l_,c_={list:{},register(t){const{tag:e}=t.prototype;u_[e]&&h_.repeat(e),u_[e]=t},get:(t,e)=>new u_[t](e)},{list:u_}=c_;class p_ extends yp{constructor(t,e){super(t,e)}}p_.BEFORE_OPEN="innerEditor.before_open",p_.OPEN="innerEditor.open",p_.BEFORE_CLOSE="innerEditor.before_close",p_.CLOSE="innerEditor.close";class __ extends yp{constructor(t,e){super(t,e)}}__.BEFORE_GROUP="editor.before_group",__.GROUP="editor.group",__.BEFORE_UNGROUP="editor.before_ungroup",__.UNGROUP="editor.ungroup",__.BEFORE_OPEN="editor.before_open_group",__.OPEN="editor.open_group",__.BEFORE_CLOSE="editor.before_close_group",__.CLOSE="editor.close_group";const{updateMatrix:g_}=Nr,f_={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},y_="top-left";class m_ extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(vo.CHANGE,e=>{if(this.checkChange&&f_[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,g_(this.parent),g_(this);const a=new et(this.__world);switch(o[i]=s,this.__layout.rotationChange(),g_(this),this.changedTransform=new et(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(y_,r);break;case"scaleX":t.scaleOf(y_,r,1);break;case"scaleY":t.scaleOf(y_,1,r);break;case"skewX":t.skewOf(y_,r,0);break;case"skewY":t.skewOf(y_,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class v_ extends yp{constructor(t,e){super(t,e)}}v_.BEFORE_MOVE="editor.before_move",v_.MOVE="editor.move";class x_ extends yp{constructor(t,e){super(t,e)}}x_.BEFORE_SCALE="editor.before_scale",x_.SCALE="editor.scale";class w_ extends yp{constructor(t,e){super(t,e)}}w_.BEFORE_ROTATE="editor.before_rotate",w_.ROTATE="editor.rotate";class E_ extends yp{constructor(t,e){super(t,e)}}E_.BEFORE_SKEW="editor.before_skew",E_.SKEW="editor.skew";class b_{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let r,{dragLimitAnimate:o}=s;const a=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,l=h(i.draggable),c=!o||a||l;if(e instanceof t.MoveEvent)r=e.getLocalMove(i),c&&t.DragEvent.limitMove(i,r);else{const s={x:e.totalX,y:e.totalY};e.shiftKey&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),r=t.DragEvent.getValidMove(i,n.point,s,c)}(r.x||r.y)&&(o&&!l&&a?Nr.animateMove(this,r,d(o)?o:.3):this.move(r))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:r}=this.editBox;let{around:o,lockRatio:a,flipable:h,editSize:l}=s;if(e instanceof t.ZoomEvent)this.scaleOf(i.getBoxPoint(e),e.scale,e.scale);else{const{direction:t}=e.current;(e.shiftKey||i.lockRatio)&&(a=!0);const s=Xp.getScaleData(i,r.bounds,t,e.getInnerTotal(i),a,Xp.getAround(o,e.altKey),h,!n||"scale"===l);this.editTool&&this.editTool.onScaleWithDrag?(s.drag=e,this.scaleWithDrag(s)):this.scaleOf(s.origin,s.scaleX,s.scaleY)}}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:r,rotateAround:o,rotateGap:a}=s,{direction:h}=e.current;let l,d;if(e instanceof t.RotateEvent)d=e.rotation,l=o?ht.getPoint(o,i.boxBounds):i.getBoxPoint(e);else{const t=Xp.getRotateData(i,h,e,n,e.shiftKey?null:o||i.around||i.origin||r||"center");d=n.rotation+t.rotation-i.rotation,l=t.origin}d=E.float(E.getGapRotation(d,a,i.rotation),2),d&&this.rotateOf(l,d)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=Xp.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Xp.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;p(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({target:i,x:t,y:e});if(p(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:r,moveX:a.x,moveY:a.y};this.emitEvent(new v_(v_.BEFORE_MOVE,h));const l=new v_(v_.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new x_(x_.BEFORE_SCALE,t));const r=new x_(x_.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(p(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new x_(x_.BEFORE_SCALE,c));const u=new x_(x_.SCALE,c);this.doScale(u),this.emitEvent(u)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new et(Nr.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new x_(x_.BEFORE_SCALE,o));const a=new x_(x_.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({target:i,origin:t,rotation:e});if(d(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),h=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),l={target:i,editor:r,worldOrigin:a,rotation:e,transform:h};this.emitEvent(new w_(w_.BEFORE_ROTATE,l));const c=new w_(w_.ROTATE,l);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(p(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),c={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new E_(E_.BEFORE_SKEW,c));const u=new E_(E_.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(Nr.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)}}t.Editor=class extends t.Group{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new qa,this.openedGroupList=new qa,this.simulateTarget=new m_(this),this.editBox=new $p(this),this.editToolList={},this.selector=new Op(this),this.editMask=new t_(this),this.targetEventIds=[];let i=f.clone(i_);t&&(i=f.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),Xt.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&&n_(this),this.update()}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(h(s))e=s;else if(!1===s)return}if(c_.list[e]){const t=this.editTool=this.editToolList[e]=this.editToolList[e]||c_.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(__.BEFORE_GROUP),this.target=a_.group(this.list,this.element,t),this.emitGroupEvent(__.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(__.BEFORE_UNGROUP,t)),this.target=a_.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(__.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(__.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(__.OPEN,t)}closeGroup(t){this.emitGroupEvent(__.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(__.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!Nr.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 __(t,{editTarget:e});e&&e.syncEventer||this.emitEvent(i),e&&e.emitEvent(i)}openInnerEditor(t,e,i){let s;if(h(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(h(i))s=i;else if(!1===i)return}c_.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.editToolList[s]=this.editToolList[s]||c_.get(s,this),this.innerEditor.editTarget=t,this.emitInnerEvent(p_.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(p_.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(p_.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(p_.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new p_(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&&(a_.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(a_.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_(Co.START,this.onRenderStart,this),i&&i.on_(vo.SCROLL,this.onChildScroll,this),t.on_(Co.CHILD_START,this.onAppRenderStart,this)],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},Qt([(t,e)=>{Yn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:n}=this,r=Object.assign({},t);return e&&e.editConfig&&Object.assign(r,e.editConfig),s.config&&Object.assign(r,s.config),i&&(i.editConfig&&Object.assign(r,i.editConfig),"font-size"===r.editSize&&(r.lockRatio=!0),"resize-rotate"===i.pointType&&(r.around||(r.around="center"),a(r.lockRatio)&&(r.lockRatio=!0))),o(r.dragLimitAnimate)&&(r.dragLimitAnimate=n&&n.config.pointer.dragLimitAnimate),this.mergedConfig=r}})}],t.Editor.prototype,"mergeConfig",void 0),Qt([mp(function(t,e){t.emitEvent(new yp(yp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),Qt([mp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof qa?i:new qa(i),t.multiple&&n_(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new yp(yp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new yp(yp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),t.Editor=Qt([Pr(b_,["editBox","editTool","emitEvent"])],t.Editor);class k_{static registerInnerEditor(){c_.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}t.EditTool=class extends k_{static registerEditTool(){c_.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=Qt([l_()],t.EditTool);const{left:B_,right:T_}=t.Direction9,{move:S_,copy:P_,toNumberPoints:L_}=K;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,r=t.target,o=i===B_;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.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=L_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:r,y:o}=n;i?(S_(t,r,o),s&&S_(e,-r,-o)):(s&&S_(t,-r,-o),S_(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),P_(s[7],i),P_(e[7],i),P_(s[3],a),P_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===B_||t===T_,s[t].visible=a,e[t].visible=!o&&a}},t.LineEditTool=Qt([l_()],t.LineEditTool);const{M:R_,L:C_,C:O_,Q:M_,Z:D_,N:I_,D:A_,X:W_,G:F_,F:z_,O:H_,P:U_,U:N_}=fe,Y_={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case R_:case C_:X_(t,e,i,n,1),n+=3;break;case O_:X_(t,e,i,n,3),n+=7;break;case M_:X_(t,e,i,n,2),n+=5;break;case D_:n+=1;break;case I_:X_(t,e,i,n,2),n+=5;break;case A_:X_(t,e,i,n,2),n+=9;break;case W_:X_(t,e,i,n,2),n+=6;break;case F_:X_(t,e,i,n,2),n+=9;break;case z_:X_(t,e,i,n,2),n+=5;break;case H_:t[n]=F_,t.splice(n+4,0,t[n+3],0),X_(t,e,i,n,2),n+=9,r+=2;break;case U_:t[n]=z_,t.splice(n+4,0,t[n+3]),X_(t,e,i,n,2),n+=5,r+=1;break;case N_:X_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:X_}=Y_,V_=W.get(),{topLeft:G_,top:j_,topRight:K_,right:Z_,bottom:q_,left:J_}=t.Direction9;function $_(t,e,i){t.pathInputed?Q_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function Q_(t,e,i){Y_.scale(t.__.path,e,i),t.path=t.__.path}function tg(t,e,i){const{points:s}=t;p(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):Y_.scalePoints(s,e,i),t.points=s}function eg(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)V_.a=e,V_.d=i,s[t].transform(V_,!0)}const ig=t.Leaf.prototype;function sg(e,i,s){ng(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{Nr.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function ng(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&f.assign(i,e),f.assign(t.config,i,t.userConfig)}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){$_(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)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,n=i&&i.editor,r=n&&n.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||r&&"font-size"===n.mergedConfig.editSize)!function(t,e,i,s){let n=e;if(!o(s)){const r=t.__layout;let{width:o,height:a}=r.boxBounds;switch(o*=i-e,a*=e-i,s){case j_:case q_:n=i,r.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case J_:case Z_:r.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case G_:case K_:r.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=u(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}(this,t,e,r&&r.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),$_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){Q_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?Q_(this,t,e):this.points?tg(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?Q_(this,t,e):this.points?tg(this,t,e):$_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){eg(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||$_(this,t,e),i&&eg(this,t,e)},Xt.add("resize"),Xt.add("editor","resize"),Vt.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,Zn),t.UI.addAttr("editConfig",void 0,Zn),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),Zn),t.UI.addAttr("editInner","PathEditor",Zn),t.Group.addAttr("editInner","",Zn),t.Text.addAttr("editInner","TextEditor",Zn),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const rg=Wt.get("LeaferTypeCreator"),og={list:{},register(t,e){ag[t]&&rg.repeat(t),ag[t]=e},run(t,e){const i=ag[t];i&&i(e)}},{list:ag,register:hg}=og;hg("viewport",sg),hg("custom",function(t){sg(t,null,!0)}),hg("design",function(t){sg(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),hg("document",function(t){sg(t,{zoom:{min:1},move:{scroll:"limit"}})});const lg={getData(t){const e=t[0],i=t[1],s=K.getCenter(e.from,i.from),n=K.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=K.getDistance(e.from,i.from);return{move:r,scale:K.getDistance(e.to,i.to)/o,rotation:K.getRotation(e.from,i.from,e.to,i.to),center:n}}},{abs:dg,max:cg}=Math,{sign:ug,within:pg}=E,_g={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=dg(s),o=dg(n);return r>50&&(s=cg(50,r/3)*ug(s)),o>50&&(n=cg(50,o/3)*ug(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,i){let s,n=1,{zoomMode:r,zoomSpeed:o}=i;const a=t.deltaY||t.deltaX;if(r?(s="mouse"===r||!t.deltaX&&(e.intWheelDeltaY?Math.abs(a)>17:Math.ceil(a)!==a),(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)):s=!t.shiftKey&&(t.metaKey||t.ctrlKey),s){o=pg(o,0,1);const e=t.deltaY?i.delta.y:i.delta.x,s=pg(1-dg(a)/(4*e)*o,.5,2);n=a>0?s:1/s}return n}};class gg{get transforming(){return!!(this.moveData||this.zoomData||this.rotateData)}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),this.zoomData=Object.assign(Object.assign({},e),{scale:1}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),this.rotateData=Object.assign(Object.assign({},e),{rotation:0}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,i),s&&e.emit(t.ZoomEvent.END,s),n&&e.emit(t.RotateEvent.END,n),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const fg=t.Leafer.prototype,yg=new Ot,mg=new Q;function vg(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function xg(t,e){return Object.assign(Object.assign({},e),{scale:t})}fg.initType=function(t){og.run(t,this)},fg.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(mg.set(t,e),s){const t=!0===s?"":s;t.includes("x")?mg.y=0:t.includes("y")?mg.x=0:Math.abs(mg.x)>Math.abs(mg.y)?mg.y=0:mg.x=0,i&&t.includes("limit")&&(yg.set(this.__world).addPoint(this.zoomLayer),nl.getValidMove(yg,this.canvas.bounds,"inner",mg,!0),t.includes("x")?mg.y=0:t.includes("y")&&(mg.x=0))}return{x:n?0:mg.x,y:n?0:mg.y}},fg.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const wg=fd.prototype;wg.createTransformer=function(){this.transformer=new gg(this)},wg.move=function(t){this.transformer.move(t)},wg.zoom=function(t){this.transformer.zoom(t)},wg.rotate=function(t){this.transformer.rotate(t)},wg.transformEnd=function(){this.transformer.transformEnd()},wg.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const r=e.getScale?e.getScale(t,e):_g.getScale(t,e);if(1!==r)this.zoom(xg(r,t));else{const s=e.getMove?e.getMove(t,e):_g.getMove(t,e);i.snap&&K.round(s),this.move(vg(s,t))}},wg.multiTouch=function(t,e){if(this.config.multiTouch.disabled)return;const{move:i,rotation:s,scale:n,center:r}=lg.getData(e);Object.assign(t,r),t.multiTouch=!0,this.pointerWaitCancel(),this.rotate(function(t,e){return Object.assign(Object.assign({},e),{rotation:t})}(s,t)),this.zoom(xg(n,t)),this.move(vg(i,t))};const Eg=od.prototype,{abs:bg}=Math;function kg(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}Eg.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=bg(i),r=bg(s),o=e?1:.1,a=this.canAnimate&&this.moving&&(n>o||r>o)&&this.interaction.m.dragAnimate;if(a){const o="touch"===t.pointerType?3:1,h=70;n*(e=e?d(a)?a:.95:o)>h?e=h/n:r*e>h&&(e=h/r),t=Object.assign({},t),K.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},Eg.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Eg.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Eg.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Pt.maxX(o),d=Pt.maxY(o),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,_=0;this.autoMoveTimer=setInterval(()=>{p+=c,_+=u,K.move(i,c,u),K.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},Eg.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},Xt.add("viewport"),Xt.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),_(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:r}=this,o=this.canvas.bounds.clone().shrink(a(n)?30:n),l=new Ot,c={x:o.x+o.width/2,y:o.y+o.height/2};let g;const{x:f,y:y,scaleX:m,scaleY:v}=r.__;if(h(t))switch(t){case"in":g=kg(m,"in");break;case"out":g=kg(m,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Ot(this.boxBounds)).height=0;break;case"fit-height":(t=new Ot(this.boxBounds)).width=0}else d(t)&&(g=t/m);if(g)g=this.getValidScale(g),r.scaleOfWorld(c,g,g,!1,s);else if(p(t)){const e={x:f,y:y,scaleX:m,scaleY:v},n=u(t);if(n||t.tag){const e=n?t:[t];l.setListWithFn(e,qr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,o);l.set(r.getWorldBounds(e))}const{width:a,height:h}=l;let d=o.x-l.x,c=o.y-l.y;return i?(d+=Math.max((o.width-a)/2,0),c+=Math.max((o.height-h)/2,0)):(g=this.getValidScale(Math.min(o.width/a,o.height/h)),d+=(o.width-a*g)/2,c+=(o.height-h*g)/2,K.scaleOf(e,l,g),l.scaleOf(l,g),e.scaleX*=g,e.scaleY*=g),"x"===i?c=0:"y"===i&&(d=0),K.move(e,d,c),l.move(d,c),r.set(e,s),l}return r.worldBoxBounds};class Bg extends t.Group{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&f.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;h(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new Ot(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:_,scrollYBar:g}=this,{x:f,y:y,width:m,height:v}=o.shrink([2,p?g.width+6:2,u?_.height+6:2,2]);_.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:p})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Co.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Po.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}Xt.add("scroll");class Tg extends Gh{}function Sg(t){return Gn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,ar(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Bh.register(t,e)}},Qt([xr(Tg)],t.Arrow.prototype,"__",void 0),Qt([Sg("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=Qt([Lr()],t.Arrow);const{M:Pg,L:Lg,C:Rg,Q:Cg,O:Og}=fe,{rotate:Mg,copyFrom:Dg,scale:Ig}=K,Ag={},Wg={layout(t,e,i,s,n,r,o){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Pg:case Lg:Fg(t,l+1,e,i,s,n,r,o),l+=3;break;case Rg:for(h=1;h<6;h+=2)Fg(t,l+h,e,i,s,n,r,o);l+=7;break;case Cg:for(h=1;h<4;h+=2)Fg(t,l+h,e,i,s,n,r,o);l+=5;break;case Og:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){Wg.layout(t,0,0,1,1,e,i)}};function Fg(t,e,i,s,n,r,o,a){Dg(Ag,t[e],t[e+1]),o&&Mg(Ag,o,a),n&&Ig(Ag,n,r),t[e]=i+Ag.x,t[e+1]=s+Ag.y}const{layout:zg,rotate:Hg}=Wg,{getAngle:Ug}=K,Ng={x:-.5},Yg={connect:Ng,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Xg={connect:Ng,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Vg={connect:Ng,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]},Gg={connect:Ng,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]},jg={offset:Ng,path:[...Vg.path],dashPath:[1,-2.5,0,2,-1,0]};Hg(jg.path,180,{x:-1.5,y:0});const Kg={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Zg={connect:{x:.5},path:[...Kg.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},qg={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]},Jg={path:[...qg.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},$g=f.clone(qg),Qg=f.clone(Jg);Hg($g.path,45),Hg(Qg.path,45);const tf={angle:Yg,"angle-side":Xg,arrow:Gg,triangle:Vg,"triangle-flip":jg,circle:Zg,"circle-line":Kg,square:Jg,"square-line":qg,diamond:Qg,"diamond-line":$g,mark:{offset:Ng,path:[1,0,-2,2,0,2]}};function ef(t,e,i,s,n,r,o){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;p(e)?e.type?(h=e.scale,a=tf[e.type]):a=e:a=tf[e];const{offset:c,connect:u,path:_,dashPath:g}=a;let f=u?u.x:0,y=c?c.x:0;const m=[..._];return o&&g&&m.push(...g),"none"!==l&&(f-=.5),c&&("round"===d&&c.roundJoin?y+=c.roundJoin:"bevel"===d&&c.bevelJoin&&(y+=c.bevelJoin)),h&&zg(m,0,0,h,h),y&&zg(m,y,0),zg(m,s.x,s.y,n,n,Ug(i,s)),r.x=(f+y)*n,m}const{M:sf,L:nf,C:rf,Q:of,Z:af,N:hf,D:lf,X:df,G:cf,F:uf,O:pf,P:_f,U:gf}=fe,{copy:ff,copyFrom:yf,getDistancePoint:mf}=K,vf={},xf={},wf={},Ef={},bf={},kf={list:tf,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:r,cornerRadius:o}=t.__,a=!o;let h,l=0,d=r.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=r[l],h){case sf:case nf:(c<2||l+6>=d)&&(yf(bf,r[l+1],r[l+2]),!c&&u&&ff(xf,bf)),l+=3;break;case rf:(1===c||l+7>=d-3)&&Bf(r,Ef,bf,l+3),l+=7;break;case of:(1===c||l+5>=d-3)&&Bf(r,Ef,bf,l+1),l+=5;break;case af:return;case hf:l+=5;break;case lf:l+=9;break;case df:l+=6;break;case cf:l+=9;break;case uf:l+=5;break;case pf:l+=7;break;case _f:l+=4;break;case gf:(1===c||l+6>=d-3)&&(Bf(r,Ef,bf,l+1),l+6!==d&&(bf.x-=(bf.x-Ef.x)/10,bf.y-=(bf.y-Ef.y)/10)),l+=6}if(c++,1===c&&h!==sf)return;if(2===c&&u&&ff(wf,h===nf?bf:Ef),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=ef(t,e,wf,xf,s,vf,!!n);n?d.push(...i):o.push(...i),vf.x&&(mf(xf,wf,-vf.x,!0),o[1]=wf.x,o[2]=wf.y)}if(i&&"none"!==i){const e=ef(t,i,Ef,bf,s,vf,!!n);if(n?d.push(...e):o.push(...e),vf.x){let t;switch(mf(bf,Ef,-vf.x,!0),h){case nf:t=l-3+1;break;case rf:t=l-7+5;break;case of:t=l-5+3;break;case gf:t=l-6+3}t&&Tf(o,Ef,t)}}}else ff(Ef,bf)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Bf(t,e,i,s){yf(e,t[s],t[s+1]),yf(i,t[s+2],t[s+3])}function Tf(t,e,i){t[i]=e.x,t[i+1]=e.y}Xt.add("arrow"),t.UI.addAttr("startArrow","none",Sg),t.UI.addAttr("endArrow","none",Sg),Object.assign(Bh,kf),Object.assign(Th,{strokeArrow(t,e,i){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:Sf,NoAndSkip:Pf,YesAndSkip:Lf}=t.Answer,Rf={},Cf={},Of={};class Mf{constructor(t){this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":Rf.id=t.substring(1),t=Rf;break;case".":Cf.className=t.substring(1),t=Cf;break;default:Of.tag=t,t=Of}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?f.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&Nr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),r===Sf||r===Lf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<Pf&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(yo.REMOVE,this.__onRemoveChild,this),this.target.on_(vo.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 Df=t.UI.prototype;function If(t){return t.leafer?t.leafer.selector:e.selector||(e.selector=Vt.selector())}Df.find=function(t,e){return If(this).getBy(t,this,!1,e)},Df.findOne=function(t,e){return If(this).getBy(t,this,!0,e)},Xt.add("find"),Vt.finder=function(t){return new Mf(t)};const{setPoint:Af,addPoint:Wf,toBounds:Ff}=st;const zf={syncExport(t,i,s){let n;Ch.running=!0;try{const r=Pn.fileType(i),a=i.includes(".");s=Pn.getExportOptions(s);const{toURL:h}=e,{download:l}=e.origin;if("json"===r)a&&l(h(JSON.stringify(t.toJSON(s.json)),"text"),i),n={data:!!a||t.toJSON(s.json)};else if("svg"===r)a&&l(h(t.toSVG(),"svg"),i),n={data:!!a||t.toSVG()};else{let e,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:_,trim:g,screenshot:f,padding:y,onCanvas:m}=s,v=o(s.smooth)?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),w=d&&f&&o(s.fill)?t.fill:s.fill,b=Pn.isOpaqueImage(i)||w,k=new et;if(f)e=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let i=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,i){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":i=c||t;default:k.set(l).divide(t.getTransform(i));const e=i.worldTransform;a/=a/e.scaleX,h/=h/e.scaleY}e=t.getBounds("render",i)}const B={scaleX:1,scaleY:1};E.getScaleData(s.scale,s.size,e,B);let T=s.pixelRatio||1,{x:S,y:P,width:L,height:R}=new Ot(e).scale(B.scaleX,B.scaleY);_&&(S+=_.x,P+=_.y,L=_.width,R=_.height);const C={exporting:!0,matrix:k.scale(1/B.scaleX,1/B.scaleY).invert().translate(-S,-P).withScale(1/a*B.scaleX,1/h*B.scaleY)};let O,M=Vt.canvas({width:Math.floor(L),height:Math.floor(R),pixelRatio:T,smooth:v,contextSettings:x});if(p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=M.bounds),M.save(),u&&!o(w)){const e=t.get("fill");t.fill="",t.__render(M,C),t.fill=e}else t.__render(M,C);if(M.restore(),O&&O.__updateWorldOpacity(),g){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?Wf(o,n,r):Af(o={},n,r)),a++;const h=new Ot;return o&&(Ff(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:T};M=Vt.canvas(s),M.copyWorld(t,r,s),t.destroy()}if(y){const[t,e,i,s]=E.fourNumber(y),n=M,{width:r,height:o}=n;M=Vt.canvas({width:r+s+e,height:o+t+i,pixelRatio:T}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}b&&M.fillWorld(M.bounds,w||"#FFFFFF","destination-over"),m&&m(M);n={data:"canvas"===i?M:M.export(i,s),width:M.pixelWidth,height:M.pixelHeight,renderBounds:e,trimBounds:r}}}catch(t){n={data:"",error:t}}return Ch.running=!1,n},export(t,i,s){return Ch.running=!0,function(t){Hf||(Hf=new On);return new Promise(e=>{Hf.add(()=>te(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(n=>new Promise(r=>{const o=()=>te(this,void 0,void 0,function*(){if(!Dn.isComplete)return e.requestRender(o);const a=Ch.syncExport(t,i,s);a.data instanceof Promise&&(a.data=yield a.data),n(a),r()});t.updateLayout(),Uf(t);const{leafer:a}=t;a?a.waitViewCompleted(o):o()}))}};let Hf;function Uf(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Uf(t))}const Nf=pe.prototype,Yf=Wt.get("@leafer-in/export");Nf.export=function(t,e){const{quality:i,blob:s}=Pn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Nf.toBlob=function(t,i){return new Promise(s=>{e.origin.canvasToBolb(this.view,t,i).then(t=>{s(t)}).catch(t=>{Yf.error(t),s(null)})})},Nf.toDataURL=function(t,i){return e.origin.canvasToDataURL(this.view,t,i)},Nf.saveAs=function(t,i){return new Promise(s=>{e.origin.canvasSaveAs(this.view,t,i).then(()=>{s(!0)}).catch(t=>{Yf.error(t),s(!1)})})},Xt.add("export"),Object.assign(Ch,zf),t.UI.prototype.export=function(t,e){return Ch.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Ch.syncExport(this,t,e)};const Xf={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Vf={top:"flex-start",middle:"center",bottom:"flex-end"},Gf={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function jf(t,e,i){const{style:s}=t,{fill:n,padding:r,textWrap:a,textOverflow:l,textDecoration:d}=e;let c;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";u(e)&&(e=e[0]);if(p(e))switch(e.type){case"solid":i=bh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=bh.string(h(t)?t:t.color);break;default:o(e.r)||(i=bh.string(e))}else i=e;t.color=i}(s,n),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,p(d)?(c=d.type,d.color&&(s.textDecorationColor=bh.string(d.color))):c=d,s.textDecoration=Gf[c],s.textTransform=Xf[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Vf[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===a||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===a?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=u(r)?r.map(t=>t*i+"px").join(" "):(r||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}t.TextEditor=class extends k_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div"),{style:r}=n;n.contentEditable="true",r.position="fixed",r.transformOrigin="left top",r.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:o}=e.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(n):o.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];h.setStartAfter(t),h.setEndAfter(t),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth&&(i+=20,o.autoSizeAlign))switch(o.textAlign){case"center":n=-i/2;break;case"right":n=-i}if(o.__autoHeight&&(s+=20,o.autoSizeAlign))switch(o.verticalAlign){case"middle":r=-s/2;break;case"bottom":r=-s}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:_}=new et(t.worldTransform).scale(1/e).translateInner(n,r),{style:g}=this.editDom;g.transform=`matrix(${l},${d},${c},${u},${p},${_})`,g.left=a+"px",g.top=h+"px",g.width=i+"px",g.height=s+"px",this.isHTMLText||jf(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}},t.TextEditor=Qt([d_()],t.TextEditor),Xt.add("text-editor","editor");class Kf extends el{setText(t){this._text=t,this.__htmlChanged=!0}}return t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}},Qt([xr(Kf)],t.HTMLText.prototype,"__",void 0),Qt([er("")],t.HTMLText.prototype,"text",void 0),Qt([Zn("TextEditor")],t.HTMLText.prototype,"editInner",void 0),Qt([dr(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=Qt([Lr()],t.HTMLText),Xt.add("html"),t.AlignHelper=ct,t.AroundHelper=ht,t.ArrowData=Tg,t.AutoBounds=Dt,t.BezierHelper=Ye,t.Bounds=Ot,t.BoundsEvent=Eo,t.BoundsHelper=Pt,t.BoxData=Yh,t.BranchHelper=to,t.BranchRender=fa,t.CanvasData=il,t.CanvasManager=$t,t.ChildEvent=yo,t.ColorConvert=bh,t.Creator=Vt,t.Cursor=yd,t.DataHelper=f,t.Debug=Wt,t.DragBoundsHelper=nl,t.Dragger=od,t.EditBox=$p,t.EditDataHelper=Xp,t.EditPoint=Zp,t.EditSelect=Op,t.EditSelectHelper=Pp,t.EditToolCreator=c_,t.EditorEvent=yp,t.EditorGroupEvent=__,t.EditorHelper=a_,t.EditorMoveEvent=v_,t.EditorRotateEvent=w_,t.EditorScaleEvent=x_,t.EditorSkewEvent=E_,t.Effect=Lh,t.EllipseData=Kh,t.EllipseHelper=$e,t.Event=fo,t.EventCreator=qt,t.Eventer=zo,t.Export=Ch,t.FileHelper=Pn,t.Filter=Rh,t.Finder=Mf,t.FrameData=Vh,t.GroupData=Nh,t.HTMLTextData=Kf,t.HitCanvasManager=md,t.ImageData=el,t.ImageEvent=wo,t.ImageManager=An,t.IncrementId=i,t.InnerEditor=k_,t.InnerEditorEvent=p_,t.InteractionBase=fd,t.InteractionHelper=td,t.Keyboard=Kl,t.LayoutEvent=Ro,t.Layouter=ph,t.LeafBounds=pa,t.LeafBoundsHelper=qr,t.LeafData=m,t.LeafDataProxy=$o,t.LeafEventer=qo,t.LeafHelper=Nr,t.LeafLayout=go,t.LeafLevelList=Ja,t.LeafList=qa,t.LeafMatrix=ra,t.LeafRender=_a,t.LeaferCanvas=$a,t.LeaferCanvasBase=pe,t.LeaferData=Xh,t.LeaferEvent=Oo,t.LeaferImage=Nn,t.LeaferTypeCreator=og,t.LineData=Gh,t.MathHelper=E,t.Matrix=et,t.MatrixHelper=W,t.MultiTouchHelper=lg,t.MyDragEvent=Ql,t.MyImage=Nl,t.MyPointerEvent=Jl,t.NeedConvertToCanvasCommandMap=me,t.OneRadian=k,t.PI2=B,t.PI_2=T,t.Paint=Th,t.PaintGradient=Ph,t.PaintImage=Sh,t.PathArrow=Bh,t.PathArrowModule=kf,t.PathBounds=fn,t.PathCommandDataHelper=rs,t.PathCommandMap=fe,t.PathConvert=Ai,t.PathCorner=bn,t.PathCreator=Es,t.PathData=Jh,t.PathDrawer=Ws,t.PathHelper=_e,t.PathMatrixHelper=Wg,t.PathNumberCommandLengthMap=Ee,t.PathNumberCommandMap=we,t.PenData=$h,t.Picker=yh,t.Platform=e,t.Plugin=Xt,t.Point=Q,t.PointHelper=K,t.PointerButton=Zl,t.PolygonData=Zh,t.PropertyEvent=vo,t.RectData=jh,t.RectHelper=be,t.RectRender=ll,t.RenderEvent=Co,t.Renderer=gh,t.ResizeEvent=Po,t.Resource=Dn,t.Run=Ut,t.ScrollBar=Bg,t.SelectArea=Sp,t.Selector=mh,t.StarData=qh,t.State=Oh,t.StringNumberMap=It,t.Stroker=Tp,t.TaskItem=Cn,t.TaskProcessor=On,t.TextConvert=Eh,t.TextData=tl,t.TransformTool=b_,t.Transformer=gg,t.Transition=Mh,t.TwoPointBoundsHelper=st,t.UIBounds=sl,t.UICreator=jt,t.UIData=Hh,t.UIEvent=ql,t.UIRender=al,t.UnitConvert=kh,t.WaitHelper=no,t.WatchEvent=Lo,t.Watcher=ih,t.WheelEventHelper=_g,t.addViewport=sg,t.addViewportConfig=ng,t.affectRenderBoundsType=lr,t.affectStrokeBoundsType=or,t.arrowType=Sg,t.attr=jn,t.autoLayoutType=$n,t.boundsType=er,t.canvasPatch=Sn,t.canvasSizeAttrs=ue,t.createAttr=function(t){return(e,i)=>{Yn(e,i,Vn(i,t))}},t.createDescriptor=Vn,t.cursorType=vr,t.dataProcessor=xr,t.dataType=Zn,t.decorateLeafAttr=Gn,t.defineDataProcessor=wr,t.defineKey=Yn,t.defineLeafAttr=Kn,t.doBoundsType=sr,t.doStrokeType=ar,t.effectType=vh,t.emptyData=r,t.eraserType=yr,t.extraPropertyEventMap=xo,t.getBoundsData=P,t.getDescriptor=Xn,t.getMatrixData=L,t.getPointData=S,t.hitType=mr,t.isArray=u,t.isData=_,t.isEmptyData=g,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=p,t.isString=h,t.isUndefined=o,t.layoutProcessor=function(t){return(e,i)=>{Yn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Wo,t.maskType=fr,t.naturalBoundsType=ir,t.opacityType=cr,t.path=kn,t.pathInputType=nr,t.pathType=rr,t.pen=Bn,t.positionType=qn,t.registerEditTool=l_,t.registerInnerEditor=d_,t.registerUI=Lr,t.registerUIEvent=Rr,t.resizeType=xh,t.rewrite=Br,t.rewriteAble=Tr,t.rotationType=tr,t.scaleType=Qn,t.scrollType=Jn,t.sortType=gr,t.strokeType=hr,t.surfaceType=dr,t.tempBounds=Mt,t.tempMatrix=it,t.tempPoint=tt,t.tryToNumber=function(t){return"string"==typeof t&&c.test(t)?+t:t},t.useCanvas=th,t.useModule=Pr,t.version="1.9.5",t.visibleType=ur,t.zoomLayerType=wh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=worker.min.js.map