leafer-draw 1.9.3 → 1.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +62 -33
- package/dist/web.esm.js +63 -34
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +150 -165
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +152 -168
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";const e={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:s,suffix:i}=e.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),s&&"/"===t[0]&&(t=s+t),t}}},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s;var r;t.Answer=void 0,(r=t.Answer||(t.Answer={}))[r.No=0]="No",r[r.Yes=1]="Yes",r[r.NoAndSkip=2]="NoAndSkip",r[r.YesAndSkip=3]="YesAndSkip";function o(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;const{isArray:c}=Array;function u(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return f(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&f(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{o(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:f}=p;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=o(s)?this[i]: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(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(c(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:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!o(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}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{round:y,pow:m,PI:x}=Math,w={within:(t,e,s)=>(u(e)&&(s=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(s)&&t>s&&(t=s),t),fourNumber(t,e){let s;if(c(t))switch(t.length){case 4:s=o(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]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),w.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=o(e)?1e12:m(10,e);return-0===(t=y(t*s)/s)?0:t},getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&w.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:v,randColor:t=>`rgba(${v(255)},${v(255)},${v(255)},${t||1})`};function v(t){return Math.round(Math.random()*t)}const b=x/180,B=2*x,k=x/2;function S(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:P,cos:T,acos:L,sqrt:E}=Math,{float:I}=w,O={};function A(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const M={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:A(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:C,getWorld:A,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i){W.toInnerPoint(t,e,O),W.scaleOfInner(t,O,s,i)},scaleOfInner(t,e,s,i=s){W.translateInner(t,e.x,e.y),W.scale(t,s,i),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=T(e*=b),a=P(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){W.toInnerPoint(t,e,O),W.rotateOfInner(t,O,s)},rotateOfInner(t,e,s){W.translateInner(t,e.x,e.y),W.rotate(t,s),W.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=b,t.a=i+o*s,t.b=r+n*s),e&&(e*=b,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){W.toInnerPoint(t,e,O),W.skewOfInner(t,O,s,i)},skewOfInner(t,e,s,i=0){W.translateInner(t,e.x,e.y),W.skew(t,s,i),W.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,i,r){const{e:n,f:a}=t;if(s||(s=t),o(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:o,c:n,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,i,r){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(o(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,o=s*b,n=T(o),a=P(o);if(i||r){const e=i*b,s=r*b;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||i)&&W.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,f=h,g=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=E(r*r+o*o),c=t/d;const e=r/d;u=o>0?L(e):-L(e)}else{c=E(n*n+a*a),d=t/c;const e=n/c;u=k-(a>0?L(-e):-L(e))}const e=I(T(u)),s=P(u);d=I(d),c=I(c),_=e?I((n/c+s)/e/b,9):0,p=e?I((o/d-s)/e/b,9):0,u=I(u/b)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(f+=e.x*r+e.y*n,g+=e.x*o+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=E(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){W.set(t)}},W=M,{toInnerPoint:D,toOuterPoint:F}=M,{sin:z,cos:U,abs:N,sqrt:Y,atan2:X,min:H,round:G}=Math,V={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=o(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(t.y)},move(t,e,s){u(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=j.defaultPoint);const i=U(e*=b),r=z(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=j;return Q(s,t),D(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=j;return Q(s,t),F(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=j;return Q(s,t),j.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),D(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){D(e,t,s)},toOuterOf(t,e,s){F(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=N(s-t),o=N(i-e);return Y(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>H(q(t,e,s,i),q(s,i,r,o)),getAngle:(t,e)=>J(t,e)/b,getRotation:(t,e,s,i)=>(i||(i=e),j.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/b),getRadianFrom(t,e,s,i,r,n,a,h){o(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>X(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=J(t,e);return(e=i?e:{}).x=t.x+U(r)*s,e.y=t.y+z(r)*s,e},toNumberPoints(t){let e=t;return u(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){j.reset(t)}},j=V,{getDistanceFrom:q,copy:Q,getAtan2:J}=j;class ${constructor(t,e){this.set(t,e)}set(t,e){return u(t)?V.copy(this,t):V.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new $(this)}move(t,e){return V.move(this,t,e),this}scale(t,e){return V.scale(this,t,e),this}scaleOf(t,e,s){return V.scaleOf(this,t,e,s),this}rotate(t,e){return V.rotate(this,t,e),this}rotateOf(t,e){return V.rotate(this,e,t),this}getRotation(t,e,s){return V.getRotation(this,t,e,s)}toInnerOf(t,e){return V.toInnerOf(this,t,e),this}toOuterOf(t,e){return V.toOuterOf(this,t,e),this}getCenter(t){return new $(V.getCenter(this,t))}getDistance(t){return V.getDistance(this,t)}getDistancePoint(t,e,s){return new $(V.getDistancePoint(this,t,e,s))}getAngle(t){return V.getAngle(this,t)}getAtan2(t){return V.getAtan2(this,t)}reset(){return V.reset(this),this}}const Z=new $;class K{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return u(t)?M.copy(this,t):M.set(this,t,e,s,i,r,o),this}setWith(t){return M.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}clone(){return new K(this)}translate(t,e){return M.translate(this,t,e),this}translateInner(t,e){return M.translateInner(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleWith(t,e){return M.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return M.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return M.scaleOfInner(this,t,e,s),this}rotate(t){return M.rotate(this,t),this}rotateOfOuter(t,e){return M.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return M.rotateOfInner(this,t,e),this}skew(t,e){return M.skew(this,t,e),this}skewOfOuter(t,e,s){return M.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return M.skewOfInner(this,t,e,s),this}multiply(t){return M.multiply(this,t),this}multiplyParent(t){return M.multiplyParent(this,t),this}divide(t){return M.divide(this,t),this}divideParent(t){return M.divideParent(this,t),this}invert(){return M.invert(this),this}invertWith(){return M.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){M.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){M.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return M.setLayout(this,t,e,s),this}getLayout(t,e,s){return M.getLayout(this,t,e,s)}withScale(t,e){return M.withScale(this,t,e)}reset(){M.reset(this)}}const tt=new K,et={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){st(t,e,s),st(t,e+i,s+r)},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:st}=et;var it,rt;t.Direction4=void 0,(it=t.Direction4||(t.Direction4={}))[it.top=0]="top",it[it.right=1]="right",it[it.bottom=2]="bottom",it[it.left=3]="left",t.Direction9=void 0,(rt=t.Direction9||(t.Direction9={}))[rt.topLeft=0]="topLeft",rt[rt.top=1]="top",rt[rt.topRight=2]="topRight",rt[rt.right=3]="right",rt[rt.bottomRight=4]="bottomRight",rt[rt.bottom=5]="bottom",rt[rt.bottomLeft=6]="bottomLeft",rt[rt.left=7]="left",rt[rt.center=8]="center",rt[rt["top-left"]=0]="top-left",rt[rt["top-right"]=2]="top-right",rt[rt["bottom-right"]=4]="bottom-right",rt[rt["bottom-left"]=6]="bottom-left";const ot=[{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}];ot.forEach(t=>t.type="percent");const nt={directionData:ot,tempPoint:{},get:at,toPoint(t,e,s,i,r,o){const n=at(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),nt.toPoint(t,e,s,!0),s)};function at(e){return a(e)?ot[t.Direction9[e]]:e}const{toPoint:ht}=nt,lt={toPoint(t,e,s,i,r,o){ht(t,s,i,r,e,o)}},{tempPointBounds:dt,setPoint:ct,addPoint:ut,toBounds:_t}=et,{toOuterPoint:pt}=M,{float:ft,fourNumber:gt}=w,{floor:yt,ceil:mt}=Math;let xt,wt,vt,bt;const Bt={},kt={},St={},Rt={tempBounds:St,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(c(s)){const e=gt(s);i?Ct.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Ct.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Ct.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Tt(e,t):e=t,s?(e.offsetX=-(Ct.maxX(s)-t.x),e.offsetY=-(Ct.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||V.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){V.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Ct.copy(St,t),Ct.toOuterOf(St,e),St),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else Bt.x=t.x,Bt.y=t.y,pt(e,Bt,kt),ct(dt,kt.x,kt.y),Bt.x=t.x+t.width,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.y=t.y+t.height,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.x=t.x,pt(e,Bt,kt),ut(dt,kt.x,kt.y),_t(dt,s)},toInnerOf(t,e,s){s||(s=t),Ct.move(s,-e.e,-e.f),Ct.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Ct.getFitScale(t,e));return new K(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,o){o||(o=e),a(i)&&(i=Ct.getFitScale(t,e,"cover"===i)),St.width=r?e.width*=i:e.width*i,St.height=r?e.height*=i:e.height*i,lt.toPoint(s,St,t,o,!0,!0)},getSpread(t,e,s){const i={};return Ct.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Ct.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ct.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=yt(t.x),t.y=yt(t.y),t.width=e>t.x?mt(t.width+e-t.x):mt(t.width),t.height=s>t.y?mt(t.height+s-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=ft(t.x,e),t.y=ft(t.y,e),t.width=ft(t.width,e),t.height=ft(t.height,e)},add(t,e,s){xt=t.x+t.width,wt=t.y+t.height,vt=e.x,bt=e.y,s||(vt+=e.width,bt+=e.height),xt=xt>vt?xt:vt,wt=wt>bt?wt:bt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=wt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ct.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ct.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Tt(t,r)):Pt(t,r));o&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?ct(dt,t.x,t.y):ut(dt,t.x,t.y)),_t(dt,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Pt(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=V.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=V.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Ct.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=Ct.tempToOuterOf(e,s)),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,s){if(s&&(e=Ct.tempToOuterOf(e,s)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return xt=i+o,wt=r+n,vt=t.x+t.width,bt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,xt=xt<vt?xt:vt,wt=wt<bt?wt:bt,o=xt-i,n=wt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Ct.copy(t,Ct.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Ct.set(t)}},Ct=Rt,{add:Pt,copy:Tt}=Ct;class Lt{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Rt.copy(this,t):Rt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Lt(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,s){return Rt.scale(this,t,e,s),this}scaleOf(t,e,s){return Rt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,s){Rt.put(this,t,e,s)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const Et=new Lt;class It{constructor(t,e,s,i,r,o){u(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Lt(r,e,o||t.width-r-s,n||t.height-e-i)}}const Ot={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:At}=w;class Mt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Mt(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const s=At();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Mt.showBounds,r=t.__nowWorld,o=At();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(Dt.enable){if(Dt.filterList.length&&Dt.filterList.every(t=>t!==this.name))return;if(Dt.excludeList.length&&Dt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Dt.enable&&this.warn(...t)}warn(...t){Dt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Wt(t){return t?a(t)&&(t=[t]):t=[],t}Mt.filterList=[],Mt.excludeList=[],Mt.showWarn=!0;const Dt=Mt,Ft=Mt.get("RunTime"),zt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Ut.currentId=Ut.idMap[i]=e?performance.now():Date.now(),Ut.currentName=Ut.nameMap[i]=t,Ut.nameToIdMap[t]=i,i},end(t,e){const s=Ut.idMap[t],i=Ut.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Ut.idMap[t]=Ut.nameMap[t]=Ut.nameToIdMap[i]=void 0,Ft.log(i,r,"ms")},endOfName(t,e){const s=Ut.nameToIdMap[t];o(s)||Ut.end(s,e)}},Ut=zt,Nt=[],Yt={list:{},add(t,...e){this.list[t]=!0,Nt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>Nt.forEach(t=>Yt.has(t,!0)));const Xt={editor:t=>Yt.need("editor")},Ht=Mt.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Vt[e]&&Ht.repeat(e),Vt[e]=t},get(t,e,s,i,r,n){Vt[t]||Ht.error("not register "+t);const a=new Vt[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:Vt}=Gt,jt=Mt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(Qt[e]&&jt.repeat(e),Qt[e]=t)})},changeName(t,e){const s=Qt[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,Qt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Qt[t](...e)},{nameList:Qt}=qt;class Jt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Xt.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function $t(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Zt(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function Kt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const te=[];function ee(){return(t,e)=>{te.push(e)}}const se=[];class ie{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||se)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;te.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){u(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}$t([Kt("imageSmoothingEnabled")],ie.prototype,"smooth",void 0),$t([Kt("imageSmoothingQuality")],ie.prototype,"smoothLevel",void 0),$t([Kt("globalAlpha")],ie.prototype,"opacity",void 0),$t([Kt()],ie.prototype,"fillStyle",void 0),$t([Kt()],ie.prototype,"strokeStyle",void 0),$t([Kt("lineWidth")],ie.prototype,"strokeWidth",void 0),$t([Kt("lineCap")],ie.prototype,"strokeCap",void 0),$t([Kt("lineJoin")],ie.prototype,"strokeJoin",void 0),$t([Kt("lineDashOffset")],ie.prototype,"dashOffset",void 0),$t([Kt()],ie.prototype,"miterLimit",void 0),$t([Kt()],ie.prototype,"shadowBlur",void 0),$t([Kt()],ie.prototype,"shadowColor",void 0),$t([Kt()],ie.prototype,"shadowOffsetX",void 0),$t([Kt()],ie.prototype,"shadowOffsetY",void 0),$t([Kt()],ie.prototype,"filter",void 0),$t([Kt()],ie.prototype,"font",void 0),$t([Kt()],ie.prototype,"fontKerning",void 0),$t([Kt()],ie.prototype,"fontStretch",void 0),$t([Kt()],ie.prototype,"fontVariantCaps",void 0),$t([Kt()],ie.prototype,"textAlign",void 0),$t([Kt()],ie.prototype,"textBaseline",void 0),$t([Kt()],ie.prototype,"textRendering",void 0),$t([Kt()],ie.prototype,"wordSpacing",void 0),$t([Kt()],ie.prototype,"letterSpacing",void 0),$t([Kt()],ie.prototype,"direction",void 0),$t([ee()],ie.prototype,"setTransform",null),$t([ee()],ie.prototype,"resetTransform",null),$t([ee()],ie.prototype,"getTransform",null),$t([ee()],ie.prototype,"save",null),$t([ee()],ie.prototype,"restore",null),$t([ee()],ie.prototype,"translate",null),$t([ee()],ie.prototype,"scale",null),$t([ee()],ie.prototype,"rotate",null),$t([ee()],ie.prototype,"fill",null),$t([ee()],ie.prototype,"stroke",null),$t([ee()],ie.prototype,"clip",null),$t([ee()],ie.prototype,"fillRect",null),$t([ee()],ie.prototype,"strokeRect",null),$t([ee()],ie.prototype,"clearRect",null),$t([ee()],ie.prototype,"beginPath",null),$t([ee()],ie.prototype,"moveTo",null),$t([ee()],ie.prototype,"lineTo",null),$t([ee()],ie.prototype,"bezierCurveTo",null),$t([ee()],ie.prototype,"quadraticCurveTo",null),$t([ee()],ie.prototype,"closePath",null),$t([ee()],ie.prototype,"arc",null),$t([ee()],ie.prototype,"arcTo",null),$t([ee()],ie.prototype,"ellipse",null),$t([ee()],ie.prototype,"rect",null),$t([ee()],ie.prototype,"roundRect",null),$t([ee()],ie.prototype,"createConicGradient",null),$t([ee()],ie.prototype,"createLinearGradient",null),$t([ee()],ie.prototype,"createPattern",null),$t([ee()],ie.prototype,"createRadialGradient",null),$t([ee()],ie.prototype,"fillText",null),$t([ee()],ie.prototype,"measureText",null),$t([ee()],ie.prototype,"strokeText",null);const{copy:re,multiplyParent:oe}=M,{round:ne}=Math,ae=new Lt,he=new Lt,le={width:1,height:1,pixelRatio:1},de=["width","height","pixelRatio"];class ce extends ie{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,i){super(),this.size={},this.worldTransform={},t||(t=le),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:o,pixelRatio:n}=t;this.autoLayout=!r||!o,this.size.pixelRatio=n||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,de),de.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle())}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&oe(t,e,r),r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s,i&&(t.half&&t.half*s%2?(r.e=ne(r.e-.5)+.5,r.f=ne(r.f-.5)+.5):(r.e=ne(r.e),r.f=ne(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.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,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),o(e.dashPattern)||(r=e.dashPattern),o(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=n,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,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=he):s=ae,this.drawImage(t.view,ae.x,ae.y,ae.width,ae.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Rt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,ae.x,ae.y,ae.width,ae.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(ae.x,ae.y,ae.width,ae.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,ae.x,ae.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(ae.x,ae.y,ae.width,ae.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(ae.x,ae.y,ae.width,ae.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ae.x,ae.y,ae.width,ae.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ae.x,ae.y,ae.width,ae.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(ae,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(he,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):Xt.canvas(Object.assign({},s));return r.save(),t&&(re(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}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 ue={creator:{},parse(t,e){},convertToCanvasData(t,e){}},_e={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},pe=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},_e),fe={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},ge={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},ye=Object.assign(Object.assign({},ge),_e),me=pe,xe={};for(let t in me)xe[me[t]]=t;const we={};for(let t in me)we[me[t]]=fe[t];const ve={drawRoundRect(t,e,s,i,r,o){const n=w.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:be,cos:Be,atan2:ke,ceil:Se,abs:Re,PI:Ce,sqrt:Pe,pow:Te}=Math,{setPoint:Le,addPoint:Ee}=et,{set:Ie,toNumberPoints:Oe}=V,{M:Ae,L:Me,C:We,Q:De,Z:Fe}=pe,ze={},Ue={points(t,e,s,i){let r=Oe(e);if(t.push(Ae,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,f,g,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Pe(Te(n-e,2)+Te(a-o,2)),f=Pe(Te(h-n,2)+Te(l-a,2)),(p||f)&&(g=p+f,p=m*p/g,f=m*f/g,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(De,d,c,n,a):t.push(We,u,_,d,c,n,a),u=n+f*h,_=a+f*l);i||t.push(De,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Me,r[e],r[e+1]);i&&t.push(Fe)},rect(t,e,s,i,r){ue.creator.path=t,ue.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){ue.creator.path=[],ve.drawRoundRect(ue.creator,e,s,i,r,o),t.push(...ue.convertToCanvasData(ue.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let f=ke(u,c),g=ke(p,_),y=g-f;if(y<0&&(y+=B),y===Ce||Re(c+u)<1e-12||Re(_+p)<1e-12)return t&&t.push(Me,i,r),h&&(Le(h,e,s),Ee(h,i,r)),d&&Ie(d,e,s),void(l&&Ie(l,i,r));const m=c*p-_*u<0,x=m?-1:1,w=a/Be(y/2),v=i+w*Be(f+y/2+k*x),S=r+w*be(f+y/2+k*x);return f-=k*x,g-=k*x,Xe(t,v,S,a,a,0,f/b,g/b,m,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>Xe(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*b,_=be(u),p=Be(u);let f=n*b,g=a*b;f>Ce&&(f-=B),g<0&&(g+=B);let y=g-f;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Se(Re(y/k)),x=y/m,w=be(x/4),v=8/3*w*w/be(x/2);g=f+x;let S,R,C,P,T,L,E,I,O=Be(f),A=be(f),M=C=p*i*O-_*r*A,W=P=_*i*O+p*r*A,D=e+C,F=s+P;t&&t.push(t.length?Me:Ae,D,F),l&&Le(l,D,F),c&&Ie(c,D,F);for(let o=0;o<m;o++)S=Be(g),R=be(g),C=p*i*S-_*r*R,P=_*i*S+p*r*R,T=e+M-v*(p*i*A+_*r*O),L=s+W-v*(_*i*A-p*r*O),E=e+C+v*(p*i*R+_*r*S),I=s+P+v*(_*i*R-p*r*S),t&&t.push(We,T,L,E,I,e+C,s+P),l&&Ye(e+M,s+W,T,L,E,I,e+C,s+P,l,!0),M=C,W=P,O=S,A=R,f=g,g+=x;d&&Ie(d,e+C,s+P)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(We,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){Ye(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,f,g,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(f=(-u+m)/(2*c),0<f&&f<1&&d.push(f),g=(-u-m)/(2*c),0<g&&g<1&&d.push(g));l?Ee(h,t,e):Le(h,t,e),Ee(h,n,a);for(let l=0,c=d.length;l<c;l++)Ne(d[l],t,e,s,i,r,o,n,a,ze),Ee(h,ze.x,ze.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return Ne(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:Ne,toTwoPointBounds:Ye,ellipse:Xe}=Ue,{sin:He,cos:Ge,sqrt:Ve,atan2:je}=Math,{ellipse:qe}=Ue,Qe={ellipticalArc(t,s,i,r,o,n,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=n*b,f=He(p),g=Ge(p),y=-g*u-f*_,m=-g*_+f*u,x=r*r,w=o*o,v=m*m,k=y*y,S=x*w-x*v-w*k;let R=0;if(S<0){const t=Ve(1-S/(x*w));r*=t,o*=t}else R=(a===h?-1:1)*Ve(S/(x*v+w*k));const C=R*r*m/o,P=-R*o*y/r,T=je((m-P)/o,(y-C)/r),L=je((-m-P)/o,(-y-C)/r);let E=L-T;0===h&&E>0?E-=B:1===h&&E<0&&(E+=B);const I=s+u+g*C-f*P,O=i+_+f*C+g*P,A=E<0?1:0;c||e.ellipseToCurve?qe(t,I,O,r,o,n,T/b,L/b,A):r!==o||n?t.push(pe.G,I,O,r,o,n,T/b,L/b,A):t.push(pe.O,I,O,r,T/b,L/b,A)}},{M:Je,m:$e,L:Ze,l:Ke,H:ts,h:es,V:ss,v:is,C:rs,c:os,S:ns,s:as,Q:hs,q:ls,T:ds,t:cs,A:us,a:_s,Z:ps,z:fs,N:gs,D:ys,X:ms,G:xs,F:ws,O:vs,P:bs,U:Bs}=pe,{rect:ks,roundRect:Ss,arcTo:Rs,arc:Cs,ellipse:Ps,quadraticCurveTo:Ts}=Ue,{ellipticalArc:Ls}=Qe,Es=Mt.get("PathConvert"),Is={},Os={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=we[i],a+=i===r?" ":xe[i];for(let i=1;i<s;i++)a+=w.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?ye:ge;for(let e=0,h=t.length;e<h;e++)i=t[e],Ot[i]?("."===i&&(As.dot&&(Ms(n,o),o=""),As.dot++),"0"===o&&"."!==i&&(Ms(n,o),o=""),o+=i):pe[i]?(o&&(Ms(n,o),o=""),As.name=pe[i],As.length=fe[i],As.index=0,Ms(n,As.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Ms(n,o),o=i):o&&(Ms(n,o),o=""),r=i;return o&&Ms(n,o),s?Os.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case $e:t[c+1]+=a,t[c+2]+=h;case Je:a=t[c+1],h=t[c+2],_.push(Je,a,h),c+=3;break;case es:t[c+1]+=a;case ts:a=t[c+1],_.push(Ze,a,h),c+=2;break;case is:t[c+1]+=h;case ss:h=t[c+1],_.push(Ze,a,h),c+=2;break;case Ke:t[c+1]+=a,t[c+2]+=h;case Ze:a=t[c+1],h=t[c+2],_.push(Ze,a,h),c+=3;break;case as:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ns;case ns:n=o===rs||o===ns,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(rs,l,d,s,i,a,h),c+=5;break;case os:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=rs;case rs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(rs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case cs:t[c+1]+=a,t[c+2]+=h,r=ds;case ds:n=o===hs||o===ds,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ts(_,a,h,s,i,t[c+1],t[c+2]):_.push(hs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ls:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=hs;case hs:s=t[c+1],i=t[c+2],e?Ts(_,a,h,s,i,t[c+3],t[c+4]):_.push(hs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case _s:t[c+6]+=a,t[c+7]+=h;case us:Ls(_,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 fs:case ps:_.push(ps),c++;break;case gs:a=t[c+1],h=t[c+2],e?ks(_,a,h,t[c+3],t[c+4]):Ws(_,t,c,5),c+=5;break;case ys:a=t[c+1],h=t[c+2],e?Ss(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ws(_,t,c,9),c+=9;break;case ms:a=t[c+1],h=t[c+2],e?Ss(_,a,h,t[c+3],t[c+4],t[c+5]):Ws(_,t,c,6),c+=6;break;case xs:Ps(e?_:Ws(_,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,Is),a=Is.x,h=Is.y,c+=9;break;case ws:e?Ps(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ws(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case vs:Cs(e?_:Ws(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Is),a=Is.x,h=Is.y,c+=7;break;case bs:e?Cs(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ws(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Bs:Rs(e?_:Ws(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Is),a=Is.x,h=Is.y,c+=6;break;default:return Es.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Je,t.x,t.y);break;case"L":e.push(Ze,t.x,t.y);break;case"C":e.push(rs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(hs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ps)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){As.index===As.length&&(As.index=1,t.push(As.name)),t.push(Number(e)),As.index++,As.dot=0}},{current:As,pushData:Ms,copyData:Ws}=Os,{M:Ds,L:Fs,C:zs,Q:Us,Z:Ns,N:Ys,D:Xs,X:Hs,G:Gs,F:Vs,O:js,P:qs,U:Qs}=pe,{getMinDistanceFrom:Js,getRadianFrom:$s}=V,{tan:Zs,min:Ks,abs:ti}=Math,ei={},si={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ds,e,s)},lineTo(t,e,s){t.push(Fs,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(zs,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Us,e,s,i,r)},closePath(t){t.push(Ns)},rect(t,e,s,i,r){t.push(Ys,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(Hs,e,s,i,r,o);else{const n=w.fourNumber(o);n?t.push(Xs,e,s,i,r,...n):t.push(Ys,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){n(o)?t.push(Vs,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(Gs,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push(qs,e,s,i):(n(o)&&(o=360),t.push(js,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h){if(!o(a)){const t=Js(a,h,e,s,i,r);n=Ks(n,Ks(t/2,t/2*ti(Zs($s(a,h,e,s,i,r)/2))))}t.push(Qs,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){Ue.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,ei),t.push(Ds,ei.x,ei.y),ii(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){Ue.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,ei),t.push(Ds,ei.x,ei.y),ri(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){Ue.points(t,e,s,i)}},{ellipse:ii,arc:ri}=si,{moveTo:oi,lineTo:ni,quadraticCurveTo:ai,bezierCurveTo:hi,closePath:li,beginPath:di,rect:ci,roundRect:ui,ellipse:_i,arc:pi,arcTo:fi,drawEllipse:gi,drawArc:yi,drawPoints:mi}=si;class xi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?ue.parse(t):t:[],this}beginPath(){return di(this.__path),this.paint(),this}moveTo(t,e){return oi(this.__path,t,e),this.paint(),this}lineTo(t,e){return ni(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return hi(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return ai(this.__path,t,e,s,i),this.paint(),this}closePath(){return li(this.__path),this.paint(),this}rect(t,e,s,i){return ci(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return ui(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return _i(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return pi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return fi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return gi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return yi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return mi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:wi,L:vi,C:bi,Q:Bi,Z:ki,N:Si,D:Ri,X:Ci,G:Pi,F:Ti,O:Li,P:Ei,U:Ii}=pe,Oi=Mt.get("PathDrawer"),Ai={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case wi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case vi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case bi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Bi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ki:t.closePath(),i+=1;break;case Si:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ri:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Ci:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Pi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*b,e[i+6]*b,e[i+7]*b,e[i+8]),i+=9;break;case Ti:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,B,!1),i+=5;break;case Li:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*b,e[i+5]*b,e[i+6]),i+=7;break;case Ei:t.arc(e[i+1],e[i+2],e[i+3],0,B,!1),i+=4;break;case Ii:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Oi.error(`command: ${s} [index:${i}]`,e)}}},{M:Mi,L:Wi,C:Di,Q:Fi,Z:zi,N:Ui,D:Ni,X:Yi,G:Xi,F:Hi,O:Gi,P:Vi,U:ji}=pe,{toTwoPointBounds:qi,toTwoPointBoundsByQuadraticCurve:Qi,arcTo:Ji,arc:$i,ellipse:Zi}=Ue,{addPointBounds:Ki,copy:tr,addPoint:er,setPoint:sr,addBounds:ir,toBounds:rr}=et,or=Mt.get("PathBounds");let nr,ar,hr;const lr={},dr={},cr={},ur={toBounds(t,e){ur.toTwoPointBounds(t,dr),rr(dr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return sr(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===zi||n===Di||n===Fi?sr(e,h,l):sr(e,t[a+1],t[a+2])),n){case Mi:case Wi:h=t[a+1],l=t[a+2],er(e,h,l),a+=3;break;case Di:r=t[a+5],o=t[a+6],qi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,lr),Ki(e,lr),h=r,l=o,a+=7;break;case Fi:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],Qi(h,l,s,i,r,o,lr),Ki(e,lr),h=r,l=o,a+=5;break;case zi:a+=1;break;case Ui:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ni:case Yi:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=n===Ni?9:6;break;case Xi:Zi(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],lr,cr),0===a?tr(e,lr):Ki(e,lr),h=cr.x,l=cr.y,a+=9;break;case Hi:h=t[a+1],l=t[a+2],ar=t[a+3],hr=t[a+4],ir(e,h-ar,l-hr,2*ar,2*hr),h+=ar,a+=5;break;case Gi:$i(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],lr,cr),0===a?tr(e,lr):Ki(e,lr),h=cr.x,l=cr.y,a+=7;break;case Vi:h=t[a+1],l=t[a+2],nr=t[a+3],ir(e,h-nr,l-nr,2*nr,2*nr),h+=nr,a+=4;break;case ji:Ji(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],lr,cr),0===a?tr(e,lr):Ki(e,lr),h=cr.x,l=cr.y,a+=6;break;default:return void or.error(`command: ${n} [index:${a}]`,t)}}},{M:_r,L:pr,Z:fr}=pe,{getCenterX:gr,getCenterY:yr}=V,{arcTo:mr}=si,xr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const f=t.length,g=[];for(;n<f;){switch(i=t[n],i){case _r:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===pr?(c=t[n+1],u=t[n+2],g.push(_r,gr(l,c),yr(d,u))):g.push(_r,l,d);break;case pr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case pr:mr(g,a,h,t[n+1],t[n+2],e,_,p);break;case fr:mr(g,a,h,l,d,e,_,p);break;default:g.push(pr,a,h)}_=a,p=h;break;case fr:r!==fr&&(mr(g,l,d,c,u,e,_,p),g.push(fr)),n+=1;break;default:o=we[i];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}r=i}return i!==fr&&(g[1]=l,g[2]=d),g}};ue.creator=new xi,ue.parse=Os.parse,ue.convertToCanvasData=Os.toCanvasData;const wr=new xi,{drawRoundRect:vr}=ve;function br(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){vr(this,t,e,s,i,r)})}(t)}const Br={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=kr.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{}}}},kr=Br;kr.alphaPixelTypes.forEach(t=>kr.upperCaseTypeMap[t]=t.toUpperCase());const Sr=Mt.get("TaskProcessor");class Rr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Zt(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Sr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Cr{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,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e){let s,i,r,n;const a=new Rr(t);return a.parent=this,l(e)?n=e:e&&(i=e.parallel,s=e.start,r=e.time,n=e.delay),r&&(a.time=r),!1===i&&(a.parallel=!1),o(n)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},n)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 Pr=Mt.get("Resource"),Tr={tasker:new Cr,map:{},get isComplete(){return Lr.tasker.isComplete},set(t,e){Lr.map[t]&&Pr.repeat(t),Lr.map[t]=e},get:t=>Lr.map[t],remove(t){const e=Lr.map[t];e&&(e.destroy&&e.destroy(),delete Lr.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return a(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=Xt.image(i)),Lr.set(t,e),e},destroy(){Lr.map={}}},Lr=Tr,Er={maxRecycled:10,recycledList:[],patternTasker:new Cr,get(t){let e=Tr.get(t.url);return e||Tr.set(t.url,e=Xt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Ir.recycledList.push(t)})},clearRecycled(){const t=Ir.recycledList;t.length>Ir.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Tr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Br.alphaPixelTypes.some(e=>Ir.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Br.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Br.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Ir.recycledList=[]}},Ir=Er,{IMAGE:Or,create:Ar}=s,{floor:Mr,max:Wr}=Math;class Dr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Ar(Or),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Er.isFormat("svg",t)&&(this.isSVG=!0),Er.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,s){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:s}=e.origin,i=this.config.showProgress&&s&&this.onProgress.bind(this);i&&(t=s),Tr.tasker.add(()=>Zt(this,void 0,void 0,function*(){return yield t(this.url,i).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,s,i,r,o,n){if(t||(t=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const a=e.origin.createCanvas(Wr(Mr(t+(o||0)),1),Wr(Mr(s+(n||0)),1)),h=a.getContext("2d");return i&&(h.globalAlpha=i),h.drawImage(this.view,0,0,t,s),this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,s,i,r){const o=e.canvas.createPattern(t,s);try{i&&o.setTransform&&(o.setTransform(i),i=void 0)}catch(t){}return r&&p.stintSet(r,"transform",i),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Fr(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function zr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Ur(t,e){const s="_"+t;return{get(){const t=this[s];return o(t)?e:t},set(t){this[s]=t}}}function Nr(t,e){return(s,i)=>Xr(s,i,t,e&&e(i))}function Yr(t){return t}function Xr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Fr(t,e,Object.assign(r,i||{})),yo(t,e,s)}function Hr(t){return Nr(t)}function Gr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Vr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function jr(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Zr(this))}}))}function qr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Qr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Jr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&Zr(this)}}))}function $r(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(Zr(this),this.__.__removeNaturalSize())}}))}function Zr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Kr(t){return Nr(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Zr(this)}}))}const to=Jr;function eo(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s)&&(so(this),e&&(this.__.__useStroke=!0))}}))}function so(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Zr(t)}const io=eo;function ro(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function oo(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function no(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&ho(this)}}))}function ao(t){return Nr(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>lo(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");lo(this,t,e,s),this.mask&&ho(this)}}))}function ho(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function lo(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||Zr(t))}function co(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function uo(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function _o(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function po(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Mt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function fo(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function go(t){return(e,s)=>{Fr(e,"__DataProcessor",{get:()=>t})}}function yo(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Ur(e,s);if(o(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){let t=this[r];return void 0===t?s(this.__leaf):t};else if(u(s)){const t=_(s);a.get=function(){let e=this[r];return void 0===e?this[r]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(void 0===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[r];if(void 0===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,d=i;for(;!l&&d;)l=zr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[n]&&(a.set=i[n],delete i[n]),Fr(i,e,a)}const mo=new Mt("rewrite"),xo=[],wo=["destroy","constructor"];function vo(t){return(e,s)=>{xo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function bo(){return t=>{Bo()}}function Bo(t){xo.length&&(xo.forEach(e=>{t&&mo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),xo.length=0)}function ko(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(wo.includes(i)||e&&e.includes(i)))if(t.prototype){zr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function So(){return t=>{Gt.register(t)}}setTimeout(()=>Bo(!0));const{copy:Ro,toInnerPoint:Co,toOuterPoint:Po,scaleOfOuter:To,rotateOfOuter:Lo,skewOfOuter:Eo,multiplyParent:Io,divideParent:Oo,getLayout:Ao}=M,Mo={},{round:Wo}=Math,Do={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Uo(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)zo(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.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,s=e.length;t<s;t++)No(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&No(t),t.__updateChange()},updateAllChange(t){if(Xo(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Yo(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,s,i,r,o,n){r||(r=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?s.copyWorldByReset(i,r,t.__nowWorld,o,n):s.copyWorldToInner(i,r,t.__layout.renderBounds,o)},moveWorld(t,e,s=0,i,r){const o=u(e)?Object.assign({},e):{x:e,y:s};i?Po(t.localTransform,o,o,!0):t.parent&&Co(t.parent.scrollWorldTransform,o,o,!0),Fo.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){u(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Wo(e),s=Wo(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){Fo.zoomOfLocal(t,Ho(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(l(i)||(i&&(o=i),i=s),Ro(Mo,n),To(Mo,e,s,i),Fo.hasHighPosition(t))Fo.setTransform(t,Mo,r,o);else{const e=t.x+Mo.e-n.e,a=t.y+Mo.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){Fo.rotateOfLocal(t,Ho(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Ro(Mo,r),Lo(Mo,e,s),Fo.hasHighPosition(t)?Fo.setTransform(t,Mo,!1,i):t.set({x:t.x+Mo.e-r.e,y:t.y+Mo.f-r.f,rotation:w.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){Fo.skewOfLocal(t,Ho(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Ro(Mo,t.__localMatrix),Eo(Mo,e,s,i),Fo.setTransform(t,Mo,r,o)},transformWorld(t,e,s,i){Ro(Mo,t.worldTransform),Io(Mo,e),t.parent&&Oo(Mo,t.parent.scrollWorldTransform),Fo.setTransform(t,Mo,s,i)},transform(t,e,s,i){Ro(Mo,t.localTransform),Io(Mo,e),Fo.setTransform(t,Mo,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&Fo.getInnerOrigin(t,r.origin),n=Ao(e,o,r.around&&Fo.getInnerOrigin(t,r.around));if(Fo.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=Fo.getInnerOrigin(t,r.origin);V.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return To(s,Fo.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>V.tempToOuterOf(Fo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return nt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Ro(Mo,t.worldTransform),Oo(Mo,e.scrollWorldTransform),s?Mo:Object.assign({},Mo)),drop(t,e,s,i){t.setTransform(Fo.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||Fo.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,s,i=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)t.move(s);else{const r=s.x*i,o=s.y*i;s.x-=r,s.y-=o,t.move(r,o),e.requestRender(()=>Fo.animateMove(t,s,i))}}},Fo=Do,{updateAllMatrix:zo,updateMatrix:Uo,updateAllWorldOpacity:No,updateAllChange:Yo,updateChange:Xo}=Fo;function Ho(t,e){return t.parent?V.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Go={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)=>jo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>jo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>jo(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 Vo;function jo(t,e){return e||(Vo=0),t.__.mask&&(Vo=1),Vo<0?null:(Vo&&(Vo=-1),!0)}const{updateBounds:qo}=Do,Qo={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:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),Jo(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&o(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 s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)$o(e[t],e)},updateBounds(t,e){const s=[t];$o(t,s),Zo(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)qo(i[t]);e&&e===s||qo(s)}}},{pushAllChildBranch:Jo,pushAllBranchStack:$o,updateBoundsByBranchStack:Zo}=Qo,Ko={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:tn,updateBounds:en}=Do,{toOuterOf:sn,getPoints:rn,copy:on}=Rt,nn="_localContentBounds",an="_worldContentBounds",hn="_worldBoxBounds",ln="_worldStrokeBounds";class dn{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 sn(this.contentBounds,this.leaf.__localMatrix,this[nn]||(this[nn]={})),this[nn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return sn(this.contentBounds,this.leaf.__world,this[an]||(this[an]={})),this[an]}get worldBoxBounds(){return sn(this.boxBounds,this.leaf.__world,this[hn]||(this[hn]={})),this[hn]}get worldStrokeBounds(){return sn(this.strokeBounds,this.leaf.__world,this[ln]||(this[ln]={})),this[ln]}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:s}=t;if(t.isApp)return en(t);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=t;for(;s.parent&&!s.parent.leafer;)s=s.parent;const i=s;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.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 M.defaultMatrix;case"page":t=e.zoomLayer;default:return tn(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=M.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=tn(i,e,!0)}if(n||(n=M.getLayout(o)),on(n,a),V.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=rn(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:r=e}return o(r)||i.forEach(t=>s.innerToWorld(t,null,!1,r)),i}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged||this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class cn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class un extends cn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}un.ADD="child.add",un.REMOVE="child.remove",un.CREATED="created",un.MOUNTED="mounted",un.UNMOUNTED="unmounted",un.DESTROY="destroy";const _n="property.scroll";class pn extends cn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}pn.CHANGE="property.change",pn.LEAFER_CHANGE="property.leafer_change",pn.SCROLL=_n;const fn={scrollX:_n,scrollY:_n};class gn extends cn{constructor(t,e){super(t),Object.assign(this,e)}}gn.LOAD="image.load",gn.LOADED="image.loaded",gn.ERROR="image.error";class yn extends cn{static checkHas(t,e,s){"on"===s?e===vn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(mn)||t.hasEvent(xn)||t.hasEvent(wn),t.__hasWorldEvent=t.hasEvent(vn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(mn,t),"inner"===e&&t.emit(xn,t)),t.emit(wn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(vn,this)}}yn.RESIZE="bounds.resize",yn.INNER="bounds.inner",yn.LOCAL="bounds.local",yn.WORLD="bounds.world";const{RESIZE:mn,INNER:xn,LOCAL:wn,WORLD:vn}=yn,bn={};[mn,xn,wn,vn].forEach(t=>bn[t]=1);class Bn extends cn{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){u(t)?(super(Bn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Bn.RESIZE="resize";class kn extends cn{constructor(t,e){super(t),this.data=e}}kn.REQUEST="watch.request",kn.DATA="watch.data";class Sn extends cn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Sn.REQUEST="layout.request",Sn.START="layout.start",Sn.BEFORE="layout.before",Sn.LAYOUT="layout",Sn.AFTER="layout.after",Sn.AGAIN="layout.again",Sn.END="layout.end";class Rn extends cn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Rn.REQUEST="render.request",Rn.CHILD_START="render.child_start",Rn.CHILD_END="render.child_end",Rn.START="render.start",Rn.BEFORE="render.before",Rn.RENDER="render",Rn.AFTER="render.after",Rn.AGAIN="render.again",Rn.END="render.end",Rn.NEXT="render.next";class Cn extends cn{}Cn.START="leafer.start",Cn.BEFORE_READY="leafer.before_ready",Cn.READY="leafer.ready",Cn.AFTER_READY="leafer.after_ready",Cn.VIEW_READY="leafer.view_ready",Cn.VIEW_COMPLETED="leafer.view_completed",Cn.STOP="leafer.stop",Cn.RESTART="leafer.restart",Cn.END="leafer.end",Cn.TRANSFORM="leafer.transform",Cn.MOVE="leafer.move",Cn.SCALE="leafer.scale",Cn.ROTATE="leafer.rotate",Cn.SKEW="leafer.skew";const{MOVE:Pn,SCALE:Tn,ROTATE:Ln,SKEW:En}=Cn,In={x:Pn,y:Pn,scaleX:Tn,scaleY:Tn,rotation:Ln,skewX:En,skewY:En},On={};class An{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(c(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)c(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,o;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Mn(this,i,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=n[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):n[t]=[l],bn[t]&&yn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=a(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Mn(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],bn[t]&&yn.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):c(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:i}}off_(t){if(!t)return;const e=c(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):c(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return c(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));u(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const i=Mn(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}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:i}=this,r=s&&s[t],n=i&&i[t];return!!(o(e)?r||n:e?n:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Mn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:On)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:On)}}const{on:Wn,on_:Dn,off:Fn,off_:zn,once:Un,emit:Nn,emitEvent:Yn,hasEvent:Xn,destroy:Hn}=An.prototype,Gn={on:Wn,on_:Dn,off:Fn,off_:zn,once:Un,emit:Nn,emitEvent:Yn,hasEvent:Xn,destroyEventer:Hn},Vn=Mt.get("setAttr"),jn={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||o(e)||(Vn.warn(this.innerName,t,e),e=void 0),u(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new pn(pn.LEAFER_CHANGE,this,t,i,e));const s=In[t];s&&(this.emitEvent(new Cn(s,this)),this.emitEvent(new Cn(Cn.TRANSFORM,this)))}this.emitPropertyEvent(pn.CHANGE,t,i,e);const s=fn[t];return s&&this.emitPropertyEvent(s,t,i,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new pn(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||o(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:qn,multiplyParent:Qn,translateInner:Jn,defaultWorld:$n}=M,{toPoint:Zn,tempPoint:Kn}=nt,ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;Qn(this.__local||e,t?t.__scrollWorld||t.__world:$n,s,!!e.affectScaleOrRotation,r),i&&Jn(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(qn(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(Zn(s.around||s.origin,t.boxBounds,Kn),Jn(e,-Kn.x,-Kn.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ea,updateAllMatrix:sa}=Do,{updateBounds:ia}=Qo,{toOuterOf:ra,copyAndSpread:oa,copy:na}=Rt,{toBounds:aa}=ur,ha={__updateWorldBounds(){const t=this.__layout;ra(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&yn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&yn.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(),ra(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ra(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ra(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__pathInputed?aa(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),sa(this),ia(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(sa(this),ia(this,this))):ea(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;oa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?oa(e.renderBounds,e.boxBounds,e.renderSpread):na(e.renderBounds,e.strokeBounds)}},la={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),Do.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Mt.showBounds&&Mt.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:da}=Go,ca={__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 s=this.__;if(s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)da(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)da(s[i],e)||s[i].__clip(t,e)}}},ua={},{LEAF:_a,create:pa}=s,{toInnerPoint:fa,toOuterPoint:ga,multiplyParent:ya}=M,{toOuterOf:ma}=Rt,{copy:xa,move:wa}=V,{moveLocal:va,zoomOfLocal:ba,rotateOfLocal:Ba,skewOfLocal:ka,moveWorld:Sa,zoomOfWorld:Ra,rotateOfWorld:Ca,skewOfWorld:Pa,transform:Ta,transformWorld:La,setTransform:Ea,getFlipTransform:Ia,getLocalOrigin:Oa,getRelativeWorld:Aa,drop:Ma}=Do;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return dn}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=pa(_a),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(un.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(un.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(un.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}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(un.MOUNTED)):this.__emitLifeEvent(un.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.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,s=this.__world;return ya(s,t.matrix,e,void 0,s),ma(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:i}=Er.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),ua.scaleX=s,ua.scaleY=i,ua}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?Aa(this,e):this.worldTransform,r=s?t:{};return ma(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&xa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&xa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),fa(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){ga(this.worldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return wa(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return wa(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){Ea(this,t,e,s)}transform(t,e,s){Ta(this,t,e,s)}move(t,e,s){va(this,t,e,s)}moveInner(t,e,s){Sa(this,t,e,!0,s)}scaleOf(t,e,s,i,r){ba(this,Oa(this,t),e,s,i,r)}rotateOf(t,e,s){Ba(this,Oa(this,t),e,s)}skewOf(t,e,s,i,r){ka(this,Oa(this,t),e,s,i,r)}transformWorld(t,e,s){La(this,t,e,s)}moveWorld(t,e,s){Sa(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Ra(this,t,e,s,i,r)}rotateOfWorld(t,e){Ca(this,t,e)}skewOfWorld(t,e,s,i,r){Pa(this,t,e,s,i,r)}flip(t,e){Ta(this,Ia(this,t),!1,e)}scaleResize(t,e=t,s){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,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Yt.need("path")}getMotionPoint(t){return Yt.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,s){Ma(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):yo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=Jr),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new un(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(un.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=$t([ko(jn),ko(ta),ko(ha),ko(Gn),ko(la)],t.Leaf);const{setListWithFn:Wa}=Rt,{sort:Da}=Qo,{localBoxBounds:Fa,localStrokeBounds:za,localRenderBounds:Ua,maskLocalBoxBounds:Na,maskLocalStrokeBounds:Ya,maskLocalRenderBounds:Xa}=Go,Ha=new Mt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){Wa(e||this.__layout.boxBounds,this.children,this.__hasMask?Na:Fa)}__updateStrokeBounds(t){Wa(t||this.__layout.strokeBounds,this.children,this.__hasMask?Ya:za)}__updateRenderBounds(t){Wa(t||this.__layout.renderBounds,this.children,this.__hasMask?Xa:Ua)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Da),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ha.warn("add self or destroyed");const s=o(e);if(!t.__){if(c(t))return t.forEach(t=>{this.add(t,e),s||e++});t=Gt.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 i=t.__layout;i.boxChanged||i.boxChange(),i.matrixChanged||i.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(un.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(un.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,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(un.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(un.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new un(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=$t([ko(ca)],t.Branch);class Ga{get length(){return this.list.length}constructor(t){this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:s}=this;o(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(o(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;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 i=0,r=e.length;i<r;i++)o(s)?e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]):this.keys[e[i].innerId]=i-1;o(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 Ga;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class Va{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const ja=Mt.get("LeaferCanvas");class qa extends ce{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,s=t.view||t.canvas;s?this.__createViewFrom(s):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.syncDomFont&&!this.parentView&&(i.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=a(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else ja.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;i.width=t+"px",i.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,s){if(this.resizeListener=s,t){this.autoBounds=t;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),ja.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else window.addEventListener("resize",this.windowListener=()=>{const t=e.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const s=this.view,{x:i,y:r,width:o,height:n}=this.autoBounds.getBoundsFrom(t),a={width:o,height:n,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=s;t.marginLeft=i+"px",t.marginTop=r+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};p.copyAttrs(e,this,de),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new Bn(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}br(CanvasRenderingContext2D.prototype),br(Path2D.prototype);const{mineType:Qa,fileType:Ja}=Br;function $a(t,s){e.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=Qa(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,Qa(e),s)),canvasSaveAs:(t,s,i)=>{const r=t.toDataURL(Qa(Ja(s)),i);return e.origin.download(r,s)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((s,i)=>{const r=new e.origin.Image,{crossOrigin:o}=e.image;o&&(r.setAttribute("crossOrigin",o),r.crossOrigin=o),r.onload=()=>{s(r)},r.onerror=t=>{i(t)},r.src=e.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.canvas=Xt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Xt,{canvas:(t,e)=>new qa(t,e),image:t=>new Dr(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},Fr(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Za}=navigator;Za.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0,e.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),Za.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Za.indexOf("Mac")>-1?e.os="Mac":Za.indexOf("Linux")>-1&&(e.os="Linux");class Ka{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ga;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 Ga,this.target=t,e&&(this.config=p.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(Rn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===un.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,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new kn(kn.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ga,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[pn.CHANGE,this.__onAttrChange,this],[[un.ADD,un.REMOVE],this.__onChildEvent,this],[kn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:th,updateBounds:eh,updateChange:sh}=Do,{pushAllChildBranch:ih,pushAllParent:rh}=Qo;const{worldBounds:oh}=Go;class nh{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,c(t)&&(t=new Ga(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:ah,updateAllChange:hh}=Do,lh=Mt.get("Layouter");class dh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Va,this.target=t,e&&(this.config=p.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(Sn.START),this.layoutOnce(),t.emitEvent(new Sn(Sn.END,this.layoutedBlocks,this.times))}catch(t){lh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?lh.warn("layouting"):this.times>3?lh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(kn.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=zt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Sn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Sn(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(th(t,!0),e.add(t),t.isBranch&&ih(t,e),rh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),rh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||eh(i[t])}eh(s)}})}(this.__levelList),function(t){t.list.forEach(sh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Sn(o,a,this.times)),s.emitEvent(new Sn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,zt.end(e)}fullLayout(){const t=zt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Sn,o=this.getBlocks(new Ga(e));e.emitEvent(new Sn(s,o,this.times)),dh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Sn(i,o,this.times)),e.emitEvent(new Sn(r,o,this.times)),this.addBlocks(o),zt.end(t)}static fullLayout(t){ah(t,!0),t.isBranch?Qo.updateBounds(t):Do.updateBounds(t),hh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new nh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new nh(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_([[Sn.REQUEST,this.layout,this],[Sn.AGAIN,this.layoutAgain,this],[kn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ch=Mt.get("Renderer");class uh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=e,s&&(this.config=p.default(s,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(Sn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Rn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Rn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Rn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,ch.log(e.innerName,"---\x3e");try{this.emitRender(Rn.START),this.renderOnce(t),this.emitRender(Rn.END,this.totalBounds),Er.clearRecycled()}catch(t){this.rendering=!1,ch.error(t)}ch.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ch.warn("rendering");if(this.times>3)return ch.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Rn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Rn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Rn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Rn.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=zt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Lt(i);s.save(),i.spread(uh.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),zt.end(e)}fullRender(){const t=zt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),zt.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Mt.showRepaint&&Mt.drawRepaint(s,t),this.target.__render(s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const s=this.requestTime=Date.now();e.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-s))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Lt(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||ch.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Rn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Rn.REQUEST,this.update,this],[Sn.END,this.__onLayoutEnd,this],[Rn.AGAIN,this.renderAgain,this],[Bn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function _h(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ph(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function fh(){return(t,e)=>{const s="_"+e;Fr(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}uh.clipSpread=10,Object.assign(Xt,{watcher:(t,e)=>new Ka(t,e),layouter:(t,e)=>new dh(t,e),renderer:(t,e,s)=>new uh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),e.layout=dh.fullLayout;const gh={},yh={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}},mh={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},xh={},wh={},vh={},bh={},Bh={},kh={apply(){Yt.need("filter")}},Sh={},Rh={setStyleName:()=>Yt.need("state"),set:()=>Yt.need("state")},Ch={list:{},register(t,e){Ch.list[t]=e},get:t=>Ch.list[t]},{parse:Ph,objectToCanvasData:Th}=Os,{stintSet:Lh}=p,{hasTransparent:Eh}=yh,Ih={},Oh=Mt.get("UIData");class Ah extends g{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,Oh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Oh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Lh(this,"__isTransparentFill",Eh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):u(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Lh(this,"__isTransparentStroke",Eh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):u(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&u(t[0])?(this.__setInput("path",t),this._path=e?Ph(t):Th(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Mh(this,"shadow",t)}setInnerShadow(t){Mh(this,"innerShadow",t)}setFilter(t){Mh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&wh.compute("fill",this.__leaf),e&&wh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(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 s=this.__leaf.__layout;s.boxChanged||s.boxChange(),c(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Ih)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ih))}__removePaint(t,e){e&&this.__removeInput(t),vh.recycleImage(t,this),"fill"===t?(Lh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Lh(this,"__isAlphaPixelStroke",void 0),Lh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Mh(t,e,s){t.__setInput(e,s),c(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class Wh extends Ah{}class Dh extends Wh{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 Fh extends Wh{__getInputData(t,e){const s=super.__getInputData(t,e);return de.forEach(t=>delete s[t]),s}}class zh extends Dh{}class Uh extends Ah{}class Nh extends Ah{get __boxStroke(){return!this.__pathInputed}}class Yh extends Ah{get __boxStroke(){return!this.__pathInputed}}class Xh extends Ah{}class Hh extends Ah{}class Gh extends Ah{get __pathInputed(){return 2}}class Vh extends Wh{}const jh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class qh extends Ah{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=jh[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=Gt.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange(),o.renderChanged&&r.renderChange(),s.__updateChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class Qh extends Nh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class Jh extends Nh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const $h={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),i&&(t=Math.max(t,i)),o&&(t+=kh.getSpread(o)),n&&(t+=n);let a=t=Math.ceil(t);return s&&s.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},Zh={getValidMove(t,e,s,i,r){const o=t.x+i.x,n=t.y+i.y,a=o+t.width,h=n+t.height,l=e.x+e.width,d=e.y+e.height;r||(i=Object.assign({},i));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==s?o>e.x?i.x+=e.x-o:a<l&&(i.x+=l-a):o<e.x?i.x+=e.x-o:a>l&&(i.x+=l-a),u&&"outer"!==s?n>e.y?i.y+=e.y-n:h<d&&(i.y+=d-h):n<e.y?i.y+=e.y-n:h>d&&(i.y+=d-h),i.x=w.float(i.x),i.y=w.float(i.y),i},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},limitMove(t,e){const{dragBounds:s,dragBoundsType:i}=t;s&&Kh.getValidMove(t.__localBoxBounds,"parent"===s?t.parent.boxBounds:s,i,e,!0),Kh.axisMove(t,e)}},Kh=Zh,{stintSet:tl}=p,el={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);tl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),tl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;tl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&s&&!t.__isTransparentFill&&!(c(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),tl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){sl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=wh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Bh.shadow(this,t,h),a&&(i.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),r&&(i.__isFills?wh.fills(r,this,t):wh.fill(r,this,t)),n&&this.__drawAfterFill(t,e),d&&Bh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),c&&kh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,yh.string(e.color))}r&&(i.__isFills?wh.fills(r,this,t):wh.fill(r,this,t)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t))}}else i.__pathInputed?sl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?wh.fills(i,this,t):wh.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?wh.strokes(r,this,t):wh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function sl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&wh.stroke(r,t,e),i&&wh.fill(i,t,e),o&&t.__drawAfterFill(e,s),r&&!n&&wh.stroke(r,t,e)}const il={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var rl,ol;t.UI=rl=class extends t.Leaf{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 wr.set(this.path=t||[]),t||this.__drawPathByBox(wr),wr}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Yt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Yt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(wr.set(s=[]),this.__drawPathByBox(wr)),t?Os.toCanvasData(s,!0):s}getPathString(t,e,s){return Os.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Sh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?xr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&xh.addArrows(this,!t.cornerRadius)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Ai.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,l(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e){wh.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return Yt.need("animate")}killAnimate(t,e){}export(t,e){return Yt.need("export")}syncExport(t,e){return Yt.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),rl.one(e)}static one(t,e,s,i,r){return Gt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){So()(this)}static registerData(t){go(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},$t([go(Ah)],t.UI.prototype,"__",void 0),$t([fh()],t.UI.prototype,"zoomLayer",void 0),$t([Hr("")],t.UI.prototype,"id",void 0),$t([Hr("")],t.UI.prototype,"name",void 0),$t([Hr("")],t.UI.prototype,"className",void 0),$t([oo("pass-through")],t.UI.prototype,"blendMode",void 0),$t([no(1)],t.UI.prototype,"opacity",void 0),$t([ao(!0)],t.UI.prototype,"visible",void 0),$t([oo(!1)],t.UI.prototype,"locked",void 0),$t([oo(!1)],t.UI.prototype,"dim",void 0),$t([oo(!1)],t.UI.prototype,"dimskip",void 0),$t([co(0)],t.UI.prototype,"zIndex",void 0),$t([uo(!1)],t.UI.prototype,"mask",void 0),$t([_o(!1)],t.UI.prototype,"eraser",void 0),$t([Gr(0,!0)],t.UI.prototype,"x",void 0),$t([Gr(0,!0)],t.UI.prototype,"y",void 0),$t([Jr(100,!0)],t.UI.prototype,"width",void 0),$t([Jr(100,!0)],t.UI.prototype,"height",void 0),$t([qr(1,!0)],t.UI.prototype,"scaleX",void 0),$t([qr(1,!0)],t.UI.prototype,"scaleY",void 0),$t([Qr(0,!0)],t.UI.prototype,"rotation",void 0),$t([Qr(0,!0)],t.UI.prototype,"skewX",void 0),$t([Qr(0,!0)],t.UI.prototype,"skewY",void 0),$t([Gr(0,!0)],t.UI.prototype,"offsetX",void 0),$t([Gr(0,!0)],t.UI.prototype,"offsetY",void 0),$t([Vr(0,!0)],t.UI.prototype,"scrollX",void 0),$t([Vr(0,!0)],t.UI.prototype,"scrollY",void 0),$t([jr()],t.UI.prototype,"origin",void 0),$t([jr()],t.UI.prototype,"around",void 0),$t([Hr(!1)],t.UI.prototype,"lazy",void 0),$t([$r(1)],t.UI.prototype,"pixelRatio",void 0),$t([ro(0)],t.UI.prototype,"renderSpread",void 0),$t([Kr()],t.UI.prototype,"path",void 0),$t([to()],t.UI.prototype,"windingRule",void 0),$t([to(!0)],t.UI.prototype,"closed",void 0),$t([Jr(0)],t.UI.prototype,"padding",void 0),$t([Jr(!1)],t.UI.prototype,"lockRatio",void 0),$t([Jr()],t.UI.prototype,"widthRange",void 0),$t([Jr()],t.UI.prototype,"heightRange",void 0),$t([Hr(!1)],t.UI.prototype,"draggable",void 0),$t([Hr()],t.UI.prototype,"dragBounds",void 0),$t([Hr("auto")],t.UI.prototype,"dragBoundsType",void 0),$t([Hr(!1)],t.UI.prototype,"editable",void 0),$t([po(!0)],t.UI.prototype,"hittable",void 0),$t([po("path")],t.UI.prototype,"hitFill",void 0),$t([io("path")],t.UI.prototype,"hitStroke",void 0),$t([po(!1)],t.UI.prototype,"hitBox",void 0),$t([po(!0)],t.UI.prototype,"hitChildren",void 0),$t([po(!0)],t.UI.prototype,"hitSelf",void 0),$t([po()],t.UI.prototype,"hitRadius",void 0),$t([fo("")],t.UI.prototype,"cursor",void 0),$t([oo()],t.UI.prototype,"fill",void 0),$t([io(void 0,!0)],t.UI.prototype,"stroke",void 0),$t([io("inside")],t.UI.prototype,"strokeAlign",void 0),$t([io(1,!0)],t.UI.prototype,"strokeWidth",void 0),$t([io(!1)],t.UI.prototype,"strokeWidthFixed",void 0),$t([io("none")],t.UI.prototype,"strokeCap",void 0),$t([io("miter")],t.UI.prototype,"strokeJoin",void 0),$t([io()],t.UI.prototype,"dashPattern",void 0),$t([io(0)],t.UI.prototype,"dashOffset",void 0),$t([io(10)],t.UI.prototype,"miterLimit",void 0),$t([to(0)],t.UI.prototype,"cornerRadius",void 0),$t([to()],t.UI.prototype,"cornerSmoothing",void 0),$t([_h()],t.UI.prototype,"shadow",void 0),$t([_h()],t.UI.prototype,"innerShadow",void 0),$t([_h()],t.UI.prototype,"blur",void 0),$t([_h()],t.UI.prototype,"backgroundBlur",void 0),$t([_h()],t.UI.prototype,"grayscale",void 0),$t([_h()],t.UI.prototype,"filter",void 0),$t([oo()],t.UI.prototype,"placeholderColor",void 0),$t([Hr(100)],t.UI.prototype,"placeholderDelay",void 0),$t([Hr({})],t.UI.prototype,"data",void 0),$t([vo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=rl=$t([ko($h),ko(el),bo()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}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(){}},$t([go(Wh)],t.Group.prototype,"__",void 0),$t([Jr(0)],t.Group.prototype,"width",void 0),$t([Jr(0)],t.Group.prototype,"height",void 0),t.Group=$t([ko(t.Branch),So()],t.Group);const nl=Mt.get("Leafer");t.Leafer=ol=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Tr.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),ol.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(i,t));const r=this.canvas=Xt.canvas(i);this.__controllers.push(this.renderer=Xt.renderer(this,r,i),this.watcher=Xt.watcher(this,i),this.layouter=Xt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i,e),this.view=r.view,e||(this.selector=Xt.selector(this),this.interaction=Xt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Xt.hitCanvasManager()),this.canvasManager=new Jt,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),Ko.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(Cn.RESTART):this.emitLeafer(Cn.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(Cn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,de);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.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 s=p.copyAttrs({},this.canvas,de);e.resize(t),this.updateLazyBounds(),this.__onResize(new Bn(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,de),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(t,e){e||(t.width&&t.height||(this.autoLayout=new It(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(de.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&de.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=p.copyAttrs({},this.canvas,de);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__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(Cn.BEFORE_READY),this.emitLeafer(Cn.READY),this.emitLeafer(Cn.AFTER_READY),Ko.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Cn.VIEW_READY),Ko.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Ko.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(Cn.VIEW_COMPLETED),Ko.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,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return Yt.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Cn(t,this))}__listenEvents(){const t=zt.start("FirstCreate "+this.innerName);this.once([[Cn.START,()=>zt.end(t)],[Sn.START,this.updateLazyBounds,this],[Rn.START,this.__onCreated,this],[Rn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[kn.DATA,this.__onWatchData,this],[Sn.END,this.__onLayoutEnd,this],[Rn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ol.list.remove(this);try{this.stop(),this.emitLeafer(Cn.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Er.clearRecycled()},100)}catch(t){nl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ga,$t([go(Fh)],t.Leafer.prototype,"__",void 0),$t([Jr()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=ol=$t([So()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},$t([go(Nh)],t.Rect.prototype,"__",void 0),t.Rect=$t([ko(il),bo(),So()],t.Rect);const{add:al,includes:hl,scroll:ll}=Rt,dl=t.Rect.prototype,cl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t;if(this.children.length){const e=this.__,s=this.__layout,{renderBounds:i,boxBounds:r}=s,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),e.overflow.includes("scroll")&&(al(o,r),ll(o,e)),this.__updateRectRenderBounds(),t=!hl(r,o),t&&"show"===e.overflow&&al(i,o)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll()}__updateRectRenderBounds(){}__updateWorldBounds(){this.hasScroller&&this.__updateScroll(),super.__updateWorldBounds()}__checkScroll(){}__updateScroll(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},$t([go(Dh)],t.Box.prototype,"__",void 0),$t([Jr(100)],t.Box.prototype,"width",void 0),$t([Jr(100)],t.Box.prototype,"height",void 0),$t([Hr(!1)],t.Box.prototype,"resizeChildren",void 0),$t([ro("show")],t.Box.prototype,"overflow",void 0),$t([vo(dl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),$t([vo(dl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),$t([vo(dl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),$t([vo(dl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),$t([vo(dl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),$t([vo(dl.__updateChange)],t.Box.prototype,"__updateRectChange",null),$t([vo(dl.__render)],t.Box.prototype,"__renderRect",null),$t([vo(cl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=$t([bo(),So()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},$t([go(zh)],t.Frame.prototype,"__",void 0),$t([oo("#FFFFFF")],t.Frame.prototype,"fill",void 0),$t([ro("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=$t([So()],t.Frame);const{moveTo:ul,closePath:_l,ellipse:pl}=si;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:s,innerRadius:i,startAngle:r,endAngle:o}=this.__,n=t/2,a=s/2,h=this.__.path=[];i?(r||o?(i<1&&pl(h,n,a,n*i,a*i,0,r,o,!1),pl(h,n,a,n,a,0,o,r,!0),i<1&&_l(h)):(i<1&&(pl(h,n,a,n*i,a*i),ul(h,t,a)),pl(h,n,a,n,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(ul(h,n,a),pl(h,n,a,n,a,0,r,o,!1),_l(h)):pl(h,n,a,n,a)}},$t([go(Yh)],t.Ellipse.prototype,"__",void 0),$t([to(0)],t.Ellipse.prototype,"innerRadius",void 0),$t([to(0)],t.Ellipse.prototype,"startAngle",void 0),$t([to(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=$t([So()],t.Ellipse);const{moveTo:fl,lineTo:gl,drawPoints:yl}=si,{rotate:ml,getAngle:xl,getDistance:wl,defaultPoint:vl}=V,{toBounds:bl}=ur;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&ml(s,e),s}set toPoint(t){this.width=wl(vl,t),this.rotation=xl(vl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?yl(e,t.points,!1,t.closed):(fl(e,0,0),gl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(yl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&xh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?bl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},$t([go(Uh)],t.Line.prototype,"__",void 0),$t([eo("center")],t.Line.prototype,"strokeAlign",void 0),$t([Jr(0)],t.Line.prototype,"height",void 0),$t([to()],t.Line.prototype,"points",void 0),$t([to(0)],t.Line.prototype,"curve",void 0),$t([to(!1)],t.Line.prototype,"closed",void 0),t.Line=$t([So()],t.Line);const{sin:Bl,cos:kl,PI:Sl}=Math,{moveTo:Rl,lineTo:Cl,closePath:Pl,drawPoints:Tl}=si,Ll=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Tl(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:i}=this.__,r=e/2,o=s/2;Rl(t,r,0);for(let e=1;e<i;e++)Cl(t,r+r*Bl(2*e*Sl/i),o-o*kl(2*e*Sl/i));Pl(t)}}__updateRenderPath(){}__updateBoxBounds(){}},$t([go(Xh)],t.Polygon.prototype,"__",void 0),$t([to(3)],t.Polygon.prototype,"sides",void 0),$t([to()],t.Polygon.prototype,"points",void 0),$t([to(0)],t.Polygon.prototype,"curve",void 0),$t([vo(Ll.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),$t([vo(Ll.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=$t([bo(),So()],t.Polygon);const{sin:El,cos:Il,PI:Ol}=Math,{moveTo:Al,lineTo:Ml,closePath:Wl}=si;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Al(n,r,0);for(let t=1;t<2*s;t++)Ml(n,r+(t%2==0?r:r*i)*El(t*Ol/s),o-(t%2==0?o:o*i)*Il(t*Ol/s));Wl(n)}},$t([go(Hh)],t.Star.prototype,"__",void 0),$t([to(5)],t.Star.prototype,"corners",void 0),$t([to(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=$t([So()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return c(t)&&t[0].image}constructor(t){super(t)}},$t([go(Qh)],t.Image.prototype,"__",void 0),$t([Jr("")],t.Image.prototype,"url",void 0),t.Image=$t([So()],t.Image);const Dl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Xt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Dr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new gn(gn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new K(t.worldTransform).invert(),o=new K;e&&o.translate(e.x,e.y),s&&(l(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},$t([go(Jh)],t.Canvas.prototype,"__",void 0),$t([ph(100)],t.Canvas.prototype,"width",void 0),$t([ph(100)],t.Canvas.prototype,"height",void 0),$t([ph(1)],t.Canvas.prototype,"pixelRatio",void 0),$t([ph(!0)],t.Canvas.prototype,"smooth",void 0),$t([Hr(!1)],t.Canvas.prototype,"safeResize",void 0),$t([ph()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=$t([So()],t.Canvas);const{copyAndSpread:Fl,includes:zl,spread:Ul,setList:Nl}=Rt;function Yl(t,e){const s=t.__,{rows:i,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,s=i.length;t<s;t++)o=i[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:o}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,o)))}}function Xl(t,e){t.__.__font?Yl(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Hl(t,e,s){switch(e.__.strokeAlign){case"center":Gl(t,1,e,s);break;case"inside":Vl(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?Gl(t,2,e,s):Vl(t,"outside",e,s)}}function Gl(t,e,s,i){const r=s.__;u(t)?ql(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),jl(s,i))}function Vl(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,Gl(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",Yl(s,r),r.blendMode="normal",Do.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function jl(t,e){let s,i=t.__.__textDrawData;const{rows:r,decorationY:o}=i;for(let t=0,i=r.length;t<i;t++)s=r[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(o){const{decorationHeight:t}=i;r.forEach(s=>o.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}}function ql(t,e,s,i,r){let o;const n=i.__,{__hasMultiStrokeStyle:a}=n;a||r.setStroke(void 0,n.__strokeWidth*e,n);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!vh.checkImage(i,r,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?r.setStroke(o.style,n.__getRealStrokeWidth(t)*e,n,t):r.setStroke(o.style,n.__strokeWidth*e,n)}else r.strokeStyle=o.style;o.blendMode?(r.saveBlendMode(o.blendMode),s?jl(i,r):r.stroke(),r.restoreBlendMode()):s?jl(i,r):r.stroke()}}function Ql(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)Hl(t,e,s);else switch(i.strokeAlign){case"center":Jl(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),Jl(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)Jl(t,2,e,s);else{const{renderBounds:r}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),Jl(t,2,e,o),o.clipUI(i),o.clearWorld(r),Do.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s)}}function Jl(t,e,s,i){const r=s.__;u(t)?ql(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&wh.strokeArrow(t,s,i)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=mh.number(e,r),t.__letterSpacing=mh.number(s,r),t.__padding=l?w.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=gh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&Ul(a,s/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),p.stintSet(this,"isOverflow",!zl(h,a)),this.isOverflow?(Nl(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Fl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},$t([go(qh)],t.Text.prototype,"__",void 0),$t([Jr(0)],t.Text.prototype,"width",void 0),$t([Jr(0)],t.Text.prototype,"height",void 0),$t([oo()],t.Text.prototype,"boxStyle",void 0),$t([Hr(!1)],t.Text.prototype,"resizeFontSize",void 0),$t([oo("#000000")],t.Text.prototype,"fill",void 0),$t([eo("outside")],t.Text.prototype,"strokeAlign",void 0),$t([po("all")],t.Text.prototype,"hitFill",void 0),$t([Jr("")],t.Text.prototype,"text",void 0),$t([Jr("")],t.Text.prototype,"placeholder",void 0),$t([Jr("caption")],t.Text.prototype,"fontFamily",void 0),$t([Jr(12)],t.Text.prototype,"fontSize",void 0),$t([Jr("normal")],t.Text.prototype,"fontWeight",void 0),$t([Jr(!1)],t.Text.prototype,"italic",void 0),$t([Jr("none")],t.Text.prototype,"textCase",void 0),$t([Jr("none")],t.Text.prototype,"textDecoration",void 0),$t([Jr(0)],t.Text.prototype,"letterSpacing",void 0),$t([Jr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),$t([Jr(0)],t.Text.prototype,"paraIndent",void 0),$t([Jr(0)],t.Text.prototype,"paraSpacing",void 0),$t([Jr("x")],t.Text.prototype,"writingMode",void 0),$t([Jr("left")],t.Text.prototype,"textAlign",void 0),$t([Jr("top")],t.Text.prototype,"verticalAlign",void 0),$t([Jr(!0)],t.Text.prototype,"autoSizeAlign",void 0),$t([Jr("normal")],t.Text.prototype,"textWrap",void 0),$t([Jr("show")],t.Text.prototype,"textOverflow",void 0),$t([oo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=$t([So()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},$t([go(Gh)],t.Path.prototype,"__",void 0),$t([eo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=$t([So()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},$t([go(Vh)],t.Pen.prototype,"__",void 0),$t([(t,e)=>{Fr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=$t([ko(xi,["set","path","paint"]),So()],t.Pen);const{getSpread:$l,getOuterOf:Zl,getByMove:Kl,getIntersectData:td}=Rt;let ed;const{stintSet:sd}=p,{hasTransparent:id}=yh;function rd(t,e,s){if(!u(e)||!1===e.visible||0===e.opacity)return;let i;const{boxBounds:r}=s.__layout;switch(e.type){case"image":i=vh.image(s,t,e,r,!ed||!ed[e.url]);break;case"linear":i=bh.linearGradient(e,r);break;case"radial":i=bh.radialGradient(e,r);break;case"angular":i=bh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;i={type:n,style:yh.string(a,h)};break;default:o(e.r)||(i={type:"solid",style:yh.string(e)})}if(i){if(a(i.style)&&id(i.style)&&(i.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;i.strokeStyle=e.style}e.editing&&(i.editing=e.editing),e.blendMode&&(i.blendMode=e.blendMode)}return i}const od={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];c(a)||(a=[a]),ed=vh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=rd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length&&i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(sd(s,"__isAlphaPixelFill",r),sd(s,"__isTransparentFill",o)):(sd(s,"__isAlphaPixelStroke",r),sd(s,"__isTransparentStroke",o),sd(s,"__hasMultiStrokeStyle",n))},fill:function(t,e,s){s.fillStyle=t,Xl(e,s)},fills:function(t,e,s){let i;for(let r=0,o=t.length;r<o;r++){if(i=t[r],i.image){if(vh.checkImage(e,s,i,!e.__.__font))continue;if(!i.style){!r&&i.image.isPlacehold&&e.drawImagePlaceholder(s,i.image);continue}}if(s.fillStyle=i.style,i.transform||i.scaleFixed){if(s.save(),i.transform&&s.transform(i.transform),i.scaleFixed){const{scaleX:t,scaleY:r}=e.getRenderScaleData(!0);(!0===i.scaleFixed||"zoom-in"===i.scaleFixed&&t>1&&r>1)&&s.scale(1/t,1/r)}i.blendMode&&(s.blendMode=i.blendMode),Xl(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),Xl(e,s),s.restoreBlendMode()):Xl(e,s)}},fillPathOrText:Xl,fillText:Yl,stroke:Ql,strokes:function(t,e,s){Ql(t,e,s)},strokeText:Hl,drawTextStroke:jl,shape:function(t,s,i){const r=s.getSameCanvas(),o=t.__nowWorld,n=s.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(o))c=r,a=d=o;else{const{renderShapeSpread:r}=t.__layout;let p;if(e.fullImageShadow)p=o;else{const t=r?$l(n,u===_?r*u:[r*_,r*u]):n;p=td(t,o)}l=n.getFitMatrix(p);let{a:f,d:g}=l;l.a<1&&(c=s.getSameCanvas(),t.__renderShape(c,i),u*=f,_*=g),d=Zl(o,l),a=Kl(d,-l.e,-l.f);const y=i.matrix;y?(h=new K(l),h.multiply(y),f*=y.scaleX,g*=y.scaleY):h=l,h.withScale(f,g),i=Object.assign(Object.assign({},i),{matrix:h})}return t.__renderShape(r,i),{canvas:r,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let nd={},ad={a:1,b:0,c:0,d:1,e:0,f:0};const{get:hd,rotateOfOuter:ld,translate:dd,scaleOfOuter:cd,multiplyParent:ud,scale:_d,rotate:pd,skew:fd}=M;function gd(t,e,s,i,r,o,n){const a=hd();dd(a,e.x+s,e.y+i),_d(a,r,o),n&&ld(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function yd(t,e,s,i,r,o,n,a,h){const l=hd();xd(l,e,s,i,r,o,n,a),h&&(ad.a=e.width/h.width,ad.d=e.height/h.height,ud(l,ad)),t.transform=l}function md(t,e,s,i,r,o,n,a,h,l,d,c){const u=hd();if(c)xd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)ld(u,{x:s/2,y:i/2},h);else switch(pd(u,h),h){case 90:dd(u,i,0);break;case 180:dd(u,s,i);break;case 270:dd(u,0,s)}nd.x=e.x+r,nd.y=e.y+o,dd(u,nd.x,nd.y),n&&cd(u,nd,n,a)}t.transform=u}function xd(t,e,s,i,r,o,n,a){n&&pd(t,n),a&&fd(t,a.x,a.y),r&&_d(t,r,o),dd(t,e.x+s,e.y+i)}const{get:wd,translate:vd}=M,bd=new Lt,Bd={},kd={};function Sd(t,e,s,i){const{changeful:r,sync:o,scaleFixed:n}=s;r&&(t.changeful=r),o&&(t.sync=o),n&&(t.scaleFixed=n),t.data=Rd(s,i,e)}function Rd(t,e,s){t.padding&&(e=bd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:i,height:r}=s;const{opacity:o,mode:n,align:h,offset:l,scale:d,size:c,rotation:_,skew:p,clipSize:f,repeat:g,gap:y,filters:m}=t,x=e.width===i&&e.height===r,v={mode:n},b="center"!==h&&(_||0)%180==90;let B,k;switch(Rt.set(kd,0,0,b?r:i,b?i:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(w.getScaleData(d,c,s,Bd),B=Bd.scaleX,k=Bd.scaleY),(h||y||g)&&(B&&Rt.scale(kd,B,k,!0),h&<.toPoint(h,kd,e,kd,!0,!0))):x&&!_||(B=k=Rt.getFitScale(e,kd,"fit"!==n),Rt.put(e,s,h,B,!1,kd),Rt.scale(kd,B,k,!0)),l&&V.move(kd,l),n){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":(kd.x||kd.y||B||f||_||p)&&yd(v,e,kd.x,kd.y,B,k,_,p,t.clipSize);break;case"repeat":(!x||B||_||p)&&md(v,e,i,r,kd.x,kd.y,B,k,_,p,h,t.freeTransform),g||(v.repeat="repeat");const s=u(g);(y||s)&&(v.gap=function(t,e,s,i,r){let o,n;u(t)?(o=t.x,n=t.y):o=n=t;return{x:Cd(o,s,r.width,e&&e.x),y:Cd(n,i,r.height,e&&e.y)}}(y,s&&g,kd.width,kd.height,e));break;default:B&&gd(v,e,kd.x,kd.y,B,k,_)}return v.transform||(e.x||e.y)&&(v.transform=wd(),vd(v.transform,e.x,e.y)),B&&"stretch"!==n&&(v.scaleX=B,v.scaleY=k),v.width=i,v.height=r,o&&(v.opacity=o),m&&(v.filters=m),g&&(v.repeat=a(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),v}function Cd(t,e,s,i){const r=a(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let Pd,Td=new Lt;const{isSame:Ld}=Rt;function Ed(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Sd(r,i,s,o),!0}function Id(t,e){Md(t,gn.LOAD,e)}function Od(t,e){Md(t,gn.LOADED,e)}function Ad(t,e,s){e.error=s,t.forceUpdate("surface"),Md(t,gn.ERROR,e)}function Md(t,e,s){t.hasEvent(e)&&t.emitEvent(new gn(e,s))}function Wd(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Dd,scale:Fd,copy:zd}=M,{floor:Ud,max:Nd,abs:Yd}=Math;function Xd(t,s,i){let{scaleX:r,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed);const n=r+"-"+o+"-"+i;if(s.patternId===n||t.destroyed)return!1;{const{image:t,data:a}=s;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:f,gap:g}=a;r*=i,o*=i;const y=g&&g.x*r,m=g&&g.y*o;u&&(u=Yd(u),_=Yd(_),l=Dd(),zd(l,p),Fd(l,1/u,1/_),r*=u,o*=_),d*=r,c*=o;const x=d*c;if(!f&&x>e.image.maxCacheSize)return!1;let w=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}if(x>w&&(h=Math.sqrt(x/w)),h&&(r/=h,o/=h,d/=h,c/=h),u&&(r/=u,o/=_),(p||1!==r||1!==o)&&(l||(l=Dd(),p&&zd(l,p)),Fd(l,1/r,1/o)),l){const t=d+(y||0),e=c+(m||0);Fd(l,t/Nd(Ud(t),1),e/Nd(Ud(e),1))}const v=t.getCanvas(d,c,a.opacity,a.filters,y,m),b=t.getPattern(v,f||e.origin.noRepeat||"no-repeat",l,s);return s.style=b,s.patternId=n,!0}}const Hd={image:function(t,e,s,i,r){let o,n;const a=Er.get(s);return Pd&&s===Pd.paint&&Ld(i,Pd.boxBounds)?o=Pd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Pd=a.use>1?{leafPaint:o,paint:s,boxBounds:Td.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Ed(t,e,s,a,o,i),r&&(Id(t,n),Od(t,n))):a.error?r&&Ad(t,n,a.error):(r&&(Wd(t,!0),Id(t,n)),o.loadId=a.load(()=>{Wd(t,!1),t.destroyed||(Ed(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Od(t,n)),o.loadId=void 0},e=>{Wd(t,!1),Ad(t,n,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,s,i,r){const{scaleX:o,scaleY:n}=t.getRenderScaleData(!0,i.scaleFixed),{pixelRatio:a}=s,{data:h}=i;if(!h||i.patternId===o+"-"+n+"-"+a&&!Sh.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===e.name&&Bn.isResizing(t)||Sh.running)){let{width:t,height:s}=h;t*=o*a,s*=n*a,h.scaleX&&(t*=h.scaleX,s*=h.scaleY),r=t*s>e.image.maxCacheSize}return r?(t.__.__isFastShadow&&(s.fillStyle=i.style||"#000",s.fill()),function(t,e,s,i){e.save(),e.clipUI(t),s.blendMode&&(e.blendMode=s.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(s.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(t,s,i,h),!0):(!i.style||i.sync||Sh.running?Xd(t,i,a):i.patternTask||(i.patternTask=Er.patternTasker.add(()=>Zt(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(t.__nowWorld)&&Xd(t,i,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Xd,recycleImage:function(t,e){const s=e["_"+t];if(c(s)){let i,r,o,n,a;for(let h=0,l=s.length;h<l;h++)i=s[h],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,Er.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],c(n)||(n=[n])),r.unload(s[h].loadId,!n.some(t=>t.url===a))));return o}return null},createData:Sd,getPatternData:Rd,fillOrFitMode:gd,clipMode:yd,repeatMode:md},{toPoint:Gd}=nt,{hasTransparent:Vd}=yh,jd={},qd={};function Qd(t,e,s,i){if(s){let r,o,n,h;for(let t=0,l=s.length;t<l;t++)r=s[t],a(r)?(n=t/(l-1),o=yh.string(r,i)):(n=r.offset,o=yh.string(r.color,i)),e.addColorStop(n,o),!h&&Vd(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Jd,getDistance:$d}=V,{get:Zd,rotateOfOuter:Kd,scaleOfOuter:tc}=M,{toPoint:ec}=nt,sc={},ic={};function rc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=Jd(e,s);o=Zd(),r?(tc(o,e,n/a*(i||1),1),Kd(o,e,t+90)):(tc(o,e,1,n/a*(i||1)),Kd(o,e,t))}return o}const{getDistance:oc}=V,{toPoint:nc}=nt,ac={},hc={};const lc={linearGradient:function(t,s){let{from:i,to:r,type:o,opacity:n}=t;Gd(i||"top",s,jd),Gd(r||"bottom",s,qd);const a=e.canvas.createLinearGradient(jd.x,jd.y,qd.x,qd.y),h={type:o,style:a};return Qd(h,a,t.stops,n),h},radialGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;ec(i||"center",s,sc),ec(r||"bottom",s,ic);const h=e.canvas.createRadialGradient(sc.x,sc.y,0,sc.x,sc.y,$d(sc,ic)),l={type:o,style:h};Qd(l,h,t.stops,n);const d=rc(s,sc,ic,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;nc(i||"center",s,ac),nc(r||"bottom",s,hc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,ac.x,ac.y):e.canvas.createRadialGradient(ac.x,ac.y,0,ac.x,ac.y,oc(ac,hc)),l={type:o,style:h};Qd(l,h,t.stops,n);const d=rc(s,ac,hc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:rc},{copy:dc,toOffsetOutBounds:cc}=Rt,uc={},_c={};function pc(t,s,i,r){const{bounds:o,shapeBounds:n}=r;if(e.fullImageShadow){if(dc(uc,t.bounds),uc.x+=s.x-n.x,uc.y+=s.y-n.y,i){const{fitMatrix:t}=r;uc.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),uc.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),uc.width*=i,uc.height*=i}t.copyWorld(r.canvas,t.bounds,uc)}else i&&(dc(uc,s),uc.x-=s.width/2*(i-1),uc.y-=s.height/2*(i-1),uc.width*=i,uc.height*=i),t.copyWorld(r.canvas,n,i?uc:s)}const{toOffsetOutBounds:fc}=Rt,gc={};const yc={shadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;cc(l,_c),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.setWorldShadow(_c.offsetX+a.x*c*g,_c.offsetY+a.y*u*g,a.blur*c*g,yh.string(a.color)),r=a.spread?1+2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,pc(_,_c,r,s),i=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),i=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),Do.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;fc(l,gc),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.save(),_.setWorldShadow(gc.offsetX+a.x*c*g,gc.offsetY+a.y*u*g,a.blur*c*g),r=a.spread?1-2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,pc(_,gc,r,s),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,yh.string(a.color),"source-in"),Do.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){}},{excludeRenderBounds:mc}=Go;let xc;function wc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":xc||(xc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);bc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":bc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function vc(t){return t.getSameCanvas(!1,!0)}function bc(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}t.Group.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(wc(this,n,t,r,i,o,void 0,!0),i=r=null),o=s.__.opacity,xc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=vc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=vc(t)),r||(r=vc(t)),s.__render(i,e)),"clipping"!==a&&"clipping-path"!==a||mc(s,e)||s.__render(t,e);continue}const d=1===o&&s.__.__blendMode;d&&wc(this,n,t,r,i,o,void 0,!1),mc(s,e)||s.__render(r||t,e),d&&wc(this,n,t,r,i,o,d,!1)}wc(this,n,t,r,i,o,void 0,!0)};const Bc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",kc=Bc+"_#~&*+\\=|≮≯≈≠=…",Sc=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 Rc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Cc=Rc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Pc=Rc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Tc=Rc(Bc),Lc=Rc(kc),Ec=Rc("- —/~|┆·");var Ic;!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"}(Ic||(Ic={}));const{Letter:Oc,Single:Ac,Before:Mc,After:Wc,Symbol:Dc,Break:Fc}=Ic;function zc(t){return Cc[t]?Oc:Ec[t]?Fc:Pc[t]?Mc:Tc[t]?Wc:Lc[t]?Dc:Sc.test(t)?Ac:Oc}const Uc={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Nc(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Yc}=Uc,{Letter:Xc,Single:Hc,Before:Gc,After:Vc,Symbol:jc,Break:qc}=Ic;let Qc,Jc,$c,Zc,Kc,tu,eu,su,iu,ru,ou,nu,au,hu,lu,du,cu,uu=[];function _u(t,e){iu&&!su&&(su=iu),Qc.data.push({char:t,width:e}),$c+=e}function pu(){Zc+=$c,Qc.width=$c,Jc.words.push(Qc),Qc={data:[]},$c=0}function fu(){hu&&(lu.paraNumber++,Jc.paraStart=!0,hu=!1),iu&&(Jc.startCharSize=su,Jc.endCharSize=iu,su=0),Jc.width=Zc,du.width?Yc(Jc):cu&&gu(),uu.push(Jc),Jc={words:[]},Zc=0}function gu(){Zc>(lu.maxWidth||0)&&(lu.maxWidth=Zc)}const{top:yu,right:mu,bottom:xu,left:wu}=t.Direction4;function vu(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const bu={getDrawData:function(t,s){a(t)||(t=String(t));let i=0,r=0,o=s.__getInput("width")||0,n=s.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=s;d&&(o?(i=d[wu],o-=d[mu]+d[wu]):s.autoSizeAlign||(i=d[wu]),n?(r=d[yu],n-=d[yu]+d[xu]):s.autoSizeAlign||(r=d[yu]));const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,s,i){lu=t,uu=t.rows,du=t.bounds,cu=!du.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=e,{width:h,height:l}=du;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;hu=!0,ou=null,su=eu=iu=$c=Zc=0,Qc={data:[]},Jc={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)tu=s[i],"\n"===tu?($c&&pu(),Jc.paraEnd=!0,fu(),hu=!0):(ru=zc(tu),ru===Xc&&"none"!==n&&(tu=Nc(tu,n,!$c)),eu=a.measureText(tu).width,r&&(r<0&&(iu=eu),eu+=r),nu=ru===Hc&&(ou===Hc||ou===Xc)||ou===Hc&&ru!==Vc,au=!(ru!==Gc&&ru!==Hc||ou!==jc&&ou!==Vc),Kc=hu&&o?h-o:h,t&&h&&Zc+$c+eu>Kc&&(e?($c&&pu(),Zc&&fu()):(au||(au=ru===Xc&&ou==Vc),nu||au||ru===qc||ru===Gc||ru===Hc||$c+eu>Kc?($c&&pu(),Zc&&fu()):Zc&&fu()))," "===tu&&!0!==hu&&Zc+$c===0||(ru===qc?(" "===tu&&$c&&pu(),_u(tu,eu),pu()):nu||au?($c&&pu(),_u(tu,eu)):_u(tu,eu)),ou=ru);$c&&pu(),Zc&&fu(),uu.length>0&&(uu[uu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{lu.paraNumber++,Zc=a.measureText(t).width,uu.push({x:o||0,text:t,width:Zc,paraStart:!0}),cu&&gu()})}(c,t,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":vu(e,"x",t[wu]);break;case"right":vu(e,"x",-t[mu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":vu(e,"y",t[yu]);break;case"bottom":vu(e,"y",-t[xu])}}(d,c,s,o,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:f,height:g}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>g)y=Math.max(g,o),r>1&&(t.overflow=r);else if(g||u)switch(d){case"middle":p+=(g-y)/2;break;case"bottom":p+=g-y}m+=p;let x,w,v,b=f||u?f:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<f||x.width>f&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&f&&f<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(c,s),function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,letterSpacing:n}=e;let a,h,l,d,c,u;i.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=s&&("justify"===r||"both"===r)&&u>1?(s-t.width-l)/(u-1):0,d=n||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!n&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,s)=>{1===d?(c={char:"",x:a},a=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,s,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||s===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,s,o),c.overflow&&function(t,s,i,r){if(!r)return;const{rows:o,overflow:n}=t;let{textOverflow:a}=s;if(o.splice(n),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=i+r-l;("none"===s.textWrap?o:[o[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],h=t.x+t.width,!(i===s&&h<d));i--){if(h<d&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,s,i,o),"none"!==h&&function(t,e){let s;const{fontSize:i,textDecoration:r}=e;switch(t.decorationHeight=i/11,u(r)?(s=r.type,r.color&&(t.decorationColor=yh.string(r.color))):s=r,s){case"under":t.decorationY=[.15*i];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i,.35*-i]}}(c,s),c}};const Bu={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!yh.object)return t;t=yh.object(t)}let i=o(t.a)?1:t.a;s&&(i*=e);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};return Object.assign(gh,bu),Object.assign(yh,Bu),Object.assign(wh,od),Object.assign(vh,Hd),Object.assign(bh,lc),Object.assign(Bh,yc),$a(),t.AlignHelper=lt,t.AroundHelper=nt,t.AutoBounds=It,t.BezierHelper=Ue,t.Bounds=Lt,t.BoundsEvent=yn,t.BoundsHelper=Rt,t.BoxData=Dh,t.BranchHelper=Qo,t.BranchRender=ca,t.CanvasData=Jh,t.CanvasManager=Jt,t.ChildEvent=un,t.ColorConvert=yh,t.Creator=Xt,t.DataHelper=p,t.Debug=Mt,t.DragBoundsHelper=Zh,t.Effect=Bh,t.EllipseData=Yh,t.EllipseHelper=Qe,t.Event=cn,t.EventCreator=qt,t.Eventer=An,t.Export=Sh,t.FileHelper=Br,t.Filter=kh,t.FrameData=zh,t.GroupData=Wh,t.ImageData=Qh,t.ImageEvent=gn,t.ImageManager=Er,t.IncrementId=s,t.LayoutEvent=Sn,t.Layouter=dh,t.LeafBounds=ha,t.LeafBoundsHelper=Go,t.LeafData=g,t.LeafDataProxy=jn,t.LeafEventer=Gn,t.LeafHelper=Do,t.LeafLayout=dn,t.LeafLevelList=Va,t.LeafList=Ga,t.LeafMatrix=ta,t.LeafRender=la,t.LeaferCanvas=qa,t.LeaferCanvasBase=ce,t.LeaferData=Fh,t.LeaferEvent=Cn,t.LeaferImage=Dr,t.LineData=Uh,t.MathHelper=w,t.Matrix=K,t.MatrixHelper=M,t.MyImage=Dl,t.NeedConvertToCanvasCommandMap=ge,t.OneRadian=b,t.PI2=B,t.PI_2=k,t.Paint=wh,t.PaintGradient=bh,t.PaintImage=vh,t.PathArrow=xh,t.PathBounds=ur,t.PathCommandDataHelper=si,t.PathCommandMap=pe,t.PathConvert=Os,t.PathCorner=xr,t.PathCreator=xi,t.PathData=Gh,t.PathDrawer=Ai,t.PathHelper=ue,t.PathNumberCommandLengthMap=we,t.PathNumberCommandMap=xe,t.PenData=Vh,t.Platform=e,t.Plugin=Yt,t.Point=$,t.PointHelper=V,t.PolygonData=Xh,t.PropertyEvent=pn,t.RectData=Nh,t.RectHelper=ve,t.RectRender=il,t.RenderEvent=Rn,t.Renderer=uh,t.ResizeEvent=Bn,t.Resource=Tr,t.Run=zt,t.StarData=Hh,t.State=Rh,t.StringNumberMap=Ot,t.TaskItem=Rr,t.TaskProcessor=Cr,t.TextConvert=gh,t.TextData=qh,t.Transition=Ch,t.TwoPointBoundsHelper=et,t.UIBounds=$h,t.UICreator=Gt,t.UIData=Ah,t.UIRender=el,t.UnitConvert=mh,t.WaitHelper=Ko,t.WatchEvent=kn,t.Watcher=Ka,t.affectRenderBoundsType=ro,t.affectStrokeBoundsType=eo,t.attr=Yr,t.autoLayoutType=jr,t.boundsType=Jr,t.canvasPatch=br,t.canvasSizeAttrs=de,t.createAttr=function(t){return(e,s)=>{Fr(e,s,Ur(s,t))}},t.createDescriptor=Ur,t.cursorType=fo,t.dataProcessor=go,t.dataType=Hr,t.decorateLeafAttr=Nr,t.defineDataProcessor=yo,t.defineKey=Fr,t.defineLeafAttr=Xr,t.doBoundsType=Zr,t.doStrokeType=so,t.effectType=_h,t.emptyData={},t.eraserType=_o,t.extraPropertyEventMap=fn,t.getBoundsData=R,t.getDescriptor=zr,t.getMatrixData=C,t.getPointData=S,t.hitType=po,t.isArray=c,t.isData=function(t){return u(t)&&!c(t)},t.isEmptyData=_,t.isFinite=h,t.isNull=n,t.isNumber=l,t.isObject=u,t.isString=a,t.isUndefined=o,t.layoutProcessor=function(t){return(e,s)=>{Fr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=In,t.maskType=uo,t.naturalBoundsType=$r,t.opacityType=no,t.pathInputType=Kr,t.pathType=to,t.pen=wr,t.positionType=Gr,t.registerUI=So,t.registerUIEvent=function(){return t=>{qt.register(t)}},t.resizeType=ph,t.rewrite=vo,t.rewriteAble=bo,t.rotationType=Qr,t.scaleType=qr,t.scrollType=Vr,t.sortType=co,t.strokeType=io,t.surfaceType=oo,t.tempBounds=Et,t.tempMatrix=tt,t.tempPoint=Z,t.tryToNumber=function(t){return"string"==typeof t&&d.test(t)?+t:t},t.useCanvas=$a,t.useModule=ko,t.version="1.9.3",t.visibleType=ao,t.zoomLayerType=fh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
1
|
+
var LeaferUI=function(t){"use strict";const e={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:s,suffix:i}=e.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),s&&"/"===t[0]&&(t=s+t),t}}},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s;var r;t.Answer=void 0,(r=t.Answer||(t.Answer={}))[r.No=0]="No",r[r.Yes=1]="Yes",r[r.NoAndSkip=2]="NoAndSkip",r[r.YesAndSkip=3]="YesAndSkip";function o(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;const{isArray:c}=Array;function u(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return f(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&f(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{o(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:f}=p;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=o(s)?this[i]: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(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(c(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:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!o(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}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{round:y,pow:m,PI:x}=Math,w={within:(t,e,s)=>(u(e)&&(s=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(s)&&t>s&&(t=s),t),fourNumber(t,e){let s;if(c(t))switch(t.length){case 4:s=o(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]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),w.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=o(e)?1e12:m(10,e);return-0===(t=y(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&w.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:v,randColor:t=>`rgba(${v(255)},${v(255)},${v(255)},${t||1})`};function v(t){return Math.round(Math.random()*t)}const b=x/180,B=2*x,k=x/2;function S(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:P,cos:T,acos:L,sqrt:E}=Math,{float:I}=w,O={};function A(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const M={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:A(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:C,getWorld:A,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},scaleOfOuter(t,e,s,i){W.toInnerPoint(t,e,O),W.scaleOfInner(t,O,s,i)},scaleOfInner(t,e,s,i=s){W.translateInner(t,e.x,e.y),W.scale(t,s,i),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=T(e*=b),a=P(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){W.toInnerPoint(t,e,O),W.rotateOfInner(t,O,s)},rotateOfInner(t,e,s){W.translateInner(t,e.x,e.y),W.rotate(t,s),W.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=b,t.a=i+o*s,t.b=r+n*s),e&&(e*=b,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){W.toInnerPoint(t,e,O),W.skewOfInner(t,O,s,i)},skewOfInner(t,e,s,i=0){W.translateInner(t,e.x,e.y),W.skew(t,s,i),W.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,i,r){const{e:n,f:a}=t;if(s||(s=t),o(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:o,c:n,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,i,r){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(o(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,o=s*b,n=T(o),a=P(o);if(i||r){const e=i*b,s=r*b;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||i)&&W.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,f=h,g=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=E(r*r+o*o),c=t/d;const e=r/d;u=o>0?L(e):-L(e)}else{c=E(n*n+a*a),d=t/c;const e=n/c;u=k-(a>0?L(-e):-L(e))}const e=I(T(u)),s=P(u);d=I(d),c=I(c),_=e?I((n/c+s)/e/b,9):0,p=e?I((o/d-s)/e/b,9):0,u=I(u/b)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(f+=e.x*r+e.y*n,g+=e.x*o+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=E(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){W.set(t)}},W=M,{toInnerPoint:D,toOuterPoint:F}=M,{sin:z,cos:U,abs:N,sqrt:Y,atan2:X,min:H,round:V}=Math,G={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=o(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?V(t.x-.5)+.5:V(t.x),t.y=e?V(t.y-.5)+.5:V(t.y)},move(t,e,s){u(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=j.defaultPoint);const i=U(e*=b),r=z(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=j;return Q(s,t),D(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=j;return Q(s,t),F(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=j;return Q(s,t),j.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),D(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){D(e,t,s)},toOuterOf(t,e,s){F(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=N(s-t),o=N(i-e);return Y(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>H(q(t,e,s,i),q(s,i,r,o)),getAngle:(t,e)=>J(t,e)/b,getRotation:(t,e,s,i)=>(i||(i=e),j.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/b),getRadianFrom(t,e,s,i,r,n,a,h){o(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>X(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=J(t,e);return(e=i?e:{}).x=t.x+U(r)*s,e.y=t.y+z(r)*s,e},toNumberPoints(t){let e=t;return u(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){j.reset(t)}},j=G,{getDistanceFrom:q,copy:Q,getAtan2:J}=j;class ${constructor(t,e){this.set(t,e)}set(t,e){return u(t)?G.copy(this,t):G.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new $(this)}move(t,e){return G.move(this,t,e),this}scale(t,e){return G.scale(this,t,e),this}scaleOf(t,e,s){return G.scaleOf(this,t,e,s),this}rotate(t,e){return G.rotate(this,t,e),this}rotateOf(t,e){return G.rotate(this,e,t),this}getRotation(t,e,s){return G.getRotation(this,t,e,s)}toInnerOf(t,e){return G.toInnerOf(this,t,e),this}toOuterOf(t,e){return G.toOuterOf(this,t,e),this}getCenter(t){return new $(G.getCenter(this,t))}getDistance(t){return G.getDistance(this,t)}getDistancePoint(t,e,s){return new $(G.getDistancePoint(this,t,e,s))}getAngle(t){return G.getAngle(this,t)}getAtan2(t){return G.getAtan2(this,t)}reset(){return G.reset(this),this}}const Z=new $;class K{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return u(t)?M.copy(this,t):M.set(this,t,e,s,i,r,o),this}setWith(t){return M.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}clone(){return new K(this)}translate(t,e){return M.translate(this,t,e),this}translateInner(t,e){return M.translateInner(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleWith(t,e){return M.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return M.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return M.scaleOfInner(this,t,e,s),this}rotate(t){return M.rotate(this,t),this}rotateOfOuter(t,e){return M.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return M.rotateOfInner(this,t,e),this}skew(t,e){return M.skew(this,t,e),this}skewOfOuter(t,e,s){return M.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return M.skewOfInner(this,t,e,s),this}multiply(t){return M.multiply(this,t),this}multiplyParent(t){return M.multiplyParent(this,t),this}divide(t){return M.divide(this,t),this}divideParent(t){return M.divideParent(this,t),this}invert(){return M.invert(this),this}invertWith(){return M.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){M.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){M.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return M.setLayout(this,t,e,s),this}getLayout(t,e,s){return M.getLayout(this,t,e,s)}withScale(t,e){return M.withScale(this,t,e)}reset(){M.reset(this)}}const tt=new K,et={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){st(t,e,s),st(t,e+i,s+r)},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:st}=et;var it,rt;t.Direction4=void 0,(it=t.Direction4||(t.Direction4={}))[it.top=0]="top",it[it.right=1]="right",it[it.bottom=2]="bottom",it[it.left=3]="left",t.Direction9=void 0,(rt=t.Direction9||(t.Direction9={}))[rt.topLeft=0]="topLeft",rt[rt.top=1]="top",rt[rt.topRight=2]="topRight",rt[rt.right=3]="right",rt[rt.bottomRight=4]="bottomRight",rt[rt.bottom=5]="bottom",rt[rt.bottomLeft=6]="bottomLeft",rt[rt.left=7]="left",rt[rt.center=8]="center",rt[rt["top-left"]=0]="top-left",rt[rt["top-right"]=2]="top-right",rt[rt["bottom-right"]=4]="bottom-right",rt[rt["bottom-left"]=6]="bottom-left";const ot=[{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}];ot.forEach(t=>t.type="percent");const nt={directionData:ot,tempPoint:{},get:at,toPoint(t,e,s,i,r,o){const n=at(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),nt.toPoint(t,e,s,!0),s)};function at(e){return a(e)?ot[t.Direction9[e]]:e}const{toPoint:ht}=nt,lt={toPoint(t,e,s,i,r,o){ht(t,s,i,r,e,o)}},{tempPointBounds:dt,setPoint:ct,addPoint:ut,toBounds:_t}=et,{toOuterPoint:pt}=M,{float:ft,fourNumber:gt}=w,{floor:yt,ceil:mt}=Math;let xt,wt,vt,bt;const Bt={},kt={},St={},Rt={tempBounds:St,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(c(s)){const e=gt(s);i?Ct.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Ct.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Ct.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Tt(e,t):e=t,s?(e.offsetX=-(Ct.maxX(s)-t.x),e.offsetY=-(Ct.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||G.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){G.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Ct.copy(St,t),Ct.toOuterOf(St,e),St),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else Bt.x=t.x,Bt.y=t.y,pt(e,Bt,kt),ct(dt,kt.x,kt.y),Bt.x=t.x+t.width,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.y=t.y+t.height,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.x=t.x,pt(e,Bt,kt),ut(dt,kt.x,kt.y),_t(dt,s)},toInnerOf(t,e,s){s||(s=t),Ct.move(s,-e.e,-e.f),Ct.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Ct.getFitScale(t,e));return new K(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,o){o||(o=e),a(i)&&(i=Ct.getFitScale(t,e,"cover"===i)),St.width=r?e.width*=i:e.width*i,St.height=r?e.height*=i:e.height*i,lt.toPoint(s,St,t,o,!0,!0)},getSpread(t,e,s){const i={};return Ct.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Ct.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ct.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=yt(t.x),t.y=yt(t.y),t.width=e>t.x?mt(t.width+e-t.x):mt(t.width),t.height=s>t.y?mt(t.height+s-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=ft(t.x,e),t.y=ft(t.y,e),t.width=ft(t.width,e),t.height=ft(t.height,e)},add(t,e,s){xt=t.x+t.width,wt=t.y+t.height,vt=e.x,bt=e.y,s||(vt+=e.width,bt+=e.height),xt=xt>vt?xt:vt,wt=wt>bt?wt:bt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=wt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ct.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ct.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||Tt(t,r)):Pt(t,r));o&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?ct(dt,t.x,t.y):ut(dt,t.x,t.y)),_t(dt,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Pt(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=G.tempToInnerRadiusPointOf(e,s)),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,s)=>(s&&(e=G.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Ct.tempToOuterOf(e,s)),!(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,s)=>(s&&(e=Ct.tempToOuterOf(e,s)),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,s){if(s&&(e=Ct.tempToOuterOf(e,s)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return xt=i+o,wt=r+n,vt=t.x+t.width,bt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,xt=xt<vt?xt:vt,wt=wt<bt?wt:bt,o=xt-i,n=wt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Ct.copy(t,Ct.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Ct.set(t)}},Ct=Rt,{add:Pt,copy:Tt}=Ct;class Lt{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Rt.copy(this,t):Rt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Lt(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,s){return Rt.scale(this,t,e,s),this}scaleOf(t,e,s){return Rt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,s){Rt.put(this,t,e,s)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const Et=new Lt;class It{constructor(t,e,s,i,r,o){u(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Lt(r,e,o||t.width-r-s,n||t.height-e-i)}}const Ot={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:At}=w;class Mt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Mt(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const s=At();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Mt.showBounds,r=t.__nowWorld,o=At();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(Dt.enable){if(Dt.filterList.length&&Dt.filterList.every(t=>t!==this.name))return;if(Dt.excludeList.length&&Dt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Dt.enable&&this.warn(...t)}warn(...t){Dt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Wt(t){return t?a(t)&&(t=[t]):t=[],t}Mt.filterList=[],Mt.excludeList=[],Mt.showWarn=!0;const Dt=Mt,Ft=Mt.get("RunTime"),zt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Ut.currentId=Ut.idMap[i]=e?performance.now():Date.now(),Ut.currentName=Ut.nameMap[i]=t,Ut.nameToIdMap[t]=i,i},end(t,e){const s=Ut.idMap[t],i=Ut.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Ut.idMap[t]=Ut.nameMap[t]=Ut.nameToIdMap[i]=void 0,Ft.log(i,r,"ms")},endOfName(t,e){const s=Ut.nameToIdMap[t];o(s)||Ut.end(s,e)}},Ut=zt,Nt=[],Yt={list:{},add(t,...e){this.list[t]=!0,Nt.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>Nt.forEach(t=>Yt.has(t,!0)));const Xt={editor:t=>Yt.need("editor")},Ht=Mt.get("UICreator"),Vt={list:{},register(t){const{__tag:e}=t.prototype;Gt[e]&&Ht.repeat(e),Gt[e]=t},get(t,e,s,i,r,n){Gt[t]||Ht.error("not register "+t);const a=new Gt[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:Gt}=Vt,jt=Mt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(Qt[e]&&jt.repeat(e),Qt[e]=t)})},changeName(t,e){const s=Qt[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,Qt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Qt[t](...e)},{nameList:Qt}=qt;class Jt{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Xt.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function $t(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function Zt(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function Kt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const te=[];function ee(){return(t,e)=>{te.push(e)}}const se=[];class ie{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||se)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;te.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){u(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}$t([Kt("imageSmoothingEnabled")],ie.prototype,"smooth",void 0),$t([Kt("imageSmoothingQuality")],ie.prototype,"smoothLevel",void 0),$t([Kt("globalAlpha")],ie.prototype,"opacity",void 0),$t([Kt()],ie.prototype,"fillStyle",void 0),$t([Kt()],ie.prototype,"strokeStyle",void 0),$t([Kt("lineWidth")],ie.prototype,"strokeWidth",void 0),$t([Kt("lineCap")],ie.prototype,"strokeCap",void 0),$t([Kt("lineJoin")],ie.prototype,"strokeJoin",void 0),$t([Kt("lineDashOffset")],ie.prototype,"dashOffset",void 0),$t([Kt()],ie.prototype,"miterLimit",void 0),$t([Kt()],ie.prototype,"shadowBlur",void 0),$t([Kt()],ie.prototype,"shadowColor",void 0),$t([Kt()],ie.prototype,"shadowOffsetX",void 0),$t([Kt()],ie.prototype,"shadowOffsetY",void 0),$t([Kt()],ie.prototype,"filter",void 0),$t([Kt()],ie.prototype,"font",void 0),$t([Kt()],ie.prototype,"fontKerning",void 0),$t([Kt()],ie.prototype,"fontStretch",void 0),$t([Kt()],ie.prototype,"fontVariantCaps",void 0),$t([Kt()],ie.prototype,"textAlign",void 0),$t([Kt()],ie.prototype,"textBaseline",void 0),$t([Kt()],ie.prototype,"textRendering",void 0),$t([Kt()],ie.prototype,"wordSpacing",void 0),$t([Kt()],ie.prototype,"letterSpacing",void 0),$t([Kt()],ie.prototype,"direction",void 0),$t([ee()],ie.prototype,"setTransform",null),$t([ee()],ie.prototype,"resetTransform",null),$t([ee()],ie.prototype,"getTransform",null),$t([ee()],ie.prototype,"save",null),$t([ee()],ie.prototype,"restore",null),$t([ee()],ie.prototype,"translate",null),$t([ee()],ie.prototype,"scale",null),$t([ee()],ie.prototype,"rotate",null),$t([ee()],ie.prototype,"fill",null),$t([ee()],ie.prototype,"stroke",null),$t([ee()],ie.prototype,"clip",null),$t([ee()],ie.prototype,"fillRect",null),$t([ee()],ie.prototype,"strokeRect",null),$t([ee()],ie.prototype,"clearRect",null),$t([ee()],ie.prototype,"beginPath",null),$t([ee()],ie.prototype,"moveTo",null),$t([ee()],ie.prototype,"lineTo",null),$t([ee()],ie.prototype,"bezierCurveTo",null),$t([ee()],ie.prototype,"quadraticCurveTo",null),$t([ee()],ie.prototype,"closePath",null),$t([ee()],ie.prototype,"arc",null),$t([ee()],ie.prototype,"arcTo",null),$t([ee()],ie.prototype,"ellipse",null),$t([ee()],ie.prototype,"rect",null),$t([ee()],ie.prototype,"roundRect",null),$t([ee()],ie.prototype,"createConicGradient",null),$t([ee()],ie.prototype,"createLinearGradient",null),$t([ee()],ie.prototype,"createPattern",null),$t([ee()],ie.prototype,"createRadialGradient",null),$t([ee()],ie.prototype,"fillText",null),$t([ee()],ie.prototype,"measureText",null),$t([ee()],ie.prototype,"strokeText",null);const{copy:re,multiplyParent:oe}=M,{round:ne}=Math,ae=new Lt,he=new Lt,le={width:1,height:1,pixelRatio:1},de=["width","height","pixelRatio"];class ce extends ie{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,i){super(),this.size={},this.worldTransform={},t||(t=le),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:o,pixelRatio:n}=t;this.autoLayout=!r||!o,this.size.pixelRatio=n||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,de),de.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&oe(t,e,r),r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s,i&&(t.half&&t.half*s%2?(r.e=ne(r.e-.5)+.5,r.f=ne(r.f-.5)+.5):(r.e=ne(r.e),r.f=ne(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.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,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),o(e.dashPattern)||(r=e.dashPattern),o(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=n,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,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=he):s=ae,this.drawImage(t.view,ae.x,ae.y,ae.width,ae.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Rt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,ae.x,ae.y,ae.width,ae.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(ae.x,ae.y,ae.width,ae.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,ae.x,ae.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(ae.x,ae.y,ae.width,ae.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(ae.x,ae.y,ae.width,ae.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ae.x,ae.y,ae.width,ae.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ae.x,ae.y,ae.width,ae.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(ae,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(he,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):Xt.canvas(Object.assign({},s));return r.save(),t&&(re(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}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 ue={creator:{},parse(t,e){},convertToCanvasData(t,e){}},_e={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},pe=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},_e),fe={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},ge={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},ye=Object.assign(Object.assign({},ge),_e),me=pe,xe={};for(let t in me)xe[me[t]]=t;const we={};for(let t in me)we[me[t]]=fe[t];const ve={drawRoundRect(t,e,s,i,r,o){const n=w.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:be,cos:Be,hypot:ke,atan2:Se,ceil:Re,abs:Ce,PI:Pe,sqrt:Te,pow:Le}=Math,{setPoint:Ee,addPoint:Ie}=et,{set:Oe,toNumberPoints:Ae}=G,{M:Me,L:We,C:De,Q:Fe,Z:ze}=pe,Ue={},Ne={points(t,e,s,i){let r=Ae(e);if(t.push(Me,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,f,g,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Te(Le(n-e,2)+Le(a-o,2)),f=Te(Le(h-n,2)+Le(l-a,2)),(p||f)&&(g=p+f,p=m*p/g,f=m*f/g,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(Fe,d,c,n,a):t.push(De,u,_,d,c,n,a),u=n+f*h,_=a+f*l);i||t.push(Fe,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(We,r[e],r[e+1]);i&&t.push(ze)},rect(t,e,s,i,r){ue.creator.path=t,ue.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){ue.creator.path=[],ve.drawRoundRect(ue.creator,e,s,i,r,o),t.push(...ue.convertToCanvasData(ue.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let f=Se(u,c),g=Se(p,_);const y=ke(c,u),m=ke(_,p);let x=g-f;if(x<0&&(x+=B),y<1e-12||m<1e-12||x<1e-12||Ce(x-Pe)<1e-12)return t&&t.push(We,i,r),h&&(Ee(h,e,s),Ie(h,i,r)),d&&Oe(d,e,s),void(l&&Oe(l,i,r));const w=c*p-_*u<0,v=w?-1:1,S=a/Be(x/2),R=i+S*Be(f+x/2+k*v),C=r+S*be(f+x/2+k*v);return f-=k*v,g-=k*v,He(t,R,C,a,a,0,f/b,g/b,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>He(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*b,_=be(u),p=Be(u);let f=n*b,g=a*b;f>Pe&&(f-=B),g<0&&(g+=B);let y=g-f;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Re(Ce(y/k)),x=y/m,w=be(x/4),v=8/3*w*w/be(x/2);g=f+x;let S,R,C,P,T,L,E,I,O=Be(f),A=be(f),M=C=p*i*O-_*r*A,W=P=_*i*O+p*r*A,D=e+C,F=s+P;t&&t.push(t.length?We:Me,D,F),l&&Ee(l,D,F),c&&Oe(c,D,F);for(let o=0;o<m;o++)S=Be(g),R=be(g),C=p*i*S-_*r*R,P=_*i*S+p*r*R,T=e+M-v*(p*i*A+_*r*O),L=s+W-v*(_*i*A-p*r*O),E=e+C+v*(p*i*R+_*r*S),I=s+P+v*(_*i*R-p*r*S),t&&t.push(De,T,L,E,I,e+C,s+P),l&&Xe(e+M,s+W,T,L,E,I,e+C,s+P,l,!0),M=C,W=P,O=S,A=R,f=g,g+=x;d&&Oe(d,e+C,s+P)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(De,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){Xe(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,f,g,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(f=(-u+m)/(2*c),0<f&&f<1&&d.push(f),g=(-u-m)/(2*c),0<g&&g<1&&d.push(g));l?Ie(h,t,e):Ee(h,t,e),Ie(h,n,a);for(let l=0,c=d.length;l<c;l++)Ye(d[l],t,e,s,i,r,o,n,a,Ue),Ie(h,Ue.x,Ue.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return Ye(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:Ye,toTwoPointBounds:Xe,ellipse:He}=Ne,{sin:Ve,cos:Ge,sqrt:je,atan2:qe}=Math,{ellipse:Qe}=Ne,Je={ellipticalArc(t,s,i,r,o,n,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=n*b,f=Ve(p),g=Ge(p),y=-g*u-f*_,m=-g*_+f*u,x=r*r,w=o*o,v=m*m,k=y*y,S=x*w-x*v-w*k;let R=0;if(S<0){const t=je(1-S/(x*w));r*=t,o*=t}else R=(a===h?-1:1)*je(S/(x*v+w*k));const C=R*r*m/o,P=-R*o*y/r,T=qe((m-P)/o,(y-C)/r),L=qe((-m-P)/o,(-y-C)/r);let E=L-T;0===h&&E>0?E-=B:1===h&&E<0&&(E+=B);const I=s+u+g*C-f*P,O=i+_+f*C+g*P,A=E<0?1:0;c||e.ellipseToCurve?Qe(t,I,O,r,o,n,T/b,L/b,A):r!==o||n?t.push(pe.G,I,O,r,o,n,T/b,L/b,A):t.push(pe.O,I,O,r,T/b,L/b,A)}},{M:$e,m:Ze,L:Ke,l:ts,H:es,h:ss,V:is,v:rs,C:os,c:ns,S:as,s:hs,Q:ls,q:ds,T:cs,t:us,A:_s,a:ps,Z:fs,z:gs,N:ys,D:ms,X:xs,G:ws,F:vs,O:bs,P:Bs,U:ks}=pe,{rect:Ss,roundRect:Rs,arcTo:Cs,arc:Ps,ellipse:Ts,quadraticCurveTo:Ls}=Ne,{ellipticalArc:Es}=Je,Is=Mt.get("PathConvert"),Os={},As={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=we[i],a+=i===r?" ":xe[i];for(let i=1;i<s;i++)a+=w.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?ye:ge;for(let e=0,h=t.length;e<h;e++)i=t[e],Ot[i]?("."===i&&(Ms.dot&&(Ws(n,o),o=""),Ms.dot++),"0"===o&&"."!==i&&(Ws(n,o),o=""),o+=i):pe[i]?(o&&(Ws(n,o),o=""),Ms.name=pe[i],Ms.length=fe[i],Ms.index=0,Ws(n,Ms.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Ws(n,o),o=i):o&&(Ws(n,o),o=""),r=i;return o&&Ws(n,o),s?As.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case Ze:t[c+1]+=a,t[c+2]+=h;case $e:a=t[c+1],h=t[c+2],_.push($e,a,h),c+=3;break;case ss:t[c+1]+=a;case es:a=t[c+1],_.push(Ke,a,h),c+=2;break;case rs:t[c+1]+=h;case is:h=t[c+1],_.push(Ke,a,h),c+=2;break;case ts:t[c+1]+=a,t[c+2]+=h;case Ke:a=t[c+1],h=t[c+2],_.push(Ke,a,h),c+=3;break;case hs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=as;case as:n=o===os||o===as,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(os,l,d,s,i,a,h),c+=5;break;case ns:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=os;case os:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(os,t[c+1],t[c+2],s,i,a,h),c+=7;break;case us:t[c+1]+=a,t[c+2]+=h,r=cs;case cs:n=o===ls||o===cs,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ls(_,a,h,s,i,t[c+1],t[c+2]):_.push(ls,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ds:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ls;case ls:s=t[c+1],i=t[c+2],e?Ls(_,a,h,s,i,t[c+3],t[c+4]):_.push(ls,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ps:t[c+6]+=a,t[c+7]+=h;case _s:Es(_,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 gs:case fs:_.push(fs),c++;break;case ys:a=t[c+1],h=t[c+2],e?Ss(_,a,h,t[c+3],t[c+4]):Ds(_,t,c,5),c+=5;break;case ms:a=t[c+1],h=t[c+2],e?Rs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ds(_,t,c,9),c+=9;break;case xs:a=t[c+1],h=t[c+2],e?Rs(_,a,h,t[c+3],t[c+4],t[c+5]):Ds(_,t,c,6),c+=6;break;case ws:Ts(e?_:Ds(_,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,Os),a=Os.x,h=Os.y,c+=9;break;case vs:e?Ts(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ds(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case bs:Ps(e?_:Ds(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Os),a=Os.x,h=Os.y,c+=7;break;case Bs:e?Ps(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ds(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case ks:Cs(e?_:Ds(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Os),a=Os.x,h=Os.y,c+=6;break;default:return Is.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push($e,t.x,t.y);break;case"L":e.push(Ke,t.x,t.y);break;case"C":e.push(os,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ls,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(fs)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Ms.index===Ms.length&&(Ms.index=1,t.push(Ms.name)),t.push(Number(e)),Ms.index++,Ms.dot=0}},{current:Ms,pushData:Ws,copyData:Ds}=As,{M:Fs,L:zs,C:Us,Q:Ns,Z:Ys,N:Xs,D:Hs,X:Vs,G:Gs,F:js,O:qs,P:Qs,U:Js}=pe,{getMinDistanceFrom:$s,getRadianFrom:Zs}=G,{tan:Ks,min:ti,abs:ei}=Math,si={},ii={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Fs,e,s)},lineTo(t,e,s){t.push(zs,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(Us,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Ns,e,s,i,r)},closePath(t){t.push(Ys)},rect(t,e,s,i,r){t.push(Xs,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(Vs,e,s,i,r,o);else{const n=w.fourNumber(o);n?t.push(Hs,e,s,i,r,...n):t.push(Xs,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){n(o)?t.push(js,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(Gs,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push(Qs,e,s,i):(n(o)&&(o=360),t.push(qs,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h){if(!o(a)){const t=$s(a,h,e,s,i,r);n=ti(n,ti(t/2,t/2*ei(Ks(Zs(a,h,e,s,i,r)/2))))}t.push(Js,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){Ne.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,si),t.push(Fs,si.x,si.y),ri(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){Ne.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,si),t.push(Fs,si.x,si.y),oi(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){Ne.points(t,e,s,i)}},{ellipse:ri,arc:oi}=ii,{moveTo:ni,lineTo:ai,quadraticCurveTo:hi,bezierCurveTo:li,closePath:di,beginPath:ci,rect:ui,roundRect:_i,ellipse:pi,arc:fi,arcTo:gi,drawEllipse:yi,drawArc:mi,drawPoints:xi}=ii;class wi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?ue.parse(t):t:[],this}beginPath(){return ci(this.__path),this.paint(),this}moveTo(t,e){return ni(this.__path,t,e),this.paint(),this}lineTo(t,e){return ai(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return li(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return hi(this.__path,t,e,s,i),this.paint(),this}closePath(){return di(this.__path),this.paint(),this}rect(t,e,s,i){return ui(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return _i(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return pi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return fi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return gi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return yi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return mi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return xi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:vi,L:bi,C:Bi,Q:ki,Z:Si,N:Ri,D:Ci,X:Pi,G:Ti,F:Li,O:Ei,P:Ii,U:Oi}=pe,Ai=Mt.get("PathDrawer"),Mi={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case vi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case bi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Bi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case ki:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Si:t.closePath(),i+=1;break;case Ri:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ci:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case Pi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ti:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*b,e[i+6]*b,e[i+7]*b,e[i+8]),i+=9;break;case Li:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,B,!1),i+=5;break;case Ei:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*b,e[i+5]*b,e[i+6]),i+=7;break;case Ii:t.arc(e[i+1],e[i+2],e[i+3],0,B,!1),i+=4;break;case Oi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Ai.error(`command: ${s} [index:${i}]`,e)}}},{M:Wi,L:Di,C:Fi,Q:zi,Z:Ui,N:Ni,D:Yi,X:Xi,G:Hi,F:Vi,O:Gi,P:ji,U:qi}=pe,{toTwoPointBounds:Qi,toTwoPointBoundsByQuadraticCurve:Ji,arcTo:$i,arc:Zi,ellipse:Ki}=Ne,{addPointBounds:tr,copy:er,addPoint:sr,setPoint:ir,addBounds:rr,toBounds:or}=et,nr=Mt.get("PathBounds");let ar,hr,lr;const dr={},cr={},ur={},_r={toBounds(t,e){_r.toTwoPointBounds(t,cr),or(cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ir(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===Ui||n===Fi||n===zi?ir(e,h,l):ir(e,t[a+1],t[a+2])),n){case Wi:case Di:h=t[a+1],l=t[a+2],sr(e,h,l),a+=3;break;case Fi:r=t[a+5],o=t[a+6],Qi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,dr),tr(e,dr),h=r,l=o,a+=7;break;case zi:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],Ji(h,l,s,i,r,o,dr),tr(e,dr),h=r,l=o,a+=5;break;case Ui:a+=1;break;case Ni:h=t[a+1],l=t[a+2],rr(e,h,l,t[a+3],t[a+4]),a+=5;break;case Yi:case Xi:h=t[a+1],l=t[a+2],rr(e,h,l,t[a+3],t[a+4]),a+=n===Yi?9:6;break;case Hi:Ki(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],dr,ur),0===a?er(e,dr):tr(e,dr),h=ur.x,l=ur.y,a+=9;break;case Vi:h=t[a+1],l=t[a+2],hr=t[a+3],lr=t[a+4],rr(e,h-hr,l-lr,2*hr,2*lr),h+=hr,a+=5;break;case Gi:Zi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],dr,ur),0===a?er(e,dr):tr(e,dr),h=ur.x,l=ur.y,a+=7;break;case ji:h=t[a+1],l=t[a+2],ar=t[a+3],rr(e,h-ar,l-ar,2*ar,2*ar),h+=ar,a+=4;break;case qi:$i(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],dr,ur),0===a?er(e,dr):tr(e,dr),h=ur.x,l=ur.y,a+=6;break;default:return void nr.error(`command: ${n} [index:${a}]`,t)}}},{M:pr,L:fr,Z:gr}=pe,{getCenterX:yr,getCenterY:mr}=G,{arcTo:xr}=ii,wr={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const f=t.length,g=[];for(;n<f;){switch(i=t[n],i){case pr:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===fr?(c=t[n+1],u=t[n+2],g.push(pr,yr(l,c),mr(d,u))):g.push(pr,l,d);break;case fr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case fr:xr(g,a,h,t[n+1],t[n+2],e,_,p);break;case gr:xr(g,a,h,l,d,e,_,p);break;default:g.push(fr,a,h)}_=a,p=h;break;case gr:r!==gr&&(xr(g,l,d,c,u,e,_,p),g.push(gr)),n+=1;break;default:o=we[i];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}r=i}return i!==gr&&(g[1]=l,g[2]=d),g}};function vr(t){return new wi(t)}const br=vr();ue.creator=vr(),ue.parse=As.parse,ue.convertToCanvasData=As.toCanvasData;const{drawRoundRect:Br}=ve;function kr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Br(this,t,e,s,i,r)})}(t)}const Sr={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=Rr.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{}}}},Rr=Sr;Rr.alphaPixelTypes.forEach(t=>Rr.upperCaseTypeMap[t]=t.toUpperCase());const Cr=Mt.get("TaskProcessor");class Pr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Zt(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Cr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Tr{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,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e){let s,i,r,n;const a=new Pr(t);return a.parent=this,l(e)?n=e:e&&(i=e.parallel,s=e.start,r=e.time,n=e.delay),r&&(a.time=r),!1===i&&(a.parallel=!1),o(n)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},n)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],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 Lr=Mt.get("Resource"),Er={tasker:new Tr,map:{},get isComplete(){return Ir.tasker.isComplete},set(t,e){Ir.map[t]&&Lr.repeat(t),Ir.map[t]=e},get:t=>Ir.map[t],remove(t){const e=Ir.map[t];e&&(e.destroy&&e.destroy(),delete Ir.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return a(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=Xt.image(i)),Ir.set(t,e),e},destroy(){Ir.map={}}},Ir=Er,Or={maxRecycled:10,recycledList:[],patternTasker:new Tr,get(t){let e=Er.get(t.url);return e||Er.set(t.url,e=Xt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Ar.recycledList.push(t)})},clearRecycled(){const t=Ar.recycledList;t.length>Ar.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Er.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Sr.alphaPixelTypes.some(e=>Ar.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Sr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Sr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Ar.recycledList=[]}},Ar=Or,{IMAGE:Mr,create:Wr}=s,{floor:Dr,max:Fr}=Math;class zr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Wr(Mr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Or.isFormat("svg",t)&&(this.isSVG=!0),Or.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,s){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:s}=e.origin,i=this.config.showProgress&&s&&this.onProgress.bind(this);i&&(t=s),Er.tasker.add(()=>Zt(this,void 0,void 0,function*(){return yield t(this.url,i).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,s,i,r,o,n,a){if(t||(t=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=e.origin.createCanvas(Fr(Dr(t+(o||0)),1),Fr(Dr(s+(n||0)),1)),l=h.getContext("2d");return i&&(l.globalAlpha=i),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,t,s),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,s,i,r){const o=e.canvas.createPattern(t,s);try{i&&o.setTransform&&(o.setTransform(i),i=void 0)}catch(t){}return r&&p.stintSet(r,"transform",i),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function Ur(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Nr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Yr(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function Xr(t,e){return(s,i)=>Vr(s,i,t,e&&e(i))}function Hr(t){return t}function Vr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Ur(t,e,Object.assign(r,i||{})),xo(t,e,s)}function Gr(t){return Xr(t)}function jr(t,e){return Xr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function qr(t,e){return Xr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function Qr(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),to(this))}}))}function Jr(t,e){return Xr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function $r(t,e){return Xr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Zr(t,e){return Xr(t,t=>({set(s){this.__setAttr(t,s,e)&&to(this)}}))}function Kr(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(to(this),this.__.__removeNaturalSize())}}))}function to(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function eo(t){return Xr(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),to(this)}}))}const so=Zr;function io(t,e){return Xr(t,t=>({set(s){this.__setAttr(t,s)&&(ro(this),e&&(this.__.__useStroke=!0))}}))}function ro(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&to(t)}const oo=io;function no(t){return Xr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ao(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function ho(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&co(this)}}))}function lo(t){return Xr(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>uo(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");uo(this,t,e,s),this.mask&&co(this)}}))}function co(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function uo(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||to(t))}function _o(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function po(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function fo(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function go(t){return Xr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Mt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function yo(t){return Xr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function mo(t){return(e,s)=>{Ur(e,"__DataProcessor",{get:()=>t})}}function xo(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Yr(e,s);if(o(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){const t=this[r];return null==t?s(this.__leaf):t};else if(u(s)){const t=_(s);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];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[r];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,d=i;for(;!l&&d;)l=Nr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[n]&&(a.set=i[n],delete i[n]),Ur(i,e,a)}const wo=new Mt("rewrite"),vo=[],bo=["destroy","constructor"];function Bo(t){return(e,s)=>{vo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function ko(){return t=>{So()}}function So(t){vo.length&&(vo.forEach(e=>{t&&wo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),vo.length=0)}function Ro(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(bo.includes(i)||e&&e.includes(i)))if(t.prototype){Nr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function Co(){return t=>{Vt.register(t)}}setTimeout(()=>So(!0));const{copy:Po,toInnerPoint:To,toOuterPoint:Lo,scaleOfOuter:Eo,rotateOfOuter:Io,skewOfOuter:Oo,multiplyParent:Ao,divideParent:Mo,getLayout:Wo}=M,Do={},{round:Fo}=Math,zo={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Yo(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)No(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.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,s=e.length;t<s;t++)Xo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Xo(t),t.__updateChange()},updateAllChange(t){if(Vo(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ho(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,s,i,r,o,n){r||(r=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?s.copyWorldByReset(i,r,t.__nowWorld,o,n):s.copyWorldToInner(i,r,t.__layout.renderBounds,o)},moveWorld(t,e,s=0,i,r){const o=u(e)?Object.assign({},e):{x:e,y:s};i?Lo(t.localTransform,o,o,!0):t.parent&&To(t.parent.scrollWorldTransform,o,o,!0),Uo.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){u(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Fo(e),s=Fo(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){Uo.zoomOfLocal(t,Go(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(l(i)||(i&&(o=i),i=s),Po(Do,n),Eo(Do,e,s,i),Uo.hasHighPosition(t))Uo.setTransform(t,Do,r,o);else{const e=t.x+Do.e-n.e,a=t.y+Do.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){Uo.rotateOfLocal(t,Go(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Po(Do,r),Io(Do,e,s),Uo.hasHighPosition(t)?Uo.setTransform(t,Do,!1,i):t.set({x:t.x+Do.e-r.e,y:t.y+Do.f-r.f,rotation:w.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){Uo.skewOfLocal(t,Go(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Po(Do,t.__localMatrix),Oo(Do,e,s,i),Uo.setTransform(t,Do,r,o)},transformWorld(t,e,s,i){Po(Do,t.worldTransform),Ao(Do,e),t.parent&&Mo(Do,t.parent.scrollWorldTransform),Uo.setTransform(t,Do,s,i)},transform(t,e,s,i){Po(Do,t.localTransform),Ao(Do,e),Uo.setTransform(t,Do,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&Uo.getInnerOrigin(t,r.origin),n=Wo(e,o,r.around&&Uo.getInnerOrigin(t,r.around));if(Uo.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=Uo.getInnerOrigin(t,r.origin);G.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return Eo(s,Uo.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>G.tempToOuterOf(Uo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return nt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Po(Do,t.worldTransform),Mo(Do,e.scrollWorldTransform),s?Do:Object.assign({},Do)),drop(t,e,s,i){t.setTransform(Uo.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||Uo.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,s,i=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)t.move(s);else{const r=s.x*i,o=s.y*i;s.x-=r,s.y-=o,t.move(r,o),e.requestRender(()=>Uo.animateMove(t,s,i))}}},Uo=zo,{updateAllMatrix:No,updateMatrix:Yo,updateAllWorldOpacity:Xo,updateAllChange:Ho,updateChange:Vo}=Uo;function Go(t,e){return t.updateLayout(),t.parent?G.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const jo={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)=>Qo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Qo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>Qo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let qo;function Qo(t,e){return e||(qo=0),t.__.mask&&(qo=1),qo<0?null:(qo&&(qo=-1),!0)}const{updateBounds:Jo}=zo,$o={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:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),Zo(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&o(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 s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)Ko(e[t],e)},updateBounds(t,e){const s=[t];Ko(t,s),tn(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)Jo(i[t]);e&&e===s||Jo(s)}}},{pushAllChildBranch:Zo,pushAllBranchStack:Ko,updateBoundsByBranchStack:tn}=$o,en={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:sn,updateBounds:rn}=zo,{toOuterOf:on,getPoints:nn,copy:an}=Rt,hn="_localContentBounds",ln="_worldContentBounds",dn="_worldBoxBounds",cn="_worldStrokeBounds";class un{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 on(this.contentBounds,this.leaf.__localMatrix,this[hn]||(this[hn]={})),this[hn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return on(this.contentBounds,this.leaf.__world,this[ln]||(this[ln]={})),this[ln]}get worldBoxBounds(){return on(this.boxBounds,this.leaf.__world,this[dn]||(this[dn]={})),this[dn]}get worldStrokeBounds(){return on(this.strokeBounds,this.leaf.__world,this[cn]||(this[cn]={})),this[cn]}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:s}=t;if(t.isApp)return rn(t);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=t;for(;s.parent&&!s.parent.leafer;)s=s.parent;const i=s;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.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 M.defaultMatrix;case"page":t=e.zoomLayer;default:return sn(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Lt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=M.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=sn(i,e,!0)}if(n||(n=M.getLayout(o)),an(n,a),G.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=nn(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:r=e}return o(r)||i.forEach(t=>s.innerToWorld(t,null,!1,r)),i}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}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 _n{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class pn extends _n{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}pn.ADD="child.add",pn.REMOVE="child.remove",pn.CREATED="created",pn.MOUNTED="mounted",pn.UNMOUNTED="unmounted",pn.DESTROY="destroy";const fn="property.scroll";class gn extends _n{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}gn.CHANGE="property.change",gn.LEAFER_CHANGE="property.leafer_change",gn.SCROLL=fn;const yn={scrollX:fn,scrollY:fn};class mn extends _n{constructor(t,e){super(t),Object.assign(this,e)}}mn.LOAD="image.load",mn.LOADED="image.loaded",mn.ERROR="image.error";class xn extends _n{static checkHas(t,e,s){"on"===s?e===Bn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(wn)||t.hasEvent(vn)||t.hasEvent(bn),t.__hasWorldEvent=t.hasEvent(Bn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(wn,t),"inner"===e&&t.emit(vn,t)),t.emit(bn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Bn,this)}}xn.RESIZE="bounds.resize",xn.INNER="bounds.inner",xn.LOCAL="bounds.local",xn.WORLD="bounds.world";const{RESIZE:wn,INNER:vn,LOCAL:bn,WORLD:Bn}=xn,kn={};[wn,vn,bn,Bn].forEach(t=>kn[t]=1);class Sn extends _n{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){u(t)?(super(Sn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Sn.RESIZE="resize";class Rn extends _n{constructor(t,e){super(t),this.data=e}}Rn.REQUEST="watch.request",Rn.DATA="watch.data";class Cn extends _n{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Cn.REQUEST="layout.request",Cn.START="layout.start",Cn.BEFORE="layout.before",Cn.LAYOUT="layout",Cn.AFTER="layout.after",Cn.AGAIN="layout.again",Cn.END="layout.end";class Pn extends _n{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Pn.REQUEST="render.request",Pn.CHILD_START="render.child_start",Pn.CHILD_END="render.child_end",Pn.START="render.start",Pn.BEFORE="render.before",Pn.RENDER="render",Pn.AFTER="render.after",Pn.AGAIN="render.again",Pn.END="render.end",Pn.NEXT="render.next";class Tn extends _n{}Tn.START="leafer.start",Tn.BEFORE_READY="leafer.before_ready",Tn.READY="leafer.ready",Tn.AFTER_READY="leafer.after_ready",Tn.VIEW_READY="leafer.view_ready",Tn.VIEW_COMPLETED="leafer.view_completed",Tn.STOP="leafer.stop",Tn.RESTART="leafer.restart",Tn.END="leafer.end",Tn.TRANSFORM="leafer.transform",Tn.MOVE="leafer.move",Tn.SCALE="leafer.scale",Tn.ROTATE="leafer.rotate",Tn.SKEW="leafer.skew";const{MOVE:Ln,SCALE:En,ROTATE:In,SKEW:On}=Tn,An={x:Ln,y:Ln,scaleX:En,scaleY:En,rotation:In,skewX:On,skewY:On},Mn={};class Wn{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(c(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)c(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,o;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Dn(this,i,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=n[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):n[t]=[l],kn[t]&&xn.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=a(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Dn(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],kn[t]&&xn.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):c(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:i}}off_(t){if(!t)return;const e=c(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):c(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return c(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));u(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const i=Dn(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}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:i}=this,r=s&&s[t],n=i&&i[t];return!!(o(e)?r||n:e?n:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Dn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Mn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Mn)}}const{on:Fn,on_:zn,off:Un,off_:Nn,once:Yn,emit:Xn,emitEvent:Hn,hasEvent:Vn,destroy:Gn}=Wn.prototype,jn={on:Fn,on_:zn,off:Un,off_:Nn,once:Yn,emit:Xn,emitEvent:Hn,hasEvent:Vn,destroyEventer:Gn},qn=Mt.get("setAttr"),Qn={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||o(e)||(qn.warn(this.innerName,t,e),e=void 0),u(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new gn(gn.LEAFER_CHANGE,this,t,i,e));const s=An[t];s&&(this.emitEvent(new Tn(s,this)),this.emitEvent(new Tn(Tn.TRANSFORM,this)))}this.emitPropertyEvent(gn.CHANGE,t,i,e);const s=yn[t];return s&&this.emitPropertyEvent(s,t,i,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new gn(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||o(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Jn,multiplyParent:$n,translateInner:Zn,defaultWorld:Kn}=M,{toPoint:ta,tempPoint:ea}=nt,sa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;$n(this.__local||e,t?t.__scrollWorld||t.__world:Kn,s,!!e.affectScaleOrRotation,r),i&&Zn(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Jn(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(ta(s.around||s.origin,t.boxBounds,ea),Zn(e,-ea.x,-ea.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ia,updateAllMatrix:ra}=zo,{updateBounds:oa}=$o,{toOuterOf:na,copyAndSpread:aa,copy:ha}=Rt,{toBounds:la}=_r,da={__updateWorldBounds(){const t=this.__layout;na(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&xn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&xn.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(),na(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){na(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){na(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?la(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ra(this),oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ra(this),oa(this,this))):ia(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;aa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?aa(e.renderBounds,e.boxBounds,e.renderSpread):ha(e.renderBounds,e.strokeBounds)}},ca={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),zo.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Mt.showBounds&&Mt.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:ua}=jo,_a={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)ua(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)ua(s[i],e)||s[i].__clip(t,e)}}},pa={},{LEAF:fa,create:ga}=s,{toInnerPoint:ya,toOuterPoint:ma,multiplyParent:xa}=M,{toOuterOf:wa}=Rt,{copy:va,move:ba}=G,{moveLocal:Ba,zoomOfLocal:ka,rotateOfLocal:Sa,skewOfLocal:Ra,moveWorld:Ca,zoomOfWorld:Pa,rotateOfWorld:Ta,skewOfWorld:La,transform:Ea,transformWorld:Ia,setTransform:Oa,getFlipTransform:Aa,getLocalOrigin:Ma,getRelativeWorld:Wa,drop:Da}=zo;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return un}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=ga(fa),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(pn.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(pn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(pn.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}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(pn.MOUNTED)):this.__emitLifeEvent(pn.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.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,s=this.__world;return xa(s,t.matrix,e,void 0,s),wa(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:i}=Or.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),pa.scaleX=s,pa.scaleY=i,pa}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?Wa(this,e):this.worldTransform,r=s?t:{};return wa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&va(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&va(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),ya(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){ma(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return ba(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return ba(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){Oa(this,t,e,s)}transform(t,e,s){Ea(this,t,e,s)}move(t,e,s){Ba(this,t,e,s)}moveInner(t,e,s){Ca(this,t,e,!0,s)}scaleOf(t,e,s,i,r){ka(this,Ma(this,t),e,s,i,r)}rotateOf(t,e,s){Sa(this,Ma(this,t),e,s)}skewOf(t,e,s,i,r){Ra(this,Ma(this,t),e,s,i,r)}transformWorld(t,e,s){Ia(this,t,e,s)}moveWorld(t,e,s){Ca(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Pa(this,t,e,s,i,r)}rotateOfWorld(t,e){Ta(this,t,e)}skewOfWorld(t,e,s,i,r){La(this,t,e,s,i,r)}flip(t,e){Ea(this,Aa(this,t),!1,e)}scaleResize(t,e=t,s){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,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Yt.need("path")}getMotionPoint(t){return Yt.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,s){Da(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):xo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=Zr),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new pn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(pn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=$t([Ro(Qn),Ro(sa),Ro(da),Ro(jn),Ro(ca)],t.Leaf);const{setListWithFn:Fa}=Rt,{sort:za}=$o,{localBoxBounds:Ua,localStrokeBounds:Na,localRenderBounds:Ya,maskLocalBoxBounds:Xa,maskLocalStrokeBounds:Ha,maskLocalRenderBounds:Va}=jo,Ga=new Mt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){Fa(e||this.__layout.boxBounds,this.children,this.__hasMask?Xa:Ua)}__updateStrokeBounds(t){Fa(t||this.__layout.strokeBounds,this.children,this.__hasMask?Ha:Na)}__updateRenderBounds(t){Fa(t||this.__layout.renderBounds,this.children,this.__hasMask?Va:Ya)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(za),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ga.warn("add self or destroyed");const s=o(e);if(!t.__){if(c(t))return t.forEach(t=>{this.add(t,e),s||e++});t=Vt.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 i=t.__layout;i.boxChanged||i.boxChange(),i.matrixChanged||i.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(pn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(pn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,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(pn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(pn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new pn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=$t([Ro(_a)],t.Branch);class ja{get length(){return this.list.length}constructor(t){this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:s}=this;o(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(o(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;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 i=0,r=e.length;i<r;i++)o(s)?e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]):this.keys[e[i].innerId]=i-1;o(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 ja;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class qa{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const Qa=Mt.get("LeaferCanvas");class Ja extends ce{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,s=t.view||t.canvas;s?this.__createViewFrom(s):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.syncDomFont&&!this.parentView&&(i.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=a(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else Qa.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:s}=this;t.width?(o(e)&&(this.autoWidthStr=i.width||""),i.width=t.width+"px"):o(e)||(i.width=e),t.height?(o(s)&&(this.autoHeightStr=i.height||""),i.height=t.height+"px"):o(s)||(i.height=s)}else i.width=t+"px",i.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),Qa.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=e.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const s=this.view,{x:i,y:r,width:o,height:n}=this.autoBounds.getBoundsFrom(t),a={width:o,height:n,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=s;t.marginLeft=i+"px",t.marginTop=r+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};p.copyAttrs(e,this,de),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new Sn(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}kr(CanvasRenderingContext2D.prototype),kr(Path2D.prototype);const{mineType:$a,fileType:Za}=Sr;function Ka(t,s){e.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=$a(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,$a(e),s)),canvasSaveAs:(t,s,i)=>{const r=t.toDataURL($a(Za(s)),i);return e.origin.download(r,s)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((s,i)=>{const r=new e.origin.Image,{crossOrigin:o}=e.image;o&&(r.setAttribute("crossOrigin",o),r.crossOrigin=o),r.onload=()=>{s(r)},r.onerror=t=>{i(t)},r.src=e.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.canvas=Xt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Xt,{canvas:(t,e)=>new Ja(t,e),image:t=>new zr(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},Ur(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:th}=navigator;th.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0,e.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),th.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):th.indexOf("Mac")>-1?e.os="Mac":th.indexOf("Linux")>-1&&(e.os="Linux");class eh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ja;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ja,this.target=t,e&&(this.config=p.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(Pn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===pn.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,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Rn(Rn.DATA,{updatedList:this.updatedList})),this.__updatedList=new ja,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[gn.CHANGE,this.__onAttrChange,this],[[pn.ADD,pn.REMOVE],this.__onChildEvent,this],[Rn.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:ih,updateChange:rh}=zo,{pushAllChildBranch:oh,pushAllParent:nh}=$o;const{worldBounds:ah}=jo;class hh{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,c(t)&&(t=new ja(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,ah)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,ah),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:dh}=zo,ch=Mt.get("Layouter");class uh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new qa,this.target=t,e&&(this.config=p.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(Cn.START),this.layoutOnce(),t.emitEvent(new Cn(Cn.END,this.layoutedBlocks,this.times))}catch(t){ch.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?ch.warn("layouting"):this.times>3?ch.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Rn.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=zt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Cn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Cn(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(sh(t,!0),e.add(t),t.isBranch&&oh(t,e),nh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),nh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||ih(i[t])}ih(s)}})}(this.__levelList),function(t){t.list.forEach(rh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Cn(o,a,this.times)),s.emitEvent(new Cn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,zt.end(e)}fullLayout(){const t=zt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Cn,o=this.getBlocks(new ja(e));e.emitEvent(new Cn(s,o,this.times)),uh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Cn(i,o,this.times)),e.emitEvent(new Cn(r,o,this.times)),this.addBlocks(o),zt.end(t)}static fullLayout(t){lh(t,!0),t.isBranch?$o.updateBounds(t):zo.updateBounds(t),dh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new hh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new hh(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_([[Cn.REQUEST,this.layout,this],[Cn.AGAIN,this.layoutAgain,this],[Rn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const _h=Mt.get("Renderer");class ph{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.target=t,this.canvas=e,s&&(this.config=p.default(s,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(Cn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Pn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Pn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Pn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,_h.log(e.innerName,"---\x3e");try{this.emitRender(Pn.START),this.renderOnce(t),this.emitRender(Pn.END,this.totalBounds),Or.clearRecycled()}catch(t){this.rendering=!1,_h.error(t)}_h.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return _h.warn("rendering");if(this.times>3)return _h.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Pn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Pn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Pn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Pn.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=zt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Lt(i);s.save(),i.spread(ph.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),zt.end(e)}fullRender(){const t=zt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),zt.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Mt.showRepaint&&Mt.drawRepaint(s,t),this.target.__render(s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);const s=this.requestTime=Date.now(),i=()=>{const t=1e3/(Date.now()-s),{maxFPS:r}=this.config;if(r&&t>r-.5)return e.requestRender(i);this.FPS=Math.min(120,Math.ceil(t)),this.requestTime=0,this.checkRender()};e.requestRender(i)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Lt(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Lt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||_h.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Pn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Pn.REQUEST,this.update,this],[Cn.END,this.__onLayoutEnd,this],[Pn.AGAIN,this.renderAgain,this],[Sn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function fh(t){return Xr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function gh(t){return Xr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function yh(){return(t,e)=>{const s="_"+e;Ur(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}ph.clipSpread=10,Object.assign(Xt,{watcher:(t,e)=>new eh(t,e),layouter:(t,e)=>new uh(t,e),renderer:(t,e,s)=>new ph(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),e.layout=uh.fullLayout;const mh={},xh={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}},wh={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},vh={},bh={},Bh={},kh={},Sh={},Rh={apply(){Yt.need("filter")}},Ch={},Ph={setStyleName:()=>Yt.need("state"),set:()=>Yt.need("state")},Th={list:{},register(t,e){Th.list[t]=e},get:t=>Th.list[t]},{parse:Lh,objectToCanvasData:Eh}=As,{stintSet:Ih}=p,{hasTransparent:Oh}=xh,Ah={},Mh=Mt.get("UIData");class Wh extends g{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,Mh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Mh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Ih(this,"__isTransparentFill",Oh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):u(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Ih(this,"__isTransparentStroke",Oh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):u(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&u(t[0])?(this.__setInput("path",t),this._path=e?Lh(t):Eh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Dh(this,"shadow",t)}setInnerShadow(t){Dh(this,"innerShadow",t)}setFilter(t){Dh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&bh.compute("fill",this.__leaf),e&&bh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(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 s=this.__leaf.__layout;s.boxChanged||s.boxChange(),c(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Ah)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ah))}__removePaint(t,e){e&&this.__removeInput(t),Bh.recycleImage(t,this),"fill"===t?(Ih(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Ih(this,"__isAlphaPixelStroke",void 0),Ih(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Dh(t,e,s){t.__setInput(e,s),c(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class Fh extends Wh{}class zh extends Fh{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 Uh extends Fh{__getInputData(t,e){const s=super.__getInputData(t,e);return de.forEach(t=>delete s[t]),s}}class Nh extends zh{}class Yh extends Wh{get __usePathBox(){return this.points||this.__pathInputed}}class Xh extends Wh{get __boxStroke(){return!this.__pathInputed}}class Hh extends Wh{get __boxStroke(){return!this.__pathInputed}}class Vh extends Yh{}class Gh extends Wh{}class jh extends Wh{get __pathInputed(){return 2}}class qh extends Fh{}const Qh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Jh extends Wh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Qh[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=Vt.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange(),o.renderChanged&&r.renderChange(),s.__updateChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class $h extends Xh{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class Zh extends Xh{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const Kh={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),e=o.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),i&&(t=Math.max(t,i)),o&&(t+=Rh.getSpread(o)),n&&(t+=n);let a=t=Math.ceil(t);return s&&s.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},tl={getValidMove(t,e,s,i,r){const o=t.x+i.x,n=t.y+i.y,a=o+t.width,h=n+t.height,l=e.x+e.width,d=e.y+e.height;r||(i=Object.assign({},i));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==s?o>e.x?i.x+=e.x-o:a<l&&(i.x+=l-a):o<e.x?i.x+=e.x-o:a>l&&(i.x+=l-a),u&&"outer"!==s?n>e.y?i.y+=e.y-n:h<d&&(i.y+=d-h):n<e.y?i.y+=e.y-n:h>d&&(i.y+=d-h),i.x=w.float(i.x),i.y=w.float(i.y),i},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},limitMove(t,e){const{dragBounds:s,dragBoundsType:i}=t;s&&el.getValidMove(t.__localBoxBounds,"parent"===s?t.parent.boxBounds:s,i,e,!0),el.axisMove(t,e)}},el=tl,{stintSet:sl}=p,il={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);sl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),sl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;sl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&s&&!t.__isTransparentFill&&!(c(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),sl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){rl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=bh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Sh.shadow(this,t,h),a&&(i.__isStrokes?bh.strokes(o,this,t):bh.stroke(o,this,t)),r&&(i.__isFills?bh.fills(r,this,t):bh.fill(r,this,t)),n&&this.__drawAfterFill(t,e),d&&Sh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?bh.strokes(o,this,t):bh.stroke(o,this,t)),c&&Rh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?bh.strokes(o,this,t):bh.stroke(o,this,t)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,xh.string(e.color))}r&&(i.__isFills?bh.fills(r,this,t):bh.fill(r,this,t)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?bh.strokes(o,this,t):bh.stroke(o,this,t))}}else i.__pathInputed?rl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?bh.fills(i,this,t):bh.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?bh.strokes(r,this,t):bh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function rl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&bh.stroke(r,t,e),i&&bh.fill(i,t,e),o&&t.__drawAfterFill(e,s),r&&!n&&bh.stroke(r,t,e)}const ol={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var nl,al;t.UI=nl=class extends t.Leaf{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 br.set(this.path=t||[]),t||this.__drawPathByBox(br),br}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Yt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Yt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(br.set(s=[]),this.__drawPathByBox(br)),t?As.toCanvasData(s,!0):s}getPathString(t,e,s){return As.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Ch.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?wr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&vh.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?Mi.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,l(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e){bh.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return this.set(t),Yt.need("animate")}killAnimate(t,e){}export(t,e){return Yt.need("export")}syncExport(t,e){return Yt.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),nl.one(e)}static one(t,e,s,i,r){return Vt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){Co()(this)}static registerData(t){mo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},$t([mo(Wh)],t.UI.prototype,"__",void 0),$t([yh()],t.UI.prototype,"zoomLayer",void 0),$t([Gr("")],t.UI.prototype,"id",void 0),$t([Gr("")],t.UI.prototype,"name",void 0),$t([Gr("")],t.UI.prototype,"className",void 0),$t([ao("pass-through")],t.UI.prototype,"blendMode",void 0),$t([ho(1)],t.UI.prototype,"opacity",void 0),$t([lo(!0)],t.UI.prototype,"visible",void 0),$t([ao(!1)],t.UI.prototype,"locked",void 0),$t([ao(!1)],t.UI.prototype,"dim",void 0),$t([ao(!1)],t.UI.prototype,"dimskip",void 0),$t([_o(0)],t.UI.prototype,"zIndex",void 0),$t([po(!1)],t.UI.prototype,"mask",void 0),$t([fo(!1)],t.UI.prototype,"eraser",void 0),$t([jr(0,!0)],t.UI.prototype,"x",void 0),$t([jr(0,!0)],t.UI.prototype,"y",void 0),$t([Zr(100,!0)],t.UI.prototype,"width",void 0),$t([Zr(100,!0)],t.UI.prototype,"height",void 0),$t([Jr(1,!0)],t.UI.prototype,"scaleX",void 0),$t([Jr(1,!0)],t.UI.prototype,"scaleY",void 0),$t([$r(0,!0)],t.UI.prototype,"rotation",void 0),$t([$r(0,!0)],t.UI.prototype,"skewX",void 0),$t([$r(0,!0)],t.UI.prototype,"skewY",void 0),$t([jr(0,!0)],t.UI.prototype,"offsetX",void 0),$t([jr(0,!0)],t.UI.prototype,"offsetY",void 0),$t([qr(0,!0)],t.UI.prototype,"scrollX",void 0),$t([qr(0,!0)],t.UI.prototype,"scrollY",void 0),$t([Qr()],t.UI.prototype,"origin",void 0),$t([Qr()],t.UI.prototype,"around",void 0),$t([Gr(!1)],t.UI.prototype,"lazy",void 0),$t([Kr(1)],t.UI.prototype,"pixelRatio",void 0),$t([no(0)],t.UI.prototype,"renderSpread",void 0),$t([eo()],t.UI.prototype,"path",void 0),$t([so()],t.UI.prototype,"windingRule",void 0),$t([so(!0)],t.UI.prototype,"closed",void 0),$t([Zr(0)],t.UI.prototype,"padding",void 0),$t([Zr(!1)],t.UI.prototype,"lockRatio",void 0),$t([Zr()],t.UI.prototype,"widthRange",void 0),$t([Zr()],t.UI.prototype,"heightRange",void 0),$t([Gr(!1)],t.UI.prototype,"draggable",void 0),$t([Gr()],t.UI.prototype,"dragBounds",void 0),$t([Gr("auto")],t.UI.prototype,"dragBoundsType",void 0),$t([Gr(!1)],t.UI.prototype,"editable",void 0),$t([go(!0)],t.UI.prototype,"hittable",void 0),$t([go("path")],t.UI.prototype,"hitFill",void 0),$t([oo("path")],t.UI.prototype,"hitStroke",void 0),$t([go(!1)],t.UI.prototype,"hitBox",void 0),$t([go(!0)],t.UI.prototype,"hitChildren",void 0),$t([go(!0)],t.UI.prototype,"hitSelf",void 0),$t([go()],t.UI.prototype,"hitRadius",void 0),$t([yo("")],t.UI.prototype,"cursor",void 0),$t([ao()],t.UI.prototype,"fill",void 0),$t([oo(void 0,!0)],t.UI.prototype,"stroke",void 0),$t([oo("inside")],t.UI.prototype,"strokeAlign",void 0),$t([oo(1,!0)],t.UI.prototype,"strokeWidth",void 0),$t([oo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),$t([oo("none")],t.UI.prototype,"strokeCap",void 0),$t([oo("miter")],t.UI.prototype,"strokeJoin",void 0),$t([oo()],t.UI.prototype,"dashPattern",void 0),$t([oo(0)],t.UI.prototype,"dashOffset",void 0),$t([oo(10)],t.UI.prototype,"miterLimit",void 0),$t([so(0)],t.UI.prototype,"cornerRadius",void 0),$t([so()],t.UI.prototype,"cornerSmoothing",void 0),$t([fh()],t.UI.prototype,"shadow",void 0),$t([fh()],t.UI.prototype,"innerShadow",void 0),$t([fh()],t.UI.prototype,"blur",void 0),$t([fh()],t.UI.prototype,"backgroundBlur",void 0),$t([fh()],t.UI.prototype,"grayscale",void 0),$t([fh()],t.UI.prototype,"filter",void 0),$t([ao()],t.UI.prototype,"placeholderColor",void 0),$t([Gr(100)],t.UI.prototype,"placeholderDelay",void 0),$t([Gr({})],t.UI.prototype,"data",void 0),$t([Bo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=nl=$t([Ro(Kh),Ro(il),ko()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}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(){}},$t([mo(Fh)],t.Group.prototype,"__",void 0),$t([Zr(0)],t.Group.prototype,"width",void 0),$t([Zr(0)],t.Group.prototype,"height",void 0),t.Group=$t([Ro(t.Branch),Co()],t.Group);const hl=Mt.get("Leafer");t.Leafer=al=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Er.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),al.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(i,t));const r=this.canvas=Xt.canvas(i);this.__controllers.push(this.renderer=Xt.renderer(this,r,i),this.watcher=Xt.watcher(this,i),this.layouter=Xt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=Xt.selector(this),this.interaction=Xt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Xt.hitCanvasManager()),this.canvasManager=new Jt,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),en.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(Tn.RESTART):this.emitLeafer(Tn.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(Tn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,de);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Lt(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.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 s=p.copyAttrs({},this.canvas,de);e.resize(t),this.updateLazyBounds(),this.__onResize(new Sn(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,de),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 It(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(de.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t&&(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&de.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=p.copyAttrs({},i,de);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__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(Tn.BEFORE_READY),this.emitLeafer(Tn.READY),this.emitLeafer(Tn.AFTER_READY),en.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Tn.VIEW_READY),en.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){en.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(Tn.VIEW_COMPLETED),en.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,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return Yt.need("view")}getValidMove(t,e,s){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:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Tn(t,this))}__listenEvents(){const t=zt.start("FirstCreate "+this.innerName);this.once([[Tn.START,()=>zt.end(t)],[Cn.START,this.updateLazyBounds,this],[Pn.START,this.__onCreated,this],[Pn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Rn.DATA,this.__onWatchData,this],[Cn.END,this.__onLayoutEnd,this],[Pn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){al.list.remove(this);try{this.stop(),this.emitLeafer(Tn.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(()=>{Or.clearRecycled()},100)}catch(t){hl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ja,$t([mo(Uh)],t.Leafer.prototype,"__",void 0),$t([Zr()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=al=$t([Co()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},$t([mo(Xh)],t.Rect.prototype,"__",void 0),t.Rect=$t([Ro(ol),ko(),Co()],t.Rect);const{add:ll,includes:dl,scroll:cl}=Rt,ul=t.Rect.prototype,_l=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const s=this.__,i=this.__layout,{renderBounds:r,boxBounds:o}=i,{overflow:n}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n.includes("scroll"))&&(ll(a,o),cl(a,s)),this.__updateRectRenderBounds(),t=!dl(o,a),t&&"show"===n&&ll(r,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},$t([mo(zh)],t.Box.prototype,"__",void 0),$t([Zr(100)],t.Box.prototype,"width",void 0),$t([Zr(100)],t.Box.prototype,"height",void 0),$t([Gr(!1)],t.Box.prototype,"resizeChildren",void 0),$t([no("show")],t.Box.prototype,"overflow",void 0),$t([Bo(ul.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),$t([Bo(ul.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),$t([Bo(ul.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),$t([Bo(ul.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),$t([Bo(ul.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),$t([Bo(ul.__updateChange)],t.Box.prototype,"__updateRectChange",null),$t([Bo(ul.__render)],t.Box.prototype,"__renderRect",null),$t([Bo(_l.__render)],t.Box.prototype,"__renderGroup",null),t.Box=$t([ko(),Co()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},$t([mo(Nh)],t.Frame.prototype,"__",void 0),$t([ao("#FFFFFF")],t.Frame.prototype,"fill",void 0),$t([no("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=$t([Co()],t.Frame);const{moveTo:pl,closePath:fl,ellipse:gl}=ii;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:s,innerRadius:i,startAngle:r,endAngle:o}=this.__,n=t/2,a=s/2,h=this.__.path=[];i?(r||o?(i<1&&gl(h,n,a,n*i,a*i,0,r,o,!1),gl(h,n,a,n,a,0,o,r,!0),i<1&&fl(h)):(i<1&&(gl(h,n,a,n*i,a*i),pl(h,t,a)),gl(h,n,a,n,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(pl(h,n,a),gl(h,n,a,n,a,0,r,o,!1),fl(h)):gl(h,n,a,n,a)}},$t([mo(Hh)],t.Ellipse.prototype,"__",void 0),$t([so(0)],t.Ellipse.prototype,"innerRadius",void 0),$t([so(0)],t.Ellipse.prototype,"startAngle",void 0),$t([so(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=$t([Co()],t.Ellipse);const{moveTo:yl,lineTo:ml,drawPoints:xl}=ii,{rotate:wl,getAngle:vl,getDistance:bl,defaultPoint:Bl}=G;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&wl(s,e),s}set toPoint(t){this.width=bl(Bl,t),this.rotation=vl(Bl,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?xl(e,t.points,t.curve,t.closed):(yl(e,0,0),ml(e,this.width,0))}},$t([mo(Yh)],t.Line.prototype,"__",void 0),$t([io("center")],t.Line.prototype,"strokeAlign",void 0),$t([Zr(0)],t.Line.prototype,"height",void 0),$t([so()],t.Line.prototype,"points",void 0),$t([so(0)],t.Line.prototype,"curve",void 0),$t([so(!1)],t.Line.prototype,"closed",void 0),t.Line=$t([Co()],t.Line);const{sin:kl,cos:Sl,PI:Rl}=Math,{moveTo:Cl,lineTo:Pl,closePath:Tl,drawPoints:Ll}=ii,El=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ll(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Cl(e,o,0);for(let t=1;t<r;t++)Pl(e,o+o*kl(2*t*Rl/r),n-n*Sl(2*t*Rl/r));Tl(e)}}__updateRenderPath(){}__updateBoxBounds(){}},$t([mo(Vh)],t.Polygon.prototype,"__",void 0),$t([so(3)],t.Polygon.prototype,"sides",void 0),$t([so()],t.Polygon.prototype,"points",void 0),$t([so(0)],t.Polygon.prototype,"curve",void 0),$t([Bo(El.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),$t([Bo(El.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=$t([ko(),Co()],t.Polygon);const{sin:Il,cos:Ol,PI:Al}=Math,{moveTo:Ml,lineTo:Wl,closePath:Dl}=ii;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Ml(n,r,0);for(let t=1;t<2*s;t++)Wl(n,r+(t%2==0?r:r*i)*Il(t*Al/s),o-(t%2==0?o:o*i)*Ol(t*Al/s));Dl(n)}},$t([mo(Gh)],t.Star.prototype,"__",void 0),$t([so(5)],t.Star.prototype,"corners",void 0),$t([so(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=$t([Co()],t.Star),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return c(t)&&t[0].image}},$t([mo($h)],t.Image.prototype,"__",void 0),$t([Zr("")],t.Image.prototype,"url",void 0),t.Image=$t([Co()],t.Image);const Fl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Xt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new zr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new mn(mn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new K(t.worldTransform).invert(),o=new K;e&&o.translate(e.x,e.y),s&&(l(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},$t([mo(Zh)],t.Canvas.prototype,"__",void 0),$t([gh(100)],t.Canvas.prototype,"width",void 0),$t([gh(100)],t.Canvas.prototype,"height",void 0),$t([gh(1)],t.Canvas.prototype,"pixelRatio",void 0),$t([gh(!0)],t.Canvas.prototype,"smooth",void 0),$t([Gr(!1)],t.Canvas.prototype,"safeResize",void 0),$t([gh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=$t([Co()],t.Canvas);const{copyAndSpread:zl,includes:Ul,spread:Nl,setList:Yl}=Rt;function Xl(t,e){const s=t.__,{rows:i,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,s=i.length;t<s;t++)o=i[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:o}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,o)))}}function Hl(t,e){t.__.__font?Xl(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Vl(t,e,s){switch(e.__.strokeAlign){case"center":Gl(t,1,e,s);break;case"inside":jl(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?Gl(t,2,e,s):jl(t,"outside",e,s)}}function Gl(t,e,s,i){const r=s.__;u(t)?Ql(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),ql(s,i))}function jl(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,Gl(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",Xl(s,r),r.blendMode="normal",zo.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function ql(t,e){let s,i=t.__.__textDrawData;const{rows:r,decorationY:o}=i;for(let t=0,i=r.length;t<i;t++)s=r[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(o){const{decorationHeight:t}=i;r.forEach(s=>o.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}}function Ql(t,e,s,i,r){let o;const n=i.__,{__hasMultiStrokeStyle:a}=n;a||r.setStroke(void 0,n.__strokeWidth*e,n);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!Bh.checkImage(i,r,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?r.setStroke(o.style,n.__getRealStrokeWidth(t)*e,n,t):r.setStroke(o.style,n.__strokeWidth*e,n)}else r.strokeStyle=o.style;o.blendMode?(r.saveBlendMode(o.blendMode),s?ql(i,r):r.stroke(),r.restoreBlendMode()):s?ql(i,r):r.stroke()}}function Jl(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)Vl(t,e,s);else switch(i.strokeAlign){case"center":$l(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),$l(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)$l(t,2,e,s);else{const{renderBounds:r}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),$l(t,2,e,o),o.clipUI(i),o.clearWorld(r),zo.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s)}}function $l(t,e,s,i){const r=s.__;u(t)?Ql(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&bh.strokeArrow(t,s,i)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=wh.number(e,r),t.__letterSpacing=wh.number(s,r),t.__padding=l?w.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=mh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&Nl(a,s/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),p.stintSet(this,"isOverflow",!Ul(h,a)),this.isOverflow?(Yl(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;zl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},$t([mo(Jh)],t.Text.prototype,"__",void 0),$t([Zr(0)],t.Text.prototype,"width",void 0),$t([Zr(0)],t.Text.prototype,"height",void 0),$t([ao()],t.Text.prototype,"boxStyle",void 0),$t([Gr(!1)],t.Text.prototype,"resizeFontSize",void 0),$t([ao("#000000")],t.Text.prototype,"fill",void 0),$t([io("outside")],t.Text.prototype,"strokeAlign",void 0),$t([go("all")],t.Text.prototype,"hitFill",void 0),$t([Zr("")],t.Text.prototype,"text",void 0),$t([Zr("")],t.Text.prototype,"placeholder",void 0),$t([Zr("caption")],t.Text.prototype,"fontFamily",void 0),$t([Zr(12)],t.Text.prototype,"fontSize",void 0),$t([Zr("normal")],t.Text.prototype,"fontWeight",void 0),$t([Zr(!1)],t.Text.prototype,"italic",void 0),$t([Zr("none")],t.Text.prototype,"textCase",void 0),$t([Zr("none")],t.Text.prototype,"textDecoration",void 0),$t([Zr(0)],t.Text.prototype,"letterSpacing",void 0),$t([Zr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),$t([Zr(0)],t.Text.prototype,"paraIndent",void 0),$t([Zr(0)],t.Text.prototype,"paraSpacing",void 0),$t([Zr("x")],t.Text.prototype,"writingMode",void 0),$t([Zr("left")],t.Text.prototype,"textAlign",void 0),$t([Zr("top")],t.Text.prototype,"verticalAlign",void 0),$t([Zr(!0)],t.Text.prototype,"autoSizeAlign",void 0),$t([Zr("normal")],t.Text.prototype,"textWrap",void 0),$t([Zr("show")],t.Text.prototype,"textOverflow",void 0),$t([ao(!1)],t.Text.prototype,"textEditing",void 0),t.Text=$t([Co()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},$t([mo(jh)],t.Path.prototype,"__",void 0),$t([io("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=$t([Co()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},$t([mo(qh)],t.Pen.prototype,"__",void 0),$t([(t,e)=>{Ur(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=$t([Ro(wi,["set","path","paint"]),Co()],t.Pen);const{getSpread:Zl,getOuterOf:Kl,getByMove:td,getIntersectData:ed}=Rt;let sd;const{stintSet:id}=p,{hasTransparent:rd}=xh;function od(t,e,s){if(!u(e)||!1===e.visible||0===e.opacity)return;let i;const{boxBounds:r}=s.__layout;switch(e.type){case"image":i=Bh.image(s,t,e,r,!sd||!sd[e.url]);break;case"linear":i=kh.linearGradient(e,r);break;case"radial":i=kh.radialGradient(e,r);break;case"angular":i=kh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;i={type:n,style:xh.string(a,h)};break;default:o(e.r)||(i={type:"solid",style:xh.string(e)})}if(i){if(a(i.style)&&rd(i.style)&&(i.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;i.strokeStyle=e.style}e.editing&&(i.editing=e.editing),e.blendMode&&(i.blendMode=e.blendMode)}return i}const nd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];c(a)||(a=[a]),sd=Bh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=od(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length&&i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(id(s,"__isAlphaPixelFill",r),id(s,"__isTransparentFill",o)):(id(s,"__isAlphaPixelStroke",r),id(s,"__isTransparentStroke",o),id(s,"__hasMultiStrokeStyle",n))},fill:function(t,e,s){s.fillStyle=t,Hl(e,s)},fills:function(t,e,s){let i;for(let r=0,o=t.length;r<o;r++){if(i=t[r],i.image){if(Bh.checkImage(e,s,i,!e.__.__font))continue;if(!i.style){!r&&i.image.isPlacehold&&e.drawImagePlaceholder(s,i.image);continue}}if(s.fillStyle=i.style,i.transform||i.scaleFixed){if(s.save(),i.transform&&s.transform(i.transform),i.scaleFixed){const{scaleX:t,scaleY:r}=e.getRenderScaleData(!0);(!0===i.scaleFixed||"zoom-in"===i.scaleFixed&&t>1&&r>1)&&s.scale(1/t,1/r)}i.blendMode&&(s.blendMode=i.blendMode),Hl(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),Hl(e,s),s.restoreBlendMode()):Hl(e,s)}},fillPathOrText:Hl,fillText:Xl,stroke:Jl,strokes:function(t,e,s){Jl(t,e,s)},strokeText:Vl,drawTextStroke:ql,shape:function(t,s,i){const r=s.getSameCanvas(),o=t.__nowWorld,n=s.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(o))c=r,a=d=o;else{const{renderShapeSpread:r}=t.__layout;let p;if(e.fullImageShadow)p=o;else{const t=r?Zl(n,u===_?r*u:[r*_,r*u]):n;p=ed(t,o)}l=n.getFitMatrix(p);let{a:f,d:g}=l;l.a<1&&(c=s.getSameCanvas(),t.__renderShape(c,i),u*=f,_*=g),d=Kl(o,l),a=td(d,-l.e,-l.f);const y=i.matrix;y?(h=new K(l),h.multiply(y),f*=y.scaleX,g*=y.scaleY):h=l,h.withScale(f,g),i=Object.assign(Object.assign({},i),{matrix:h})}return t.__renderShape(r,i),{canvas:r,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let ad={},hd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:ld,rotateOfOuter:dd,translate:cd,scaleOfOuter:ud,multiplyParent:_d,scale:pd,rotate:fd,skew:gd}=M;function yd(t,e,s,i,r,o,n){const a=ld();cd(a,e.x+s,e.y+i),pd(a,r,o),n&&dd(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function md(t,e,s,i,r,o,n,a,h){const l=ld();wd(l,e,s,i,r,o,n,a),h&&(hd.a=e.width/h.width,hd.d=e.height/h.height,_d(l,hd)),t.transform=l}function xd(t,e,s,i,r,o,n,a,h,l,d,c){const u=ld();if(c)wd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)dd(u,{x:s/2,y:i/2},h);else switch(fd(u,h),h){case 90:cd(u,i,0);break;case 180:cd(u,s,i);break;case 270:cd(u,0,s)}ad.x=e.x+r,ad.y=e.y+o,cd(u,ad.x,ad.y),n&&ud(u,ad,n,a)}t.transform=u}function wd(t,e,s,i,r,o,n,a){n&&fd(t,n),a&&gd(t,a.x,a.y),r&&pd(t,r,o),cd(t,e.x+s,e.y+i)}const{get:vd,translate:bd}=M,Bd=new Lt,kd={},Sd={};function Rd(t,e,s,i){const{changeful:r,sync:o,scaleFixed:n}=s;r&&(t.changeful=r),o&&(t.sync=o),n&&(t.scaleFixed=n),t.data=Cd(s,i,e)}function Cd(t,e,s){t.padding&&(e=Bd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:i,height:r}=s;const{opacity:o,mode:n,align:h,offset:l,scale:d,size:c,rotation:_,skew:p,clipSize:f,repeat:g,gap:y,filters:m}=t,x=e.width===i&&e.height===r,v={mode:n},b="center"!==h&&(_||0)%180==90;let B,k;switch(Rt.set(Sd,0,0,b?r:i,b?i:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(w.getScaleData(d,c,s,kd),B=kd.scaleX,k=kd.scaleY),(h||y||g)&&(B&&Rt.scale(Sd,B,k,!0),h&<.toPoint(h,Sd,e,Sd,!0,!0))):x&&!_||(B=k=Rt.getFitScale(e,Sd,"fit"!==n),Rt.put(e,s,h,B,!1,Sd),Rt.scale(Sd,B,k,!0)),l&&G.move(Sd,l),n){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":(Sd.x||Sd.y||B||f||_||p)&&md(v,e,Sd.x,Sd.y,B,k,_,p,t.clipSize);break;case"repeat":(!x||B||_||p)&&xd(v,e,i,r,Sd.x,Sd.y,B,k,_,p,h,t.freeTransform),g||(v.repeat="repeat");const s=u(g);(y||s)&&(v.gap=function(t,e,s,i,r){let o,n;u(t)?(o=t.x,n=t.y):o=n=t;return{x:Pd(o,s,r.width,e&&e.x),y:Pd(n,i,r.height,e&&e.y)}}(y,s&&g,Sd.width,Sd.height,e));break;default:B&&yd(v,e,Sd.x,Sd.y,B,k,_)}return v.transform||(e.x||e.y)&&(v.transform=vd(),bd(v.transform,e.x,e.y)),B&&"stretch"!==n&&(v.scaleX=B,v.scaleY=k),v.width=i,v.height=r,o&&(v.opacity=o),m&&(v.filters=m),g&&(v.repeat=a(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),v}function Pd(t,e,s,i){const r=a(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let Td,Ld=new Lt;const{isSame:Ed}=Rt;function Id(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Rd(r,i,s,o),!0}function Od(t,e){Wd(t,mn.LOAD,e)}function Ad(t,e){Wd(t,mn.LOADED,e)}function Md(t,e,s){e.error=s,t.forceUpdate("surface"),Wd(t,mn.ERROR,e)}function Wd(t,e,s){t.hasEvent(e)&&t.emitEvent(new mn(e,s))}function Dd(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Fd,scale:zd,copy:Ud}=M,{floor:Nd,ceil:Yd,max:Xd,abs:Hd}=Math;function Vd(t,s,i){let{scaleX:r,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed);const n=r+"-"+o+"-"+i;if(s.patternId===n||t.destroyed)return!1;{const{image:a,data:h}=s;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:f,repeat:g,gap:y}=h;r*=i,o*=i,_&&(_=Hd(_),p=Hd(p),d=Fd(),Ud(d,f),zd(d,1/_,1/p),r*=_,o*=p),c*=r,u*=o;const m=c*u;if(!g&&m>e.image.maxCacheSize)return!1;let x=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/Yd(t))}else{const t=a.width*a.height;x>t&&(x=t)}m>x&&(l=Math.sqrt(m/x)),l&&(r/=l,o/=l,c/=l,u/=l),_&&(r/=_,o/=p);const w=y&&y.x*r,v=y&&y.y*o;if(f||1!==r||1!==o){const t=c+(w||0),e=u+(v||0);r/=t/Xd(Nd(t),1),o/=e/Xd(Nd(e),1),d||(d=Fd(),f&&Ud(d,f)),zd(d,1/r,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,v,t.leafer&&t.leafer.config.smooth),B=a.getPattern(b,g||e.origin.noRepeat||"no-repeat",d,s);return s.style=B,s.patternId=n,!0}}const Gd={image:function(t,e,s,i,r){let o,n;const a=Or.get(s);return Td&&s===Td.paint&&Ed(i,Td.boxBounds)?o=Td.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Td=a.use>1?{leafPaint:o,paint:s,boxBounds:Ld.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Id(t,e,s,a,o,i),r&&(Od(t,n),Ad(t,n))):a.error?r&&Md(t,n,a.error):(r&&(Dd(t,!0),Od(t,n)),o.loadId=a.load(()=>{Dd(t,!1),t.destroyed||(Id(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Ad(t,n)),o.loadId=void 0},e=>{Dd(t,!1),Md(t,n,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,s,i,r){const{scaleX:o,scaleY:n}=t.getRenderScaleData(!0,i.scaleFixed),{pixelRatio:a}=s,{data:h}=i;if(!h||i.patternId===o+"-"+n+"-"+a&&!Ch.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===e.name&&Sn.isResizing(t)||Ch.running)){let{width:t,height:s}=h;t*=o*a,s*=n*a,h.scaleX&&(t*=h.scaleX,s*=h.scaleY),r=t*s>e.image.maxCacheSize}return r?(t.__.__isFastShadow&&(s.fillStyle=i.style||"#000",s.fill()),function(t,e,s,i){e.save(),e.clipUI(t),s.blendMode&&(e.blendMode=s.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(s.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(t,s,i,h),!0):(!i.style||i.sync||Ch.running?Vd(t,i,a):i.patternTask||(i.patternTask=Or.patternTasker.add(()=>Zt(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(t.__nowWorld)&&Vd(t,i,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Vd,recycleImage:function(t,e){const s=e["_"+t];if(c(s)){let i,r,o,n,a;for(let h=0,l=s.length;h<l;h++)i=s[h],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,Or.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],c(n)||(n=[n])),r.unload(s[h].loadId,!n.some(t=>t.url===a))));return o}return null},createData:Rd,getPatternData:Cd,fillOrFitMode:yd,clipMode:md,repeatMode:xd},{toPoint:jd}=nt,{hasTransparent:qd}=xh,Qd={},Jd={};function $d(t,e,s,i){if(s){let r,o,n,h;for(let t=0,l=s.length;t<l;t++)r=s[t],a(r)?(n=t/(l-1),o=xh.string(r,i)):(n=r.offset,o=xh.string(r.color,i)),e.addColorStop(n,o),!h&&qd(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Zd,getDistance:Kd}=G,{get:tc,rotateOfOuter:ec,scaleOfOuter:sc}=M,{toPoint:ic}=nt,rc={},oc={};function nc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=Zd(e,s);o=tc(),r?(sc(o,e,n/a*(i||1),1),ec(o,e,t+90)):(sc(o,e,1,n/a*(i||1)),ec(o,e,t))}return o}const{getDistance:ac}=G,{toPoint:hc}=nt,lc={},dc={};const cc={linearGradient:function(t,s){let{from:i,to:r,type:o,opacity:n}=t;jd(i||"top",s,Qd),jd(r||"bottom",s,Jd);const a=e.canvas.createLinearGradient(Qd.x,Qd.y,Jd.x,Jd.y),h={type:o,style:a};return $d(h,a,t.stops,n),h},radialGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;ic(i||"center",s,rc),ic(r||"bottom",s,oc);const h=e.canvas.createRadialGradient(rc.x,rc.y,0,rc.x,rc.y,Kd(rc,oc)),l={type:o,style:h};$d(l,h,t.stops,n);const d=nc(s,rc,oc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;hc(i||"center",s,lc),hc(r||"bottom",s,dc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,lc.x,lc.y):e.canvas.createRadialGradient(lc.x,lc.y,0,lc.x,lc.y,ac(lc,dc)),l={type:o,style:h};$d(l,h,t.stops,n);const d=nc(s,lc,dc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:nc},{copy:uc,toOffsetOutBounds:_c}=Rt,pc={},fc={};function gc(t,s,i,r){const{bounds:o,shapeBounds:n}=r;if(e.fullImageShadow){if(uc(pc,t.bounds),pc.x+=s.x-n.x,pc.y+=s.y-n.y,i){const{fitMatrix:t}=r;pc.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),pc.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),pc.width*=i,pc.height*=i}t.copyWorld(r.canvas,t.bounds,pc)}else i&&(uc(pc,s),pc.x-=s.width/2*(i-1),pc.y-=s.height/2*(i-1),pc.width*=i,pc.height*=i),t.copyWorld(r.canvas,n,i?pc:s)}const{toOffsetOutBounds:yc}=Rt,mc={};const xc={shadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;_c(l,fc),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.setWorldShadow(fc.offsetX+a.x*c*g,fc.offsetY+a.y*u*g,a.blur*c*g,xh.string(a.color)),r=a.spread?1+2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,gc(_,fc,r,s),i=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),i=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),zo.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;yc(l,mc),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.save(),_.setWorldShadow(mc.offsetX+a.x*c*g,mc.offsetY+a.y*u*g,a.blur*c*g),r=a.spread?1-2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,gc(_,mc,r,s),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,xh.string(a.color),"source-in"),zo.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){}},{excludeRenderBounds:wc}=jo;let vc;function bc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":vc||(vc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);kc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":kc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function Bc(t){return t.getSameCanvas(!1,!0)}function kc(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}t.Group.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(bc(this,n,t,r,i,o,void 0,!0),i=r=null),o=s.__.opacity,vc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=Bc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=Bc(t)),r||(r=Bc(t)),s.__render(i,e)),"clipping"!==a&&"clipping-path"!==a||wc(s,e)||s.__render(t,e);continue}const d=1===o&&s.__.__blendMode;d&&bc(this,n,t,r,i,o,void 0,!1),wc(s,e)||s.__render(r||t,e),d&&bc(this,n,t,r,i,o,d,!1)}bc(this,n,t,r,i,o,void 0,!0)};const Sc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Rc=Sc+"_#~&*+\\=|≮≯≈≠=…",Cc=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 Pc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Tc=Pc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Lc=Pc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ec=Pc(Sc),Ic=Pc(Rc),Oc=Pc("- —/~|┆·");var Ac;!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"}(Ac||(Ac={}));const{Letter:Mc,Single:Wc,Before:Dc,After:Fc,Symbol:zc,Break:Uc}=Ac;function Nc(t){return Tc[t]?Mc:Oc[t]?Uc:Lc[t]?Dc:Ec[t]?Fc:Ic[t]?zc:Cc.test(t)?Wc:Mc}const Yc={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Xc(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Hc}=Yc,{Letter:Vc,Single:Gc,Before:jc,After:qc,Symbol:Qc,Break:Jc}=Ac;let $c,Zc,Kc,tu,eu,su,iu,ru,ou,nu,au,hu,lu,du,cu,uu,_u,pu=[];function fu(t,e){ou&&!ru&&(ru=ou),$c.data.push({char:t,width:e}),Kc+=e}function gu(){tu+=Kc,$c.width=Kc,Zc.words.push($c),$c={data:[]},Kc=0}function yu(){du&&(cu.paraNumber++,Zc.paraStart=!0,du=!1),ou&&(Zc.startCharSize=ru,Zc.endCharSize=ou,ru=0),Zc.width=tu,uu.width?Hc(Zc):_u&&mu(),pu.push(Zc),Zc={words:[]},tu=0}function mu(){tu>(cu.maxWidth||0)&&(cu.maxWidth=tu)}const{top:xu,right:wu,bottom:vu,left:bu}=t.Direction4;function Bu(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const ku={getDrawData:function(t,s){a(t)||(t=String(t));let i=0,r=0,o=s.__getInput("width")||0,n=s.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=s;d&&(o?(i=d[bu],o-=d[wu]+d[bu]):s.autoSizeAlign||(i=d[bu]),n?(r=d[xu],n-=d[xu]+d[vu]):s.autoSizeAlign||(r=d[xu]));const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,s,i){cu=t,pu=t.rows,uu=t.bounds,_u=!uu.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=e,{width:h,height:l}=uu;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;du=!0,au=null,ru=iu=ou=Kc=tu=0,$c={data:[]},Zc={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)su=s[i],"\n"===su?(Kc&&gu(),Zc.paraEnd=!0,yu(),du=!0):(nu=Nc(su),nu===Vc&&"none"!==n&&(su=Xc(su,n,!Kc)),iu=a.measureText(su).width,r&&(r<0&&(ou=iu),iu+=r),hu=nu===Gc&&(au===Gc||au===Vc)||au===Gc&&nu!==qc,lu=!(nu!==jc&&nu!==Gc||au!==Qc&&au!==qc),eu=du&&o?h-o:h,t&&h&&tu+Kc+iu>eu&&(e?(Kc&&gu(),tu&&yu()):(lu||(lu=nu===Vc&&au==qc),hu||lu||nu===Jc||nu===jc||nu===Gc||Kc+iu>eu?(Kc&&gu(),tu&&yu()):tu&&yu()))," "===su&&!0!==du&&tu+Kc===0||(nu===Jc?(" "===su&&Kc&&gu(),fu(su,iu),gu()):hu||lu?(Kc&&gu(),fu(su,iu)):fu(su,iu)),au=nu);Kc&&gu(),tu&&yu(),pu.length>0&&(pu[pu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{cu.paraNumber++,tu=a.measureText(t).width,pu.push({x:o||0,text:t,width:tu,paraStart:!0}),_u&&mu()})}(c,t,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":Bu(e,"x",t[bu]);break;case"right":Bu(e,"x",-t[wu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":Bu(e,"y",t[xu]);break;case"bottom":Bu(e,"y",-t[vu])}}(d,c,s,o,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:f,height:g}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>g)y=Math.max(g,o),r>1&&(t.overflow=r);else if(g||u)switch(d){case"middle":p+=(g-y)/2;break;case"bottom":p+=g-y}m+=p;let x,w,v,b=f||u?f:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<f||x.width>f&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&f&&f<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(c,s),function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,letterSpacing:n}=e;let a,h,l,d,c,u;i.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=s&&("justify"===r||"both"===r)&&u>1?(s-t.width-l)/(u-1):0,d=n||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!n&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,s)=>{1===d?(c={char:"",x:a},a=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,s,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||s===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,s,o),c.overflow&&function(t,s,i,r){if(!r)return;const{rows:o,overflow:n}=t;let{textOverflow:a}=s;if(o.splice(n),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=i+r-l;("none"===s.textWrap?o:[o[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],h=t.x+t.width,!(i===s&&h<d));i--){if(h<d&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,s,i,o),"none"!==h&&function(t,e){let s;const{fontSize:i,textDecoration:r}=e;switch(t.decorationHeight=i/11,u(r)?(s=r.type,r.color&&(t.decorationColor=xh.string(r.color))):s=r,s){case"under":t.decorationY=[.15*i];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i,.35*-i]}}(c,s),c}};const Su={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!xh.object)return t;t=xh.object(t)}let i=o(t.a)?1:t.a;s&&(i*=e);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};return Object.assign(mh,ku),Object.assign(xh,Su),Object.assign(bh,nd),Object.assign(Bh,Gd),Object.assign(kh,cc),Object.assign(Sh,xc),Ka(),t.AlignHelper=lt,t.AroundHelper=nt,t.AutoBounds=It,t.BezierHelper=Ne,t.Bounds=Lt,t.BoundsEvent=xn,t.BoundsHelper=Rt,t.BoxData=zh,t.BranchHelper=$o,t.BranchRender=_a,t.CanvasData=Zh,t.CanvasManager=Jt,t.ChildEvent=pn,t.ColorConvert=xh,t.Creator=Xt,t.DataHelper=p,t.Debug=Mt,t.DragBoundsHelper=tl,t.Effect=Sh,t.EllipseData=Hh,t.EllipseHelper=Je,t.Event=_n,t.EventCreator=qt,t.Eventer=Wn,t.Export=Ch,t.FileHelper=Sr,t.Filter=Rh,t.FrameData=Nh,t.GroupData=Fh,t.ImageData=$h,t.ImageEvent=mn,t.ImageManager=Or,t.IncrementId=s,t.LayoutEvent=Cn,t.Layouter=uh,t.LeafBounds=da,t.LeafBoundsHelper=jo,t.LeafData=g,t.LeafDataProxy=Qn,t.LeafEventer=jn,t.LeafHelper=zo,t.LeafLayout=un,t.LeafLevelList=qa,t.LeafList=ja,t.LeafMatrix=sa,t.LeafRender=ca,t.LeaferCanvas=Ja,t.LeaferCanvasBase=ce,t.LeaferData=Uh,t.LeaferEvent=Tn,t.LeaferImage=zr,t.LineData=Yh,t.MathHelper=w,t.Matrix=K,t.MatrixHelper=M,t.MyImage=Fl,t.NeedConvertToCanvasCommandMap=ge,t.OneRadian=b,t.PI2=B,t.PI_2=k,t.Paint=bh,t.PaintGradient=kh,t.PaintImage=Bh,t.PathArrow=vh,t.PathBounds=_r,t.PathCommandDataHelper=ii,t.PathCommandMap=pe,t.PathConvert=As,t.PathCorner=wr,t.PathCreator=wi,t.PathData=jh,t.PathDrawer=Mi,t.PathHelper=ue,t.PathNumberCommandLengthMap=we,t.PathNumberCommandMap=xe,t.PenData=qh,t.Platform=e,t.Plugin=Yt,t.Point=$,t.PointHelper=G,t.PolygonData=Vh,t.PropertyEvent=gn,t.RectData=Xh,t.RectHelper=ve,t.RectRender=ol,t.RenderEvent=Pn,t.Renderer=ph,t.ResizeEvent=Sn,t.Resource=Er,t.Run=zt,t.StarData=Gh,t.State=Ph,t.StringNumberMap=Ot,t.TaskItem=Pr,t.TaskProcessor=Tr,t.TextConvert=mh,t.TextData=Jh,t.Transition=Th,t.TwoPointBoundsHelper=et,t.UIBounds=Kh,t.UICreator=Vt,t.UIData=Wh,t.UIRender=il,t.UnitConvert=wh,t.WaitHelper=en,t.WatchEvent=Rn,t.Watcher=eh,t.affectRenderBoundsType=no,t.affectStrokeBoundsType=io,t.attr=Hr,t.autoLayoutType=Qr,t.boundsType=Zr,t.canvasPatch=kr,t.canvasSizeAttrs=de,t.createAttr=function(t){return(e,s)=>{Ur(e,s,Yr(s,t))}},t.createDescriptor=Yr,t.cursorType=yo,t.dataProcessor=mo,t.dataType=Gr,t.decorateLeafAttr=Xr,t.defineDataProcessor=xo,t.defineKey=Ur,t.defineLeafAttr=Vr,t.doBoundsType=to,t.doStrokeType=ro,t.effectType=fh,t.emptyData={},t.eraserType=fo,t.extraPropertyEventMap=yn,t.getBoundsData=R,t.getDescriptor=Nr,t.getMatrixData=C,t.getPointData=S,t.hitType=go,t.isArray=c,t.isData=function(t){return u(t)&&!c(t)},t.isEmptyData=_,t.isFinite=h,t.isNull=n,t.isNumber=l,t.isObject=u,t.isString=a,t.isUndefined=o,t.layoutProcessor=function(t){return(e,s)=>{Ur(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=An,t.maskType=po,t.naturalBoundsType=Kr,t.opacityType=ho,t.path=vr,t.pathInputType=eo,t.pathType=so,t.pen=br,t.positionType=jr,t.registerUI=Co,t.registerUIEvent=function(){return t=>{qt.register(t)}},t.resizeType=gh,t.rewrite=Bo,t.rewriteAble=ko,t.rotationType=$r,t.scaleType=Jr,t.scrollType=qr,t.sortType=_o,t.strokeType=oo,t.surfaceType=ao,t.tempBounds=Et,t.tempMatrix=tt,t.tempPoint=Z,t.tryToNumber=function(t){return"string"==typeof t&&d.test(t)?+t:t},t.useCanvas=Ka,t.useModule=Ro,t.version="1.9.5",t.visibleType=lo,t.zoomLayerType=yh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=web.min.js.map
|