@leafer/miniapp 1.11.0 → 1.11.2
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.
- package/dist/miniapp.cjs +9 -0
- package/dist/miniapp.esm.js +11 -0
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +14 -4
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +21 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(t||(t={}));const e={};function i(t){return void 0===t}function s(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:n}=Number;function r(t){return"number"==typeof t}const a=/^-?\d+(?:\.\d+)?$/;function h(t){return"string"==typeof t&&a.test(t)?+t:t}const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return d(t)&&!l(t)}function u(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return _(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&_(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{i(e[s])||(t[s]=e[s])}),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:_}=g;class p{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(!i(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let o in this)"_"!==o[0]&&(s=e?e[o]:void 0,t[o]=i(s)?this[o]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!i(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!i(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(l(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:o}=this;s.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!i(t))){if("path"===n&&!this.__pathInputed)continue;e=o?o[n]:void 0,s[n]=i(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:o,e:n,f:r}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:o,e:n,f:r}}return s}__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{floor:f,max:m}=Math,y={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",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,o,n,r,a,h){const l=y.origin.createCanvas(m(f(e+(s||0)),1),m(f(i+(o||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==r,n){const s=e/n.width,o=i/n.height;d.setTransform(s,0,0,o,-n.x*s,-n.y*o),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:v}=y,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=w;let b,k,S;const{max:E}=Math,B=[0,0,0,0],T={zero:[...B],tempFour:B,set:(t,e,i,s,o)=>(void 0===i&&(i=s=o=e),t[0]=e,t[1]=i,t[2]=s,t[3]=o,t),setTemp:(t,e,i,s)=>R(B,t,e,i,s),toTempAB(t,e,i){S=i?r(t)?e:t:[],r(t)?(b=O(t),k=e):r(e)?(b=t,k=O(e)):(b=t,k=e),4!==b.length&&(b=C(b)),4!==k.length&&(k=C(k))},get(t,e){let s;if(!r(t))switch(t.length){case 4:s=i(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!i(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,i)=>r(t)&&r(e)?E(t,e):(P(t,e,i),R(S,E(b[0],k[0]),E(b[1],k[1]),E(b[2],k[2]),E(b[3],k[3]))),add:(t,e,i)=>r(t)&&r(e)?t+e:(P(t,e,i),R(S,b[0]+k[0],b[1]+k[1],b[2]+k[2],b[3]+k[3])),swapAndScale(t,e,i,s){if(r(t))return e===i?t*e:[t*i,t*e];const o=s?t:[],[n,a,h,l]=4===t.length?t:C(t);return R(o,h*i,l*e,n*i,a*e)}},{set:R,get:C,setTemp:O,toTempAB:P}=T,{round:L,pow:A,max:D,floor:M,PI:F}=Math,I={within:(t,e,s)=>(d(e)&&(s=e.max,e=e.min),!i(e)&&t<e&&(t=e),!i(s)&&t>s&&(t=s),t),fourNumber:T.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),I.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 s=i(e)?1e12:A(10,e);return-0===(t=L(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(r(e)?e:e.width||0)/i.width,o=(r(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&I.assignScale(s,t);return s},assignScale(t,e){r(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(M(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const z=F/180,Y=2*F,X=F/2;function N(){return{x:0,y:0}}function H(){return{x:0,y:0,width:0,height:0}}function V(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:U,acos:G,sqrt:K}=Math,{float:q}=I,Z={};function J(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:V,getWorld:J,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.scaleOfInner(t,Z,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=U(e*=z),a=j(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,Z),$.rotateOfInner(t,Z,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=z,t.a=s+n*i,t.b=o+r*i),e&&(e*=z,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,Z),$.skewOfInner(t,Z,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,s,o,n){const{e:r,f:a}=t;if(s||(s=t),i(o)&&(o=1!==t.a||t.b||t.c||1!==t.d),o){const{a:i,b:o,c:r,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=r*e.a+a*e.c,s.d=r*e.b+a*e.d,n&&(s.scaleX=e.scaleX*n.scaleX,s.scaleY=e.scaleY*n.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,n&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=r*e.a+a*e.c+e.e,s.f=r*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,s,o,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(i(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:o}=e,n=i*z,r=U(n),a=j(n);if(s||o){const e=s*z,i=o*z;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(s=s||o)&&$.translateInner(t,-s.x,-s.y,!o)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=K(o*o+n*n),c=t/d;const e=o/d;u=n>0?G(e):-G(e)}else{c=K(r*r+a*a),d=t/c;const e=r/c;u=X-(a>0?G(-e):-G(e))}const e=q(U(u)),i=j(u);d=q(d),c=q(c),g=e?q((r/c+i)/e/z,9):0,_=e?q((n/d-i)/e/z,9):0,u=q(u/z)}else d=o,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=K(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=Q,{toInnerPoint:tt,toOuterPoint:et}=Q,{sin:it,cos:st,abs:ot,sqrt:nt,atan2:rt,min:at,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,s){t.radiusX=e,t.radiusY=i(s)?e:s},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?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){d(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=dt.defaultPoint);const s=st(e*=z),o=it(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(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)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=ot(i-t),n=ot(s-e);return nt(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>at(ct(t,e,i,s),ct(i,s,o,n)),getAngle:(t,e)=>gt(t,e)/z,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/z),getRadianFrom(t,e,s,o,n,r,a,h){i(a)&&(a=s,h=o);const l=t-s,d=e-o,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>rt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,o){const n=gt(t,e);return o&&(t=e),s||(e={}),e.x=t.x+st(n)*i,e.y=t.y+it(n)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,getAtan2:gt}=dt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new _t(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const pt=new _t;class ft{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return d(t)?Q.copy(this,t):Q.set(this,t,e,i,s,o,n),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new ft(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const mt=new ft,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,o){vt(t,e,i),vt(t,e+s,i+o)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:vt}=yt;var wt,xt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(xt||(xt={}));const bt=[{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}];bt.forEach(t=>t.type="percent");const kt={directionData:bt,tempPoint:{},get:St,toPoint(t,e,i,s,o,n){const r=St(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),kt.toPoint(t,e,i,!0),i)};function St(t){return o(t)?bt[xt[t]]:t}const{toPoint:Et}=kt,Bt={toPoint(t,e,i,s,o,n){Et(t,i,s,o,e,n)}},{tempPointBounds:Tt,setPoint:Rt,addPoint:Ct,toBounds:Ot}=yt,{toOuterPoint:Pt}=Q,{float:Lt,fourNumber:At}=I,{floor:Dt,ceil:Mt}=Math;let Ft,It,Wt,zt;const Yt={},Xt={},Nt={},Ht={tempBounds:Nt,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(l(i)){const e=At(i);s?Vt.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Vt.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Vt.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Vt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ut(e,t):e=t,i||(i=t),e.offsetX=Vt.maxX(i),e.offsetY=Vt.maxY(i),Vt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Nt,t),Vt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Vt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o,e:n,f:r}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=r+t.y*o):(i.height=t.height*-o,i.y=r+t.y*o-i.height)}else Yt.x=t.x,Yt.y=t.y,Pt(e,Yt,Xt),Rt(Tt,Xt.x,Xt.y),Yt.x=t.x+t.width,Pt(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Yt.y=t.y+t.height,Pt(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Yt.x=t.x,Pt(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Ot(Tt,i)},toInnerOf(t,e,i){i||(i=t),Vt.move(i,-e.e,-e.f),Vt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Vt.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),o(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Nt.width=n?e.width*=s:e.width*s,Nt.height=n?e.height*=s:e.height*s,Bt.toPoint(i,Nt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Vt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Vt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Vt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){Ft=t.x+t.width,It=t.y+t.height,Wt=e.x,zt=e.y,i||(Wt+=e.width,zt+=e.height),Ft=Ft>Wt?Ft:Wt,It=It>zt?It:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=It-t.y},addList(t,e){Vt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Vt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Vt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Ut(t,o)):jt(t,o));n&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Tt,t.x,t.y):Ct(Tt,t.x,t.y)),Ot(Tt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=lt.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=lt.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=Vt.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=Vt.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=Vt.tempToOuterOf(e,i)),!Vt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return Ft=s+n,It=o+r,Wt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,Ft=Ft<Wt?Ft:Wt,It=It<zt?It:zt,n=Ft-s,r=It-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){Vt.copy(t,Vt.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){Vt.set(t)}},Vt=Ht,{add:jt,copy:Ut}=Vt;class Gt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Ht.copy(this,t):Ht.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 Gt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Kt=new Gt;class qt{constructor(t,e,i,s,o,n){d(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Gt(o,e,n||t.width-o-i,r||t.height-e-s)}}const Zt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Jt}=I;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=$t(t)}static set exclude(t){this.excludeList=$t(t)}static drawRepaint(t,e){const i=Jt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,o=t.__nowWorld,n=Jt();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.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 $t(t){return t?o(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const te=Qt,ee=Qt.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return se.currentId=se.idMap[i]=e?performance.now():Date.now(),se.currentName=se.nameMap[i]=t,se.nameToIdMap[t]=i,i},end(t,e){const i=se.idMap[t],s=se.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[s]=void 0,ee.log(s,o,"ms")},endOfName(t,e){const s=se.nameToIdMap[t];i(s)||se.end(s,e)}},se=ie,oe=[],ne={list:{},add(t,...e){this.list[t]=!0,oe.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(()=>oe.forEach(t=>ne.has(t,!0)));const re={editor:t=>ne.need("editor")},ae=Qt.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&ae.repeat(e),le[e]=t},get(t,e,s,o,n,r){le[t]||ae.error("not register "+t);const a=new le[t](e);return i(s)||(a.x=s,o&&(a.y=o),n&&(a.width=n),r&&(a.height=r)),a}},{list:le}=he,de=Qt.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const i=ue[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ue[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;class ge{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=re.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 _e(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function pe(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function fe(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 me=[];function ye(){return(t,e)=>{me.push(e)}}const ve=[];let we=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ve)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;me.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};_e([fe("imageSmoothingEnabled")],we.prototype,"smooth",void 0),_e([fe("imageSmoothingQuality")],we.prototype,"smoothLevel",void 0),_e([fe("globalAlpha")],we.prototype,"opacity",void 0),_e([fe()],we.prototype,"fillStyle",void 0),_e([fe()],we.prototype,"strokeStyle",void 0),_e([fe("lineWidth")],we.prototype,"strokeWidth",void 0),_e([fe("lineCap")],we.prototype,"strokeCap",void 0),_e([fe("lineJoin")],we.prototype,"strokeJoin",void 0),_e([fe("lineDashOffset")],we.prototype,"dashOffset",void 0),_e([fe()],we.prototype,"miterLimit",void 0),_e([fe()],we.prototype,"shadowBlur",void 0),_e([fe()],we.prototype,"shadowColor",void 0),_e([fe()],we.prototype,"shadowOffsetX",void 0),_e([fe()],we.prototype,"shadowOffsetY",void 0),_e([fe()],we.prototype,"filter",void 0),_e([fe()],we.prototype,"font",void 0),_e([fe()],we.prototype,"fontKerning",void 0),_e([fe()],we.prototype,"fontStretch",void 0),_e([fe()],we.prototype,"fontVariantCaps",void 0),_e([fe()],we.prototype,"textAlign",void 0),_e([fe()],we.prototype,"textBaseline",void 0),_e([fe()],we.prototype,"textRendering",void 0),_e([fe()],we.prototype,"wordSpacing",void 0),_e([fe()],we.prototype,"letterSpacing",void 0),_e([fe()],we.prototype,"direction",void 0),_e([ye()],we.prototype,"setTransform",null),_e([ye()],we.prototype,"resetTransform",null),_e([ye()],we.prototype,"getTransform",null),_e([ye()],we.prototype,"save",null),_e([ye()],we.prototype,"restore",null),_e([ye()],we.prototype,"translate",null),_e([ye()],we.prototype,"scale",null),_e([ye()],we.prototype,"rotate",null),_e([ye()],we.prototype,"fill",null),_e([ye()],we.prototype,"stroke",null),_e([ye()],we.prototype,"clip",null),_e([ye()],we.prototype,"fillRect",null),_e([ye()],we.prototype,"strokeRect",null),_e([ye()],we.prototype,"clearRect",null),_e([ye()],we.prototype,"beginPath",null),_e([ye()],we.prototype,"moveTo",null),_e([ye()],we.prototype,"lineTo",null),_e([ye()],we.prototype,"bezierCurveTo",null),_e([ye()],we.prototype,"quadraticCurveTo",null),_e([ye()],we.prototype,"closePath",null),_e([ye()],we.prototype,"arc",null),_e([ye()],we.prototype,"arcTo",null),_e([ye()],we.prototype,"ellipse",null),_e([ye()],we.prototype,"rect",null),_e([ye()],we.prototype,"roundRect",null),_e([ye()],we.prototype,"createConicGradient",null),_e([ye()],we.prototype,"createLinearGradient",null),_e([ye()],we.prototype,"createPattern",null),_e([ye()],we.prototype,"createRadialGradient",null),_e([ye()],we.prototype,"fillText",null),_e([ye()],we.prototype,"measureText",null),_e([ye()],we.prototype,"strokeText",null);const{copy:xe,multiplyParent:be,pixelScale:ke}=Q,{round:Se}=Math,Ee=new Gt,Be=new Gt,Te={width:1,height:1,pixelRatio:1},Re=["width","height","pixelRatio"];class Ce extends we{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,e){super(),this.size={},this.worldTransform={},t||(t=Te),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:o}=t;this.autoLayout=!i||!s,this.size.pixelRatio=o||y.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;g.copyAttrs(s,t,Re),Re.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&be(t,e,o),ke(t,i,o),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(o.e=Se(o.e-.5)+.5,o.f=Se(o.f-.5)+.5):(o.e=Se(o.e),o.f=Se(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:o,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(o=e.strokeJoin),i(e.dashPattern)||(n=e.dashPattern),i(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=o,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:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),i=Be):i=Ee,this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),this.drawImage(t.view,Ee.x,Ee.y,Ee.width,Ee.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(Ee.x,Ee.y,Ee.width,Ee.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,Ee.x,Ee.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(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ee.x,Ee.y,Ee.width,Ee.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ee.x,Ee.y,Ee.width,Ee.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ee.x,Ee.y,Ee.width,Ee.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ee,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,o=this.manager?this.manager.get(i):re.canvas(Object.assign({},i));return o.save(),t&&(xe(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Pe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=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},Pe),Ae={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},De={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},Me=Object.assign(Object.assign({},De),Pe),Fe=Le,Ie={};for(let t in Fe)Ie[Fe[t]]=t;const We={};for(let t in Fe)We[Fe[t]]=Ae[t];const ze={drawRoundRect(t,e,i,s,o,n){const r=I.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Ye,cos:Xe,hypot:Ne,atan2:He,ceil:Ve,abs:je,PI:Ue,sqrt:Ge,pow:Ke}=Math,{setPoint:qe,addPoint:Ze}=yt,{set:Je,toNumberPoints:Qe}=lt,{M:$e,L:ti,C:ei,Q:ii,Z:si}=Le,oi={},ni={points(t,e,i,s){let o=Qe(e);if(t.push($e,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,g,_,p,f,m=o.length;const y=!0===i?.5:i;s&&(o=[o[m-2],o[m-1],...o,o[0],o[1],o[2],o[3]],m=o.length);for(let i=2;i<m-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],_=Ge(Ke(r-e,2)+Ke(a-n,2)),p=Ge(Ke(h-r,2)+Ke(l-a,2)),(_||p)&&(f=_+p,_=y*_/f,p=y*p/f,h-=e,l-=n,d=r-_*h,c=a-_*l,2===i?s||t.push(ii,d,c,r,a):t.push(ei,u,g,d,c,r,a),u=r+p*h,g=a+p*l);s||t.push(ii,u,g,o[m-2],o[m-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(ti,o[e],o[e+1]);s&&t.push(si)},rect(t,e,i,s,o){Oe.creator.path=t,Oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){Oe.creator.path=[],ze.drawRoundRect(Oe.creator,e,i,s,o,n),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,g=n-s,_=r-o;let p=He(u,c),f=He(_,g);const m=Ne(c,u),y=Ne(g,_);let v=f-p;if(v<0&&(v+=Y),m<1e-12||y<1e-12||v<1e-12||je(v-Ue)<1e-12)return t&&t.push(ti,s,o),h&&(qe(h,e,i),Ze(h,s,o)),d&&Je(d,e,i),void(l&&Je(l,s,o));const w=c*_-g*u<0,x=w?-1:1,b=a/Xe(v/2),k=s+b*Xe(p+v/2+X*x),S=o+b*Ye(p+v/2+X*x);return p-=X*x,f-=X*x,hi(t,k,S,a,a,0,p/z,f/z,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>hi(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*z,g=Ye(u),_=Xe(u);let p=r*z,f=a*z;p>Ue&&(p-=Y),f<0&&(f+=Y);let m=f-p;m<0?m+=Y:m>Y&&(m-=Y),h&&(m-=Y);const y=Ve(je(m/X)),v=m/y,w=Ye(v/4),x=8/3*w*w/Ye(v/2);f=p+v;let b,k,S,E,B,T,R,C,O=Xe(p),P=Ye(p),L=S=_*s*O-g*o*P,A=E=g*s*O+_*o*P,D=e+S,M=i+E;t&&t.push(t.length?ti:$e,D,M),l&&qe(l,D,M),c&&Je(c,D,M);for(let n=0;n<y;n++)b=Xe(f),k=Ye(f),S=_*s*b-g*o*k,E=g*s*b+_*o*k,B=e+L-x*(_*s*P+g*o*O),T=i+A-x*(g*s*P-_*o*O),R=e+S+x*(_*s*k+g*o*b),C=i+E+x*(g*s*k-_*o*b),t&&t.push(ei,B,T,R,C,e+S,i+E),l&&ai(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,O=b,P=k,p=f,f+=v;d&&Je(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(ei,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){ai(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-g/u,0<_&&_<1&&d.push(_)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Ze(h,t,e):qe(h,t,e),Ze(h,r,a);for(let l=0,c=d.length;l<c;l++)ri(d[l],t,e,i,s,o,n,r,a,oi),Ze(h,oi.x,oi.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*n+_*a,l.y=c*i+u*o+g*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return ri(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:ri,toTwoPointBounds:ai,ellipse:hi}=ni,{sin:li,cos:di,sqrt:ci,atan2:ui}=Math,{ellipse:gi}=ni,_i={ellipticalArc(t,e,i,s,o,n,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=n*z,_=li(g),p=di(g),f=-p*c-_*u,m=-p*u+_*c,v=s*s,w=o*o,x=m*m,b=f*f,k=v*w-v*x-w*b;let S=0;if(k<0){const t=ci(1-k/(v*w));s*=t,o*=t}else S=(r===a?-1:1)*ci(k/(v*x+w*b));const E=S*s*m/o,B=-S*o*f/s,T=ui((m-B)/o,(f-E)/s),R=ui((-m-B)/o,(-f-E)/s);let C=R-T;0===a&&C>0?C-=Y:1===a&&C<0&&(C+=Y);const O=e+c+p*E-_*B,P=i+u+_*E+p*B,L=C<0?1:0;d||y.ellipseToCurve?gi(t,O,P,s,o,n,T/z,R/z,L):s!==o||n?t.push(Le.G,O,P,s,o,n,T/z,R/z,L):t.push(Le.O,O,P,s,T/z,R/z,L)}},pi={toCommand:t=>[],toNode:t=>[]},{M:fi,m:mi,L:yi,l:vi,H:wi,h:xi,V:bi,v:ki,C:Si,c:Ei,S:Bi,s:Ti,Q:Ri,q:Ci,T:Oi,t:Pi,A:Li,a:Ai,Z:Di,z:Mi,N:Fi,D:Ii,X:Wi,G:zi,F:Yi,O:Xi,P:Ni,U:Hi}=Le,{rect:Vi,roundRect:ji,arcTo:Ui,arc:Gi,ellipse:Ki,quadraticCurveTo:qi}=ni,{ellipticalArc:Zi}=_i,Ji=Qt.get("PathConvert"),Qi={},$i={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=We[s],a+=s===o?" ":Ie[s];for(let s=1;s<i;s++)a+=I.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?Me:De;for(let e=0,h=t.length;e<h;e++)s=t[e],Zt[s]?("."===s&&(ts.dot&&(es(r,n),n=""),ts.dot++),"0"===n&&"."!==s&&(es(r,n),n=""),n+=s):Le[s]?(n&&(es(r,n),n=""),ts.name=Le[s],ts.length=Ae[s],ts.index=0,es(r,ts.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&es(r,n),n=s):n&&(es(r,n),n=""),o=s;return n&&es(r,n),i?$i.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(o=t[c],o){case mi:t[c+1]+=a,t[c+2]+=h;case fi:a=t[c+1],h=t[c+2],g.push(fi,a,h),c+=3;break;case xi:t[c+1]+=a;case wi:a=t[c+1],g.push(yi,a,h),c+=2;break;case ki:t[c+1]+=h;case bi:h=t[c+1],g.push(yi,a,h),c+=2;break;case vi:t[c+1]+=a,t[c+2]+=h;case yi:a=t[c+1],h=t[c+2],g.push(yi,a,h),c+=3;break;case Ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Bi;case Bi:r=n===Si||n===Bi,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(Si,l,d,i,s,a,h),c+=5;break;case Ei:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=Si;case Si:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Si,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Pi:t[c+1]+=a,t[c+2]+=h,o=Oi;case Oi:r=n===Ri||n===Oi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?qi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ri,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,o=Ri;case Ri:i=t[c+1],s=t[c+2],e?qi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ri,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ai:t[c+6]+=a,t[c+7]+=h;case Li:Zi(g,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 Di:g.push(Di),c++;break;case Fi:a=t[c+1],h=t[c+2],e?Vi(g,a,h,t[c+3],t[c+4]):is(g,t,c,5),c+=5;break;case Ii:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):is(g,t,c,9),c+=9;break;case Wi:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4],t[c+5]):is(g,t,c,6),c+=6;break;case zi:Ki(e?g:is(g,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,Qi),a=Qi.x,h=Qi.y,c+=9;break;case Yi:e?Ki(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):is(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Xi:Gi(e?g:is(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qi),a=Qi.x,h=Qi.y,c+=7;break;case Ni:e?Gi(g,t[c+1],t[c+2],t[c+3],0,360,!1):is(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Hi:Ui(e?g:is(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qi),a=Qi.x,h=Qi.y,c+=6;break;default:return Ji.error(`command: ${o} [index:${c}]`,t),g}n=o}return g},objectToCanvasData(t){if(t[0].name.length>1)return pi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(fi,t.x,t.y);break;case"L":e.push(yi,t.x,t.y);break;case"C":e.push(Si,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ri,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Di)}}),e}},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){ts.index===ts.length&&(ts.index=1,t.push(ts.name)),t.push(Number(e)),ts.index++,ts.dot=0}},{current:ts,pushData:es,copyData:is}=$i,{M:ss,L:os,C:ns,Q:rs,Z:as,N:hs,D:ls,X:ds,G:cs,F:us,O:gs,P:_s,U:ps}=Le,{getMinDistanceFrom:fs,getRadianFrom:ms}=lt,{tan:ys,min:vs,abs:ws}=Math,xs={},bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ss,e,i)},lineTo(t,e,i){t.push(os,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(ns,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(rs,e,i,s,o)},closePath(t){t.push(as)},rect(t,e,i,s,o){t.push(hs,e,i,s,o)},roundRect(t,e,i,s,o,n){if(r(n))t.push(ds,e,i,s,o,n);else{const r=I.fourNumber(n);r?t.push(ls,e,i,s,o,...r):t.push(hs,e,i,s,o)}},ellipse(t,e,i,o,n,r,a,h,l){s(r)?t.push(us,e,i,o,n):(s(a)&&(a=0),s(h)&&(h=360),t.push(cs,e,i,o,n,r,a,h,l?1:0))},arc(t,e,i,o,n,r,a){s(n)?t.push(_s,e,i,o):(s(r)&&(r=360),t.push(gs,e,i,o,n,r,a?1:0))},arcTo(t,e,s,o,n,r,a,h){if(!i(a)){const t=fs(a,h,e,s,o,n);r=vs(r,vs(t/2,t/2*ws(ys(ms(a,h,e,s,o,n)/2))))}t.push(ps,e,s,o,n,r)},drawEllipse(t,e,i,o,n,r,a,h,l){ni.ellipse(null,e,i,o,n,s(r)?0:r,s(a)?0:a,s(h)?360:h,l,null,null,xs),t.push(ss,xs.x,xs.y),ks(t,e,i,o,n,r,a,h,l)},drawArc(t,e,i,o,n,r,a){ni.arc(null,e,i,o,s(n)?0:n,s(r)?360:r,a,null,null,xs),t.push(ss,xs.x,xs.y),Ss(t,e,i,o,n,r,a)},drawPoints(t,e,i,s){ni.points(t,e,i,s)}},{ellipse:ks,arc:Ss}=bs,{moveTo:Es,lineTo:Bs,quadraticCurveTo:Ts,bezierCurveTo:Rs,closePath:Cs,beginPath:Os,rect:Ps,roundRect:Ls,ellipse:As,arc:Ds,arcTo:Ms,drawEllipse:Fs,drawArc:Is,drawPoints:Ws}=bs;class zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Oe.parse(t):t:[],this}beginPath(){return Os(this.__path),this.paint(),this}moveTo(t,e){return Es(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return Rs(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ts(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,o){return Ls(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return As(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return Ds(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return Ms(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return Fs(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return Is(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return Ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ys,L:Xs,C:Ns,Q:Hs,Z:Vs,N:js,D:Us,X:Gs,G:Ks,F:qs,O:Zs,P:Js,U:Qs}=Le,$s=Qt.get("PathDrawer"),to={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Ys:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Xs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Hs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Vs:t.closePath(),s+=1;break;case js:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Us:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*z,e[s+6]*z,e[s+7]*z,e[s+8]),s+=9;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,Y,!1),s+=5;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*z,e[s+5]*z,e[s+6]),s+=7;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],0,Y,!1),s+=4;break;case Qs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void $s.error(`command: ${i} [index:${s}]`,e)}}},{M:eo,L:io,C:so,Q:oo,Z:no,N:ro,D:ao,X:ho,G:lo,F:co,O:uo,P:go,U:_o}=Le,{toTwoPointBounds:po,toTwoPointBoundsByQuadraticCurve:fo,arcTo:mo,arc:yo,ellipse:vo}=ni,{addPointBounds:wo,copy:xo,addPoint:bo,setPoint:ko,addBounds:So,toBounds:Eo}=yt,Bo=Qt.get("PathBounds");let To,Ro,Co;const Oo={},Po={},Lo={},Ao={toBounds(t,e){Ao.toTwoPointBounds(t,Po),Eo(Po,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ko(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===no||r===so||r===oo?ko(e,h,l):ko(e,t[a+1],t[a+2])),r){case eo:case io:h=t[a+1],l=t[a+2],bo(e,h,l),a+=3;break;case so:o=t[a+5],n=t[a+6],po(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Oo),wo(e,Oo),h=o,l=n,a+=7;break;case oo:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],fo(h,l,i,s,o,n,Oo),wo(e,Oo),h=o,l=n,a+=5;break;case no:a+=1;break;case ro:h=t[a+1],l=t[a+2],So(e,h,l,t[a+3],t[a+4]),a+=5;break;case ao:case ho:h=t[a+1],l=t[a+2],So(e,h,l,t[a+3],t[a+4]),a+=r===ao?9:6;break;case lo:vo(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],Oo,Lo),0===a?xo(e,Oo):wo(e,Oo),h=Lo.x,l=Lo.y,a+=9;break;case co:h=t[a+1],l=t[a+2],Ro=t[a+3],Co=t[a+4],So(e,h-Ro,l-Co,2*Ro,2*Co),h+=Ro,a+=5;break;case uo:yo(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Oo,Lo),0===a?xo(e,Oo):wo(e,Oo),h=Lo.x,l=Lo.y,a+=7;break;case go:h=t[a+1],l=t[a+2],To=t[a+3],So(e,h-To,l-To,2*To,2*To),h+=To,a+=4;break;case _o:mo(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Oo,Lo),0===a?xo(e,Oo):wo(e,Oo),h=Lo.x,l=Lo.y,a+=6;break;default:return void Bo.error(`command: ${r} [index:${a}]`,t)}}},{M:Do,L:Mo,Z:Fo}=Le,{getCenterX:Io,getCenterY:Wo}=lt,{arcTo:zo}=bs,Yo={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,_=0;const p=t.length,f=[];for(;r<p;){switch(s=t[r],s){case Do:l=g=t[r+1],d=_=t[r+2],r+=3,t[r]===Mo?(c=t[r+1],u=t[r+2],f.push(Do,Io(l,c),Wo(d,u))):f.push(Do,l,d);break;case Mo:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Mo:zo(f,a,h,t[r+1],t[r+2],e,g,_);break;case Fo:zo(f,a,h,l,d,e,g,_);break;default:f.push(Mo,a,h)}g=a,_=h;break;case Fo:o!==Fo&&(zo(f,l,d,c,u,e,g,_),f.push(Fo)),r+=1;break;default:n=We[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==Fo&&(f[1]=l,f[2]=d),f}};function Xo(t){return new zs(t)}const No=Xo();Oe.creator=Xo(),Oe.parse=$i.parse,Oe.convertToCanvasData=$i.toCanvasData;const{drawRoundRect:Ho}=ze;function Vo(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){Ho(this,t,e,i,s,o)})}(t)}const jo={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=Uo.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{}}}},Uo=jo;Uo.alphaPixelTypes.forEach(t=>Uo.upperCaseTypeMap[t]=t.toUpperCase());const Go=Qt.get("TaskProcessor");class Ko{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return pe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Go.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class qo{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&&g.assign(this.config,t),this.empty()}add(t,e,s){let o,n,a,h;const l=new Ko(t);return l.parent=this,r(e)?h=e:e&&(n=e.parallel,o=e.start,a=e.time,h=e.delay,s||(s=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),s&&(l.canUse=s),i(h)?this.push(l,o):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,o))},h)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let o=s+e.parallel;if(o>i.length&&(o=i.length),e.parallel>1)for(let e=s;e<o&&(t=i[e],t.parallel);e++)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 Zo=Qt.get("Resource"),Jo={tasker:new qo,map:{},get isComplete(){return Qo.tasker.isComplete},set(t,e){Qo.map[t]&&Zo.repeat(t),Qo.map[t]=e},get:t=>Qo.map[t],remove(t){const e=Qo.map[t];e&&(e.destroy&&e.destroy(),delete Qo.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return o(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=re.image(s)),Qo.set(t,e),e},destroy(){Qo.map={}}},Qo=Jo,$o={maxRecycled:10,recycledList:[],patternTasker:new qo,get(t){let e=Jo.get(t.url);return e||Jo.set(t.url,e=re.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||tn.recycledList.push(t)})},clearRecycled(){const t=tn.recycledList;t.length>tn.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Jo.remove(t.url)),t.length=0)},hasAlphaPixel:t=>jo.alphaPixelTypes.some(e=>tn.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:"+jo.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+jo.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){tn.recycledList=[]}},tn=$o,{IMAGE:en,create:sn}=w;class on{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=sn(en),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}$o.isFormat("svg",t)&&(this.isSVG=!0),$o.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Jo.tasker.add(()=>pe(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,i(t)?y.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),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)}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,e,i,s,o,n,r){if(t||(t=this.width),e||(e=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=y.image.resize(this.view,t,e,o,n,void 0,r,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const o=y.canvas.createPattern(t,e);return y.image.setPatternTransform(o,i,s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function nn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function rn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function an(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function hn(t,e){return(i,s)=>dn(i,s,t,e&&e(s))}function ln(t){return t}function dn(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};nn(t,e,Object.assign(o,s||{})),zn(t,e,i)}function cn(t){return hn(t)}function un(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function gn(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function _n(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),vn(this))}}))}function pn(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function fn(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function mn(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i,e)&&vn(this)}}))}function yn(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(vn(this),this.__.__removeNaturalSize())}}))}function vn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function wn(t){return hn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),vn(this)}}))}const xn=mn;function bn(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i)&&(kn(this),e&&(this.__.__useStroke=!0))}}))}function kn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&vn(t)}const Sn=bn;function En(t){return hn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Bn(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Tn(t){return hn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Rn(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&On(this)}}))}function Cn(t){return hn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Pn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Pn(this,t,e,i),this.mask&&On(this)}}))}function On(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Pn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||vn(t))}function Ln(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function An(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Dn(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Mn(t){return hn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Fn(t){return hn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function In(t){return(e,i)=>{nn(e,"__DataProcessor",{get:()=>t})}}function Wn(t){return(e,i)=>{nn(e,"__LayoutProcessor",{get:()=>t})}}function zn(t,e,s){const o=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=an(e,s);if(i(s))a.get=function(){return this[n]};else if("function"==typeof s)a.get=function(){const t=this[n];return null==t?s(this.__leaf):t};else if(d(s)){const t=u(s);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:g.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,c=o;for(;!l&&c;)l=rn(c,e),c=c.__proto__;l&&l.set&&(a.set=l.set),o[r]&&(a.set=o[r],delete o[r]),nn(o,e,a)}const Yn=new Qt("rewrite"),Xn=[],Nn=["destroy","constructor"];function Hn(t){return(e,i)=>{Xn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Vn(){return t=>{jn()}}function jn(t){Xn.length&&(Xn.forEach(e=>{t&&Yn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Xn.length=0)}function Un(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Nn.includes(s)||e&&e.includes(s)))if(t.prototype){rn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Gn(){return t=>{he.register(t)}}function Kn(){return t=>{ce.register(t)}}setTimeout(()=>jn(!0));const{copy:qn,toInnerPoint:Zn,toOuterPoint:Jn,scaleOfOuter:Qn,rotateOfOuter:$n,skewOfOuter:tr,multiplyParent:er,divideParent:ir,getLayout:sr}=Q,or={},{round:nr}=Math,rr={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),lr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)hr(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++)dr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&dr(t),t.__updateChange()},updateAllChange(t){if(ur(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)cr(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,e,i,s,o,n){s||(s=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,o,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,o){const n=d(e)?Object.assign({},e):{x:e,y:i};s?Jn(t.localTransform,n,n,!0):t.parent&&Zn(t.parent.scrollWorldTransform,n,n,!0),ar.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=nr(e),i=nr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){ar.zoomOfLocal(t,gr(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const a=t.__localMatrix;if(r(s)||(s&&(n=s),s=i),qn(or,a),Qn(or,e,i,s),ar.hasHighPosition(t))ar.setTransform(t,or,o,n);else{const e=t.x+or.e-a.e,r=t.y+or.f-a.f;n&&!o?t.animate({x:e,y:r,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=r,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){ar.rotateOfLocal(t,gr(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;qn(or,o),$n(or,e,i),ar.hasHighPosition(t)?ar.setTransform(t,or,!1,s):t.set({x:t.x+or.e-o.e,y:t.y+or.f-o.f,rotation:I.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){ar.skewOfLocal(t,gr(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){qn(or,t.__localMatrix),tr(or,e,i,s),ar.setTransform(t,or,o,n)},transformWorld(t,e,i,s){qn(or,t.worldTransform),er(or,e),t.parent&&ir(or,t.parent.scrollWorldTransform),ar.setTransform(t,or,i,s)},transform(t,e,i,s){qn(or,t.localTransform),er(or,e),ar.setTransform(t,or,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&ar.getInnerOrigin(t,o.origin),r=sr(e,n,o.around&&ar.getInnerOrigin(t,o.around));if(ar.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ar.getInnerOrigin(t,o.origin);lt.move(r,n.x-s.x,n.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Qn(i,ar.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(ar.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return kt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(qn(or,t.worldTransform),ir(or,e.scrollWorldTransform),i?or:Object.assign({},or)),drop(t,e,i,s){t.setTransform(ar.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ar.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,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,o=e.y*i;e.x-=s,e.y-=o,t.move(s,o),y.requestRender(()=>ar.animateMove(t,e,i))}}},ar=rr,{updateAllMatrix:hr,updateMatrix:lr,updateAllWorldOpacity:dr,updateAllChange:cr,updateChange:ur}=ar;function gr(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const _r={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)=>fr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>fr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>fr(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 pr;function fr(t,e){return e||(pr=0),t.__.mask&&(pr=1),pr<0?null:(pr&&(pr=-1),!0)}const{updateBounds:mr}=rr,yr={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),vr(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&i(s[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++)wr(e[t],e)},updateBounds(t,e){const i=[t];wr(t,i),xr(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)mr(s[t]);e&&e===i||mr(i)}}},{pushAllChildBranch:vr,pushAllBranchStack:wr,updateBoundsByBranchStack:xr}=yr,br={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:kr,updateBounds:Sr}=rr,{toOuterOf:Er,getPoints:Br,copy:Tr}=Ht,Rr="_localContentBounds",Cr="_worldContentBounds",Or="_worldBoxBounds",Pr="_worldStrokeBounds";class Lr{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 Er(this.contentBounds,this.leaf.__localMatrix,this[Rr]||(this[Rr]={})),this[Rr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Er(this.contentBounds,this.leaf.__world,this[Cr]||(this[Cr]={})),this[Cr]}get worldBoxBounds(){return Er(this.boxBounds,this.leaf.__world,this[Or]||(this[Or]={})),this[Or]}get worldStrokeBounds(){return Er(this.strokeBounds,this.leaf.__world,this[Pr]||(this[Pr]={})),this[Pr]}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:e}=t;if(t.isApp)return Sr(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,y.layout(i),delete i.__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 Q.defaultMatrix;case"page":t=e.zoomLayer;default:return kr(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 Gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=kr(s,e,!0)}if(r||(r=Q.getLayout(n)),Tr(r,a),lt.copy(r,o),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:s}=this,o=Br(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:n=e}return i(n)||o.forEach(t=>s.innerToWorld(t,null,!1,n)),o}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 Ar{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Dr extends Ar{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Dr.ADD="child.add",Dr.REMOVE="child.remove",Dr.CREATED="created",Dr.MOUNTED="mounted",Dr.UNMOUNTED="unmounted",Dr.DESTROY="destroy";const Mr="property.scroll";class Fr extends Ar{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}Fr.CHANGE="property.change",Fr.LEAFER_CHANGE="property.leafer_change",Fr.SCROLL=Mr;const Ir={scrollX:Mr,scrollY:Mr};class Wr extends Ar{constructor(t,e){super(t),Object.assign(this,e)}}Wr.LOAD="image.load",Wr.LOADED="image.loaded",Wr.ERROR="image.error";class zr extends Ar{static checkHas(t,e,i){"on"===i?e===Hr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Yr)||t.hasEvent(Xr)||t.hasEvent(Nr),t.__hasWorldEvent=t.hasEvent(Hr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Yr,t),"inner"===e&&t.emit(Xr,t)),t.emit(Nr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Hr,this)}}zr.RESIZE="bounds.resize",zr.INNER="bounds.inner",zr.LOCAL="bounds.local",zr.WORLD="bounds.world";const{RESIZE:Yr,INNER:Xr,LOCAL:Nr,WORLD:Hr}=zr,Vr={};[Yr,Xr,Nr,Hr].forEach(t=>Vr[t]=1);class jr extends Ar{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){d(t)?(super(jr.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!i(this.resizingKeys[t.innerId])}}jr.RESIZE="resize";class Ur extends Ar{constructor(t,e){super(t),this.data=e}}Ur.REQUEST="watch.request",Ur.DATA="watch.data";class Gr extends Ar{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Gr.REQUEST="layout.request",Gr.START="layout.start",Gr.BEFORE="layout.before",Gr.LAYOUT="layout",Gr.AFTER="layout.after",Gr.AGAIN="layout.again",Gr.END="layout.end";class Kr extends Ar{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Kr.REQUEST="render.request",Kr.CHILD_START="render.child_start",Kr.CHILD_END="render.child_end",Kr.START="render.start",Kr.BEFORE="render.before",Kr.RENDER="render",Kr.AFTER="render.after",Kr.AGAIN="render.again",Kr.END="render.end",Kr.NEXT="render.next";class qr extends Ar{}qr.START="leafer.start",qr.BEFORE_READY="leafer.before_ready",qr.READY="leafer.ready",qr.AFTER_READY="leafer.after_ready",qr.VIEW_READY="leafer.view_ready",qr.VIEW_COMPLETED="leafer.view_completed",qr.STOP="leafer.stop",qr.RESTART="leafer.restart",qr.END="leafer.end",qr.UPDATE_MODE="leafer.update_mode",qr.TRANSFORM="leafer.transform",qr.MOVE="leafer.move",qr.SCALE="leafer.scale",qr.ROTATE="leafer.rotate",qr.SKEW="leafer.skew";const{MOVE:Zr,SCALE:Jr,ROTATE:Qr,SKEW:$r}=qr,ta={x:Zr,y:Zr,scaleX:Jr,scaleY:Jr,rotation:Qr,skewX:$r,skewY:$r},ea={};class ia{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(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 a=sa(this,s,!0),h=o(t)?t.split(" "):t,d=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(d):a[t]=[d],Vr[t]&&zr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=sa(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],Vr[t]&&zr.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):l(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=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(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 l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ce.has(t)&&(e=ce.get(t,{type:t,target:this,current:this}));const s=sa(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:o}=this,n=s&&s[t],r=o&&o[t];return!!(i(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function sa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ea)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ea)}}const{on:oa,on_:na,off:ra,off_:aa,once:ha,emit:la,emitEvent:da,hasEvent:ca,destroy:ua}=ia.prototype,ga={on:oa,on_:na,off:ra,off_:aa,once:ha,emit:la,emitEvent:da,hasEvent:ca,destroyEventer:ua},_a=Qt.get("setAttr"),pa={__setAttr(t,e,s){if(this.leaferIsCreated){const o=this.__.__getInput(t);if(!s||n(e)||i(e)||(_a.warn(this.innerName,t,e),e=void 0),d(e)||o!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Fr(Fr.LEAFER_CHANGE,this,t,o,e));const i=ta[t];i&&(this.emitEvent(new qr(i,this)),this.emitEvent(new qr(qr.TRANSFORM,this)))}this.emitPropertyEvent(Fr.CHANGE,t,o,e);const i=Ir[t];return i&&this.emitPropertyEvent(i,t,o,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new Fr(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||i(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:fa,multiplyParent:ma,translateInner:ya,defaultWorld:va}=Q,{toPoint:wa,tempPoint:xa}=kt,ba={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;ma(this.__local||e,t?t.__scrollWorld||t.__world:va,i,!!e.affectScaleOrRotation,o),s&&ya(Object.assign(s,i),o.scrollX,o.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(fa(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)&&(wa(i.around||i.origin,t.boxBounds,xa),ya(e,-xa.x,-xa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ka,updateAllMatrix:Sa}=rr,{updateBounds:Ea}=yr,{toOuterOf:Ba,copyAndSpread:Ta,copy:Ra}=Ht,{toBounds:Ca}=Ao,Oa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ba(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&zr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&zr.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(),Ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Ca(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),Sa(this),Ea(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Sa(this),Ea(this,this))):ka(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ta(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;r(i)&&i<=0?Ra(e.renderBounds,e.strokeBounds):Ta(e.renderBounds,e.boxBounds,i)}},Pa={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),rr.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.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:La}=_r,Aa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)La(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)La(i[s],e)||i[s].__clip(t,e)}}},Da={},{LEAF:Ma,create:Fa}=w,{stintSet:Ia}=g,{toInnerPoint:Wa,toOuterPoint:za,multiplyParent:Ya}=Q,{toOuterOf:Xa}=Ht,{copy:Na,move:Ha}=lt,{moveLocal:Va,zoomOfLocal:ja,rotateOfLocal:Ua,skewOfLocal:Ga,moveWorld:Ka,zoomOfWorld:qa,rotateOfWorld:Za,skewOfWorld:Ja,transform:Qa,transformWorld:$a,setTransform:th,getFlipTransform:eh,getLocalOrigin:ih,getRelativeWorld:sh,drop:oh}=rr;let nh=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 p}get __LayoutProcessor(){return Lr}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=Fa(Ma),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Dr.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(Dr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Dr.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(Dr.MOUNTED)):this.__emitLifeEvent(Dr.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){i(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=i(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 Ya(i,t.matrix,e,void 0,i),Xa(this.__layout.renderBounds,e,e),Ia(e,"half",i.half),Ia(e,"ignorePixelSnap",i.ignorePixelSnap),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}=$o.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),Da.scaleX=i,Da.scaleY=s,Da}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?sh(this,e):this.worldTransform,o=i?t:{};return Xa(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Na(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Na(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Wa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){za(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ha(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Ha(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){th(this,t,e,i)}transform(t,e,i){Qa(this,t,e,i)}move(t,e,i){Va(this,t,e,i)}moveInner(t,e,i){Ka(this,t,e,!0,i)}scaleOf(t,e,i,s,o){ja(this,ih(this,t),e,i,s,o)}rotateOf(t,e,i){Ua(this,ih(this,t),e,i)}skewOf(t,e,i,s,o){Ga(this,ih(this,t),e,i,s,o)}transformWorld(t,e,i){$a(this,t,e,i)}moveWorld(t,e,i){Ka(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){qa(this,t,e,i,s,o)}rotateOfWorld(t,e){Za(this,t,e)}skewOfWorld(t,e,i,s,o){Ja(this,t,e,i,s,o)}flip(t,e){Qa(this,eh(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 ne.need("path")}getMotionPoint(t){return ne.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){oh(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):zn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=mn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Dr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Dr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};nh=_e([Un(pa),Un(ba),Un(Oa),Un(ga),Un(Pa)],nh);const{setListWithFn:rh}=Ht,{sort:ah}=yr,{localBoxBounds:hh,localStrokeBounds:lh,localRenderBounds:dh,maskLocalBoxBounds:ch,maskLocalStrokeBounds:uh,maskLocalRenderBounds:gh}=_r,_h=new Qt("Branch");let ph=class extends nh{__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){rh(e||this.__layout.boxBounds,this.children,this.__hasMask?ch:hh)}__updateStrokeBounds(t){rh(t||this.__layout.strokeBounds,this.children,this.__hasMask?uh:lh)}__updateRenderBounds(t){rh(t||this.__layout.renderBounds,this.children,this.__hasMask?gh:dh)}__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(ah),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return _h.warn("add self or destroyed");const s=i(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),s||e++});t=he.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const o=t.__layout;o.boxChanged||o.boxChange(),o.matrixChanged||o.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Dr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Dr.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)):i(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(Dr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Dr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Dr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};ph=_e([Un(Aa)],ph);class fh{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!i(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return i(e)?-1:e}add(t){const{list:e,keys:s}=this;i(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(i(s[t.innerId])){const{list:i}=this;for(let t=e,o=i.length;t<o;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let o=0,n=e.length;o<n;o++)i(s)?e[o].innerId===t.innerId&&(s=o,delete this.keys[t.innerId]):this.keys[e[o].innerId]=o-1;i(s)||e.splice(s,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 fh;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 mh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!i(this.keys[t.innerId])}without(t){return i(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const yh="1.11.0";class vh extends Ce{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(o(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=y.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&y.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:i,pixelRatio:s}=this.config,o={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(o),this.context&&(this.viewSelect&&(y.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,r(o)?[o]:o)}),Vo(this.context.__proto__))}__createView(){this.view=y.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&y.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),y.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,y.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};g.copyAttrs(e,this,Re),this.resize(t),i(this.width)||this.resizeListener(new jr(t,e))}}const{mineType:wh,fileType:xh}=jo;function bh(t,e){y.origin={createCanvas:(t,i,s)=>{const o={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(o):e.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(wh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>{let s=t.toDataURL(wh(xh(e)),i);return s=s.substring(s.indexOf("64,")+3),y.origin.download(s,e)},download:(t,i)=>new Promise((s,o)=>{let n;i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,n=!0);const r=e.getFileSystemManager();r.writeFile({filePath:i,data:t,encoding:"base64",success(){n?y.miniapp.saveToAlbum(i).then(()=>{r.unlink({filePath:i}),s()}):s()},fail(t){o(t)}})}),loadImage:t=>new Promise((e,i)=>{const s=y.canvas.view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=y.image.getRealURL(t)}),noRepeat:"repeat-x"},y.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},y.event={stopDefault(t){},stopNow(t){},stop(t){}},y.canvas=re.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(re,{canvas:(t,e)=>new vh(t,e),image:t=>new on(t)}),y.name="miniapp",y.requestRender=function(t){const{view:e}=y.renderCanvas||y.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},nn(y,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class kh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new fh;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 fh,this.target=t,e&&(this.config=g.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(Kr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Dr.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 Ur(Ur.DATA,{updatedList:this.updatedList})),this.__updatedList=new fh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Fr.CHANGE,this.__onAttrChange,this],[[Dr.ADD,Dr.REMOVE],this.__onChildEvent,this],[Ur.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:Eh,updateChange:Bh}=rr,{pushAllChildBranch:Th,pushAllParent:Rh}=yr;const{worldBounds:Ch}=_r;class Oh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,l(t)&&(t=new fh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ch)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ch),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Ph,updateAllChange:Lh}=rr,Ah=Qt.get("Layouter");class Dh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new mh,this.target=t,e&&(this.config=g.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(Gr.START),this.layoutOnce(),t.emitEvent(new Gr(Gr.END,this.layoutedBlocks,this.times))}catch(t){Ah.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Ah.warn("layouting"):this.times>3?Ah.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ur.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=ie.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=Gr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Gr(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Sh(t,!0),e.add(t),t.isBranch&&Th(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(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Eh(s[t])}Eh(i)}})}(this.__levelList),function(t){t.list.forEach(Bh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Gr(n,a,this.times)),i.emitEvent(new Gr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ie.end(e)}fullLayout(){const t=ie.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=Gr,n=this.getBlocks(new fh(e));e.emitEvent(new Gr(i,n,this.times)),Dh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Gr(s,n,this.times)),e.emitEvent(new Gr(o,n,this.times)),this.addBlocks(n),ie.end(t)}static fullLayout(t){Ph(t,!0),t.isBranch?yr.updateBounds(t):rr.updateBounds(t),Lh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Oh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Oh(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_([[Gr.REQUEST,this.layout,this],[Gr.AGAIN,this.layoutAgain,this],[Ur.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Mh=Qt.get("Renderer");class Fh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.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(Gr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Kr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Kr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Kr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Mh.log(e.innerName,"---\x3e");try{this.emitRender(Kr.START),this.renderOnce(t),this.emitRender(Kr.END,this.totalBounds),$o.clearRecycled()}catch(t){this.rendering=!1,Mh.error(t)}Mh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Mh.warn("rendering");if(this.times>3)return Mh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Kr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Kr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Kr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Kr.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=ie.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new Gt(s);i.save(),s.spread(Fh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),i.restore(),ie.end(e)}fullRender(){const t=ie.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ie.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),o=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),y.render(this.target,i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;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);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return y.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(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 Gt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Mh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Kr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Kr.REQUEST,this.update,this],[Gr.END,this.__onLayoutEnd,this],[Kr.AGAIN,this.renderAgain,this],[jr.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Fh.clipSpread=10;const{hitRadiusPoint:Ih}=Ht;class Wh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new fh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o,!!i.findList),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const o=this.findList=new fh;if(t.length){let e;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||rr.worldHittable(e))&&(this.hitChild(e,r),o.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&rr.hasParent(t,e))){o.reset();break}return o.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),o.length)return o.list[0];return s?null:i?t[0]:t.find(t=>rr.worldHittable(t))}getPath(t){const e=new fh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new fh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new fh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Ih(i.__world,o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(o))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else s&&this.hitChild(i,o)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class zh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Wh(this.target=t,this),this.finder=re.finder&&re.finder()}getByPoint(t,e,i){const{target:s,picker:o}=this;return y.backgrounder&&s&&s.updateLayout(),o.getByPoint(t,e,i)}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):ne.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Yh(t){return hn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Xh(t){return hn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Nh(){return(t,e)=>{const i="_"+e;nn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Hh(t){return(e,i)=>{nn(e,i,an(i,t))}}Object.assign(re,{watcher:(t,e)=>new kh(t,e),layouter:(t,e)=>new Dh(t,e),renderer:(t,e,i)=>new Fh(t,e,i),selector:(t,e)=>new zh(t,e)}),y.layout=Dh.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new fh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Vh={},jh={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}},Uh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Gh={},Kh={},qh={},Zh={},Jh={},Qh={apply(){ne.need("filter")}},$h={},tl={setStyleName:()=>ne.need("state"),set:()=>ne.need("state")},el={list:{},register(t,e){el.list[t]=e},get:t=>el.list[t]},{parse:il,objectToCanvasData:sl}=$i,{stintSet:ol}=g,{hasTransparent:nl}=jh,rl={originPaint:{}},al=Qt.get("UIData");class hl extends p{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,al.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,al.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(ol(this,"__isTransparentFill",nl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(ol(this,"__isTransparentStroke",nl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?il(t):sl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){ll(this,"shadow",t)}setInnerShadow(t){ll(this,"innerShadow",t)}setFilter(t){ll(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:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),i(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){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(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=rl)):(this.__isStrokes=!0,this._stroke||(this._stroke=rl))}__removePaint(t,e){e&&this.__removeInput(t),qh.recycleImage(t,this),"fill"===t?(ol(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ol(this,"__isAlphaPixelStroke",void 0),ol(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function ll(t,e,i){t.__setInput(e,i),l(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 dl extends hl{}class cl extends dl{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 ul extends dl{__getInputData(t,e){const i=super.__getInputData(t,e);return Re.forEach(t=>delete i[t]),i}}class gl extends cl{}class _l extends hl{get __usePathBox(){return this.points||this.__pathInputed}}class pl extends hl{get __boxStroke(){return!this.__pathInputed}}class fl extends hl{get __boxStroke(){return!this.__pathInputed}}class ml extends _l{}class yl extends hl{}class vl extends hl{get __pathInputed(){return 2}}class wl extends dl{}const xl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class bl extends hl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=xl[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=he.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class kl extends pl{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 t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class Sl extends pl{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{max:El,add:Bl}=T,Tl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=El(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Jh.getShadowRenderSpread(this,e)),s&&(t=El(t,s)),n&&(t=Bl(t,Qh.getSpread(n))),r&&(t=Bl(t,r)),a&&(t=Bl(t,a));let l=t;return i&&(l=El(l,Jh.getInnerShadowSpread(this,i))),o&&(l=El(l,o)),this.__layout.renderShapeSpread=l,h?El(h.__updateRenderSpread(),t):t}},{stintSet:Rl}=g,Cl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Rl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Rl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Rl(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Jh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Rl(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:o,stroke:n,__drawAfterFill:r,__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&&Jh.shadow(this,t,h),a&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),o&&(s.__isFills?Kh.fills(o,this,t,e):Kh.fill(o,this,t,e)),r&&this.__drawAfterFill(t,e),d&&Jh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),c&&Qh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,jh.string(e.color))}o&&(s.__isFills?Kh.fills(o,this,t,e):Kh.fill(o,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?Kh.strokes(n,this,t,e):Kh.stroke(n,this,t,e))}}else s.__pathInputed?Ol(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Kh.fills(s,this,t,e):Kh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Kh.strokes(o,this,t,e):Kh.stroke("#000000",this,t,e))},__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:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&Kh.stroke(o,t,e,i),s&&Kh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),o&&!r&&Kh.stroke(o,t,e,i)}const Pl={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var Ll;let Al=Ll=class extends nh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){I.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 No.set(this.path=t||[]),t||this.__drawPathByBox(No),No}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return ne.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ne.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(No.set(i=[]),this.__drawPathByBox(No)),t?$i.toCanvasData(i,!0):i}getPathString(t,e,i){return $i.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||$h.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Yo.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Gh.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?to.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,r(n)?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e,i){Kh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ne.need("animate")}killAnimate(t,e){}export(t,e){return ne.need("export")}syncExport(t,e){return ne.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Ll.one(e)}static one(t,e,i,s,o){return he.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){Gn()(this)}static registerData(t){In(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};_e([In(hl)],Al.prototype,"__",void 0),_e([Nh()],Al.prototype,"zoomLayer",void 0),_e([cn("")],Al.prototype,"id",void 0),_e([cn("")],Al.prototype,"name",void 0),_e([cn("")],Al.prototype,"className",void 0),_e([Bn("pass-through")],Al.prototype,"blendMode",void 0),_e([Rn(1)],Al.prototype,"opacity",void 0),_e([Cn(!0)],Al.prototype,"visible",void 0),_e([Bn(!1)],Al.prototype,"locked",void 0),_e([Tn(!1)],Al.prototype,"dim",void 0),_e([Tn(!1)],Al.prototype,"dimskip",void 0),_e([Ln(0)],Al.prototype,"zIndex",void 0),_e([An(!1)],Al.prototype,"mask",void 0),_e([Dn(!1)],Al.prototype,"eraser",void 0),_e([un(0,!0)],Al.prototype,"x",void 0),_e([un(0,!0)],Al.prototype,"y",void 0),_e([mn(100,!0)],Al.prototype,"width",void 0),_e([mn(100,!0)],Al.prototype,"height",void 0),_e([pn(1,!0)],Al.prototype,"scaleX",void 0),_e([pn(1,!0)],Al.prototype,"scaleY",void 0),_e([fn(0,!0)],Al.prototype,"rotation",void 0),_e([fn(0,!0)],Al.prototype,"skewX",void 0),_e([fn(0,!0)],Al.prototype,"skewY",void 0),_e([un(0,!0)],Al.prototype,"offsetX",void 0),_e([un(0,!0)],Al.prototype,"offsetY",void 0),_e([gn(0,!0)],Al.prototype,"scrollX",void 0),_e([gn(0,!0)],Al.prototype,"scrollY",void 0),_e([_n()],Al.prototype,"origin",void 0),_e([_n()],Al.prototype,"around",void 0),_e([cn(!1)],Al.prototype,"lazy",void 0),_e([yn(1)],Al.prototype,"pixelRatio",void 0),_e([En(0)],Al.prototype,"renderSpread",void 0),_e([wn()],Al.prototype,"path",void 0),_e([xn()],Al.prototype,"windingRule",void 0),_e([xn(!0)],Al.prototype,"closed",void 0),_e([mn(0)],Al.prototype,"padding",void 0),_e([mn(!1)],Al.prototype,"lockRatio",void 0),_e([mn()],Al.prototype,"widthRange",void 0),_e([mn()],Al.prototype,"heightRange",void 0),_e([cn(!1)],Al.prototype,"draggable",void 0),_e([cn()],Al.prototype,"dragBounds",void 0),_e([cn("auto")],Al.prototype,"dragBoundsType",void 0),_e([cn(!1)],Al.prototype,"editable",void 0),_e([Mn(!0)],Al.prototype,"hittable",void 0),_e([Mn("path")],Al.prototype,"hitFill",void 0),_e([Sn("path")],Al.prototype,"hitStroke",void 0),_e([Mn(!1)],Al.prototype,"hitBox",void 0),_e([Mn(!0)],Al.prototype,"hitChildren",void 0),_e([Mn(!0)],Al.prototype,"hitSelf",void 0),_e([Mn()],Al.prototype,"hitRadius",void 0),_e([Fn("")],Al.prototype,"cursor",void 0),_e([Bn()],Al.prototype,"fill",void 0),_e([Sn(void 0,!0)],Al.prototype,"stroke",void 0),_e([Sn("inside")],Al.prototype,"strokeAlign",void 0),_e([Sn(1,!0)],Al.prototype,"strokeWidth",void 0),_e([Sn(!1)],Al.prototype,"strokeWidthFixed",void 0),_e([Sn("none")],Al.prototype,"strokeCap",void 0),_e([Sn("miter")],Al.prototype,"strokeJoin",void 0),_e([Sn()],Al.prototype,"dashPattern",void 0),_e([Sn(0)],Al.prototype,"dashOffset",void 0),_e([Sn(10)],Al.prototype,"miterLimit",void 0),_e([xn(0)],Al.prototype,"cornerRadius",void 0),_e([xn()],Al.prototype,"cornerSmoothing",void 0),_e([Yh()],Al.prototype,"shadow",void 0),_e([Yh()],Al.prototype,"innerShadow",void 0),_e([Yh()],Al.prototype,"blur",void 0),_e([Yh()],Al.prototype,"backgroundBlur",void 0),_e([Yh()],Al.prototype,"grayscale",void 0),_e([Yh()],Al.prototype,"filter",void 0),_e([Bn()],Al.prototype,"placeholderColor",void 0),_e([cn(100)],Al.prototype,"placeholderDelay",void 0),_e([cn({})],Al.prototype,"data",void 0),_e([Hn(nh.prototype.reset)],Al.prototype,"reset",null),Al=Ll=_e([Un(Tl),Un(Cl),Vn()],Al);let Dl=class extends Al{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Ml;_e([In(dl)],Dl.prototype,"__",void 0),_e([mn(0)],Dl.prototype,"width",void 0),_e([mn(0)],Dl.prototype,"height",void 0),Dl=_e([Un(ph),Gn()],Dl);const Fl=Qt.get("Leafer");let Il=Ml=class extends Dl{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Jo.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ml.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,g.assign(s,t));const o=this.canvas=re.canvas(s);this.__controllers.push(this.renderer=re.renderer(this,o,s),this.watcher=re.watcher(this,s),this.layouter=re.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=re.selector(this),this.interaction=re.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=re.hitCanvasManager()),this.canvasManager=new ge,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),br.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(qr.RESTART):this.emitLeafer(qr.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(qr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,Re);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(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=g.copyAttrs({},this.canvas,Re);e.resize(t),this.updateLazyBounds(),this.__onResize(new jr(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,Re),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 qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Re.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(qr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Re.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=g.copyAttrs({},s,Re);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(qr.BEFORE_READY),this.emitLeafer(qr.READY),this.emitLeafer(qr.AFTER_READY),br.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(qr.VIEW_READY),br.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){br.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(qr.VIEW_COMPLETED),br.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 ne.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 qr(t,this))}__listenEvents(){const t=ie.start("FirstCreate "+this.innerName);this.once([[qr.START,()=>ie.end(t)],[Gr.START,this.updateLazyBounds,this],[Kr.START,this.__onCreated,this],[Kr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ur.DATA,this.__onWatchData,this],[Gr.END,this.__onLayoutEnd,this],[Kr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ml.list.remove(this);try{this.stop(),this.emitLeafer(qr.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(()=>{$o.clearRecycled()},100)}catch(t){Fl.error(t)}}};t?e():setTimeout(e)}};Il.list=new fh,_e([In(ul)],Il.prototype,"__",void 0),_e([mn()],Il.prototype,"pixelRatio",void 0),_e([cn("normal")],Il.prototype,"mode",void 0),Il=Ml=_e([Gn()],Il);let Wl=class extends Al{get __tag(){return"Rect"}};_e([In(pl)],Wl.prototype,"__",void 0),Wl=_e([Un(Pl),Vn(),Gn()],Wl);const{add:zl,includes:Yl,scroll:Xl}=Ht,Nl=Wl.prototype,Hl=Dl.prototype;let Vl=class extends Dl{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:n}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(zl(a,n),Xl(a,i)),this.__updateRectRenderBounds(),t=!Yl(n,a),t&&"show"===r&&zl(o,a)}else this.__updateRectRenderBounds();g.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))}};_e([In(cl)],Vl.prototype,"__",void 0),_e([mn(100)],Vl.prototype,"width",void 0),_e([mn(100)],Vl.prototype,"height",void 0),_e([cn(!1)],Vl.prototype,"resizeChildren",void 0),_e([En("show")],Vl.prototype,"overflow",void 0),_e([Hn(Nl.__updateStrokeSpread)],Vl.prototype,"__updateStrokeSpread",null),_e([Hn(Nl.__updateRenderSpread)],Vl.prototype,"__updateRectRenderSpread",null),_e([Hn(Nl.__updateBoxBounds)],Vl.prototype,"__updateRectBoxBounds",null),_e([Hn(Nl.__updateStrokeBounds)],Vl.prototype,"__updateStrokeBounds",null),_e([Hn(Nl.__updateRenderBounds)],Vl.prototype,"__updateRectRenderBounds",null),_e([Hn(Nl.__updateChange)],Vl.prototype,"__updateRectChange",null),_e([Hn(Nl.__render)],Vl.prototype,"__renderRect",null),_e([Hn(Hl.__render)],Vl.prototype,"__renderGroup",null),Vl=_e([Vn(),Gn()],Vl);let jl=class extends Vl{get __tag(){return"Frame"}get isFrame(){return!0}};_e([In(gl)],jl.prototype,"__",void 0),_e([Bn("#FFFFFF")],jl.prototype,"fill",void 0),_e([En("hide")],jl.prototype,"overflow",void 0),jl=_e([Gn()],jl);const{moveTo:Ul,closePath:Gl,ellipse:Kl}=bs;let ql=class extends Al{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,n=t/2,r=e/2,a=this.__.path=[];i?(s||o?(i<1&&Kl(a,n,r,n*i,r*i,0,s,o,!1),Kl(a,n,r,n,r,0,o,s,!0),i<1&&Gl(a)):(i<1&&(Kl(a,n,r,n*i,r*i),Ul(a,t,r)),Kl(a,n,r,n,r,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(Ul(a,n,r),Kl(a,n,r,n,r,0,s,o,!1),Gl(a)):Kl(a,n,r,n,r)}};_e([In(fl)],ql.prototype,"__",void 0),_e([xn(0)],ql.prototype,"innerRadius",void 0),_e([xn(0)],ql.prototype,"startAngle",void 0),_e([xn(0)],ql.prototype,"endAngle",void 0),ql=_e([Gn()],ql);const{sin:Zl,cos:Jl,PI:Ql}=Math,{moveTo:$l,lineTo:td,closePath:ed,drawPoints:id}=bs;let sd=class extends Al{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)id(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,n=i/2,r=s/2;$l(e,n,0);for(let t=1;t<o;t++)td(e,n+n*Zl(2*t*Ql/o),r-r*Jl(2*t*Ql/o));ed(e)}}};_e([In(ml)],sd.prototype,"__",void 0),_e([xn(3)],sd.prototype,"sides",void 0),_e([xn()],sd.prototype,"points",void 0),_e([xn(0)],sd.prototype,"curve",void 0),sd=_e([Vn(),Gn()],sd);const{sin:od,cos:nd,PI:rd}=Math,{moveTo:ad,lineTo:hd,closePath:ld}=bs;let dd=class extends Al{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];ad(r,o,0);for(let t=1;t<2*i;t++)hd(r,o+(t%2==0?o:o*s)*od(t*rd/i),n-(t%2==0?n:n*s)*nd(t*rd/i));ld(r)}};_e([In(yl)],dd.prototype,"__",void 0),_e([xn(5)],dd.prototype,"corners",void 0),_e([xn(.382)],dd.prototype,"innerRadius",void 0),dd=_e([Gn()],dd);const{moveTo:cd,lineTo:ud,drawPoints:gd}=bs,{rotate:_d,getAngle:pd,getDistance:fd,defaultPoint:md}=lt;let yd=class extends Al{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&_d(i,e),i}set toPoint(t){this.width=fd(md,t),this.rotation=pd(md,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?gd(e,t.points,t.curve,t.closed):(cd(e,0,0),ud(e,this.width,0))}};_e([In(_l)],yd.prototype,"__",void 0),_e([bn("center")],yd.prototype,"strokeAlign",void 0),_e([mn(0)],yd.prototype,"height",void 0),_e([xn()],yd.prototype,"points",void 0),_e([xn(0)],yd.prototype,"curve",void 0),_e([xn(!1)],yd.prototype,"closed",void 0),yd=_e([Gn()],yd);let vd=class extends Wl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}};_e([In(kl)],vd.prototype,"__",void 0),_e([mn("")],vd.prototype,"url",void 0),vd=_e([Gn()],vd);const wd=vd;let xd=class extends Wl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=re.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new on({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Wr(Wr.LOADED,{image:t}))})}draw(t,e,i,s){const o=new ft(t.worldTransform).invert(),n=new ft;e&&n.translate(e.x,e.y),i&&(r(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};_e([In(Sl)],xd.prototype,"__",void 0),_e([Xh(100)],xd.prototype,"width",void 0),_e([Xh(100)],xd.prototype,"height",void 0),_e([Xh(1)],xd.prototype,"pixelRatio",void 0),_e([Xh(!0)],xd.prototype,"smooth",void 0),_e([cn(!1)],xd.prototype,"safeResize",void 0),_e([Xh()],xd.prototype,"contextSettings",void 0),xd=_e([Gn()],xd);const{copyAndSpread:bd,includes:kd,spread:Sd,setList:Ed}=Ht,{stintSet:Bd}=g;let Td=class extends Al{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Uh.number(e,o),t.__letterSpacing=Uh.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||12}px ${s||"caption"}`,Bd(t,"__padding",l&&I.fourNumber(l)),Bd(t,"__clipText","show"!==h&&!t.__autoSize),Bd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Vh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Sd(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!kd(h,a)),this.isOverflow?(Ed(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;bd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};_e([In(bl)],Td.prototype,"__",void 0),_e([mn(0)],Td.prototype,"width",void 0),_e([mn(0)],Td.prototype,"height",void 0),_e([Bn()],Td.prototype,"boxStyle",void 0),_e([cn(!1)],Td.prototype,"resizeFontSize",void 0),_e([Bn("#000000")],Td.prototype,"fill",void 0),_e([bn("outside")],Td.prototype,"strokeAlign",void 0),_e([Mn("all")],Td.prototype,"hitFill",void 0),_e([mn("")],Td.prototype,"text",void 0),_e([mn("")],Td.prototype,"placeholder",void 0),_e([mn("caption")],Td.prototype,"fontFamily",void 0),_e([mn(12)],Td.prototype,"fontSize",void 0),_e([mn("normal")],Td.prototype,"fontWeight",void 0),_e([mn(!1)],Td.prototype,"italic",void 0),_e([mn("none")],Td.prototype,"textCase",void 0),_e([mn("none")],Td.prototype,"textDecoration",void 0),_e([mn(0)],Td.prototype,"letterSpacing",void 0),_e([mn({type:"percent",value:1.5})],Td.prototype,"lineHeight",void 0),_e([mn(0)],Td.prototype,"paraIndent",void 0),_e([mn(0)],Td.prototype,"paraSpacing",void 0),_e([mn("x")],Td.prototype,"writingMode",void 0),_e([mn("left")],Td.prototype,"textAlign",void 0),_e([mn("top")],Td.prototype,"verticalAlign",void 0),_e([mn(!0)],Td.prototype,"autoSizeAlign",void 0),_e([mn("normal")],Td.prototype,"textWrap",void 0),_e([mn("show")],Td.prototype,"textOverflow",void 0),_e([Bn(!1)],Td.prototype,"textEditing",void 0),Td=_e([Gn()],Td);let Rd=class extends Al{get __tag(){return"Path"}};_e([In(vl)],Rd.prototype,"__",void 0),_e([bn("center")],Rd.prototype,"strokeAlign",void 0),Rd=_e([Gn()],Rd);let Cd=class extends Dl{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Rd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};_e([In(wl)],Cd.prototype,"__",void 0),_e([(t,e)=>{nn(t,e,{get(){return this.__path}})}],Cd.prototype,"path",void 0),Cd=_e([Un(zs,["set","path","paint"]),Gn()],Cd);let Od=class extends Il{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&re.editor(o,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Il(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),i(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&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,Re),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Gr.END,this.__onReady,this],[Kr.START,this.__onCreated,this],[Kr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Kr.END,this.__onChildRenderEnd,this))}};Od=_e([Gn()],Od);const Pd={},Ld={isHoldSpaceKey:()=>Ld.isHold("Space"),isHold:t=>Pd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Pd[t]||(Pd[t]=!0)},setUpCode(t){Pd[t]=!1}},Ad={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 Dd extends Ar{get spaceKey(){return Ld.isHoldSpaceKey()}get left(){return Ad.left(this)}get right(){return Ad.right(this)}get middle(){return Ad.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Ld.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){ce.changeName(t,e)}}const{min:Md,max:Fd,abs:Id}=Math,{float:Wd,sign:zd}=I,{minX:Yd,maxX:Xd,minY:Nd,maxY:Hd}=Ht,Vd=new Gt,jd=new Gt,Ud={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Gd.getValidMove(t.__localBoxBounds,Gd.getDragBounds(t),s,e,!0),Gd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:o,dragBoundsType:n}=t;o&&Gd.getValidScaleOf(t.__localBoxBounds,Gd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),Gd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),Gd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=Wd(s.x),s.y=Wd(s.y),s},getValidScaleOf(t,e,i,s,o,r,a){a||(o=Object.assign({},o)),jd.set(e),Vd.set(t).scaleOf(s,o.x,o.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,g,_,p,f=1,m=1;return Gd.isInnerMode(t,e,i,"width")?(o.x<0&&Vd.scaleOf(s,f=1/o.x,1),_=Wd(Vd.minX-jd.minX),p=Wd(jd.maxX-Vd.maxX),u=h&&_>0?1+_/(h*Vd.width):1,g=l&&p>0?1+p/(l*Vd.width):1,f*=Fd(u,g)):(o.x<0&&((Wd(Yd(t)-Yd(e))<=0||Wd(Xd(e)-Xd(t))<=0)&&Vd.scaleOf(s,f=1/o.x,1),Vd.unsign()),_=Wd(jd.minX-Vd.minX),p=Wd(Vd.maxX-jd.maxX),u=h&&_>0?1-_/(h*Vd.width):1,g=l&&p>0?1-p/(l*Vd.width):1,f*=Md(u,g)),Gd.isInnerMode(t,e,i,"height")?(o.y<0&&Vd.scaleOf(s,1,m=1/o.y),_=Wd(Vd.minY-jd.minY),p=Wd(jd.maxY-Vd.maxY),u=d&&_>0?1+_/(d*Vd.height):1,g=c&&p>0?1+p/(c*Vd.height):1,m*=Fd(u,g),r&&(u=Fd(Id(f),Id(m)),f=zd(f)*u,m=zd(m)*u)):(o.y<0&&((Wd(Nd(t)-Nd(e))<=0||Wd(Hd(e)-Hd(t))<=0)&&Vd.scaleOf(s,1,m=1/o.y),Vd.unsign()),_=Wd(jd.minY-Vd.minY),p=Wd(Vd.maxY-jd.maxY),u=d&&_>0?1-_/(d*Vd.height):1,g=c&&p>0?1-p/(c*Vd.height):1,m*=Md(u,g)),o.x*=n(f)?f:1,o.y*=n(m)?m:1,o}},Gd=Ud;let Kd=class extends Dd{};Kd.POINTER="pointer",Kd.BEFORE_DOWN="pointer.before_down",Kd.BEFORE_MOVE="pointer.before_move",Kd.BEFORE_UP="pointer.before_up",Kd.DOWN="pointer.down",Kd.MOVE="pointer.move",Kd.UP="pointer.up",Kd.OVER="pointer.over",Kd.OUT="pointer.out",Kd.ENTER="pointer.enter",Kd.LEAVE="pointer.leave",Kd.TAP="tap",Kd.DOUBLE_TAP="double_tap",Kd.CLICK="click",Kd.DOUBLE_CLICK="double_click",Kd.LONG_PRESS="long_press",Kd.LONG_TAP="long_tap",Kd.MENU="pointer.menu",Kd.MENU_TAP="pointer.menu_tap",Kd=_e([Kn()],Kd);const qd=Kd,Zd={};let Jd=class extends Kd{static setList(t){this.list=t instanceof fh?t:new fh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const o=t.getLocalPoint(i,null,!0);return lt.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),Ud.axisMove(t,o),o}static limitMove(t,e){Ud.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Zd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Zd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Zd,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){Zd.x=t?this.totalX:this.moveX,Zd.y=t?this.totalY:this.moveY}};Jd.BEFORE_DRAG="drag.before_drag",Jd.START="drag.start",Jd.DRAG="drag",Jd.END="drag.end",Jd.OVER="drag.over",Jd.OUT="drag.out",Jd.ENTER="drag.enter",Jd.LEAVE="drag.leave",Jd=_e([Kn()],Jd);const Qd=Jd;let $d=class extends Kd{static setList(t){Jd.setList(t)}static setData(t){Jd.setData(t)}};$d.DROP="drop",$d=_e([Kn()],$d);let tc=class extends Jd{};tc.BEFORE_MOVE="move.before_move",tc.START="move.start",tc.MOVE="move",tc.END="move.end",tc=_e([Kn()],tc);let ec=class extends Dd{};ec=_e([Kn()],ec);const ic=ec;let sc=class extends Kd{};sc.BEFORE_ROTATE="rotate.before_rotate",sc.START="rotate.start",sc.ROTATE="rotate",sc.END="rotate.end",sc=_e([Kn()],sc);let oc=class extends Jd{};oc.SWIPE="swipe",oc.LEFT="swipe.left",oc.RIGHT="swipe.right",oc.UP="swipe.up",oc.DOWN="swipe.down",oc=_e([Kn()],oc);let nc=class extends Kd{};nc.BEFORE_ZOOM="zoom.before_zoom",nc.START="zoom.start",nc.ZOOM="zoom",nc.END="zoom.end",nc=_e([Kn()],nc);let rc=class extends Dd{};rc.BEFORE_DOWN="key.before_down",rc.BEFORE_UP="key.before_up",rc.DOWN="key.down",rc.HOLD="key.hold",rc.UP="key.up",rc=_e([Kn()],rc);const ac={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?oc.UP:t>45&&t<135?oc.DOWN:t<=45&&t>=-45?oc.RIGHT:oc.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:hc.getSwipeDirection(lt.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:i(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 fh,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>rr.draggable(t)||!t.isLeafer&&t.hasEvent(Jd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},hc=ac,lc=new fh,{getDragEventData:dc,getDropEventData:cc,getSwipeEventData:uc}=ac;class gc{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=dc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Jd.list||this.draggableList||lc;return this.dragging&&(s?t?lc:new fh(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(tc.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Ad.left(t),this.dragging&&(this.interaction.emit(Jd.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],rr.draggable(e)){this.draggableList=new fh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=dc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(tc.BEFORE_MOVE,this.dragData),e.emit(tc.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(Jd.BEFORE_DRAG,this.dragData),e.emit(Jd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:n}=this.dragData,{dragLimitAnimate:a}=e.p,h=!a||!!t;s.forEach(e=>{if(e.draggable){const s=o(e.draggable),l=Jd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:n},h||s);a&&!s&&t?rr.animateMove(e,l,r(a)?a:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Jd.OUT,t,i),e.emit(Jd.OVER,t,s)):e.emit(Jd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Jd.LEAVE,t,i,s),e.emit(Jd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=dc(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(tc.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Jd.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(lt.getDistance(e,t)>o.config.pointer.swipeDistance){const t=uc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=cc(t,e,Jd.data);s.path=i,this.interaction.emit($d.DROP,s),this.interaction.emit(Jd.LEAVE,t,i)}dragReset(){Jd.list=Jd.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 _c=Qt.get("emit");const pc=["move","zoom","rotate","key"];function fc(t,e,i,s,o){if(pc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!yc(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&mc(n,e,i,s,o)}}function mc(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!yc(t,o)&&(tl.updateEventStyle&&!s&&tl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=ce.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function yc(t,e){return e&&e.has(t)}const vc={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:wc,pathCanDrag:xc,pathHasOutside:bc}=ac;class kc{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&&Ad.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Ad.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Ld.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=g.clone(vc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new fh(t),this.createTransformer(),this.dragger=new gc(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Ad.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(Kd.BEFORE_DOWN,t),this.emit(Kd.DOWN,t),Ad.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Ad.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Ad.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(Kd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=lt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(Kd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Ad.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(Kd.BEFORE_UP,t),this.emit(Kd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(Kd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(Kd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(rc.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Ld.setDownCode(e),this.emit(rc.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(rc.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(rc.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Ld.setUpCode(e),this.emit(rc.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new fh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(Kd.OUT,t,i),this.emit(Kd.OVER,t,e)):this.emit(Kd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(Kd.LEAVE,t,i,e),this.emit(Kd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Kd.LEAVE,t),this.dragger.dragging&&this.emit($d.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[Kd.DOUBLE_TAP,Kd.DOUBLE_CLICK].some(e=>wc(t.path,e));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:o,target:n}=this;y.backgrounder||t.origin||n&&n.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:o,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.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&&!bc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!xc(t.path))&&!bc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:Kd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,o=s.length;t<o&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.height/i.height,this.p.snap&<.round(s),s}emitTap(t){this.emit(Kd.TAP,t),this.emit(Kd.CLICK,t)}emitDoubleTap(t){this.emit(Kd.DOUBLE_TAP,t),this.emit(Kd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(Kd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(Kd.LONG_TAP,t),(wc(t.path,Kd.LONG_TAP)||wc(t.path,Kd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(r(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(jr.RESIZE,this.__onResize,this)],t.once(qr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],mc(o,t,e,!0,s))return;o.isApp&&fc(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&fc(o,t,e,!1,s),mc(o,t,e,!1,s))return}catch(t){_c.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 Sc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Sc.custom={};class Ec extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new fh,this.pixelList=new fh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),re.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),re.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()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=re.selector())};const{toInnerRadiusPointOf:Bc,copy:Tc,setRadius:Rc}=lt,{hitRadiusPoint:Cc,hitPoint:Oc}=Ht,Pc={},Lc={},Ac=nh.prototype;Ac.hit=function(t,e=0){this.updateLayout(),Tc(Lc,t),Rc(Lc,e);const i=this.__world;return!!(e?Cc(i,Lc):Oc(i,Lc))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},Lc),e,{target:this}):this.__hitWorld(Lc))},Ac.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(Tc(Pc,t),Rc(t=Pc,e.hitRadius)),Bc(t,i,Pc),e.hitBox||o){if(Ht.hitRadiusPoint(s.boxBounds,Pc))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Pc)},Ac.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Ac.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Ac.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Ac.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Dc=new ft,Mc=Al.prototype;Mc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,o=i||s;this.__hitCanvas||(this.__hitCanvas=o?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(o){const{renderBounds:t}=this.__layout,o=y.image.hitCanvasSize,r=n.hitScale=Kt.set(0,0,o,o).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(r);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),$o.patternLocked=!0,this.__renderShape(n,{matrix:Dc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),$o.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},Mc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Fc=Al.prototype,Ic=Wl.prototype,Wc=Vl.prototype;Ic.__updateHitCanvas=Wc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Fc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Ic.__hitFill=Wc.__hitFill=function(t){return this.__hitCanvas?Fc.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},Td.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.width,e<i?i:e))},Dl.prototype.pick=function(t,i){return i||(i=e),this.updateLayout(),y.getSelector(this).getByPoint(t,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const zc=Ce.prototype;zc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},zc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},zc.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),Kt.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.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 Yc={convertTouch(t,e){const i=Yc.getTouch(t),s=ac.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Xc extends kc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return i(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Yc.getTouch(t);this.pointerDown(Yc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Yc.getTouch(t);this.pointerMove(Yc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Yc.getTouch(t);this.pointerUp(Yc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(ac.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function Nc(t,e,i){t.__.__font?Kh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Hc(t,e,i,s,o){const n=i.__;d(t)?Kh.drawStrokesStyle(t,e,!1,i,s,o):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Kh.strokeArrow(t,i,s,o)}function Vc(t,e,i,s,o){const n=i.__;d(t)?Kh.drawStrokesStyle(t,e,!0,i,s,o):(s.setStroke(t,n.__strokeWidth*e,n),Kh.drawTextStroke(i,s,o))}function jc(t,e,i,s,o){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,Vc(t,2,i,n,o),n.blendMode="outside"===e?"destination-out":"destination-in",Kh.fillText(i,n,o),n.blendMode="normal",rr.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}const{getSpread:Uc,copyAndSpread:Gc,toOuterOf:Kc,getOuterOf:qc,getByMove:Zc,move:Jc,getIntersectData:Qc}=Ht,$c={};let tu;const{stintSet:eu}=g,{hasTransparent:iu}=jh;function su(t,e,s){if(!d(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:r}=s.__layout;switch(e.type){case"image":n=qh.image(s,t,e,r,!tu||!tu[e.url]);break;case"linear":n=Zh.linearGradient(e,r);break;case"radial":n=Zh.radialGradient(e,r);break;case"angular":n=Zh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;n={type:o,style:jh.string(a,h)};break;default:i(e.r)||(n={type:"solid",style:jh.string(e)})}if(n&&(n.originPaint=e,o(n.style)&&iu(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const ou={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];l(a)||(a=[a]),tu=qh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=su(t,a[o],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(o=!0),n=!0),"fill"===t?(eu(i,"__isAlphaPixelFill",o),eu(i,"__isTransparentFill",n)):(eu(i,"__isAlphaPixelStroke",o),eu(i,"__isTransparentStroke",n),eu(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Nc(e,i,s)},fills:function(t,e,i,s){let o,n,r;for(let a=0,h=t.length;a<h;a++){if(o=t[a],n=o.originPaint,o.image){if(r?r++:r=1,qh.checkImage(o,!e.__.__font,e,i,s))continue;if(!o.style){1===r&&o.image.isPlacehold&&e.drawImagePlaceholder(o,i,s);continue}}if(i.fillStyle=o.style,o.transform||n.scaleFixed){if(i.save(),o.transform&&i.transform(o.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),Nc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),Nc(e,i,s),i.restoreBlendMode()):Nc(e,i,s)}},fillPathOrText:Nc,fillText:function(t,e,i){const s=t.__,{rows:o,decorationY:n}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=o.length;t<i;t++)r=o[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:i}=s.__textDrawData;t&&(e.fillStyle=t),o.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const o=e.__;if(o.__strokeWidth)if(o.__font)Kh.strokeText(t,e,i,s);else switch(o.strokeAlign){case"center":Hc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Hc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const o=e.__;if(o.__fillAfterStroke)Hc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Hc(t,2,e,r,s),r.clipUI(o),r.clearWorld(n),rr.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Kh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Vc(t,1,e,i,s);break;case"inside":jc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Vc(t,2,e,i,s):jc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,o=t.__.__textDrawData;const{rows:n,decorationY:r}=o;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=o;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,o,n){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||o.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(r=t[l],(!r.image||!qh.checkImage(r,!1,s,o,n))&&r.style){if(h){const{strokeStyle:t}=r;t?o.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):o.setStroke(r.style,a.__strokeWidth*e,a)}else o.strokeStyle=r.style;r.originPaint.blendMode?(o.saveBlendMode(r.originPaint.blendMode),i?Kh.drawTextStroke(s,o,n):o.stroke(),o.restoreBlendMode()):i?Kh.drawTextStroke(s,o,n):o.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),o=e.bounds,n=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;Kc(r.strokeSpread?(Gc($c,r.boxBounds,r.strokeSpread),$c):r.boxBounds,n,a);let{scaleX:_,scaleY:p}=t.getRenderScaleData(!0);if(o.includes(a))g=s,h=u=a,l=n;else{let s;if(y.fullImageShadow)s=a;else{const t=r.renderShapeSpread?Uc(o,T.swapAndScale(r.renderShapeSpread,_,p)):o;s=Qc(t,a)}c=o.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),_*=f,p*=m),u=qc(a,c),h=Zc(u,-c.e,-c.f),l=qc(n,c),Jc(l,-c.e,-c.f);const v=i.matrix;v?(d=new ft(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:_,scaleY:p}}};let nu,ru=new Gt;const{isSame:au}=Ht;function hu(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||qh.createData(o,s,i,n),!0}function lu(t,e){uu(t,Wr.LOAD,e)}function du(t,e){uu(t,Wr.LOADED,e)}function cu(t,e,i){e.error=i,t.forceUpdate("surface"),uu(t,Wr.ERROR,e)}function uu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Wr(e,i))}function gu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:_u,translate:pu}=Q,fu=new Gt,mu={},yu={};function vu(t,e,i,s){const n=o(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let wu={},xu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:bu,set:ku,rotateOfOuter:Su,translate:Eu,scaleOfOuter:Bu,multiplyParent:Tu,scale:Ru,rotate:Cu,skew:Ou}=Q;function Pu(t,e,i,s,o,n,r,a){r&&Cu(t,r),a&&Ou(t,a.x,a.y),o&&Ru(t,o,n),Eu(t,e.x+i,e.y+s)}const{get:Lu,scale:Au,copy:Du}=Q,{getFloorScale:Mu}=I,{abs:Fu}=Math;const Iu={image:function(t,e,i,s,o){let n,r;const a=$o.get(i);return nu&&i===nu.paint&&au(s,nu.boxBounds)?n=nu.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),nu=a.use>1?{leafPaint:n,paint:i,boxBounds:ru.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(hu(t,e,i,a,n,s),o&&(lu(t,r),du(t,r))):a.error?o&&cu(t,r,a.error):(o&&(gu(t,!0),lu(t,r)),n.loadId=a.load(()=>{gu(t,!1),t.destroyed||(hu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),du(t,r)),n.loadId=void 0},e=>{gu(t,!1),cu(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,o){const{scaleX:n,scaleY:r}=qh.getImageRenderScaleData(t,i,s,o),{image:a,data:h,originPaint:l}=t,{exporting:d}=o;return!(!h||t.patternId===n+"-"+r&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&jr.isResizing(i)||d||(e=y.image.isLarge(a,n,r))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),qh.drawImage(t,n,r,i,s,o),!0):(!t.style||l.sync||d?qh.createPattern(t,i,s,o):qh.createPatternTask(t,i,s,o),!1))},drawImage:function(t,e,i,s,o,n){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=r,c=a.getFull(r.filters),u=s.__;let g,{width:_,height:p}=a;(g=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(o.save(),g&&o.clipUI(s),h&&(o.blendMode=h),l&&(o.opacity*=l),d&&o.transform(d),o.drawImage(c,0,0,_,p),o.restore()):(r.scaleX&&(_*=r.scaleX,p*=r.scaleY),o.drawImage(c,0,0,_,p))},getImageRenderScaleData:function(t,e,i,s){const o=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;o.scaleX*=t,o.scaleY*=t}return n&&n.scaleX&&(o.scaleX*=Math.abs(n.scaleX),o.scaleY*=Math.abs(n.scaleY)),o},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,o,n,r,a;for(let h=0,d=i.length;h<d;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,$o.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],l(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=$o.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&qh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:o,scaleY:n}=qh.getImageRenderScaleData(t,e,i,s),r=o+"-"+n;if(t.patternId!==r&&!e.destroyed&&(!y.image.isLarge(t.image,o,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=qh.getPatternFixScale(t,o,n);let d,c,u,{width:g,height:_}=i;l&&(o*=l,n*=l),g*=o,_*=n,h&&(c=h.x*o/Fu(s.scaleX||1),u=h.y*n/Fu(s.scaleY||1)),(a||1!==o||1!==n)&&(o*=Mu(g+(c||0)),n*=Mu(_+(u||0)),d=Lu(),a&&Du(d,a),Au(d,1/o,1/n));const p=i.getCanvas(g,_,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(p,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let o,n=y.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(o=Math.ceil(e)/e):n>r&&(n=r),(r*=e*i)>n&&(o=Math.sqrt(n/r)),o},createData:function(t,e,i,s){t.data=qh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=fu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:r,mode:a,align:h,offset:l,scale:c,size:u,rotation:g,skew:_,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Ht.set(yu,0,0,x?n:s,x?s:n),a&&"cover"!==a&&"fit"!==a?((c||u)&&(I.getScaleData(c,u,i,mu),b=mu.scaleX,k=mu.scaleY),(h||m||f)&&(b&&Ht.scale(yu,b,k,!0),h&&Bt.toPoint(h,yu,e,yu,!0,!0))):v&&!g||(b=k=Ht.getFitScale(e,yu,"fit"!==a),Ht.put(e,i,h,b,!1,yu),Ht.scale(yu,b,k,!0)),l&<.move(yu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/n,qh.stretchMode(w,e,b,k));break;case"normal":case"clip":if(yu.x||yu.y||b||p||g||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),qh.clipMode(w,e,yu.x,yu.y,b,k,g,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||_)&&qh.repeatMode(w,e,s,n,yu.x,yu.y,b,k,g,_,h,t.freeTransform),f||(w.repeat="repeat");const i=d(f);(m||i)&&(w.gap=function(t,e,i,s,o){let n,r;d(t)?(n=t.x,r=t.y):n=r=t;return{x:vu(n,i,o.width,e&&e.x),y:vu(r,s,o.height,e&&e.y)}}(m,i&&f,yu.width,yu.height,e));break;default:b&&qh.fillOrFitMode(w,e,yu.x,yu.y,b,k,g)}return w.transform||(e.x||e.y)&&pu(w.transform=_u(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const o=bu(),{x:n,y:r}=e;n||r?Eu(o,n,r):o.onlyScale=!0,Ru(o,i,s),t.transform=o},fillOrFitMode:function(t,e,i,s,o,n,r){const a=bu();Eu(a,e.x+i,e.y+s),Ru(a,o,n),r&&Su(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,o,n,r,a,h,l){const d=bu();Pu(d,e,i,s,o,n,r,a),h&&(r||a?(ku(xu),Bu(xu,e,h,l),Tu(d,xu)):Bu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,o,n,r,a,h,l,d,c){const u=bu();if(c)Pu(u,e,o,n,r,a,h,l);else{if(h)if("center"===d)Su(u,{x:i/2,y:s/2},h);else switch(Cu(u,h),h){case 90:Eu(u,s,0);break;case 180:Eu(u,i,s);break;case 270:Eu(u,0,i)}wu.x=e.x+o,wu.y=e.y+n,Eu(u,wu.x,wu.y),r&&Bu(u,wu,r,a)}t.transform=u}},{toPoint:Wu}=kt,{hasTransparent:zu}=jh,Yu={},Xu={};function Nu(t,e,i,s){if(i){let n,r,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],o(n)?(a=t/(l-1),r=jh.string(n,s)):(a=n.offset,r=jh.string(n.color,s)),e.addColorStop(a,r),!h&&zu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Hu,getDistance:Vu}=lt,{get:ju,rotateOfOuter:Uu,scaleOfOuter:Gu}=Q,{toPoint:Ku}=kt,qu={},Zu={};function Ju(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Hu(e,i);n=ju(),o?(Gu(n,e,r/a*(s||1),1),Uu(n,e,t+90)):(Gu(n,e,1,r/a*(s||1)),Uu(n,e,t))}return n}const{getDistance:Qu}=lt,{toPoint:$u}=kt,tg={},eg={};const ig={linearGradient:function(t,e){let{from:i,to:s,type:o,opacity:n}=t;Wu(i||"top",e,Yu),Wu(s||"bottom",e,Xu);const r=y.canvas.createLinearGradient(Yu.x,Yu.y,Xu.x,Xu.y),a={type:o,style:r};return Nu(a,r,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:o,opacity:n,stretch:r}=t;Ku(i||"center",e,qu),Ku(s||"bottom",e,Zu);const a=y.canvas.createRadialGradient(qu.x,qu.y,0,qu.x,qu.y,Vu(qu,Zu)),h={type:o,style:a};Nu(h,a,t.stops,n);const l=Ju(e,qu,Zu,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:o,opacity:n,stretch:r}=t;$u(i||"center",e,tg),$u(s||"bottom",e,eg);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,tg.x,tg.y):y.canvas.createRadialGradient(tg.x,tg.y,0,tg.x,tg.y,Qu(tg,eg)),h={type:o,style:a};Nu(h,a,t.stops,n);const l=Ju(e,tg,eg,r||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Ju},{copy:sg,move:og,toOffsetOutBounds:ng}=Ht,{max:rg,abs:ag}=Math,hg={},lg=new ft,dg={};function cg(t,e){let i,s,o,n,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),o=ag(t.spread||0),r=rg(r,o+n-s),a=rg(a,o+n+i),h=rg(h,o+n+s),l=rg(l,o+n-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function ug(t,e,i){const{shapeBounds:s}=i;let o,n;y.fullImageShadow?(sg(hg,t.bounds),og(hg,e.x-s.x,e.y-s.y),o=t.bounds,n=hg):(o=s,n=e),t.copyWorld(i.canvas,o,n)}const{toOffsetOutBounds:gg}=Ht,_g={};const pg=cg;const fg={shadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;ng(h,dg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.setWorldShadow(dg.offsetX+(r.x||0)*c*f,dg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,jh.string(r.color)),o=Jh.getShadowTransform(t,g,i,r,dg,f),o&&g.setTransform(o),ug(g,dg,i),o&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,n,"copy"),s=n),a?g.copyWorld(a,n,n,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),rr.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;gg(h,_g,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(_g.offsetX+(r.x||0)*c*f,_g.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),o=Jh.getShadowTransform(t,g,i,r,_g,f,!0),o&&g.setTransform(o),ug(g,_g,i),g.restore(),a?(g.copyWorld(g,l,n,"copy"),g.copyWorld(a,n,n,"source-out"),s=n):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,jh.string(r.color),"source-in"),rr.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.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){},getShadowRenderSpread:cg,getShadowTransform:function(t,e,i,s,o,n,r){if(s.spread){const i=2*s.spread*n*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return lg.set().scaleOfOuter({x:(o.x+o.width/2)*e.pixelRatio,y:(o.y+o.height/2)*e.pixelRatio},1+i/a,1+i/h),lg}},isTransformShadow(t){},getInnerShadowSpread:pg},{excludeRenderBounds:mg}=_r;let yg;function vg(t,e,i,s,o,n,r,a){switch(e){case"grayscale":yg||(yg=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);xg(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":xg(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function wg(t){return t.getSameCanvas(!1,!0)}function xg(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}Dl.prototype.__renderMask=function(t,e){let i,s,o,n,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(vg(this,r,t,o,s,n,void 0,!0),s=o=null),"clipping"!==a&&"clipping-path"!==a||mg(i,e)||i.__render(t,e),n=i.__.opacity,yg=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=wg(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=wg(t)),o||(o=wg(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&vg(this,r,t,o,s,n,void 0,!1),mg(i,e)||i.__render(o||t,e),d&&vg(this,r,t,o,s,n,d,!1)}vg(this,r,t,o,s,n,void 0,!0)};const bg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",kg=bg+"_#~&*+\\=|≮≯≈≠=…",Sg=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 Eg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Bg=Eg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Tg=Eg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Rg=Eg(bg),Cg=Eg(kg),Og=Eg("- —/~|┆·");var Pg;!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"}(Pg||(Pg={}));const{Letter:Lg,Single:Ag,Before:Dg,After:Mg,Symbol:Fg,Break:Ig}=Pg;function Wg(t){return Bg[t]?Lg:Og[t]?Ig:Tg[t]?Dg:Rg[t]?Mg:Cg[t]?Fg:Sg.test(t)?Ag:Lg}const zg={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function Yg(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:Xg}=zg,{Letter:Ng,Single:Hg,Before:Vg,After:jg,Symbol:Ug,Break:Gg}=Pg;let Kg,qg,Zg,Jg,Qg,$g,t_,e_,i_,s_,o_,n_,r_,a_,h_,l_,d_,c_=[];function u_(t,e){i_&&!e_&&(e_=i_),Kg.data.push({char:t,width:e}),Zg+=e}function g_(){Jg+=Zg,Kg.width=Zg,qg.words.push(Kg),Kg={data:[]},Zg=0}function __(){a_&&(h_.paraNumber++,qg.paraStart=!0,a_=!1),i_&&(qg.startCharSize=e_,qg.endCharSize=i_,e_=0),qg.width=Jg,l_.width?Xg(qg):d_&&p_(),c_.push(qg),qg={words:[]},Jg=0}function p_(){Jg>(h_.maxWidth||0)&&(h_.maxWidth=Jg)}const{top:f_,right:m_,bottom:y_,left:v_}=wt;function w_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const x_={getDrawData:function(t,e){o(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[v_],n-=a[m_]+a[v_],!n&&(n=.01)):e.autoSizeAlign||(i=a[v_]),r?(s=a[f_],r-=a[f_]+a[y_],!r&&(r=.01)):e.autoSizeAlign||(s=a[f_]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){h_=t,c_=t.rows,l_=t.bounds,d_=!l_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:n}=i,{canvas:r}=y,{width:a}=l_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;a_=!0,o_=null,e_=t_=i_=Zg=Jg=0,Kg={data:[]},qg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)$g=e[i],"\n"===$g?(Zg&&g_(),qg.paraEnd=!0,__(),a_=!0):(s_=Wg($g),s_===Ng&&"none"!==n&&($g=Yg($g,n,!Zg)),t_=r.measureText($g).width,s&&(s<0&&(i_=t_),t_+=s),n_=s_===Hg&&(o_===Hg||o_===Ng)||o_===Hg&&s_!==jg,r_=!(s_!==Vg&&s_!==Hg||o_!==Ug&&o_!==jg),Qg=a_&&o?a-o:a,t&&a&&Jg+Zg+t_>Qg&&(h?(Zg&&g_(),Jg&&__()):(r_||(r_=s_===Ng&&o_==jg),n_||r_||s_===Gg||s_===Vg||s_===Hg||Zg+t_>Qg?(Zg&&g_(),Jg&&__()):Jg&&__()))," "===$g&&!0!==a_&&Jg+Zg===0||(s_===Gg?(" "===$g&&Zg&&g_(),u_($g,t_),g_()):n_||r_?(Zg&&g_(),u_($g,t_)):u_($g,t_)),o_=s_);Zg&&g_(),Jg&&__(),c_.length>0&&(c_[c_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{h_.paraNumber++,Jg=r.measureText(t).width,c_.push({x:o||0,text:t,width:Jg,paraStart:!0}),d_&&p_()})}(h,t,e),a&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":w_(e,"x",t[v_]);break;case"right":w_(e,"x",-t[m_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":w_(e,"y",t[f_]);break;case"bottom":w_(e,"y",-t[y_])}}(a,h,e,n,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=n*o+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,w,x,b=p||u?p:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=g,v.width<p||v.width>p&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=n,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&p&&p<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e,a=i&&o.includes("both"),h=a||i&&o.includes("justify"),l=h&&o.includes("letter");let d,c,u,g,_,p,f,m,y,v;s.forEach(t=>{t.words&&(_=n&&t.paraStart?n:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===p?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===p?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,o){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,o&&(e+=o)}),e}(e.data,d,t.data,t.isOverflow,v&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:o,overflow:n}=t;let{textOverflow:r}=e;if(o.splice(n),r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?y.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?o:[o[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:r,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:o,textDecoration:n}=e;switch(t.decorationHeight=o/11,d(n)?(i=n.type,n.color&&(t.decorationColor=jh.string(n.color)),n.offset&&(s=Math.min(.3*o,Math.max(n.offset,.15*-o)))):i=n,i){case"under":t.decorationY=[.15*o+s];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+s,.35*-o]}}(h,e),h}};const b_={string:function(t,e){if(!t)return"#000";const s=r(e)&&e<1;if(o(t)){if(!s||!jh.object)return t;t=jh.object(t)}let n=i(t.a)?1:t.a;s&&(n*=e);const a=t.r+","+t.g+","+t.b;return 1===n?"rgb("+a+")":"rgba("+a+","+n+")"}};Object.assign(Vh,x_),Object.assign(jh,b_),Object.assign(Kh,ou),Object.assign(qh,Iu),Object.assign(Zh,ig),Object.assign(Jh,fg),Object.assign(re,{interaction:(t,e,i,s)=>new Xc(t,e,i,s),hitCanvas:(t,e)=>new vh(t,e),hitCanvasManager:()=>new Ec}),Il.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&bh(0,wx)}catch(t){}function k_(t){return t?l(t)?t:[t]:[]}class S_ extends Ar{get list(){return k_(this.value)}get oldList(){return k_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function E_(t){return(e,i)=>{const s="_"+i;nn(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){const n=this;if(n.config){const t="target"===i;if(t){const{beforeSelect:t}=n.config;if(t){const i=t({target:e});if(d(i))e=i;else if(!1===i)return}n.setDimOthers(!1),n.setBright(!1),l(e)&&e.length>1&&e[0].locked&&e.splice(0,1),n.single&&(delete n.element.syncEventer,delete n.element.__world.ignorePixelSnap)}const s=t?S_.BEFORE_SELECT:S_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new S_(s,{editor:n,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}S_.BEFORE_SELECT="editor.before_select",S_.SELECT="editor.select",S_.AFTER_SELECT="editor.after_select",S_.BEFORE_HOVER="editor.before_hover",S_.HOVER="editor.hover";const{abs:B_}=Math,{copy:T_,scale:R_}=Q,{setListWithFn:C_}=Ht,{worldBounds:O_}=_r,P_={a:1,b:0,c:0,d:1,e:0,f:0},L_={x:0,y:0,width:0,height:0};class A_ extends Al{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?(C_(L_,e,O_),t&&this.set(t),this.set(L_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:a,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=B_(c.scaleX),l=B_(c.scaleY);if(T_(P_,c),P_.half=a%2,i!==l){R_(P_,1/i,1/l),t.setWorld(P_,e.matrix),t.beginPath(),n.strokeWidth=a;const{x:o,y:r,width:h,height:d}=s.__layout.boxBounds;t.rect(o*i,r*l,h*i,d*l)}else t.setWorld(P_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/B_(c.scaleX);r&&(o(r)?Kh.stroke(r,this,t,e):Kh.strokes(r,this,t,e)),h&&(o(h)?Kh.fill(h,this,t,e):Kh.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}_e([E_(function(t){const e=t.target;t.list=e?l(e)?e:[e]:[]})],A_.prototype,"target",void 0);class D_ extends Dl{constructor(t){super(t),this.strokeArea=new Wl({strokeAlign:"center"}),this.fillArea=new Wl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const M_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return F_([t],i,e),i}};function F_(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&o.hitSelf&&e.push(s)}s.isBranch&&F_(s.children,e,i)}}const{findOne:I_,findByBounds:W_}=M_;class z_ extends Dl{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new A_,this.targetStroker=new A_,this.bounds=new Gt,this.selectArea=new D_,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{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:o,strokeWidth:n,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:o,strokeWidth:n},a||{}))}}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,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(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)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),o=new fh(W_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!I_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new fh(this.editor.editBox.rect)};return I_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):I_(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[S_.HOVER,this.onHover,this],[S_.SELECT,this.onSelect,this]]),e.on_([[Kd.MOVE,this.onPointerMove,this],[Kd.BEFORE_DOWN,this.onBeforeDown,this],[Kd.TAP,this.onTap,this],[Jd.START,this.onDragStart,this,!0],[Jd.DRAG,this.onDrag,this],[Jd.END,this.onDragEnd,this],[tc.MOVE,this.onAutoMove,this],[[nc.ZOOM,tc.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:Y_,top:X_,topRight:N_,right:H_,bottomRight:V_,bottom:j_,bottomLeft:U_,left:G_}=xt,{toPoint:K_}=kt,{within:q_,sign:Z_}=I,{abs:J_}=Math,Q_={getScaleData(t,e,i,s,o,n,a,h){let l,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=Z_(x),S=Z_(b),E=h?x:k*_.width/v,B=h?b:S*_.height/w;if(r(s))u=g=Math.sqrt(s);else{n&&(s.x*=2,s.y*=2),s.x*=h?x:k,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case X_:g=t,l="bottom";break;case H_:u=e,l="left";break;case j_:g=r,l="top";break;case G_:u=a,l="right";break;case Y_:g=t,u=a,l="bottom-right";break;case N_:g=t,u=e,l="bottom-left";break;case V_:g=r,u=e,l="top-left";break;case U_:g=r,u=a,l="top-right"}if(o)if("corner"===o&&i%2)o=!1;else switch(i){case X_:case j_:u=g;break;case G_:case H_:g=u;break;default:d=Math.sqrt(J_(u*g)),u=Z_(u)*d,g=Z_(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!a){const{worldTransform:e}=t;u<0&&(u=1/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if(K_(n||l,_,c,!0),m){const e={x:u,y:g};Ud.limitScaleOf(t,c,e,o),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=q_(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=q_(e*g,f)/e}return T&&J_(u*y.width)<1&&(u=Z_(u)/y.width),R&&J_(g*y.height)<1&&(g=Z_(g)/y.height),o&&u!==g&&(d=Math.min(J_(u),J_(g)),u=Z_(u)*d,g=Z_(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case Y_:n="bottom-right";break;case N_:n="bottom-left";break;case V_:n="top-left";break;case U_:n="top-right";break;default:n="center"}return K_(o||n,t.boxBounds,r,!0),{origin:r,rotation:lt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case X_:case Y_:n={x:.5,y:0},o="bottom",a=1;break;case j_:case V_:n={x:.5,y:1},o="top",a=1;break;case G_:case U_:n={x:0,y:.5},o="right",h=1;break;case H_:case N_:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,K_(s||o,t,r,!0);const c=lt.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case G_:t=H_;break;case Y_:t=N_;break;case U_:t=V_;break;case H_:t=G_;break;case N_:t=Y_;break;case V_:t=U_}if(i)switch(t){case X_:t=j_;break;case Y_:t=U_;break;case N_:t=V_;break;case j_:t=X_;break;case U_:t=Y_;break;case V_:t=N_}return t}},$_={};function tp(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return ep(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:_,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(_||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!p)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?o?g:n?c:u:v?g:y?c:u;h+=45*(Q_.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(I.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;$_[S]?i.cursor=$_[S]:$_[S]=i.cursor={url:ip(x,h),x:b,y:k}}function ep(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function ip(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class sp extends Vl{constructor(t){super(t),this.useFastShadow=!0}}const op=["top","right","bottom","left"],np=void 0;class rp extends Dl{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.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return o(t)||o(e)||o(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Dl,this.rect=new sp({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new sp({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Dl({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new sp({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new sp({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new sp({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:o,circle:n,resizePoints:r,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),_=this.getResizeLinesStyle();let p;this.visible=!t.locked;for(let t=0;t<8;t++)p=r[t],p.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),p.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},_[(t-1)/2%_.length]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),o.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:np},e.rect||{}));const f=s(e.rectThrough)?i:e.rectThrough;o.hittable=!f,f&&(t.syncEventer=o,this.app.interaction.bottomList=[{target:o,proxy:t}]),i&&g.stintSet(t.__world,"ignorePixelSnap",d),ep(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:o,circle:n,buttons:a,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:_,hideOnSmall:p,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Ht.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=r(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)kt.toPoint(kt.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));n.visible=y&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||f})),a.visible=y&&a.children.length>0||0,a.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=op.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=op.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?Q_.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:np};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return l(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return l(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return l(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:o,rotateable:n,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!o?(n&&(this.rotating=!0),"resize-rotate"===i?o&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&o&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t)}tp(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(jr.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof Jd||t instanceof tc)&&this.transformTool.onMove(t),this.resizing&&(jr.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),o(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case tc.START:this.onTransformStart(t);break;case tc.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),o(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case nc.START:this.onTransformStart(t);break;case nc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),o(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case nc.START:this.onTransformStart(t);break;case nc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){tp(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Td)||t.find(t=>t instanceof Td);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[Jd.START,this.onDragStart,this],[Jd.DRAG,this.onDrag,this],[Jd.END,this.onDragEnd,this],[Kd.ENTER,e=>{this.enterPoint=t,tp(this,e)}],[Kd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[Kd.DOUBLE_TAP,this.onDoubleTap,this],[Kd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[rc.HOLD,rc.UP],this.onKey,this],[rc.DOWN,this.onArrow,this],[[tc.START,tc.BEFORE_MOVE,tc.END],this.onMove,this,!0],[[nc.START,nc.BEFORE_ZOOM,nc.END],this.onScale,this,!0],[[sc.START,sc.BEFORE_ROTATE,sc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const ap={x:0,y:0,width:1e5,height:1e5};class hp extends Al{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,ap),Object.assign(this.__world,ap)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const lp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',dp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${lp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${lp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${lp}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},cp=new Gt;function up(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{cp.setListWithFn(i,t=>t.getBounds("box","page")),0===cp.width&&(cp.width=.1),0===cp.height&&(cp.height=.1),e.reset(cp.get())}),s.add(e)}const gp=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),_p=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),pp={group(t,e,i){t.sort(_p);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Dl(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(gp);const r=new ft(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(gp),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(_p),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},fp=Qt.get("EditToolCreator");function mp(){return t=>{vp.register(t)}}const yp=mp,vp={list:{},register(t){const{tag:e}=t.prototype;wp[e]&&fp.repeat(e),wp[e]=t},get:(t,e)=>new wp[t](e)},{list:wp}=vp;class xp extends S_{constructor(t,e){super(t,e)}}xp.BEFORE_OPEN="innerEditor.before_open",xp.OPEN="innerEditor.open",xp.BEFORE_CLOSE="innerEditor.before_close",xp.CLOSE="innerEditor.close";class bp extends S_{constructor(t,e){super(t,e)}}bp.BEFORE_GROUP="editor.before_group",bp.GROUP="editor.group",bp.BEFORE_UNGROUP="editor.before_ungroup",bp.UNGROUP="editor.ungroup",bp.BEFORE_OPEN="editor.before_open_group",bp.OPEN="editor.open_group",bp.BEFORE_CLOSE="editor.before_close_group",bp.CLOSE="editor.close_group";const{updateMatrix:kp}=rr,Sp={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Ep="top-left";class Bp extends Wl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Fr.CHANGE,e=>{if(this.checkChange&&Sp[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,kp(this.parent),kp(this);const a=new ft(this.__world);switch(r[i]=s,this.__layout.rotationChange(),kp(this),this.changedTransform=new ft(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(Ep,n);break;case"scaleX":t.scaleOf(Ep,n,1);break;case"scaleY":t.scaleOf(Ep,1,n);break;case"skewX":t.skewOf(Ep,n,0);break;case"skewY":t.skewOf(Ep,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Tp extends S_{constructor(t,e){super(t,e)}}Tp.BEFORE_MOVE="editor.before_move",Tp.MOVE="editor.move";class Rp extends S_{constructor(t,e){super(t,e)}}Rp.BEFORE_SCALE="editor.before_scale",Rp.SCALE="editor.scale";class Cp extends S_{constructor(t,e){super(t,e)}}Cp.BEFORE_ROTATE="editor.before_rotate",Cp.ROTATE="editor.rotate";class Op extends S_{constructor(t,e){super(t,e)}}Op.BEFORE_SKEW="editor.before_skew",Op.SKEW="editor.skew";class Pp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let n,{dragLimitAnimate:a}=i;const h=t.type===tc.END||t.type===Jd.END,l=o(e.draggable),d=!a||h||l,c={x:t.totalX,y:t.totalY};t instanceof tc&<.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),n=Jd.getValidMove(e,s.point,c,d),(n.x||n.y)&&(a&&!l&&h?rr.animateMove(this,n,r(a)?a:.3):this.move(n))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let n,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof nc?(r=e.getBoxPoint(t),n=t.totalScale):n=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=Q_.getScaleData(e,o.bounds,d,n,a,Q_.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof Jd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),lt.move(o.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof sc)d=t.rotation,l=n?kt.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=Q_.getRotateData(e,h,t,s,i?null:n||e.around||e.origin||o||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=I.float(I.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),lt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=Q_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),Q_.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;d(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(d(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Tp(Tp.BEFORE_MOVE,h));const l=new Tp(Tp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Rp(Rp.BEFORE_SCALE,t));const n=new Rp(Rp.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if(d(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.scaleOf(t,e,i))),u={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:c};this.emitEvent(new Rp(Rp.BEFORE_SCALE,u));const g=new Rp(Rp.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new ft(rr.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Rp(Rp.BEFORE_SCALE,r));const a=new Rp(Rp.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:a}=s;if(a){const s=a({target:i,origin:t,rotation:e});if(r(s))e=s;else if(!1===s)return}const h=this.getWorldOrigin(t),l=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new Cp(Cp.BEFORE_ROTATE,d));const c=new Cp(Cp.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if(d(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.skewOf(t,e,i))),u={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:c};this.emitEvent(new Op(Op.BEFORE_SKEW,u));const g=new Op(Op.SKEW,u);this.doSkew(g),this.emitEvent(g)}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(rr.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ft(e.worldTransform);return t(),new ft(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Lp=class extends Dl{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 fh,this.openedGroupList=new fh,this.simulateTarget=new Bp(this),this.editBox=new rp(this),this.editToolList={},this.selector=new z_(this),this.editMask=new hp(this),this.targetEventIds=[];let i=g.clone(dp);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),ne.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?l(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>g.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&up(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||vp.get(t,this)}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(o(s))e=s;else if(!1===s)return}if(vp.list[e]){const t=this.editTool=this.getEditTool(e);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(bp.BEFORE_GROUP),this.target=pp.group(this.list,this.element,t),this.emitGroupEvent(bp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(bp.BEFORE_UNGROUP,t)),this.target=pp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(bp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(bp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(bp.OPEN,t)}closeGroup(t){this.emitGroupEvent(bp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(bp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!rr.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 bp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||vp.get(t,this)}openInnerEditor(t,e,i){let s;if(o(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(o(i))s=i;else if(!1===i)return}vp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(xp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(xp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(xp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(xp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new xp(t,{editTarget:i,innerEditor:e});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&&(pp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(pp.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_(Kr.START,this.onRenderStart,this),i&&i.on_(Fr.SCROLL,this.onChildScroll,this),t.on_(Kr.CHILD_START,this.onAppRenderStart,this),t.on_(qr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};_e([(t,e)=>{nn(t,e,{get(){const{config:t,element:e,dragPoint:o,editBox:n,app:r}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return n.config&&Object.assign(a,n.config),o&&(o.editConfig&&Object.assign(a,o.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===o.pointType&&(a.around||(a.around="center"),s(a.lockRatio)&&(a.lockRatio=!0))),i(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Lp.prototype,"mergeConfig",void 0),_e([E_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof fh?i:new fh(i),t.multiple&&up(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new S_(S_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new S_(S_.AFTER_SELECT,s))})],Lp.prototype,"target",void 0),_e([E_(function(t,e){t.emitEvent(new S_(S_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Lp.prototype,"hoverTarget",void 0),Lp=_e([Un(Pp,["editBox","editTool","emitEvent"])],Lp);class Ap{static registerInnerEditor(){vp.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 Dl,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Dp=class extends Ap{static registerEditTool(){vp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Dp=_e([mp()],Dp);const{left:Mp,right:Fp}=xt,{move:Ip,copy:Wp,toNumberPoints:zp}=lt;let Yp=class extends Dp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===Mp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=zp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(Ip(t,n,r),s&&Ip(e,-n,-r)):(s&&Ip(t,-n,-r),Ip(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),Wp(s[7],i),Wp(e[7],i),Wp(s[3],a),Wp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Mp||t===Fp,s[t].visible=a,e[t].visible=!r&&a}};Yp=_e([mp()],Yp);const{M:Xp,L:Np,C:Hp,Q:Vp,Z:jp,N:Up,D:Gp,X:Kp,G:qp,F:Zp,O:Jp,P:Qp,U:$p}=Le,tf={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case Xp:case Np:ef(t,e,i,o,1),o+=3;break;case Hp:ef(t,e,i,o,3),o+=7;break;case Vp:ef(t,e,i,o,2),o+=5;break;case jp:o+=1;break;case Up:ef(t,e,i,o,2),o+=5;break;case Gp:ef(t,e,i,o,2),o+=9;break;case Kp:ef(t,e,i,o,2),o+=6;break;case qp:ef(t,e,i,o,2),o+=9;break;case Zp:ef(t,e,i,o,2),o+=5;break;case Jp:t[o]=qp,t.splice(o+4,0,t[o+3],0),ef(t,e,i,o,2),o+=9,n+=2;break;case Qp:t[o]=Zp,t.splice(o+4,0,t[o+3]),ef(t,e,i,o,2),o+=5,n+=1;break;case $p:ef(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:ef}=tf,sf=Q.get(),{topLeft:of,top:nf,topRight:rf,right:af,bottom:hf,left:lf}=xt;function df(t,e,i){t.pathInputed?uf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function cf(t,e,s,o){let n=e;if(!i(o)){const i=t.__layout;let{width:r,height:a}=i.boxBounds;switch(r*=s-e,a*=e-s,o){case nf:case hf:n=s,i.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case lf:case af:i.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case of:case rf:i.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=l(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function uf(t,e,i){tf.scale(t.__.path,e,i),t.path=t.__.path}function gf(t,e,i){const{points:s}=t;d(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):tf.scalePoints(s,e,i),t.points=s}function _f(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)sf.a=e,sf.d=i,s[t].transform(sf,!0)}const pf=nh.prototype;function ff(t,e,i){mf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(tc.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(tc.END,e=>{rr.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(nc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function mf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&g.assign(i,e),g.assign(t.config,i,t.userConfig)}pf.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))},pf.__scaleResize=function(t,e){df(this,t,e)},pf.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},pf.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Td.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)cf(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),df(this,t,e)}},Rd.prototype.__scaleResize=function(t,e){uf(this,t,e)},yd.prototype.__scaleResize=function(t,e){this.pathInputed?uf(this,t,e):this.points?gf(this,t,e):this.width*=t},sd.prototype.__scaleResize=function(t,e){this.pathInputed?uf(this,t,e):this.points?gf(this,t,e):df(this,t,e)},Dl.prototype.__scaleResize=function(t,e){_f(this,t,e)},Vl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||df(this,t,e),i&&_f(this,t,e)},ne.add("resize"),ne.add("editor","resize"),re.editor=function(t,e){const i=new Lp(t);return e&&e.sky.add(e.editor=i),i},Vl.addAttr("textBox",!1,cn),Al.addAttr("editConfig",void 0,cn),Al.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),cn),Al.addAttr("editInner","PathEditor",cn),Dl.addAttr("editInner","",cn),Td.addAttr("editInner","TextEditor",cn),Al.setEditConfig=function(t){this.changeAttr("editConfig",t)},Al.setEditOuter=function(t){this.changeAttr("editOuter",t)},Al.setEditInner=function(t){this.changeAttr("editInner",t)};const yf=Qt.get("LeaferTypeCreator"),vf={list:{},register(t,e){wf[t]&&yf.repeat(t),wf[t]=e},run(t,e){const i=wf[t];i&&i(e)}},{list:wf,register:xf}=vf;xf("viewport",ff),xf("custom",function(t){ff(t,null,!0)}),xf("design",function(t){ff(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),xf("document",function(t){ff(t,{zoom:{min:1},move:{scroll:"limit"}})});const bf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=lt.getCenter(e.from,i.from),o=lt.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=lt.getDistance(e.from,i.from);return{move:n,scale:lt.getDistance(e.to,i.to)/r,rotation:lt.getRotation(e.from,i.from,e.to,i.to),center:o}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),o=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&o<1?"none":i>=s&&i>=o?"move":s>=o?"zoom":"rotate"},detect(t,e){const{state:i}=kf,s=kf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),kf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?kf.getType(i.totalData,e):"none"},add(t,e){e&&(lt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=kf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},kf=bf,{abs:Sf,max:Ef}=Math,{sign:Bf,within:Tf}=I,Rf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=Sf(s),r=Sf(o);return n>50&&(s=Ef(50,n/3)*Bf(s)),r>50&&(o=Ef(50,r/3)*Bf(o)),{x:-s*i*2,y:-o*i*2}},getScale(t,e){let i,s=1,{zoomMode:o,zoomSpeed:n}=e;const r=t.deltaY||t.deltaX;if(o?(i="mouse"===o||!t.deltaX&&(y.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){n=Tf(n,0,1);const i=t.deltaY?e.delta.y:e.delta.x,o=Tf(1-Sf(r)/(4*i)*n,.5,2);s=r>0?o:1/o}return s}};let Cf,Of,Pf,Lf;class Af{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Cf=0,Of=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Cf,totalY:Of}),e.emit(tc.START,this.moveData)),t.path=this.moveData.path,t.totalX=Cf+=t.moveX,t.totalY=Of+=t.moveY,e.emit(tc.BEFORE_MOVE,t),e.emit(tc.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Pf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Pf}),e.emit(nc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Pf*=t.scale,e.emit(nc.BEFORE_ZOOM,t),e.emit(nc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Lf=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Lf}),e.emit(sc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Lf+=t.rotation,e.emit(sc.BEFORE_ROTATE,t),e.emit(sc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(tc.END,Object.assign(Object.assign({},e),{totalX:Cf,totalY:Of})),i&&t.emit(nc.END,Object.assign(Object.assign({},i),{totalScale:Pf})),s&&t.emit(sc.END,Object.assign(Object.assign({},s),{totalRotation:Lf})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Df=Il.prototype,Mf=new Gt,Ff=new _t;function If(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function Wf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Df.initType=function(t){vf.run(t,this)},Df.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if(Ff.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Ff.y=0:t.includes("y")?Ff.x=0:Math.abs(Ff.x)>Math.abs(Ff.y)?Ff.y=0:Ff.x=0,i&&t.includes("limit")&&(Mf.set(this.__world).addPoint(this.zoomLayer),Ud.getValidMove(Mf,this.canvas.bounds,"inner",Ff,!0),t.includes("x")?Ff.y=0:t.includes("y")&&(Ff.x=0))}return{x:o?0:Ff.x,y:o?0:Ff.y}},Df.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const zf=kc.prototype;zf.createTransformer=function(){this.transformer=new Af(this)},zf.move=function(t){this.transformer.move(t)},zf.zoom=function(t){this.transformer.zoom(t)},zf.rotate=function(t){this.transformer.rotate(t)},zf.transformEnd=function(){this.transformer.transformEnd()},zf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):Rf.getScale(t,e);if(1!==n)this.zoom(Wf(n,t));else{const s=e.getMove?e.getMove(t,e):Rf.getMove(t,e);i.snap&<.round(s),this.move(If(s,t))}},zf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let o=bf.getData(e),{moving:n,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(bf.detect(o,d(s)?s:{})){case"move":n=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}bf.reset()}n||(o.center=bf.state.center)}else n=r=a=!0;var h,l;Object.assign(t,o.center),t.multiTouch=!0,a&&this.rotate((h=o.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(Wf(o.scale,t)),n&&this.move(If(o.move,t))};const Yf=gc.prototype,{abs:Xf}=Math;function Nf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}Yf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=Xf(i),n=Xf(s),a=e?1:.1,h=this.canAnimate&&this.moving&&(o>a||n>a)&&this.interaction.m.dragAnimate;if(h){const a="touch"===t.pointerType?3:1,l=70;o*(e=e?r(h)?h:.95:a)>l?e=l/o:n*e>l&&(e=l/n),t=Object.assign({},t),lt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},Yf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Yf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Yf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Ht.maxX(r),d=Ht.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let g=0,_=0;this.autoMoveTimer=setInterval(()=>{g+=c,_+=u,lt.move(i,c,u),lt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},Yf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},ne.add("viewport"),ne.add("view"),Il.prototype.zoom=function(t,e,i,n){let a;this.killAnimate(),c(e)?(a=e.padding,i=e.scroll,n=e.transition):a=e;const{zoomLayer:h}=this,u=this.canvas.bounds.clone().shrink(s(a)?30:a),g=new Gt,_={x:u.x+u.width/2,y:u.y+u.height/2};let p;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(o(t))switch(t){case"in":p=Nf(y,"in");break;case"out":p=Nf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Gt(this.boxBounds)).height=0;break;case"fit-height":(t=new Gt(this.boxBounds)).width=0}else r(t)&&(p=t/y);if(p)p=this.getValidScale(p),h.scaleOfWorld(_,p,p,!1,n);else if(d(t)){const e={x:f,y:m,scaleX:y,scaleY:v},s=l(t);if(s||t.tag){const e=s?t:[t];g.setListWithFn(e,_r.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,u);g.set(h.getWorldBounds(e))}const{width:o,height:r}=g;let a=u.x-g.x,d=u.y-g.y;return i?(a+=Math.max((u.width-o)/2,0),d+=Math.max((u.height-r)/2,0)):(p=this.getValidScale(Math.min(u.width/o,u.height/r)),a+=(u.width-o*p)/2,d+=(u.height-r*p)/2,lt.scaleOf(e,g,p),g.scaleOf(g,p),e.scaleX*=p,e.scaleY*=p),"x"===i?d=0:"y"===i&&(a=0),lt.move(e,a,d),g.move(a,d),h.set(e,n),g}return h.worldBoxBounds};class Hf extends Dl{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&&g.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;o(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new Vl,this.scrollYBar=new Vl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Gt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?p.width+6:2,u?_.height+6:2,2]);_.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),p.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Jd.DRAG,this.onDrag,this),e.on_(Jd.DRAG,this.onDrag,this),t.on_(Jd.END,this.onDragEnd,this),e.on_(Jd.END,this.onDragEnd,this),this.target.on_(Kr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(jr.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}ne.add("scroll");class Vf extends _l{}function jf(t){return hn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;kn(this);const e="none"!==t.startArrow||"none"!==t.endArrow;(e||t.__useArrow!==e)&&vn(this)}}}))}let Uf=class extends yd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Gh.register(t,e)}};_e([In(Vf)],Uf.prototype,"__",void 0),_e([jf("angle")],Uf.prototype,"endArrow",void 0),Uf=_e([Gn()],Uf);const{M:Gf,L:Kf,C:qf,Q:Zf,O:Jf}=Le,{rotate:Qf,copyFrom:$f,scale:tm}=lt,em={},im={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Gf:case Kf:sm(t,l+1,e,i,s,o,n,r),l+=3;break;case qf:for(h=1;h<6;h+=2)sm(t,l+h,e,i,s,o,n,r);l+=7;break;case Zf:for(h=1;h<4;h+=2)sm(t,l+h,e,i,s,o,n,r);l+=5;break;case Jf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){im.layout(t,0,0,1,1,e,i)}};function sm(t,e,i,s,o,n,r,a){$f(em,t[e],t[e+1]),r&&Qf(em,r,a),o&&tm(em,o,n),t[e]=i+em.x,t[e+1]=s+em.y}const{layout:om,rotate:nm}=im,{getAngle:rm}=lt,am={x:-.5},hm={connect:am,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},lm={connect:am,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},dm={connect:am,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]},cm={connect:am,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]},um={offset:am,path:[...dm.path],dashPath:[1,-2.5,0,2,-1,0]};nm(um.path,180,{x:-1.5,y:0});const gm={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},_m={connect:{x:.5},path:[...gm.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},pm={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]},fm={path:[...pm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},mm=g.clone(pm),ym=g.clone(fm);nm(mm.path,45),nm(ym.path,45);const vm={angle:hm,"angle-side":lm,arrow:cm,triangle:dm,"triangle-flip":um,circle:_m,"circle-line":gm,square:fm,"square-line":pm,diamond:ym,"diamond-line":mm,mark:{offset:am,path:[1,0,-2,2,0,2]}};function wm(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:c}=t.__;d(e)?e.type?(h=e.scale,a=vm[e.type]):a=e:a=vm[e];const{offset:u,connect:g,path:_,dashPath:p}=a;let f=g?g.x:0,m=u?u.x:0;const y=[..._];return r&&p&&y.push(...p),"none"!==l&&(f-=.5),u&&("round"===c&&u.roundJoin?m+=u.roundJoin:"bevel"===c&&u.bevelJoin&&(m+=u.bevelJoin)),h&&om(y,0,0,h,h),m&&om(y,m,0),om(y,s.x,s.y,o,o,rm(i,s)),n.x=(f+m)*o,y}const{M:xm,L:bm,C:km,Q:Sm,Z:Em,N:Bm,D:Tm,X:Rm,G:Cm,F:Om,O:Pm,P:Lm,U:Am}=Le,{copy:Dm,copyFrom:Mm,getDistancePoint:Fm}=lt,Im={},Wm={},zm={},Ym={},Xm={},Nm={list:vm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case xm:case bm:(c<2||l+6>=d)&&(Mm(Xm,n[l+1],n[l+2]),!c&&u&&Dm(Wm,Xm)),l+=3;break;case km:(1===c||l+7>=d-3)&&Hm(n,Ym,Xm,l+3),l+=7;break;case Sm:(1===c||l+5>=d-3)&&Hm(n,Ym,Xm,l+1),l+=5;break;case Em:return;case Bm:l+=5;break;case Tm:l+=9;break;case Rm:l+=6;break;case Cm:l+=9;break;case Om:l+=5;break;case Pm:l+=7;break;case Lm:l+=4;break;case Am:(1===c||l+6>=d-3)&&(Hm(n,Ym,Xm,l+1),l+6!==d&&(Xm.x-=(Xm.x-Ym.x)/10,Xm.y-=(Xm.y-Ym.y)/10)),l+=6}if(c++,1===c&&h!==xm)return;if(2===c&&u&&Dm(zm,h===bm?Xm:Ym),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=wm(t,e,zm,Wm,s,Im,!!o);o?d.push(...i):r.push(...i),Im.x&&(Fm(Wm,zm,-Im.x,!0),r[1]=zm.x,r[2]=zm.y)}if(i&&"none"!==i){const e=wm(t,i,Ym,Xm,s,Im,!!o);if(o?d.push(...e):r.push(...e),Im.x){let t;switch(Fm(Xm,Ym,-Im.x,!0),h){case bm:t=l-3+1;break;case km:t=l-7+5;break;case Sm:t=l-5+3;break;case Am:t=l-6+3}t&&Vm(r,Ym,t)}}}else Dm(Ym,Xm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Hm(t,e,i,s){Mm(e,t[s],t[s+1]),Mm(i,t[s+2],t[s+3])}function Vm(t,e,i){t[i]=e.x,t[i+1]=e.y}ne.add("arrow"),Al.addAttr("startArrow","none",jf),Al.addAttr("endArrow","none",jf),Object.assign(Gh,Nm),Object.assign(Kh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let jm=class extends Vl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};_e([In(class extends cl{})],jm.prototype,"__",void 0),_e([_n("x")],jm.prototype,"flow",void 0),jm=_e([Gn()],jm);const Um={},Gm={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},Km={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function qm(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;Bt.toPoint(i,e,o,Um),e.x=s.__autoWidth?o.x:Um.x,e.y=s.__autoHeight?o.y:Um.y}const{move:Zm}=lt;function Jm(t,e,i,s,o,n){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),Zm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function Qm(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const $m={};function ty(t,e){const{gap:i,flowAlign:s,flowWrap:n,__autoWidth:r,__autoHeight:a}=t.__,l=n&&(e?!r:!a);return d(i)?($m.xGap=i.x||0,$m.yGap=i.y||0):$m.xGap=$m.yGap=h(i),$m.isAutoXGap=o($m.xGap)&&!r,$m.isAutoYGap=o($m.yGap)&&!a,$m.complex=l||"top-left"!==s||t.__hasGrow||$m.isAutoXGap||$m.isAutoYGap,$m.wrap=l,$m.complex&&($m.isFitXGap="fit"===$m.xGap&&!r,$m.isFitYGap="fit"===$m.yGap&&!a,d(s)?($m.contentAlign=s.content||"top-left",$m.rowXAlign=s.x||"from",$m.rowYAlign=s.y||"from"):($m.contentAlign=s,$m.rowXAlign=Gm[s],$m.rowYAlign=Km[s])),$m}function ey(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function iy(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function sy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:oy}=I;function ny(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=ry(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=ry(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function ry(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?oy(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:ay}=I;function hy(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=ly(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=ly(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function ly(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?ay(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:dy}=lt;function cy(t,e){const i="width",{children:s,itemBox:o}=t,n=ty(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=sy(_,o),r?(_.__flowBounds=p,y||(y=ey(m,g)),a&&y.count&&y.width+p.width>x&&(y.grow?ny(t,y,x,e):d&&iy(y,i,x,c),Qm(u,y,i),y=ey(m,g)),f=p.width,_.__widthGrow&&(y.grow+=_.__widthGrow,f=0,_.__.widthRange&&(y.hasRangeSize=!0)),_.__heightGrow&&ly(_,p,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,p.height),y.count++):(dy(_,v-p.x,w-p.y),v+=p.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:g}=n;y.count&&(y.grow?ny(t,y,x,e):d&&iy(y,i,x,c),a&&Qm(u,y,i)),a?(s?iy(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){qm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Gm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],Jm(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(qm(t,y,r),Jm(t,y,0,y.y,g,e))}}const{move:uy}=lt;function gy(t,e,i,s,o,n){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),uy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:_y}=lt;function py(t,e){const i="height",{children:s,itemBox:o}=t,n=ty(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=sy(_,o),r?(_.__flowBounds=p,y||(y=ey(m,g)),a&&y.count&&y.height+p.height>b&&(y.grow&&hy(t,y,b,e),d&&iy(y,i,b,c),Qm(u,y,i),y=ey(m,g)),f=p.height,_.__heightGrow&&(y.grow+=_.__heightGrow,f=0,_.__.heightRange&&(y.hasRangeSize=!0)),_.__widthGrow&&ry(_,p,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,p.width),y.count++):(_y(_,v-p.x,w-p.y),w+=p.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:g}=n;y.count&&(y.grow&&hy(t,y,b,e),d&&iy(y,i,b,c),a&&Qm(u,y,i)),a?(s?iy(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){qm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Km[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],gy(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(qm(t,y,r),gy(t,y,y.x,0,l,e))}}function fy(t){return hn(t,t=>({set(e){const i=r(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&vn(this)}}))}ne.add("flow","resize");const my=Vl.prototype,{__updateBoxBounds:yy}=Dl.prototype;Al.addAttr("flow",!1,_n),Al.addAttr("gap",0,mn),Al.addAttr("flowAlign","top-left",mn),Al.addAttr("flowWrap",!1,mn),Al.addAttr("itemBox","box",mn),Al.addAttr("inFlow",!0,mn),Al.addAttr("autoWidth",void 0,fy),Al.addAttr("autoHeight",void 0,fy),Al.addAttr("autoBox",void 0,mn);const{copyAndSpread:vy}=Ht;my.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:cy(this);break;case"y":py(this);break;case"x-reverse":cy(this,!0);break;case"y-reverse":py(this,!0)}t&&(this.leafer.created=!0)},my.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),vy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},my.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():yy.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&vy(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:wy,sin:xy,pow:by,sqrt:ky,abs:Sy,ceil:Ey,floor:By,round:Ty,PI:Ry}=Math,Cy=5*Ry,Oy=1.70158,Py=2.5949095,Ly=7.5625,Ay=2.75;function Dy(t){return e=>by(e,t)}function My(t){return e=>1-by(1-e,t)}function Fy(t){return e=>e<.5?.5*by(2*e,t):1-.5*by(2-2*e,t)}function Iy(t){return t<1/Ay?Ly*t*t:t<2/Ay?Ly*(t-=1.5/Ay)*t+.75:t<2.5/Ay?Ly*(t-=2.25/Ay)*t+.9375:Ly*(t-=2.625/Ay)*t+.984375}function Wy(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=zy(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Sy(l)<1e-6));e++)c-=d/l;return o[r]=zy(c,e,s)}}function zy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Yy={get(t){const{list:e}=Yy;return o(t)?e[t||"ease"]:d(t)?e[t.name].apply(e,l(t.value)?t.value:[t.value]):e.ease},register(t,e){Yy.list[t]=e},list:{linear:t=>t,ease:Wy(.25,.1,.25,1),"ease-in":Wy(.42,0,1,1),"ease-out":Wy(0,0,.58,1),"ease-in-out":Wy(.42,0,.58,1),"sine-in":t=>1-wy(t*Ry*.5),"sine-out":t=>xy(t*Ry*.5),"sine-in-out":t=>.5*(1-wy(t*Ry)),"quad-in":Dy(2),"quad-out":My(2),"quad-in-out":Fy(2),"cubic-in":Dy(3),"cubic-out":My(3),"cubic-in-out":Fy(3),"quart-in":Dy(4),"quart-out":My(4),"quart-in-out":Fy(4),"quint-in":Dy(5),"quint-out":My(5),"quint-in-out":Fy(5),"expo-in":t=>t?by(2,10*t-10):0,"expo-out":t=>1===t?1:1-by(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*by(2,2*t*10-10):.5*(2-by(2,10-2*t*10)),"circ-in":t=>1-ky(1-by(t,2)),"circ-out":t=>ky(1-by(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-ky(1-by(2*t,2))):.5*(ky(1-by(2-2*t,2))+1),"back-in":t=>((Oy+1)*t-Oy)*t*t,"back-out":t=>(t-=1)*t*((Oy+1)*t+Oy)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Py+1)*t-Py)*.5:.5*((t=2*t-2)*t*((Py+1)*t+Py)+2),"elastic-in":t=>0===t||1===t?t:-by(2,10*(t-1))*xy((t-1.1)*Cy),"elastic-out":t=>0===t||1===t?t:by(2,-10*t)*xy((t-.1)*Cy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-by(2,10*((t*=2)-1))*xy((t-1.1)*Cy)*.5:by(2,10*(1-(t*=2)))*xy((t-1.1)*Cy)*.5+1,"bounce-in":t=>1-Iy(1-t),"bounce-out":Iy,"bounce-in-out":t=>t<.5?.5*(1-Iy(1-2*t)):.5*(1+Iy(2*t-1)),"cubic-bezier":Wy,steps:function(t,e="floor"){return i=>("floor"===e?By(i*t):"ceil"===e?Ey(i*t):Ty(i*t))/t}}};function Xy(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class Ny{}Ny.CREATED="created",Ny.PLAY="play",Ny.PAUSE="pause",Ny.STOP="stop",Ny.SEEK="seek",Ny.UPDATE="update",Ny.COMPLETED="completed";let Hy=class extends ia{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&r(o)&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=l(e)?e:e?[e]:[];const{easing:o,attrs:n}=this;this.easingFn=Yy.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Ny.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Ny.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Ny.STOP))}seek(t){this.destroyed||(d(t)&&(t=Uh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(Ny.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:s,config:o}=this,{length:n}=s,a=!(n>1)||this.join;let h,l,d,c,u,g=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let o=0;o<n;o++){if(l=s[o],c=l.style||l,h||(h=a?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:a}=l;n&&(d.swing=r(n)?n:2,u=2*d.swing-1),a&&(d.loop=u=r(a)?a:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,_+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,_+=s*u),o&&(d.easingFn=Yy.get(o))}if(!d.autoDuration&&i(d.duration)&&(n>1?o>0||a?_+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}_?((this.duration<=g||!o||!o.duration)&&this.changeDuration(g+.2*_),this.allocateTime((this.duration-g)/_)):g&&this.changeDuration(g),this.emitType(Ny.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,s){const{fromStyle:o,toStyle:n,target:r}=this;for(let a in e)i(o[a])&&(o[a]=n[a]=e===s?s[a]:r[a]),t.beforeStyle[a]=i(s[a])?n[a]:s[a],n[a]=e[a]}allocateTime(t){let e,{frames:s}=this,{length:o}=s;for(let n=0;n<o;n++)e=s[n],i(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),y.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(Ny.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),el.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(Ny.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return r(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};_e([Xy("ease")],Hy.prototype,"easing",void 0),_e([Xy(0)],Hy.prototype,"delay",void 0),_e([Xy(.2)],Hy.prototype,"duration",void 0),_e([Xy("auto")],Hy.prototype,"ending",void 0),_e([Xy(!1)],Hy.prototype,"reverse",void 0),_e([Xy(!1)],Hy.prototype,"swing",void 0),_e([Xy(!1)],Hy.prototype,"loop",void 0),_e([Xy(0)],Hy.prototype,"loopDelay",void 0),_e([Xy(1)],Hy.prototype,"speed",void 0),_e([Xy(!0)],Hy.prototype,"autoplay",void 0),_e([Xy()],Hy.prototype,"join",void 0),_e([Xy()],Hy.prototype,"attrs",void 0),Hy=_e([Un(ga)],Hy);let Vy=class extends Hy{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Hy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(Ny.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Ny.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Ny.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Ny.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Ny.COMPLETED:this.completed&&this.emitType(t);break;case Ny.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};Vy=_e([Un(ga)],Vy);const jy={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Uy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Gy=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,Ky=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,qy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Zy=parseInt,Jy=parseFloat,{round:Qy}=Math;let $y={},tv=0;function ev(t){let e,i,s,o=1;switch(t.length){case 9:e=Zy(t.slice(1,3),16),i=Zy(t.slice(3,5),16),s=Zy(t.slice(5,7),16),o=Zy(t.slice(7,9),16)/255;break;case 7:e=Zy(t.slice(1,3),16),i=Zy(t.slice(3,5),16),s=Zy(t.slice(5,7),16);break;case 5:e=Zy(t[1]+t[1],16),i=Zy(t[2]+t[2],16),s=Zy(t[3]+t[3],16),o=Zy(t[4]+t[4],16)/255;break;case 4:e=Zy(t[1]+t[1],16),i=Zy(t[2]+t[2],16),s=Zy(t[3]+t[3],16);break;case 3:e=i=s=Zy(t[1]+t[2],16);break;case 2:e=i=s=Zy(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const iv=1/6,sv=.5,ov=2/3,nv=1/3;function rv(t,e,i){return i<0?i++:i>1&&i--,i<iv?t+6*(e-t)*i:i<sv?e:i<ov?t+(e-t)*(ov-i)*6:t}function av(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=rv(a,s,t+nv),n=rv(a,s,t),r=rv(a,s,t-nv)}return{r:Qy(255*o),g:Qy(255*n),b:Qy(255*r),a:s}}ne.add("color"),jh.object=function(t,e){let s,n=!i(e)&&e<1;if(o(t)){const e=$y[t];if(e)s=Object.assign({},e);else{switch(t[0]){case"#":s=ev(t);break;case"R":case"r":"("===t[4]&&Gy.test(t)?s=function(t){const e=Gy.exec(t);return{r:Zy(e[1]),g:Zy(e[2]),b:Zy(e[3]),a:Jy(e[4])}}(t):"("===t[3]&&Uy.test(t)&&(s=function(t){const e=Uy.exec(t);return{r:Zy(e[1]),g:Zy(e[2]),b:Zy(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&qy.test(t)?s=function(t){const e=qy.exec(t);return av(Jy(e[1]),Jy(e[2]),Jy(e[3]),Jy(e[4]))}(t):"("===t[3]&&Ky.test(t)&&(s=function(t){const e=Ky.exec(t);return av(Jy(e[1]),Jy(e[2]),Jy(e[3]),1)}(t))}if(!s){const e=jy[t.toLowerCase()];e&&(s=ev("#"+e))}s&&(tv++,tv>1e4&&($y={},tv=0),$y[t]=Object.assign({},s))}}else d(t)&&(i(t.a)&&(t.a=1),n&&(t=Object.assign({},t)),s=t);return s||(s={r:255,g:255,b:255,a:1}),n&&(s.a*=e),s};const{round:hv}=Math,{fourNumber:lv}=I,dv={fill:pv,stroke:pv,cornerRadius:(t,e,i)=>r(t)&&r(e)?gv(t,e,i):(t=lv(t),e=lv(e),t.map((t,s)=>gv(t,e[s],i))),text(t,e,i){if(o(t)&&o(e)){const s=t.length,o=e.length,n=gv(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return r(t)||r(e)?I.float(gv(t,e,i),Math.max(uv(t),uv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return el.setBetweenStyle(o,t,e,o,i,s),o},shadow:fv,innerShadow:fv},cv={value:function(t,e,i){const s=r(t),o=r(e);return s&&o?t+(e-t)*i:o||s?gv(t,e,i):t},number:gv,color:_v,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=el;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,o,n)))}};function uv(t){const e=String(t).split(".")[1];return e?e.length:0}function gv(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?hv(o):o}function _v(t,e,i){t=jh.object(t),e=jh.object(e);const s=gv(t.r,e.r,i,1)+","+gv(t.g,e.g,i,1)+","+gv(t.b,e.b,i,1),o=gv(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function pv(t,e,i){return o(t)&&o(e)?_v(t,e,i):e}function fv(t,e,i){return l(t)||l(e)?e:(e=e||{},{x:gv((t=t||{}).x,e.x,i),y:gv(t.y,e.y,i),blur:gv(t.blur,e.blur,i),spread:gv(t.spread,e.spread,i),color:_v(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ne.add("animate","color"),tl.canAnimate=!0,Object.assign(el.list,dv),Object.assign(el,cv);const mv=Al.prototype;Al.addAttr("animation",void 0,function(t){return hn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Al.addAttr("animationOut",void 0,cn),Al.addAttr("transition",!0,cn),Al.addAttr("transitionOut",void 0,cn),mv.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},mv.animate=function(t,e,s,o){if(i(t))return this.__animate;let n=l(t)&&!e&&s?new Vy(this,t,o):new Hy(this,t,e,o);this.killAnimate(s,n.toStyle);const r=this.__animate;return r&&(n instanceof Vy?n.list.unshift(r):n=new Vy(this,[r,n])),this.__animate=n},mv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof Vy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},mv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Ny.COMPLETED,e)};const yv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],vv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:wv}=Math,{getDerivative:xv}=ni,bv={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,g,_,p=0,f=h/2;for(let h=0;h<yv.length;h++)l=f*(1+yv[h]),d=f*(1-yv[h]),c=xv(l,t,i,o,r),u=xv(l,e,s,n,a),g=xv(d,t,i,o,r),_=xv(d,e,s,n,a),p+=vv[h]*(wv(c*c+u*u)+wv(g*g+_*_));return p*f},getRotation(t,e,i,s,o,n,r,a,h){const l=xv(t,e,s,n,a),d=xv(t,i,o,r,h);return Math.atan2(d,l)/z},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,g=t/e,_=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>_;)kv(i,s,o,n,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,g=d*o+e*r,_=d*n+e*a,p=d*c+e*g,f=d*u+e*_,m=d*p+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*_+e*(d*a+e*l));t.push(Le.C,c,u,p,f,m,y)}},{getDistance:kv}=bv,{M:Sv,L:Ev,C:Bv,Z:Tv}=Le,Rv={},Cv={},Ov={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Sv:case Ev:Ov.transformPoints(t,e,s,1),s+=3;break;case Bv:Ov.transformPoints(t,e,s,3),s+=7;break;case Tv:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Rv.x=t[o],Rv.y=t[o+1],Q.toOuterPoint(e,Rv),t[o]=Rv.x,t[o+1]=Rv.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Sv:case Ev:i=t[a+1],s=t[a+2],e=o===Ev&&a>0?lt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Bv:i=t[a+5],s=t[a+6],e=bv.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Tv:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=Uh.number(e,t.total);let n,r,a,h,l,d,c,u,g,_=0,p={},f=0,m=0,y=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Sv:case Ev:if(r=o[f+1],a=o[f+2],n=s[m],_+n>=e||!t.total)return f||(y=r,v=a),Cv.x=y,Cv.y=v,p.x=r,p.y=a,lt.getDistancePoint(Cv,p,e-_,!0),p.rotation=lt.getAngle(Cv,p),p;y=r,v=a,f+=3;break;case Bv:if(r=o[f+5],a=o[f+6],n=s[m],_+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],g=bv.getT(e-_,n,y,v,l,d,c,u,r,a,i),ni.getPointAndSet(g,y,v,l,d,c,u,r,a,p),p.rotation=bv.getRotation(g,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Tv:f+=1;default:n=0}m++,_+=n}return p},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Uh.number(e,t.total);let r,a,h,l,d,c,u,g,_,p=0,f={},m=0,y=0,v=0,w=0;const x=o.length;for(;m<x;){switch(l=o[m],l){case Sv:case Ev:if(a=o[m+1],h=o[m+2],r=s[y],p+r>=e||!t.total)return m||(v=a,w=h),Cv.x=v,Cv.y=w,f.x=a,f.y=h,lt.getDistancePoint(Cv,f,e-p,!0),n.push(l,f.x,f.y),n;v=a,w=h,m+=3,n.push(l,v,w);break;case Bv:if(d=o[m+1],c=o[m+2],u=o[m+3],g=o[m+4],a=o[m+5],h=o[m+6],r=s[y],p+r>=e)return _=bv.getT(e-p,r,v,w,d,c,u,g,a,h,i),bv.cut(n,_,v,w,d,c,u,g,a,h),n;v=a,w=h,m+=7,n.push(l,d,c,u,g,a,h);break;case Tv:m+=1,n.push(l);default:r=0}y++,p+=r}return n}};function Pv(t){return hn(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!s(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ne.add("motion-path"),el.register("motion",function(t,e,i,s){return d(t)&&(t=Uh.number(t,s.getMotionTotal())),d(e)&&(e=Uh.number(e,s.getMotionTotal())),el.number(t||0,e||0,i)}),el.register("motionRotation",function(t,e,i){return el.number(t,e,i)});const Lv=Al.prototype,{updateMatrix:Av,updateAllMatrix:Dv}=rr,{updateBounds:Mv}=yr;function Fv(t){const{motion:e,leaferIsCreated:i}=t;if(!s(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=Wv(t);i.total&&(t.__.__pathForRender=Ov.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Dv(t),Mv(t,t)):Av(t));i&&(t.leafer.created=!0)}}function Iv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function Wv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Ov.getMotionPathData(t.getPath(!0,!0))}function zv(t,e){return hn(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?tl.setStyleName(this,e,i):tl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Yv(t){return hn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Xv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function Nv(t,e){d(e)||(e=void 0),jv(t,e,"in")}function Hv(t,e){const{normalStyle:i}=t;d(e)||(e=void 0),i&&(e||(e=i),jv(t,e,"out"))}Al.addAttr("motionPath",void 0,Pv),Al.addAttr("motionPrecision",1,Pv),Al.addAttr("motion",void 0,Pv),Al.addAttr("motionRotation",!0,Pv),Lv.getMotionPathData=function(){return Wv(Iv(this))},Lv.getMotionPoint=function(t){const e=Iv(this),i=Wv(e);if(!i.total)return{};const s=Ov.getDistancePoint(i,t,e.motionPrecision);Q.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:r(o)&&(s.rotation+=o),s},Lv.getMotionTotal=function(){return this.getMotionPathData().total},Lv.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],s(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Fv(t))}else Fv(this)};const Vv={};function jv(t,e,i){const{normalStyle:o}=t;e||(e=Vv),e.scale&&(I.assignScale(e,e.scale),delete e.scale),e!==Vv&&tl.canAnimate||(i=null);let n=!!i&&function(t,e,i){let o="in"===t?"transition":"transitionOut";"out"===t&&s(i[o])&&s(e[o])&&(o="transition");return s(e[o])?i[o]:e[o]}(i,e,t);const r=n?function(t,e){const i=Kv(e,t),s=t.animate();s&&Kv(i,t,s.fromStyle);return i}(t,e):void 0;tl.canAnimate&&Uv(t)&&t.killAnimate("transition"),o&&t.set(o,"temp");const a=Uv(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=Gv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=Gv(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Uv(t){let e;const i={},s=Xv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&tl.isState(o,t,s)&&(e=qv(i,n));const r=i.selectedStyle||t.selectedStyle;r&&tl.isSelected(t,s)&&(e=qv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&tl.isPlacehold(t,s)&&(e=qv(i,a)),tl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=qv(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&tl.isFocus(t,s)&&(e=qv(i,o));const n=i.hoverStyle||t.hoverStyle;n&&tl.isHover(t,s)&&(e=qv(i,n));const r=i.pressStyle||t.pressStyle;r&&tl.isPress(t,s)&&(e=qv(i,r))}return e?i:void 0}function Gv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&tl.animateExcludes[t]||(o[t]=e[t]);return o}function Kv(t,e,i){return Gv(t,e,i,!0)}function qv(t,e){return Object.assign(t,e),!0}function Zv(t,e){const i=t[e];i&&Nv(t,i),t.button&&Qv(t.children,e)}function Jv(t,e,i){i||(i=t.states[e]),Nv(t,i),t.button&&Qv(t.children,null,e)}function Qv(t,e,s){if(!t)return;let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],e){switch(n=!0,e){case"hoverStyle":tl.isHover(o)&&(n=!1);break;case"pressStyle":tl.isPress(o)&&(n=!1);break;case"focusStyle":tl.isFocus(o)&&(n=!1)}n&&Zv(o,e)}else i(s)||Jv(o,s);o.isBranch&&Qv(o.children,e,s)}}function $v(t,e){const i=t[e];i&&Hv(t,i),t.button&&ew(t.children,e)}function tw(t,e,i){Hv(t,i),t.button&&ew(t.children,null,e)}function ew(t,e,s){if(!t)return;let o;for(let n=0,r=t.length;n<r;n++)o=t[n],e?$v(o,e):i(s)||tw(o,s),o.isBranch&&ew(o.children,e,s)}function iw(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=Xv(e,i);n&&(s=o[t](n))}return s}function sw(t,e,i){let s=e[t];if(!s&&i){const o=Xv(e,i);o&&(s=o[t])}return s}ne.add("state"),tl.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},tl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=Xv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},tl.isSelected=function(t,e){return sw("selected",t,e)},tl.isDisabled=function(t,e){return sw("disabled",t,e)},tl.isFocus=function(t,e){return iw("isFocus",t,e)},tl.isHover=function(t,e){return iw("isHover",t,e)},tl.isPress=function(t,e){return iw("isPress",t,e)},tl.isPlacehold=function(t,e){return t.__.__isPlacehold},tl.isDrag=function(t,e){return iw("isDrag",t,e)},tl.setStyleName=function(t,e,i){i?Jv(t,e,t[e]):tw(t,e,t[e])},tl.set=function(t,e){const i=t.states[e];i?Jv(t,e,i):tw(t,e,i)},tl.getStyle=Uv,tl.updateStyle=jv,tl.updateEventStyle=function(t,e){switch(e){case Kd.ENTER:Zv(t,"hoverStyle");break;case Kd.LEAVE:$v(t,"hoverStyle");break;case Kd.DOWN:Zv(t,"pressStyle");break;case Kd.UP:$v(t,"pressStyle")}};const ow=Al.prototype;Al.addAttr("selected",!1,zv,"selectedStyle"),Al.addAttr("disabled",!1,zv,"disabledStyle"),Al.addAttr("states",{},Yv),Al.addAttr("state","",zv),Al.addAttr("normalStyle",void 0,cn),Al.addAttr("hoverStyle",void 0,Yv),Al.addAttr("pressStyle",void 0,Yv),Al.addAttr("focusStyle",void 0,Yv),Al.addAttr("selectedStyle",void 0,Yv),Al.addAttr("disabledStyle",void 0,Yv),Al.addAttr("placeholderStyle",void 0,Yv),Al.addAttr("button",!1,cn),ow.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},ow.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Zv(this,"focusStyle"):$v(this,"focusStyle")})},ow.updateState=function(){tl.updateStyle(this,void 0,"in")};const nw=Td.prototype,rw="text";nn(nw,rw,Object.assign(Object.assign({},rn(nw,rw)),{set(t){const e=this,i=e.text;e.__setAttr(rw,t)&&(vn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class aw extends hl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let hw=class extends Al{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;l(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!i(t))if(r(t))this.now=t;else if(d(t)){const e=l(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=$o.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:o,size:n,total:a}=e,{width:h,height:l}=n&&(r(n)?{width:n,height:n}:n)||(a>1?this:t);let d=o?o.x:0,c=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Wr(Wr.LOADED,{image:t}))}__runAction(t,e){let{FPS:s,loop:o,__action:n}=this;n&&(n.FPS&&(s=n.FPS),i(n.loop)||(o=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!o)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/s)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};_e([In(aw)],hw.prototype,"__",void 0),_e([mn()],hw.prototype,"robot",void 0),_e([cn()],hw.prototype,"actions",void 0),_e([cn("")],hw.prototype,"action",void 0),_e([Bn(0)],hw.prototype,"now",void 0),_e([cn(12)],hw.prototype,"FPS",void 0),_e([cn(!0)],hw.prototype,"loop",void 0),hw=_e([Gn()],hw),ne.add("robot");const{Yes:lw,NoAndSkip:dw,YesAndSkip:cw}=t,uw={},gw={},_w={};class pw{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,s,o){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return s?n:n?[n]:[];case"string":switch(t[0]){case"#":uw.id=t.substring(1),t=uw;break;case".":gw.className=t.substring(1),t=gw;break;default:_w.tag=t,t=_w}case"object":if(i(t.id)){if(t.tag){const{tag:i}=t,o=l(i);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,s,o?g.toMap(i):i)}return this.getByMethod(this.methods.className,e,s,t.className)}{const i=this.getById(t.id,e);return s?i:i?[i]:[]}case"function":return this.getByMethod(t,e,s,o)}}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&&rr.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===lw||n===cw){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<dw&&this.eachFind(o.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Dr.REMOVE,this.__onRemoveChild,this),this.target.on_(Fr.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 fw=Al.prototype;function mw(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=re.selector())}fw.find=function(t,e){return mw(this).getBy(t,this,!1,e)},fw.findOne=function(t,e){return mw(this).getBy(t,this,!0,e)},ne.add("find"),re.finder=function(t){return new pw(t)};const{setPoint:yw,addPoint:vw,toBounds:ww}=yt;const xw={syncExport(t,e,s){let o;$h.running=!0;try{const n=jo.fileType(e),r=e.includes(".");s=jo.getExportOptions(s);const{toURL:a}=y,{download:h}=y.origin;if("json"===n)r&&h(a(JSON.stringify(t.toJSON(s.json)),"text"),e),o={data:!!r||t.toJSON(s.json)};else if("svg"===n)r&&h(a(t.toSVG(),"svg"),e),o={data:!!r||t.toSVG()};else{let n,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:_,trim:p,screenshot:f,padding:m,onCanvas:v}=s,w=i(s.smooth)?!c||c.config.smooth:s.smooth,x=s.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&i(s.fill)?t.fill:s.fill,k=jo.isOpaqueImage(e)||b,S=new ft;if(f)n=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=s.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}n=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};I.getScaleData(s.scale,s.size,n,E);let B=s.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Gt(n).scale(E.scaleX,E.scaleY);_&&(T+=_.x,R+=_.y,C=_.width,O=_.height);const P={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let L,A=re.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});g&&(L=t,L.__worldOpacity=0,t=c||t,P.bounds=A.bounds),A.save();const D=u&&!i(b),M=t.get("fill");if(D&&(t.fill=""),y.render(t,A,P),D&&(t.fill=M),A.restore(),L&&L.__updateWorldOpacity(),p){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?vw(r,o,n):yw(r={},o,n)),a++;const h=new Gt;return r&&(ww(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=re.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=I.fourNumber(m),o=A,{width:n,height:r}=o;A=re.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),v&&v(A);o={data:"canvas"===e?A:A.export(e,s),width:A.pixelWidth,height:A.pixelHeight,renderBounds:n,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){o={data:"",error:t}}return $h.running=!1,o},export(t,e,i){return $h.running=!0,function(t){bw||(bw=new qo);return new Promise(e=>{bw.add(()=>pe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(o=>{const n=()=>pe(this,void 0,void 0,function*(){if(!Jo.isComplete)return y.requestRender(n);const r=$h.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),o()});t.updateLayout(),kw(t);const{leafer:r}=t;r?r.waitViewCompleted(n):n()}))}};let bw;function kw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>kw(t))}const Sw=Ce.prototype,Ew=Qt.get("@leafer-in/export");Sw.export=function(t,e){const{quality:i,blob:s}=jo.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Sw.toBlob=function(t,e){return new Promise(i=>{y.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Ew.error(t),i(null)})})},Sw.toDataURL=function(t,e){return y.origin.canvasToDataURL(this.view,t,e)},Sw.saveAs=function(t,e){return new Promise(i=>{y.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Ew.error(t),i(!1)})})},ne.add("export"),Object.assign($h,xw),Al.prototype.export=function(t,e){return $h.export(this,t,e)},Al.prototype.syncExport=function(t,e){return $h.syncExport(this,t,e)},ne.add("filter"),Object.assign(Qh,{list:{},register(t,e){Qh.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach(t=>{r=Qh.list[t.type],r&&r.apply(t,e,i,s,o,n)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=Qh.list[t.type],e&&(i+=e.getSpread(t))}),i}}),ne.add("bright"),Al.addAttr("bright",!1,Tn);export{Bt as AlignHelper,Hy as Animate,Yy as AnimateEasing,Ny as AnimateEvent,Vy as AnimateList,t as Answer,Od as App,kt as AroundHelper,Uf as Arrow,Vf as ArrowData,qt as AutoBounds,ni as BezierHelper,Gt as Bounds,zr as BoundsEvent,Ht as BoundsHelper,Vl as Box,cl as BoxData,ph as Branch,yr as BranchHelper,Aa as BranchRender,xd as Canvas,Sl as CanvasData,ge as CanvasManager,Dr as ChildEvent,jh as ColorConvert,re as Creator,Sc as Cursor,g as DataHelper,Qt as Debug,wt as Direction4,xt as Direction9,Ud as DragBoundsHelper,Jd as DragEvent,gc as Dragger,$d as DropEvent,rp as EditBox,Q_ as EditDataHelper,sp as EditPoint,z_ as EditSelect,M_ as EditSelectHelper,Dp as EditTool,vp as EditToolCreator,Lp as Editor,S_ as EditorEvent,bp as EditorGroupEvent,pp as EditorHelper,Tp as EditorMoveEvent,Cp as EditorRotateEvent,Rp as EditorScaleEvent,Op as EditorSkewEvent,Jh as Effect,ql as Ellipse,fl as EllipseData,_i as EllipseHelper,Ar as Event,ce as EventCreator,ia as Eventer,$h as Export,jo as FileHelper,Qh as Filter,pw as Finder,jm as Flow,T as FourNumberHelper,jl as Frame,gl as FrameData,Dl as Group,dl as GroupData,bv as HighBezierHelper,Ov as HighCurveHelper,Ec as HitCanvasManager,vd as Image,kl as ImageData,Wr as ImageEvent,$o as ImageManager,w as IncrementId,Ap as InnerEditor,xp as InnerEditorEvent,Xc as Interaction,kc as InteractionBase,ac as InteractionHelper,rc as KeyEvent,Ld as Keyboard,Gr as LayoutEvent,Dh as Layouter,nh as Leaf,Oa as LeafBounds,_r as LeafBoundsHelper,p as LeafData,pa as LeafDataProxy,ga as LeafEventer,rr as LeafHelper,Lr as LeafLayout,mh as LeafLevelList,fh as LeafList,ba as LeafMatrix,Pa as LeafRender,Il as Leafer,vh as LeaferCanvas,Ce as LeaferCanvasBase,ul as LeaferData,qr as LeaferEvent,on as LeaferImage,vf as LeaferTypeCreator,yd as Line,_l as LineData,Yp as LineEditTool,I as MathHelper,ft as Matrix,Q as MatrixHelper,tc as MoveEvent,bf as MultiTouchHelper,Qd as MyDragEvent,wd as MyImage,qd as MyPointerEvent,ic as MyTouchEvent,De as NeedConvertToCanvasCommandMap,z as OneRadian,Y as PI2,X as PI_2,Kh as Paint,Zh as PaintGradient,qh as PaintImage,Rd as Path,Gh as PathArrow,Nm as PathArrowModule,Ao as PathBounds,bs as PathCommandDataHelper,Le as PathCommandMap,pi as PathCommandNodeHelper,$i as PathConvert,Yo as PathCorner,zs as PathCreator,vl as PathData,to as PathDrawer,Oe as PathHelper,im as PathMatrixHelper,We as PathNumberCommandLengthMap,Ie as PathNumberCommandMap,tf as PathScaler,Cd as Pen,wl as PenData,Wh as Picker,y as Platform,ne as Plugin,_t as Point,lt as PointHelper,Ad as PointerButton,Kd as PointerEvent,sd as Polygon,ml as PolygonData,Fr as PropertyEvent,Wl as Rect,pl as RectData,ze as RectHelper,Pl as RectRender,Kr as RenderEvent,Fh as Renderer,jr as ResizeEvent,Jo as Resource,hw as Robot,aw as RobotData,sc as RotateEvent,ie as Run,Hf as ScrollBar,D_ as SelectArea,zh as Selector,dd as Star,yl as StarData,tl as State,Zt as StringNumberMap,A_ as Stroker,oc as SwipeEvent,Ko as TaskItem,qo as TaskProcessor,Td as Text,Vh as TextConvert,bl as TextData,ec as TouchEvent,Pp as TransformTool,Af as Transformer,el as Transition,yt as TwoPointBoundsHelper,Al as UI,Tl as UIBounds,he as UICreator,hl as UIData,Dd as UIEvent,Cl as UIRender,Uh as UnitConvert,br as WaitHelper,Ur as WatchEvent,kh as Watcher,Rf as WheelEventHelper,nc as ZoomEvent,ff as addViewport,mf as addViewportConfig,En as affectRenderBoundsType,bn as affectStrokeBoundsType,jf as arrowType,ln as attr,_n as autoLayoutType,mn as boundsType,Vo as canvasPatch,Re as canvasSizeAttrs,Hh as createAttr,an as createDescriptor,Fn as cursorType,In as dataProcessor,cn as dataType,hn as decorateLeafAttr,zn as defineDataProcessor,nn as defineKey,dn as defineLeafAttr,Tn as dimType,vn as doBoundsType,kn as doStrokeType,Yh as effectType,e as emptyData,Dn as eraserType,Ir as extraPropertyEventMap,H as getBoundsData,rn as getDescriptor,V as getMatrixData,N as getPointData,Mn as hitType,l as isArray,c as isData,u as isEmptyData,n as isFinite,s as isNull,r as isNumber,d as isObject,o as isString,i as isUndefined,Wn as layoutProcessor,ta as leaferTransformAttrMap,An as maskType,Pv as motionPathType,yn as naturalBoundsType,Rn as opacityType,Xo as path,wn as pathInputType,xn as pathType,No as pen,un as positionType,mp as registerEditTool,yp as registerInnerEditor,Gn as registerUI,Kn as registerUIEvent,Xh as resizeType,Hn as rewrite,Vn as rewriteAble,fn as rotationType,df as scaleResize,cf as scaleResizeFontSize,_f as scaleResizeGroup,uf as scaleResizePath,gf as scaleResizePoints,pn as scaleType,gn as scrollType,Ln as sortType,Yv as stateStyleType,zv as stateType,Sn as strokeType,Bn as surfaceType,Kt as tempBounds,mt as tempMatrix,pt as tempPoint,h as tryToNumber,bh as useCanvas,Un as useModule,yh as version,Cn as visibleType,Nh as zoomLayerType};
|
|
1
|
+
var t,e;!function(t){t[t.none=1]="none",t[t.free=2]="free",t[t.mirrorAngle=3]="mirrorAngle",t[t.mirror=4]="mirror"}(t||(t={})),function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function o(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:r}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function g(t){return"{}"===JSON.stringify(t)}const _={default:(t,e)=>(p(e,t),p(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return p(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&p(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(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:p}=_;class f{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(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let o in this)"_"!==o[0]&&(i=e?e[o]:void 0,t[o]=s(i)?this[o]: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(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(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:o}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=o?o[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}const{floor:m,max:y}=Math,v={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",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||w.maxCacheSize),isSuperLarge:(t,e,i)=>w.isLarge(t,e,i,w.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,o,n,r,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(o||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==r,n){const s=e/n.width,o=i/n.height;d.setTransform(s,0,0,o,-n.x*s,-n.y*o),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&_.stintSet(i,"transform",e)}}},{image:w}=v,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=b;return e[t]?e[t]++:(e[t]=1,0)}},b=x;let k,S,E;const{max:B}=Math,T=[0,0,0,0],R={zero:[...T],tempFour:T,set:(t,e,i,s,o)=>(void 0===i&&(i=s=o=e),t[0]=e,t[1]=i,t[2]=s,t[3]=o,t),setTemp:(t,e,i,s)=>C(T,t,e,i,s),toTempAB(t,e,i){E=i?a(t)?e:t:[],a(t)?(k=P(t),S=e):a(e)?(k=t,S=P(e)):(k=t,S=e),4!==k.length&&(k=O(k)),4!==S.length&&(S=O(S))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(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]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?B(t,e):(L(t,e,i),C(E,B(k[0],S[0]),B(k[1],S[1]),B(k[2],S[2]),B(k[3],S[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(L(t,e,i),C(E,k[0]+S[0],k[1]+S[1],k[2]+S[2],k[3]+S[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const o=s?t:[],[n,r,h,l]=4===t.length?t:O(t);return C(o,h*i,l*e,n*i,r*e)}},{set:C,get:O,setTemp:P,toTempAB:L}=R,{round:A,pow:D,max:M,floor:F,PI:I}=Math,W={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:R.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.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=s(e)?1e12:D(10,e);return-0===(t=A(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,o=(a(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>M(F(t),e)/t,randInt:z,randColor:t=>`rgba(${z(255)},${z(255)},${z(255)},${t||1})`};function z(t){return Math.round(Math.random()*t)}const Y=I/180,X=2*I,N=I/2;function H(){return{x:0,y:0}}function V(){return{x:0,y:0,width:0,height:0}}function j(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:U,cos:G,acos:K,sqrt:q}=Math,{float:Z}=W,J={};function Q(){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 $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Q(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:j,getWorld:Q,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=G(e*=Y),a=U(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=Y,t.a=s+n*i,t.b=o+r*i),e&&(e*=Y,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,o,n){const{e:r,f:a}=t;if(i||(i=t),s(o)&&(o=1!==t.a||t.b||t.c||1!==t.d),o){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,o,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:o}=e,n=i*Y,r=G(n),a=U(n);if(s||o){const e=s*Y,i=o*Y;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||o)&&tt.translateInner(t,-i.x,-i.y,!o)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,g,_,p=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=q(o*o+n*n),c=t/d;const e=o/d;u=n>0?K(e):-K(e)}else{c=q(r*r+a*a),d=t/c;const e=r/c;u=N-(a>0?K(-e):-K(e))}const e=Z(G(u)),i=U(u);d=Z(d),c=Z(c),g=e?Z((r/c+i)/e/Y,9):0,_=e?Z((n/d-i)/e/Y,9):0,u=Z(u/Y)}else d=o,c=a,u=g=_=0;return(e=i||e)&&(p+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(p-=e.x,f-=e.y)),{x:p,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=q(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=$,{toInnerPoint:et,toOuterPoint:it}=$,{sin:st,cos:ot,abs:nt,sqrt:rt,atan2:at,min:ht,round:lt}=Math,dt={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=s(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?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(t.y)},move(t,e,i){c(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=ct.defaultPoint);const s=ot(e*=Y),o=st(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return gt(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return gt(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return gt(i,t),ct.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(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)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=nt(i-t),n=nt(s-e);return rt(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>ht(ut(t,e,i,s),ut(i,s,o,n)),getAngle:(t,e)=>_t(t,e)/Y,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/Y),getRadianFrom(t,e,i,o,n,r,a,h){s(a)&&(a=i,h=o);const l=t-i,d=e-o,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,o){const n=_t(t,e);return o&&(t=e),s||(e={}),e.x=t.x+ot(n)*i,e.y=t.y+st(n)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:gt,getAtan2:_t}=ct;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new pt(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(dt.getDistancePoint(this,t,e,i,s))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t){return dt.isSame(this,t)}reset(){return dt.reset(this),this}}const ft=new pt;class mt{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return c(t)?$.copy(this,t):$.set(this,t,e,i,s,o,n),this}setWith(t){return $.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new mt(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const yt=new mt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,o){wt(t,e,i),wt(t,e+s,i+o)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:wt}=vt;var xt,bt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(xt||(xt={})),function(t){t[t.topLeft=0]="topLeft",t[t.top=1]="top",t[t.topRight=2]="topRight",t[t.right=3]="right",t[t.bottomRight=4]="bottomRight",t[t.bottom=5]="bottom",t[t.bottomLeft=6]="bottomLeft",t[t.left=7]="left",t[t.center=8]="center",t[t["top-left"]=0]="top-left",t[t["top-right"]=2]="top-right",t[t["bottom-right"]=4]="bottom-right",t[t["bottom-left"]=6]="bottom-left"}(bt||(bt={}));const kt=[{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}];kt.forEach(t=>t.type="percent");const St={directionData:kt,tempPoint:{},get:Et,toPoint(t,e,i,s,o,n){const r=Et(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),St.toPoint(t,e,i,!0),i)};function Et(t){return n(t)?kt[bt[t]]:t}const{toPoint:Bt}=St,Tt={toPoint(t,e,i,s,o,n){Bt(t,i,s,o,e,n)}},{tempPointBounds:Rt,setPoint:Ct,addPoint:Ot,toBounds:Pt}=vt,{toOuterPoint:Lt}=$,{float:At,fourNumber:Dt}=W,{floor:Mt,ceil:Ft}=Math;let It,Wt,zt,Yt;const Xt={},Nt={},Ht={},Vt={tempBounds:Ht,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(d(i)){const e=Dt(i);s?jt.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Ht,t),jt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o,e:n,f:r}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),o>0?(i.height=t.height*o,i.y=r+t.y*o):(i.height=t.height*-o,i.y=r+t.y*o-i.height)}else Xt.x=t.x,Xt.y=t.y,Lt(e,Xt,Nt),Ct(Rt,Nt.x,Nt.y),Xt.x=t.x+t.width,Lt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Xt.y=t.y+t.height,Lt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Xt.x=t.x,Lt(e,Xt,Nt),Ot(Rt,Nt.x,Nt.y),Pt(Rt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new mt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,r){r||(r=e),n(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Ht.width=o?e.width*=s:e.width*s,Ht.height=o?e.height*=s:e.height*s,Tt.toPoint(i,Ht,t,r,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Mt(t.x),t.y=Mt(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(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=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){It=t.x+t.width,Wt=t.y+t.height,zt=e.x,Yt=e.y,i||(zt+=e.width,Yt+=e.height),It=It>zt?It:zt,Wt=Wt>Yt?Wt:Yt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=It-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Gt(t,o)):Ut(t,o));n&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Rt,t.x,t.y):Ot(Rt,t.x,t.y)),Pt(Rt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Ut(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},hitRadiusPoint:(t,e,i)=>(i&&(e=dt.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=dt.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=jt.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=jt.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=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return It=s+n,Wt=o+r,zt=t.x+t.width,Yt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,It=It<zt?It:zt,Wt=Wt<Yt?Wt:Yt,n=It-s,r=Wt-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){jt.copy(t,jt.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){jt.set(t)}},jt=Vt,{add:Ut,copy:Gt}=jt;class Kt{get minX(){return Vt.minX(this)}get minY(){return Vt.minY(this)}get maxX(){return Vt.maxX(this)}get maxY(){return Vt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Vt.copy(this,t):Vt.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 Kt(this)}move(t,e){return Vt.move(this,t,e),this}scale(t,e,i){return Vt.scale(this,t,e,i),this}scaleOf(t,e,i){return Vt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Vt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Vt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Vt.getFitMatrix(this,t,e)}put(t,e,i){Vt.put(this,t,e,i)}spread(t,e){return Vt.spread(this,t,e),this}shrink(t,e){return Vt.shrink(this,t,e),this}ceil(){return Vt.ceil(this),this}unsign(){return Vt.unsign(this),this}float(t){return Vt.float(this,t),this}add(t){return Vt.add(this,t),this}addList(t){return Vt.setList(this,t,!0),this}setList(t){return Vt.setList(this,t),this}addListWithFn(t,e){return Vt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Vt.setListWithFn(this,t,e),this}setPoint(t){return Vt.setPoint(this,t),this}setPoints(t){return Vt.setPoints(this,t),this}addPoint(t){return Vt.addPoint(this,t),this}getPoints(){return Vt.getPoints(this)}hitPoint(t,e){return Vt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Vt.hitRadiusPoint(this,t,e)}hit(t,e){return Vt.hit(this,t,e)}includes(t,e){return Vt.includes(this,t,e)}intersect(t,e){return Vt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(Vt.getIntersectData(this,t,e))}isSame(t){return Vt.isSame(this,t)}isEmpty(){return Vt.isEmpty(this)}reset(){Vt.reset(this)}}const qt=new Kt;class Zt{constructor(t,e,i,s,o,n){c(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Kt(o,e,n||t.width-o-i,r||t.height-e-s)}}const Jt={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:Qt}=W;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=te(t)}static set exclude(t){this.excludeList=te(t)}static drawRepaint(t,e){const i=Qt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===$t.showBounds,o=t.__nowWorld,n=Qt();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(ee.enable){if(ee.filterList.length&&ee.filterList.every(t=>t!==this.name))return;if(ee.excludeList.length&&ee.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ee.enable&&this.warn(...t)}warn(...t){ee.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 te(t){return t?n(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const ee=$t,ie=$t.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return oe.currentId=oe.idMap[i]=e?performance.now():Date.now(),oe.currentName=oe.nameMap[i]=t,oe.nameToIdMap[t]=i,i},end(t,e){const i=oe.idMap[t],s=oe.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;oe.idMap[t]=oe.nameMap[t]=oe.nameToIdMap[s]=void 0,ie.log(s,o,"ms")},endOfName(t,e){const i=oe.nameToIdMap[t];s(i)||oe.end(i,e)}},oe=se,ne=[],re={list:{},add(t,...e){this.list[t]=!0,ne.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(()=>ne.forEach(t=>re.has(t,!0)));const ae={editor:t=>re.need("editor")},he=$t.get("UICreator"),le={list:{},register(t){const{__tag:e}=t.prototype;de[e]&&he.repeat(e),de[e]=t},get(t,e,i,o,n,r){de[t]||he.error("not register "+t);const a=new de[t](e);return s(i)||(a.x=i,o&&(a.y=o),n&&(a.width=n),r&&(a.height=r)),a}},{list:de}=le,ce=$t.get("EventCreator"),ue={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ge[e]&&ce.repeat(e),ge[e]=t)})},changeName(t,e){const i=ge[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ge[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ge[t](...e)},{nameList:ge}=ue;class _e{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ae.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 pe(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function fe(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}function me(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 ye=[];function ve(){return(t,e)=>{ye.push(e)}}const we=[];let xe=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||we)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};pe([me("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),pe([me("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),pe([me("globalAlpha")],xe.prototype,"opacity",void 0),pe([me()],xe.prototype,"fillStyle",void 0),pe([me()],xe.prototype,"strokeStyle",void 0),pe([me("lineWidth")],xe.prototype,"strokeWidth",void 0),pe([me("lineCap")],xe.prototype,"strokeCap",void 0),pe([me("lineJoin")],xe.prototype,"strokeJoin",void 0),pe([me("lineDashOffset")],xe.prototype,"dashOffset",void 0),pe([me()],xe.prototype,"miterLimit",void 0),pe([me()],xe.prototype,"shadowBlur",void 0),pe([me()],xe.prototype,"shadowColor",void 0),pe([me()],xe.prototype,"shadowOffsetX",void 0),pe([me()],xe.prototype,"shadowOffsetY",void 0),pe([me()],xe.prototype,"filter",void 0),pe([me()],xe.prototype,"font",void 0),pe([me()],xe.prototype,"fontKerning",void 0),pe([me()],xe.prototype,"fontStretch",void 0),pe([me()],xe.prototype,"fontVariantCaps",void 0),pe([me()],xe.prototype,"textAlign",void 0),pe([me()],xe.prototype,"textBaseline",void 0),pe([me()],xe.prototype,"textRendering",void 0),pe([me()],xe.prototype,"wordSpacing",void 0),pe([me()],xe.prototype,"letterSpacing",void 0),pe([me()],xe.prototype,"direction",void 0),pe([ve()],xe.prototype,"setTransform",null),pe([ve()],xe.prototype,"resetTransform",null),pe([ve()],xe.prototype,"getTransform",null),pe([ve()],xe.prototype,"save",null),pe([ve()],xe.prototype,"restore",null),pe([ve()],xe.prototype,"translate",null),pe([ve()],xe.prototype,"scale",null),pe([ve()],xe.prototype,"rotate",null),pe([ve()],xe.prototype,"fill",null),pe([ve()],xe.prototype,"stroke",null),pe([ve()],xe.prototype,"clip",null),pe([ve()],xe.prototype,"fillRect",null),pe([ve()],xe.prototype,"strokeRect",null),pe([ve()],xe.prototype,"clearRect",null),pe([ve()],xe.prototype,"beginPath",null),pe([ve()],xe.prototype,"moveTo",null),pe([ve()],xe.prototype,"lineTo",null),pe([ve()],xe.prototype,"bezierCurveTo",null),pe([ve()],xe.prototype,"quadraticCurveTo",null),pe([ve()],xe.prototype,"closePath",null),pe([ve()],xe.prototype,"arc",null),pe([ve()],xe.prototype,"arcTo",null),pe([ve()],xe.prototype,"ellipse",null),pe([ve()],xe.prototype,"rect",null),pe([ve()],xe.prototype,"roundRect",null),pe([ve()],xe.prototype,"createConicGradient",null),pe([ve()],xe.prototype,"createLinearGradient",null),pe([ve()],xe.prototype,"createPattern",null),pe([ve()],xe.prototype,"createRadialGradient",null),pe([ve()],xe.prototype,"fillText",null),pe([ve()],xe.prototype,"measureText",null),pe([ve()],xe.prototype,"strokeText",null);const{copy:be,multiplyParent:ke,pixelScale:Se}=$,{round:Ee}=Math,Be=new Kt,Te=new Kt,Re={width:1,height:1,pixelRatio:1},Ce=["width","height","pixelRatio"];class Oe extends xe{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,e){super(),this.size={},this.worldTransform={},t||(t=Re),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:o}=t;this.autoLayout=!i||!s,this.size.pixelRatio=o||v.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;_.copyAttrs(s,t,Ce),Ce.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,o=this.worldTransform;e&&ke(t,e,o),Se(t,i,o),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(o.e=Ee(o.e-.5)+.5,o.f=Ee(o.f-.5)+.5):(o.e=Ee(o.e),o.f=Ee(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:o,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(o=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=o,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:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),i=Te):i=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,o=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Vt.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,o,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(Be.x,Be.y,Be.width,Be.height),{data:n}=o;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(o,Be.x,Be.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(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Be,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,o=this.manager?this.manager.get(i):ae.canvas(Object.assign({},i));return o.save(),t&&(be(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Pe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Le={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ae=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},Le),De={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},Fe=Object.assign(Object.assign({},Me),Le),Ie=Ae,We={};for(let t in Ie)We[Ie[t]]=t;const ze={};for(let t in Ie)ze[Ie[t]]=De[t];const Ye={drawRoundRect(t,e,i,s,o,n){const r=W.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:Xe,cos:Ne,hypot:He,atan2:Ve,ceil:je,abs:Ue,PI:Ge,sqrt:Ke,pow:qe}=Math,{setPoint:Ze,addPoint:Je}=vt,{set:Qe,toNumberPoints:$e}=dt,{M:ti,L:ei,C:ii,Q:si,Z:oi}=Ae,ni={},ri={points(t,e,i,s){let o=$e(e);if(t.push(ti,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,g,_,p,f,m=o.length;const y=!0===i?.5:i;s&&(o=[o[m-2],o[m-1],...o,o[0],o[1],o[2],o[3]],m=o.length);for(let i=2;i<m-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],_=Ke(qe(r-e,2)+qe(a-n,2)),p=Ke(qe(h-r,2)+qe(l-a,2)),(_||p)&&(f=_+p,_=y*_/f,p=y*p/f,h-=e,l-=n,d=r-_*h,c=a-_*l,2===i?s||t.push(si,d,c,r,a):t.push(ii,u,g,d,c,r,a),u=r+p*h,g=a+p*l);s||t.push(si,u,g,o[m-2],o[m-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(ei,o[e],o[e+1]);s&&t.push(oi)},rect(t,e,i,s,o){Pe.creator.path=t,Pe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){Pe.creator.path=[],Ye.drawRoundRect(Pe.creator,e,i,s,o,n),t.push(...Pe.convertToCanvasData(Pe.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,g=n-s,_=r-o;let p=Ve(u,c),f=Ve(_,g);const m=He(c,u),y=He(g,_);let v=f-p;if(v<0&&(v+=X),m<1e-12||y<1e-12||v<1e-12||Ue(v-Ge)<1e-12)return t&&t.push(ei,s,o),h&&(Ze(h,e,i),Je(h,s,o)),d&&Qe(d,e,i),void(l&&Qe(l,s,o));const w=c*_-g*u<0,x=w?-1:1,b=a/Ne(v/2),k=s+b*Ne(p+v/2+N*x),S=o+b*Xe(p+v/2+N*x);return p-=N*x,f-=N*x,li(t,k,S,a,a,0,p/Y,f/Y,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>li(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*Y,g=Xe(u),_=Ne(u);let p=r*Y,f=a*Y;p>Ge&&(p-=X),f<0&&(f+=X);let m=f-p;m<0?m+=X:m>X&&(m-=X),h&&(m-=X);const y=je(Ue(m/N)),v=m/y,w=Xe(v/4),x=8/3*w*w/Xe(v/2);f=p+v;let b,k,S,E,B,T,R,C,O=Ne(p),P=Xe(p),L=S=_*s*O-g*o*P,A=E=g*s*O+_*o*P,D=e+S,M=i+E;t&&t.push(t.length?ei:ti,D,M),l&&Ze(l,D,M),c&&Qe(c,D,M);for(let n=0;n<y;n++)b=Ne(f),k=Xe(f),S=_*s*b-g*o*k,E=g*s*b+_*o*k,B=e+L-x*(_*s*P+g*o*O),T=i+A-x*(g*s*P-_*o*O),R=e+S+x*(_*s*k+g*o*b),C=i+E+x*(g*s*k-_*o*b),t&&t.push(ii,B,T,R,C,e+S,i+E),l&&hi(e+L,i+A,B,T,R,C,e+S,i+E,l,!0),L=S,A=E,O=b,P=k,p=f,f+=v;d&&Qe(d,e+S,i+E)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(ii,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){hi(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,g,_,p,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-g/u,0<_&&_<1&&d.push(_)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(p=(-u+y)/(2*c),0<p&&p<1&&d.push(p),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):Ze(h,t,e),Je(h,r,a);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,o,n,r,a,ni),Je(h,ni.x,ni.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,_=t*t*t;l.x=c*e+u*s+g*n+_*a,l.y=c*i+u*o+g*r+_*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return ai(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=ri,{sin:di,cos:ci,sqrt:ui,atan2:gi}=Math,{ellipse:_i}=ri,pi={ellipticalArc(t,e,i,s,o,n,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=n*Y,_=di(g),p=ci(g),f=-p*c-_*u,m=-p*u+_*c,y=s*s,w=o*o,x=m*m,b=f*f,k=y*w-y*x-w*b;let S=0;if(k<0){const t=ui(1-k/(y*w));s*=t,o*=t}else S=(r===a?-1:1)*ui(k/(y*x+w*b));const E=S*s*m/o,B=-S*o*f/s,T=gi((m-B)/o,(f-E)/s),R=gi((-m-B)/o,(-f-E)/s);let C=R-T;0===a&&C>0?C-=X:1===a&&C<0&&(C+=X);const O=e+c+p*E-_*B,P=i+u+_*E+p*B,L=C<0?1:0;d||v.ellipseToCurve?_i(t,O,P,s,o,n,T/Y,R/Y,L):s!==o||n?t.push(Ae.G,O,P,s,o,n,T/Y,R/Y,L):t.push(Ae.O,O,P,s,T/Y,R/Y,L)}},fi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:yi,L:vi,l:wi,H:xi,h:bi,V:ki,v:Si,C:Ei,c:Bi,S:Ti,s:Ri,Q:Ci,q:Oi,T:Pi,t:Li,A:Ai,a:Di,Z:Mi,z:Fi,N:Ii,D:Wi,X:zi,G:Yi,F:Xi,O:Ni,P:Hi,U:Vi}=Ae,{rect:ji,roundRect:Ui,arcTo:Gi,arc:Ki,ellipse:qi,quadraticCurveTo:Zi}=ri,{ellipticalArc:Ji}=pi,Qi=$t.get("PathConvert"),$i={},ts={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=ze[s],a+=s===o?" ":We[s];for(let s=1;s<i;s++)a+=W.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?Fe:Me;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(es.dot&&(is(r,n),n=""),es.dot++),"0"===n&&"."!==s&&(is(r,n),n=""),n+=s):Ae[s]?(n&&(is(r,n),n=""),es.name=Ae[s],es.length=De[s],es.index=0,is(r,es.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&is(r,n),n=s):n&&(is(r,n),n=""),o=s;return n&&is(r,n),i?ts.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=t.length;const g=[];for(;c<u;){switch(o=t[c],o){case yi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],g.push(mi,a,h),c+=3;break;case bi:t[c+1]+=a;case xi:a=t[c+1],g.push(vi,a,h),c+=2;break;case Si:t[c+1]+=h;case ki:h=t[c+1],g.push(vi,a,h),c+=2;break;case wi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],g.push(vi,a,h),c+=3;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Ti;case Ti:r=n===Ei||n===Ti,l=r?2*a-i:t[c+1],d=r?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],g.push(Ei,l,d,i,s,a,h),c+=5;break;case Bi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,o=Ei;case Ei:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],g.push(Ei,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Li:t[c+1]+=a,t[c+2]+=h,o=Pi;case Pi:r=n===Ci||n===Pi,i=r?2*a-i:t[c+1],s=r?2*h-s:t[c+2],e?Zi(g,a,h,i,s,t[c+1],t[c+2]):g.push(Ci,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Oi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,o=Ci;case Ci:i=t[c+1],s=t[c+2],e?Zi(g,a,h,i,s,t[c+3],t[c+4]):g.push(Ci,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Di:t[c+6]+=a,t[c+7]+=h;case Ai:Ji(g,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 Fi:case Mi:g.push(Mi),c++;break;case Ii:a=t[c+1],h=t[c+2],e?ji(g,a,h,t[c+3],t[c+4]):ss(g,t,c,5),c+=5;break;case Wi:a=t[c+1],h=t[c+2],e?Ui(g,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ss(g,t,c,9),c+=9;break;case zi:a=t[c+1],h=t[c+2],e?Ui(g,a,h,t[c+3],t[c+4],t[c+5]):ss(g,t,c,6),c+=6;break;case Yi:qi(e?g:ss(g,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,$i),a=$i.x,h=$i.y,c+=9;break;case Xi:e?qi(g,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ss(g,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ni:Ki(e?g:ss(g,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$i),a=$i.x,h=$i.y,c+=7;break;case Hi:e?Ki(g,t[c+1],t[c+2],t[c+3],0,360,!1):ss(g,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Vi:Gi(e?g:ss(g,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$i),a=$i.x,h=$i.y,c+=6;break;default:return Qi.error(`command: ${o} [index:${c}]`,t),g}n=o}return g},objectToCanvasData(t){if(t[0].name.length>1)return fi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(mi,t.x,t.y);break;case"L":e.push(vi,t.x,t.y);break;case"C":e.push(Ei,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(Mi)}}),e}},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){es.index===es.length&&(es.index=1,t.push(es.name)),t.push(Number(e)),es.index++,es.dot=0}},{current:es,pushData:is,copyData:ss}=ts,{M:os,L:ns,C:rs,Q:as,Z:hs,N:ls,D:ds,X:cs,G:us,F:gs,O:_s,P:ps,U:fs}=Ae,{getMinDistanceFrom:ms,getRadianFrom:ys}=dt,{tan:vs,min:ws,abs:xs}=Math,bs={},ks={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(ns,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(rs,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(as,e,i,s,o)},closePath(t){t.push(hs)},rect(t,e,i,s,o){t.push(ls,e,i,s,o)},roundRect(t,e,i,s,o,n){if(a(n))t.push(cs,e,i,s,o,n);else{const r=W.fourNumber(n);r?t.push(ds,e,i,s,o,...r):t.push(ls,e,i,s,o)}},ellipse(t,e,i,s,n,r,a,h,l){o(r)?t.push(gs,e,i,s,n):(o(a)&&(a=0),o(h)&&(h=360),t.push(us,e,i,s,n,r,a,h,l?1:0))},arc(t,e,i,s,n,r,a){o(n)?t.push(ps,e,i,s):(o(r)&&(r=360),t.push(_s,e,i,s,n,r,a?1:0))},arcTo(t,e,i,o,n,r,a,h){if(!s(a)){const t=ms(a,h,e,i,o,n);r=ws(r,ws(t/2,t/2*xs(vs(ys(a,h,e,i,o,n)/2))))}t.push(fs,e,i,o,n,r)},drawEllipse(t,e,i,s,n,r,a,h,l){ri.ellipse(null,e,i,s,n,o(r)?0:r,o(a)?0:a,o(h)?360:h,l,null,null,bs),t.push(os,bs.x,bs.y),Ss(t,e,i,s,n,r,a,h,l)},drawArc(t,e,i,s,n,r,a){ri.arc(null,e,i,s,o(n)?0:n,o(r)?360:r,a,null,null,bs),t.push(os,bs.x,bs.y),Es(t,e,i,s,n,r,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:Ss,arc:Es}=ks,{moveTo:Bs,lineTo:Ts,quadraticCurveTo:Rs,bezierCurveTo:Cs,closePath:Os,beginPath:Ps,rect:Ls,roundRect:As,ellipse:Ds,arc:Ms,arcTo:Fs,drawEllipse:Is,drawArc:Ws,drawPoints:zs}=ks;class Ys{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Pe.parse(t):t:[],this}beginPath(){return Ps(this.__path),this.paint(),this}moveTo(t,e){return Bs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return Cs(this.__path,t,e,i,s,o,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Rs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Os(this.__path),this.paint(),this}rect(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return As(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return Ds(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return Ms(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return Fs(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return Is(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return Ws(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xs,L:Ns,C:Hs,Q:Vs,Z:js,N:Us,D:Gs,X:Ks,G:qs,F:Zs,O:Js,P:Qs,U:$s}=Ae,to=$t.get("PathDrawer"),eo={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case Xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case js:t.closePath(),s+=1;break;case Us:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs: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 Ks:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*Y,e[s+6]*Y,e[s+7]*Y,e[s+8]),s+=9;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,X,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*Y,e[s+5]*Y,e[s+6]),s+=7;break;case Qs:t.arc(e[s+1],e[s+2],e[s+3],0,X,!1),s+=4;break;case $s:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void to.error(`command: ${i} [index:${s}]`,e)}}},{M:io,L:so,C:oo,Q:no,Z:ro,N:ao,D:ho,X:lo,G:co,F:uo,O:go,P:_o,U:po}=Ae,{toTwoPointBounds:fo,toTwoPointBoundsByQuadraticCurve:mo,arcTo:yo,arc:vo,ellipse:wo}=ri,{addPointBounds:xo,copy:bo,addPoint:ko,setPoint:So,addBounds:Eo,toBounds:Bo}=vt,To=$t.get("PathBounds");let Ro,Co,Oo;const Po={},Lo={},Ao={},Do={toBounds(t,e){Do.toTwoPointBounds(t,Lo),Bo(Lo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return So(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===ro||r===oo||r===no?So(e,h,l):So(e,t[a+1],t[a+2])),r){case io:case so:h=t[a+1],l=t[a+2],ko(e,h,l),a+=3;break;case oo:o=t[a+5],n=t[a+6],fo(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Po),xo(e,Po),h=o,l=n,a+=7;break;case no:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],mo(h,l,i,s,o,n,Po),xo(e,Po),h=o,l=n,a+=5;break;case ro:a+=1;break;case ao:h=t[a+1],l=t[a+2],Eo(e,h,l,t[a+3],t[a+4]),a+=5;break;case ho:case lo:h=t[a+1],l=t[a+2],Eo(e,h,l,t[a+3],t[a+4]),a+=r===ho?9:6;break;case co:wo(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],Po,Ao),0===a?bo(e,Po):xo(e,Po),h=Ao.x,l=Ao.y,a+=9;break;case uo:h=t[a+1],l=t[a+2],Co=t[a+3],Oo=t[a+4],Eo(e,h-Co,l-Oo,2*Co,2*Oo),h+=Co,a+=5;break;case go:vo(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Po,Ao),0===a?bo(e,Po):xo(e,Po),h=Ao.x,l=Ao.y,a+=7;break;case _o:h=t[a+1],l=t[a+2],Ro=t[a+3],Eo(e,h-Ro,l-Ro,2*Ro,2*Ro),h+=Ro,a+=4;break;case po:yo(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Po,Ao),0===a?bo(e,Po):xo(e,Po),h=Ao.x,l=Ao.y,a+=6;break;default:return void To.error(`command: ${r} [index:${a}]`,t)}}},{M:Mo,L:Fo,Z:Io}=Ae,{getCenterX:Wo,getCenterY:zo}=dt,{arcTo:Yo}=ks,Xo={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,d=0,c=0,u=0,g=0,_=0;const p=t.length,f=[];for(;r<p;){switch(s=t[r],s){case Mo:l=g=t[r+1],d=_=t[r+2],r+=3,t[r]===Fo?(c=t[r+1],u=t[r+2],f.push(Mo,Wo(l,c),zo(d,u))):f.push(Mo,l,d);break;case Fo:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Fo:Yo(f,a,h,t[r+1],t[r+2],e,g,_);break;case Io:Yo(f,a,h,l,d,e,g,_);break;default:f.push(Fo,a,h)}g=a,_=h;break;case Io:o!==Io&&(Yo(f,l,d,c,u,e,g,_),f.push(Io)),r+=1;break;default:n=ze[s];for(let e=0;e<n;e++)f.push(t[r+e]);r+=n}o=s}return s!==Io&&(f[1]=l,f[2]=d),f}};function No(t){return new Ys(t)}const Ho=No();Pe.creator=No(),Pe.parse=ts.parse,Pe.convertToCanvasData=ts.toCanvasData;const{drawRoundRect:Vo}=Ye;function jo(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,o){Vo(this,t,e,i,s,o)})}(t)}const Uo={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=Go.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{}}}},Go=Uo;Go.alphaPixelTypes.forEach(t=>Go.upperCaseTypeMap[t]=t.toUpperCase());const Ko=$t.get("TaskProcessor");class qo{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return fe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Ko.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zo{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&&_.assign(this.config,t),this.empty()}add(t,e,i){let o,n,r,h;const l=new qo(t);return l.parent=this,a(e)?h=e:e&&(n=e.parallel,o=e.start,r=e.time,h=e.delay,i||(i=e.canUse)),r&&(l.time=r),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,o):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,o))},h)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let o=s+e.parallel;if(o>i.length&&(o=i.length),e.parallel>1)for(let e=s;e<o&&(t=i[e],t.parallel);e++)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 Jo=$t.get("Resource"),Qo={tasker:new Zo,map:{},get isComplete(){return $o.tasker.isComplete},set(t,e){$o.map[t]&&Jo.repeat(t),$o.map[t]=e},get:t=>$o.map[t],remove(t){const e=$o.map[t];e&&(e.destroy&&e.destroy(),delete $o.map[t])},loadImage(t,e){return new Promise((i,s)=>{const o=this.setImage(t,t,e);o.load(()=>i(o),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ae.image(s)),$o.set(t,e),e},destroy(){$o.map={}}},$o=Qo,tn={maxRecycled:10,recycledList:[],patternTasker:new Zo,get(t){let e=Qo.get(t.url);return e||Qo.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||en.recycledList.push(t)})},clearRecycled(){const t=en.recycledList;t.length>en.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Qo.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Uo.alphaPixelTypes.some(e=>en.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:"+Uo.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Uo.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){en.recycledList=[]}},en=tn,{IMAGE:sn,create:on}=x;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=on(sn),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}tn.isFormat("svg",t)&&(this.isSVG=!0),tn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Qo.tasker.add(()=>fe(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.url,s(t)?v.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),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)}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,e,i,s,o,n,r){if(t||(t=this.width),e||(e=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=v.image.resize(this.view,t,e,o,n,void 0,r,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const o=v.canvas.createPattern(t,e);return v.image.setPatternTransform(o,i,s),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function rn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function an(t,e){return Object.getOwnPropertyDescriptor(t,e)}function hn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ln(t,e){return(i,s)=>cn(i,s,t,e&&e(s))}function dn(t){return t}function cn(t,e,i,s){const o={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};rn(t,e,Object.assign(o,s||{})),Yn(t,e,i)}function un(t){return ln(t)}function gn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function _n(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function pn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),wn(this))}}))}function fn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function mn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function yn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i,e)&&wn(this)}}))}function vn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(wn(this),this.__.__removeNaturalSize())}}))}function wn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function xn(t){return ln(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),wn(this)}}))}const bn=yn;function kn(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i)&&(Sn(this),e&&(this.__.__useStroke=!0))}}))}function Sn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&wn(t)}const En=kn;function Bn(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Tn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Rn(t){return ln(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;_.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Cn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Pn(this)}}))}function On(t){return ln(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Ln(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Ln(this,t,e,i),this.mask&&Pn(this)}}))}function Pn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Ln(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||wn(t))}function An(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Dn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Fn(t){return ln(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function In(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wn(t){return(e,i)=>{rn(e,"__DataProcessor",{get:()=>t})}}function zn(t){return(e,i)=>{rn(e,"__LayoutProcessor",{get:()=>t})}}function Yn(t,e,i){const o=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=hn(e,i);if(s(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(c(i)){const t=g(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:_.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=o;for(;!l&&d;)l=an(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),o[r]&&(a.set=o[r],delete o[r]),rn(o,e,a)}const Xn=new $t("rewrite"),Nn=[],Hn=["destroy","constructor"];function Vn(t){return(e,i)=>{Nn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function jn(){return t=>{Un()}}function Un(t){Nn.length&&(Nn.forEach(e=>{t&&Xn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Nn.length=0)}function Gn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Hn.includes(s)||e&&e.includes(s)))if(t.prototype){an(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Kn(){return t=>{le.register(t)}}function qn(){return t=>{ue.register(t)}}setTimeout(()=>Un(!0));const{copy:Zn,toInnerPoint:Jn,toOuterPoint:Qn,scaleOfOuter:$n,rotateOfOuter:tr,skewOfOuter:er,multiplyParent:ir,divideParent:sr,getLayout:or}=$,nr={},{round:rr}=Math,ar={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),dr(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,o=s.length;t<o;t++)lr(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++)cr(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&cr(t),t.__updateChange()},updateAllChange(t){if(gr(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ur(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,e,i,s,o,n){s||(s=t.__nowWorld),t.__worldFlipped||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,o,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,o)},moveWorld(t,e,i=0,s,o){const n=c(e)?Object.assign({},e):{x:e,y:i};s?Qn(t.localTransform,n,n,!0):t.parent&&Jn(t.parent.scrollWorldTransform,n,n,!0),hr.moveLocal(t,n.x,n.y,o)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=rr(e),i=rr(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,o,n){hr.zoomOfLocal(t,_r(t,e),i,s,o,n)},zoomOfLocal(t,e,i,s=i,o,n){const r=t.__localMatrix;if(a(s)||(s&&(n=s),s=i),Zn(nr,r),$n(nr,e,i,s),hr.hasHighPosition(t))hr.setTransform(t,nr,o,n);else{const e=t.x+nr.e-r.e,a=t.y+nr.f-r.f;n&&!o?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==o))}},rotateOfWorld(t,e,i,s){hr.rotateOfLocal(t,_r(t,e),i,s)},rotateOfLocal(t,e,i,s){const o=t.__localMatrix;Zn(nr,o),tr(nr,e,i),hr.hasHighPosition(t)?hr.setTransform(t,nr,!1,s):t.set({x:t.x+nr.e-o.e,y:t.y+nr.f-o.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,o,n){hr.skewOfLocal(t,_r(t,e),i,s,o,n)},skewOfLocal(t,e,i,s=0,o,n){Zn(nr,t.__localMatrix),er(nr,e,i,s),hr.setTransform(t,nr,o,n)},transformWorld(t,e,i,s){Zn(nr,t.worldTransform),ir(nr,e),t.parent&&sr(nr,t.parent.scrollWorldTransform),hr.setTransform(t,nr,i,s)},transform(t,e,i,s){Zn(nr,t.localTransform),ir(nr,e),hr.setTransform(t,nr,i,s)},setTransform(t,e,i,s){const o=t.__,n=o.origin&&hr.getInnerOrigin(t,o.origin),r=or(e,n,o.around&&hr.getInnerOrigin(t,o.around));if(hr.hasOffset(t)&&(r.x-=o.offsetX,r.y-=o.offsetY),i){const e=r.scaleX/t.scaleX,i=r.scaleY/t.scaleY;if(delete r.scaleX,delete r.scaleY,n){Vt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=hr.getInnerOrigin(t,o.origin);dt.move(r,n.x-s.x,n.y-s.y)}t.set(r),t.scaleResize(e,i,!1)}else t.set(r,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return $n(i,hr.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(hr.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return St.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Zn(nr,t.worldTransform),sr(nr,e.scrollWorldTransform),i?nr:Object.assign({},nr)),drop(t,e,i,s){t.setTransform(hr.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||hr.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,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,o=e.y*i;e.x-=s,e.y-=o,t.move(s,o),v.requestRender(()=>hr.animateMove(t,e,i))}}},hr=ar,{updateAllMatrix:lr,updateMatrix:dr,updateAllWorldOpacity:cr,updateAllChange:ur,updateChange:gr}=hr;function _r(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const pr={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)=>mr(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>mr(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>mr(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 fr;function mr(t,e){return e||(fr=0),t.__.mask&&(fr=1),fr<0?null:(fr&&(fr=-1),!0)}const{updateBounds:yr}=ar,vr={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:i}=t;for(let s=0,o=i.length;s<o;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),wr(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(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++)xr(e[t],e)},updateBounds(t,e){const i=[t];xr(t,i),br(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let o=t.length-1;o>-1;o--){i=t[o],s=i.children;for(let t=0,e=s.length;t<e;t++)yr(s[t]);e&&e===i||yr(i)}}},{pushAllChildBranch:wr,pushAllBranchStack:xr,updateBoundsByBranchStack:br}=vr,kr={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:Sr,updateBounds:Er}=ar,{toOuterOf:Br,getPoints:Tr,copy:Rr}=Vt,Cr="_localContentBounds",Or="_worldContentBounds",Pr="_worldBoxBounds",Lr="_worldStrokeBounds";class Ar{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 Br(this.contentBounds,this.leaf.__localMatrix,this[Cr]||(this[Cr]={})),this[Cr]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Br(this.contentBounds,this.leaf.__world,this[Or]||(this[Or]={})),this[Or]}get worldBoxBounds(){return Br(this.boxBounds,this.leaf.__world,this[Pr]||(this[Pr]={})),this[Pr]}get worldStrokeBounds(){return Br(this.strokeBounds,this.leaf.__world,this[Lr]||(this[Lr]={})),this[Lr]}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:e}=t;if(t.isApp)return Er(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,v.layout(i),delete i.__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 $.defaultMatrix;case"page":t=e.zoomLayer;default:return Sr(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 Kt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let o,n,r,a=this.getInnerBounds(t);switch(e){case"world":o=s.getWorldPoint(a),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;r={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},o=s.getLocalPointByInner(a);break;case"inner":o=a,n=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:o=s.getWorldPoint(a,e),n=Sr(s,e,!0)}if(r||(r=$.getLayout(n)),Rr(r,a),dt.copy(r,o),i){const{scaleX:t,scaleY:e}=r,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(r.scaleX/=i,r.scaleY/=s,r.width*=i,r.height*=s)}return r}getLayoutPoints(t,e="world"){const{leaf:i}=this,o=Tr(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 s(n)||o.forEach(t=>i.innerToWorld(t,null,!1,n)),o}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 Dr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&v.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&v.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&v.event.stop(this.origin)}}class Mr extends Dr{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Mr.ADD="child.add",Mr.REMOVE="child.remove",Mr.CREATED="created",Mr.MOUNTED="mounted",Mr.UNMOUNTED="unmounted",Mr.DESTROY="destroy";const Fr="property.scroll";class Ir extends Dr{constructor(t,e,i,s,o){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=o}}Ir.CHANGE="property.change",Ir.LEAFER_CHANGE="property.leafer_change",Ir.SCROLL=Fr;const Wr={scrollX:Fr,scrollY:Fr};class zr extends Dr{constructor(t,e){super(t),Object.assign(this,e)}}zr.LOAD="image.load",zr.LOADED="image.loaded",zr.ERROR="image.error";class Yr extends Dr{static checkHas(t,e,i){"on"===i?e===Vr?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Xr)||t.hasEvent(Nr)||t.hasEvent(Hr),t.__hasWorldEvent=t.hasEvent(Vr))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Xr,t),"inner"===e&&t.emit(Nr,t)),t.emit(Hr,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Vr,this)}}Yr.RESIZE="bounds.resize",Yr.INNER="bounds.inner",Yr.LOCAL="bounds.local",Yr.WORLD="bounds.world";const{RESIZE:Xr,INNER:Nr,LOCAL:Hr,WORLD:Vr}=Yr,jr={};[Xr,Nr,Hr,Vr].forEach(t=>jr[t]=1);class Ur extends Dr{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){c(t)?(super(Ur.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Ur.RESIZE="resize";class Gr extends Dr{constructor(t,e){super(t),this.data=e}}Gr.REQUEST="watch.request",Gr.DATA="watch.data";class Kr extends Dr{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Kr.REQUEST="layout.request",Kr.START="layout.start",Kr.BEFORE="layout.before",Kr.LAYOUT="layout",Kr.AFTER="layout.after",Kr.AGAIN="layout.again",Kr.END="layout.end";class qr extends Dr{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}qr.REQUEST="render.request",qr.CHILD_START="render.child_start",qr.CHILD_END="render.child_end",qr.START="render.start",qr.BEFORE="render.before",qr.RENDER="render",qr.AFTER="render.after",qr.AGAIN="render.again",qr.END="render.end",qr.NEXT="render.next";class Zr extends Dr{}Zr.START="leafer.start",Zr.BEFORE_READY="leafer.before_ready",Zr.READY="leafer.ready",Zr.AFTER_READY="leafer.after_ready",Zr.VIEW_READY="leafer.view_ready",Zr.VIEW_COMPLETED="leafer.view_completed",Zr.STOP="leafer.stop",Zr.RESTART="leafer.restart",Zr.END="leafer.end",Zr.UPDATE_MODE="leafer.update_mode",Zr.TRANSFORM="leafer.transform",Zr.MOVE="leafer.move",Zr.SCALE="leafer.scale",Zr.ROTATE="leafer.rotate",Zr.SKEW="leafer.skew";const{MOVE:Jr,SCALE:Qr,ROTATE:$r,SKEW:ta}=Zr,ea={x:Jr,y:Jr,scaleX:Qr,scaleY:Qr,rotation:$r,skewX:ta,skewY:ta},ia={};class sa{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,o,r;i&&("once"===i?o=!0:"boolean"==typeof i?s=i:(s=i.capture,o=i.once));const a=oa(this,s,!0),h=n(t)?t.split(" "):t,l=o?{listener:e,once:o}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):a[t]=[l],jr[t]&&Yr.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,o,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const r=oa(this,t);s.forEach(t=>{t&&(o=r[t],o&&(n=o.findIndex(t=>t.listener===e),n>-1&&o.splice(n,1),o.length||delete r[t],jr[t]&&Yr.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):d(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=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(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 d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ue.has(t)&&(e=ue.get(t,{type:t,target:this,current:this}));const s=oa(this,i)[t];if(s){let o;for(let n=0,r=s.length;n<r&&!((o=s[n])&&(o.listener(e),o.once&&(this.off(t,o.listener,i),n--,r--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:i,__captureMap:o}=this,n=i&&i[t],r=o&&o[t];return!!(s(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function oa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ia)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ia)}}const{on:na,on_:ra,off:aa,off_:ha,once:la,emit:da,emitEvent:ca,hasEvent:ua,destroy:ga}=sa.prototype,_a={on:na,on_:ra,off:aa,off_:ha,once:la,emit:da,emitEvent:ca,hasEvent:ua,destroyEventer:ga},pa=$t.get("setAttr"),fa={__setAttr(t,e,i){if(this.leaferIsCreated){const o=this.__.__getInput(t);if(!i||r(e)||s(e)||(pa.warn(this.innerName,t,e),e=void 0),c(e)||o!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ir(Ir.LEAFER_CHANGE,this,t,o,e));const i=ea[t];i&&(this.emitEvent(new Zr(i,this)),this.emitEvent(new Zr(Zr.TRANSFORM,this)))}this.emitPropertyEvent(Ir.CHANGE,t,o,e);const i=Wr[t];return i&&this.emitPropertyEvent(i,t,o,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const o=new Ir(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(o),this.leafer.emitEvent(o)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ma,multiplyParent:ya,translateInner:va,defaultWorld:wa}=$,{toPoint:xa,tempPoint:ba}=St,ka={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:o}=this;ya(this.__local||e,t?t.__scrollWorld||t.__world:wa,i,!!e.affectScaleOrRotation,o),s&&va(Object.assign(s,i),o.scrollX,o.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ma(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)&&(xa(i.around||i.origin,t.boxBounds,ba),va(e,-ba.x,-ba.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Sa,updateAllMatrix:Ea}=ar,{updateBounds:Ba}=vr,{toOuterOf:Ta,copyAndSpread:Ra,copy:Ca}=Vt,{toBounds:Oa}=Do,Pa={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ta(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Yr.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Yr.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(),Ta(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ta(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ta(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Oa(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(),Ea(this),Ba(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Ea(this),Ba(this,this))):Sa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ra(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ca(e.renderBounds,e.strokeBounds):Ra(e.renderBounds,e.boxBounds,i)}},La={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ar.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);$t.showBounds&&$t.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:Aa}=pr,Da={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const o=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,o,o,i.__blendMode,!0),s.recycle(o)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Aa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,o=i.length;s<o;s++)Aa(i[s],e)||i[s].__clip(t,e)}}},Ma={},{LEAF:Fa,create:Ia}=x,{stintSet:Wa}=_,{toInnerPoint:za,toOuterPoint:Ya,multiplyParent:Xa}=$,{toOuterOf:Na}=Vt,{copy:Ha,move:Va}=dt,{moveLocal:ja,zoomOfLocal:Ua,rotateOfLocal:Ga,skewOfLocal:Ka,moveWorld:qa,zoomOfWorld:Za,rotateOfWorld:Ja,skewOfWorld:Qa,transform:$a,transformWorld:th,setTransform:eh,getFlipTransform:ih,getLocalOrigin:sh,getRelativeWorld:oh,drop:nh}=ar;let rh=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 f}get __LayoutProcessor(){return Ar}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=Ia(Fa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Mr.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Mr.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Mr.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Mr.MOUNTED)):this.__emitLifeEvent(Mr.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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),Na(this.__layout.renderBounds,e,e),Wa(e,"half",i.half),Wa(e,"ignorePixelSnap",i.ignorePixelSnap),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}=tn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ma.scaleX=i,Ma.scaleY=s,Ma}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?oh(this,e):this.worldTransform,o=i?t:{};return Na(t,s,o),o}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ha(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ha(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),za(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Ya(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Va(o,-n,-r),o}getInnerPoint(t,e,i,s){const o=s?t:{};return this.worldToInner(t,o,i,e),o}getInnerPointByBox(t,e,i,s){const o=s?t:Object.assign({},t),{x:n,y:r}=this.boxBounds;return Va(o,n,r),o}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const o=s?t:{};return this.worldToLocal(t,o,i,e),o}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const o=s?t:{};return this.innerToWorld(t,o,i,e),o}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const o=s?t:{};return this.localToWorld(t,o,i,e),o}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){eh(this,t,e,i)}transform(t,e,i){$a(this,t,e,i)}move(t,e,i){ja(this,t,e,i)}moveInner(t,e,i){qa(this,t,e,!0,i)}scaleOf(t,e,i,s,o){Ua(this,sh(this,t),e,i,s,o)}rotateOf(t,e,i){Ga(this,sh(this,t),e,i)}skewOf(t,e,i,s,o){Ka(this,sh(this,t),e,i,s,o)}transformWorld(t,e,i){th(this,t,e,i)}moveWorld(t,e,i){qa(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,o){Za(this,t,e,i,s,o)}rotateOfWorld(t,e){Ja(this,t,e)}skewOfWorld(t,e,i,s,o){Qa(this,t,e,i,s,o)}flip(t,e){$a(this,ih(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 re.need("path")}getMotionPoint(t){return re.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){nh(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):Yn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=yn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Mr(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Mr.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}};rh=pe([Gn(fa),Gn(ka),Gn(Pa),Gn(_a),Gn(La)],rh);const{setListWithFn:ah}=Vt,{sort:hh}=vr,{localBoxBounds:lh,localStrokeBounds:dh,localRenderBounds:ch,maskLocalBoxBounds:uh,maskLocalStrokeBounds:gh,maskLocalRenderBounds:_h}=pr,ph=new $t("Branch");let fh=class extends rh{__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){ah(e||this.__layout.boxBounds,this.children,this.__hasMask?uh:lh)}__updateStrokeBounds(t){ah(t||this.__layout.strokeBounds,this.children,this.__hasMask?gh:dh)}__updateRenderBounds(t){ah(t||this.__layout.renderBounds,this.children,this.__hasMask?_h:ch)}__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(hh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ph.warn("add self or destroyed");const i=s(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=le.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 o=t.__layout;o.boxChanged||o.boxChange(),o.matrixChanged||o.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Mr.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Mr.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Mr.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Mr.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Mr(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}};fh=pe([Gn(Da)],fh);class mh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,o=s.length;t<o;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let o=0,n=e.length;o<n;o++)s(i)?e[o].innerId===t.innerId&&(i=o,delete this.keys[t.innerId]):this.keys[e[o].innerId]=o-1;s(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 mh;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 yh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const vh="1.11.2";class wh extends Oe{get allowBackgroundColor(){return!1}init(){const{config:t}=this;let e=t.view||t.canvas;e?(n(e)?("#"!==e[0]&&(e="#"+e),this.viewSelect=v.miniapp.select(e)):e.fields?this.viewSelect=e:this.initView(e),this.viewSelect&&v.miniapp.getSizeView(this.viewSelect).then(t=>{this.initView(t)})):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.view.getContext?this.__createContext():this.unrealCanvas();const{width:e,height:i,pixelRatio:s}=this.config,o={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(o),this.context&&(this.viewSelect&&(v.renderCanvas=this),this.context.roundRect&&(this.roundRect=function(t,e,i,s,o){this.context.roundRect(t,e,i,s,a(o)?[o]:o)}),jo(this.context.__proto__))}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){if(this.unreal)return;const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(t){this.viewSelect&&v.miniapp.getBounds(this.viewSelect).then(e=>{this.clientBounds=e,t&&t()})}startAutoLayout(t,e){this.resizeListener||(this.resizeListener=e,t&&(this.checkSize=this.checkSize.bind(this),v.miniapp.onWindowResize(this.checkSize)))}checkSize(){this.viewSelect&&setTimeout(()=>{this.updateClientBounds(()=>{const{width:t,height:e}=this.clientBounds,{pixelRatio:i}=this,s={width:t,height:e,pixelRatio:i};this.isSameSize(s)||this.emitResize(s)})},500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,v.miniapp.offWindowResize(this.checkSize)}unrealCanvas(){this.unreal=!0}emitResize(t){const e={};_.copyAttrs(e,this,Ce),this.resize(t),s(this.width)||this.resizeListener(new Ur(t,e))}}const{mineType:xh,fileType:bh}=Uo;function kh(t,e){v.origin={createCanvas:(t,i,s)=>{const o={type:"2d",width:t,height:i};return e.createOffscreenCanvas?e.createOffscreenCanvas(o):e.createOffScreenCanvas(o)},canvasToDataURL:(t,e,i)=>t.toDataURL(xh(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,e,i)=>{let s=t.toDataURL(xh(bh(e)),i);return s=s.substring(s.indexOf("64,")+3),v.origin.download(s,e)},download:(t,i)=>new Promise((s,o)=>{let n;i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,n=!0);const r=e.getFileSystemManager();r.writeFile({filePath:i,data:t,encoding:"base64",success(){n?v.miniapp.saveToAlbum(i).then(()=>{r.unlink({filePath:i}),s()}):s()},fail(t){o(t)}})}),loadImage:t=>new Promise((e,i)=>{const s=v.canvas.view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=v.image.getRealURL(t)}),noRepeat:"repeat-x"},v.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise(e=>{t.boundingClientRect().exec(t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})})}),getSizeView:t=>new Promise(e=>{t.fields({node:!0,size:!0}).exec(t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})})}),saveToAlbum:t=>new Promise(i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})}),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},v.event={stopDefault(t){},stopNow(t){},stop(t){}},v.canvas=ae.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new wh(t,e),image:t=>new nn(t)}),v.name="miniapp",v.requestRender=function(t){const{view:e}=v.renderCanvas||v.canvas;e.requestAnimationFrame?e.requestAnimationFrame(t):setTimeout(t,16)},rn(v,"devicePixelRatio",{get:()=>Math.max(1,wx.getWindowInfo?wx.getWindowInfo().pixelRatio:wx.getSystemInfoSync().pixelRatio)});class Sh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new mh;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 mh,this.target=t,e&&(this.config=_.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(qr.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Mr.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Gr(Gr.DATA,{updatedList:this.updatedList})),this.__updatedList=new mh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ir.CHANGE,this.__onAttrChange,this],[[Mr.ADD,Mr.REMOVE],this.__onChildEvent,this],[Gr.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:Bh,updateChange:Th}=ar,{pushAllChildBranch:Rh,pushAllParent:Ch}=vr;const{worldBounds:Oh}=pr;class Ph{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,d(t)&&(t=new mh(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:Lh,updateAllChange:Ah}=ar,Dh=$t.get("Layouter");class Mh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new yh,this.target=t,e&&(this.config=_.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(Kr.START),this.layoutOnce(),t.emitEvent(new Kr(Kr.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(Gr.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=se.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:o,LAYOUT:n,AFTER:r}=Kr,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Kr(o,a,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(Eh(t,!0),e.add(t),t.isBranch&&Rh(t,e),Ch(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ch(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(o=>{e=t.levelMap[o];for(let t=0,o=e.length;t<o;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Bh(s[t])}Bh(i)}})}(this.__levelList),function(t){t.list.forEach(Th)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Kr(n,a,this.times)),i.emitEvent(new Kr(r,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,se.end(e)}fullLayout(){const t=se.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:o}=Kr,n=this.getBlocks(new mh(e));e.emitEvent(new Kr(i,n,this.times)),Mh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Kr(s,n,this.times)),e.emitEvent(new Kr(o,n,this.times)),this.addBlocks(n),se.end(t)}static fullLayout(t){Lh(t,!0),t.isBranch?vr.updateBounds(t):ar.updateBounds(t),Ah(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ph([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ph(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[Kr.REQUEST,this.layout,this],[Kr.AGAIN,this.layoutAgain,this],[Gr.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Fh=$t.get("Renderer");class Ih{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.frames=[],this.target=t,this.canvas=e,i&&(this.config=_.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(Kr.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(qr.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(qr.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(qr.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Fh.log(e.innerName,"---\x3e");try{this.emitRender(qr.START),this.renderOnce(t),this.emitRender(qr.END,this.totalBounds),tn.clearRecycled()}catch(t){this.rendering=!1,Fh.error(t)}Fh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Fh.warn("rendering");if(this.times>3)return Fh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender(qr.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(qr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(qr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(qr.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=se.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),o=new Kt(s);i.save(),s.spread(Ih.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,o),i.restore(),se.end(e)}fullRender(){const t=se.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),se.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),o=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(i,t),v.render(this.target,i,o),this.renderBounds=e=e||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Kt;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);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return v.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Kt(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 Kt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Fh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new qr(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[qr.REQUEST,this.update,this],[Kr.END,this.__onLayoutEnd,this],[qr.AGAIN,this.renderAgain,this],[Ur.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Ih.clipSpread=10;const{hitRadiusPoint:Wh}=Vt;class zh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,o=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new mh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:r}=this.findList,a=this.getBestMatchLeaf(r,i.bottomList,o,!!i.findList),h=o?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:r.length?this.getThroughPath(r):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const o=this.findList=new mh;if(t.length){let e;const{x:s,y:n}=this.point,r={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||ar.worldHittable(e))&&(this.hitChild(e,r),o.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ar.hasParent(t,e))){o.reset();break}return o.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),o.length)return o.list[0];return s?null:i?t[0]:t.find(t=>ar.worldHittable(t))}getPath(t){const e=new mh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new mh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new mh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,o,n;for(let t=0,r=i.length;t<r;t++){s=i[t],o=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!o||!o.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:o}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Wh(i.__world,o),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(o))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,o)}}else s&&this.hitChild(i,o)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,o=[];const{children:n}=s;for(let s=0,r=n.length;s<r;s++)if(i=n[s],i.__.mask&&o.push(i),i===t){if(o&&!o.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Yh{constructor(t,e){this.config={},e&&(this.config=_.default(e,this.config)),this.picker=new zh(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:o}=this;return v.backgrounder&&s&&s.updateLayout(),o.getByPoint(t,e,i)}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):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Xh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Nh(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Hh(){return(t,e)=>{const i="_"+e;rn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}function Vh(t){return(e,i)=>{rn(e,i,hn(i,t))}}Object.assign(ae,{watcher:(t,e)=>new Sh(t,e),layouter:(t,e)=>new Mh(t,e),renderer:(t,e,i)=>new Ih(t,e,i),selector:(t,e)=>new Yh(t,e)}),v.layout=Mh.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new mh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const jh={},Uh={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}},Gh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Kh={},qh={},Zh={},Jh={},Qh={},$h={apply(){re.need("filter")}},tl={},el={setStyleName:()=>re.need("state"),set:()=>re.need("state")},il={list:{},register(t,e){il.list[t]=e},get:t=>il.list[t]},{parse:sl,objectToCanvasData:ol}=ts,{stintSet:nl}=_,{hasTransparent:rl}=Uh,al={originPaint:{}},hl=$t.get("UIData");class ll extends f{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,hl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,hl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(nl(this,"__isTransparentFill",rl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(nl(this,"__isTransparentStroke",rl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?sl(t):ol(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){dl(this,"shadow",t)}setInnerShadow(t){dl(this,"innerShadow",t)}setFilter(t){dl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&qh.compute("fill",this.__leaf),e&&qh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(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(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=al)):(this.__isStrokes=!0,this._stroke||(this._stroke=al))}__removePaint(t,e){e&&this.__removeInput(t),Zh.recycleImage(t,this),"fill"===t?(nl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(nl(this,"__isAlphaPixelStroke",void 0),nl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function dl(t,e,i){t.__setInput(e,i),d(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 cl extends ll{}class ul extends cl{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 gl extends cl{__getInputData(t,e){const i=super.__getInputData(t,e);return Ce.forEach(t=>delete i[t]),i}}class _l extends ul{}class pl extends ll{get __usePathBox(){return this.points||this.__pathInputed}}class fl extends ll{get __boxStroke(){return!this.__pathInputed}}class ml extends ll{get __boxStroke(){return!this.__pathInputed}}class yl extends pl{}class vl extends ll{}class wl extends ll{get __pathInputed(){return 2}}class xl extends cl{}const bl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class kl extends ll{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=bl[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=le.get("Rect",0);const o=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=o.boxBounds),i.set(t),n.strokeChanged&&o.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class Sl extends fl{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 t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class El extends fl{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{max:Bl,add:Tl}=R,Rl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:o}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&o&&"inside"!==s&&(e=t="center"===s?o/2:o,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:o;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*o),n&&(t=Bl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:o,filter:n,renderSpread:r}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Qh.getShadowRenderSpread(this,e)),s&&(t=Bl(t,s)),n&&(t=Tl(t,$h.getSpread(n))),r&&(t=Tl(t,r)),a&&(t=Tl(t,a));let l=t;return i&&(l=Bl(l,Qh.getInnerShadowSpread(this,i))),o&&(l=Bl(l,o)),this.__layout.renderShapeSpread=l,h?Bl(h.__updateRenderSpread(),t):t}},{stintSet:Cl}=_,Ol={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Cl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Cl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Cl(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!Qh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}t.__checkSingle(),Cl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Pl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:o,stroke:n,__drawAfterFill:r,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=qh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Qh.shadow(this,t,h),a&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e)),o&&(s.__isFills?qh.fills(o,this,t,e):qh.fill(o,this,t,e)),r&&this.__drawAfterFill(t,e),d&&Qh.innerShadow(this,t,h),n&&!a&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e)),c&&$h.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:o}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*o,e.blur*i,Uh.string(e.color))}o&&(s.__isFills?qh.fills(o,this,t,e):qh.fill(o,this,t,e)),h&&t.restore(),r&&this.__drawAfterFill(t,e),n&&!a&&(s.__isStrokes?qh.strokes(n,this,t,e):qh.stroke(n,this,t,e))}}else s.__pathInputed?Pl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:o}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?qh.fills(s,this,t,e):qh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),o&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?qh.strokes(o,this,t,e):qh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Pl(t,e,i){const{fill:s,stroke:o,__drawAfterFill:n,__fillAfterStroke:r}=t.__;t.__drawRenderPath(e),r&&qh.stroke(o,t,e,i),s&&qh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),o&&!r&&qh.stroke(o,t,e,i)}const Ll={__drawFast(t,e){let{x:i,y:s,width:o,height:n}=this.__layout.boxBounds;const{fill:r,stroke:a,__drawAfterFill:h}=this.__;if(r&&(t.fillStyle=r,t.fillRect(i,s,o,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:r,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(r){case"center":t.strokeRect(0,0,o,n);break;case"inside":o-=h,n-=h,o<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,o,n),t.restore()):t.strokeRect(i+l,s+l,o,n);break;case"outside":t.strokeRect(i-l,s-l,o+h,n+h)}}}};var Al;let Dl=Al=class extends rh{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.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 Ho.set(this.path=t||[]),t||this.__drawPathByBox(Ho),Ho}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Ho.set(i=[]),this.__drawPathByBox(Ho)),t?ts.toCanvasData(i,!0):i}getPathString(t,e,i){return ts.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||tl.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Xo.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Kh.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?eo.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,o,a(n)?[n]:n)}else t.rect(e,i,s,o)}drawImagePlaceholder(t,e,i){qh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=_.clone(this.toJSON());return t&&Object.assign(e,t),Al.one(e)}static one(t,e,i,s,o){return le.get(t.tag||this.prototype.__tag,t,e,i,s,o)}static registerUI(){Kn()(this)}static registerData(t){Wn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}};pe([Wn(ll)],Dl.prototype,"__",void 0),pe([Hh()],Dl.prototype,"zoomLayer",void 0),pe([un("")],Dl.prototype,"id",void 0),pe([un("")],Dl.prototype,"name",void 0),pe([un("")],Dl.prototype,"className",void 0),pe([Tn("pass-through")],Dl.prototype,"blendMode",void 0),pe([Cn(1)],Dl.prototype,"opacity",void 0),pe([On(!0)],Dl.prototype,"visible",void 0),pe([Tn(!1)],Dl.prototype,"locked",void 0),pe([Rn(!1)],Dl.prototype,"dim",void 0),pe([Rn(!1)],Dl.prototype,"dimskip",void 0),pe([An(0)],Dl.prototype,"zIndex",void 0),pe([Dn(!1)],Dl.prototype,"mask",void 0),pe([Mn(!1)],Dl.prototype,"eraser",void 0),pe([gn(0,!0)],Dl.prototype,"x",void 0),pe([gn(0,!0)],Dl.prototype,"y",void 0),pe([yn(100,!0)],Dl.prototype,"width",void 0),pe([yn(100,!0)],Dl.prototype,"height",void 0),pe([fn(1,!0)],Dl.prototype,"scaleX",void 0),pe([fn(1,!0)],Dl.prototype,"scaleY",void 0),pe([mn(0,!0)],Dl.prototype,"rotation",void 0),pe([mn(0,!0)],Dl.prototype,"skewX",void 0),pe([mn(0,!0)],Dl.prototype,"skewY",void 0),pe([gn(0,!0)],Dl.prototype,"offsetX",void 0),pe([gn(0,!0)],Dl.prototype,"offsetY",void 0),pe([_n(0,!0)],Dl.prototype,"scrollX",void 0),pe([_n(0,!0)],Dl.prototype,"scrollY",void 0),pe([pn()],Dl.prototype,"origin",void 0),pe([pn()],Dl.prototype,"around",void 0),pe([un(!1)],Dl.prototype,"lazy",void 0),pe([vn(1)],Dl.prototype,"pixelRatio",void 0),pe([Bn(0)],Dl.prototype,"renderSpread",void 0),pe([xn()],Dl.prototype,"path",void 0),pe([bn()],Dl.prototype,"windingRule",void 0),pe([bn(!0)],Dl.prototype,"closed",void 0),pe([yn(0)],Dl.prototype,"padding",void 0),pe([yn(!1)],Dl.prototype,"lockRatio",void 0),pe([yn()],Dl.prototype,"widthRange",void 0),pe([yn()],Dl.prototype,"heightRange",void 0),pe([un(!1)],Dl.prototype,"draggable",void 0),pe([un()],Dl.prototype,"dragBounds",void 0),pe([un("auto")],Dl.prototype,"dragBoundsType",void 0),pe([un(!1)],Dl.prototype,"editable",void 0),pe([Fn(!0)],Dl.prototype,"hittable",void 0),pe([Fn("path")],Dl.prototype,"hitFill",void 0),pe([En("path")],Dl.prototype,"hitStroke",void 0),pe([Fn(!1)],Dl.prototype,"hitBox",void 0),pe([Fn(!0)],Dl.prototype,"hitChildren",void 0),pe([Fn(!0)],Dl.prototype,"hitSelf",void 0),pe([Fn()],Dl.prototype,"hitRadius",void 0),pe([In("")],Dl.prototype,"cursor",void 0),pe([Tn()],Dl.prototype,"fill",void 0),pe([En(void 0,!0)],Dl.prototype,"stroke",void 0),pe([En("inside")],Dl.prototype,"strokeAlign",void 0),pe([En(1,!0)],Dl.prototype,"strokeWidth",void 0),pe([En(!1)],Dl.prototype,"strokeWidthFixed",void 0),pe([En("none")],Dl.prototype,"strokeCap",void 0),pe([En("miter")],Dl.prototype,"strokeJoin",void 0),pe([En()],Dl.prototype,"dashPattern",void 0),pe([En(0)],Dl.prototype,"dashOffset",void 0),pe([En(10)],Dl.prototype,"miterLimit",void 0),pe([bn(0)],Dl.prototype,"cornerRadius",void 0),pe([bn()],Dl.prototype,"cornerSmoothing",void 0),pe([Xh()],Dl.prototype,"shadow",void 0),pe([Xh()],Dl.prototype,"innerShadow",void 0),pe([Xh()],Dl.prototype,"blur",void 0),pe([Xh()],Dl.prototype,"backgroundBlur",void 0),pe([Xh()],Dl.prototype,"grayscale",void 0),pe([Xh()],Dl.prototype,"filter",void 0),pe([Tn()],Dl.prototype,"placeholderColor",void 0),pe([un(100)],Dl.prototype,"placeholderDelay",void 0),pe([un({})],Dl.prototype,"data",void 0),pe([Vn(rh.prototype.reset)],Dl.prototype,"reset",null),Dl=Al=pe([Gn(Rl),Gn(Ol),jn()],Dl);let Ml=class extends Dl{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}};var Fl;pe([Wn(cl)],Ml.prototype,"__",void 0),pe([yn(0)],Ml.prototype,"width",void 0),pe([yn(0)],Ml.prototype,"height",void 0),Ml=pe([Gn(fh),Kn()],Ml);const Il=$t.get("Leafer");let Wl=Fl=class extends Ml{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Qo.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Fl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,_.assign(s,t));const o=this.canvas=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,o,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=o.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,o,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new _e,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(o),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),kr.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(Zr.RESTART):this.emitLeafer(Zr.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(Zr.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=_.copyAttrs({},t,Ce);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(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=_.copyAttrs({},this.canvas,Ce);e.resize(t),this.updateLazyBounds(),this.__onResize(new Ur(t,i))}__onResize(t){this.emitEvent(t),_.copyAttrs(this.__,t,Ce),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 Zt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Ce.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Zr.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Ce.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,o=_.copyAttrs({},s,Ce);o[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(o)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Zr.BEFORE_READY),this.emitLeafer(Zr.READY),this.emitLeafer(Zr.AFTER_READY),kr.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Zr.VIEW_READY),kr.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:o,pixelRatio:n}=this;const r="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,r.x+r.width)),i||(o=Math.max(1,r.y+r.height)),this.__doResize({width:s,height:o,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){kr.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(Zr.VIEW_COMPLETED),kr.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 re.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 Zr(t,this))}__listenEvents(){const t=se.start("FirstCreate "+this.innerName);this.once([[Zr.START,()=>se.end(t)],[Kr.START,this.updateLazyBounds,this],[qr.START,this.__onCreated,this],[qr.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Gr.DATA,this.__onWatchData,this],[Kr.END,this.__onLayoutEnd,this],[qr.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Fl.list.remove(this);try{this.stop(),this.emitLeafer(Zr.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(()=>{tn.clearRecycled()},100)}catch(t){Il.error(t)}}};t?e():setTimeout(e)}};Wl.list=new mh,pe([Wn(gl)],Wl.prototype,"__",void 0),pe([yn()],Wl.prototype,"pixelRatio",void 0),pe([un("normal")],Wl.prototype,"mode",void 0),Wl=Fl=pe([Kn()],Wl);let zl=class extends Dl{get __tag(){return"Rect"}};pe([Wn(fl)],zl.prototype,"__",void 0),zl=pe([Gn(Ll),jn(),Kn()],zl);const{add:Yl,includes:Xl,scroll:Nl}=Vt,Hl=zl.prototype,Vl=Ml.prototype;let jl=class extends Ml{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:o,boxBounds:n}=s,{overflow:r}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=r&&r.includes("scroll"))&&(Yl(a,n),Nl(a,i)),this.__updateRectRenderBounds(),t=!Xl(n,a),t&&"show"===r&&Yl(o,a)}else this.__updateRectRenderBounds();_.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))}};pe([Wn(ul)],jl.prototype,"__",void 0),pe([yn(100)],jl.prototype,"width",void 0),pe([yn(100)],jl.prototype,"height",void 0),pe([un(!1)],jl.prototype,"resizeChildren",void 0),pe([Bn("show")],jl.prototype,"overflow",void 0),pe([Vn(Hl.__updateStrokeSpread)],jl.prototype,"__updateStrokeSpread",null),pe([Vn(Hl.__updateRenderSpread)],jl.prototype,"__updateRectRenderSpread",null),pe([Vn(Hl.__updateBoxBounds)],jl.prototype,"__updateRectBoxBounds",null),pe([Vn(Hl.__updateStrokeBounds)],jl.prototype,"__updateStrokeBounds",null),pe([Vn(Hl.__updateRenderBounds)],jl.prototype,"__updateRectRenderBounds",null),pe([Vn(Hl.__updateChange)],jl.prototype,"__updateRectChange",null),pe([Vn(Hl.__render)],jl.prototype,"__renderRect",null),pe([Vn(Vl.__render)],jl.prototype,"__renderGroup",null),jl=pe([jn(),Kn()],jl);let Ul=class extends jl{get __tag(){return"Frame"}get isFrame(){return!0}};pe([Wn(_l)],Ul.prototype,"__",void 0),pe([Tn("#FFFFFF")],Ul.prototype,"fill",void 0),pe([Bn("hide")],Ul.prototype,"overflow",void 0),Ul=pe([Kn()],Ul);const{moveTo:Gl,closePath:Kl,ellipse:ql}=ks;let Zl=class extends Dl{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:o}=this.__,n=t/2,r=e/2,a=this.__.path=[];i?(s||o?(i<1&&ql(a,n,r,n*i,r*i,0,s,o,!1),ql(a,n,r,n,r,0,o,s,!0),i<1&&Kl(a)):(i<1&&(ql(a,n,r,n*i,r*i),Gl(a,t,r)),ql(a,n,r,n,r,0,360,0,!0)),v.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||o?(Gl(a,n,r),ql(a,n,r,n,r,0,s,o,!1),Kl(a)):ql(a,n,r,n,r)}};pe([Wn(ml)],Zl.prototype,"__",void 0),pe([bn(0)],Zl.prototype,"innerRadius",void 0),pe([bn(0)],Zl.prototype,"startAngle",void 0),pe([bn(0)],Zl.prototype,"endAngle",void 0),Zl=pe([Kn()],Zl);const{sin:Jl,cos:Ql,PI:$l}=Math,{moveTo:td,lineTo:ed,closePath:id,drawPoints:sd}=ks;let od=class extends Dl{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)sd(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:o}=t,n=i/2,r=s/2;td(e,n,0);for(let t=1;t<o;t++)ed(e,n+n*Jl(2*t*$l/o),r-r*Ql(2*t*$l/o));id(e)}}};pe([Wn(yl)],od.prototype,"__",void 0),pe([bn(3)],od.prototype,"sides",void 0),pe([bn()],od.prototype,"points",void 0),pe([bn(0)],od.prototype,"curve",void 0),od=pe([jn(),Kn()],od);const{sin:nd,cos:rd,PI:ad}=Math,{moveTo:hd,lineTo:ld,closePath:dd}=ks;let cd=class extends Dl{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,o=t/2,n=e/2,r=this.__.path=[];hd(r,o,0);for(let t=1;t<2*i;t++)ld(r,o+(t%2==0?o:o*s)*nd(t*ad/i),n-(t%2==0?n:n*s)*rd(t*ad/i));dd(r)}};pe([Wn(vl)],cd.prototype,"__",void 0),pe([bn(5)],cd.prototype,"corners",void 0),pe([bn(.382)],cd.prototype,"innerRadius",void 0),cd=pe([Kn()],cd);const{moveTo:ud,lineTo:gd,drawPoints:_d}=ks,{rotate:pd,getAngle:fd,getDistance:md,defaultPoint:yd}=dt;let vd=class extends Dl{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&pd(i,e),i}set toPoint(t){this.width=md(yd,t),this.rotation=fd(yd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?_d(e,t.points,t.curve,t.closed):(ud(e,0,0),gd(e,this.width,0))}};pe([Wn(pl)],vd.prototype,"__",void 0),pe([kn("center")],vd.prototype,"strokeAlign",void 0),pe([yn(0)],vd.prototype,"height",void 0),pe([bn()],vd.prototype,"points",void 0),pe([bn(0)],vd.prototype,"curve",void 0),pe([bn(!1)],vd.prototype,"closed",void 0),vd=pe([Kn()],vd);let wd=class extends zl{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return d(t)&&t[0].image}};pe([Wn(Sl)],wd.prototype,"__",void 0),pe([yn("")],wd.prototype,"url",void 0),wd=pe([Kn()],wd);const xd=wd;let bd=class extends zl{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ae.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 zr(zr.LOADED,{image:t}))})}draw(t,e,i,s){const o=new mt(t.worldTransform).invert(),n=new mt;e&&n.translate(e.x,e.y),i&&(a(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),o.multiplyParent(n),t.__render(this.canvas,{matrix:o.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}};pe([Wn(El)],bd.prototype,"__",void 0),pe([Nh(100)],bd.prototype,"width",void 0),pe([Nh(100)],bd.prototype,"height",void 0),pe([Nh(1)],bd.prototype,"pixelRatio",void 0),pe([Nh(!0)],bd.prototype,"smooth",void 0),pe([un(!1)],bd.prototype,"safeResize",void 0),pe([Nh()],bd.prototype,"contextSettings",void 0),bd=pe([Kn()],bd);const{copyAndSpread:kd,includes:Sd,spread:Ed,setList:Bd}=Vt,{stintSet:Td}=_;let Rd=class extends Dl{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:o,fontWeight:n,italic:r,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Gh.number(e,o),t.__letterSpacing=Gh.number(i,o),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*o)/2,t.__font=`${r?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${o||12}px ${s||"caption"}`,Td(t,"__padding",l&&W.fourNumber(l)),Td(t,"__clipText","show"!==h&&!t.__autoSize),Td(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=jh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:o,__autoWidth:n,__autoHeight:r}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&Ed(a,i/2),n||r){if(h.x=n?a.x:0,h.y=r?a.y:0,h.width=n?a.width:t.width,h.height=r?a.height:t.height,o){const[e,i,s,o]=t.__padding;n&&(h.x-=o,h.width+=i+o),r&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),_.stintSet(this,"isOverflow",!Sd(h,a)),this.isOverflow?(Bd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;kd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}};pe([Wn(kl)],Rd.prototype,"__",void 0),pe([yn(0)],Rd.prototype,"width",void 0),pe([yn(0)],Rd.prototype,"height",void 0),pe([Tn()],Rd.prototype,"boxStyle",void 0),pe([un(!1)],Rd.prototype,"resizeFontSize",void 0),pe([Tn("#000000")],Rd.prototype,"fill",void 0),pe([kn("outside")],Rd.prototype,"strokeAlign",void 0),pe([Fn("all")],Rd.prototype,"hitFill",void 0),pe([yn("")],Rd.prototype,"text",void 0),pe([yn("")],Rd.prototype,"placeholder",void 0),pe([yn("caption")],Rd.prototype,"fontFamily",void 0),pe([yn(12)],Rd.prototype,"fontSize",void 0),pe([yn("normal")],Rd.prototype,"fontWeight",void 0),pe([yn(!1)],Rd.prototype,"italic",void 0),pe([yn("none")],Rd.prototype,"textCase",void 0),pe([yn("none")],Rd.prototype,"textDecoration",void 0),pe([yn(0)],Rd.prototype,"letterSpacing",void 0),pe([yn({type:"percent",value:1.5})],Rd.prototype,"lineHeight",void 0),pe([yn(0)],Rd.prototype,"paraIndent",void 0),pe([yn(0)],Rd.prototype,"paraSpacing",void 0),pe([yn("x")],Rd.prototype,"writingMode",void 0),pe([yn("left")],Rd.prototype,"textAlign",void 0),pe([yn("top")],Rd.prototype,"verticalAlign",void 0),pe([yn(!0)],Rd.prototype,"autoSizeAlign",void 0),pe([yn("normal")],Rd.prototype,"textWrap",void 0),pe([yn("show")],Rd.prototype,"textOverflow",void 0),pe([Tn(!1)],Rd.prototype,"textEditing",void 0),Rd=pe([Kn()],Rd);let Cd=class extends Dl{get __tag(){return"Path"}};pe([Wn(wl)],Cd.prototype,"__",void 0),pe([kn("center")],Cd.prototype,"strokeAlign",void 0),Cd=pe([Kn()],Cd);let Od=class extends Ml{get __tag(){return"Pen"}setStyle(t){const e=this.pathElement=new Cd(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,o,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,o){return this}ellipse(t,e,i,s,o,n,r,a){return this}arc(t,e,i,s,o,n){return this}arcTo(t,e,i,s,o){return this}drawEllipse(t,e,i,s,o,n,r,a){return this}drawArc(t,e,i,s,o,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}};pe([Wn(xl)],Od.prototype,"__",void 0),pe([(t,e)=>{rn(t,e,{get(){return this.__path}})}],Od.prototype,"path",void 0),Od=pe([Gn(Ys,["set","path","paint"]),Kn()],Od);let Pd=class extends Wl{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:o}=t;e&&(this.ground=this.addLeafer(e)),(i||o)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||o)&&(this.sky=this.addLeafer(s)),o&&ae.editor(o,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(t){const e=new Wl(t);return this.add(e),e}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(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&&_.assign(e,t),this.autoLayout&&_.copyAttrs(e,this,Ce),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Kr.END,this.__onReady,this],[qr.START,this.__onCreated,this],[qr.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(qr.END,this.__onChildRenderEnd,this))}};Pd=pe([Kn()],Pd);const Ld={},Ad={isHoldSpaceKey:()=>Ad.isHold("Space"),isHold:t=>Ld[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Ld[t]||(Ld[t]=!0)},setUpCode(t){Ld[t]=!1}},Dd={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 Md extends Dr{get spaceKey(){return Ad.isHoldSpaceKey()}get left(){return Dd.left(this)}get right(){return Dd.right(this)}get middle(){return Dd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Ad.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){ue.changeName(t,e)}}const{min:Fd,max:Id,abs:Wd}=Math,{float:zd,sign:Yd}=W,{minX:Xd,maxX:Nd,minY:Hd,maxY:Vd}=Vt,jd=new Kt,Ud=new Kt,Gd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Kd.getValidMove(t.__localBoxBounds,Kd.getDragBounds(t),s,e,!0),Kd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:o,dragBoundsType:n}=t;o&&Kd.getValidScaleOf(t.__localBoxBounds,Kd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,o){const n=t.x+s.x,r=t.y+s.y,a=n+t.width,h=r+t.height,l=e.x+e.width,d=e.y+e.height;return o||(s=Object.assign({},s)),Kd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:a<l&&(s.x+=l-a):n<e.x?s.x+=e.x-n:a>l&&(s.x+=l-a),Kd.isInnerMode(t,e,i,"height")?r>e.y?s.y+=e.y-r:h<d&&(s.y+=d-h):r<e.y?s.y+=e.y-r:h>d&&(s.y+=d-h),s.x=zd(s.x),s.y=zd(s.y),s},getValidScaleOf(t,e,i,s,o,n,a){a||(o=Object.assign({},o)),Ud.set(e),jd.set(t).scaleOf(s,o.x,o.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,g,_,p,f=1,m=1;return Kd.isInnerMode(t,e,i,"width")?(o.x<0&&jd.scaleOf(s,f=1/o.x,1),_=zd(jd.minX-Ud.minX),p=zd(Ud.maxX-jd.maxX),u=h&&_>0?1+_/(h*jd.width):1,g=l&&p>0?1+p/(l*jd.width):1,f*=Id(u,g)):(o.x<0&&((zd(Xd(t)-Xd(e))<=0||zd(Nd(e)-Nd(t))<=0)&&jd.scaleOf(s,f=1/o.x,1),jd.unsign()),_=zd(Ud.minX-jd.minX),p=zd(jd.maxX-Ud.maxX),u=h&&_>0?1-_/(h*jd.width):1,g=l&&p>0?1-p/(l*jd.width):1,f*=Fd(u,g)),Kd.isInnerMode(t,e,i,"height")?(o.y<0&&jd.scaleOf(s,1,m=1/o.y),_=zd(jd.minY-Ud.minY),p=zd(Ud.maxY-jd.maxY),u=d&&_>0?1+_/(d*jd.height):1,g=c&&p>0?1+p/(c*jd.height):1,m*=Id(u,g),n&&(u=Id(Wd(f),Wd(m)),f=Yd(f)*u,m=Yd(m)*u)):(o.y<0&&((zd(Hd(t)-Hd(e))<=0||zd(Vd(e)-Vd(t))<=0)&&jd.scaleOf(s,1,m=1/o.y),jd.unsign()),_=zd(Ud.minY-jd.minY),p=zd(jd.maxY-Ud.maxY),u=d&&_>0?1-_/(d*jd.height):1,g=c&&p>0?1-p/(c*jd.height):1,m*=Fd(u,g)),o.x*=r(f)?f:1,o.y*=r(m)?m:1,o}},Kd=Gd;let qd=class extends Md{};qd.POINTER="pointer",qd.BEFORE_DOWN="pointer.before_down",qd.BEFORE_MOVE="pointer.before_move",qd.BEFORE_UP="pointer.before_up",qd.DOWN="pointer.down",qd.MOVE="pointer.move",qd.UP="pointer.up",qd.OVER="pointer.over",qd.OUT="pointer.out",qd.ENTER="pointer.enter",qd.LEAVE="pointer.leave",qd.TAP="tap",qd.DOUBLE_TAP="double_tap",qd.CLICK="click",qd.DOUBLE_CLICK="double_click",qd.LONG_PRESS="long_press",qd.LONG_TAP="long_tap",qd.MENU="pointer.menu",qd.MENU_TAP="pointer.menu_tap",qd=pe([qn()],qd);const Zd=qd,Jd={};let Qd=class extends qd{static setList(t){this.list=t instanceof mh?t:new mh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const o=t.getLocalPoint(i,null,!0);return dt.move(o,e.x-t.x,e.y-t.y),s&&this.limitMove(t,o),Gd.axisMove(t,o),o}static limitMove(t,e){Gd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Jd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Jd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Jd,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 Vt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Vt.unsign(i),i}assignMove(t){Jd.x=t?this.totalX:this.moveX,Jd.y=t?this.totalY:this.moveY}};Qd.BEFORE_DRAG="drag.before_drag",Qd.START="drag.start",Qd.DRAG="drag",Qd.END="drag.end",Qd.OVER="drag.over",Qd.OUT="drag.out",Qd.ENTER="drag.enter",Qd.LEAVE="drag.leave",Qd=pe([qn()],Qd);const $d=Qd;let tc=class extends qd{static setList(t){Qd.setList(t)}static setData(t){Qd.setData(t)}};tc.DROP="drop",tc=pe([qn()],tc);let ec=class extends Qd{};ec.BEFORE_MOVE="move.before_move",ec.START="move.start",ec.MOVE="move",ec.END="move.end",ec=pe([qn()],ec);let ic=class extends Md{};ic=pe([qn()],ic);const sc=ic;let oc=class extends qd{};oc.BEFORE_ROTATE="rotate.before_rotate",oc.START="rotate.start",oc.ROTATE="rotate",oc.END="rotate.end",oc=pe([qn()],oc);let nc=class extends Qd{};nc.SWIPE="swipe",nc.LEFT="swipe.left",nc.RIGHT="swipe.right",nc.UP="swipe.up",nc.DOWN="swipe.down",nc=pe([qn()],nc);let rc=class extends qd{};rc.BEFORE_ZOOM="zoom.before_zoom",rc.START="zoom.start",rc.ZOOM="zoom",rc.END="zoom.end",rc=pe([qn()],rc);let ac=class extends Md{};ac.BEFORE_DOWN="key.before_down",ac.BEFORE_UP="key.before_up",ac.DOWN="key.down",ac.HOLD="key.hold",ac.UP="key.up",ac=pe([qn()],ac);const hc={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?nc.UP:t>45&&t<135?nc.DOWN:t<=45&&t>=-45?nc.RIGHT:nc.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:lc.getSwipeDirection(dt.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:s(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 mh,{list:s}=t;for(let t=0,o=s.length;t<o;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some(t=>ar.draggable(t)||!t.isLeafer&&t.hasEvent(Qd.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},lc=hc,dc=new mh,{getDragEventData:cc,getDropEventData:uc,getSwipeEventData:gc}=hc;class _c{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=cc(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,o=Qd.list||this.draggableList||dc;return this.dragging&&(s?t?dc:new mh(e?[...i.list,...i.dragHoverExclude]:i.list):o)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(ec.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&Dd.left(t),this.dragging&&(this.interaction.emit(Qd.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],ar.draggable(e)){this.draggableList=new mh(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:o,throughPath:n}=s;this.dragData=cc(s,i,t),n&&(this.dragData.throughPath=n),this.dragData.path=o,this.moving?(t.moving=!0,this.dragData.moveType="drag",e.emit(ec.BEFORE_MOVE,this.dragData),e.emit(ec.MOVE,this.dragData)):this.dragging&&(t.dragging=!0,this.dragReal(),e.emit(Qd.BEFORE_DRAG,this.dragData),e.emit(Qd.DRAG,this.dragData))}dragReal(t){const{interaction:e}=this,{running:i}=e,s=this.realDraggableList;if(s.length&&i){const{totalX:i,totalY:o}=this.dragData,{dragLimitAnimate:r}=e.p,h=!r||!!t;s.forEach(e=>{if(e.draggable){const s=n(e.draggable),l=Qd.getValidMove(e,this.dragStartPoints[e.innerId],{x:i,y:o},h||s);r&&!s&&t?ar.animateMove(e,l,a(r)?r:.3):e.move(l)}})}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(Qd.OUT,t,i),e.emit(Qd.OVER,t,s)):e.emit(Qd.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(Qd.LEAVE,t,i,s),e.emit(Qd.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:o,throughPath:n}=i,r=cc(i,t,t);if(n&&(r.throughPath=n),r.path=o,this.moving&&(this.moving=!1,r.moveType="drag",e.emit(ec.END,r)),this.dragging){const o=this.getList();this.dragging=!1,e.p.dragLimitAnimate&&this.dragReal(!0),e.emit(Qd.END,r),this.swipe(t,i,s,r),this.drop(t,o,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:o}=this;if(dt.getDistance(e,t)>o.config.pointer.swipeDistance){const t=gc(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=uc(t,e,Qd.data);s.path=i,this.interaction.emit(tc.DROP,s),this.interaction.emit(Qd.LEAVE,t,i)}dragReset(){Qd.list=Qd.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 pc=$t.get("emit");const fc=["move","zoom","rotate","key"];function mc(t,e,i,s,o){if(fc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!vc(t,o)){let n;for(let r=0,a=t.children.length;r<a;r++)n=t.children[r],!i.path.has(n)&&n.__.hittable&&yc(n,e,i,s,o)}}function yc(t,e,i,s,o){if(t.destroyed)return!1;if(t.__.hitSelf&&!vc(t,o)&&(el.updateEventStyle&&!s&&el.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const o=ue.get(e,i);if(t.emitEvent(o,s),o.isStop)return!0}return!1}function vc(t,e){return e&&e.has(t)}const wc={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:xc,pathCanDrag:bc,pathHasOutside:kc}=hc;class Sc{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&&Dd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Dd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Ad.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=_.clone(wc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new mh(t),this.createTransformer(),this.dragger=new _c(this),s&&(this.config=_.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(Dd.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(qd.BEFORE_DOWN,t),this.emit(qd.DOWN,t),Dd.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=Dd.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&Dd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(qd.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=dt.getDistance(this.downData,t)>this.p.dragDistance;e&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(qd.MOVE,t),this.pointerHover(t),this.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;Dd.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(qd.BEFORE_UP,t),this.emit(qd.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(qd.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(qd.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;this.emit(ac.BEFORE_DOWN,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,Ad.setDownCode(e),this.emit(ac.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(ac.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;this.emit(ac.BEFORE_UP,t,this.defaultPath);const{code:e}=t;this.downKeyMap[e]=!1,Ad.setUpCode(e),this.emit(ac.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new mh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(qd.OUT,t,i),this.emit(qd.OVER,t,e)):this.emit(qd.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach(t=>e.add(t)));const{enterPath:i}=this;this.enterPath=e,this.emit(qd.LEAVE,t,i,e),this.emit(qd.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(qd.LEAVE,t),this.dragger.dragging&&this.emit(tc.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,o=[qd.DOUBLE_TAP,qd.DOUBLE_CLICK].some(e=>xc(t.path,e));s<e.tapTime+50&&o?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))},e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:o,target:n}=this;v.backgrounder||t.origin||n&&n.updateLayout();const r=this.selector.getByPoint(t,i,Object.assign({bottomList:o,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.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&&!kc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!bc(t.path))&&!kc(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:qd.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,o=s.length;t<o&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:o}=this.canvas;return s.x*=o.width/i.width,s.y*=o.height/i.height,this.p.snap&&dt.round(s),s}emitTap(t){this.emit(qd.TAP,t),this.emit(qd.CLICK,t)}emitDoubleTap(t){this.emit(qd.DOUBLE_TAP,t),this.emit(qd.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(qd.LONG_PRESS,t)},this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(qd.LONG_TAP,t),(xc(t.path,qd.LONG_TAP)||xc(t.path,qd.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ur.RESIZE,this.__onResize,this)],t.once(Zr.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let o;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(o=i.list[n],yc(o,t,e,!0,s))return;o.isApp&&mc(o,t,e,!0,s)}for(let n=0,r=i.length;n<r;n++)if(o=i.list[n],o.isApp&&mc(o,t,e,!1,s),yc(o,t,e,!1,s))return}catch(t){pc.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 Ec{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Ec.custom={};class Bc extends _e{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new mh,this.pixelList=new mh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.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()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())};const{toInnerRadiusPointOf:Tc,copy:Rc,setRadius:Cc}=dt,{hitRadiusPoint:Oc,hitPoint:Pc}=Vt,Lc={},Ac={},Dc=rh.prototype;Dc.hit=function(t,e=0){this.updateLayout(),Rc(Ac,t),Cc(Ac,e);const i=this.__world;return!!(e?Oc(i,Ac):Pc(i,Ac))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},Ac),e,{target:this}):this.__hitWorld(Ac))},Dc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,o=i.width<10&&i.height<10;if(e.hitRadius&&(Rc(Lc,t),Cc(t=Lc,e.hitRadius)),Tc(t,i,Lc),e.hitBox||o){if(Vt.hitRadiusPoint(s.boxBounds,Lc))return!0;if(o)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(Lc)},Dc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},Dc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},Dc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},Dc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Mc=new mt,Fc=Dl.prototype;Fc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,o=i||s;this.__hitCanvas||(this.__hitCanvas=o?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(o){const{renderBounds:t}=this.__layout,o=v.image.hitCanvasSize,r=n.hitScale=qt.set(0,0,o,o).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=qt.set(t).scale(r);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),tn.patternLocked=!0,this.__renderShape(n,{matrix:Mc.setWith(this.__world).scaleWith(1/r).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),tn.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},Fc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:o,__maxStrokeWidth:n}=e,r=e.stroke&&("path"===o||"pixel"===o&&!e.__isAlphaPixelStroke)||"all"===o;if(!s&&!r)return!1;const a=2*t.radiusX;let h=a;if(r)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const Ic=Dl.prototype,Wc=zl.prototype,zc=jl.prototype;Wc.__updateHitCanvas=zc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Ic.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Wc.__hitFill=zc.__hitFill=function(t){return this.__hitCanvas?Ic.__hitFill.call(this,t):Vt.hitRadiusPoint(this.__layout.boxBounds,t)},Rd.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:o,__textDrawData:n}=this.__;t.beginPath(),o<0?this.__drawPathByBox(t):n.rows.forEach(o=>t.rect(o.x,o.y-s,o.width,e<i?i:e))},Ml.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),v.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Yc=Oe.prototype;Yc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Yc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Yc.hitPixel=function(t,e,i=1){let{x:s,y:o,radiusX:n,radiusY:r}=t;e&&(s-=e.x,o-=e.y),qt.set(s-n,o-r,2*n,2*r).scale(i).ceil();const{data:a}=this.context.getImageData(qt.x,qt.y,qt.width||1,qt.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 Xc={convertTouch(t,e){const i=Xc.getTouch(t),s=hc.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class Nc extends Sc{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){return s(t.x)?super.getLocal(t,e):{x:t.x,y:t.y}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=Xc.getTouch(t);this.pointerDown(Xc.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=Xc.getTouch(t);this.pointerMove(Xc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=Xc.getTouch(t);this.pointerUp(Xc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(hc.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}destroy(){super.destroy(),this.touches=null}}function Hc(t,e,i){t.__.__font?qh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Vc(t,e,i,s,o){const n=i.__;c(t)?qh.drawStrokesStyle(t,e,!1,i,s,o):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&qh.strokeArrow(t,i,s,o)}function jc(t,e,i,s,o){const n=i.__;c(t)?qh.drawStrokesStyle(t,e,!0,i,s,o):(s.setStroke(t,n.__strokeWidth*e,n),qh.drawTextStroke(i,s,o))}function Uc(t,e,i,s,o){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,jc(t,2,i,n,o),n.blendMode="outside"===e?"destination-out":"destination-in",qh.fillText(i,n,o),n.blendMode="normal",ar.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}const{getSpread:Gc,copyAndSpread:Kc,toOuterOf:qc,getOuterOf:Zc,getByMove:Jc,move:Qc,getIntersectData:$c}=Vt,tu={};let eu;const{stintSet:iu}=_,{hasTransparent:su}=Uh;function ou(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let o;const{boxBounds:r}=i.__layout;switch(e.type){case"image":o=Zh.image(i,t,e,r,!eu||!eu[e.url]);break;case"linear":o=Jh.linearGradient(e,r);break;case"radial":o=Jh.radialGradient(e,r);break;case"angular":o=Jh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;o={type:n,style:Uh.string(a,h)};break;default:s(e.r)||(o={type:"solid",style:Uh.string(e)})}if(o&&(o.originPaint=e,n(o.style)&&su(o.style)&&(o.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;o.strokeStyle=e.style}return o}const nu={compute:function(t,e){const i=e.__,s=[];let o,n,r,a=i.__input[t];d(a)||(a=[a]),eu=Zh.recycleImage(t,i);for(let i,o=0,n=a.length;o<n;o++)(i=ou(t,a[o],e))&&(s.push(i),i.strokeStyle&&(r||(r=1),i.strokeStyle.strokeWidth&&(r=Math.max(r,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(o=!0),n=!0),"fill"===t?(iu(i,"__isAlphaPixelFill",o),iu(i,"__isTransparentFill",n)):(iu(i,"__isAlphaPixelStroke",o),iu(i,"__isTransparentStroke",n),iu(i,"__hasMultiStrokeStyle",r))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,Hc(e,i,s)},fills:function(t,e,i,s){let o,n,r;for(let a=0,h=t.length;a<h;a++){if(o=t[a],n=o.originPaint,o.image){if(r?r++:r=1,Zh.checkImage(o,!e.__.__font,e,i,s))continue;if(!o.style){1===r&&o.image.isPlacehold&&e.drawImagePlaceholder(o,i,s);continue}}if(i.fillStyle=o.style,o.transform||n.scaleFixed){if(i.save(),o.transform&&i.transform(o.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),Hc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),Hc(e,i,s),i.restoreBlendMode()):Hc(e,i,s)}},fillPathOrText:Hc,fillText:function(t,e,i){const s=t.__,{rows:o,decorationY:n}=s.__textDrawData;let r;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=o.length;t<i;t++)r=o[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:i}=s.__textDrawData;t&&(e.fillStyle=t),o.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const o=e.__;if(o.__strokeWidth)if(o.__font)qh.strokeText(t,e,i,s);else switch(o.strokeAlign){case"center":Vc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Vc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const o=e.__;if(o.__fillAfterStroke)Vc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,r=i.getSameCanvas(!0,!0);e.__drawRenderPath(r),Vc(t,2,e,r,s),r.clipUI(o),r.clearWorld(n),ar.copyCanvasByWorld(e,i,r),r.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){qh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":jc(t,1,e,i,s);break;case"inside":Uc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?jc(t,2,e,i,s):Uc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,o=t.__.__textDrawData;const{rows:n,decorationY:r}=o;for(let t=0,i=n.length;t<i;t++)s=n[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(r){const{decorationHeight:t}=o;n.forEach(i=>r.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,o,n){let r;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||o.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(r=t[l],(!r.image||!Zh.checkImage(r,!1,s,o,n))&&r.style){if(h){const{strokeStyle:t}=r;t?o.setStroke(r.style,a.__getRealStrokeWidth(t)*e,a,t):o.setStroke(r.style,a.__strokeWidth*e,a)}else o.strokeStyle=r.style;r.originPaint.blendMode?(o.saveBlendMode(r.originPaint.blendMode),i?qh.drawTextStroke(s,o,n):o.stroke(),o.restoreBlendMode()):i?qh.drawTextStroke(s,o,n):o.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),o=e.bounds,n=t.__nowWorld,r=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,g;qc(r.strokeSpread?(Kc(tu,r.boxBounds,r.strokeSpread),tu):r.boxBounds,n,a);let{scaleX:_,scaleY:p}=t.getRenderScaleData(!0);if(o.includes(a))g=s,h=u=a,l=n;else{let s;if(v.fullImageShadow)s=a;else{const t=r.renderShapeSpread?Gc(o,R.swapAndScale(r.renderShapeSpread,_,p)):o;s=$c(t,a)}c=o.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(g=e.getSameCanvas(),t.__renderShape(g,i),_*=f,p*=m),u=Zc(a,c),h=Jc(u,-c.e,-c.f),l=Zc(n,c),Qc(l,-c.e,-c.f);const y=i.matrix;y?(d=new mt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:g,shapeBounds:u,scaleX:_,scaleY:p}}};let ru,au=new Kt;const{isSame:hu}=Vt;function lu(t,e,i,s,o,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return o.data||Zh.createData(o,s,i,n),!0}function du(t,e){gu(t,zr.LOAD,e)}function cu(t,e){gu(t,zr.LOADED,e)}function uu(t,e,i){e.error=i,t.forceUpdate("surface"),gu(t,zr.ERROR,e)}function gu(t,e,i){t.hasEvent(e)&&t.emitEvent(new zr(e,i))}function _u(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:pu,translate:fu}=$,mu=new Kt,yu={},vu={};function wu(t,e,i,s){const o=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&o<0?0:o}let xu={},bu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:ku,set:Su,rotateOfOuter:Eu,translate:Bu,scaleOfOuter:Tu,multiplyParent:Ru,scale:Cu,rotate:Ou,skew:Pu}=$;function Lu(t,e,i,s,o,n,r,a){r&&Ou(t,r),a&&Pu(t,a.x,a.y),o&&Cu(t,o,n),Bu(t,e.x+i,e.y+s)}const{get:Au,scale:Du,copy:Mu}=$,{getFloorScale:Fu}=W,{abs:Iu}=Math;const Wu={image:function(t,e,i,s,o){let n,r;const a=tn.get(i);return ru&&i===ru.paint&&hu(s,ru.boxBounds)?n=ru.leafPaint:(n={type:i.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),ru=a.use>1?{leafPaint:n,paint:i,boxBounds:au.set(s)}:null),(o||a.loading)&&(r={image:a,attrName:e,attrValue:i}),a.ready?(lu(t,e,i,a,n,s),o&&(du(t,r),cu(t,r))):a.error?o&&uu(t,r,a.error):(o&&(_u(t,!0),du(t,r)),n.loadId=a.load(()=>{_u(t,!1),t.destroyed||(lu(t,e,i,a,n,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),cu(t,r)),n.loadId=void 0},e=>{_u(t,!1),uu(t,r,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,e,i,s,o){const{scaleX:n,scaleY:r}=Zh.getImageRenderScaleData(t,i,s,o),{image:a,data:h,originPaint:l}=t,{exporting:d}=o;return!(!h||t.patternId===n+"-"+r&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&Ur.isResizing(i)||d||(e=v.image.isLarge(a,n,r))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Zh.drawImage(t,n,r,i,s,o),!0):(!t.style||l.sync||d?Zh.createPattern(t,i,s,o):Zh.createPatternTask(t,i,s,o),!1))},drawImage:function(t,e,i,s,o,n){const{data:r,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=r,c=a.getFull(r.filters),u=s.__;let g,{width:_,height:p}=a;(g=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(o.save(),g&&o.clipUI(s),h&&(o.blendMode=h),l&&(o.opacity*=l),d&&o.transform(d),o.drawImage(c,0,0,_,p),o.restore()):(r.scaleX&&(_*=r.scaleX,p*=r.scaleY),o.drawImage(c,0,0,_,p))},getImageRenderScaleData:function(t,e,i,s){const o=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;o.scaleX*=t,o.scaleY*=t}return n&&n.scaleX&&(o.scaleX*=Math.abs(n.scaleX),o.scaleY*=Math.abs(n.scaleY)),o},recycleImage:function(t,e){const i=e["_"+t];if(d(i)){let s,o,n,r,a;for(let h=0,l=i.length;h<l;h++)s=i[h],o=s.image,a=o&&o.url,a&&(n||(n={}),n[a]=!0,tn.recycle(o),o.loading&&(r||(r=e.__input&&e.__input[t]||[],d(r)||(r=[r])),o.unload(i[h].loadId,!r.some(t=>t.url===a))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=tn.patternTasker.add(()=>fe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Zh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:o,scaleY:n}=Zh.getImageRenderScaleData(t,e,i,s),r=o+"-"+n;if(t.patternId!==r&&!e.destroyed&&(!v.image.isLarge(t.image,o,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Zh.getPatternFixScale(t,o,n);let d,c,u,{width:g,height:_}=i;l&&(o*=l,n*=l),g*=o,_*=n,h&&(c=h.x*o/Iu(s.scaleX||1),u=h.y*n/Iu(s.scaleY||1)),(a||1!==o||1!==n)&&(o*=Fu(g+(c||0)),n*=Fu(_+(u||0)),d=Au(),a&&Mu(d,a),Du(d,1/o,1/n));const p=i.getCanvas(g,_,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(p,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=r}},getPatternFixScale:function(t,e,i){const{image:s}=t;let o,n=v.image.maxPatternSize,r=s.width*s.height;return s.isSVG?e>1&&(o=Math.ceil(e)/e):n>r&&(n=r),(r*=e*i)>n&&(o=Math.sqrt(n/r)),o},createData:function(t,e,i,s){t.data=Zh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=mu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:o}=i,{opacity:r,mode:a,align:h,offset:l,scale:d,size:u,rotation:g,skew:_,clipSize:p,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===o,w={mode:a},x="center"!==h&&(g||0)%180==90;let b,k;switch(Vt.set(vu,0,0,x?o:s,x?s:o),a&&"cover"!==a&&"fit"!==a?((d||u)&&(W.getScaleData(d,u,i,yu),b=yu.scaleX,k=yu.scaleY),(h||m||f)&&(b&&Vt.scale(vu,b,k,!0),h&&Tt.toPoint(h,vu,e,vu,!0,!0))):v&&!g||(b=k=Vt.getFitScale(e,vu,"fit"!==a),Vt.put(e,i,h,b,!1,vu),Vt.scale(vu,b,k,!0)),l&&dt.move(vu,l),a){case"stretch":v?b&&(b=k=void 0):(b=e.width/s,k=e.height/o,Zh.stretchMode(w,e,b,k));break;case"normal":case"clip":if(vu.x||vu.y||b||p||g||_){let t,i;p&&(t=e.width/p.width,i=e.height/p.height),Zh.clipMode(w,e,vu.x,vu.y,b,k,g,_,t,i),t&&(b=b?b*t:t,k=k?k*i:i)}break;case"repeat":(!v||b||g||_)&&Zh.repeatMode(w,e,s,o,vu.x,vu.y,b,k,g,_,h,t.freeTransform),f||(w.repeat="repeat");const i=c(f);(m||i)&&(w.gap=function(t,e,i,s,o){let n,r;c(t)?(n=t.x,r=t.y):n=r=t;return{x:wu(n,i,o.width,e&&e.x),y:wu(r,s,o.height,e&&e.y)}}(m,i&&f,vu.width,vu.height,e));break;default:b&&Zh.fillOrFitMode(w,e,vu.x,vu.y,b,k,g)}return w.transform||(e.x||e.y)&&fu(w.transform=pu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=k),r&&r<1&&(w.opacity=r),y&&(w.filters=y),f&&(w.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w},stretchMode:function(t,e,i,s){const o=ku(),{x:n,y:r}=e;n||r?Bu(o,n,r):o.onlyScale=!0,Cu(o,i,s),t.transform=o},fillOrFitMode:function(t,e,i,s,o,n,r){const a=ku();Bu(a,e.x+i,e.y+s),Cu(a,o,n),r&&Eu(a,{x:e.x+e.width/2,y:e.y+e.height/2},r),t.transform=a},clipMode:function(t,e,i,s,o,n,r,a,h,l){const d=ku();Lu(d,e,i,s,o,n,r,a),h&&(r||a?(Su(bu),Tu(bu,e,h,l),Ru(d,bu)):Tu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,o,n,r,a,h,l,d,c){const u=ku();if(c)Lu(u,e,o,n,r,a,h,l);else{if(h)if("center"===d)Eu(u,{x:i/2,y:s/2},h);else switch(Ou(u,h),h){case 90:Bu(u,s,0);break;case 180:Bu(u,i,s);break;case 270:Bu(u,0,i)}xu.x=e.x+o,xu.y=e.y+n,Bu(u,xu.x,xu.y),r&&Tu(u,xu,r,a)}t.transform=u}},{toPoint:zu}=St,{hasTransparent:Yu}=Uh,Xu={},Nu={};function Hu(t,e,i,s){if(i){let o,r,a,h;for(let t=0,l=i.length;t<l;t++)o=i[t],n(o)?(a=t/(l-1),r=Uh.string(o,s)):(a=o.offset,r=Uh.string(o.color,s)),e.addColorStop(a,r),!h&&Yu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Vu,getDistance:ju}=dt,{get:Uu,rotateOfOuter:Gu,scaleOfOuter:Ku}=$,{toPoint:qu}=St,Zu={},Ju={};function Qu(t,e,i,s,o){let n;const{width:r,height:a}=t;if(r!==a||s){const t=Vu(e,i);n=Uu(),o?(Ku(n,e,r/a*(s||1),1),Gu(n,e,t+90)):(Ku(n,e,1,r/a*(s||1)),Gu(n,e,t))}return n}const{getDistance:$u}=dt,{toPoint:tg}=St,eg={},ig={};const sg={linearGradient:function(t,e){let{from:i,to:s,type:o,opacity:n}=t;zu(i||"top",e,Xu),zu(s||"bottom",e,Nu);const r=v.canvas.createLinearGradient(Xu.x,Xu.y,Nu.x,Nu.y),a={type:o,style:r};return Hu(a,r,t.stops,n),a},radialGradient:function(t,e){let{from:i,to:s,type:o,opacity:n,stretch:r}=t;qu(i||"center",e,Zu),qu(s||"bottom",e,Ju);const a=v.canvas.createRadialGradient(Zu.x,Zu.y,0,Zu.x,Zu.y,ju(Zu,Ju)),h={type:o,style:a};Hu(h,a,t.stops,n);const l=Qu(e,Zu,Ju,r,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:o,opacity:n,stretch:r}=t;tg(i||"center",e,eg),tg(s||"bottom",e,ig);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,eg.x,eg.y):v.canvas.createRadialGradient(eg.x,eg.y,0,eg.x,eg.y,$u(eg,ig)),h={type:o,style:a};Hu(h,a,t.stops,n);const l=Qu(e,eg,ig,r||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:Qu},{copy:og,move:ng,toOffsetOutBounds:rg}=Vt,{max:ag,abs:hg}=Math,lg={},dg=new mt,cg={};function ug(t,e){let i,s,o,n,r=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),o=hg(t.spread||0),r=ag(r,o+n-s),a=ag(a,o+n+i),h=ag(h,o+n+s),l=ag(l,o+n-i)}),r===a&&a===h&&h===l?r:[r,a,h,l]}function gg(t,e,i){const{shapeBounds:s}=i;let o,n;v.fullImageShadow?(og(lg,t.bounds),ng(lg,e.x-s.x,e.y-s.y),o=t.bounds,n=lg):(o=s,n=e),t.copyWorld(i.canvas,o,n)}const{toOffsetOutBounds:_g}=Vt,pg={};const fg=ug;const mg={shadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{shadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;rg(h,cg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.setWorldShadow(cg.offsetX+(r.x||0)*c*f,cg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f,Uh.string(r.color)),o=Qh.getShadowTransform(t,g,i,r,cg,f),o&&g.setTransform(o),gg(g,cg,i),o&&g.resetTransform(),s=l,r.box&&(g.restore(),g.save(),a&&(g.copyWorld(g,l,n,"copy"),s=n),a?g.copyWorld(a,n,n,"destination-out"):g.copyWorld(i.canvas,d,h,"destination-out")),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.recycle(s)},innerShadow:function(t,e,i){let s,o;const{__nowWorld:n}=t,{innerShadow:r}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,g=e.getSameCanvas(),_=r.length-1;_g(h,pg,l),r.forEach((r,p)=>{let f=1;if(r.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}g.save(),g.setWorldShadow(pg.offsetX+(r.x||0)*c*f,pg.offsetY+(r.y||0)*u*f,(r.blur||0)*c*f),o=Qh.getShadowTransform(t,g,i,r,pg,f,!0),o&&g.setTransform(o),gg(g,pg,i),g.restore(),a?(g.copyWorld(g,l,n,"copy"),g.copyWorld(a,n,n,"source-out"),s=n):(g.copyWorld(i.canvas,d,h,"source-out"),s=l),g.fillWorld(s,Uh.string(r.color),"source-in"),ar.copyCanvasByWorld(t,e,g,s,r.blendMode),_&&p<_&&g.clearWorld(s)}),g.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){},getShadowRenderSpread:ug,getShadowTransform:function(t,e,i,s,o,n,r){if(s.spread){const i=2*s.spread*n*(r?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return dg.set().scaleOfOuter({x:(o.x+o.width/2)*e.pixelRatio,y:(o.y+o.height/2)*e.pixelRatio},1+i/a,1+i/h),dg}},isTransformShadow(t){},getInnerShadowSpread:fg},{excludeRenderBounds:yg}=pr;let vg;function wg(t,e,i,s,o,n,r,a){switch(e){case"grayscale":vg||(vg=!0,o.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,o,n){const r=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,r),n&&s.recycle(r);bg(t,e,i,1,o,n)}(t,i,s,o,r,a);break;case"opacity-path":bg(t,i,s,n,r,a);break;case"path":a&&i.restore()}}function xg(t){return t.getSameCanvas(!1,!0)}function bg(t,e,i,s,o,n){const r=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,r,void 0,o),n?i.recycle(r):i.clearWorld(r)}Ml.prototype.__renderMask=function(t,e){let i,s,o,n,r,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){r&&(wg(this,r,t,o,s,n,void 0,!0),s=o=null),"clipping"!==a&&"clipping-path"!==a||yg(i,e)||i.__render(t,e),n=i.__.opacity,vg=!1,"path"===a||"clipping-path"===a?(n<1?(r="opacity-path",o||(o=xg(t))):(r="path",t.save()),i.__clip(o||t,e)):(r="grayscale"===a?"grayscale":"alpha",s||(s=xg(t)),o||(o=xg(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&wg(this,r,t,o,s,n,void 0,!1),yg(i,e)||i.__render(o||t,e),d&&wg(this,r,t,o,s,n,d,!1)}wg(this,r,t,o,s,n,void 0,!0)};const kg=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Sg=kg+"_#~&*+\\=|≮≯≈≠=…",Eg=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 Bg(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Tg=Bg("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Rg=Bg("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Cg=Bg(kg),Og=Bg(Sg),Pg=Bg("- —/~|┆·");var Lg;!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"}(Lg||(Lg={}));const{Letter:Ag,Single:Dg,Before:Mg,After:Fg,Symbol:Ig,Break:Wg}=Lg;function zg(t){return Tg[t]?Ag:Pg[t]?Wg:Rg[t]?Mg:Cg[t]?Fg:Og[t]?Ig:Eg.test(t)?Dg:Ag}const Yg={trimRight(t){const{words:e}=t;let i,s=0,o=e.length;for(let n=o-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(o-s,s)}};function Xg(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:Ng}=Yg,{Letter:Hg,Single:Vg,Before:jg,After:Ug,Symbol:Gg,Break:Kg}=Lg;let qg,Zg,Jg,Qg,$g,t_,e_,i_,s_,o_,n_,r_,a_,h_,l_,d_,c_,u_=[];function g_(t,e){s_&&!i_&&(i_=s_),qg.data.push({char:t,width:e}),Jg+=e}function __(){Qg+=Jg,qg.width=Jg,Zg.words.push(qg),qg={data:[]},Jg=0}function p_(){h_&&(l_.paraNumber++,Zg.paraStart=!0,h_=!1),s_&&(Zg.startCharSize=i_,Zg.endCharSize=s_,i_=0),Zg.width=Qg,d_.width?Ng(Zg):c_&&f_(),u_.push(Zg),Zg={words:[]},Qg=0}function f_(){Qg>(l_.maxWidth||0)&&(l_.maxWidth=Qg)}const{top:m_,right:y_,bottom:v_,left:w_}=xt;function x_(t,e,i){const{bounds:s,rows:o}=t;s[e]+=i;for(let t=0;t<o.length;t++)o[t][e]+=i}const b_={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,o=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(o?(i=a[w_],o-=a[y_]+a[w_],!o&&(o=.01)):e.autoSizeAlign||(i=a[w_]),r?(s=a[m_],r-=a[m_]+a[v_],!r&&(r=.01)):e.autoSizeAlign||(s=a[m_]));const h={bounds:{x:i,y:s,width:o,height:r},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){l_=t,u_=t.rows,d_=t.bounds,c_=!d_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:o,textCase:n}=i,{canvas:r}=v,{width:a}=d_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;h_=!0,n_=null,i_=e_=s_=Jg=Qg=0,qg={data:[]},Zg={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)t_=e[i],"\n"===t_?(Jg&&__(),Zg.paraEnd=!0,p_(),h_=!0):(o_=zg(t_),o_===Hg&&"none"!==n&&(t_=Xg(t_,n,!Jg)),e_=r.measureText(t_).width,s&&(s<0&&(s_=e_),e_+=s),r_=o_===Vg&&(n_===Vg||n_===Hg)||n_===Vg&&o_!==Ug,a_=!(o_!==jg&&o_!==Vg||n_!==Gg&&n_!==Ug),$g=h_&&o?a-o:a,t&&a&&Qg+Jg+e_>$g&&(h?(Jg&&__(),Qg&&p_()):(a_||(a_=o_===Hg&&n_==Ug),r_||a_||o_===Kg||o_===jg||o_===Vg||Jg+e_>$g?(Jg&&__(),Qg&&p_()):Qg&&p_()))," "===t_&&!0!==h_&&Qg+Jg===0||(o_===Kg?(" "===t_&&Jg&&__(),g_(t_,e_),__()):r_||a_?(Jg&&__(),g_(t_,e_)):g_(t_,e_)),n_=o_);Jg&&__(),Qg&&p_(),u_.length>0&&(u_[u_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{l_.paraNumber++,Qg=r.measureText(t).width,u_.push({x:o||0,text:t,width:Qg,paraStart:!0}),c_&&f_()})}(h,t,e),a&&function(t,e,i,s,o){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":x_(e,"x",t[w_]);break;case"right":x_(e,"x",-t[y_])}if(!o&&i.autoSizeAlign)switch(i.verticalAlign){case"top":x_(e,"y",t[m_]);break;case"bottom":x_(e,"y",-t[v_])}}(a,h,e,o,r),function(t,e){const{rows:i,bounds:s}=t,o=i.length,{__lineHeight:n,__baseLine:r,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:g,y:_,width:p,height:f}=s,m=n*o+(c?c*(t.paraNumber-1):0),y=r;if(h&&m>f)m=Math.max(f,n),o>1&&(t.overflow=o);else if(f||u)switch(d){case"middle":_+=(f-m)/2;break;case"bottom":_+=f-m}y+=_;let v,w,x,b=p||u?p:t.maxWidth;for(let r=0,d=o;r<d;r++){if(v=i[r],v.x=g,v.width<p||v.width>p&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&r>0&&(y+=c),v.y=y,y+=n,t.overflow>r&&y>m&&(v.isOverflow=!0,t.overflow=r+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&p&&p<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:o,paraIndent:n,letterSpacing:r}=e,a=i&&o.includes("both"),h=a||i&&o.includes("justify"),l=h&&o.includes("letter");let d,c,u,g,_,p,f,m,y,v;s.forEach(t=>{t.words&&(_=n&&t.paraStart?n:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?g=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),p=r||t.isOverflow||l?0:u?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===p?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===p?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,o){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,o&&(e+=o)}),e}(e.data,d,t.data,t.isOverflow,v&&g),v&&(y=i===m-1,u?y||(d+=u,t.width+=u):g&&(t.width+=g*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,o),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:o,overflow:n}=t;let{textOverflow:r}=e;if(o.splice(n),r&&"show"!==r){let t,a;"hide"===r?r="":"ellipsis"===r&&(r="...");const h=r?v.canvas.measureText(r).width:0,l=i+s-h;("none"===e.textWrap?o:[o[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:r,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,o),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:o,textDecoration:n}=e;switch(t.decorationHeight=o/11,c(n)?(i=n.type,n.color&&(t.decorationColor=Uh.string(n.color)),n.offset&&(s=Math.min(.3*o,Math.max(n.offset,.15*-o)))):i=n,i){case"under":t.decorationY=[.15*o+s];break;case"delete":t.decorationY=[.35*-o];break;case"under-delete":t.decorationY=[.15*o+s,.35*-o]}}(h,e),h}};const k_={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(n(t)){if(!i||!Uh.object)return t;t=Uh.object(t)}let o=s(t.a)?1:t.a;i&&(o*=e);const r=t.r+","+t.g+","+t.b;return 1===o?"rgb("+r+")":"rgba("+r+","+o+")"}};Object.assign(jh,b_),Object.assign(Uh,k_),Object.assign(qh,nu),Object.assign(Zh,Wu),Object.assign(Jh,sg),Object.assign(Qh,mg),Object.assign(ae,{interaction:(t,e,i,s)=>new Nc(t,e,i,s),hitCanvas:(t,e)=>new wh(t,e),hitCanvasManager:()=>new Bc}),Wl.prototype.receiveEvent=function(t){this.interaction&&this.interaction.receive(t)};try{wx&&kh(0,wx)}catch(t){}function S_(t){return t?d(t)?t:[t]:[]}class E_ extends Dr{get list(){return S_(this.value)}get oldList(){return S_(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function B_(t){return(e,i)=>{const s="_"+i;rn(e,i,{get(){return this[s]},set(e){const o=this[s];if(o!==e){const n=this;if(n.config){const t="target"===i;if(t){const{beforeSelect:t}=n.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}n.setDimOthers(!1),n.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),n.single&&(delete n.element.syncEventer,delete n.element.__world.ignorePixelSnap)}const s=t?E_.BEFORE_SELECT:E_.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new E_(s,{editor:n,value:e,oldValue:o}))}this[s]=e,t(this,o)}}})}}E_.BEFORE_SELECT="editor.before_select",E_.SELECT="editor.select",E_.AFTER_SELECT="editor.after_select",E_.BEFORE_HOVER="editor.before_hover",E_.HOVER="editor.hover";const{abs:T_}=Math,{copy:R_,scale:C_}=$,{setListWithFn:O_}=Vt,{worldBounds:P_}=pr,L_={a:1,b:0,c:0,d:1,e:0,f:0},A_={x:0,y:0,width:0,height:0};class D_ extends Dl{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?(O_(A_,e,P_),t&&this.set(t),this.set(A_),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const o=this.__,{stroke:r,strokeWidth:a,fill:h}=o,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=T_(c.scaleX),l=T_(c.scaleY);if(R_(L_,c),L_.half=a%2,i!==l){C_(L_,1/i,1/l),t.setWorld(L_,e.matrix),t.beginPath(),o.strokeWidth=a;const{x:n,y:r,width:h,height:d}=s.__layout.boxBounds;t.rect(n*i,r*l,h*i,d*l)}else t.setWorld(L_,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),o.strokeWidth=a/T_(c.scaleX);r&&(n(r)?qh.stroke(r,this,t,e):qh.strokes(r,this,t,e)),h&&(n(h)?qh.fill(h,this,t,e):qh.fills(h,this,t,e))}}o.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}pe([B_(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],D_.prototype,"target",void 0);class M_ extends Ml{constructor(t){super(t),this.strokeArea=new zl({strokeAlign:"center"}),this.fillArea=new zl,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:o}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:o},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const F_={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return I_([t],i,e),i}};function I_(t,e,i){let s,o;for(let n=0,r=t.length;n<r;n++)if(s=t[n],o=s.__,o.hittable&&o.visible&&!o.locked&&i.hit(s.__world)){if(o.editable){if(s.isBranch&&!o.hitChildren){o.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&o.hitSelf&&e.push(s)}s.isBranch&&I_(s.children,e,i)}}const{findOne:W_,findByBounds:z_}=F_;class Y_ extends Ml{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new D_,this.targetStroker=new D_,this.bounds=new Kt,this.selectArea=new M_,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{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:o,strokeWidth:n,hover:r,hoverStyle:a}=s;this.hoverStroker.setTarget(r?e:null,Object.assign({stroke:o,strokeWidth:n},a||{}))}}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,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(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)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:o,y:n}=t.getInnerPoint(this);this.bounds.set(o,n),this.selectArea.setStyle({visible:!0,stroke:i,x:o,y:n},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),o=new mh(z_(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),o.length){const t=[];this.originList.forEach(e=>{o.has(e)||t.push(e)}),o.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!W_(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new mh(this.editor.editBox.rect)};return W_(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):W_(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:t}=this;t.waitLeafer(()=>{const{app:e}=t;e.selector.proxy=t,this.__eventIds=[t.on_([[E_.HOVER,this.onHover,this],[E_.SELECT,this.onSelect,this]]),e.on_([[qd.MOVE,this.onPointerMove,this],[qd.BEFORE_DOWN,this.onBeforeDown,this],[qd.TAP,this.onTap,this],[Qd.START,this.onDragStart,this,!0],[Qd.DRAG,this.onDrag,this],[Qd.END,this.onDragEnd,this],[ec.MOVE,this.onAutoMove,this],[[rc.ZOOM,ec.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:X_,top:N_,topRight:H_,right:V_,bottomRight:j_,bottom:U_,bottomLeft:G_,left:K_}=bt,{toPoint:q_}=St,{within:Z_,sign:J_}=W,{abs:Q_}=Math,$_={getScaleData(t,e,i,s,o,n,r,h){let l,d,c={},u=1,g=1;const{boxBounds:_,widthRange:p,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:w}=e,x=t.scaleX/e.scaleX,b=t.scaleY/e.scaleY,k=J_(x),S=J_(b),E=h?x:k*_.width/v,B=h?b:S*_.height/w;if(a(s))u=g=Math.sqrt(s);else{n&&(s.x*=2,s.y*=2),s.x*=h?x:k,s.y*=h?b:S;const t=(-s.y+w)/w,e=(s.x+v)/v,r=(s.y+w)/w,a=(-s.x+v)/v;switch(i){case N_:g=t,l="bottom";break;case V_:u=e,l="left";break;case U_:g=r,l="top";break;case K_:u=a,l="right";break;case X_:g=t,u=a,l="bottom-right";break;case H_:g=t,u=e,l="bottom-left";break;case j_:g=r,u=e,l="top-left";break;case G_:g=r,u=a,l="top-right"}if(o)if("corner"===o&&i%2)o=!1;else switch(i){case N_:case U_:u=g;break;case K_:case V_:g=u;break;default:d=Math.sqrt(Q_(u*g)),u=J_(u)*d,g=J_(g)*d}}const T=1!==u,R=1!==g;if(T&&(u/=E),R&&(g/=B),!r){const{worldTransform:e}=t;u<0&&(u=1/_.width/e.scaleX),g<0&&(g=1/_.height/e.scaleY)}if(q_(n||l,_,c,!0),m){const e={x:u,y:g};Gd.limitScaleOf(t,c,e,o),u=e.x,g=e.y}if(T&&p){const e=_.width*t.scaleX;u=Z_(e*u,p)/e}if(R&&f){const e=_.height*t.scaleY;g=Z_(e*g,f)/e}return T&&Q_(u*y.width)<1&&(u=J_(u)/y.width),R&&Q_(g*y.height)<1&&(g=J_(g)/y.height),o&&u!==g&&(d=Math.min(Q_(u),Q_(g)),u=J_(u)*d,g=J_(g)*d),isFinite(u)||(u=1),isFinite(g)||(g=1),{origin:c,scaleX:u,scaleY:g,direction:i,lockRatio:o,around:n}},getRotateData(t,e,i,s,o){let n,r={};switch(e){case X_:n="bottom-right";break;case H_:n="bottom-left";break;case j_:n="top-left";break;case G_:n="top-right";break;default:n="center"}return q_(o||n,t.boxBounds,r,!0),{origin:r,rotation:dt.getRotation(s,t.getWorldPointByBox(r),i)}},getSkewData(t,e,i,s){let o,n,r={},a=0,h=0;switch(e){case N_:case X_:n={x:.5,y:0},o="bottom",a=1;break;case U_:case j_:n={x:.5,y:1},o="top",a=1;break;case K_:case G_:n={x:0,y:.5},o="right",h=1;break;case V_:case H_:n={x:1,y:.5},o="left",h=1}const{width:l,height:d}=t;n.x=n.x*l,n.y=n.y*d,q_(s||o,t,r,!0);const c=dt.getRotation(n,r,{x:n.x+(a?i.x:0),y:n.y+(h?i.y:0)});return a?a=-c:h=c,{origin:r,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case K_:t=V_;break;case X_:t=H_;break;case G_:t=j_;break;case V_:t=K_;break;case H_:t=X_;break;case j_:t=G_}if(i)switch(t){case N_:t=U_;break;case X_:t=G_;break;case H_:t=j_;break;case U_:t=N_;break;case G_:t=X_;break;case j_:t=H_}return t}},tp={};function ep(t,e){const{enterPoint:i,dragging:s,skewing:o,resizing:n,flippedX:r,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return ip(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:g,moveable:_,resizeable:p,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(_||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!p)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),w=s?o?g:n?c:u:v?g:y?c:u;h+=45*($_.getFlipDirection(i.direction,r,a)+1),h=2*Math.round(W.formatRotation(h,!0)/2);const{url:x,x:b,y:k}=w,S=x+h;tp[S]?i.cursor=tp[S]:tp[S]=i.cursor={url:sp(x,h),x:b,y:k}}function ip(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function sp(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class op extends jl{constructor(t){super(t),this.useFastShadow=!0}}const np=["top","right","bottom","left"],rp=void 0;class ap extends Ml{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.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return n(t)||n(e)||n(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(t){super(),this.view=new Ml,this.rect=new op({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new op({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new Ml({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=t,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:o,rotatePoints:n,resizeLines:r,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new op({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),n.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new op({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),r.push(e),this.listenPointEvents(e,"resize",s)),i=new op({name:"resize-point",hitRadius:5}),o.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...n,a,h,l,...r,...o),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:r,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let p;this.visible=!t.locked;for(let t=0;t<8;t++)p=r[t],p.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),p.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:rp},e.rect||{}));const f=o(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&_.stintSet(t.__world,"ignorePixelSnap",d),ip(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:o,rotation:n,skewX:r,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:o,circle:n,buttons:r,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:g,rotateable:_,hideOnSmall:p,editBox:f,mask:m,dimOthers:y,bright:v,spread:w,hideRotatePoints:x,hideResizeLines:b}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),w&&Vt.spread(t,w),this.view.worldOpacity){const{width:e,height:c}=t,m=a(p)?p:10,y=f&&!(p&&e<m&&c<m);let v,w,k,S={};for(let i=0;i<8;i++)St.toPoint(St.directionData[i],t,S),w=h[i],v=l[i],w.set(S),v.set(S),w.visible=y&&!(!g&&!_),v.visible=y&&_&&g&&!x,i%2&&(k=d[(i-1)/2],k.set(S),k.visible=w.visible&&!b,w.visible=v.visible=y&&!!u,(i+1)/2%2?(k.width=e+k.height,p&&2*w.width>e&&(w.visible=!1)):(k.width=c+k.height,p&&2*w.width>c&&(w.visible=!1)));n.visible=y&&_&&!(!i.circle&&!i.rotatePoint),n.visible&&this.layoutCircle(),o.path&&(o.path=null),o.set(Object.assign(Object.assign({},t),{visible:!s||f})),r.visible=y&&r.children.length>0||0,r.visible&&this.layoutButtons()}else o.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:o}=this.mergedConfig,n=np.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,n,e||i,!!o)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:o}=this.mergedConfig,{flippedX:n,flippedY:r}=this;let a=np.indexOf(e);(a%2&&n||(a+1)%2&&r)&&i&&(a=(a+2)%4);const h=i?$_.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!o),i&&(t.rotation=90*(h-a)),t.scaleX=n?-1:1,t.scaleY=r?-1:1}setButtonPosition(t,e,i,s){const o=this.resizePoints[2*e+1],n=e%2,r=e&&3!==e?1:-1,a=(i+(e%2?(s?o.width:0)+t.boxBounds.width:(s?o.height:0)+t.boxBounds.height)/2)*r;n?(t.x=o.x+a,t.y=o.y):(t.x=o.x,t.y=o.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:o,pointRadius:n}=this.mergedConfig,r={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:o,height:o,cornerRadius:n,offsetX:0,offsetY:0,editConfig:rp};return t?Object.assign(r,t):r}getPointsStyle(){const{point:t}=this.mergedConfig;return d(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return d(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return d(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:o,rotateable:n,skewable:r}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!o?(n&&(this.rotating=!0),"resize-rotate"===i?o&&(this.resizing=!0):"resize-line"===e.name&&(r&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&o&&(this.resizing=!0),"skew"===i&&r&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:o,skewing:n}=this;if(i)e.onMove(t);else if(s||o||n){const i=t.current;i.pointType&&(this.enterPoint=i),o&&e.onRotate(t),s&&e.onScale(t),n&&e.onSkew(t)}ep(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Ur.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(t){this.canDragLimitAnimate&&(t instanceof Qd||t instanceof ec)&&this.transformTool.onMove(t),this.resizing&&(Ur.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(t){if(this.canGesture&&"drag"!==t.moveType&&(t.stop(),n(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,t.type){case ec.START:this.onTransformStart(t);break;case ec.END:this.onTransformEnd(t);break;default:this.transformTool.onMove(t)}}onScale(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,t.type){case rc.START:this.onTransformStart(t);break;case rc.END:this.onTransformEnd(t);break;default:this.transformTool.onScale(t)}}onRotate(t){if(this.canGesture&&(t.stop(),n(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,t.type){case rc.START:this.onTransformStart(t);break;case rc.END:this.onTransformEnd(t);break;default:this.transformTool.onRotate(t)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){ep(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(t){const{editor:e,target:i}=this;if(this.single){if(i.locked)return;if(i.isBranch&&!i.editInner){if(i.textBox){const{children:t}=i,s=t.find(t=>t.editable&&t instanceof Rd)||t.find(t=>t instanceof Rd);if(s)return e.openInnerEditor(s)}e.openGroup(i),e.target=e.selector.findDeepOne(t)}else e.openInnerEditor()}}listenPointEvents(t,e,i){t.direction=i,t.pointType=e,this.__eventIds.push(t.on_([[Qd.START,this.onDragStart,this],[Qd.DRAG,this.onDrag,this],[Qd.END,this.onDragEnd,this],[qd.ENTER,e=>{this.enterPoint=t,ep(this,e)}],[qd.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:t,editor:e,__eventIds:i}=this;i.push(t.on_([[qd.DOUBLE_TAP,this.onDoubleTap,this],[qd.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{i.push(e.app.on_([[[ac.HOLD,ac.UP],this.onKey,this],[ac.DOWN,this.onArrow,this],[[ec.START,ec.BEFORE_MOVE,ec.END],this.onMove,this,!0],[[rc.START,rc.BEFORE_ZOOM,rc.END],this.onScale,this,!0],[[oc.START,oc.BEFORE_ROTATE,oc.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const hp={x:0,y:0,width:1e5,height:1e5};class lp extends Dl{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,hp),Object.assign(this.__world,hp)}__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 dp='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',cp={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${dp}\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${dp}\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${dp}\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},up=new Kt;function gp(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{up.setListWithFn(i,t=>t.getBounds("box","page")),0===up.width&&(up.width=.1),0===up.height&&(up.height=.1),e.reset(up.get())}),s.add(e)}const _p=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),pp=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),fp={group(t,e,i){t.sort(pp);const{app:s,parent:o}=t[0];let n;n=i&&i.add?i:new Ml(i),o.addAt(n,o.children.indexOf(t[0])),t.sort(_p);const r=new mt(e.worldTransform);return r.divideParent(o.scrollWorldTransform),n.setTransform(r),n.editable=!0,n.hitChildren=!1,s.lockLayout(),t.forEach(t=>t.dropTo(n)),s.unlockLayout(),n},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(_p),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(pp),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},mp=$t.get("EditToolCreator");function yp(){return t=>{wp.register(t)}}const vp=yp,wp={list:{},register(t){const{tag:e}=t.prototype;xp[e]&&mp.repeat(e),xp[e]=t},get:(t,e)=>new xp[t](e)},{list:xp}=wp;class bp extends E_{constructor(t,e){super(t,e)}}bp.BEFORE_OPEN="innerEditor.before_open",bp.OPEN="innerEditor.open",bp.BEFORE_CLOSE="innerEditor.before_close",bp.CLOSE="innerEditor.close";class kp extends E_{constructor(t,e){super(t,e)}}kp.BEFORE_GROUP="editor.before_group",kp.GROUP="editor.group",kp.BEFORE_UNGROUP="editor.before_ungroup",kp.UNGROUP="editor.ungroup",kp.BEFORE_OPEN="editor.before_open_group",kp.OPEN="editor.open_group",kp.BEFORE_CLOSE="editor.before_close_group",kp.CLOSE="editor.close_group";const{updateMatrix:Sp}=ar,Ep={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Bp="top-left";class Tp extends zl{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Ir.CHANGE,e=>{if(this.checkChange&&Ep[e.attrName]){const{attrName:i,newValue:s,oldValue:o}=e,n="s"===i[0]?(s||1)/(o||1):(s||0)-(o||0);this.canChange=!1;const r=this.__;r[i]=o,Sp(this.parent),Sp(this);const a=new mt(this.__world);switch(r[i]=s,this.__layout.rotationChange(),Sp(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(n,0);break;case"y":t.move(0,n);break;case"rotation":t.rotateOf(Bp,n);break;case"scaleX":t.scaleOf(Bp,n,1);break;case"scaleY":t.scaleOf(Bp,1,n);break;case"skewX":t.skewOf(Bp,n,0);break;case"skewY":t.skewOf(Bp,0,n)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Rp extends E_{constructor(t,e){super(t,e)}}Rp.BEFORE_MOVE="editor.before_move",Rp.MOVE="editor.move";class Cp extends E_{constructor(t,e){super(t,e)}}Cp.BEFORE_SCALE="editor.before_scale",Cp.SCALE="editor.scale";class Op extends E_{constructor(t,e){super(t,e)}}Op.BEFORE_ROTATE="editor.before_rotate",Op.ROTATE="editor.rotate";class Pp extends E_{constructor(t,e){super(t,e)}}Pp.BEFORE_SKEW="editor.before_skew",Pp.SKEW="editor.skew";class Lp{onMove(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox;let o,{dragLimitAnimate:r}=i;const h=t.type===ec.END||t.type===Qd.END,l=n(e.draggable),d=!r||h||l,c={x:t.totalX,y:t.totalY};t instanceof ec&&dt.move(c,e.getWorldPointByLocal(s.totalOffset,null,!0)),t.shiftKey&&(Math.abs(c.x)>Math.abs(c.y)?c.y=0:c.x=0),o=Qd.getValidMove(e,s.point,c,d),(o.x||o.y)&&(r&&!l&&h?ar.animateMove(this,o,a(r)?r:.3):this.move(o))}onScale(t){const{target:e,mergeConfig:i,single:s,dragStartData:o}=this.editBox;let n,{around:r,lockRatio:a,flipable:h,editSize:l}=i;t instanceof rc?(r=e.getBoxPoint(t),n=t.totalScale):n=t.getInnerTotal(e);const{direction:d}=t.current;(t.shiftKey||e.lockRatio)&&(a=!0);const c=$_.getScaleData(e,o.bounds,d,n,a,$_.getAround(r,t.altKey),h,!s||"scale"===l),u=e.x,g=e.y;t instanceof Qd&&this.editTool&&this.editTool.onScaleWithDrag?(c.drag=t,this.scaleWithDrag(c)):this.scaleOf(c.origin,c.scaleX,c.scaleY),dt.move(o.totalOffset,e.x-u,e.y-g)}onRotate(t){const{target:e,mergeConfig:i,dragStartData:s}=this.editBox,{around:o,rotateAround:n,rotateGap:r,diagonalRotateKey:a}=i,{direction:h}=t.current;let l,d;if(t instanceof oc)d=t.rotation,l=n?St.getPoint(n,e.boxBounds):e.getBoxPoint(t);else{const i=a?t.isHoldKeys(a):t.shiftKey,r=$_.getRotateData(e,h,t,s,i?null:n||e.around||e.origin||o||"center");d=s.rotation+r.rotation-e.rotation,l=r.origin}if(d=W.float(W.getGapRotation(d,r,e.rotation),2),!d)return;const c=e.x,u=e.y;this.rotateOf(l,d),dt.move(s.totalOffset,e.x-c,e.y-u)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:o,skewX:n,skewY:r}=$_.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),$_.getAround(s,t.altKey));(n||r)&&this.skewOf(o,n,r)}move(t,e=0){if(!this.checkTransform("moveable"))return;c(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeMove:r}=s;if(r){const s=r({target:i,x:t,y:e});if(c(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);o||i.safeChange(()=>i.move(t,e));const h={target:i,editor:n,moveX:a.x,moveY:a.y};this.emitEvent(new Rp(Rp.BEFORE_MOVE,h));const l=new Rp(Rp.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:o}=i;if(o){const{origin:i,scaleX:s,scaleY:n,drag:r}=t;if(!1===o({target:e,drag:r,origin:i,scaleX:s,scaleY:n}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Cp(Cp.BEFORE_SCALE,t));const n=new Cp(Cp.SCALE,t);this.editTool.onScaleWithDrag(n),this.emitEvent(n)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeScale:h}=n;if(h){const s=h({target:o,origin:t,scaleX:e,scaleY:i});if(c(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.scaleOf(t,e,i))),u={target:o,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Cp(Cp.BEFORE_SCALE,u));const g=new Cp(Cp.SCALE,u);this.doScale(g),this.emitEvent(g)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,o=this.getWorldOrigin("center"),n=i?new mt(ar.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),r={target:e,editor:s,worldOrigin:o,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:n};this.emitEvent(new Cp(Cp.BEFORE_SCALE,r));const a=new Cp(Cp.SCALE,r);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:o,editor:n}=this.editBox,{beforeRotate:r}=s;if(r){const s=r({target:i,origin:t,rotation:e});if(a(s))e=s;else if(!1===s)return}const h=this.getWorldOrigin(t),l=!o&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:n,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new Op(Op.BEFORE_ROTATE,d));const c=new Op(Op.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:o,mergeConfig:n,single:r,editor:a}=this.editBox,{beforeSkew:h}=n;if(h){const s=h({target:o,origin:t,skewX:e,skewY:i});if(c(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!r&&this.getChangedTransform(()=>o.safeChange(()=>o.skewOf(t,e,i))),u={target:o,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Pp(Pp.BEFORE_SKEW,u));const g=new Pp(Pp.SKEW,u);this.doSkew(g),this.emitEvent(g)}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(ar.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new mt(e.worldTransform);return t(),new mt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}let Ap=class extends Ml{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 mh,this.openedGroupList=new mh,this.simulateTarget=new Tp(this),this.editBox=new ap(this),this.editToolList={},this.selector=new Y_(this),this.editMask=new lp(this),this.targetEventIds=[];let i=_.clone(cp);t&&(i=_.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),re.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?d(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>_.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&gp(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||wp.get(t,this)}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(n(s))e=s;else if(!1===s)return}if(wp.list[e]){const t=this.editTool=this.getEditTool(e);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(kp.BEFORE_GROUP),this.target=fp.group(this.list,this.element,t),this.emitGroupEvent(kp.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(kp.BEFORE_UNGROUP,t)),this.target=fp.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(kp.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(kp.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(kp.OPEN,t)}closeGroup(t){this.emitGroupEvent(kp.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(kp.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ar.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 kp(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||wp.get(t,this)}openInnerEditor(t,e,i){let s;if(n(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(n(i))s=i;else if(!1===i)return}wp.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(bp.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(bp.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(bp.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(bp.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new bp(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(fp.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(fp.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(qr.START,this.onRenderStart,this),i&&i.on_(Ir.SCROLL,this.onChildScroll,this),t.on_(qr.CHILD_START,this.onAppRenderStart,this),t.on_(Zr.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}};pe([(t,e)=>{rn(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:n,app:r}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return n.config&&Object.assign(a,n.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),o(a.lockRatio)&&(a.lockRatio=!0))),s(a.dragLimitAnimate)&&(a.dragLimitAnimate=r&&r.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],Ap.prototype,"mergeConfig",void 0),pe([B_(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof mh?i:new mh(i),t.multiple&&gp(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new E_(E_.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new E_(E_.AFTER_SELECT,s))})],Ap.prototype,"target",void 0),pe([B_(function(t,e){t.emitEvent(new E_(E_.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],Ap.prototype,"hoverTarget",void 0),Ap=pe([Gn(Lp,["editBox","editTool","emitEvent"])],Ap);class Dp{static registerInnerEditor(){wp.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new Ml,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}let Mp=class extends Dp{static registerEditTool(){wp.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:o,list:n}=s;o.lockLayout(),n.forEach(t=>{t.moveWorld(e,i)}),o.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.scaleOfWorld(o,e,i,r)}),r.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:o}=t,{app:n,list:r}=o;n.lockLayout(),r.forEach(t=>{const n="scale"!==o.getEditSize(t);i?t.transformWorld(i,n):t.rotateOfWorld(s,e)}),n.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:o,editor:n}=t,{app:r,list:a}=n;r.lockLayout(),a.forEach(t=>{const r="scale"!==n.getEditSize(t);s?t.transformWorld(s,r):t.skewOfWorld(o,e,i,r)}),r.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}};Mp=pe([yp()],Mp);const{left:Fp,right:Ip}=bt,{move:Wp,copy:zp,toNumberPoints:Yp}=dt;let Xp=class extends Mp{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:o}=t,n=t.target,r=i===Fp;if(n.pathInputed){const{path:t}=n.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,n.path=t}else if(n.points){const{points:t}=n,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,r,o,this.getInnerMove(n,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,n.points=t}else{const t={x:0,y:0},{toPoint:i}=n;n.rotation=0,this.dragPoint(t,i,r,o,this.getInnerMove(n,e,s)),n.getLocalPointByInner(t,null,null,!0),n.getLocalPointByInner(i,null,null,!0),n.x=t.x,n.y=t.y,n.getInnerPointByLocal(i,null,null,!0),n.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=Yp(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,o){const{x:n,y:r}=o;i?(Wp(t,n,r),s&&Wp(e,-n,-r)):(s&&Wp(t,-n,-r),Wp(e,n,r))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:o}=t,n=this.editor.element;let r,a;if(n.pathInputed?r=this.getFromToByPath(n.__.path):n.points&&(r=this.getFromToByPoints(n.__.points)),r){const{from:i,to:a}=r;n.innerToWorld(i,i,!1,t),n.innerToWorld(a,a,!1,t),o.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),zp(s[7],i),zp(e[7],i),zp(s[3],a),zp(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===Fp||t===Ip,s[t].visible=a,e[t].visible=!r&&a}};Xp=pe([yp()],Xp);const{M:Np,L:Hp,C:Vp,Q:jp,Z:Up,N:Gp,D:Kp,X:qp,G:Zp,F:Jp,O:Qp,P:$p,U:tf}=Ae,ef={scale(t,e,i){if(!t)return;let s,o=0,n=t.length;for(;o<n;)switch(s=t[o],s){case Np:case Hp:sf(t,e,i,o,1),o+=3;break;case Vp:sf(t,e,i,o,3),o+=7;break;case jp:sf(t,e,i,o,2),o+=5;break;case Up:o+=1;break;case Gp:sf(t,e,i,o,2),o+=5;break;case Kp:sf(t,e,i,o,2),o+=9;break;case qp:sf(t,e,i,o,2),o+=6;break;case Zp:sf(t,e,i,o,2),o+=9;break;case Jp:sf(t,e,i,o,2),o+=5;break;case Qp:t[o]=Zp,t.splice(o+4,0,t[o+3],0),sf(t,e,i,o,2),o+=9,n+=2;break;case $p:t[o]=Jp,t.splice(o+4,0,t[o+3]),sf(t,e,i,o,2),o+=5,n+=1;break;case tf:sf(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let n=o?s+1:0,r=o?n+2*o:t.length;n<r;n+=2)t[n]*=e,t[n+1]*=i}},{scalePoints:sf}=ef,of=$.get(),{topLeft:nf,top:rf,topRight:af,right:hf,bottom:lf,left:df}=bt;function cf(t,e,i){t.pathInputed?gf(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function uf(t,e,i,o){let n=e;if(!s(o)){const s=t.__layout;let{width:r,height:a}=s.boxBounds;switch(r*=i-e,a*=e-i,o){case rf:case lf:n=i,s.affectScaleOrRotation?t.moveInner(-r/2,0):t.x-=r/2;break;case df:case hf:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case nf:case af:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=n;const r=t.__,{padding:a}=r;a&&(t.padding=d(a)?a.map(t=>t*n):a*n),r.__autoWidth||(t.width*=n),r.__autoHeight||(t.height*=n)}function gf(t,e,i){ef.scale(t.__.path,e,i),t.path=t.__.path}function _f(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):ef.scalePoints(s,e,i),t.points=s}function pf(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)of.a=e,of.d=i,s[t].transform(of,!0)}const ff=rh.prototype;function mf(t,e,i){yf(t.parentApp?t.parentApp:t,e),t.isApp||i||t.__eventIds.push(t.on_(ec.BEFORE_MOVE,e=>{t.zoomLayer.move(t.getValidMove(e.moveX,e.moveY,!1))}),t.on_(ec.END,e=>{ar.animateMove(t.zoomLayer,t.getValidMove(e.moveX,e.moveY))}),t.on_(rc.BEFORE_ZOOM,e=>{const{zoomLayer:i}=t,s=t.getValidScale(e.scale);1!==s&&i.scaleOfWorld(e,s)}))}function yf(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&_.assign(i,e),_.assign(t.config,i,t.userConfig)}ff.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))},ff.__scaleResize=function(t,e){cf(this,t,e)},ff.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},ff.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},Rd.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,n=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||n&&"font-size"===o.mergedConfig.editSize)uf(this,t,e,n&&n.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:n}=this.__,{boxBounds:r}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=r.x),s&&"top"!==n&&1!==e&&(this.y+=r.y),cf(this,t,e)}},Cd.prototype.__scaleResize=function(t,e){gf(this,t,e)},vd.prototype.__scaleResize=function(t,e){this.pathInputed?gf(this,t,e):this.points?_f(this,t,e):this.width*=t},od.prototype.__scaleResize=function(t,e){this.pathInputed?gf(this,t,e):this.points?_f(this,t,e):cf(this,t,e)},Ml.prototype.__scaleResize=function(t,e){pf(this,t,e)},jl.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||cf(this,t,e),i&&pf(this,t,e)},re.add("resize"),re.add("editor","resize"),ae.editor=function(t,e){const i=new Ap(t);return e&&e.sky.add(e.editor=i),i},jl.addAttr("textBox",!1,un),Dl.addAttr("editConfig",void 0,un),Dl.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),un),Dl.addAttr("editInner","PathEditor",un),Ml.addAttr("editInner","",un),Rd.addAttr("editInner","TextEditor",un),Dl.setEditConfig=function(t){this.changeAttr("editConfig",t)},Dl.setEditOuter=function(t){this.changeAttr("editOuter",t)},Dl.setEditInner=function(t){this.changeAttr("editInner",t)};const vf=$t.get("LeaferTypeCreator"),wf={list:{},register(t,e){xf[t]&&vf.repeat(t),xf[t]=e},run(t,e){const i=xf[t];i&&i(e)}},{list:xf,register:bf}=wf;bf("viewport",mf),bf("custom",function(t){mf(t,null,!0)}),bf("design",function(t){mf(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),bf("document",function(t){mf(t,{zoom:{min:1},move:{scroll:"limit"}})});const kf={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=dt.getCenter(e.from,i.from),o=dt.getCenter(e.to,i.to),n={x:o.x-s.x,y:o.y-s.y},r=dt.getDistance(e.from,i.from);return{move:n,scale:dt.getDistance(e.to,i.to)/r,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:o}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),o=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&o<1?"none":i>=s&&i>=o?"move":s>=o?"zoom":"rotate"},detect(t,e){const{state:i}=Sf,s=Sf.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),Sf.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?Sf.getType(i.totalData,e):"none"},add(t,e){e&&(dt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=Sf;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},Sf=kf,{abs:Ef,max:Bf}=Math,{sign:Tf,within:Rf}=W,Cf={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:o}=t;t.shiftKey&&!s&&(s=o,o=0);const n=Ef(s),r=Ef(o);return n>50&&(s=Bf(50,n/3)*Tf(s)),r>50&&(o=Bf(50,r/3)*Tf(o)),{x:-s*i*2,y:-o*i*2}},getScale(t,e){let i,s=1,{zoomMode:o,zoomSpeed:n}=e;const r=t.deltaY||t.deltaX;if(o?(i="mouse"===o||!t.deltaX&&(v.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){n=Rf(n,0,1);const i=t.deltaY?e.delta.y:e.delta.x,o=Rf(1-Ef(r)/(4*i)*n,.5,2);s=r>0?o:1/o}return s}};let Of,Pf,Lf,Af;class Df{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:e}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),Of=0,Pf=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:Of,totalY:Pf}),e.emit(ec.START,this.moveData)),t.path=this.moveData.path,t.totalX=Of+=t.moveX,t.totalY=Pf+=t.moveY,e.emit(ec.BEFORE_MOVE,t),e.emit(ec.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),Lf=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:Lf}),e.emit(rc.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=Lf*=t.scale,e.emit(rc.BEFORE_ZOOM,t),e.emit(rc.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),Af=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:Af}),e.emit(oc.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=Af+=t.rotation,e.emit(oc.BEFORE_ROTATE,t),e.emit(oc.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:e,zoomData:i,rotateData:s}=this;e&&t.emit(ec.END,Object.assign(Object.assign({},e),{totalX:Of,totalY:Pf})),i&&t.emit(rc.END,Object.assign(Object.assign({},i),{totalScale:Lf})),s&&t.emit(oc.END,Object.assign(Object.assign({},s),{totalRotation:Af})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const Mf=Wl.prototype,Ff=new Kt,If=new pt;function Wf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function zf(t,e){return Object.assign(Object.assign({},e),{scale:t})}Mf.initType=function(t){wf.run(t,this)},Mf.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:o}=this.app.config.move;if(If.set(t,e),s){const t=!0===s?"":s;t.includes("x")?If.y=0:t.includes("y")?If.x=0:Math.abs(If.x)>Math.abs(If.y)?If.y=0:If.x=0,i&&t.includes("limit")&&(Ff.set(this.__world).addPoint(this.zoomLayer),Gd.getValidMove(Ff,this.canvas.bounds,"inner",If,!0),t.includes("x")?If.y=0:t.includes("y")&&(If.x=0))}return{x:o?0:If.x,y:o?0:If.y}},Mf.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:o}=this.app.config.zoom,n=Math.abs(e*t);return i&&n<i?t=i/e:s&&n>s&&(t=s/e),o?1:t};const Yf=Sc.prototype;Yf.createTransformer=function(){this.transformer=new Df(this)},Yf.move=function(t){this.transformer.move(t)},Yf.zoom=function(t){this.transformer.zoom(t)},Yf.rotate=function(t){this.transformer.rotate(t)},Yf.transformEnd=function(){this.transformer.transformEnd()},Yf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:o}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):o&&(t.deltaX*=o),t.deltaY>0?s&&(t.deltaY*=s):o&&(t.deltaY*=o);const n=e.getScale?e.getScale(t,e):Cf.getScale(t,e);if(1!==n)this.zoom(zf(n,t));else{const s=e.getMove?e.getMove(t,e):Cf.getMove(t,e);i.snap&&dt.round(s),this.move(Wf(s,t))}},Yf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let o=kf.getData(e),{moving:n,zooming:r,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(kf.detect(o,c(s)?s:{})){case"move":n=!0;break;case"zoom":r=!0;break;case"rotate":a=!0;break;default:return}kf.reset()}n||(o.center=kf.state.center)}else n=r=a=!0;var h,l;Object.assign(t,o.center),t.multiTouch=!0,a&&this.rotate((h=o.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),r&&this.zoom(zf(o.scale,t)),n&&this.move(Wf(o.move,t))};const Xf=_c.prototype,{abs:Nf}=Math;function Hf(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}Xf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,o=Nf(i),n=Nf(s),r=e?1:.1,h=this.canAnimate&&this.moving&&(o>r||n>r)&&this.interaction.m.dragAnimate;if(h){const r="touch"===t.pointerType?3:1,l=70;o*(e=e?a(h)?h:.95:r)>l?e=l/o:n*e>l&&(e=l/n),t=Object.assign({},t),dt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},Xf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},Xf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},Xf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:o,dragOut:n}=e.m;if(!n||!s||!o)return;const r=e.shrinkCanvasBounds,{x:a,y:h}=r,l=Vt.maxX(r),d=Vt.maxY(r),c=t.x<a?o:l<t.x?-o:0,u=t.y<h?o:d<t.y?-o:0;let g=0,_=0;this.autoMoveTimer=setInterval(()=>{g+=c,_+=u,dt.move(i,c,u),dt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:g,totalY:_,moveType:"drag"})),e.pointerMoveReal(t)},10)},Xf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},re.add("viewport"),re.add("view"),Wl.prototype.zoom=function(t,e,i,s){let r;this.killAnimate(),u(e)?(r=e.padding,i=e.scroll,s=e.transition):r=e;const{zoomLayer:h}=this,l=this.canvas.bounds.clone().shrink(o(r)?30:r),g=new Kt,_={x:l.x+l.width/2,y:l.y+l.height/2};let p;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(n(t))switch(t){case"in":p=Hf(y,"in");break;case"out":p=Hf(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Kt(this.boxBounds)).height=0;break;case"fit-height":(t=new Kt(this.boxBounds)).width=0}else a(t)&&(p=t/y);if(p)p=this.getValidScale(p),h.scaleOfWorld(_,p,p,!1,s);else if(c(t)){const e={x:f,y:m,scaleX:y,scaleY:v},o=d(t);if(o||t.tag){const e=o?t:[t];g.setListWithFn(e,pr.worldBounds)}else{const e=function(t,e){let i,{x:s,y:o,width:n,height:r}=t;return r||(r=n*(e.height/e.width),i=!0),n||(n=r*(e.width/e.height),i=!0),i?{x:s,y:o,width:n,height:r}:t}(t,l);g.set(h.getWorldBounds(e))}const{width:n,height:r}=g;let a=l.x-g.x,c=l.y-g.y;return i?(a+=Math.max((l.width-n)/2,0),c+=Math.max((l.height-r)/2,0)):(p=this.getValidScale(Math.min(l.width/n,l.height/r)),a+=(l.width-n*p)/2,c+=(l.height-r*p)/2,dt.scaleOf(e,g,p),g.scaleOf(g,p),e.scaleX*=p,e.scaleY*=p),"x"===i?c=0:"y"===i&&(a=0),dt.move(e,a,c),g.move(a,c),h.set(e,s),g}return h.worldBoxBounds};class Vf extends Ml{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&&_.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(t){let e;n(t)?(e={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===t&&(e.fill="white",e.stroke="rgba(0,0,0,0.2)")):e=t,this.scrollXBar||this.addMany(this.scrollXBar=new jl,this.scrollYBar=new jl),e=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},e),e.height||(e.height=e.width),this.scrollXBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},e),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:o}=this.target.leafer,{worldRenderBounds:n}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(n))return;this.scrollBounds=new Kt(n);const r=o.bounds.clone().shrink(i),a=r.clone().add(n),h=this.ratioX=r.width/a.width,l=this.ratioY=r.height/a.height,d=(r.x-a.x)/a.width,c=(r.y-a.y)/a.height,u=h<1,g=l<1,{scrollXBar:_,scrollYBar:p}=this,{x:f,y:m,width:y,height:v}=r.shrink([2,g?p.width+6:2,u?_.height+6:2,2]);_.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),p.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:g})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:t,scrollYBar:e}=this;this.__eventIds=[t.on_(Qd.DRAG,this.onDrag,this),e.on_(Qd.DRAG,this.onDrag,this),t.on_(Qd.END,this.onDragEnd,this),e.on_(Qd.END,this.onDragEnd,this),this.target.on_(qr.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Ur.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}re.add("scroll");class jf extends pl{}function Uf(t){return ln(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&wn(this),t.__useArrow=e,Sn(this)}}}))}let Gf=class extends vd{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Kh.register(t,e)}};pe([Wn(jf)],Gf.prototype,"__",void 0),pe([Uf("angle")],Gf.prototype,"endArrow",void 0),Gf=pe([Kn()],Gf);const{M:Kf,L:qf,C:Zf,Q:Jf,O:Qf}=Ae,{rotate:$f,copyFrom:tm,scale:em}=dt,im={},sm={layout(t,e,i,s,o,n,r){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case Kf:case qf:om(t,l+1,e,i,s,o,n,r),l+=3;break;case Zf:for(h=1;h<6;h+=2)om(t,l+h,e,i,s,o,n,r);l+=7;break;case Jf:for(h=1;h<4;h+=2)om(t,l+h,e,i,s,o,n,r);l+=5;break;case Qf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),n&&(t[l+4]+=n,t[l+5]+=n),l+=7}},rotate(t,e,i){sm.layout(t,0,0,1,1,e,i)}};function om(t,e,i,s,o,n,r,a){tm(im,t[e],t[e+1]),r&&$f(im,r,a),o&&em(im,o,n),t[e]=i+im.x,t[e+1]=s+im.y}const{layout:nm,rotate:rm}=sm,{getAngle:am}=dt,hm={x:-.5},lm={connect:hm,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},dm={connect:hm,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},cm={connect:hm,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]},um={connect:hm,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]},gm={offset:hm,path:[...cm.path],dashPath:[1,-2.5,0,2,-1,0]};rm(gm.path,180,{x:-1.5,y:0});const _m={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},pm={connect:{x:.5},path:[..._m.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},fm={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]},mm={path:[...fm.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},ym=_.clone(fm),vm=_.clone(mm);rm(ym.path,45),rm(vm.path,45);const wm={angle:lm,"angle-side":dm,arrow:um,triangle:cm,"triangle-flip":gm,circle:pm,"circle-line":_m,square:mm,"square-line":fm,diamond:vm,"diamond-line":ym,mark:{offset:hm,path:[1,0,-2,2,0,2]}};function xm(t,e,i,s,o,n,r){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=wm[e.type]):a=e:a=wm[e];const{offset:u,connect:g,path:_,dashPath:p}=a;let f=g?g.x:0,m=u?u.x:0;const y=[..._];return r&&p&&y.push(...p),"none"!==l&&(f-=.5),u&&("round"===d&&u.roundJoin?m+=u.roundJoin:"bevel"===d&&u.bevelJoin&&(m+=u.bevelJoin)),h&&nm(y,0,0,h,h),m&&nm(y,m,0),nm(y,s.x,s.y,o,o,am(i,s)),n.x=(f+m)*o,y}const{M:bm,L:km,C:Sm,Q:Em,Z:Bm,N:Tm,D:Rm,X:Cm,G:Om,F:Pm,O:Lm,P:Am,U:Dm}=Ae,{copy:Mm,copyFrom:Fm,getDistancePoint:Im}=dt,Wm={},zm={},Ym={},Xm={},Nm={},Hm={list:wm,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:o,__pathForRender:n,cornerRadius:r}=t.__,a=!r;let h,l=0,d=n.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=n[l],h){case bm:case km:(c<2||l+6>=d)&&(Fm(Nm,n[l+1],n[l+2]),!c&&u&&Mm(zm,Nm)),l+=3;break;case Sm:(1===c||l+7>=d-3)&&Vm(n,Xm,Nm,l+3),l+=7;break;case Em:(1===c||l+5>=d-3)&&Vm(n,Xm,Nm,l+1),l+=5;break;case Bm:return;case Tm:l+=5;break;case Rm:l+=9;break;case Cm:l+=6;break;case Om:l+=9;break;case Pm:l+=5;break;case Lm:l+=7;break;case Am:l+=4;break;case Dm:(1===c||l+6>=d-3)&&(Vm(n,Xm,Nm,l+1),l+6!==d&&(Nm.x-=(Nm.x-Xm.x)/10,Nm.y-=(Nm.y-Xm.y)/10)),l+=6}if(c++,1===c&&h!==bm)return;if(2===c&&u&&Mm(Ym,h===km?Nm:Xm),l===d){const r=t.__.__pathForRender=a?[...n]:n,d=t.__.__pathForArrow=[];if(u){const i=xm(t,e,Ym,zm,s,Wm,!!o);o?d.push(...i):r.push(...i),Wm.x&&(Im(zm,Ym,-Wm.x,!0),r[1]=Ym.x,r[2]=Ym.y)}if(i&&"none"!==i){const e=xm(t,i,Xm,Nm,s,Wm,!!o);if(o?d.push(...e):r.push(...e),Wm.x){let t;switch(Im(Nm,Xm,-Wm.x,!0),h){case km:t=l-3+1;break;case Sm:t=l-7+5;break;case Em:t=l-5+3;break;case Dm:t=l-6+3}t&&jm(r,Xm,t)}}}else Mm(Xm,Nm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function Vm(t,e,i,s){Fm(e,t[s],t[s+1]),Fm(i,t[s+2],t[s+3])}function jm(t,e,i){t[i]=e.x,t[i+1]=e.y}re.add("arrow"),Dl.addAttr("startArrow","none",Uf),Dl.addAttr("endArrow","none",Uf),Object.assign(Kh,Hm),Object.assign(qh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});let Um=class extends jl{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};pe([Wn(class extends ul{})],Um.prototype,"__",void 0),pe([pn("x")],Um.prototype,"flow",void 0),Um=pe([Kn()],Um);const Gm={},Km={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},qm={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function Zm(t,e,i){const s=t.__,{contentBounds:o}=t.__layout;Tt.toPoint(i,e,o,Gm),e.x=s.__autoWidth?o.x:Gm.x,e.y=s.__autoHeight?o.y:Gm.y}const{move:Jm}=dt;function Qm(t,e,i,s,o,n){const{children:r}=t;let a,h,{x:l,start:d}=e,c=s;l+=i;for(let t=0,i=e.count;t<i;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=s+(e.height-h.height)/("center"===o?2:1)),Jm(a,l-h.x,c-h.y),l+=h.width+e.gap):i++}function $m(t,e,i){const s="width"===i?"height":"width";t[i]=Math.max(t[i],e[i]),t[s]+=t.count?e[s]+t.gap:e[s],t.list.push(e),t.count++}const ty={};function ey(t,e){const{gap:i,flowAlign:s,flowWrap:o,__autoWidth:r,__autoHeight:a}=t.__,h=o&&(e?!r:!a);return c(i)?(ty.xGap=i.x||0,ty.yGap=i.y||0):ty.xGap=ty.yGap=l(i),ty.isAutoXGap=n(ty.xGap)&&!r,ty.isAutoYGap=n(ty.yGap)&&!a,ty.complex=h||"top-left"!==s||t.__hasGrow||ty.isAutoXGap||ty.isAutoYGap,ty.wrap=h,ty.complex&&(ty.isFitXGap="fit"===ty.xGap&&!r,ty.isFitYGap="fit"===ty.yGap&&!a,c(s)?(ty.contentAlign=s.content||"top-left",ty.rowXAlign=s.x||"from",ty.rowYAlign=s.y||"from"):(ty.contentAlign=s,ty.rowXAlign=Km[s],ty.rowYAlign=qm[s])),ty}function iy(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function sy(t,e,i,s){const{count:o}=t;o>1&&(i>t[e]||s)&&(t.gap=(i-t[e])/(o-1),t[e]=i)}function oy(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:ny}=W;function ry(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.width)/l,{children:u}=t;if(!(c<=0)){e.width=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__widthGrow)&&(r=ay(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.widthRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__widthGrow,o=e/i*s,r=ay(t,n=t.__flowBounds,n.width+o),e-=o-r,i-=s})}(h,a,l)}}function ay(t,e,i){const{widthRange:s,lockRatio:o}=t.__,n=s?ny(i,s):i,r=n/e.width;return t.scaleResize(r,o?r:1),e.width=n,i-n}const{within:hy}=W;function ly(t,e,i,s){let o,n,r,a=0,h=e.hasRangeSize&&[],{grow:l,start:d}=e;const c=(i-e.height)/l,{children:u}=t;if(!(c<=0)){e.height=i;for(let t=0,i=e.count;t<i;t++)o=u[s?d-t:d+t],o.__.inFlow&&0!==o.__.visible?(n=o.__heightGrow)&&(r=dy(o,o.__flowBounds,c*n),r?(a+=r,l-=n):h&&(o.__.heightRange?h.unshift(o):h.push(o))):i++;a&&function(t,e,i){let s,o,n,r;t.forEach(t=>{s=t.__heightGrow,o=e/i*s,r=dy(t,n=t.__flowBounds,n.height+o),e-=o-r,i-=s})}(h,a,l)}}function dy(t,e,i){const{heightRange:s,lockRatio:o}=t.__,n=s?hy(i,s):i,r=n/e.height;return t.scaleResize(o?r:1,r),e.height=n,i-n}const{move:cy}=dt;function uy(t,e){const i="width",{children:s,itemBox:o}=t,n=ey(t,!0),{complex:r,wrap:a,xGap:h,yGap:l,isAutoXGap:d,isFitXGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:h;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=oy(_,o),r?(_.__flowBounds=p,y||(y=iy(m,g)),a&&y.count&&y.width+p.width>x&&(y.grow?ry(t,y,x,e):d&&sy(y,i,x,c),$m(u,y,i),y=iy(m,g)),f=p.width,_.__widthGrow&&(y.grow+=_.__widthGrow,f=0,_.__.widthRange&&(y.hasRangeSize=!0)),_.__heightGrow&&dy(_,p,b),y.width+=y.count?f+g:f,y.height=Math.max(y.height,p.height),y.count++):(cy(_,v-p.x,w-p.y),v+=p.width+g));if(r&&y){const{isAutoYGap:s,isFitYGap:o,contentAlign:r,rowXAlign:h,rowYAlign:g}=n;y.count&&(y.grow?ry(t,y,x,e):d&&sy(y,i,x,c),a&&$m(u,y,i)),a?(s?sy(u,"height",b,o):u.height+=(u.gap=l)*(u.list.length-1),function(t,e,i,s){Zm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=Km[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.x=e.width-t.width,"center"===s&&(t.x/=2)}}(t,u,r,h),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],Qm(t,r,a,h,i,s),h+=r.height+e.gap}(t,u,g,e)):(Zm(t,y,r),Qm(t,y,0,y.y,g,e))}}const{move:gy}=dt;function _y(t,e,i,s,o,n){const{children:r}=t;let a,h,{y:l,start:d}=e,c=i;l+=s;for(let t=0,s=e.count;t<s;t++)a=r[n?d-t:d+t],a.__.inFlow&&0!==a.__.visible?(h=a.__flowBounds,"from"!==o&&(c=i+(e.width-h.width)/("center"===o?2:1)),gy(a,c-h.x,l-h.y),l+=h.height+e.gap):s++}const{move:py}=dt;function fy(t,e){const i="height",{children:s,itemBox:o}=t,n=ey(t,!1),{complex:r,wrap:a,xGap:h,yGap:l,isAutoYGap:d,isFitYGap:c}=n;if(!s.length)return;const u=a&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},g=d?0:l;let _,p,f,m,y,{x:v,y:w,width:x,height:b}=t.__layout.contentBounds;for(let n=0,h=s.length;n<h;n++)_=s[m=e?h-1-n:n],_.__.inFlow&&0!==_.__.visible&&(p=oy(_,o),r?(_.__flowBounds=p,y||(y=iy(m,g)),a&&y.count&&y.height+p.height>b&&(y.grow&&ly(t,y,b,e),d&&sy(y,i,b,c),$m(u,y,i),y=iy(m,g)),f=p.height,_.__heightGrow&&(y.grow+=_.__heightGrow,f=0,_.__.heightRange&&(y.hasRangeSize=!0)),_.__widthGrow&&ay(_,p,x),y.height+=y.count?f+g:f,y.width=Math.max(y.width,p.width),y.count++):(py(_,v-p.x,w-p.y),w+=p.height+g));if(r&&y){const{isAutoXGap:s,isFitXGap:o,contentAlign:r,rowXAlign:l,rowYAlign:g}=n;y.count&&(y.grow&&ly(t,y,b,e),d&&sy(y,i,b,c),a&&$m(u,y,i)),a?(s?sy(u,"width",x,o):u.width+=(u.gap=h)*(u.list.length-1),function(t,e,i,s){Zm(t,e,i);const{list:o}=e;if(o.length>1&&(s||(s=qm[i]),"from"!==s)){let t;for(let i=0,n=o.length;i<n;i++)t=o[i],t.y=e.height-t.height,"center"===s&&(t.y/=2)}}(t,u,r,g),function(t,e,i,s){const{list:o}=e,n="reverse"===t.__.flowWrap;let r,{x:a,y:h}=e;for(let l=0,d=o.length;l<d;l++)r=o[n?d-1-l:l],_y(t,r,a,h,i,s),a+=r.width+e.gap}(t,u,l,e)):(Zm(t,y,r),_y(t,y,y.x,0,l,e))}}function my(t){return ln(t,t=>({set(e){const i=a(e)?e:0;"autoWidth"===t?this.__widthGrow=i:this.__heightGrow=i,!i||this.parent&&this.parent.__hasGrow||this.waitParent(()=>{this.parent.__hasGrow=!0}),this.__setAttr(t,e)&&wn(this)}}))}re.add("flow","resize");const yy=jl.prototype,{__updateBoxBounds:vy}=Ml.prototype;Dl.addAttr("flow",!1,pn),Dl.addAttr("gap",0,yn),Dl.addAttr("flowAlign","top-left",yn),Dl.addAttr("flowWrap",!1,yn),Dl.addAttr("itemBox","box",yn),Dl.addAttr("inFlow",!0,yn),Dl.addAttr("autoWidth",void 0,my),Dl.addAttr("autoHeight",void 0,my),Dl.addAttr("autoBox",void 0,yn);const{copyAndSpread:wy}=Vt;yy.__updateFlowLayout=function(){const{leaferIsCreated:t,flow:e}=this;switch(t&&(this.leafer.created=!1),e){case"x":case!0:uy(this);break;case"y":fy(this);break;case"x-reverse":uy(this,!0);break;case"y-reverse":fy(this,!0)}t&&(this.leafer.created=!0)},yy.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,i=e.contentBounds===e.boxBounds;t?(i&&e.shrinkContent(),wy(e.contentBounds,e.boxBounds,t,!0)):i||e.shrinkContentCancel()},yy.__updateBoxBounds=function(t){if(this.children.length&&!this.pathInputed){const e=this.__,{flow:i}=e;if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),i&&!t?this.__updateRectBoxBounds():vy.call(this);const{boxBounds:s}=this.__layout;e.__autoSize||(e.__autoWidth?(i||(s.width+=s.x,s.x=0),s.height=e.height,s.y=0):(i||(s.height+=s.y,s.y=0),s.width=e.width,s.x=0)),i&&t&&e.padding&&wy(s,s,e.padding,!1,e.__autoSize?null:e.__autoWidth?"width":"height"),this.__updateNaturalSize()}else this.__updateRectBoxBounds();i&&this.__updateContentBounds()}else this.__updateRectBoxBounds()};const{cos:xy,sin:by,pow:ky,sqrt:Sy,abs:Ey,ceil:By,floor:Ty,round:Ry,PI:Cy}=Math,Oy=5*Cy,Py=1.70158,Ly=2.5949095,Ay=7.5625,Dy=2.75;function My(t){return e=>ky(e,t)}function Fy(t){return e=>1-ky(1-e,t)}function Iy(t){return e=>e<.5?.5*ky(2*e,t):1-.5*ky(2-2*e,t)}function Wy(t){return t<1/Dy?Ay*t*t:t<2/Dy?Ay*(t-=1.5/Dy)*t+.75:t<2.5/Dy?Ay*(t-=2.25/Dy)*t+.9375:Ay*(t-=2.625/Dy)*t+.984375}function zy(t,e,i,s){const o={};return n=>{const r=~~(1e4*n),a=o[r];if(a)return a;let h,l,d,c=n;for(let e=0;e<8&&(h=1-c,d=Yy(c,t,i)-n,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(Ey(l)<1e-6));e++)c-=d/l;return o[r]=Yy(c,e,s)}}function Yy(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const Xy={get(t){const{list:e}=Xy;return n(t)?e[t||"ease"]:c(t)?e[t.name].apply(e,d(t.value)?t.value:[t.value]):e.ease},register(t,e){Xy.list[t]=e},list:{linear:t=>t,ease:zy(.25,.1,.25,1),"ease-in":zy(.42,0,1,1),"ease-out":zy(0,0,.58,1),"ease-in-out":zy(.42,0,.58,1),"sine-in":t=>1-xy(t*Cy*.5),"sine-out":t=>by(t*Cy*.5),"sine-in-out":t=>.5*(1-xy(t*Cy)),"quad-in":My(2),"quad-out":Fy(2),"quad-in-out":Iy(2),"cubic-in":My(3),"cubic-out":Fy(3),"cubic-in-out":Iy(3),"quart-in":My(4),"quart-out":Fy(4),"quart-in-out":Iy(4),"quint-in":My(5),"quint-out":Fy(5),"quint-in-out":Iy(5),"expo-in":t=>t?ky(2,10*t-10):0,"expo-out":t=>1===t?1:1-ky(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*ky(2,2*t*10-10):.5*(2-ky(2,10-2*t*10)),"circ-in":t=>1-Sy(1-ky(t,2)),"circ-out":t=>Sy(1-ky(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-Sy(1-ky(2*t,2))):.5*(Sy(1-ky(2-2*t,2))+1),"back-in":t=>((Py+1)*t-Py)*t*t,"back-out":t=>(t-=1)*t*((Py+1)*t+Py)+1,"back-in-out":t=>t<.5?(t*=2)*t*((Ly+1)*t-Ly)*.5:.5*((t=2*t-2)*t*((Ly+1)*t+Ly)+2),"elastic-in":t=>0===t||1===t?t:-ky(2,10*(t-1))*by((t-1.1)*Oy),"elastic-out":t=>0===t||1===t?t:ky(2,-10*t)*by((t-.1)*Oy)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-ky(2,10*((t*=2)-1))*by((t-1.1)*Oy)*.5:ky(2,10*(1-(t*=2)))*by((t-1.1)*Oy)*.5+1,"bounce-in":t=>1-Wy(1-t),"bounce-out":Wy,"bounce-in-out":t=>t<.5?.5*(1-Wy(1-2*t)):.5*(1+Wy(2*t-1)),"cubic-bezier":zy,steps:function(t,e="floor"){return i=>("floor"===e?Ty(i*t):"ceil"===e?By(i*t):Ry(i*t))/t}}};function Ny(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class Hy{}Hy.CREATED="created",Hy.PLAY="play",Hy.PAUSE="pause",Hy.STOP="stop",Hy.SEEK="seek",Hy.UPDATE="update",Hy.COMPLETED="completed";let Vy=class extends sa{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:o}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&o&&a(o)&&(t+=o-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=d(e)?e:e?[e]:[];const{easing:o,attrs:n}=this;this.easingFn=Xy.get(o),(n||this.attrsMap)&&(this.attrsMap=n?n.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.requestAnimate():(this.clearTimer(),this.start()),this.emitType(Hy.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(Hy.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(Hy.STOP))}seek(t){this.destroyed||(c(t)&&(t=Gh.number(t,this.duration)),t&&(t/=this.speed),(!this.started||t<this.time)&&this.start(!0),this.time=t,this.animate(0,!0),this.clearTimer(()=>this.requestAnimate()),this.emitType(Hy.SEEK))}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:o}=this,{length:n}=i,r=!(n>1)||this.join;let h,l,d,c,u,g=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let o=0;o<n;o++){if(l=i[o],c=l.style||l,h||(h=r?t:c),d={style:c,beforeStyle:{}},u=1,l.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:o,swing:n,loop:r}=l;n&&(d.swing=a(n)?n:2,u=2*d.swing-1),r&&(d.loop=u=a(r)?r:2),t?(d.duration=t,g+=t*u,i&&(d.totalTime=t+i)):e&&(d.autoDuration=e,_+=e*u),i?(d.delay=i,g+=i*u):s&&(d.autoDelay=s,_+=s*u),o&&(d.easingFn=Xy.get(o))}if(!d.autoDuration&&s(d.duration)&&(n>1?o>0||r?_+=u:d.duration=0:d.duration=this.duration),n>1)this.setBefore(d,c,h);else{for(let e in c)d.beforeStyle[e]=t[e];this.fromStyle=d.beforeStyle,this.toStyle=d.style}h=c,e.push(d)}_?((this.duration<=g||!o||!o.duration)&&this.changeDuration(g+.2*_),this.allocateTime((this.duration-g)/_)):g&&this.changeDuration(g),this.emitType(Hy.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:o,toStyle:n,target:r}=this;for(let a in e)s(o[a])&&(o[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=s(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:o}=i;for(let n=0;n<o;n++)e=i[n],s(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}requestAnimate(){this.requestAnimateTime=Date.now(),v.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(!this.running)return;this.time+=(Date.now()-this.requestAnimateTime)/1e3}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.requestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(Hy.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,o=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(o);else{const{attrsMap:i,target:n}=this;let{betweenStyle:r}=this.frame;r||(r=this.frame.betweenStyle={}),il.setBetweenStyle(r,s,o,e,t,n,i),this.setStyle(r)}this.emitType(Hy.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return a(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}};pe([Ny("ease")],Vy.prototype,"easing",void 0),pe([Ny(0)],Vy.prototype,"delay",void 0),pe([Ny(.2)],Vy.prototype,"duration",void 0),pe([Ny("auto")],Vy.prototype,"ending",void 0),pe([Ny(!1)],Vy.prototype,"reverse",void 0),pe([Ny(!1)],Vy.prototype,"swing",void 0),pe([Ny(!1)],Vy.prototype,"loop",void 0),pe([Ny(0)],Vy.prototype,"loopDelay",void 0),pe([Ny(1)],Vy.prototype,"speed",void 0),pe([Ny(!0)],Vy.prototype,"autoplay",void 0),pe([Ny()],Vy.prototype,"join",void 0),pe([Ny()],Vy.prototype,"attrs",void 0),Vy=pe([Gn(_a)],Vy);let jy=class extends Vy{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(t,e){this.fromStyle={},this.toStyle={},this._endingStyle={},t||(t=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=t.map(t=>{const i=t.target?t:new Vy(this.target,t,e);return i.parent=this,Object.assign(this.fromStyle,i.fromStyle),Object.assign(this.toStyle,i.toStyle),Object.assign(this._endingStyle,i.endingStyle),i})}play(){this.each(t=>t.play()),this.emitType(Hy.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(Hy.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(Hy.STOP)}seek(t){this.each(e=>e.seek(t)),this.emitType(Hy.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case Hy.COMPLETED:this.completed&&this.emitType(t);break;case Hy.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}};jy=pe([Gn(_a)],jy);const Uy={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},Gy=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,Ky=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,qy=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,Zy=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,Jy=parseInt,Qy=parseFloat,{round:$y}=Math;let tv={},ev=0;function iv(t){let e,i,s,o=1;switch(t.length){case 9:e=Jy(t.slice(1,3),16),i=Jy(t.slice(3,5),16),s=Jy(t.slice(5,7),16),o=Jy(t.slice(7,9),16)/255;break;case 7:e=Jy(t.slice(1,3),16),i=Jy(t.slice(3,5),16),s=Jy(t.slice(5,7),16);break;case 5:e=Jy(t[1]+t[1],16),i=Jy(t[2]+t[2],16),s=Jy(t[3]+t[3],16),o=Jy(t[4]+t[4],16)/255;break;case 4:e=Jy(t[1]+t[1],16),i=Jy(t[2]+t[2],16),s=Jy(t[3]+t[3],16);break;case 3:e=i=s=Jy(t[1]+t[2],16);break;case 2:e=i=s=Jy(t[1]+t[1],16)}return{r:e,g:i,b:s,a:o}}const sv=1/6,ov=.5,nv=2/3,rv=1/3;function av(t,e,i){return i<0?i++:i>1&&i--,i<sv?t+6*(e-t)*i:i<ov?e:i<nv?t+(e-t)*(nv-i)*6:t}function hv(t,e,i,s=1){let o,n,r;if(t/=360,i/=100,0===(e/=100))o=n=r=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;o=av(a,s,t+rv),n=av(a,s,t),r=av(a,s,t-rv)}return{r:$y(255*o),g:$y(255*n),b:$y(255*r),a:s}}re.add("color"),Uh.object=function(t,e){let i,o=!s(e)&&e<1;if(n(t)){const e=tv[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=iv(t);break;case"R":case"r":"("===t[4]&&Ky.test(t)?i=function(t){const e=Ky.exec(t);return{r:Jy(e[1]),g:Jy(e[2]),b:Jy(e[3]),a:Qy(e[4])}}(t):"("===t[3]&&Gy.test(t)&&(i=function(t){const e=Gy.exec(t);return{r:Jy(e[1]),g:Jy(e[2]),b:Jy(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&Zy.test(t)?i=function(t){const e=Zy.exec(t);return hv(Qy(e[1]),Qy(e[2]),Qy(e[3]),Qy(e[4]))}(t):"("===t[3]&&qy.test(t)&&(i=function(t){const e=qy.exec(t);return hv(Qy(e[1]),Qy(e[2]),Qy(e[3]),1)}(t))}if(!i){const e=Uy[t.toLowerCase()];e&&(i=iv("#"+e))}i&&(ev++,ev>1e4&&(tv={},ev=0),tv[t]=Object.assign({},i))}}else c(t)&&(s(t.a)&&(t.a=1),o&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),o&&(i.a*=e),i};const{round:lv}=Math,{fourNumber:dv}=W,cv={fill:fv,stroke:fv,cornerRadius:(t,e,i)=>a(t)&&a(e)?_v(t,e,i):(t=dv(t),e=dv(e),t.map((t,s)=>_v(t,e[s],i))),text(t,e,i){if(n(t)&&n(e)){const s=t.length,o=e.length,n=_v(s,o,i,1);return s<o?e.substring(0,n):t.substring(0,n)}return a(t)||a(e)?W.float(_v(t,e,i),Math.max(gv(t),gv(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const o=Object.assign(Object.assign({},t),e);return il.setBetweenStyle(o,t,e,o,i,s),o},shadow:mv,innerShadow:mv},uv={value:function(t,e,i){const s=a(t),o=a(e);return s&&o?t+(e-t)*i:o||s?_v(t,e,i):t},number:_v,color:pv,setBetweenStyle:function(t,e,i,s,o,n,r){let a,h,l;const{list:d,value:c}=il;for(let u in s)r&&!r[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,o,n)))}};function gv(t){const e=String(t).split(".")[1];return e?e.length:0}function _v(t,e,i,s){t||(t=0),e||(e=0);const o=t+(e-t)*i;return s?lv(o):o}function pv(t,e,i){t=Uh.object(t),e=Uh.object(e);const s=_v(t.r,e.r,i,1)+","+_v(t.g,e.g,i,1)+","+_v(t.b,e.b,i,1),o=_v(t.a,e.a,i);return 1===o?"rgb("+s+")":"rgba("+s+","+o+")"}function fv(t,e,i){return n(t)&&n(e)?pv(t,e,i):e}function mv(t,e,i){return d(t)||d(e)?e:(e=e||{},{x:_v((t=t||{}).x,e.x,i),y:_v(t.y,e.y,i),blur:_v(t.blur,e.blur,i),spread:_v(t.spread,e.spread,i),color:pv(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}re.add("animate","color"),el.canAnimate=!0,Object.assign(il.list,cv),Object.assign(il,uv);const yv=Dl.prototype;Dl.addAttr("animation",void 0,function(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),Dl.addAttr("animationOut",void 0,un),Dl.addAttr("transition",!0,un),Dl.addAttr("transitionOut",void 0,un),yv.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},yv.animate=function(t,e,i,o){if(s(t))return this.__animate;let n=d(t)&&!e&&i?new jy(this,t,o):new Vy(this,t,e,o);this.killAnimate(i,n.toStyle);const r=this.__animate;return r&&(n instanceof jy?n.list.unshift(r):n=new jy(this,[r,n])),this.__animate=n},yv.killAnimate=function(t,e){const i=this.__animate;if(i){let t=!1;if(e&&!i.completed){i instanceof jy&&i.updateList();const{toStyle:s}=i;for(let i in e)if(i in s){t=!0;break}}else t=!0;t&&(i.kill(!0,e),this.__animate=null)}},yv.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(Hy.COMPLETED,e)};const vv=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],wv=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:xv}=Math,{getDerivative:bv}=ri,kv={getDistance(t,e,i,s,o,n,r,a,h=1){let l,d,c,u,g,_,p=0,f=h/2;for(let h=0;h<vv.length;h++)l=f*(1+vv[h]),d=f*(1-vv[h]),c=bv(l,t,i,o,r),u=bv(l,e,s,n,a),g=bv(d,t,i,o,r),_=bv(d,e,s,n,a),p+=wv[h]*(xv(c*c+u*u)+xv(g*g+_*_));return p*f},getRotation(t,e,i,s,o,n,r,a,h){const l=bv(t,e,s,n,a),d=bv(t,i,o,r,h);return Math.atan2(d,l)/Y},getT(t,e,i,s,o,n,r,a,h,l,d=1){let c=0,u=1,g=t/e,_=d/e/3;if(g>=1)return 1;if(g<=0)return 0;for(;u-c>_;)Sv(i,s,o,n,r,a,h,l,g)<t?c=g:u=g,g=(c+u)/2;return g},cut(t,e,i,s,o,n,r,a,h,l){const d=1-e,c=d*i+e*o,u=d*s+e*n,g=d*o+e*r,_=d*n+e*a,p=d*c+e*g,f=d*u+e*_,m=d*p+e*(d*g+e*(d*r+e*h)),y=d*f+e*(d*_+e*(d*a+e*l));t.push(Ae.C,c,u,p,f,m,y)}},{getDistance:Sv}=kv,{M:Ev,L:Bv,C:Tv,Z:Rv}=Ae,Cv={},Ov={},Pv={transform(t,e){let i,s=0;const o=t.length;for(;s<o;)switch(i=t[s],i){case Ev:case Bv:Pv.transformPoints(t,e,s,1),s+=3;break;case Tv:Pv.transformPoints(t,e,s,3),s+=7;break;case Rv:s+=1}},transformPoints(t,e,i,s){for(let o=i+1,n=o+2*s;o<n;o+=2)Cv.x=t[o],Cv.y=t[o+1],$.toOuterPoint(e,Cv),t[o]=Cv.x,t[o+1]=Cv.y},getMotionPathData(t){let e,i,s,o,n=0,r=[],a=0,h=0,l=0;const d=t.length;for(;a<d;){switch(o=t[a],o){case Ev:case Bv:i=t[a+1],s=t[a+2],e=o===Bv&&a>0?dt.getDistanceFrom(h,l,i,s):0,h=i,l=s,a+=3;break;case Tv:i=t[a+5],s=t[a+6],e=kv.getDistance(h,l,t[a+1],t[a+2],t[a+3],t[a+4],i,s),h=i,l=s,a+=7;break;case Rv:a+=1;default:e=0}r.push(e),n+=e}return{total:n,segments:r,data:t}},getDistancePoint(t,e,i){const{segments:s,data:o}=t;e=Gh.number(e,t.total);let n,r,a,h,l,d,c,u,g,_=0,p={},f=0,m=0,y=0,v=0;const w=o.length;for(;f<w;){switch(h=o[f],h){case Ev:case Bv:if(r=o[f+1],a=o[f+2],n=s[m],_+n>=e||!t.total)return f||(y=r,v=a),Ov.x=y,Ov.y=v,p.x=r,p.y=a,dt.getDistancePoint(Ov,p,e-_,!0),p.rotation=dt.getAngle(Ov,p),p;y=r,v=a,f+=3;break;case Tv:if(r=o[f+5],a=o[f+6],n=s[m],_+n>=e)return l=o[f+1],d=o[f+2],c=o[f+3],u=o[f+4],g=kv.getT(e-_,n,y,v,l,d,c,u,r,a,i),ri.getPointAndSet(g,y,v,l,d,c,u,r,a,p),p.rotation=kv.getRotation(g,y,v,l,d,c,u,r,a),p;y=r,v=a,f+=7;break;case Rv:f+=1;default:n=0}m++,_+=n}return p},getDistancePath(t,e,i){const{segments:s,data:o}=t,n=[];e=Gh.number(e,t.total);let r,a,h,l,d,c,u,g,_,p=0,f={},m=0,y=0,v=0,w=0;const x=o.length;for(;m<x;){switch(l=o[m],l){case Ev:case Bv:if(a=o[m+1],h=o[m+2],r=s[y],p+r>=e||!t.total)return m||(v=a,w=h),Ov.x=v,Ov.y=w,f.x=a,f.y=h,dt.getDistancePoint(Ov,f,e-p,!0),n.push(l,f.x,f.y),n;v=a,w=h,m+=3,n.push(l,v,w);break;case Tv:if(d=o[m+1],c=o[m+2],u=o[m+3],g=o[m+4],a=o[m+5],h=o[m+6],r=s[y],p+r>=e)return _=kv.getT(e-p,r,v,w,d,c,u,g,a,h,i),kv.cut(n,_,v,w,d,c,u,g,a,h),n;v=a,w=h,m+=7,n.push(l,d,c,u,g,a,h);break;case Rv:m+=1,n.push(l);default:r=0}y++,p+=r}return n}};function Lv(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!o(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}re.add("motion-path"),il.register("motion",function(t,e,i,s){return c(t)&&(t=Gh.number(t,s.getMotionTotal())),c(e)&&(e=Gh.number(e,s.getMotionTotal())),il.number(t||0,e||0,i)}),il.register("motionRotation",function(t,e,i){return il.number(t,e,i)});const Av=Dl.prototype,{updateMatrix:Dv,updateAllMatrix:Mv}=ar,{updateBounds:Fv}=vr;function Iv(t){const{motion:e,leaferIsCreated:i}=t;if(!o(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=zv(t);i.total&&(t.__.__pathForRender=Pv.getDistancePath(i,e,t.motionPrecision))}else t.set(t.getMotionPoint(e)),t.__hasAutoLayout||(t.isBranch?(Mv(t),Fv(t,t)):Dv(t));i&&(t.leafer.created=!0)}}function Wv(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function zv(t){const e=t.__;return e.__pathForMotion?e.__pathForMotion:e.__pathForMotion=Pv.getMotionPathData(t.getPath(!0,!0))}function Yv(t,e){return ln(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?el.setStyleName(this,e,i):el.set(this,i):this.__layout.stateStyleChanged=!0}}))}function Xv(t){return ln(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function Nv(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function Hv(t,e){c(e)||(e=void 0),Uv(t,e,"in")}function Vv(t,e){const{normalStyle:i}=t;c(e)||(e=void 0),i&&(e||(e=i),Uv(t,e,"out"))}Dl.addAttr("motionPath",void 0,Lv),Dl.addAttr("motionPrecision",1,Lv),Dl.addAttr("motion",void 0,Lv),Dl.addAttr("motionRotation",!0,Lv),Av.getMotionPathData=function(){return zv(Wv(this))},Av.getMotionPoint=function(t){const e=Wv(this),i=zv(e);if(!i.total)return{};const s=Pv.getDistancePoint(i,t,e.motionPrecision);$.toOuterPoint(e.localTransform,s);const{motionRotation:o}=this;return!1===o?delete s.rotation:a(o)&&(s.rotation+=o),s},Av.getMotionTotal=function(){return this.getMotionPathData().total},Av.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],o(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),Iv(t))}else Iv(this)};const jv={};function Uv(t,e,i){const{normalStyle:s}=t;e||(e=jv),e.scale&&(W.assignScale(e,e.scale),delete e.scale),e!==jv&&el.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&o(i[s])&&o(e[s])&&(s="transition");return o(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=qv(e,t),s=t.animate();s&&qv(i,t,s.fromStyle);return i}(t,e):void 0;el.canAnimate&&Gv(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const a=Gv(t);if(a){const{animation:s}=a;if(s){const o=t.animate(s,void 0,"animation",!0);Object.assign(a,o.endingStyle),"in"!==i||e.animation!==s?o.kill():n=!1,delete a.animation}t.normalStyle=Kv(a,t),t.set(a,"temp")}else t.normalStyle=void 0;if(n){const e=Kv(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function Gv(t){let e;const i={},s=Nv(t),o=s?t.state||s.state:t.state,n=o&&t.states[o];n&&el.isState(o,t,s)&&(e=Zv(i,n));const r=i.selectedStyle||t.selectedStyle;r&&el.isSelected(t,s)&&(e=Zv(i,r));const a=i.placeholderStyle||t.placeholderStyle;if(a&&el.isPlacehold(t,s)&&(e=Zv(i,a)),el.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=Zv(i,s))}else{const o=i.focusStyle||t.focusStyle;o&&el.isFocus(t,s)&&(e=Zv(i,o));const n=i.hoverStyle||t.hoverStyle;n&&el.isHover(t,s)&&(e=Zv(i,n));const r=i.pressStyle||t.pressStyle;r&&el.isPress(t,s)&&(e=Zv(i,r))}return e?i:void 0}function Kv(t,e,i,s){const o=i?t:{},n=i||t;for(let t in n)s&&el.animateExcludes[t]||(o[t]=e[t]);return o}function qv(t,e,i){return Kv(t,e,i,!0)}function Zv(t,e){return Object.assign(t,e),!0}function Jv(t,e){const i=t[e];i&&Hv(t,i),t.button&&$v(t.children,e)}function Qv(t,e,i){i||(i=t.states[e]),Hv(t,i),t.button&&$v(t.children,null,e)}function $v(t,e,i){if(!t)return;let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],e){switch(n=!0,e){case"hoverStyle":el.isHover(o)&&(n=!1);break;case"pressStyle":el.isPress(o)&&(n=!1);break;case"focusStyle":el.isFocus(o)&&(n=!1)}n&&Jv(o,e)}else s(i)||Qv(o,i);o.isBranch&&$v(o.children,e,i)}}function tw(t,e){const i=t[e];i&&Vv(t,i),t.button&&iw(t.children,e)}function ew(t,e,i){Vv(t,i),t.button&&iw(t.children,null,e)}function iw(t,e,i){if(!t)return;let o;for(let n=0,r=t.length;n<r;n++)o=t[n],e?tw(o,e):s(i)||ew(o,i),o.isBranch&&iw(o.children,e,i)}function sw(t,e,i){let s;const o=e.leafer?e.leafer.interaction:null;if(o&&(s=o[t](e),!s&&i)){const n=Nv(e,i);n&&(s=o[t](n))}return s}function ow(t,e,i){let s=e[t];if(!s&&i){const o=Nv(e,i);o&&(s=o[t])}return s}re.add("state"),el.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},el.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const o=Nv(e,i);o&&(s=o.states[t])}return!!s}(t,e,i)},el.isSelected=function(t,e){return ow("selected",t,e)},el.isDisabled=function(t,e){return ow("disabled",t,e)},el.isFocus=function(t,e){return sw("isFocus",t,e)},el.isHover=function(t,e){return sw("isHover",t,e)},el.isPress=function(t,e){return sw("isPress",t,e)},el.isPlacehold=function(t,e){return t.__.__isPlacehold},el.isDrag=function(t,e){return sw("isDrag",t,e)},el.setStyleName=function(t,e,i){i?Qv(t,e,t[e]):ew(t,e,t[e])},el.set=function(t,e){const i=t.states[e];i?Qv(t,e,i):ew(t,e,i)},el.getStyle=Gv,el.updateStyle=Uv,el.updateEventStyle=function(t,e){switch(e){case qd.ENTER:Jv(t,"hoverStyle");break;case qd.LEAVE:tw(t,"hoverStyle");break;case qd.DOWN:Jv(t,"pressStyle");break;case qd.UP:tw(t,"pressStyle")}};const nw=Dl.prototype;Dl.addAttr("selected",!1,Yv,"selectedStyle"),Dl.addAttr("disabled",!1,Yv,"disabledStyle"),Dl.addAttr("states",{},Xv),Dl.addAttr("state","",Yv),Dl.addAttr("normalStyle",void 0,un),Dl.addAttr("hoverStyle",void 0,Xv),Dl.addAttr("pressStyle",void 0,Xv),Dl.addAttr("focusStyle",void 0,Xv),Dl.addAttr("selectedStyle",void 0,Xv),Dl.addAttr("disabledStyle",void 0,Xv),Dl.addAttr("placeholderStyle",void 0,Xv),Dl.addAttr("button",!1,un),nw.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},nw.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?Jv(this,"focusStyle"):tw(this,"focusStyle")})},nw.updateState=function(){el.updateStyle(this,void 0,"in")};const rw=Rd.prototype,aw="text";rn(rw,aw,Object.assign(Object.assign({},an(rw,aw)),{set(t){const e=this,i=e.text;e.__setAttr(aw,t)&&(wn(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));class hw extends ll{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}let lw=class extends Dl{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;d(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!s(t))if(a(t))this.now=t;else if(c(t)){const e=d(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=tn.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:o,size:n,total:r}=e,{width:h,height:l}=n&&(a(n)?{width:n,height:n}:n)||(r>1?this:t);let d=o?o.x:0,c=o?o.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:d,y:c,width:h,height:l},d+h>=t.width?(d=0,c+=l):d+=h;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new zr(zr.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:o,__action:n}=this;n&&(n.FPS&&(i=n.FPS),s(n.loop)||(o=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!o)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate("width"),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:o}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,o)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}};pe([Wn(hw)],lw.prototype,"__",void 0),pe([yn()],lw.prototype,"robot",void 0),pe([un()],lw.prototype,"actions",void 0),pe([un("")],lw.prototype,"action",void 0),pe([Tn(0)],lw.prototype,"now",void 0),pe([un(12)],lw.prototype,"FPS",void 0),pe([un(!0)],lw.prototype,"loop",void 0),lw=pe([Kn()],lw),re.add("robot");const{Yes:dw,NoAndSkip:cw,YesAndSkip:uw}=e,gw={},_w={},pw={};class fw{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,o){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":gw.id=t.substring(1),t=gw;break;case".":_w.className=t.substring(1),t=_w;break;default:pw.tag=t,t=pw}case"object":if(s(t.id)){if(t.tag){const{tag:s}=t,o=d(s);return this.getByMethod(o?this.methods.tags:this.methods.tag,e,i,o?_.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,o)}}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&&ar.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const o=i?null:[];return this.eachFind(this.toChildren(e),t,o,s),o||this.findLeaf}eachFind(t,e,i,s){let o,n;for(let r=0,a=t.length;r<a;r++){if(o=t[r],n=e(o,s),n===dw||n===uw){if(!i)return void(this.findLeaf=o);i.push(o)}o.isBranch&&n<cw&&this.eachFind(o.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Mr.REMOVE,this.__onRemoveChild,this),this.target.on_(Ir.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 mw=Dl.prototype;function yw(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())}mw.find=function(t,e){return yw(this).getBy(t,this,!1,e)},mw.findOne=function(t,e){return yw(this).getBy(t,this,!0,e)},re.add("find"),ae.finder=function(t){return new fw(t)};const{setPoint:vw,addPoint:ww,toBounds:xw}=vt;const bw={syncExport(t,e,i){let o;tl.running=!0;try{const n=Uo.fileType(e),r=e.includes(".");i=Uo.getExportOptions(i);const{toURL:a}=v,{download:h}=v.origin;if("json"===n)r&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),o={data:!!r||t.toJSON(i.json)};else if("svg"===n)r&&h(a(t.toSVG(),"svg"),e),o={data:!!r||t.toSVG()};else{let n,r,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:g,clip:_,trim:p,screenshot:f,padding:m,onCanvas:y}=i,w=s(i.smooth)?!c||c.config.smooth:i.smooth,x=i.contextSettings||(c?c.config.contextSettings:void 0),b=d&&f&&s(i.fill)?t.fill:i.fill,k=Uo.isOpaqueImage(e)||b,S=new mt;if(f)n=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":S.set(l);break;case"local":S.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:S.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}n=t.getBounds("render",e)}const E={scaleX:1,scaleY:1};W.getScaleData(i.scale,i.size,n,E);let B=i.pixelRatio||1,{x:T,y:R,width:C,height:O}=new Kt(n).scale(E.scaleX,E.scaleY);_&&(T+=_.x,R+=_.y,C=_.width,O=_.height);const P={exporting:!0,matrix:S.scale(1/E.scaleX,1/E.scaleY).invert().translate(-T,-R).withScale(1/a*E.scaleX,1/h*E.scaleY)};let L,A=ae.canvas({width:Math.floor(C),height:Math.floor(O),pixelRatio:B,smooth:w,contextSettings:x});g&&(L=t,L.__worldOpacity=0,t=c||t,P.bounds=A.bounds),A.save();const D=u&&!s(b),M=t.get("fill");if(D&&(t.fill=""),v.render(t,A,P),D&&(t.fill=M),A.restore(),L&&L.__updateWorldOpacity(),p){r=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let o,n,r,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(o=a%e,n=(a-o)/e,r?ww(r,o,n):vw(r={},o,n)),a++;const h=new Kt;return r&&(xw(r,h),h.scale(1/t.pixelRatio).ceil()),h}(A);const t=A,{width:e,height:i}=r,s={x:0,y:0,width:e,height:i,pixelRatio:B};A=ae.canvas(s),A.copyWorld(t,r,s),t.destroy()}if(m){const[t,e,i,s]=W.fourNumber(m),o=A,{width:n,height:r}=o;A=ae.canvas({width:n+s+e,height:r+t+i,pixelRatio:B}),A.copyWorld(o,o.bounds,{x:s,y:t,width:n,height:r}),o.destroy()}k&&A.fillWorld(A.bounds,b||"#FFFFFF","destination-over"),y&&y(A);o={data:"canvas"===e?A:A.export(e,i),width:A.pixelWidth,height:A.pixelHeight,renderBounds:n,trimBounds:r};const F=c&&c.app;F&&F.canvasManager&&F.canvasManager.clearRecycled()}}catch(t){o={data:"",error:t}}return tl.running=!1,o},export(t,e,i){return tl.running=!0,function(t){kw||(kw=new Zo);return new Promise(e=>{kw.add(()=>fe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(o=>{const n=()=>fe(this,void 0,void 0,function*(){if(!Qo.isComplete)return v.requestRender(n);const r=tl.syncExport(t,e,i);r.data instanceof Promise&&(r.data=yield r.data),s(r),o()});t.updateLayout(),Sw(t);const{leafer:r}=t;r?r.waitViewCompleted(n):n()}))}};let kw;function Sw(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Sw(t))}const Ew=Oe.prototype,Bw=$t.get("@leafer-in/export");Ew.export=function(t,e){const{quality:i,blob:s}=Uo.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},Ew.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Bw.error(t),i(null)})})},Ew.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},Ew.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Bw.error(t),i(!1)})})},re.add("export"),Object.assign(tl,bw),Dl.prototype.export=function(t,e){return tl.export(this,t,e)},Dl.prototype.syncExport=function(t,e){return tl.syncExport(this,t,e)},re.add("filter"),Object.assign($h,{list:{},register(t,e){$h.list[t]=e},apply(t,e,i,s,o,n){let r;t.forEach(t=>{r=$h.list[t.type],r&&r.apply(t,e,i,s,o,n)})},getSpread(t){let e,i=0;return t.forEach(t=>{e=$h.list[t.type],e&&(i+=e.getSpread(t))}),i}}),re.add("bright"),Dl.addAttr("bright",!1,Rn);export{Tt as AlignHelper,Vy as Animate,Xy as AnimateEasing,Hy as AnimateEvent,jy as AnimateList,e as Answer,Pd as App,St as AroundHelper,Gf as Arrow,jf as ArrowData,Zt as AutoBounds,ri as BezierHelper,Kt as Bounds,Yr as BoundsEvent,Vt as BoundsHelper,jl as Box,ul as BoxData,fh as Branch,vr as BranchHelper,Da as BranchRender,bd as Canvas,El as CanvasData,_e as CanvasManager,Mr as ChildEvent,Uh as ColorConvert,ae as Creator,Ec as Cursor,_ as DataHelper,$t as Debug,xt as Direction4,bt as Direction9,Gd as DragBoundsHelper,Qd as DragEvent,_c as Dragger,tc as DropEvent,ap as EditBox,$_ as EditDataHelper,op as EditPoint,Y_ as EditSelect,F_ as EditSelectHelper,Mp as EditTool,wp as EditToolCreator,Ap as Editor,E_ as EditorEvent,kp as EditorGroupEvent,fp as EditorHelper,Rp as EditorMoveEvent,Op as EditorRotateEvent,Cp as EditorScaleEvent,Pp as EditorSkewEvent,Qh as Effect,Zl as Ellipse,ml as EllipseData,pi as EllipseHelper,Dr as Event,ue as EventCreator,sa as Eventer,tl as Export,Uo as FileHelper,$h as Filter,fw as Finder,Um as Flow,R as FourNumberHelper,Ul as Frame,_l as FrameData,Ml as Group,cl as GroupData,kv as HighBezierHelper,Pv as HighCurveHelper,Bc as HitCanvasManager,wd as Image,Sl as ImageData,zr as ImageEvent,tn as ImageManager,x as IncrementId,Dp as InnerEditor,bp as InnerEditorEvent,Nc as Interaction,Sc as InteractionBase,hc as InteractionHelper,ac as KeyEvent,Ad as Keyboard,Kr as LayoutEvent,Mh as Layouter,rh as Leaf,Pa as LeafBounds,pr as LeafBoundsHelper,f as LeafData,fa as LeafDataProxy,_a as LeafEventer,ar as LeafHelper,Ar as LeafLayout,yh as LeafLevelList,mh as LeafList,ka as LeafMatrix,La as LeafRender,Wl as Leafer,wh as LeaferCanvas,Oe as LeaferCanvasBase,gl as LeaferData,Zr as LeaferEvent,nn as LeaferImage,wf as LeaferTypeCreator,vd as Line,pl as LineData,Xp as LineEditTool,W as MathHelper,mt as Matrix,$ as MatrixHelper,ec as MoveEvent,kf as MultiTouchHelper,$d as MyDragEvent,xd as MyImage,Zd as MyPointerEvent,sc as MyTouchEvent,Me as NeedConvertToCanvasCommandMap,Y as OneRadian,X as PI2,N as PI_2,qh as Paint,Jh as PaintGradient,Zh as PaintImage,Cd as Path,Kh as PathArrow,Hm as PathArrowModule,Do as PathBounds,ks as PathCommandDataHelper,Ae as PathCommandMap,fi as PathCommandNodeHelper,ts as PathConvert,Xo as PathCorner,Ys as PathCreator,wl as PathData,eo as PathDrawer,Pe as PathHelper,sm as PathMatrixHelper,t as PathNodeHandleType,ze as PathNumberCommandLengthMap,We as PathNumberCommandMap,ef as PathScaler,Od as Pen,xl as PenData,zh as Picker,v as Platform,re as Plugin,pt as Point,dt as PointHelper,Dd as PointerButton,qd as PointerEvent,od as Polygon,yl as PolygonData,Ir as PropertyEvent,zl as Rect,fl as RectData,Ye as RectHelper,Ll as RectRender,qr as RenderEvent,Ih as Renderer,Ur as ResizeEvent,Qo as Resource,lw as Robot,hw as RobotData,oc as RotateEvent,se as Run,Vf as ScrollBar,M_ as SelectArea,Yh as Selector,cd as Star,vl as StarData,el as State,Jt as StringNumberMap,D_ as Stroker,nc as SwipeEvent,qo as TaskItem,Zo as TaskProcessor,Rd as Text,jh as TextConvert,kl as TextData,ic as TouchEvent,Lp as TransformTool,Df as Transformer,il as Transition,vt as TwoPointBoundsHelper,Dl as UI,Rl as UIBounds,le as UICreator,ll as UIData,Md as UIEvent,Ol as UIRender,Gh as UnitConvert,kr as WaitHelper,Gr as WatchEvent,Sh as Watcher,Cf as WheelEventHelper,rc as ZoomEvent,mf as addViewport,yf as addViewportConfig,Bn as affectRenderBoundsType,kn as affectStrokeBoundsType,Uf as arrowType,dn as attr,pn as autoLayoutType,yn as boundsType,jo as canvasPatch,Ce as canvasSizeAttrs,Vh as createAttr,hn as createDescriptor,In as cursorType,Wn as dataProcessor,un as dataType,ln as decorateLeafAttr,Yn as defineDataProcessor,rn as defineKey,cn as defineLeafAttr,Rn as dimType,wn as doBoundsType,Sn as doStrokeType,Xh as effectType,i as emptyData,Mn as eraserType,Wr as extraPropertyEventMap,V as getBoundsData,an as getDescriptor,j as getMatrixData,H as getPointData,Fn as hitType,d as isArray,u as isData,g as isEmptyData,r as isFinite,o as isNull,a as isNumber,c as isObject,n as isString,s as isUndefined,zn as layoutProcessor,ea as leaferTransformAttrMap,Dn as maskType,Lv as motionPathType,vn as naturalBoundsType,Cn as opacityType,No as path,xn as pathInputType,bn as pathType,Ho as pen,gn as positionType,yp as registerEditTool,vp as registerInnerEditor,Kn as registerUI,qn as registerUIEvent,Nh as resizeType,Vn as rewrite,jn as rewriteAble,mn as rotationType,cf as scaleResize,uf as scaleResizeFontSize,pf as scaleResizeGroup,gf as scaleResizePath,_f as scaleResizePoints,fn as scaleType,_n as scrollType,An as sortType,Xv as stateStyleType,Yv as stateType,En as strokeType,Tn as surfaceType,qt as tempBounds,yt as tempMatrix,ft as tempPoint,l as tryToNumber,kh as useCanvas,Gn as useModule,vh as version,On as visibleType,Hh as zoomLayerType};
|
|
2
2
|
//# sourceMappingURL=miniapp.module.min.js.map
|