leafer-ui 1.0.0-beta.7 → 1.0.0-beta.9
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/global.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,r={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,i,r;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=r=t[1];break;case 3:e=t[0],s=r=t[1],i=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,i,r]}},n=Math.PI/180,o=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:u,PI:_}=Math,p={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:g,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){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s},scaleOfOuter(t,e,s,i=s){y.toInnerPoint(t,e,p),y.scaleOfInner(t,p,s,i)},scaleOfInner(t,e,s,i=s){y.translateInner(t,e.x,e.y),y.scale(t,s,i),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=n),i=h(e),{a:r,b:o,c:a,d:d}=t;t.a=r*s-o*i,t.b=r*i+o*s,t.c=a*s-d*i,t.d=a*i+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,p),y.rotateOfInner(t,p,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:a}=t;s&&(s*=n,t.a=i+o*s,t.b=r+a*s),e&&(e*=n,t.c=o+i*e,t.d=a+r*e)},skewOfOuter(t,e,s,i){y.toInnerPoint(t,e,p),y.skewOfInner(t,p,s,i)},skewOfInner(t,e,s,i){y.translateInner(t,e.x,e.y),y.skew(t,s,i),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},preMultiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+n*e.c,t.d=r*e.b+n*e.d),t.e=o*e.a+a*e.c+e.e,t.f=o*e.b+a*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=t,a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:n}=e,{a:o,b:a,c:h,d:l}=t,d=1/(o*l-a*h);if(s||(s=e),s.x=(r*l-n*h)*d,s.y=(n*o-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*o-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let o=e,a=r,h=0,l=0,p=0;if(s||i){const t=e*r-s*i,g=e*i+s*r;if(s){const i=e*e+s*s;o=u(i),a=t/o;const r=e/o;h=s>0?d(r):-d(r),l=c(g/i)/n}else{const e=i*i+r*r;a=u(e),o=t/a;const s=i/a;h=_/2-(r>0?d(-s):-d(s)),p=c(g/e)/n}h/=n}return{x:t.e,y:t.f,scaleX:o,scaleY:a,rotation:h,skewX:l,skewY:p}},reset(t){y.set(t)}},y=f,{toInnerPoint:m,toOuterPoint:v}=f,{sin:w,cos:x,abs:b,sqrt:B,atan2:E}=Math,k={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=T.defaultPoint);const i=x(e*n),r=w(e*n),o=t.x-s.x,a=t.y-s.y;t.x=s.x+o*i-a*r,t.y=s.y+o*r-a*i},tempToInnerOf(t,e){const{tempPoint:s}=T;return T.copy(s,t),m(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=T;return T.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=T;return T.copy(s,t),T.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),m(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){m(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=b(e.x-t.x),i=b(e.y-t.y);return B(s*s+i*i)},getAngle:(t,e)=>T.getAtan2(t,e)/n,getAtan2:(t,e)=>E(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=T.getAtan2(t,e);return{x:t.x+x(i)*s,y:t.y+w(i)*s}},reset(t){T.reset(t)}},T=k;class C{constructor(t,e){"object"==typeof t?k.copy(this,t):k.set(this,t,e)}set(t,e){k.set(this,t,e)}copy(t){return k.copy(this,t),this}clone(){return new C(this)}rotate(t,e){return k.rotate(this,t,e),this}toInnerOf(t,e){return k.toInnerOf(this,t,e),this}toOuterOf(t,e){return k.toOuterOf(this,t,e),this}getCenter(t){return k.getCenter(this,t)}getDistance(t){return k.getDistance(this,t)}getAngle(t){return k.getAngle(this,t)}getAtan2(t){return k.getAtan2(this,t)}reset(){k.reset(this)}}class R{constructor(t,e,s,i,r,n){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,i,r,n)}set(t,e,s,i,r,n){f.set(this,t,e,s,i,r,n)}copy(t){return f.copy(this,t),this}clone(){return new R(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const L={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){P(t,e,s),P(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(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:P}=L,{tempPointBounds:O,setPoint:S,addPoint:M,toBounds:D}=L,{toOuterPoint:A}=f;let I,W,N,F;const z={},U={},H={tempBounds:{},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){Y.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),Y.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(Y.right(s)-t.x),e.offsetY=-(Y.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Y.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(Y.copy(Y.tempBounds,t),Y.toOuterOf(Y.tempBounds,e),Y.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),Y.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 z.x=t.x,z.y=t.y,A(e,z,U),S(O,U.x,U.y),z.x=t.x+t.width,A(e,z,U),M(O,U.x,U.y),z.y=t.y+t.height,A(e,z,U),M(O,U.x,U.y),z.x=t.x,A(e,z,U),M(O,U.x,U.y),D(O,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new R(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return Y.copyAndSpread(s,t,e),s},spread(t,e){Y.copyAndSpread(t,t,e)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height)},add(t,e){I=t.x+t.width,W=t.y+t.height,N=e.x+e.width,F=e.y+e.height,I=I>N?I:N,W=W>F?W:F,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){Y.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){Y.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){Y.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o]):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||X(t,r)):j(t,r));n&&Y.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?S(O,t.x,t.y):M(O,t.x,t.y)})),D(O,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=k.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=k.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=Y.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=Y.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){s&&(e=Y.tempToOuterOf(e,s));let{x:i,y:r,width:n,height:o}=e;return I=i+n,W=r+o,N=t.x+t.width,F=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,I=I<N?I:N,W=W<F?W:F,n=I-i,o=W-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){Y.copy(t,Y.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){Y.set(t)}},Y=H,{add:j,copy:X}=Y;class V{constructor(t,e,s,i){"object"==typeof t?H.copy(this,t):H.set(this,t,e,s,i)}set(t,e,s,i){H.set(this,t,e,s,i)}copy(t){return H.copy(this,t),this}clone(){return new V(this)}scale(t){return H.scale(this,t),this}toOuterOf(t,e){return H.toOuterOf(this,t,e),this}getFitMatrix(t){return H.getFitMatrix(this,t)}spread(t){return H.spread(this,t),this}ceil(){return H.ceil(this),this}add(t){return H.add(this,t),this}addList(t){return H.setByList(this,t,!0),this}setByList(t,e){return H.setByList(this,t,e),this}addListWithHandle(t,e){return H.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return H.setByListWithHandle(this,t,e,s),this}setByPoints(t){return H.setByPoints(this,t),this}hitPoint(t,e){return H.hitPoint(this,t,e)}hitRadiusPoint(t,e){return H.hitRadiusPoint(this,t,e)}hit(t,e){return H.hit(this,t,e)}includes(t,e){return H.includes(this,t,e)}intersect(t,e){return H.intersect(this,t,e),this}getIntersect(t,e){return new V(H.getIntersectData(this,t,e))}isSame(t){return H.isSame(this,t)}isEmpty(){return H.isEmpty(this)}reset(){H.reset(this)}}class G{constructor(t,e,s,i,r,n){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new V(r,e,n||t.width-r-s,o||t.height-e-i)}}class K{constructor(t,e){L.setPoint(this,t,e)}addPoint(t,e){L.addPoint(this,t,e)}addBounds(t,e,s,i){L.addBounds(this,t,e,s,i)}add(t){L.add(this,t)}}const q={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};class Q{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Q(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Z.enable){if(Z.filterList.length&&Z.filterList.every((t=>t!==this.name)))return;if(Z.excludeList.length&&Z.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(console.warn(this.name,"repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}Q.filterList=[],Q.excludeList=[];const Z=Q,$=Q.get("RunTime");class J{static start(t,e){const i=s.create(s.RUNTIME);return tt.currentId=tt.idMap[i]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[i]=t,tt.nameToIdMap[t]=i,i}static end(t,e){const s=tt.idMap[t],i=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[i]=void 0,e?$.log(i,performance.now()-s,"µs"):$.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Q.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;it[e]?et.repeat(e):it[e]=t},get(t,e,s,i,r,n){const o=new it[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:it}=st,rt=Q.get("EventCreator"),nt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(ot[e]?rt.repeat(e):ot[e]=t)}))},changeName(t,e){const s=ot[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,ot[e]=s)}},get:(t,...e)=>new ot[t](...e)},{nameList:ot}=nt;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),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}destory(){this.clear()}}class ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(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}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}get(t){}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(ut(e,t),ut(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?ut(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:ut}=ct;class _t{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]:e}return this[t]}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__input:e}=this;let s,i;for(let r in this)s=r.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[r]:i);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__leaf=null}}const pt={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}};function gt(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function ft(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(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(o,a)}h((i=i.apply(t,e||[])).next())}))}function yt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const mt=[];function vt(){return(t,e)=>{mt.push(e)}}const wt=[];let xt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||wt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;mt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){}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,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,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,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,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,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};gt([yt("imageSmoothingEnabled")],xt.prototype,"smooth",void 0),gt([yt("imageSmoothingQuality")],xt.prototype,"smoothLevel",void 0),gt([yt("globalAlpha")],xt.prototype,"opacity",void 0),gt([yt()],xt.prototype,"fillStyle",void 0),gt([yt()],xt.prototype,"strokeStyle",void 0),gt([yt("lineWidth")],xt.prototype,"strokeWidth",void 0),gt([yt("lineCap")],xt.prototype,"strokeCap",void 0),gt([yt("lineJoin")],xt.prototype,"strokeJoin",void 0),gt([yt("lineDashOffset")],xt.prototype,"dashOffset",void 0),gt([yt()],xt.prototype,"miterLimit",void 0),gt([yt()],xt.prototype,"shadowBlur",void 0),gt([yt()],xt.prototype,"shadowColor",void 0),gt([yt()],xt.prototype,"shadowOffsetX",void 0),gt([yt()],xt.prototype,"shadowOffsetY",void 0),gt([yt()],xt.prototype,"filter",void 0),gt([yt()],xt.prototype,"font",void 0),gt([yt()],xt.prototype,"fontKerning",void 0),gt([yt()],xt.prototype,"fontStretch",void 0),gt([yt()],xt.prototype,"fontVariantCaps",void 0),gt([yt()],xt.prototype,"textAlign",void 0),gt([yt()],xt.prototype,"textBaseline",void 0),gt([yt()],xt.prototype,"textRendering",void 0),gt([yt()],xt.prototype,"wordSpacing",void 0),gt([yt()],xt.prototype,"letterSpacing",void 0),gt([yt()],xt.prototype,"direction",void 0),gt([vt()],xt.prototype,"setTransform",null),gt([vt()],xt.prototype,"resetTransform",null),gt([vt()],xt.prototype,"getTransform",null),gt([vt()],xt.prototype,"save",null),gt([vt()],xt.prototype,"restore",null),gt([vt()],xt.prototype,"transform",null),gt([vt()],xt.prototype,"translate",null),gt([vt()],xt.prototype,"scale",null),gt([vt()],xt.prototype,"rotate",null),gt([vt()],xt.prototype,"fill",null),gt([vt()],xt.prototype,"stroke",null),gt([vt()],xt.prototype,"clip",null),gt([vt()],xt.prototype,"fillRect",null),gt([vt()],xt.prototype,"strokeRect",null),gt([vt()],xt.prototype,"clearRect",null),gt([vt()],xt.prototype,"beginPath",null),gt([vt()],xt.prototype,"moveTo",null),gt([vt()],xt.prototype,"lineTo",null),gt([vt()],xt.prototype,"bezierCurveTo",null),gt([vt()],xt.prototype,"quadraticCurveTo",null),gt([vt()],xt.prototype,"closePath",null),gt([vt()],xt.prototype,"arc",null),gt([vt()],xt.prototype,"arcTo",null),gt([vt()],xt.prototype,"ellipse",null),gt([vt()],xt.prototype,"rect",null),gt([vt()],xt.prototype,"roundRect",null),gt([vt()],xt.prototype,"createConicGradient",null),gt([vt()],xt.prototype,"createLinearGradient",null),gt([vt()],xt.prototype,"createPattern",null),gt([vt()],xt.prototype,"createRadialGradient",null),gt([vt()],xt.prototype,"fillText",null),gt([vt()],xt.prototype,"measureText",null),gt([vt()],xt.prototype,"strokeText",null);const bt=new V,Bt={width:1,height:1,pixelRatio:1},Et=Q.get("LeaferCanvasBase"),kt=["width","height","pixelRatio"];class Tt extends xt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(e,i){super(),this.worldTransform={},e||(e=Bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:n,pixelRatio:o}=e;this.autoLayout=!r||!n,this.pixelRatio=o,this.offscreen=t.isWorker||e.offscreen,this.config=e,this.init(),this.textBaseline="alphabetic"}init(){}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Et.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(pt.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Et.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,kt),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:n,c:o,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*o)*i,r.b=(t.a*n+t.b*a)*i,r.c=(t.c*s+t.d*o)*i,r.d=(t.c*n+t.d*a)*i,r.e=(t.e*s+t.f*o+h)*i,r.f=(t.e*n+t.f*a+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}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){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,H.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}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){s&&(this.blendMode=s),this.fillStyle=e,bt.copy(t).scale(this.pixelRatio),this.fillRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,bt.copy(t).scale(this.pixelRatio),this.strokeRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.clearRect(bt.x,bt.y,bt.width,bt.height)}clipWorld(t,e){this.beginPath(),bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.rect(bt.x,bt.y,bt.width,bt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:i,pixelRatio:r}=this,n={width:s,height:i,pixelRatio:r},o=this.manager?this.manager.get(n):e.canvas(n);if(o.save(),t){const t=this.worldTransform;o.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return o}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:n}=this;t&&(i+=t),s&&(r+=s);const o={width:i,height:r,pixelRatio:n},a=this.manager?this.manager.get(o):e.canvas(o);return a.save(),a}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}function Ct(t,e,s){Object.defineProperty(t,e,s)}function Rt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Lt(t){return(e,s)=>{Ct(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function Pt(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};Ct(t,e,Object.assign(r,i||{})),qt(t,e,s)}function Ot(t){return(e,s)=>{Pt(e,s,t)}}function St(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function Mt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Dt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function At(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const It=At;function Wt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Nt=Wt;function Ft(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function zt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Ut(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Ht(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function Yt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function jt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Xt(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),Q.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Vt(t){return(e,s)=>{Ct(e,"__DataProcessor",{get:()=>t})}}function Gt(t){return(e,s)=>{Ct(e,"__LayoutProcessor",{get:()=>t})}}function Kt(t,e,s){qt(t.prototype,e,s)}function qt(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s&&(o.get=function(){return this[r]});const a=Rt(i,e);a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),Object.defineProperty(i,e,o)}const Qt=new Q("rewrite"),Zt=[],$t=["destroy","constructor"];function Jt(t){return(e,s)=>{Zt.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function te(){return t=>{ee()}}function ee(t){Zt.length&&(Zt.forEach((e=>{t&&Qt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Zt.length=0)}function se(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!($t.includes(i)||e&&e.includes(i)))if(t.prototype){Rt(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function ie(){return t=>{st.register(t)}}function re(){return t=>{nt.register(t)}}setTimeout((()=>ee(!0)));const{toOuterOf:ne}=H;class oe{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),ne(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),ne(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),ne(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}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}}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}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const ae={},he={on(t,e,s){let i,r,n;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const o=le(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))},off(t,e,s){let i,r,n;s&&(i="boolean"==typeof s?s:s.capture);const o=le(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=o[t],r&&(n=r.findIndex((t=>t.listener===e)),n>-1&&r.splice(n,1),r.length||delete o[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const i=le(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&(r=i[n],r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),!e||!e.isStopNow);n++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function le(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:ae)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:ae)}}class de{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class ce extends de{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}ce.ADD="child.add",ce.REMOVE="child.remove";class ue extends de{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}ue.CHANGE="property.change";class _e extends de{constructor(t,e,s,i,r,n){super(t,e),this.image=s,this.attrName=i,this.attrValue=r,n&&(this.error=n)}}_e.LOADED="image.loaded",_e.ERROR="image.error";class pe extends de{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){"object"==typeof t?(super(pe.RESIZE),Object.assign(this,t)):super(t),this.old=e}}pe.RESIZE="resize";class ge extends de{constructor(t,e){super(t),e&&Object.assign(this,e)}}ge.START="transform.start",ge.CHANGE="transform.change",ge.END="transform.end",ge.BEFORE_START="transform.before_start",ge.BEFORE_CHANGE="transform.before_change",ge.BEFORE_END="transform.before_end";class fe extends de{constructor(t,e){super(t),this.data=e}}fe.REQUEST="watch.request",fe.DATA="watch.data";class ye extends de{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ye.CHECK_UPDATE="layout.check_update",ye.REQUEST="layout.request",ye.START="layout.start",ye.BEFORE="layout.before",ye.LAYOUT="layout.layout",ye.AFTER="layout.after",ye.AGAIN="layout.again",ye.END="layout.end";class me extends de{}me.FRAME="animate.frame";class ve extends de{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}ve.REQUEST="render.request",ve.START="render.start",ve.BEFORE="render.before",ve.RENDER="render",ve.AFTER="render.after",ve.AGAIN="render.again",ve.END="render.end";class we extends de{}we.START="leafer.start",we.BEFORE_READY="leafer.before_ready",we.READY="leafer.ready",we.AFTER_READY="leafer.after_ready",we.VIEW_READY="leafer.view_ready",we.STOP="leafer.stop",we.RESTART="leafer.restart",we.END="leafer.end";const xe={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=ue,i=new ue(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:be}=f,{sin:Be,cos:Ee}=Math,ke={__updateWorldMatrix(){const t=this.parent?this.parent.__world:be,e=this.__local,s=this.__world;this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation?(s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:r,skewX:o,skewY:a}=this.__;r||o||a?(r*=n,o&&(o*=n),a&&(a*=n),t.a=s*Ee(r+a),t.b=s*Be(r+a),t.c=i*-Be(r-o),t.d=i*Ee(r-o)):(t.a=s,t.b=0,t.c=0,t.d=i,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=i,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:Te,copyAndSpread:Ce}=H,Re={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,Te(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else Te(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){Te(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Te(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Te(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){Ce(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){Ce(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:Le}=k,Pe={},Oe={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),Le(t,this.__world,Pe),this.__hit(Pe)},__drawHitPath(t){this.__drawRenderPath(t)}},Se={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e),t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,this.__.isEraser?"destination-out":this.__.blendMode),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},Me={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},De={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity,t.copyWorld(s,this.__world,this.__world,this.__.isEraser?"destination-out":this.__.blendMode),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,n=t.getSameCanvas(),o=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,o,n),n.clear(),o.clear()):r=!0,s.__render(n,e)):s.__render(o,e);this.__renderMask(t,o,n),n.recycle(),o.recycle()}else{const{bounds:r,hideBounds:n}=e;for(let o=0,a=i.length;o<a;o++)s=i[o],r&&!r.hit(s.__world,e.matrix)||n&&n.includes(s.__world,e.matrix)||s.__render(t,e)}}},Ae={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)We(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Ne(e[t])}},updateAllChange(t){if(Ne(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Fe(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){const i={x:e,y:s};t.parent&&f.toInnerPoint(t.parent.__world,i,i,!0),Ie.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,i,r){const n=t.parent?k.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,n,s,i,r)},zoomOfLocal(t,e,s,i,r){i||(i=s),r||(r=t);const{x:n,y:o}=r.__,a=(new R).translate(n,o).scaleOfOuter(e,s,i);r.x=a.e,r.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*i},rotateOfWorld(t,e,s,i){const r=t.parent?k.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){i||(i=t);const{x:r,y:n}=i.__,o=(new R).translate(r,n).rotateOfOuter(e,s);i.x=o.e,i.y=o.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},Ie=Ae,{updateAllWorldMatrix:We,updateAllWorldOpacity:Ne,updateAllChange:Fe}=Ie,ze={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},Ue={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.push(t),He(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(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++)Ye(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let s=t.length-1;s>-1;s--){e=t[s];for(let t=0,s=e.children.length;t<s;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:He,pushAllBranchStack:Ye}=Ue,je={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Xe,create:Ve}=s;let Ge=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 _t}get __LayoutProcessor(){return oe}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=Ve(Xe),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={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),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&je.run(this.__leaferWait),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__get(t);this.__[t]=null===e?0:null,this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?f.toInnerPoint(this.parent.worldTransform,t,e,s):e&&k.copy(e,t)}localToWorld(t,e,s){this.parent?f.toOuterPoint(this.parent.worldTransform,t,e,s):e&&k.copy(e,t)}worldToInner(t,e,s){f.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){f.toOuterPoint(this.worldTransform,t,e,s)}move(t,e){Ae.moveLocal(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),void 0===s&&(s=e),Ae.zoomOfLocal(this,k.tempToOuterOf(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Ae.rotateOfLocal(this,k.tempToOuterOf(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){this.parent&&this.parent.remove(this)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.__&&(this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null,this.children&&(this.children.forEach((t=>{t.destroy()})),this.children.length=0))}};Ge=gt([se(xe),se(ke),se(Re),se(Oe),se(he),se(Se)],Ge);const{setByListWithHandle:Ke}=H,{sort:qe}=Ue,{localBoxBounds:Qe,localEventBounds:Ze,localRenderBounds:$e,maskLocalBoxBounds:Je,maskLocalEventBounds:ts,maskLocalRenderBounds:es}=ze;let ss=class extends Ge{constructor(){super(),this.isBranch=!0,this.children=[]}__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(){Ke(this.__layout.boxBounds,this.children,this.__hasMask?Je:Qe)}__updateStrokeBounds(){Ke(this.__layout.strokeBounds,this.children,this.__hasMask?ts:Ze)}__updateRenderBounds(){Ke(this.__layout.renderBounds,this.children,this.__hasMask?es:$e)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,s=t.length;e<s;e++)t[e].__tempNumber=e;t.sort(qe)}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&je.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(ce.ADD,t))}remove(t){if(t){const e=this.children.indexOf(t);e>-1&&(this.children.splice(e,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t))}else void 0===t&&super.remove()}removeAll(){const{children:t}=this;this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,t.forEach((t=>{this.__realRemoveChild(t)}))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(ce.REMOVE,t))}__emitChildEvent(t,e){const s=new ce(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};ss=gt([se(De),se(Me)],ss);const is={};class rs{static isHoldSpaceKey(){return rs.hasDownCode("Space")}static setDownCode(t){is[t]||(is[t]=!0)}static setUpCode(t){is[t]=!1}static hasDownCode(t){return is[t]}}class ns{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class os extends de{get spaceKey(){return rs.isHoldSpaceKey()}get left(){return ns.left(this)}get right(){return ns.right(this)}get middle(){return ns.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}static changeName(t,e){nt.changeName(t,e)}}let as=class extends os{};as.POINTER="pointer",as.BEFORE_DOWN="pointer.before_down",as.BEFORE_MOVE="pointer.before_move",as.BEFORE_UP="pointer.before_up",as.DOWN="pointer.down",as.MOVE="pointer.move",as.UP="pointer.up",as.OVER="pointer.over",as.OUT="pointer.out",as.ENTER="pointer.enter",as.LEAVE="pointer.leave",as.TAP="tap",as.DOUBLE_TAP="double_tap",as.CLICK="click",as.DOUBLE_CLICK="double_click",as.LONG_PRESS="long_press",as.LONG_TAP="long_tap",as=gt([re()],as);let hs=class extends as{};var ls;hs.DRAG="drag",hs.START="drag.start",hs.END="drag.end",hs.OVER="drag.over",hs.OUT="drag.out",hs.ENTER="drag.enter",hs.LEAVE="drag.leave",hs=gt([re()],hs);let ds=ls=class extends as{static setList(t){ls.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}};ds.DROP="drop",ds=ls=gt([re()],ds);let cs=class extends hs{};cs.MOVE="move",cs.START="move.start",cs.END="move.end",cs=gt([re()],cs);let us=class extends os{};us.ROTATE="rotate",us.START="rotate.start",us.END="rotate.end",us=gt([re()],us);let _s=class extends hs{};_s.SWIPE="swipe",_s.LEFT="swipe.left",_s.RIGHT="swipe.right",_s.UP="swipe.up",_s.DOWN="swipe.down",_s=gt([re()],_s);let ps=class extends os{};ps.ZOOM="zoom",ps.START="zoom.start",ps.END="zoom.end",ps=gt([re()],ps);let gs=class extends os{};gs.DOWN="key.down",gs.PRESS="key.press",gs.UP="key.up",gs=gt([re()],gs);class fs{constructor(t){this.options=t}load(e,s){return ft(this,void 0,void 0,(function*(){return t.origin.loadImage(this.options.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,e&&e(this)})).catch((t=>{s&&s(t)}))}))}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const n=t.origin.createCanvas(e,s),o=n.getContext("2d");return i&&(o.globalAlpha=i),o.drawImage(this.view,0,0,e,s),n}destory(){this.view=null,this.options=null}}class ys{constructor(t){this.taskTime=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}}const ms=Q.get("TaskProcessor");class vs{get isComplete(){return this._isComplete}get running(){return this._running}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].taskTime,i===this.finishedIndex&&(e=s)):e+=this.list[i].taskTime;return this._isComplete?1:s/e}get total(){return this.list.length}get finishedIndex(){return this._isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this._isComplete?this.total:this.total-this.finishedIndex}constructor(t){this.config={parallel:6},this.list=[],this.index=0,t&&ct.assign(this.config,t),this.init()}init(){this.empty(),this._running=!1,this._isComplete=!0}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){clearTimeout(this._timer),this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){clearTimeout(this._timer),this._running=!1,this._isComplete=!0,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new ys(t),e)}addParallel(t,e){const s=new ys(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new ys(t))}push(t,e){e&&(t.taskTime=e),t.parent=this,this.list.push(t)}run(){this._running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTask():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTask(){this.parallelList.forEach((t=>{t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}))}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.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}nextTask(){this.total===this.finishedIndex?this.onComplete():this._timer=setTimeout((()=>this.run()),0)}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){ms.error("ParallelError"),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)}destory(){this.empty(),this.config={}}}class ws{constructor(t,e){this.map={},this.leafer=t,this.tasker=new vs}get(t){let s=this.map[t.url];return s||(s=e.image(t),this.map[t.url]=s),s}load(t,e,s){this.tasker.addParallel((()=>ft(this,void 0,void 0,(function*(){return yield t.load(e,s)})))),this.tasker.running||this.tasker.start()}destory(){this.leafer=null,this.map=null}}const xs={creator:{},parse(t,e){},convertToCanvasData(t,e){}},bs={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Bs=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},bs),Es={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},ks={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},Ts=Object.assign(Object.assign({},ks),bs),Cs=Bs,Rs={};for(let t in Cs)Rs[Cs[t]]=t;const Ls={};for(let t in Cs)Ls[Cs[t]]=Es[t];const Ps={drawRoundRect(t,e,s,i,n,o){let[a,h,l,d]=r.fourNumber(o);const c=Math.min(i/2,n/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+i,s,e+i,s+n,h):t.lineTo(e+i,s),l?t.arcTo(e+i,s+n,e,s+n,l):t.lineTo(e+i,s+n),d?t.arcTo(e,s+n,e,s,d):t.lineTo(e,s+n),a?t.arcTo(e,s,e+i,s,a):t.lineTo(e,s)}},{sin:Os,cos:Ss,atan2:Ms,ceil:Ds,abs:As,PI:Is}=Math,{setPoint:Ws,addPoint:Ns}=L,{set:Fs}=k,zs={},Us={rect(t,e,s,i,r){xs.creator.path=t,xs.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,n){xs.creator.path=[],Ps.drawRoundRect(xs.creator,e,s,i,r,n),t.push(...xs.convertToCanvasData(xs.creator.path,!0))},arcTo(t,e,s,i,r,h,l,d,c,u,_){const p=i-e,g=r-s,f=h-i,y=l-r;let m=Ms(g,p),v=Ms(y,f),w=v-m;if(w<0&&(w+=o),w===Is||As(p+g)<1e-12||As(f+y)<1e-12)return t&&t.push(Bs.L,i,r),c&&(Ws(c,e,s),Ns(c,i,r)),_&&Fs(_,e,s),void(u&&Fs(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=d/Ss(w/2),E=i+B*Ss(m+w/2+a*b),k=r+B*Os(m+w/2+a*b);return m-=a*b,v-=a*b,js(t,E,k,d,d,0,m/n,v/n,x,c,u,_)},arc:(t,e,s,i,r,n,o,a,h,l)=>js(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,h,l,d,c,u,_,p){const g=h*n,f=Os(g),y=Ss(g);let m=l*n,v=d*n;m>Is&&(m-=o),v<0&&(v+=o);let w=v-m;w<0?w+=o:w>o&&(w-=o),c&&(w-=o);const x=Ds(As(w/a)),b=w/x,B=Os(b/4),E=8/3*B*B/Os(b/2);v=m+b;let k,T,C,R,L,P,O,S,M=Ss(m),D=Os(m),A=C=y*i*M-f*r*D,I=R=f*i*M+y*r*D,W=e+C,N=s+R;t&&t.push(Bs.L,W,N),u&&Ws(u,W,N),p&&Fs(p,W,N);for(let n=0;n<x;n++)k=Ss(v),T=Os(v),C=y*i*k-f*r*T,R=f*i*k+y*r*T,L=e+A-E*(y*i*D+f*r*M),P=s+I-E*(f*i*D-y*r*M),O=e+C+E*(y*i*T+f*r*k),S=s+R+E*(f*i*T-y*r*k),t&&t.push(Bs.C,L,P,O,S,e+C,s+R),u&&Ys(e+A,s+I,L,P,O,S,e+C,s+R,u,!0),A=C,I=R,M=k,D=T,m=v,v+=b;_&&Fs(_,e+C,s+R)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Bs.C,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){Ys(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Ns(h,t,e):Ws(h,t,e),Ns(h,o,a);for(let l=0,c=d.length;l<c;l++)Hs(d[l],t,e,s,i,r,n,o,a,zs),Ns(h,zs.x,zs.y)},getPointAndSet(t,e,s,i,r,n,o,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+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return Hs(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:Hs,toTwoPointBounds:Ys,ellipse:js}=Us,{sin:Xs,cos:Vs,sqrt:Gs,atan2:Ks}=Math,{ellipse:qs}=Us,Qs={ellipticalArc(t,e,s,i,r,a,h,l,d,c,u){const _=(d-e)/2,p=(c-s)/2,g=a*n,f=Xs(g),y=Vs(g),m=-y*_-f*p,v=-y*p+f*_,w=i*i,x=r*r,b=v*v,B=m*m,E=w*x-w*b-x*B;let k=0;if(E<0){const t=Gs(1-E/(w*x));i*=t,r*=t}else k=(h===l?-1:1)*Gs(E/(w*b+x*B));const T=k*i*v/r,C=-k*r*m/i,R=Ks((v-C)/r,(m-T)/i),L=Ks((-v-C)/r,(-m-T)/i);let P=L-R;0===l&&P>0?P-=o:1===l&&P<0&&(P+=o);const O=e+_+y*T-f*C,S=s+p+f*T+y*C,M=P<0?1:0;u?qs(t,O,S,i,r,a,R/n,L/n,M):i!==r||a?t.push(Bs.G,O,S,i,r,a,R/n,L/n,M):t.push(Bs.O,O,S,i,R/n,L/n,M)}},{M:Zs,m:$s,L:Js,l:ti,H:ei,h:si,V:ii,v:ri,C:ni,c:oi,S:ai,s:hi,Q:li,q:di,T:ci,t:ui,A:_i,a:pi,Z:gi,z:fi,N:yi,D:mi,X:vi,G:wi,F:xi,O:bi,P:Bi,U:Ei}=Bs,{rect:ki,roundRect:Ti,arcTo:Ci,arc:Ri,ellipse:Li,quadraticCurveTo:Pi}=Us,{ellipticalArc:Oi}=Qs,Si=Q.get("PathConvert"),Mi={},Di={current:{},stringify(t){let e,s,i,r=0,n=t.length,o="";for(;r<n;){s=t[r],e=Ls[s],o+=s===i?" ":Rs[s];for(let s=1;s<e;s++)o+=t[r+s],s===e-1||(o+=" ");i=s,r+=e}return o},parse(t,e){let s,i,r,n="";const o=[],a=e?Ts:ks;for(let e=0,h=t.length;e<h;e++)i=t[e],q[i]?n+=i:Bs[i]?(n&&(Ii(o,Number(n)),n=""),Ai.name=Bs[i],Ai.length=Es[i],Ai.index=0,Ii(o,Ai.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&Ii(o,Number(n)),n=i):n&&(Ii(o,Number(n)),n=""),r=i;return n&&Ii(o,Number(n)),s?Di.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case $s:t[c+1]+=a,t[c+2]+=h;case Zs:a=t[c+1],h=t[c+2],_.push(Zs,a,h),c+=3;break;case si:t[c+1]+=a;case ei:a=t[c+1],_.push(Js,a,h),c+=2;break;case ri:t[c+1]+=h;case ii:h=t[c+1],_.push(Js,a,h),c+=2;break;case ti:t[c+1]+=a,t[c+2]+=h;case Js:a=t[c+1],h=t[c+2],_.push(Js,a,h),c+=3;break;case hi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ai;case ai:o=n===ni||n===ai,l=o?2*a-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(ni,l,d,s,i,a,h),c+=5;break;case oi: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=ni;case ni:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ni,t[c+1],t[c+2],s,i,a,h),c+=7;break;case ui:t[c+1]+=a,t[c+2]+=h,r=ci;case ci:o=n===li||n===ci,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Pi(_,a,h,s,i,t[c+1],t[c+2]):_.push(li,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case di:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=li;case li:s=t[c+1],i=t[c+2],e?Pi(_,a,h,s,i,t[c+3],t[c+4]):_.push(li,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case pi:t[c+6]+=a,t[c+7]+=h;case _i:Oi(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case fi:case gi:_.push(gi),c++;break;case yi:a=t[c+1],h=t[c+2],e?ki(_,a,h,t[c+3],t[c+4]):Wi(_,t,c,5),c+=5;break;case mi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Wi(_,t,c,9),c+=9;break;case vi:a=t[c+1],h=t[c+2],e?Ti(_,a,h,t[c+3],t[c+4],t[c+5]):Wi(_,t,c,6),c+=6;break;case wi:Li(e?_:Wi(_,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,Mi),a=Mi.x,h=Mi.y,c+=9;break;case xi:e?Li(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Wi(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case bi:Ri(e?_:Wi(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Mi),a=Mi.x,h=Mi.y,c+=7;break;case Bi:e?Ri(_,t[c+1],t[c+2],t[c+3],0,360,!1):Wi(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ei:Ci(e?_:Wi(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Mi),a=Mi.x,h=Mi.y,c+=6;break;default:return Si.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){Ai.index===Ai.length&&(Ai.index=1,t.push(Ai.name)),t.push(e),Ai.index++}},{current:Ai,pushData:Ii,copyData:Wi}=Di,{M:Ni,L:Fi,C:zi,Q:Ui,Z:Hi,N:Yi,D:ji,X:Xi,G:Vi,F:Gi,O:Ki,P:qi,U:Qi}=Bs,Zi={},$i={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ni,e,s)},lineTo(t,e,s){t.push(Fi,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(zi,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Ui,e,s,i,r)},closePath(t){t.push(Hi)},rect(t,e,s,i,r){t.push(Yi,e,s,i,r)},roundRect(t,e,s,i,n,o){if("number"==typeof o)t.push(Xi,e,s,i,n,o);else{const a=r.fourNumber(o);a?t.push(ji,e,s,i,n,...a):t.push(Yi,e,s,i,n)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push(Gi,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Vi,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(qi,e,s,i):(void 0===n&&(n=360),t.push(Ki,e,s,i,r,n,o?1:0))},moveToEllipse(t,e,s,i,r,n,o,a,h){void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=360),Us.ellipse(null,e,s,i,r,n,o,a,h,null,null,Zi),t.push(Ni,Zi.x,Zi.y),Ji(t,e,s,i,r,n,o,a,h)},moveToArc(t,e,s,i,r,n,o){void 0===r&&(r=0),void 0===n&&(n=360),Us.arc(null,e,s,i,r,n,o,null,null,Zi),t.push(Ni,Zi.x,Zi.y),tr(t,e,s,i,r,n,o)},arcTo(t,e,s,i,r,n){t.push(Qi,e,s,i,r,n)}},{ellipse:Ji,arc:tr}=$i,{moveTo:er,lineTo:sr,quadraticCurveTo:ir,bezierCurveTo:rr,closePath:nr,beginPath:or,rect:ar,roundRect:hr,ellipse:lr,arc:dr,arcTo:cr,moveToEllipse:ur,moveToArc:_r}=$i;class pr{constructor(t){this.path=t?"string"==typeof t?xs.parse(t):t:[]}beginPath(){return or(this.path),this}moveTo(t,e){return er(this.path,t,e),this}lineTo(t,e){return sr(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,n){return rr(this.path,t,e,s,i,r,n),this}quadraticCurveTo(t,e,s,i){return ir(this.path,t,e,s,i),this}closePath(){return nr(this.path),this}rect(t,e,s,i){return ar(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return hr(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,n,o,a){return lr(this.path,t,e,s,i,r,n,o,a),this}arc(t,e,s,i,r,n){return dr(this.path,t,e,s,i,r,n),this}arcTo(t,e,s,i,r){return cr(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,n,o,a){return ur(this.path,t,e,s,i,r,n,o,a),this}moveToArc(t,e,s,i,r,n){return _r(this.path,t,e,s,i,r,n),this}}const{M:gr,L:fr,C:yr,Q:mr,Z:vr,N:wr,D:xr,X:br,G:Br,F:Er,O:kr,P:Tr,U:Cr}=Bs,Rr=Q.get("PathDrawer"),Lr={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case gr:t.moveTo(e[i+1],e[i+2]),i+=3;break;case fr:t.lineTo(e[i+1],e[i+2]),i+=3;break;case yr:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case mr:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case vr:t.closePath(),i+=1;break;case wr:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case xr: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 br:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Br:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*n,e[i+6]*n,e[i+7]*n,e[i+8]),i+=9;break;case Er:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,o,!1),i+=5;break;case kr:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*n,e[i+5]*n,e[i+6]),i+=7;break;case Tr:t.arc(e[i+1],e[i+2],e[i+3],0,o,!1),i+=4;break;case Cr:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Rr.error(`command: ${s} [index:${i}]`,e)}}},{M:Pr,L:Or,C:Sr,Q:Mr,Z:Dr,N:Ar,D:Ir,X:Wr,G:Nr,F:Fr,O:zr,P:Ur,U:Hr}=Bs,{toTwoPointBounds:Yr,toTwoPointBoundsByQuadraticCurve:jr,arcTo:Xr,arc:Vr,ellipse:Gr}=Us,{add:Kr,copy:qr,addPoint:Qr,setPoint:Zr,addBounds:$r,toBounds:Jr}=L,tn=Q.get("PathBounds");let en,sn,rn;const nn={},on={},an={},hn={toBounds(t,e){hn.toTwoPointBounds(t,on),Jr(on,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Zr(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===Dr||s===Sr||s===Mr?Zr(e,h,l):Zr(e,t[a+1],t[a+2])),s){case Pr:case Or:h=t[a+1],l=t[a+2],Qr(e,h,l),a+=3;break;case Sr:n=t[a+5],o=t[a+6],Yr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,nn),Kr(e,nn),h=n,l=o,a+=7;break;case Mr:i=t[a+1],r=t[a+2],n=t[a+3],o=t[a+4],jr(h,l,i,r,n,o,nn),Kr(e,nn),h=n,l=o,a+=5;break;case Dr:a+=1;break;case Ar:h=t[a+1],l=t[a+2],$r(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ir:case Wr:h=t[a+1],l=t[a+2],$r(e,h,l,t[a+3],t[a+4]),a+=s===Ir?9:6;break;case Nr:Gr(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],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=9;break;case Fr:h=t[a+1],l=t[a+2],sn=t[a+3],rn=t[a+4],$r(e,h-sn,l-rn,2*sn,2*rn),h+=sn,a+=5;break;case zr:Vr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=7;break;case Ur:h=t[a+1],l=t[a+2],en=t[a+3],$r(e,h-en,l-en,2*en,2*en),h+=en,a+=4;break;case Hr:Xr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],nn,an),0===a?qr(e,nn):Kr(e,nn),h=an.x,l=an.y,a+=6;break;default:return void tn.error(`command: ${s} [index:${a}]`,t)}}},ln={smooth:(t,e,s)=>t};xs.creator=new pr,xs.parse=Di.parse,xs.convertToCanvasData=Di.toCanvasData;const dn=Q.get("plugin"),cn={power:{},list:[]};function un(t,e){const{power:s}=cn;cn.list.push(t);const i={};t.import?t.import.forEach((t=>{s[t]?i[t]=s[t]:dn.error(t+" non-existent")})):dn.warn("no import");try{t.run(i,e)}catch(t){dn.error(t)}}class _n{get updatedList(){if(this.hasRemoved){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.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(ve.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===ce.ADD?this.__pushChild(t.child):(this.hasRemoved||(this.hasRemoved=!0),this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(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 fe(fe.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ue.CHANGE,this.__onAttrChange,this),t.on_([ce.ADD,ce.REMOVE],this.__onChildEvent,this),t.on_(fe.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:pn,updateAllWorldOpacity:gn}=Ae,{pushAllChildBranch:fn,pushAllParent:yn}=Ue;const{worldBounds:mn}=ze,{setByListWithHandle:vn}=H;class wn{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){vn(this.beforeBounds,this.updatedList.list,mn)}setAfter(){vn(this.afterBounds,this.updatedList.list,mn),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:xn,updateAllChange:bn}=Ae,{pushAllBranchStack:Bn,updateWorldBoundsByBranchStack:En}=Ue,kn=Q.get("Layouter");class Tn{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.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.running)return;const{target:t}=this;this.times=0;try{t.emit(ye.START),this.layoutOnce(),t.emitEvent(new ye(ye.END,this.layoutedBlocks,this.times))}catch(t){kn.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?kn.warn("layouting"):this.times>3?kn.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(fe.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=J.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=ye,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new ye(r,a,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(pn(t),e.push(t),t.isBranch&&fn(t,e),yn(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),yn(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&gn(t),t.__updateChange()}))}(i),a.forEach((t=>t.setAfter())),s.emitEvent(new ye(n,a,this.times)),s.emitEvent(new ye(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=ye,n=this.getBlocks(new ht(e));e.emitEvent(new ye(s,n,this.times)),Tn.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new ye(i,n,this.times)),e.emitEvent(new ye(r,n,this.times)),this.addBlocks(n),J.end(t)}static fullLayout(t){if(xn(t),t.isBranch){const e=[t];Bn(t,e),En(e)}else t.__updateWorldBounds();bn(t)}createBlock(t){return new wn(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(){const{target:t}=this;this.__eventIds=[t.on_(ye.REQUEST,this.layout,this),t.on_(ye.AGAIN,this.layoutAgain,this),t.on_(fe.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Cn=Q.get("Renderer");class Rn{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=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ye.REQUEST)}render(t){if(!this.running)return;const{target:e}=this;this.times=0,this.totalBounds=new V,Cn.log(e.innerName,"---\x3e");try{this.emitRender(ve.START),this.renderOnce(t),this.emitRender(ve.END,this.totalBounds)}catch(t){Cn.error(t)}Cn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Cn.warn("rendering"):this.times>3?Cn.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(ve.BEFORE),t()):(this.requestLayout(),this.emitRender(ve.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(ve.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ve.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return Cn.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),n=(new V).copy(i);s.save(),r&&!Q.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,n),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Q.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Q.showHitView&&this.renderHitView(s),Q.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.render(),this.running&&this.target.emit(me.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__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&&(Cn.warn(t.innerName,": none bounds"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new ve(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ve.REQUEST,this.update,this),t.on_(ye.END,this.__onLayoutEnd,this),t.on_(ve.AGAIN,this.renderAgain,this),t.on_(pe.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:Ln}=H;class Pn{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const n=this.findList,o=this.getBestMatchLeaf(),a=r?this.getPath(o):this.getHitablePath(o);return this.clear(),i?{path:a,leaf:o,throughPath:n.length?this.getThroughPath(n):a}:{path:a,leaf:o}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],Ae.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,n;for(let t=0,o=s.length;t<o;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(n=i.list[t],!r||!r.has(n));t++)e.push(n)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let n=t.length-1;n>-1;n--)s=t[n],e&&!s.isMask||(i=Ln(s.__world,r),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,r)):i&&this.hitChild(s,r))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.target=null,this.selector=null}}class On{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new Pn(t,this),this.__listenEvents()}getByPoint(e,s,i){return t.realtimeLayout&&this.target.emit(ye.CHECK_UPDATE),this.findPath.getByPoint(e,s,i)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(ce.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(e,{watcher:(t,e)=>new _n(t,e),layouter:(t,e)=>new Tn(t,e),renderer:(t,e,s)=>new Rn(t,e,s),selector:(t,e)=>new On(t,e)}),t.layout=Tn.fullLayout;const Sn=Q.get("LeaferCanvas");class Mn extends Tt{init(){const{view:t}=this.config;if(this.offscreen)t?this.view=t:this.__createView();else{t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;this.autoLayout&&(e.display||(e.display="block")),this.parentView=this.view.parentElement}this.__createContext(),this.autoLayout||this.resize(this.config)}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}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}__createView(){if(this.offscreen)try{return void(this.view=new OffscreenCanvas(1,1))}catch(t){Sn.error(t)}this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof 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;if(t.hasChildNodes()){const{style:e}=s;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(s)}else Sn.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;if(!this.offscreen){const{style:s}=this.view;s.width=t+"px",s.height=e+"px"}this.view.width=t*s,this.view.height=e*s}startAutoLayout(t,e){if(!this.offscreen){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),window.requestAnimationFrame(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:n}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||n!==this.height){const{style:t}=e,{pixelRatio:o}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const a={width:r,height:n,pixelRatio:o},h={};ct.copyAttrs(h,this,kt),this.resize(a),void 0!==this.width&&this.resizeListener(new pe(a,h))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}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.unreal&&!this.offscreen){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}const{drawRoundRect:Dn}=Ps;!function(){const t=CanvasRenderingContext2D.prototype;t.roundRect||(t.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,r){Dn(this,t,e,s,i,r)})}();class An{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(cs.START,this.moveData)}t.path=this.moveData.path,e.emit(cs.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(ps.START,this.zoomData)}t.path=this.zoomData.path,e.emit(ps.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(us.START,this.rotateData)}t.path=this.rotateData.path,e.emit(us.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(cs.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(ps.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(us.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const In={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?_s.UP:t>45&&t<135?_s.DOWN:t<=45&&t>=-45?_s.RIGHT:_s.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:Wn.getSwipeDirection(k.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Wn=In,{getDragEventData:Nn,getDropEventData:Fn,getSwipeEventData:zn,filterPathByEventType:Un}=In;class Hn{constructor(t){this.interaction=t}setDragData(t){this.dragData=Nn(t,t,t)}getDragList(){return this.dragging?ds.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!ns.middle(t)&&!ns.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const n=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(ns.middle(t)||rs.isHoldSpaceKey()||n)&&e,this.moving&&s.emit(cs.START,r)}this.moving||this.dragStart(t,e);const{path:n,throughPath:o}=i;this.dragData=Nn(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?s.emit(cs.MOVE,this.dragData):this.dragging&&(s.emit(hs.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=ns.left(t)&&e,this.dragging&&(this.interaction.emit(hs.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Un(this.dragData.path,hs.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{Ae.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(hs.OUT,t,s),e.emit(hs.OVER,t,i)):e.emit(hs.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(hs.ENTER,t,i,s),e.emit(hs.LEAVE,t,s,i),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,n=Nn(s,t,t);r&&(n.throughPath=r),n.path=i,this.moving&&e.emit(cs.END,n),this.dragging&&(e.emit(hs.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(k.getDistance(i,t)>s.config.pointer.swipeDistance){const t=zn(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Fn(t,this.getDragList(),ds.dragData);e.path=this.dragEnterPath,this.interaction.emit(ds.DROP,e),this.interaction.emit(hs.LEAVE,t,this.dragEnterPath)}dragReset(){ds.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const n=e.shrinkCanvasBounds,{x:o,y:a}=n,h=H.right(n),l=H.bottom(n),d=t.x<o?i:h<t.x?-i:0,c=t.y<a?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,k.move(s,d,c),k.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:_})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const Yn=["move","zoom","rotate"];function jn(t,e,s,i,r){if(Yn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Vn(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!s.path.has(n)&&n.__.hittable&&Xn(n,e,s,i,r)}}function Xn(t,e,s,i,r){if(!t.__)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!Vn(t,r)){s.phase=i?1:t===s.target?2:3;const r=nt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Vn(t,e){return e&&e.has(t)}const{pathHasEventType:Gn}=In;class Kn{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,i,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=i,this.defaultPath=new ht(e),this.transformer=new An(this),this.dragger=new Hn(this),r&&(this.config=ct.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(as.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getByPoint(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(as.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),ns.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit(as.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=k.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:as.MOVE});t.path=e.path,this.emit(as.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit(as.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(as.UP,t),this.emit(as.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit(as.OUT,t,this.overPath),this.emit(as.OVER,t,e)):this.emit(as.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit(as.ENTER,t,e,this.enterPath),this.emit(as.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(as.LEAVE,t),this.dragger.dragging&&this.emit(ds.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[as.DOUBLE_TAP,as.DOUBLE_CLICK].some((e=>Gn(t.path,e)));i<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}emitTap(t){this.emit(as.TAP,t),this.emit(as.CLICK,t)}emitDoubleTap(t){this.emit(as.DOUBLE_TAP,t),this.emit(as.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(as.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(as.LONG_TAP,t),Gn(t.path,as.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(pe.RESIZE,this.__onResize,this)],this.__onResize()}__removeListenEvents(){this.target.off_(this.__eventIds)}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let n=s.length-1;n>-1;n--){if(r=s.list[n],Xn(r,t,e,!0,i))return;r.isApp&&jn(r,t,e,!0,i)}for(let n=0,o=s.length;n<o;n++)if(r=s.list[n],r.isApp&&jn(r,t,e,!1,i),Xn(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=null,this.target=null,this.selector=null,this.canvas=null,this.dragger=null,this.transformer=null)}}const qn={convert(t,e){const s=In.getBase(t),i=Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===i.pointerType&&(i.tangentialPressure=t.tangentialPressure,i.tiltX=t.tiltX,i.tiltY=t.tiltY,i.twist=t.twist),i},convertMouse(t,e){const s=In.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const s=qn.getTouch(t),i=In.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:s.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Qn={getData(t,e){const s=k.getCenter(t[0],t[1]),i=k.getCenter(e[0],e[1]),r={x:i.x-s.x,y:i.y-s.y},n=k.getDistance(t[0],t[1]),o=k.getDistance(e[0],e[1])/n,a=k.getAngle(t[0],t[1]),h=k.getAngle(e[0],e[1]);return{move:r,scale:o,angle:this.getChangedAngle(a,h),center:i}},getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},Zn={getMove(t,e){let{moveSpeed:s}=e,{deltaX:i,deltaY:r}=t;return t.shiftKey&&!i&&(i=r,r=0),i>50&&(i=Math.max(50,i/3)),r>50&&(r=Math.max(50,r/3)),{x:-i*s*2,y:-r*s*2}},getScale(e,s){let i,n=1,{zoomMode:o,zoomSpeed:a}=s;const h=e.deltaY||e.deltaX;if(o?(i=!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(i=!0)):i=!e.shiftKey&&(e.metaKey||e.ctrlKey),i){a=r.within(a,0,1);n=1-h/(25*(e.deltaY?s.delta.y:s.delta.x)*(1-a)+10),n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}},{getMoveEventData:$n,getZoomEventData:Jn,getRotateEventData:to}=In;class eo extends Kn{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t){const e=this.view.getBoundingClientRect();return{x:t.clientX-e.x,y:t.clientY-e.y}}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){rs.setDownCode(t.code)}onKeyUp(t){rs.setUpCode(t.code)}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerDown(qn.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.preventWindowPointer(t)||this.pointerMove(qn.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMutiTouch||this.preventWindowPointer(t)||this.pointerUp(qn.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(qn.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(qn.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(qn.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.mutiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=qn.getTouch(t);this.pointerDown(qn.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=qn.getTouch(t);this.pointerMove(qn.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.mutiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=qn.getTouch(t);this.pointerUp(qn.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Qn.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Qn.getTouches(t.touches),s=e.find((t=>t.identifier===this.touches[0].identifier)),i=e.find((t=>t.identifier===this.touches[1].identifier));if(s&&i){const r=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],n=[this.getLocal(s),this.getLocal(i)],{move:o,angle:a,scale:h,center:l}=Qn.getData(r,n),d=In.getBase(t);this.rotate(to(l,a,d)),this.zoom(Jn(l,h,d)),this.move($n(l,o,d)),this.touches=e}}}mutiTouchEnd(){this.touches=null,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):Zn.getScale(t,e),i=this.getLocal(t),r=In.getBase(t);1!==s?this.zoom(Jn(i,s,r)):this.move($n(i,e.getMove?e.getMove(t,e):Zn.getMove(t,e),r))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),s=In.getBase(t),i=t.scale/this.lastGestureScale,n=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=r.within(o,0,1),this.zoom(Jn(e,i*i,s)),this.rotate(to(e,n/Math.PI*180*(o/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}const{mineType:so,fileType:io}=pt;function ro(s,i){t.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>t.toDataURL(so(e),s),canvasToBolb:(t,e,s)=>new Promise((i=>t.toBlob(i,so(e),s))),canvasSaveAs:(t,e,s)=>new Promise((i=>{let r=document.createElement("a");r.href=t.toDataURL(so(io(e)),s),r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),i()})),loadImage:t=>new Promise(((e,s)=>{const i=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>{e(i)},i.onerror=t=>{s(t)},t.startsWith("data:")||t.includes("?"),i.src=t}))},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new Mn(t,e),image:t=>new fs(t),hitCanvas:(t,e)=>new Mn(t,e),interaction:(t,e,s,i)=>new eo(t,e,s,i)}),t.name="web",t.requestRender=function(t){window.requestAnimationFrame(t)},t.devicePixelRatio=devicePixelRatio,t.realtimeLayout=!0;const{userAgent:no}=navigator;no.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):no.indexOf("Safari")>-1&&-1===no.indexOf("Chrome")&&(t.fullImageShadow=!0),no.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):no.indexOf("Mac")>-1?t.os="Mac":no.indexOf("Linux")>-1&&(t.os="Linux");const oo=Q.get("LeaferTypeCreator"),ao={list:{},register(t,e){ho[t]?oo.repeat(t):ho[t]=e},run(t,e){const s=ao.list[t];s?s(e):oo.error("no",t)}},{list:ho}=ao;ao.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),ao.register("design",(function(t){const{MOVE:e}=cs,{ZOOM:s}=ps;t.__eventIds.push(t.on_(e,(e=>{Ae.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:n}=e;n*s<i?n=i/s:n*s>r&&(n=r/s),1!==n&&Ae.zoomOfWorld(t.zoomLayer,e,n)})))}));const lo={},co={},uo={},_o={export(t,e,s){return new Promise((i=>{const{leafer:r}=t;r?r.waitViewLoaded((()=>ft(this,void 0,void 0,(function*(){let t,n,o,{canvas:a}=r,{unreal:h}=a;switch(h&&(a=a.getSameCanvas(),a.backgroundColor=r.config.fill,r.__render(a,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(n=!0);break;case"number":t=s;break;case"boolean":n=s}o=e.includes(".")?yield a.saveAs(e,t):n?yield a.toBlob(e,t):a.toDataURL(e,t),i({data:o}),h&&a.recycle()})))):i({data:!1})}))}},{copy:po,toOffsetOutBounds:go}=H,fo={},yo={};function mo(e,s,i,r){const{bounds:n,shapeBounds:o}=r;if(t.fullImageShadow){if(po(fo,e.bounds),fo.x+=s.x-o.x,fo.y+=s.y-o.y,i){const{matrix:t}=r;fo.x-=(n.x+(t?t.e:0)+n.width/2)*(i-1),fo.y-=(n.y+(t?t.f:0)+n.height/2)*(i-1),fo.width*=i,fo.height*=i}e.copyWorld(r.canvas,e.bounds,fo)}else i&&(po(fo,s),fo.x-=s.width/2*(i-1),fo.y-=s.height/2*(i-1),fo.width*=i,fo.height*=i),e.copyWorld(r.canvas,o,i?fo:s)}const{toOffsetOutBounds:vo}=H,wo={};var xo=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s){let i,r;const{__world:n,__layout:o}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;vo(l,wo),a.forEach(((t,a)=>{_.save(),_.setWorldShadow(wo.offsetX+t.x*c,wo.offsetY+t.y*u,t.blur*c),r=t.spread?1-2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,mo(_,wo,r,s),_.restore(),h?(_.copyWorld(_,l,n,"copy"),_.copyWorld(h,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,t.color,"source-in"),e.copyWorldToInner(_,i,o.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()},shadow:function(t,e,s){let i,r;const{__world:n,__layout:o}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;go(l,yo),a.forEach(((t,a)=>{_.setWorldShadow(yo.offsetX+t.x*c,yo.offsetY+t.y*u,t.blur*c,t.color),r=t.spread?1+2*t.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,mo(_,yo,r,s),i=l,t.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,n,"copy"),i=n),h?_.copyWorld(h,n,n,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),e.copyWorldToInner(_,i,o.renderBounds,t.blendMode),p&&a<p&&_.clear()})),_.recycle()}});function bo(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,n)}function Bo(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),Co(t,e);break;case"inside":Eo(t,e,s,"inside");break;case"outside":Eo(t,e,s,"outside")}}function Eo(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),o.font=n,Co(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",bo(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function ko(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),To(t,s,e);break;case"inside":Eo(t,e,s,"inside");break;case"outside":!function(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(void 0,2*r,t.__),o.font=n,To(t,s,o),o.blendMode="outside"===i?"destination - out":"destination -in ",bo(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}(t,e,s,"outside")}}function To(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),Co(t,s),s.restoreBlendMode()):Co(t,s)}))}function Co(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)s=i[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)})),r&&e.strokeRect(s.x,s.y+r,s.width,n)}function Ro(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:Lo,getOuterOf:Po,getByMove:Oo,getIntersectData:So}=H;const Mo={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},{get:Do,rotateOfOuter:Ao,translate:Io,scaleOfOuter:Wo,scale:No,rotate:Fo}=f;function zo(e,s,i,r){const{type:n,blendMode:o}=i;let a={type:n,style:"rgba(255,255,255,0)"};o&&(a.blendMode=o);const{imageManager:h}=e.leafer,l=h.get(i);if(l.ready){if(!Uo(e,l)){let e,{opacity:s,mode:n,offset:o,scale:h,rotation:d}=i,{width:c,height:u}=l;const _=r.width===c&&r.height===u;switch(n){case"strench":_||(c=r.width,u=r.height),(r.x||r.y)&&(e=Do(),Io(e,r.x,r.y));break;case"clip":(o||h||d)&&(e=function(t,e,s,i){const r=Do();Io(r,t.x,t.y),e&&Io(r,e.x,e.y);s&&("number"==typeof s?No(r,s):No(r,s.x,s.y));i&&Fo(r,i);return r}(r,o,h,d));break;case"repeat":(!_||h||d)&&(e=function(t,e,s,i,r){const n=Do();if(r)switch(Fo(n,r),r){case 90:Io(n,s,0);break;case 180:Io(n,e,s);break;case 270:Io(n,0,e)}Io(n,t.x,t.y),i&&Wo(n,t,i);return n}(r,c,u,h,d));break;default:_&&!d||(e=function(t,e,s,i,r){const n=Do(),o=r&&180!==r,a=e.width/(o?i:s),h=e.height/(o?s:i),l="fit"===t?Math.min(a,h):Math.max(a,h),d=e.x+(e.width-s*l)/2,c=e.y+(e.height-i*l)/2;Io(n,d,c),No(n,l),r&&Ao(n,{x:e.x+e.width/2,y:e.y+e.height/2},r);return n}(n,r,c,u,d))}a.style=function(e,s,i){let r=t.canvas.createPattern(e,i?"repeat":"no-repeat");if(s){const{a:t,b:e,c:i,d:n,e:o,f:a}=s;r.setTransform(new DOMMatrix([t,e,i,n,o,a]))}return r}(l.getCanvas(c,u,s),e,"repeat"===n)}}else h.load(l,(()=>{e.leafer&&(Uo(e,l)||e.forceUpdate("width"),e.emitEvent(new _e(_e.LOADED,e,l,s,i)))}),(t=>{e.emitEvent(new _e(_e.ERROR,e,l,s,i,t))}));return a}function Uo(t,e){let s;const{__:i}=t;return i&&(i.__getInput("width")||(s=!0,t.width=e.width),i.__getInput("height")||(s=!0,t.height=e.height)),s}const Ho={x:.5,y:0},Yo={x:.5,y:1};function jo(t,e,s){let i;for(let r=0,n=e.length;r<n;r++)i=e[r],t.addColorStop(i.offset,Mo.string(i.color,s))}const{set:Xo,getAngle:Vo,getDistance:Go}=k,{get:Ko,rotateOfOuter:qo,scaleOfOuter:Qo}=f,Zo={x:.5,y:.5},$o={x:.5,y:1},Jo={},ta={};const{set:ea,getAngle:sa,getDistance:ia}=k,{get:ra,rotateOfOuter:na,scaleOfOuter:oa}=f,aa={x:.5,y:.5},ha={x:.5,y:1},la={},da={};function ca(t,e){let s,i=t.__.__input[e];const r=[];i instanceof Array||(i=[i]);for(let n=0,o=i.length;n<o;n++)s=ua(t,i[n],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function ua(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=e.__layout;switch(s.type){case"solid":let{type:n,blendMode:o,color:a,opacity:h}=s;return{type:n,blendMode:o,style:Mo.string(a,h)};case"image":return zo(e,i,s,r);case"linear":return function(e,s){let{from:i,to:r,type:n,blendMode:o,opacity:a}=e;i||(i=Ho),r||(r=Yo);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);return jo(h,e.stops,a),{type:n,blendMode:o,style:h}}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:n,opacity:o,blendMode:a,stretch:h}=e;i||(i=Zo),r||(r=$o);const{x:l,y:d,width:c,height:u}=s;let _;Xo(Jo,l+i.x*c,d+i.y*u),Xo(ta,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=Ko(),Qo(_,Jo,c/u*(h||1),1),qo(_,Jo,Vo(Jo,ta)+90));const p=t.canvas.createRadialGradient(Jo.x,Jo.y,0,Jo.x,Jo.y,Go(Jo,ta));return jo(p,e.stops,o),{type:n,blendMode:a,style:p,transform:_}}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:n,opacity:o,blendMode:a,stretch:h}=e;i||(i=aa),r||(r=ha);const{x:l,y:d,width:c,height:u}=s;ea(la,l+i.x*c,d+i.y*u),ea(da,l+r.x*c,d+r.y*u);const _=ra(),p=sa(la,da);t.conicGradientRotate90?(oa(_,la,c/u*(h||1),1),na(_,la,p+90)):(oa(_,la,1,c/u*(h||1)),na(_,la,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,la.x,la.y):t.canvas.createRadialGradient(la.x,la.y,0,la.x,la.y,ia(la,da));return jo(g,e.stops,o),{type:n,blendMode:a,style:g,transform:_}}(s,r);default:return s.r?{type:"solid",style:Mo.string(s)}:void 0}}var _a=Object.freeze({__proto__:null,computeFill:function(t){ca(t,"fill")},computeStroke:function(t){ca(t,"stroke")},drawText:bo,drawTextStroke:Co,fill:function(t,e,s){e.fillStyle=s,t.__.__font?bo(t,e):e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:r,__font:n}=t.__;for(let o=0,a=s.length;o<a;o++)if(i=s[o],e.fillStyle=i.style,i.transform){e.save();const{a:s,b:o,c:a,d:h,e:l,f:d}=i.transform;e.transform(s,o,a,h,l,d),i.blendMode&&(e.blendMode=i.blendMode),n?bo(t,e):e.fill(r),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),n?bo(t,e):e.fill(r),e.restoreBlendMode()):n?bo(t,e):e.fill(r)},shape:function(t,e,s){const i=e.getSameCanvas();let r,n,o,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))r=o=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=So(i?Lo(e.bounds,i*l):e.bounds,h,s.matrix);n=e.bounds.getFitMatrix(c),n.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=n.a,d*=n.d),o=Po(h,n),r=Oo(o,-n.e,-n.f),s.matrix&&n.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:n})}return t.__renderShape(i,s),{canvas:i,matrix:n,bounds:r,worldCanvas:a,shapeBounds:o,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)Bo(t,e,s);else switch(n){case"center":e.setStroke(s,r,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*r,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);n.setStroke(s,2*r,t.__),t.__drawRenderPath(n),n.stroke(),n.clip(i.windingRule),n.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokeText:Bo,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(o)ko(t,e,s);else switch(n){case"center":e.setStroke(void 0,r,i),Ro(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),Ro(s,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,o=e.getSameCanvas(!0);t.__drawRenderPath(o),o.setStroke(void 0,2*r,t.__),Ro(s,o),o.clip(i.windingRule),o.clearWorld(n),e.copyWorldToInner(o,t.__world,n),o.recycle()}},strokesText:ko});Object.assign(lo,xo),Object.assign(co,_a);class pa extends _t{setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:co.computeFill(this.__leaf),this.__isFills=!0):(this._fill=t,this.__input&&this.__removeInput("fill"),this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged?this._stroke=t:co.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const ga={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class fa extends pa{}class ya extends fa{get __boxStroke(){return!0}}class ma extends pa{get __boxStroke(){return!0}}const{parse:va}=Di;const wa={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class xa extends ma{}function ba(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Ba(t){return(e,s)=>{Pt(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const Ea={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:o}=this.__;if((s||"all"===i)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*n/2)*Math.sqrt(o)-t:0,r="none"===s?0:o;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let n=t=Math.ceil(t);return s&&s.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(n=Math.max(n,r)),this.__layout.renderShapeSpread=n,t}},ka={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawHitPath(this.__hitCanvas),this.__hitCanvas.setStrokeOptions(this.__)},__hit(t){const{__hitCanvas:e}=this,{fill:s,hitFill:i,windingRule:r}=this.__,n=s&&"path"===i||"all"===i;if(n&&e.hitFill(t,r))return!0;const{stroke:o,hitStroke:a,strokeWidth:h,strokeAlign:l}=this.__,d=o&&"path"===a||"all"===a,c=2*t.radiusX;let u=2*(d?"center"===l?h/2:h:0)+c;if(!u)return!1;switch(l){case"inside":if(!n&&e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c;break;case"outside":if(!n){if(!e.hitFill(t,r)&&e.hitStroke(t,u))return!0;u=c}}return!!u&&e.hitStroke(t,u)}},Ta={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&co.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&co.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const n=co.shape(this,t,e),{shadow:o,innerShadow:a}=this.__;o&&lo.shadow(this,t,n),s&&(this.__.__isFills?co.fills(this,t,s):co.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&lo.innerShadow(this,t,n),i&&(this.__.__isStrokes?co.strokes(this,t,i):co.stroke(this,t,i)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else s&&(this.__.__isFills?co.fills(this,t,s):co.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?co.strokes(this,t,i):co.stroke(this,t,i))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&co.fill(this,t,"#000000"),i&&co.stroke(this,t,"#000000")}},Ca={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:n,__drawAfterFill:o}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),o&&this.__drawAfterFill(t,e),n){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(n,r,this.__);const o=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(o,o,s-r,i-r);break;case"outside":t.strokeRect(-o,-o,s+r,i+r)}}}};let Ra=class extends Ge{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?Di.toCanvasData(e,!0):e:[]}getPathString(t){return Di.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&co.computeFill(this),e&&co.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?ln.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return _o.export(this,t,e)}static one(t,e,s,i,r){return st.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};gt([Vt(pa)],Ra.prototype,"__",void 0),gt([Ot("")],Ra.prototype,"id",void 0),gt([Ot("")],Ra.prototype,"name",void 0),gt([Ot("")],Ra.prototype,"className",void 0),gt([zt("pass-through")],Ra.prototype,"blendMode",void 0),gt([Ut(1)],Ra.prototype,"opacity",void 0),gt([Ut(!0)],Ra.prototype,"visible",void 0),gt([Yt(!1)],Ra.prototype,"isMask",void 0),gt([jt(!1)],Ra.prototype,"isEraser",void 0),gt([Ht(0)],Ra.prototype,"zIndex",void 0),gt([Ot()],Ra.prototype,"locked",void 0),gt([St(0)],Ra.prototype,"x",void 0),gt([St(0)],Ra.prototype,"y",void 0),gt([At(100)],Ra.prototype,"width",void 0),gt([At(100)],Ra.prototype,"height",void 0),gt([Mt(1)],Ra.prototype,"scaleX",void 0),gt([Mt(1)],Ra.prototype,"scaleY",void 0),gt([Dt(0)],Ra.prototype,"rotation",void 0),gt([Dt(0)],Ra.prototype,"skewX",void 0),gt([Dt(0)],Ra.prototype,"skewY",void 0),gt([Ot(!1)],Ra.prototype,"draggable",void 0),gt([Xt(!0)],Ra.prototype,"hittable",void 0),gt([Xt("path")],Ra.prototype,"hitFill",void 0),gt([Nt("path")],Ra.prototype,"hitStroke",void 0),gt([Xt(!0)],Ra.prototype,"hitChildren",void 0),gt([Xt(!0)],Ra.prototype,"hitSelf",void 0),gt([zt()],Ra.prototype,"fill",void 0),gt([Nt()],Ra.prototype,"stroke",void 0),gt([Nt("inside")],Ra.prototype,"strokeAlign",void 0),gt([Nt(1)],Ra.prototype,"strokeWidth",void 0),gt([Nt("none")],Ra.prototype,"strokeCap",void 0),gt([Nt("miter")],Ra.prototype,"strokeJoin",void 0),gt([Nt()],Ra.prototype,"dashPattern",void 0),gt([Nt()],Ra.prototype,"dashOffset",void 0),gt([Nt(10)],Ra.prototype,"miterLimit",void 0),gt([It()],Ra.prototype,"cornerRadius",void 0),gt([It()],Ra.prototype,"cornerSmoothing",void 0),gt([ba()],Ra.prototype,"shadow",void 0),gt([ba()],Ra.prototype,"innerShadow",void 0),gt([ba()],Ra.prototype,"blur",void 0),gt([ba()],Ra.prototype,"backgroundBlur",void 0),gt([ba()],Ra.prototype,"grayscale",void 0),gt([Jt(Lr.drawPathByData)],Ra.prototype,"__drawPathByData",null),Ra=gt([se(Ea),se(ka),se(Ta),te()],Ra);let La=class extends Ra{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}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){}remove(t){}removeAll(){}};gt([Vt(fa)],La.prototype,"__",void 0),La=gt([se(ss),ie()],La);let Pa=class extends Ra{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};gt([Vt(ma)],Pa.prototype,"__",void 0),Pa=gt([se(Ca),ie()],Pa);const Oa=Pa.prototype,Sa=La.prototype,Ma={},{copy:Da,add:Aa}=H;let Ia=class extends La{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;Da(Ma,t),super.__updateRenderBounds(),Aa(t,Ma)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};gt([Vt(ya)],Ia.prototype,"__",void 0),gt([Ft("show")],Ia.prototype,"overflow",void 0),gt([Jt(Oa.__updateStrokeSpread)],Ia.prototype,"__updateStrokeSpread",null),gt([Jt(Oa.__updateRenderSpread)],Ia.prototype,"__updateRectRenderSpread",null),gt([Jt(Oa.__updateBoxBounds)],Ia.prototype,"__updateBoxBounds",null),gt([Jt(Oa.__updateStrokeBounds)],Ia.prototype,"__updateStrokeBounds",null),gt([Jt(Oa.__updateRenderBounds)],Ia.prototype,"__updateRectRenderBounds",null),gt([Jt(Oa.__updateChange)],Ia.prototype,"__updateRectChange",null),gt([Jt(Oa.__drawPathByData)],Ia.prototype,"__drawPathByData",null),gt([Jt(Oa.__render)],Ia.prototype,"__renderRect",null),gt([Jt(Sa.__render)],Ia.prototype,"__renderGroup",null),Ia=gt([te(),ie()],Ia);let Wa=class extends Ia{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};gt([Vt(class extends ya{})],Wa.prototype,"__",void 0),gt([Ft("hide")],Wa.prototype,"overflow",void 0),Wa=gt([ie()],Wa);const{moveTo:Na,closePath:Fa,ellipse:za}=$i;let Ua=class extends Ra{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];s?i||r?(s<1&&za(a,n,o,n*s,o*s,0,i,r,!1),za(a,n,o,n,o,0,r,i,!0),s<1&&Fa(a)):(s<1&&(za(a,n,o,n*s,o*s),Na(a,t,o)),za(a,n,o,n,o,0,0,360,!0)):i||r?(Na(a,n,o),za(a,n,o,n,o,0,i,r,!1),Fa(a)):za(a,n,o,n,o)}};gt([Vt(class extends pa{get __boxStroke(){return!0}})],Ua.prototype,"__",void 0),gt([It(0)],Ua.prototype,"innerRadius",void 0),gt([It(0)],Ua.prototype,"startAngle",void 0),gt([It(0)],Ua.prototype,"endAngle",void 0),Ua=gt([ie()],Ua);const{sin:Ha,cos:Ya,PI:ja}=Math,{moveTo:Xa,lineTo:Va,closePath:Ga}=$i;let Ka=class extends Ra{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,n=this.__.path=[];Xa(n,i,0);for(let t=1;t<s;t++)Va(n,i+i*Ha(2*t*ja/s),r-r*Ya(2*t*ja/s));Ga(n)}};gt([Vt(class extends pa{})],Ka.prototype,"__",void 0),gt([It(3)],Ka.prototype,"sides",void 0),Ka=gt([ie()],Ka);const{sin:qa,cos:Qa,PI:Za}=Math,{moveTo:$a,lineTo:Ja,closePath:th}=$i;let eh=class extends Ra{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,n=e/2,o=this.__.path=[];$a(o,r,0);for(let t=1;t<2*s;t++)Ja(o,r+(t%2==0?r:r*i)*qa(t*Za/s),n-(t%2==0?n:n*i)*Qa(t*Za/s));th(o)}};gt([Vt(class extends pa{})],eh.prototype,"__",void 0),gt([It(5)],eh.prototype,"points",void 0),gt([It(.382)],eh.prototype,"innerRadius",void 0),eh=gt([ie()],eh);const{moveTo:sh,lineTo:ih}=$i,{rotate:rh,getAngle:nh,getDistance:oh,defaultPoint:ah}=k,{setPoint:hh,addPoint:lh,toBounds:dh}=L,ch={};let uh=class extends Ra{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&rh(s,e),this.__toPoint=s,s}set toPoint(t){this.width=oh(ah,t),this.rotation=nh(ah,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];sh(t,0,0);const e=this.toPoint;ih(t,e.x,e.y)}__updateBoxBounds(){hh(ch,0,0),lh(ch,this.__toPoint.x,this.__toPoint.y),dh(ch,this.__layout.boxBounds)}};gt([Vt(class extends pa{})],uh.prototype,"__",void 0),gt([At()],uh.prototype,"rotation",void 0),gt([Wt("center")],uh.prototype,"strokeAlign",void 0),uh=gt([ie()],uh);let _h=class extends Pa{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill={type:"image",mode:"strench",url:e},this.once(_e.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};gt([Vt(xa)],_h.prototype,"__",void 0),gt([At("")],_h.prototype,"url",void 0),_h=gt([ie()],_h);let ph=class extends Pa{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new R(t.__world);r.invert();const n=new R;e&&n.translate(e.x,e.y),s&&("number"==typeof s?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.preMultiply(n),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};gt([Vt(xa)],ph.prototype,"__",void 0),gt([Ba(100)],ph.prototype,"width",void 0),gt([Ba(100)],ph.prototype,"height",void 0),gt([Ba(t.devicePixelRatio)],ph.prototype,"pixelRatio",void 0),gt([Ba(!0)],ph.prototype,"smooth",void 0),gt([Xt("all")],ph.prototype,"hitFill",void 0),ph=gt([ie()],ph);const gh=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",fh=gh+"_#~&*+\\=|≮≯≈≠=…",yh=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 mh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const vh=mh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),wh=mh("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),xh=mh(gh),bh=mh(fh),Bh=mh("- —/~|┆·");var Eh;!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"}(Eh||(Eh={}));const{Letter:kh,Single:Th,Before:Ch,After:Rh,Symbol:Lh,Break:Ph}=Eh;function Oh(t){return vh[t]?kh:Bh[t]?Ph:wh[t]?Ch:xh[t]?Rh:bh[t]?Lh:yh.test(t)?Th:kh}const Sh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Mh(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:Dh}=Sh,{Letter:Ah,Single:Ih,Before:Wh,After:Nh,Symbol:Fh,Break:zh}=Eh;let Uh,Hh,Yh,jh,Xh,Vh,Gh,Kh,qh,Qh,Zh,$h,Jh,tl,el=[];function sl(t,e){Uh.data.push({char:t,width:e}),Yh+=e}function il(){jh+=Yh,Uh.width=Yh,Hh.words.push(Uh),Uh={data:[]},Yh=0}function rl(){$h&&(Jh.paraNumber++,Hh.paraStart=!0,$h=!1),Hh.width=jh,Dh(Hh),el.push(Hh),Hh.width>tl.width&&(tl.width=Hh.width),Hh={words:[]},jh=0}const nl=0,ol=1,al=2;const hl={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,n=0,{width:o,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(o||(o=0),h){const[t,e,s,l]=r.fourNumber(h);o&&(i=l,o-=e+l),a&&(n=t,a-=t+s)}const u={bounds:{x:i,y:n,width:o,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,i){Jh=e,el=e.rows,tl=e.bounds;const{__letterSpacing:r,paraIndent:n,textCase:o}=i,{canvas:a}=t,{width:h,height:l}=tl;if(h||l||r||o){$h=!0,qh=null,Yh=jh=0,Uh={data:[]},Hh={words:[]};for(let t=0,e=s.length;t<e;t++)Vh=s[t],"\n"===Vh?(Yh&&il(),Hh.paraEnd=!0,rl(),$h=!0):(Kh=Oh(Vh),Kh===Ah&&"none"!==o&&(Vh=Mh(Vh,o,!Yh)),Gh=a.measureText(Vh).width,r&&(Gh+=r),Qh=Kh===Ih&&(qh===Ih||qh===Ah)||qh===Ih&&Kh!==Nh,Zh=!(Kh!==Wh&&Kh!==Ih||qh!==Fh&&qh!==Nh),Xh=$h&&n?h-n:h,h&&jh+Yh+Gh>Xh&&(Zh||(Zh=Kh===Ah&&qh==Nh),Qh||Zh||Kh===zh||Kh===Wh||Kh===Ih||Yh+Gh>Xh?(Yh&&il(),rl()):rl())," "===Vh&&jh+Yh===0||(Kh===zh?(" "===Vh&&Yh&&il(),sl(Vh,Gh),il()):Qh||Zh?(Yh&&il(),sl(Vh,Gh)):sl(Vh,Gh)),qh=Kh);Yh&&il(),jh&&rl(),el.length>0&&(el[el.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{Jh.paraNumber++,el.push({x:n||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(u,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:n,textAlign:o,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:u,width:_,height:p}=i,g=r*s.length+(h?h*(t.paraNumber-1):0),f=n;if(p){if("show"!==l&&g>p)g=Math.max(p,r),t.overflow=s.length;else switch(a){case"middle":u+=(p-g)/2;break;case"bottom":u+=p-g}f+=u}for(let e=0,i=s.length;e<i;e++){switch(d=s[e],d.x=c,o){case"center":d.x+=(_-d.width)/2;break;case"right":d.x+=_-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=r,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1)}i.y=u,i.height=g}(u,s),function(t,e,s,i){const{rows:r}=t,{textAlign:n,paraIndent:o,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=o&&t.paraStart?o:0,l=s&&"justify"===n&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?nl:l>.01?ol:al,c===al?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===ol?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(u,s,o),u.overflow&&function(e,s){const{rows:i,overflow:r}=e;if(i.splice(r),"hide"!==s){"ellipsis"===s&&(s="...");const n=t.canvas.measureText(s).width,o=i[r-1];let a,h,l=o.data.length-1;const{x:d,width:c}=e.bounds,u=d+c-n;for(let t=l;t>-1&&(a=o.data[t],h=a.x+a.width,!(t===l&&h<u));t--){if(h<u&&" "!==a.char){o.data.splice(t+1),o.width-=a.width;break}o.width-=a.width}o.width+=n,o.data.push({char:s,x:h})}}(u,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(u,s),u}},{copyAndSpread:ll,includes:dl,spread:cl}=H;let ul=class extends Ra{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:n}=this.__layout.boxBounds;t.rect(s,i,r,n)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=hl.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:n,fontFamily:o,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=ga.number(r,a),t.__letterSpacing=ga.number(n,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${o}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<a&&cl(c,a/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=dl(u,c)?u:c;_!==e.contentBounds&&(e.contentBounds=_,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){ll(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};gt([Vt(class extends pa{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=wa[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],ul.prototype,"__",void 0),gt([At(0)],ul.prototype,"width",void 0),gt([At(0)],ul.prototype,"height",void 0),gt([At(0)],ul.prototype,"padding",void 0),gt([Wt("outside")],ul.prototype,"strokeAlign",void 0),gt([At("")],ul.prototype,"text",void 0),gt([At("L")],ul.prototype,"fontFamily",void 0),gt([At(12)],ul.prototype,"fontSize",void 0),gt([At("normal")],ul.prototype,"fontWeight",void 0),gt([At(!1)],ul.prototype,"italic",void 0),gt([At("none")],ul.prototype,"textCase",void 0),gt([At("none")],ul.prototype,"textDecoration",void 0),gt([At(0)],ul.prototype,"letterSpacing",void 0),gt([At({type:"percent",value:150})],ul.prototype,"lineHeight",void 0),gt([At(0)],ul.prototype,"paraIndent",void 0),gt([At(0)],ul.prototype,"paraSpacing",void 0),gt([At("left")],ul.prototype,"textAlign",void 0),gt([At("top")],ul.prototype,"verticalAlign",void 0),gt([At("show")],ul.prototype,"textOverflow",void 0),ul=gt([ie()],ul);const{toBounds:_l}=hn;let pl=class extends Ra{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){_l(this.__.path,this.__layout.boxBounds)}};gt([Vt(class extends pa{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=va(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],pl.prototype,"__",void 0),gt([It()],pl.prototype,"path",void 0),gt([It()],pl.prototype,"windingRule",void 0),gt([Wt("center")],pl.prototype,"strokeAlign",void 0),pl=gt([ie()],pl);let gl=class extends La{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new pl(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,n){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,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,n,o,a){return this}moveToArc(t,e,s,i,r,n){return this}paint(){this.pathElement.forceUpdate("path")}};gt([Vt(class extends fa{})],gl.prototype,"__",void 0),gl=gt([se(pr,["beginPath"]),ie()],gl);const fl=Q.get("Leafer");let yl=class extends La{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&this.imageManager.tasker.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:r}=this;ao.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new at,this.hitCanvasManager=new dt,this.imageManager=new ws(this,r),i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this)))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(we.RESTART):this.emitLeafer(we.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(we.STOP))}resize(t){const e=ct.copyAttrs({},t,kt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,kt);this.canvas.resize(t),this.__onResize(new pe(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,kt),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,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const i=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),i(),this.viewLoaded||(s=this.on_("render.after",i))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(kt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&kt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,kt);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.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(we.BEFORE_READY),this.emitLeafer(we.READY),this.emitLeafer(we.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(we.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new we(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(we.START,(()=>J.end(t))),this.once(ye.END,(()=>this.__onReady())),this.once(ve.END,(()=>this.__onViewReady())),this.on(ye.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destory(){if(this.canvas)try{this.stop(),this.emitEvent(new we(we.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>t.destroy())),this.__controllers.length=0,this.selector.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory(),this.canvas.destroy(),this.canvas=null,this.config=this.userConfig=this.view=null,super.destroy()}catch(t){fl.error(t)}}};gt([Vt(class extends fa{})],yl.prototype,"__",void 0),gt([At()],yl.prototype,"pixelRatio",void 0),yl=gt([ie()],yl);let ml=class extends yl{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(ue.CHANGE,(()=>{Q.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new yl(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ye.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(ve.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(ve.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,kt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}destory(){this.children.forEach((t=>{t.destory()})),this.children.length=0,super.destory()}};ml=gt([ie()],ml);var vl=Object.freeze({__proto__:null,Animate:uo,AnimateEvent:me,get App(){return ml},AutoBounds:G,BezierHelper:Us,Bounds:V,BoundsHelper:H,get Box(){return Ia},get Branch(){return ss},BranchHelper:Ue,BranchRender:De,get Canvas(){return ph},CanvasManager:at,ChildEvent:ce,Creator:e,DataHelper:ct,Debug:Q,get DragEvent(){return hs},get DropEvent(){return ds},Effect:lo,get Ellipse(){return Ua},EllipseHelper:Qs,Event:de,EventCreator:nt,Export:_o,FileHelper:pt,get Frame(){return Wa},get Group(){return La},HitCanvasManager:dt,get Image(){return _h},ImageEvent:_e,ImageManager:ws,IncrementId:s,Interaction:eo,get KeyEvent(){return gs},Keyboard:rs,LayoutEvent:ye,Layouter:Tn,get Leaf(){return Ge},LeafBounds:Re,LeafBoundsHelper:ze,LeafData:_t,LeafDataProxy:xe,LeafEventer:he,LeafHelper:Ae,LeafHit:Oe,LeafLevelList:lt,LeafList:ht,LeafMask:Me,LeafMatrix:ke,LeafRender:Se,get Leafer(){return yl},LeaferCanvas:Mn,LeaferCanvasBase:Tt,LeaferEvent:we,LeaferImage:fs,LeaferImageBase:fs,LeaferTypeCreator:ao,get Line(){return uh},MathHelper:r,Matrix:R,MatrixHelper:f,get MoveEvent(){return cs},NeedConvertToCanvasCommandMap:ks,OneRadian:n,PI2:o,PI_2:a,Paint:co,get Path(){return pl},PathBounds:hn,PathCommandDataHelper:$i,PathCommandMap:Bs,PathConvert:Di,PathCorner:ln,PathCreator:pr,PathDrawer:Lr,PathHelper:xs,PathNumberCommandLengthMap:Ls,PathNumberCommandMap:Rs,get Pen(){return gl},Platform:t,PluginManager:cn,Point:C,PointHelper:k,PointerButton:ns,get PointerEvent(){return as},get Polygon(){return Ka},PropertyEvent:ue,get Rect(){return Pa},RectHelper:Ps,RectRender:Ca,RenderEvent:ve,Renderer:Rn,ResizeEvent:pe,get RotateEvent(){return us},Run:J,Selector:On,get Star(){return eh},StringNumberMap:q,get SwipeEvent(){return _s},TaskItem:ys,TaskProcessor:vs,get Text(){return ul},TransformEvent:ge,TwoPointBounds:K,TwoPointBoundsHelper:L,get UI(){return Ra},UIBounds:Ea,UICreator:st,UIEvent:os,UIHit:ka,UIRender:Ta,WaitHelper:je,WatchEvent:fe,Watcher:_n,get ZoomEvent(){return ps},affectRenderBoundsType:Ft,affectStrokeBoundsType:Wt,aliasType:Lt,boundsType:At,canvasSizeAttrs:kt,dataProcessor:Vt,dataType:Ot,defineDataProcessor:qt,defineKey:Ct,defineLeafAttr:Pt,effectType:ba,eraserType:jt,getDescriptor:Rt,hitType:Xt,layoutProcessor:Gt,maskType:Yt,opacityType:Ut,pathType:It,positionType:St,registerUI:ie,registerUIEvent:re,resizeType:Ba,rewrite:Jt,rewriteAble:te,rotationType:Dt,scaleType:Mt,setDefaultValue:Kt,sortType:Ht,strokeType:Nt,surfaceType:zt,useCanvas:ro,useModule:se,usePlugin:un});cn.power=vl,ro();export{uo as Animate,me as AnimateEvent,ml as App,G as AutoBounds,Us as BezierHelper,V as Bounds,H as BoundsHelper,Ia as Box,ss as Branch,Ue as BranchHelper,De as BranchRender,ph as Canvas,at as CanvasManager,ce as ChildEvent,e as Creator,ct as DataHelper,Q as Debug,hs as DragEvent,ds as DropEvent,lo as Effect,Ua as Ellipse,Qs as EllipseHelper,de as Event,nt as EventCreator,_o as Export,pt as FileHelper,Wa as Frame,La as Group,dt as HitCanvasManager,_h as Image,_e as ImageEvent,ws as ImageManager,s as IncrementId,eo as Interaction,gs as KeyEvent,rs as Keyboard,ye as LayoutEvent,Tn as Layouter,Ge as Leaf,Re as LeafBounds,ze as LeafBoundsHelper,_t as LeafData,xe as LeafDataProxy,he as LeafEventer,Ae as LeafHelper,Oe as LeafHit,lt as LeafLevelList,ht as LeafList,Me as LeafMask,ke as LeafMatrix,Se as LeafRender,yl as Leafer,Mn as LeaferCanvas,Tt as LeaferCanvasBase,we as LeaferEvent,fs as LeaferImage,fs as LeaferImageBase,ao as LeaferTypeCreator,uh as Line,r as MathHelper,R as Matrix,f as MatrixHelper,cs as MoveEvent,ks as NeedConvertToCanvasCommandMap,n as OneRadian,o as PI2,a as PI_2,co as Paint,pl as Path,hn as PathBounds,$i as PathCommandDataHelper,Bs as PathCommandMap,Di as PathConvert,ln as PathCorner,pr as PathCreator,Lr as PathDrawer,xs as PathHelper,Ls as PathNumberCommandLengthMap,Rs as PathNumberCommandMap,gl as Pen,t as Platform,cn as PluginManager,C as Point,k as PointHelper,ns as PointerButton,as as PointerEvent,Ka as Polygon,ue as PropertyEvent,Pa as Rect,Ps as RectHelper,Ca as RectRender,ve as RenderEvent,Rn as Renderer,pe as ResizeEvent,us as RotateEvent,J as Run,On as Selector,eh as Star,q as StringNumberMap,_s as SwipeEvent,ys as TaskItem,vs as TaskProcessor,ul as Text,ge as TransformEvent,K as TwoPointBounds,L as TwoPointBoundsHelper,Ra as UI,Ea as UIBounds,st as UICreator,os as UIEvent,ka as UIHit,Ta as UIRender,je as WaitHelper,fe as WatchEvent,_n as Watcher,ps as ZoomEvent,Ft as affectRenderBoundsType,Wt as affectStrokeBoundsType,Lt as aliasType,At as boundsType,kt as canvasSizeAttrs,Vt as dataProcessor,Ot as dataType,qt as defineDataProcessor,Ct as defineKey,Pt as defineLeafAttr,ba as effectType,jt as eraserType,Rt as getDescriptor,Xt as hitType,Gt as layoutProcessor,Yt as maskType,Ut as opacityType,It as pathType,St as positionType,ie as registerUI,re as registerUIEvent,Ba as resizeType,Jt as rewrite,te as rewriteAble,Dt as rotationType,Mt as scaleType,Kt as setDefaultValue,Ht as sortType,Nt as strokeType,zt as surfaceType,ro as useCanvas,se as useModule,un as usePlugin};
|
|
1
|
+
const t={},e={},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s,r={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t),fourNumber(t){let e,s,i,r;if(t instanceof Array)switch(t.length){case 4:return t;case 2:e=i=t[0],s=r=t[1];break;case 3:e=t[0],s=r=t[1],i=t[2];break;case 1:t=t[0];break;default:t=0}return void 0===e?[t,t,t,t]:[e,s,i,r]}},n=Math.PI/180,o=2*Math.PI,a=Math.PI/2,{sin:h,cos:l,acos:d,atan:c,sqrt:u,PI:_}=Math,p={};function g(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const f={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:g,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){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s},scaleOfOuter(t,e,s,i=s){y.toInnerPoint(t,e,p),y.scaleOfInner(t,p,s,i)},scaleOfInner(t,e,s,i=s){y.translateInner(t,e.x,e.y),y.scale(t,s,i),y.translateInner(t,-e.x,-e.y)},rotate(t,e){const s=l(e*=n),i=h(e),{a:r,b:o,c:a,d:d}=t;t.a=r*s-o*i,t.b=r*i+o*s,t.c=a*s-d*i,t.d=a*i+d*s},rotateOfOuter(t,e,s){y.toInnerPoint(t,e,p),y.rotateOfInner(t,p,s)},rotateOfInner(t,e,s){y.translateInner(t,e.x,e.y),y.rotate(t,s),y.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:a}=t;s&&(s*=n,t.a=i+o*s,t.b=r+a*s),e&&(e*=n,t.c=o+i*e,t.d=a+r*e)},skewOfOuter(t,e,s,i){y.toInnerPoint(t,e,p),y.skewOfInner(t,p,s,i)},skewOfInner(t,e,s,i){y.translateInner(t,e.x,e.y),y.skew(t,s,i),y.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},preMultiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;1===e.a&&0===e.b&&0===e.c&&1===e.d||(t.a=s*e.a+i*e.c,t.b=s*e.b+i*e.d,t.c=r*e.a+n*e.c,t.d=r*e.b+n*e.d),t.e=o*e.a+a*e.c+e.e,t.f=o*e.b+a*e.d+e.f},divide(t,e){y.multiply(t,y.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=y;return y.copy(e,t),y.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=t,a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{x:r,y:n}=e,{a:o,b:a,c:h,d:l}=t,d=1/(o*l-a*h);if(s||(s=e),s.x=(r*l-n*h)*d,s.y=(n*o-r*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*o-e*a)*d}},decompose(t){const{a:e,b:s,c:i,d:r}=t;let o=e,a=r,h=0,l=0,p=0;if(s||i){const t=e*r-s*i,g=e*i+s*r;if(s){const i=e*e+s*s;o=u(i),a=t/o;const r=e/o;h=s>0?d(r):-d(r),l=c(g/i)/n}else{const e=i*i+r*r;a=u(e),o=t/a;const s=i/a;h=_/2-(r>0?d(-s):-d(s)),p=c(g/e)/n}h/=n}return{x:t.e,y:t.f,scaleX:o,scaleY:a,rotation:h,skewX:l,skewY:p}},reset(t){y.set(t)}},y=f,{toInnerPoint:m,toOuterPoint:v}=f,{sin:w,cos:x,abs:b,sqrt:B,atan2:E}=Math,T={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},copy(t,e){t.x=e.x,t.y=e.y},move(t,e,s){t.x+=e,t.y+=s},rotate(t,e,s){s||(s=k.defaultPoint);const i=x(e*n),r=w(e*n),o=t.x-s.x,a=t.y-s.y;t.x=s.x+o*i-a*r,t.y=s.y+o*r-a*i},tempToInnerOf(t,e){const{tempPoint:s}=k;return k.copy(s,t),m(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=k;return k.copy(s,t),v(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=k;return k.copy(s,t),k.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),m(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toInnerOf(t,e,s){m(e,t,s)},toOuterOf(t,e,s){v(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getDistance(t,e){const s=b(e.x-t.x),i=b(e.y-t.y);return B(s*s+i*i)},getAngle:(t,e)=>k.getAtan2(t,e)/n,getAtan2:(t,e)=>E(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=k.getAtan2(t,e);return{x:t.x+x(i)*s,y:t.y+w(i)*s}},reset(t){k.reset(t)}},k=T;class C{constructor(t,e){"object"==typeof t?T.copy(this,t):T.set(this,t,e)}set(t,e){T.set(this,t,e)}copy(t){return T.copy(this,t),this}clone(){return new C(this)}rotate(t,e){return T.rotate(this,t,e),this}toInnerOf(t,e){return T.toInnerOf(this,t,e),this}toOuterOf(t,e){return T.toOuterOf(this,t,e),this}getCenter(t){return T.getCenter(this,t)}getDistance(t){return T.getDistance(this,t)}getAngle(t){return T.getAngle(this,t)}getAtan2(t){return T.getAtan2(this,t)}reset(){T.reset(this)}}class R{constructor(t,e,s,i,r,n){"object"==typeof t?f.copy(this,t):f.set(this,t,e,s,i,r,n)}set(t,e,s,i,r,n){f.set(this,t,e,s,i,r,n)}copy(t){return f.copy(this,t),this}clone(){return new R(this)}translate(t,e){return f.translate(this,t,e),this}translateInner(t,e){return f.translateInner(this,t,e),this}scale(t,e){return f.scale(this,t,e),this}scaleOfOuter(t,e,s){return f.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return f.scaleOfInner(this,t,e,s),this}rotate(t){return f.rotate(this,t),this}rotateOfOuter(t,e){return f.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return f.rotateOfInner(this,t,e),this}skew(t,e){return f.skew(this,t,e),this}skewOfOuter(t,e,s){return f.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return f.skewOfInner(this,t,e,s),this}multiply(t){return f.multiply(this,t),this}preMultiply(t){return f.preMultiply(this,t),this}divide(t){return f.divide(this,t),this}invert(){return f.invert(this),this}toOuterPoint(t,e){f.toOuterPoint(this,t,e)}toInnerPoint(t,e){f.toInnerPoint(this,t,e)}decompose(){return f.decompose(this)}reset(){f.reset(this)}}const L={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){P(t,e,s),P(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},add(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:P}=L,{tempPointBounds:O,setPoint:S,addPoint:D,toBounds:M}=L,{toOuterPoint:A}=f;let I,W,N,F;const z={},U={},H={tempBounds:{},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){Y.set(t,e.x-s,e.y-s,e.width+2*s,e.height+2*s)},right:t=>t.x+t.width,bottom:t=>t.y+t.height,move(t,e,s){t.x+=e,t.y+=s},getByMove:(t,e,s)=>(t=Object.assign({},t),Y.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?X(e,t):e=t,s?(e.offsetX=-(Y.right(s)-t.x),e.offsetY=-(Y.bottom(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Y.move(e,-e.offsetX,-e.offsetY)},scale(t,e){t.x*=e,t.y*=e,t.width*=e,t.height*=e},tempToOuterOf:(t,e)=>(Y.copy(Y.tempBounds,t),Y.toOuterOf(Y.tempBounds,e),Y.tempBounds),getOuterOf:(t,e)=>(t=Object.assign({},t),Y.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 z.x=t.x,z.y=t.y,A(e,z,U),S(O,U.x,U.y),z.x=t.x+t.width,A(e,z,U),D(O,U.x,U.y),z.y=t.y+t.height,A(e,z,U),D(O,U.x,U.y),z.x=t.x,A(e,z,U),D(O,U.x,U.y),M(O,s)},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new R(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return Y.copyAndSpread(s,t,e),s},spread(t,e){Y.copyAndSpread(t,t,e)},ceil(t){t.x=Math.floor(t.x),t.y=Math.floor(t.y),t.width=Math.ceil(t.width),t.height=Math.ceil(t.height)},add(t,e){I=t.x+t.width,W=t.y+t.height,N=e.x+e.width,F=e.y+e.height,I=I>N?I:N,W=W>F?W:F,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=I-t.x,t.height=W-t.y},addList(t,e){Y.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){Y.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){Y.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o]):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||X(t,r)):j(t,r));n&&Y.reset(t)},setByPoints(t,e){e.forEach(((t,e)=>{0===e?S(O,t.x,t.y):D(O,t.x,t.y)})),M(O,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=T.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=T.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=Y.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=Y.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){s&&(e=Y.tempToOuterOf(e,s));let{x:i,y:r,width:n,height:o}=e;return I=i+n,W=r+o,N=t.x+t.width,F=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,I=I<N?I:N,W=W<F?W:F,n=I-i,o=W-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){Y.copy(t,Y.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){Y.set(t)}},Y=H,{add:j,copy:X}=Y;class V{constructor(t,e,s,i){"object"==typeof t?H.copy(this,t):H.set(this,t,e,s,i)}set(t,e,s,i){H.set(this,t,e,s,i)}copy(t){return H.copy(this,t),this}clone(){return new V(this)}scale(t){return H.scale(this,t),this}toOuterOf(t,e){return H.toOuterOf(this,t,e),this}getFitMatrix(t){return H.getFitMatrix(this,t)}spread(t){return H.spread(this,t),this}ceil(){return H.ceil(this),this}add(t){return H.add(this,t),this}addList(t){return H.setByList(this,t,!0),this}setByList(t,e){return H.setByList(this,t,e),this}addListWithHandle(t,e){return H.setByListWithHandle(this,t,e,!0),this}setByListWithHandle(t,e,s){return H.setByListWithHandle(this,t,e,s),this}setByPoints(t){return H.setByPoints(this,t),this}hitPoint(t,e){return H.hitPoint(this,t,e)}hitRadiusPoint(t,e){return H.hitRadiusPoint(this,t,e)}hit(t,e){return H.hit(this,t,e)}includes(t,e){return H.includes(this,t,e)}intersect(t,e){return H.intersect(this,t,e),this}getIntersect(t,e){return new V(H.getIntersectData(this,t,e))}isSame(t){return H.isSame(this,t)}isEmpty(){return H.isEmpty(this)}reset(){H.reset(this)}}class G{constructor(t,e,s,i,r,n){"object"==typeof t?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new V(r,e,n||t.width-r-s,o||t.height-e-i)}}class K{constructor(t,e){L.setPoint(this,t,e)}addPoint(t,e){L.addPoint(this,t,e)}addBounds(t,e,s,i){L.addBounds(this,t,e,s,i)}add(t){L.add(this,t)}}const q={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};class Z{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Z(t)}static set filter(t){t?"string"==typeof t&&(t=[t]):t=[],this.filterList=t}static set exclude(t){t?"string"==typeof t&&(t=[t]):t=[],this.excludeList=t}log(...t){if(Q.enable){if(Q.filterList.length&&Q.filterList.every((t=>t!==this.name)))return;if(Q.excludeList.length&&Q.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}warn(...t){console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(console.warn(this.name,"repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}Z.filterList=[],Z.excludeList=[];const Q=Z,$=Z.get("RunTime");class J{static start(t,e){const i=s.create(s.RUNTIME);return tt.currentId=tt.idMap[i]=e?performance.now():Date.now(),tt.currentName=tt.nameMap[i]=t,tt.nameToIdMap[t]=i,i}static end(t,e){const s=tt.idMap[t],i=tt.nameMap[t];tt.idMap[t]=tt.nameMap[t]=tt.nameToIdMap[i]=void 0,e?$.log(i,performance.now()-s,"µs"):$.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=tt.nameToIdMap[t];void 0!==s&&tt.end(s,e)}}J.idMap={},J.nameMap={},J.nameToIdMap={};const tt=J,et=Z.get("UICreator"),st={list:{},register(t){const{__tag:e}=t.prototype;it[e]?et.repeat(e):it[e]=t},get(t,e,s,i,r,n){const o=new it[t](e);return void 0!==s&&(o.x=s,i&&(o.y=i),r&&(o.width=r),n&&(o.height=n)),o}},{list:it}=st,rt=Z.get("EventCreator"),nt={nameList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(ot[e]?rt.repeat(e):ot[e]=t)}))},changeName(t,e){const s=ot[t];if(s){const i=Object.keys(s).find((e=>s[e]===t));i&&(s[i]=e,ot[e]=s)}},get:(t,...e)=>new ot[t](...e)},{nameList:ot}=nt;class at{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let s;const{list:i}=this;for(let e=0,r=i.length;e<r;e++)if(s=i[e],s.recycled&&s.isSameSize(t))return s.recycled=!1,s.manager||(s.manager=this),s;const r=e.canvas(t);return this.add(r),r}recycle(t){t.recycled||(t.clear(),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()}}class ht{get length(){return this.list.length}constructor(t){this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return void 0===e?-1:e}pushList(t){t.forEach((t=>{this.push(t)}))}unshift(t){const{keys:e}=this;void 0===e[t.innerId]&&(this.list.unshift(t),Object.keys(e).forEach((t=>{void 0!==e[t]&&e[t]++})),e[t.innerId]=0)}push(t){const{list:e,keys:s}=this;void 0===s[t.innerId]&&(e.push(t),s[t.innerId]=e.length-1)}sort(t){const{list:e}=this;t?e.sort(((t,e)=>e.__level-t.__level)):e.sort(((t,e)=>t.__level-e.__level))}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)void 0!==s?this.keys[e[i].innerId]=i-1:e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]);void 0!==s&&e.splice(s,1)}forEach(t){this.list.forEach(t)}clone(){const t=new ht;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class lt{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(t instanceof Array?this.pushList(t):this.push(t))}has(t){return void 0!==this.keys[t.innerId]}without(t){return void 0===this.keys[t.innerId]}sort(t){const{levels:e}=this;t?e.sort(((t,e)=>e-t)):e.sort(((t,e)=>t-e))}pushList(t){t.forEach((t=>{this.push(t)}))}push(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}}class dt extends at{constructor(){super(...arguments),this.pathTypeList=new ht,this.imageTypeList=new ht}get(t){}getImageType(t,s){return this.imageTypeList.push(t),e.hitCanvas(s)}getPathType(t){return this.pathTypeList.push(t),e.hitCanvas()}clearImageType(){this.__clearLeafList(this.imageTypeList)}clearPathType(){this.__clearLeafList(this.pathTypeList)}__clearLeafList(t){t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset()}clear(){this.clearPathType(),this.clearImageType()}}const ct={default:(t,e)=>(ut(e,t),ut(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var r;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(r=t[i])||void 0===r?void 0:r.constructor)===Object?ut(t[i],e[i]):t[i]=e[i]}))},copyAttrs:(t,e,s)=>(s.forEach((s=>{void 0!==e[s]&&(t[s]=e[s])})),t),clone:t=>JSON.parse(JSON.stringify(t))},{assign:ut}=ct;class _t{constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];return void 0===e?this[t]:e}return this[t]}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];return void 0===e?this["_"+t]:e}return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(){const t={},{__input:e}=this;let s,i;for(let r in this)s=r.substring(1),void 0!==this[s]&&(i=e?e[s]:void 0,t[s]=void 0===i?this[r]:i);return t}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){"pass-through"===this.blendMode?this.__leaf.__hasEraser||this.isEraser?this.__single=!0:this.__single&&(this.__single=!1):this.__single=!0}destroy(){this.__leaf=null}}const pt={mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]}};function gt(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function ft(t,e,s,i){return new(s||(s=Promise))((function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(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(o,a)}h((i=i.apply(t,e||[])).next())}))}function yt(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};Object.defineProperty(e,s,i)}}const mt=[];function vt(){return(t,e)=>{mt.push(e)}}const wt=[];let xt=class{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||wt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;mt.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))})),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){}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,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,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,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,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,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}};gt([yt("imageSmoothingEnabled")],xt.prototype,"smooth",void 0),gt([yt("imageSmoothingQuality")],xt.prototype,"smoothLevel",void 0),gt([yt("globalAlpha")],xt.prototype,"opacity",void 0),gt([yt()],xt.prototype,"fillStyle",void 0),gt([yt()],xt.prototype,"strokeStyle",void 0),gt([yt("lineWidth")],xt.prototype,"strokeWidth",void 0),gt([yt("lineCap")],xt.prototype,"strokeCap",void 0),gt([yt("lineJoin")],xt.prototype,"strokeJoin",void 0),gt([yt("lineDashOffset")],xt.prototype,"dashOffset",void 0),gt([yt()],xt.prototype,"miterLimit",void 0),gt([yt()],xt.prototype,"shadowBlur",void 0),gt([yt()],xt.prototype,"shadowColor",void 0),gt([yt()],xt.prototype,"shadowOffsetX",void 0),gt([yt()],xt.prototype,"shadowOffsetY",void 0),gt([yt()],xt.prototype,"filter",void 0),gt([yt()],xt.prototype,"font",void 0),gt([yt()],xt.prototype,"fontKerning",void 0),gt([yt()],xt.prototype,"fontStretch",void 0),gt([yt()],xt.prototype,"fontVariantCaps",void 0),gt([yt()],xt.prototype,"textAlign",void 0),gt([yt()],xt.prototype,"textBaseline",void 0),gt([yt()],xt.prototype,"textRendering",void 0),gt([yt()],xt.prototype,"wordSpacing",void 0),gt([yt()],xt.prototype,"letterSpacing",void 0),gt([yt()],xt.prototype,"direction",void 0),gt([vt()],xt.prototype,"setTransform",null),gt([vt()],xt.prototype,"resetTransform",null),gt([vt()],xt.prototype,"getTransform",null),gt([vt()],xt.prototype,"save",null),gt([vt()],xt.prototype,"restore",null),gt([vt()],xt.prototype,"transform",null),gt([vt()],xt.prototype,"translate",null),gt([vt()],xt.prototype,"scale",null),gt([vt()],xt.prototype,"rotate",null),gt([vt()],xt.prototype,"fill",null),gt([vt()],xt.prototype,"stroke",null),gt([vt()],xt.prototype,"clip",null),gt([vt()],xt.prototype,"fillRect",null),gt([vt()],xt.prototype,"strokeRect",null),gt([vt()],xt.prototype,"clearRect",null),gt([vt()],xt.prototype,"beginPath",null),gt([vt()],xt.prototype,"moveTo",null),gt([vt()],xt.prototype,"lineTo",null),gt([vt()],xt.prototype,"bezierCurveTo",null),gt([vt()],xt.prototype,"quadraticCurveTo",null),gt([vt()],xt.prototype,"closePath",null),gt([vt()],xt.prototype,"arc",null),gt([vt()],xt.prototype,"arcTo",null),gt([vt()],xt.prototype,"ellipse",null),gt([vt()],xt.prototype,"rect",null),gt([vt()],xt.prototype,"roundRect",null),gt([vt()],xt.prototype,"createConicGradient",null),gt([vt()],xt.prototype,"createLinearGradient",null),gt([vt()],xt.prototype,"createPattern",null),gt([vt()],xt.prototype,"createRadialGradient",null),gt([vt()],xt.prototype,"fillText",null),gt([vt()],xt.prototype,"measureText",null),gt([vt()],xt.prototype,"strokeText",null);const bt=new V,Bt={width:1,height:1,pixelRatio:1},Et=Z.get("LeaferCanvasBase"),Tt=["width","height","pixelRatio"];class kt extends xt{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}get allowBackgroundColor(){return this.view&&this.parentView&&!this.offscreen}constructor(e,i){super(),this.worldTransform={},e||(e=Bt),e.pixelRatio||(e.pixelRatio=t.devicePixelRatio),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:n,pixelRatio:o}=e;this.autoLayout=!r||!n,this.pixelRatio=o,this.offscreen=t.isWorker||e.offscreen,this.config=e,this.init()}init(){}__createContext(){this.context=this.view.getContext("2d"),this.__bindContext()}toBlob(e,s){return new Promise((i=>{const r=this.getSaveCanvas(e);t.origin.canvasToBolb(r.view,e,s).then((t=>{r.recycle(),i(t)})).catch((t=>{Et.error(t),i(null)}))}))}toDataURL(e,s){const i=this.getSaveCanvas(e),r=t.origin.canvasToDataURL(i.view,e,s);return i.recycle(),r}saveAs(e,s){return new Promise((i=>{const r=this.getSaveCanvas(pt.fileType(e));t.origin.canvasSaveAs(r.view,e,s).then((()=>{r.recycle(),i(!0)})).catch((t=>{Et.error(t),i(!1)}))}))}getSaveCanvas(t){const{backgroundColor:e,bounds:s}=this,i=this.getSameCanvas();return["jpg","jpeg"].includes(t)&&i.fillWorld(s,"#FFFFFF"),e&&i.fillWorld(s,e),i.copyWorld(this),i}resize(t){if(this.isSameSize(t))return;let e;this.context&&!this.unreal&&this.width&&(e=this.getSameCanvas(),e.copyWorld(this)),ct.copyAttrs(this,t,Tt),this.bounds=new V(0,0,this.width,this.height),this.pixelRatio||(this.pixelRatio=1),this.unreal||(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!this.unreal&&e&&(this.clearWorld(e.bounds),this.copyWorld(e),e.recycle())}updateViewSize(){}updateClientBounds(){}startAutoLayout(t,e){}stopAutoLayout(){}setWorld(t,e,s){const{pixelRatio:i}=this,r=this.worldTransform;if(e)if(s)this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=(t.e+e.e)*i,r.f=(t.f+e.f)*i);else{const{a:s,b:n,c:o,d:a,e:h,f:l}=e;this.setTransform(r.a=(t.a*s+t.b*o)*i,r.b=(t.a*n+t.b*a)*i,r.c=(t.c*s+t.d*o)*i,r.d=(t.c*n+t.d*a)*i,r.e=(t.e*s+t.f*o+h)*i,r.f=(t.e*n+t.f*a+l)*i)}else this.setTransform(r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i)}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s)}setStrokeOptions(t){this.strokeCap=t.strokeCap,this.strokeJoin=t.strokeJoin,this.dashPattern=t.dashPattern,this.dashOffset=t.dashOffset,this.miterLimit=t.miterLimit}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)}hitStroke(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)}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){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,H.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}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){s&&(this.blendMode=s),this.fillStyle=e,bt.copy(t).scale(this.pixelRatio),this.fillRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,bt.copy(t).scale(this.pixelRatio),this.strokeRect(bt.x,bt.y,bt.width,bt.height),s&&(this.blendMode="source-over")}clearWorld(t,e){bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.clearRect(bt.x,bt.y,bt.width,bt.height)}clipWorld(t,e){this.beginPath(),bt.copy(t).scale(this.pixelRatio),e&&bt.ceil(),this.rect(bt.x,bt.y,bt.width,bt.height),this.clip()}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t,this.height*t)}isSameSize(t){return this.width===t.width&&this.height===t.height&&this.pixelRatio===t.pixelRatio}getSameCanvas(t){const{width:s,height:i,pixelRatio:r}=this,n={width:s,height:i,pixelRatio:r},o=this.manager?this.manager.get(n):e.canvas(n);if(o.save(),t){const t=this.worldTransform;o.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}return o}getBiggerCanvas(t,s){let{width:i,height:r,pixelRatio:n}=this;t&&(i+=t),s&&(r+=s);const o={width:i,height:r,pixelRatio:n},a=this.manager?this.manager.get(o):e.canvas(o);return a.save(),a}recycle(){this.restore(),this.manager?this.manager.recycle(this):this.destroy()}unrealCanvas(){}destroy(){this.manager=null,this.view=null,this.parentView=null,this.context=null,this.config=null}}const Ct={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Rt={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Lt=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},Rt),Pt={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},Ot={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},St=Object.assign(Object.assign({},Ot),Rt),Dt=Lt,Mt={};for(let t in Dt)Mt[Dt[t]]=t;const At={};for(let t in Dt)At[Dt[t]]=Pt[t];const It={drawRoundRect(t,e,s,i,n,o){let[a,h,l,d]=r.fourNumber(o);const c=Math.min(i/2,n/2);a>c&&(a=c),h>c&&(h=c),l>c&&(l=c),d>c&&(d=c),a?t.moveTo(e+a,s):t.moveTo(e,s),h?t.arcTo(e+i,s,e+i,s+n,h):t.lineTo(e+i,s),l?t.arcTo(e+i,s+n,e,s+n,l):t.lineTo(e+i,s+n),d?t.arcTo(e,s+n,e,s,d):t.lineTo(e,s+n),a?t.arcTo(e,s,e+i,s,a):t.lineTo(e,s)}},{sin:Wt,cos:Nt,atan2:Ft,ceil:zt,abs:Ut,PI:Ht}=Math,{setPoint:Yt,addPoint:jt}=L,{set:Xt}=T,Vt={},Gt={rect(t,e,s,i,r){Ct.creator.path=t,Ct.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,n){Ct.creator.path=[],It.drawRoundRect(Ct.creator,e,s,i,r,n),t.push(...Ct.convertToCanvasData(Ct.creator.path,!0))},arcTo(t,e,s,i,r,h,l,d,c,u,_){const p=i-e,g=r-s,f=h-i,y=l-r;let m=Ft(g,p),v=Ft(y,f),w=v-m;if(w<0&&(w+=o),w===Ht||Ut(p+g)<1e-12||Ut(f+y)<1e-12)return t&&t.push(Lt.L,i,r),c&&(Yt(c,e,s),jt(c,i,r)),_&&Xt(_,e,s),void(u&&Xt(u,i,r));const x=p*y-f*g<0,b=x?-1:1,B=d/Nt(w/2),E=i+B*Nt(m+w/2+a*b),T=r+B*Wt(m+w/2+a*b);return m-=a*b,v-=a*b,Zt(t,E,T,d,d,0,m/n,v/n,x,c,u,_)},arc:(t,e,s,i,r,n,o,a,h,l)=>Zt(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,h,l,d,c,u,_,p){const g=h*n,f=Wt(g),y=Nt(g);let m=l*n,v=d*n;m>Ht&&(m-=o),v<0&&(v+=o);let w=v-m;w<0?w+=o:w>o&&(w-=o),c&&(w-=o);const x=zt(Ut(w/a)),b=w/x,B=Wt(b/4),E=8/3*B*B/Wt(b/2);v=m+b;let T,k,C,R,L,P,O,S,D=Nt(m),M=Wt(m),A=C=y*i*D-f*r*M,I=R=f*i*D+y*r*M,W=e+C,N=s+R;t&&t.push(Lt.L,W,N),u&&Yt(u,W,N),p&&Xt(p,W,N);for(let n=0;n<x;n++)T=Nt(v),k=Wt(v),C=y*i*T-f*r*k,R=f*i*T+y*r*k,L=e+A-E*(y*i*M+f*r*D),P=s+I-E*(f*i*M-y*r*D),O=e+C+E*(y*i*k+f*r*T),S=s+R+E*(f*i*k-y*r*T),t&&t.push(Lt.C,L,P,O,S,e+C,s+R),u&&qt(e+A,s+I,L,P,O,S,e+C,s+R,u,!0),A=C,I=R,D=T,M=k,m=v,v+=b;_&&Xt(_,e+C,s+R)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(Lt.C,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){qt(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,w=s,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=i,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,_=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?jt(h,t,e):Yt(h,t,e),jt(h,o,a);for(let l=0,c=d.length;l<c;l++)Kt(d[l],t,e,s,i,r,n,o,a,Vt),jt(h,Vt.x,Vt.y)},getPointAndSet(t,e,s,i,r,n,o,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+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return Kt(t,e,s,i,r,n,o,a,h,l),l}},{getPointAndSet:Kt,toTwoPointBounds:qt,ellipse:Zt}=Gt,{sin:Qt,cos:$t,sqrt:Jt,atan2:te}=Math,{ellipse:ee}=Gt,se={ellipticalArc(t,e,s,i,r,a,h,l,d,c,u){const _=(d-e)/2,p=(c-s)/2,g=a*n,f=Qt(g),y=$t(g),m=-y*_-f*p,v=-y*p+f*_,w=i*i,x=r*r,b=v*v,B=m*m,E=w*x-w*b-x*B;let T=0;if(E<0){const t=Jt(1-E/(w*x));i*=t,r*=t}else T=(h===l?-1:1)*Jt(E/(w*b+x*B));const k=T*i*v/r,C=-T*r*m/i,R=te((v-C)/r,(m-k)/i),L=te((-v-C)/r,(-m-k)/i);let P=L-R;0===l&&P>0?P-=o:1===l&&P<0&&(P+=o);const O=e+_+y*k-f*C,S=s+p+f*k+y*C,D=P<0?1:0;u?ee(t,O,S,i,r,a,R/n,L/n,D):i!==r||a?t.push(Lt.G,O,S,i,r,a,R/n,L/n,D):t.push(Lt.O,O,S,i,R/n,L/n,D)}},{M:ie,m:re,L:ne,l:oe,H:ae,h:he,V:le,v:de,C:ce,c:ue,S:_e,s:pe,Q:ge,q:fe,T:ye,t:me,A:ve,a:we,Z:xe,z:be,N:Be,D:Ee,X:Te,G:ke,F:Ce,O:Re,P:Le,U:Pe}=Lt,{rect:Oe,roundRect:Se,arcTo:De,arc:Me,ellipse:Ae,quadraticCurveTo:Ie}=Gt,{ellipticalArc:We}=se,Ne=Z.get("PathConvert"),Fe={},ze={current:{dot:0},stringify(t){let e,s,i,r=0,n=t.length,o="";for(;r<n;){s=t[r],e=At[s],o+=s===i?" ":Mt[s];for(let s=1;s<e;s++)o+=t[r+s],s===e-1||(o+=" ");i=s,r+=e}return o},parse(t,e){let s,i,r,n="";const o=[],a=e?St:Ot;for(let e=0,h=t.length;e<h;e++)i=t[e],q[i]?("."===i&&(Ue.dot++,Ue.dot>1&&(He(o,n),n="")),n+=i):Lt[i]?(n&&(He(o,n),n=""),Ue.name=Lt[i],Ue.length=Pt[i],Ue.index=0,He(o,Ue.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&He(o,n),n=i):n&&(He(o,n),n=""),r=i;return n&&He(o,n),s?ze.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case re:t[c+1]+=a,t[c+2]+=h;case ie:a=t[c+1],h=t[c+2],_.push(ie,a,h),c+=3;break;case he:t[c+1]+=a;case ae:a=t[c+1],_.push(ne,a,h),c+=2;break;case de:t[c+1]+=h;case le:h=t[c+1],_.push(ne,a,h),c+=2;break;case oe:t[c+1]+=a,t[c+2]+=h;case ne:a=t[c+1],h=t[c+2],_.push(ne,a,h),c+=3;break;case pe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=_e;case _e:o=n===ce||n===_e,l=o?2*a-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(ce,l,d,s,i,a,h),c+=5;break;case ue: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=ce;case ce:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ce,t[c+1],t[c+2],s,i,a,h),c+=7;break;case me:t[c+1]+=a,t[c+2]+=h,r=ye;case ye:o=n===ge||n===ye,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Ie(_,a,h,s,i,t[c+1],t[c+2]):_.push(ge,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case fe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ge;case ge:s=t[c+1],i=t[c+2],e?Ie(_,a,h,s,i,t[c+3],t[c+4]):_.push(ge,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case we:t[c+6]+=a,t[c+7]+=h;case ve:We(_,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 be:case xe:_.push(xe),c++;break;case Be:a=t[c+1],h=t[c+2],e?Oe(_,a,h,t[c+3],t[c+4]):Ye(_,t,c,5),c+=5;break;case Ee:a=t[c+1],h=t[c+2],e?Se(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ye(_,t,c,9),c+=9;break;case Te:a=t[c+1],h=t[c+2],e?Se(_,a,h,t[c+3],t[c+4],t[c+5]):Ye(_,t,c,6),c+=6;break;case ke:Ae(e?_:Ye(_,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,Fe),a=Fe.x,h=Fe.y,c+=9;break;case Ce:e?Ae(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ye(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Re:Me(e?_:Ye(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Fe),a=Fe.x,h=Fe.y,c+=7;break;case Le:e?Me(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ye(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Pe:De(e?_:Ye(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Fe),a=Fe.x,h=Fe.y,c+=6;break;default:return Ne.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){Ue.index===Ue.length&&(Ue.index=1,t.push(Ue.name)),t.push(Number(e)),Ue.index++,Ue.dot=0}},{current:Ue,pushData:He,copyData:Ye}=ze,{M:je,L:Xe,C:Ve,Q:Ge,Z:Ke,N:qe,D:Ze,X:Qe,G:$e,F:Je,O:ts,P:es,U:ss}=Lt,is={},rs={beginPath(t){t.length=0},moveTo(t,e,s){t.push(je,e,s)},lineTo(t,e,s){t.push(Xe,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push(Ve,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Ge,e,s,i,r)},closePath(t){t.push(Ke)},rect(t,e,s,i,r){t.push(qe,e,s,i,r)},roundRect(t,e,s,i,n,o){if("number"==typeof o)t.push(Qe,e,s,i,n,o);else{const a=r.fourNumber(o);a?t.push(Ze,e,s,i,n,...a):t.push(qe,e,s,i,n)}},ellipse(t,e,s,i,r,n,o,a,h){void 0===n?t.push(Je,e,s,i,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push($e,e,s,i,r,n,o,a,h?1:0))},arc(t,e,s,i,r,n,o){void 0===r?t.push(es,e,s,i):(void 0===n&&(n=360),t.push(ts,e,s,i,r,n,o?1:0))},moveToEllipse(t,e,s,i,r,n,o,a,h){void 0===n&&(n=0),void 0===o&&(o=0),void 0===a&&(a=360),Gt.ellipse(null,e,s,i,r,n,o,a,h,null,null,is),t.push(je,is.x,is.y),ns(t,e,s,i,r,n,o,a,h)},moveToArc(t,e,s,i,r,n,o){void 0===r&&(r=0),void 0===n&&(n=360),Gt.arc(null,e,s,i,r,n,o,null,null,is),t.push(je,is.x,is.y),os(t,e,s,i,r,n,o)},arcTo(t,e,s,i,r,n){t.push(ss,e,s,i,r,n)}},{ellipse:ns,arc:os}=rs,{moveTo:as,lineTo:hs,quadraticCurveTo:ls,bezierCurveTo:ds,closePath:cs,beginPath:us,rect:_s,roundRect:ps,ellipse:gs,arc:fs,arcTo:ys,moveToEllipse:ms,moveToArc:vs}=rs;class ws{constructor(t){this.path=t?"string"==typeof t?Ct.parse(t):t:[]}beginPath(){return us(this.path),this}moveTo(t,e){return as(this.path,t,e),this}lineTo(t,e){return hs(this.path,t,e),this}bezierCurveTo(t,e,s,i,r,n){return ds(this.path,t,e,s,i,r,n),this}quadraticCurveTo(t,e,s,i){return ls(this.path,t,e,s,i),this}closePath(){return cs(this.path),this}rect(t,e,s,i){return _s(this.path,t,e,s,i),this}roundRect(t,e,s,i,r){return ps(this.path,t,e,s,i,r),this}ellipse(t,e,s,i,r,n,o,a){return gs(this.path,t,e,s,i,r,n,o,a),this}arc(t,e,s,i,r,n){return fs(this.path,t,e,s,i,r,n),this}arcTo(t,e,s,i,r){return ys(this.path,t,e,s,i,r),this}moveToEllipse(t,e,s,i,r,n,o,a){return ms(this.path,t,e,s,i,r,n,o,a),this}moveToArc(t,e,s,i,r,n){return vs(this.path,t,e,s,i,r,n),this}}const{M:xs,L:bs,C:Bs,Q:Es,Z:Ts,N:ks,D:Cs,X:Rs,G:Ls,F:Ps,O:Os,P:Ss,U:Ds}=Lt,Ms=Z.get("PathDrawer"),As={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case xs:t.moveTo(e[i+1],e[i+2]),i+=3;break;case bs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Bs:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Es:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ts:t.closePath(),i+=1;break;case ks:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Cs: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 Rs:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ls:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*n,e[i+6]*n,e[i+7]*n,e[i+8]),i+=9;break;case Ps:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,o,!1),i+=5;break;case Os:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*n,e[i+5]*n,e[i+6]),i+=7;break;case Ss:t.arc(e[i+1],e[i+2],e[i+3],0,o,!1),i+=4;break;case Ds:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Ms.error(`command: ${s} [index:${i}]`,e)}}},{M:Is,L:Ws,C:Ns,Q:Fs,Z:zs,N:Us,D:Hs,X:Ys,G:js,F:Xs,O:Vs,P:Gs,U:Ks}=Lt,{toTwoPointBounds:qs,toTwoPointBoundsByQuadraticCurve:Zs,arcTo:Qs,arc:$s,ellipse:Js}=Gt,{add:ti,copy:ei,addPoint:si,setPoint:ii,addBounds:ri,toBounds:ni}=L,oi=Z.get("PathBounds");let ai,hi,li;const di={},ci={},ui={},_i={toBounds(t,e){_i.toTwoPointBounds(t,ci),ni(ci,e)},toTwoPointBounds(t,e){if(!t||!t.length)return ii(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(s=t[a],0===a&&(s===zs||s===Ns||s===Fs?ii(e,h,l):ii(e,t[a+1],t[a+2])),s){case Is:case Ws:h=t[a+1],l=t[a+2],si(e,h,l),a+=3;break;case Ns:n=t[a+5],o=t[a+6],qs(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,o,di),ti(e,di),h=n,l=o,a+=7;break;case Fs:i=t[a+1],r=t[a+2],n=t[a+3],o=t[a+4],Zs(h,l,i,r,n,o,di),ti(e,di),h=n,l=o,a+=5;break;case zs:a+=1;break;case Us:h=t[a+1],l=t[a+2],ri(e,h,l,t[a+3],t[a+4]),a+=5;break;case Hs:case Ys:h=t[a+1],l=t[a+2],ri(e,h,l,t[a+3],t[a+4]),a+=s===Hs?9:6;break;case js:Js(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],di,ui),0===a?ei(e,di):ti(e,di),h=ui.x,l=ui.y,a+=9;break;case Xs:h=t[a+1],l=t[a+2],hi=t[a+3],li=t[a+4],ri(e,h-hi,l-li,2*hi,2*li),h+=hi,a+=5;break;case Vs:$s(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],di,ui),0===a?ei(e,di):ti(e,di),h=ui.x,l=ui.y,a+=7;break;case Gs:h=t[a+1],l=t[a+2],ai=t[a+3],ri(e,h-ai,l-ai,2*ai,2*ai),h+=ai,a+=4;break;case Ks:Qs(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],di,ui),0===a?ei(e,di):ti(e,di),h=ui.x,l=ui.y,a+=6;break;default:return void oi.error(`command: ${s} [index:${a}]`,t)}}},pi={smooth:(t,e,s)=>t};Ct.creator=new ws,Ct.parse=ze.parse,Ct.convertToCanvasData=ze.toCanvasData;const{drawRoundRect:gi}=It;function fi(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){gi(this,t,e,s,i,r)})}(t)}function yi(t,e,s){Object.defineProperty(t,e,s)}function mi(t,e){return Object.getOwnPropertyDescriptor(t,e)}function vi(t){return(e,s)=>{yi(e,s,{get(){return this.__getAttr(t)},set(e){this.__setAttr(t,e)}})}}function wi(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)},configurable:!0,enumerable:!0};yi(t,e,Object.assign(r,i||{})),Fi(t,e,s)}function xi(t){return(e,s)=>{wi(e,s,t)}}function bi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.positionChanged||this.__layout.positionChange()}})}}function Bi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}})}}function Ei(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}})}}function Ti(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange()}})}}const ki=Ti;function Ci(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.strokeChanged||this.__layout.strokeChange()}})}}const Ri=Ci;function Li(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Pi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}})}}function Oi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.opacityChanged||this.__layout.opacityChange()}})}}function Si(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent((()=>{this.parent.__layout.childrenSortChanged=!0}))}})}}function Di(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent((()=>{this.parent.__updateMask(t)}))}})}}function Mi(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.waitParent((()=>{this.parent.__updateEraser(t)}))}})}}function Ai(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),Z.showHitView&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}})}}function Ii(t){return(e,s)=>{yi(e,"__DataProcessor",{get:()=>t})}}function Wi(t){return(e,s)=>{yi(e,"__LayoutProcessor",{get:()=>t})}}function Ni(t,e,s){Fi(t.prototype,e,s)}function Fi(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o={get(){const t=this[r];return void 0===t?s:t},set(t){this[r]=t},configurable:!0,enumerable:!0};void 0===s?o.get=function(){return this[r]}:"width"===e?o.get=function(){const t=this[r];return void 0===t?this.__naturalWidth||s:t}:"height"===e&&(o.get=function(){const t=this[r];return void 0===t?this.__naturalHeight||s:t});const a=mi(i,e);a&&a.set&&(o.set=a.set),i[n]&&(o.set=i[n],delete i[n]),Object.defineProperty(i,e,o)}const zi=new Z("rewrite"),Ui=[],Hi=["destroy","constructor"];function Yi(t){return(e,s)=>{Ui.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function ji(){return t=>{Xi()}}function Xi(t){Ui.length&&(Ui.forEach((e=>{t&&zi.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),Ui.length=0)}function Vi(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach((i=>{if(!(Hi.includes(i)||e&&e.includes(i)))if(t.prototype){mi(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]}))}}function Gi(){return t=>{st.register(t)}}function Ki(){return t=>{nt.register(t)}}setTimeout((()=>Xi(!0)));const{toOuterOf:qi}=H;class Zi{constructor(t){this.leaf=t,this.renderBounds=this.strokeBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.localRenderBounds=this.localStrokeBounds=t.__local,this.boxChange(),this.positionChange()}checkUpdate(e){const{leafer:s}=this.leaf;if(s)s.ready?(t.realtimeLayout||e)&&s.watcher.changed&&s.layouter.layout():s.start();else{let e=this.leaf;for(;e.parent;)e=e.parent;t.layout(e)}}getTransform(t){return this.checkUpdate(),"world"===t?this.leaf.__world:this.leaf.__local}decomposeTransform(t){return this.checkUpdate(),f.decompose("world"===t?this.leaf.__world:this.leaf.__local)}getBounds(t,e){if(this.checkUpdate(),"world"===e)switch(t){case"render":return this.leaf.__world;case"content":if(this.contentBounds)return this.getWorldContentBounds();case"margin":case"box":return this.getWorldBoxBounds();case"margin":case"stroke":return this.getWorldStrokeBounds()}else if("inner"===e)switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"margin":case"box":return this.boxBounds;case"stroke":return this.strokeBounds}else switch(t){case"render":return this.localRenderBounds;case"margin":case"content":case"box":return this.leaf.__local;case"stroke":return this.localStrokeBounds}}getWorldContentBounds(){return this._worldContentBounds||(this._worldContentBounds={}),qi(this.contentBounds,this.leaf.__world,this._worldContentBounds),this._worldContentBounds}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),qi(this.boxBounds,this.leaf.__world,this._worldBoxBounds),this._worldBoxBounds}getWorldStrokeBounds(){return this._worldStrokeBounds||(this._worldStrokeBounds={}),qi(this.strokeBounds,this.leaf.__world,this._worldStrokeBounds),this._worldStrokeBounds}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this.strokeBounds=this.boxBounds,this.localStrokeBounds=this.leaf.__local,t&&this.spreadRenderCancel()}spreadRenderCancel(){this.renderBounds=this.strokeBounds,this.localRenderBounds=this.localStrokeBounds}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}}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}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxChanged||this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const Qi={},$i={on(t,e,s){let i,r,n;s&&("boolean"==typeof s?i=s:(i=s.capture,r=s.once));const o=Ji(this,i,!0),a="string"==typeof t?t.split(" "):t,h=r?{listener:e,once:r}:{listener:e};a.forEach((t=>{t&&(n=o[t],n?-1===n.findIndex((t=>t.listener===e))&&n.push(h):o[t]=[h])}))},off(t,e,s){let i,r,n;s&&(i="boolean"==typeof s?s:s.capture);const o=Ji(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(r=o[t],r&&(n=r.findIndex((t=>t.listener===e)),n>-1&&r.splice(n,1),r.length||delete o[t]))}))},on_(t,e,s,i){return s&&(e=e.bind(s)),this.on(t,e,i),{type:t,listener:e,options:i}},off_(t){if(!t)return;const e=t instanceof Array?t:[t];e.forEach((t=>{this.off(t.type,t.listener,t.options)})),e.length=0},once(t,e,s){this.on(t,e,{once:!0,capture:s})},emit(t,e,s){const i=Ji(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&(r=i[n],r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),!e||!e.isStopNow);n++);}},emitEvent(t,e){t.current=this,this.emit(t.type,t,e)},hasEvent(t,e){const{__bubbleMap:s,__captureMap:i}=this;return void 0===e?!!(i&&i[t]||s&&s[t]):!!(e?i&&i[t]:s&&s[t])}};function Ji(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Qi)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Qi)}}class tr{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0}stopNow(){this.isStopNow=!0,this.isStop=!0}stop(){this.isStop=!0}}class er extends tr{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}er.ADD="child.add",er.REMOVE="child.remove";class sr extends tr{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}sr.CHANGE="property.change";class ir extends tr{constructor(t,e,s,i,r,n){super(t,e),this.image=s,this.attrName=i,this.attrValue=r,n&&(this.error=n)}}ir.LOADED="image.loaded",ir.ERROR="image.error";class rr extends tr{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){"object"==typeof t?(super(rr.RESIZE),Object.assign(this,t)):super(t),this.old=e}}rr.RESIZE="resize";class nr extends tr{constructor(t,e){super(t),e&&Object.assign(this,e)}}nr.START="transform.start",nr.CHANGE="transform.change",nr.END="transform.end",nr.BEFORE_START="transform.before_start",nr.BEFORE_CHANGE="transform.before_change",nr.BEFORE_END="transform.before_end";class or extends tr{constructor(t,e){super(t),this.data=e}}or.REQUEST="watch.request",or.DATA="watch.data";class ar extends tr{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}ar.CHECK_UPDATE="layout.check_update",ar.REQUEST="layout.request",ar.START="layout.start",ar.BEFORE="layout.before",ar.LAYOUT="layout.layout",ar.AFTER="layout.after",ar.AGAIN="layout.again",ar.END="layout.end";class hr extends tr{}hr.FRAME="animate.frame";class lr extends tr{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}lr.REQUEST="render.request",lr.START="render.start",lr.BEFORE="render.before",lr.RENDER="render",lr.AFTER="render.after",lr.AGAIN="render.again",lr.END="render.end";class dr extends tr{}dr.START="leafer.start",dr.BEFORE_READY="leafer.before_ready",dr.READY="leafer.ready",dr.AFTER_READY="leafer.after_ready",dr.VIEW_READY="leafer.view_ready",dr.STOP="leafer.stop",dr.RESTART="leafer.restart",dr.END="leafer.end";const cr={__setAttr(t,e){if(this.leafer&&this.leafer.ready){this.__[t]=e;const{CHANGE:s}=sr,i=new sr(s,this,t,this.__.__get(t),e);this.hasEvent(s)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}else this.__[t]=e},__getAttr(t){return this.__.__get(t)}},{defaultMatrix:ur}=f,{sin:_r,cos:pr}=Math,gr={__updateWorldMatrix(){const t=this.parent?this.parent.__world:ur,e=this.__local,s=this.__world;this.__layout.matrixChanged&&this.__updateLocalMatrix(),this.__layout.affectScaleOrRotation?(s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f):(s.a=t.a,s.b=t.b,s.c=t.c,s.d=t.d,s.e=e.e*t.a+e.f*t.c+t.e,s.f=e.e*t.b+e.f*t.d+t.f)},__updateLocalMatrix(){const t=this.__local,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:r,skewX:o,skewY:a}=this.__;r||o||a?(r*=n,o&&(o*=n),a&&(a*=n),t.a=s*pr(r+a),t.b=s*_r(r+a),t.c=i*-_r(r-o),t.d=i*pr(r-o)):(t.a=s,t.b=0,t.c=0,t.d=i,e.affectRotation=!1),e.scaleChanged=!1,e.rotationChanged=!1}}else e.scaleChanged&&(t.a=s,t.d=i,e.scaleChanged=!1)}e.positionChanged&&(t.e=this.__.x,t.f=this.__.y,e.positionChanged=!1),this.__layout.matrixChanged=!1}},{toOuterOf:fr,copyAndSpread:yr}=H,mr={__updateWorldBounds(){var t;if(this.__layout.boundsChanged){let e;const s=this.__layout;s.boxChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),s.boxChanged=!1,e=!0),s.localBoxChanged&&(this.__updateLocalBoxBounds(),s.localBoxChanged=!1,s.strokeSpread&&(s.strokeChanged=!0),s.renderSpread&&(s.renderChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxChange()),s.strokeChanged&&(s.strokeSpread=this.__updateStrokeSpread(),s.strokeSpread?(s.strokeBounds===s.boxBounds&&s.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):s.spreadStrokeCancel(),s.strokeChanged=!1,s.renderSpread&&(s.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),e||(e=!0)),s.renderChanged&&(s.renderSpread=this.__updateRenderSpread(),s.renderSpread?(s.renderBounds!==s.boxBounds&&s.renderBounds!==s.strokeBounds||s.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):s.spreadRenderCancel(),s.renderChanged=!1,this.parent&&this.parent.__layout.renderChange()),s.boundsChanged=!1,fr(this.__layout.renderBounds,this.__world,this.__world),e&&this.__onUpdateSize()}else fr(this.__layout.renderBounds,this.__world,this.__world)},__updateLocalBoxBounds(){fr(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){fr(this.__layout.strokeBounds,this.__local,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){fr(this.__layout.renderBounds,this.__local,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height},__updateStrokeBounds(){yr(this.__layout.strokeBounds,this.__layout.boxBounds,this.__layout.strokeSpread)},__updateRenderBounds(){yr(this.__layout.renderBounds,this.__layout.strokeBounds,this.__layout.renderSpread)}},{toInnerRadiusPointOf:vr}=T,wr={},xr={__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),vr(t,this.__world,wr),this.__hit(wr)},__drawHitPath(t){this.__drawRenderPath(t)}},br={__render(t,e){if(this.__worldOpacity)if(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,this.__.__single){const s=t.getSameCanvas(!0);this.__draw(s,e);const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?(t.resetTransform(),t.copyWorld(s,null,null,i)):t.copyWorldToInner(s,this.__world,this.__layout.renderBounds,i),s.recycle()}else this.__draw(t,e)},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},Br={__updateEraser(t){this.__hasEraser=!!t||this.children.some((t=>t.__.isEraser))},__updateMask(t){this.__hasMask=!!t||this.children.some((t=>t.__.isMask))},__renderMask(t,e,s){e.resetTransform(),e.useMask(s),t.resetTransform(),t.opacity=this.__worldOpacity,t.copyWorld(e)},__removeMask(t){if(t)t.isMask=!1,this.remove(t);else{const{children:e}=this;for(let s=0,i=e.length;s<i;s++)(t=e[s]).isMask&&(this.__removeMask(t),i--,s--)}}},Er={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__worldOpacity)if(this.__.__single){t.resetTransform();const s=t.getSameCanvas();this.__renderBranch(s,e),t.opacity=this.__worldOpacity;const i=this.__.isEraser?"destination-out":this.__.blendMode;e.matrix?t.copyWorld(s,null,null,i):t.copyWorld(s,this.__world,this.__world,i),s.recycle()}else this.__renderBranch(t,e)},__renderBranch(t,e){let s;const{children:i}=this;if(this.__hasMask&&i.length>1){let r,n=t.getSameCanvas(),o=t.getSameCanvas();for(let a=0,h=i.length;a<h;a++)s=i[a],s.isMask?(r?(this.__renderMask(t,o,n),n.clear(),o.clear()):r=!0,s.__render(n,e)):s.__render(o,e);this.__renderMask(t,o,n),n.recycle(),o.recycle()}else{const{bounds:r,hideBounds:n}=e;for(let o=0,a=i.length;o<a;o++)s=i[o],r&&!r.hit(s.__world,e.matrix)||n&&n.includes(s.__world,e.matrix)||s.__render(t,e)}}},Tr={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Cr(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Rr(e[t])}},updateAllChange(t){if(Rr(t),t.__updateChange(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Lr(e[t])}},worldHittable(t){if(!t.__.hittable)return!1;let{parent:e}=t;for(;e;){if(!e.__.hittable||!e.__.hitChildren)return!1;e=e.parent}return!0},moveWorld(t,e,s){const i={x:e,y:s};t.parent&&f.toInnerPoint(t.parent.__world,i,i,!0),kr.moveLocal(t,i.x,i.y)},moveLocal(t,e,s=0){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,i,r){const n=t.parent?T.tempToInnerOf(e,t.parent.__world):e;this.zoomOfLocal(t,n,s,i,r)},zoomOfLocal(t,e,s,i,r){i||(i=s),r||(r=t);const{x:n,y:o}=r.__,a=(new R).translate(n,o).scaleOfOuter(e,s,i);r.x=a.e,r.y=a.f,t.scaleX=t.__.scaleX*s,t.scaleY=t.__.scaleY*i},rotateOfWorld(t,e,s,i){const r=t.parent?T.tempToInnerOf(e,t.parent.__world):e;this.rotateOfLocal(t,r,s,i)},rotateOfLocal(t,e,s,i){i||(i=t);const{x:r,y:n}=i.__,o=(new R).translate(r,n).rotateOfOuter(e,s);i.x=o.e,i.y=o.f,t.rotation=t.__.rotation+s},drop(t,e){const s={x:t.x,y:t.y};t.localToWorld(s),e.worldToInner(s),t.set(s),e.add(t)}},kr=Tr,{updateAllWorldMatrix:Cr,updateAllWorldOpacity:Rr,updateAllChange:Lr}=kr,Pr={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.isEraser?null:t.__local,localEventBounds:t=>t.__.isEraser?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.isEraser?null:t.__layout.localRenderBounds,maskLocalBoxBounds:t=>t.__.isMask?t.__local:null,maskLocalEventBounds:t=>t.__.isMask?t.__layout.localStrokeBounds:null,maskLocalRenderBounds:t=>t.__.isMask?t.__layout.localRenderBounds:null},Or={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.push(t),Sr(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&void 0===s[t.parent.innerId];)e.push(t.parent),t=t.parent;else for(;t.parent;)e.push(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++)Dr(e[t],e)},updateWorldBoundsByBranchStack(t){let e;for(let s=t.length-1;s>-1;s--){e=t[s];for(let t=0,s=e.children.length;t<s;t++)e.children[t].__updateWorldBounds()}e.__updateWorldBounds()}},{pushAllChildBranch:Sr,pushAllBranchStack:Dr}=Or,Mr={run(t){for(let e=0,s=t.length;e<s;e++)t[e]();t.length=0}},{LEAF:Ar,create:Ir}=s;let Wr=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 _t}get __LayoutProcessor(){return Zi}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.__layout.checkUpdate(),this.__worldOpacity}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}constructor(t){this.innerId=Ir(Ar),this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0},this.__world={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),t&&Object.assign(this,t)}waitParent(t){this.parent?t():this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}waitLeafer(t){this.leafer?t():this.__leaferWait?this.__leaferWait.push(t):this.__leaferWait=[t]}__bindLeafer(t){if(this.isLeafer&&(t=this),this.leafer=t,this.__level=this.parent?this.parent.__level+1:1,this.__leaferWait&&t&&Mr.run(this.__leaferWait),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t){}get(t){}__setAttr(t,e){}__getAttr(t){}forceUpdate(t){t||(t="x");const e=this.__.__getInput(t);this[t]=e}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){}__updateMask(t){}__renderMask(t,e,s){}__removeMask(t){}getWorld(t){return this.__layout.decomposeTransform("world")[t]}getBounds(t,e="world"){return this.__layout.getBounds(t,e)}worldToLocal(t,e,s){this.parent?f.toInnerPoint(this.parent.worldTransform,t,e,s):e&&T.copy(e,t)}localToWorld(t,e,s){this.parent?f.toOuterPoint(this.parent.worldTransform,t,e,s):e&&T.copy(e,t)}worldToInner(t,e,s){f.toInnerPoint(this.worldTransform,t,e,s)}innerToWorld(t,e,s){f.toOuterPoint(this.worldTransform,t,e,s)}move(t,e){Tr.moveLocal(this,t,e)}scaleOf(t,e,s){this.__layout.checkUpdate(),void 0===s&&(s=e),Tr.zoomOfLocal(this,T.tempToOuterOf(t,this.__local),e,s)}rotateOf(t,e){this.__layout.checkUpdate(),Tr.rotateOfLocal(this,T.tempToOuterOf(t,this.__local),e)}__hitWorld(t){return!0}__hit(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__renderShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){this.parent&&this.parent.remove(this)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}destroy(){this.__&&(this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null,this.children&&(this.children.forEach((t=>{t.destroy()})),this.children.length=0))}};Wr=gt([Vi(cr),Vi(gr),Vi(mr),Vi(xr),Vi($i),Vi(br)],Wr);const{setByListWithHandle:Nr}=H,{sort:Fr}=Or,{localBoxBounds:zr,localEventBounds:Ur,localRenderBounds:Hr,maskLocalBoxBounds:Yr,maskLocalEventBounds:jr,maskLocalRenderBounds:Xr}=Pr;let Vr=class extends Wr{constructor(){super(),this.isBranch=!0,this.children=[]}__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(){Nr(this.__layout.boxBounds,this.children,this.__hasMask?Yr:zr)}__updateStrokeBounds(){Nr(this.__layout.strokeBounds,this.children,this.__hasMask?jr:Ur)}__updateRenderBounds(){Nr(this.__layout.renderBounds,this.children,this.__hasMask?Xr:Hr)}__updateSortChildren(){const{children:t}=this;if(t.length>1){for(let e=0,s=t.length;e<s;e++)t[e].__tempNumber=e;t.sort(Fr)}}add(t,e){t.parent&&t.parent.remove(t),t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1),t.__layout.boundsChanged||t.__layout.positionChange(),t.__parentWait&&Mr.run(t.__parentWait),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.ready&&this.__emitChildEvent(er.ADD,t))}remove(t){if(t){const e=this.children.indexOf(t);e>-1&&(this.children.splice(e,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t))}else void 0===t&&super.remove()}removeAll(){const{children:t}=this;this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,t.forEach((t=>{this.__realRemoveChild(t)}))}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange()}__realRemoveChild(t){t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.ready&&this.__emitChildEvent(er.REMOVE,t))}__emitChildEvent(t,e){const s=new er(t,e,this);e.hasEvent(t)&&e.emitEvent(s),this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}};Vr=gt([Vi(Er),Vi(Br)],Vr);const Gr={};class Kr{static isHoldSpaceKey(){return Kr.hasDownCode("Space")}static setDownCode(t){Gr[t]||(Gr[t]=!0)}static setUpCode(t){Gr[t]=!1}static hasDownCode(t){return Gr[t]}}class qr{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}const Zr={};class Qr extends tr{get spaceKey(){return Kr.isHoldSpaceKey()}get left(){return qr.left(this)}get right(){return qr.right(this)}get middle(){return qr.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getInner(t){return t||(t=this.current),t.worldToInner(this,Zr),Object.assign({},Zr)}getLocal(t){return t||(t=this.current),t.worldToLocal(this,Zr),Object.assign({},Zr)}static changeName(t,e){nt.changeName(t,e)}}let $r=class extends Qr{};$r.POINTER="pointer",$r.BEFORE_DOWN="pointer.before_down",$r.BEFORE_MOVE="pointer.before_move",$r.BEFORE_UP="pointer.before_up",$r.DOWN="pointer.down",$r.MOVE="pointer.move",$r.UP="pointer.up",$r.OVER="pointer.over",$r.OUT="pointer.out",$r.ENTER="pointer.enter",$r.LEAVE="pointer.leave",$r.TAP="tap",$r.DOUBLE_TAP="double_tap",$r.CLICK="click",$r.DOUBLE_CLICK="double_click",$r.LONG_PRESS="long_press",$r.LONG_TAP="long_tap",$r=gt([Ki()],$r);const Jr={},tn={};let en=class extends $r{getInnerMove(t){return t||(t=this.current),Jr.x=this.moveX,Jr.y=this.moveY,t.worldToInner(Jr,tn,!0),Object.assign({},tn)}getLocalMove(t){return t||(t=this.current),Jr.x=this.moveX,Jr.y=this.moveY,t.worldToLocal(Jr,tn,!0),Object.assign({},tn)}};var sn;en.DRAG="drag",en.START="drag.start",en.END="drag.end",en.OVER="drag.over",en.OUT="drag.out",en.ENTER="drag.enter",en.LEAVE="drag.leave",en=gt([Ki()],en);let rn=sn=class extends $r{static setList(t){sn.dragList=t instanceof ht?t:new ht(t)}static setData(t){this.dragData=t}};rn.DROP="drop",rn=sn=gt([Ki()],rn);let nn=class extends en{};nn.MOVE="move",nn.START="move.start",nn.END="move.end",nn=gt([Ki()],nn);let on=class extends Qr{};on.ROTATE="rotate",on.START="rotate.start",on.END="rotate.end",on=gt([Ki()],on);let an=class extends en{};an.SWIPE="swipe",an.LEFT="swipe.left",an.RIGHT="swipe.right",an.UP="swipe.up",an.DOWN="swipe.down",an=gt([Ki()],an);let hn=class extends Qr{};hn.ZOOM="zoom",hn.START="zoom.start",hn.END="zoom.end",hn=gt([Ki()],hn);let ln=class extends Qr{};ln.DOWN="key.down",ln.PRESS="key.press",ln.UP="key.up",ln=gt([Ki()],ln);class dn{constructor(t){this.options=t}load(e,s){return ft(this,void 0,void 0,(function*(){return t.origin.loadImage(this.options.url).then((t=>{this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,e&&e(this)})).catch((t=>{this.error=t,s&&s(t)}))}))}getCanvas(e,s,i,r){e||(e=this.width),s||(s=this.height);const n=t.origin.createCanvas(e,s),o=n.getContext("2d");return i&&(o.globalAlpha=i),o.drawImage(this.view,0,0,e,s),n}destroy(){this.view=null,this.options=null}}class cn{constructor(t){this.taskTime=1,this.id=s.create(s.TASK),this.task=t}run(){return ft(this,void 0,void 0,(function*(){this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}}const un=Z.get("TaskProcessor");class _n{get isComplete(){return this._isComplete}get running(){return this._running}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].taskTime,i===this.finishedIndex&&(e=s)):e+=this.list[i].taskTime;return this._isComplete?1:s/e}get total(){return this.list.length}get finishedIndex(){return this._isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this._isComplete?this.total:this.total-this.finishedIndex}constructor(t){this.config={parallel:6},this.list=[],this.index=0,t&&ct.assign(this.config,t),this.init()}init(){this.empty(),this._running=!1,this._isComplete=!0}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){clearTimeout(this._timer),this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){clearTimeout(this._timer),this._running=!1,this._isComplete=!0,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new cn(t),e)}addParallel(t,e){const s=new cn(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new cn(t))}push(t,e){e&&(t.taskTime=e),t.parent=this,this.list.push(t)}run(){this._running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTask():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)}))}runParallelTask(){this.parallelList.forEach((t=>{t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}))}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.parallel&&(e.push(t),t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}nextTask(){this.total===this.finishedIndex?this.onComplete():this._timer=setTimeout((()=>this.run()),0)}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){un.error("ParallelError"),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.empty(),this.config={}}}class pn{constructor(t,e){this.map={},this.leafer=t,this.tasker=new _n}get(t){let s=this.map[t.url];return s||(s=e.image(t),this.map[t.url]=s),s}load(t,e,s){this.tasker.addParallel((()=>ft(this,void 0,void 0,(function*(){return yield t.load(e,s)})))),this.tasker.running||this.tasker.start()}destroy(){this.leafer=null,this.map=null}}const gn=Z.get("plugin"),fn={power:{},list:[],onLeafer(t){fn.list.forEach((e=>{e.onLeafer&&e.onLeafer(t)}))}};function yn(t,e){const{power:s}=fn;fn.list.push(t);const i={};t.import?t.import.forEach((t=>{s[t]?i[t]=s[t]:gn.error(t+" non-existent")})):gn.warn("no import");try{t.run(i,e)}catch(t){gn.error(t)}}class mn{get updatedList(){if(this.hasRemoved){const t=new ht;return this.__updatedList.list.forEach((e=>{e.leafer&&t.push(e)})),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new ht,this.target=t,e&&(this.config=ct.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(lr.REQUEST)}__onAttrChange(t){this.__updatedList.push(t.target),this.update()}__onChildEvent(t){t.type===er.ADD?this.__pushChild(t.child):(this.hasRemoved||(this.hasRemoved=!0),this.__updatedList.push(t.parent)),this.update()}__pushChild(t){this.__updatedList.push(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 or(or.DATA,{updatedList:this.updatedList})),this.__updatedList=new ht,this.totalTimes++,this.changed=!1,this.hasRemoved=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(sr.CHANGE,this.__onAttrChange,this),t.on_([er.ADD,er.REMOVE],this.__onChildEvent,this),t.on_(or.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllWorldMatrix:vn,updateAllWorldOpacity:wn}=Tr,{pushAllChildBranch:xn,pushAllParent:bn}=Or;const{worldBounds:Bn}=Pr,{setByListWithHandle:En}=H;class Tn{constructor(t){this.updatedBounds=new V,this.beforeBounds=new V,this.afterBounds=new V,t instanceof Array&&(t=new ht(t)),this.updatedList=t}setBefore(){En(this.beforeBounds,this.updatedList.list,Bn)}setAfter(){En(this.afterBounds,this.updatedList.list,Bn),this.updatedBounds.setByList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:kn,updateAllChange:Cn}=Tr,{pushAllBranchStack:Rn,updateWorldBoundsByBranchStack:Ln}=Or,Pn=Z.get("Layouter");class On{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new lt,this.target=t,e&&(this.config=ct.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.running)return;const{target:t}=this;this.times=0;try{t.emit(ar.START),this.layoutOnce(),t.emitEvent(new ar(ar.END,this.layoutedBlocks,this.times))}catch(t){Pn.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Pn.warn("layouting"):this.times>3?Pn.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(or.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=J.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=ar,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new ar(r,a,this.times)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&!s.useZoomProxy&&(s.matrixChanged?(vn(t),e.push(t),t.isBranch&&xn(t,e),bn(t,e)):s.boundsChanged&&(e.push(t),t.isBranch&&(t.__tempNumber=0),bn(t,e)))}))}(i,this.__levelList),function(t){let e,s;t.sort(!0),t.levels.forEach((i=>{e=t.levelMap[i];for(let t=0,i=e.length;t<i;t++){if(s=e[t],s.isBranch&&s.__tempNumber)for(let t=0,e=s.children.length;t<e;t++)s.children[t].isBranch||s.children[t].__updateWorldBounds();s.__updateWorldBounds()}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&wn(t),t.__updateChange()}))}(i),a.forEach((t=>t.setAfter())),s.emitEvent(new ar(n,a,this.times)),s.emitEvent(new ar(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,J.end(e)}fullLayout(){const t=J.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=ar,n=this.getBlocks(new ht(e));e.emitEvent(new ar(s,n,this.times)),On.fullLayout(e),n.forEach((t=>{t.setAfter()})),e.emitEvent(new ar(i,n,this.times)),e.emitEvent(new ar(r,n,this.times)),this.addBlocks(n),J.end(t)}static fullLayout(t){if(kn(t),t.isBranch){const e=[t];Rn(t,e),Ln(e)}else t.__updateWorldBounds();Cn(t)}createBlock(t){return new Tn(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(){const{target:t}=this;this.__eventIds=[t.on_(ar.REQUEST,this.layout,this),t.on_(ar.AGAIN,this.layoutAgain,this),t.on_(or.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.config=null)}}const Sn=Z.get("Renderer");class Dn{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=ct.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(ar.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new V,Sn.log(e.innerName,"---\x3e");try{this.emitRender(lr.START),this.renderOnce(t),this.emitRender(lr.END,this.totalBounds)}catch(t){Sn.error(t)}Sn.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?Sn.warn("rendering"):this.times>3?Sn.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new V,this.renderOptions={},t?(this.emitRender(lr.BEFORE),t()):(this.requestLayout(),this.emitRender(lr.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(lr.RENDER,this.renderBounds,this.renderOptions),this.emitRender(lr.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return Sn.warn("PartRender: need update attr");e.some((t=>t.includes(this.target.__world)))&&this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=J.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=t.includes(this.target.__world),n=(new V).copy(i);s.save(),r&&!Z.showRepaint?s.clear():(i.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0)),this.__render(i,n),s.restore(),J.end(e)}fullRender(){const t=J.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),J.end(t)}__render(t,e){const s=(null==t?void 0:t.includes(this.target.__world))?{}:{bounds:t};this.needFill&&this.canvas.fillWorld(t,this.config.fill),Z.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=e||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),Z.showHitView&&this.renderHitView(s),Z.showBoundsView&&this.renderBoundsView(s)}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new V;e.setByList(t),t.length=0,t.push(e)}}__requestRender(){const e=Date.now();t.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-e))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(hr.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:s}=t.old;new V(0,0,e,s).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__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&&(Sn.warn(t.innerName,": none bounds"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new lr(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(lr.REQUEST,this.update,this),t.on_(ar.END,this.__onLayoutEnd,this),t.on_(lr.AGAIN,this.renderAgain,this),t.on_(rr.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:Mn}=H;class An{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,s){e||(e=0),s||(s={});const i=s.through||!1,r=s.ignoreHittable||!1;this.exclude=s.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const n=this.findList,o=this.getBestMatchLeaf(),a=r?this.getPath(o):this.getHitablePath(o);return this.clear(),i?{path:a,leaf:o,throughPath:n.length?this.getThroughPath(n):a}:{path:a,leaf:o}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:s,y:i}=this.point,r={x:s,y:i,radiusX:0,radiusY:0};for(let s=0,i=t.length;s<i;s++)if(e=t[s],Tr.worldHittable(e)&&(this.hitChild(e,r),this.findList.length))return this.findList[0]}return t[0]}getPath(t){const e=new ht;for(;t;)e.push(t),t=t.parent;return e.push(this.target),e}getHitablePath(t){const e=this.getPath(t);let s,i=new ht;for(let t=e.list.length-1;t>-1&&(s=e.list[t],s.__.hittable)&&(i.unshift(s),s.__.hitChildren);t--);return i}getThroughPath(t){const e=new ht,s=[];for(let e=t.length-1;e>-1;e--)s.push(this.getPath(t[e]));let i,r,n;for(let t=0,o=s.length;t<o;t++){i=s[t],r=s[t+1];for(let t=0,s=i.length;t<s&&(n=i.list[t],!r||!r.has(n));t++)e.push(n)}return e}eachFind(t,e){let s,i;const{point:r}=this;for(let n=t.length-1;n>-1;n--)s=t[n],e&&!s.isMask||(i=Mn(s.__world,r),s.isBranch?(i||s.__ignoreHitWorld)&&(this.eachFind(s.children,s.__onlyHitMask),s.isBranchLeaf&&!this.findList.length&&this.hitChild(s,r)):i&&this.hitChild(s,r))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.target=null,this.selector=null}}class In{constructor(t,e){this.config={},this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,e&&(this.config=ct.default(e,this.config)),this.findPath=new An(t,this),this.__listenEvents()}getByPoint(e,s,i){return"node"===t.name&&this.target.emit(ar.CHECK_UPDATE),this.findPath.getByPoint(e,s,i)}find(t,e){return"number"==typeof t?this.getByInnerId(t,e):t.startsWith("#")?this.getById(t.substring(1),e):t.startsWith(".")?this.getByClassName(t.substring(1),e):this.getByTagName(t,e)}getByInnerId(t,e){let s,i=this.innerIdList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.innerId===t&&(s=e,this.innerIdList[t]=s,!0))),s)}getById(t,e){let s,i=this.idList[t];return i||(e||(e=this.target),this.loopFind(e,(e=>e.id===t&&(s=e,this.idList[t]=s,!0))),s)}getByClassName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.className===t&&s.push(e),!1))),s}getByTagName(t,e){e||(e=this.target);let s=[];return this.loopFind(e,(e=>(e.__tag===t&&s.push(e),!1))),s}loopFind(t,e){if(e(t))return;const{children:s}=t;for(let i=0,r=s.length;i<r;i++){if(e(t=s[i]))return;t.isBranch&&this.loopFind(t,e)}}__onRemoveChild(t){const e=t.target;this.idList[e.id]&&(this.idList[e.id]=null),this.innerIdList[e.id]&&(this.innerIdList[e.innerId]=null)}__listenEvents(){this.__eventIds=[this.target.on_(er.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.findPath.destroy(),this.target=null,this.findPath=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}Object.assign(e,{watcher:(t,e)=>new mn(t,e),layouter:(t,e)=>new On(t,e),renderer:(t,e,s)=>new Dn(t,e,s),selector:(t,e)=>new In(t,e)}),t.layout=On.fullLayout;const Wn=Z.get("LeaferCanvas");class Nn extends kt{init(){const{view:t}=this.config;if(this.offscreen)t?this.view=t:this.__createView();else{t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;e.display||(e.display="block"),this.parentView=this.view.parentElement}this.__createContext(),this.autoLayout||this.resize(this.config)}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(){if(this.offscreen)try{return void(this.view=new OffscreenCanvas(1,1))}catch(t){Wn.error(t)}this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof 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;if(t.hasChildNodes()){const{style:e}=s;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(s)}else Wn.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this;if(!this.offscreen){const{style:s}=this.view;s.width=t+"px",s.height=e+"px"}this.view.width=t*s,this.view.height=e*s}updateClientBounds(){this.offscreen||(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(!this.offscreen){this.autoBounds=t,this.resizeListener=e;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()))}catch(t){this.imitateResizeObserver()}}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),t.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:s,y:i,width:r,height:n}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||n!==this.height){const{style:t}=e,{pixelRatio:o}=this;t.marginLeft=s+"px",t.marginTop=i+"px";const a={width:r,height:n,pixelRatio:o},h={};ct.copyAttrs(h,this,Tt),this.resize(a),void 0!==this.width&&this.resizeListener(new rr(a,h))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}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.unreal&&!this.offscreen){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}fi(CanvasRenderingContext2D.prototype),fi(Path2D.prototype);class Fn{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(nn.START,this.moveData)}t.path=this.moveData.path,e.emit(nn.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(hn.START,this.zoomData)}t.path=this.zoomData.path,e.emit(hn.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getByPoint(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(on.START,this.rotateData)}t.path=this.rotateData.path,e.emit(on.ROTATE,t),this.transformEndWait()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout((()=>{this.transformEnd()}),this.interaction.config.pointer.transformTime)}transformEnd(){this.moveEnd(),this.zoomEnd(),this.rotateEnd(),this.transformMode=null}moveEnd(){this.moveData&&(this.interaction.emit(nn.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(hn.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(on.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const zn={getMoveEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,moveX:e.x,moveY:e.y}),getRotateEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,rotation:e}),getZoomEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:t.x,y:t.y,scale:e}),getDragEventData:(t,e,s)=>Object.assign(Object.assign({},s),{x:s.x,y:s.y,moveX:s.x-e.x,moveY:s.y-e.y,totalX:s.x-t.x,totalY:s.y-t.y}),getDropEventData:(t,e,s)=>Object.assign(Object.assign({},t),{list:e,data:s}),getSwipeDirection:t=>t<-45&&t>-135?an.UP:t>45&&t<135?an.DOWN:t<=45&&t>=-45?an.RIGHT:an.LEFT,getSwipeEventData:(t,e,s)=>Object.assign(Object.assign({},s),{moveX:e.moveX,moveY:e.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:Un.getSwipeDirection(T.getAngle(t,s))}),getBase:t=>({altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:t.buttons,origin:t}),pathHasEventType(t,e){const{list:s}=t;for(let t=0,i=s.length;t<i;t++)if(s[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const s=new ht,{list:i}=t;for(let t=0,r=i.length;t<r;t++)i[t].hasEvent(e)&&s.push(i[t]);return s}},Un=zn,{getDragEventData:Hn,getDropEventData:Yn,getSwipeEventData:jn,filterPathByEventType:Xn}=zn;class Vn{constructor(t){this.interaction=t}setDragData(t){this.dragData=Hn(t,t,t)}getDragList(){return this.dragging?rn.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!qr.middle(t)&&!qr.left(t))return void s.pointerCancel();const{dragData:r}=this;if(!this.moving){const n=i.target.isLeafer&&s.config.move.dragEmpty;this.moving=(qr.middle(t)||Kr.isHoldSpaceKey()||n)&&e,this.moving&&s.emit(nn.START,r)}this.moving||this.dragStart(t,e);const{path:n,throughPath:o}=i;this.dragData=Hn(i,r,t),o&&(this.dragData.throughPath=o),this.dragData.path=n,this.moving?s.emit(nn.MOVE,this.dragData):this.dragging&&(s.emit(en.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=qr.left(t)&&e,this.dragging&&(this.interaction.emit(en.START,this.dragData),this.getDragableList(this.dragData.path),this.dragList=Xn(this.dragData.path,en.DRAG),!this.dragList.length&&this.dragableList&&this.dragList.pushList(this.dragableList)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.__.draggable&&e.__.hitSelf){this.dragableList=[e];break}}dragDragableList(){const{running:t}=this.interaction;if(this.dragableList&&t){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{Tr.moveWorld(s,t,e)}))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:s}=this,{path:i}=t;s?i.indexAt(0)!==s.indexAt(0)&&(e.emit(en.OUT,t,s),e.emit(en.OVER,t,i)):e.emit(en.OVER,t,i),this.dragOverPath=i}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:s}=this,{path:i}=t;e.emit(en.ENTER,t,i,s),e.emit(en.LEAVE,t,s,i),this.dragEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:r}=s,n=Hn(s,t,t);r&&(n.throughPath=r),n.path=i,this.moving&&e.emit(nn.END,n),this.dragging&&(e.emit(en.END,n),this.swipe(t,n),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(T.getDistance(i,t)>s.config.pointer.swipeDistance){const t=jn(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Yn(t,this.getDragList(),rn.dragData);e.path=this.dragEnterPath,this.interaction.emit(rn.DROP,e),this.interaction.emit(en.LEAVE,t,this.dragEnterPath)}dragReset(){rn.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dragOverPath=null,this.dragEnterPath=null,this.dragging=null,this.moving=null}checkDragOut(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)}autoMoveOnDragOut(t){const{interaction:e}=this,{downData:s}=e,{autoDistance:i,dragOut:r}=e.config.move;if(!r||!i)return;const n=e.shrinkCanvasBounds,{x:o,y:a}=n,h=H.right(n),l=H.bottom(n),d=t.x<o?i:h<t.x?-i:0,c=t.y<a?i:l<t.y?-i:0;let u=0,_=0;this.autoMoveTimer=setInterval((()=>{u+=d,_+=c,T.move(s,d,c),T.move(this.dragData,d,c),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:c,totalX:u,totalY:_})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const Gn=["move","zoom","rotate"];function Kn(t,e,s,i,r){if(Gn.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!Zn(t,r)){let n;for(let o=0,a=t.children.length;o<a;o++)n=t.children[o],!s.path.has(n)&&n.__.hittable&&qn(n,e,s,i,r)}}function qn(t,e,s,i,r){if(!t.__)return!0;if(t.__.hitSelf&&t.hasEvent(e,i)&&!Zn(t,r)){s.phase=i?1:t===s.target?2:3;const r=nt.get(e,s);if(t.emitEvent(r,i),r.isStop)return!0}return!1}function Zn(t,e){return e&&e.has(t)}const Qn={getData(t){const e=t[0],s=t[1],i=T.getCenter(e.from,s.from),r=T.getCenter(e.to,s.to),n={x:r.x-i.x,y:r.y-i.y},o=T.getDistance(e.from,s.from),a=T.getDistance(e.to,s.to)/o,h=T.getAngle(e.from,s.from),l=T.getAngle(e.to,s.to);return{move:n,scale:a,angle:this.getChangedAngle(h,l),center:r}},getChangedAngle(t,e){const s=(e=e<=-90?360+e:e)-(t=t<=-90?360+t:t);return s<0?s+360:s}},{pathHasEventType:$n,getMoveEventData:Jn,getZoomEventData:to,getRotateEventData:eo}=zn;class so{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(e,s,i,r){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:"Windows"===t.os?{x:37.5,y:37.5}:{x:20,y:8},preventDefault:!0},pointer:{hitRadius:5,through:!1,tapTime:120,longPressTime:800,transformTime:500,dragHover:!0,dragDistance:2,swipeDistance:20,ignoreMove:!1}},this.tapCount=0,this.target=e,this.canvas=s,this.selector=i,this.defaultPath=new ht(e),this.transformer=new Fn(this),this.dragger=new Vn(this),r&&(this.config=ct.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t){this.emit($r.BEFORE_DOWN,t,this.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getByPoint(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit($r.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),qr.left(t)&&(this.tapWait(),this.longPressWait(t))}pointerMove(t){(this.downData||this.canvas.bounds.hitPoint(t))&&(this.pointerMoveReal(t),this.dragger.checkDragOut(t))}pointerMoveReal(t){if(this.emit($r.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=T.getDistance(this.downData,t)>this.config.pointer.dragDistance;this.waitTap&&e&&this.pointerWaitCancel(),this.dragger.checkDrag(t,e)}if(this.dragger.moving||this.config.pointer.ignoreMove)return;const e=this.selector.getByPoint(t,this.hitRadius,{exclude:this.dragger.getDragList(),name:$r.MOVE});t.path=e.path,this.emit($r.MOVE,t),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))}pointerUp(t){if(!this.downData)return;this.emit($r.BEFORE_UP,t,this.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getByPoint(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit($r.UP,t),this.emit($r.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.dragger.dragEnd(t),this.downData=null}pointerCancel(){this.pointerUp(this.dragger.dragData)}multiTouch(t,e){const{move:s,angle:i,scale:r,center:n}=Qn.getData(e);this.rotate(eo(n,i,t)),this.zoom(to(n,r,t)),this.move(Jn(n,s,t))}move(t){this.transformer.move(t)}zoom(t){this.transformer.zoom(t)}rotate(t){this.transformer.rotate(t)}transformEnd(){this.transformer.transformEnd()}pointerOverOrOut(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.overPath?e.indexAt(0)!==this.overPath.indexAt(0)&&(this.emit($r.OUT,t,this.overPath),this.emit($r.OVER,t,e)):this.emit($r.OVER,t,e),this.overPath=e}pointerEnterOrLeave(t){if(this.dragger.moving)return;if(this.dragging&&!this.config.pointer.dragHover)return;const{path:e}=t;this.emit($r.ENTER,t,e,this.enterPath),this.emit($r.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit($r.LEAVE,t),this.dragger.dragging&&this.emit(rn.LEAVE,t))}tap(t){const{pointer:e}=this.config,s=this.longTap(t);if(!e.tapMore&&s)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const i=Date.now()-this.downTime,r=[$r.DOUBLE_TAP,$r.DOUBLE_CLICK].some((e=>$n(t.path,e)));i<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}emitTap(t){this.emit($r.TAP,t),this.emit($r.CLICK,t)}emitDoubleTap(t){this.emit($r.DOUBLE_TAP,t),this.emit($r.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit($r.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit($r.LONG_TAP,t),$n(t.path,$r.LONG_TAP)&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new V(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(rr.RESIZE,this.__onResize,this)],t.once(dr.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds)}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let r;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let n=s.length-1;n>-1;n--){if(r=s.list[n],qn(r,t,e,!0,i))return;r.isApp&&Kn(r,t,e,!0,i)}for(let n=0,o=s.length;n<o;n++)if(r=s.list[n],r.isApp&&Kn(r,t,e,!1,i),qn(r,t,e,!1,i))return}(t,e,s,i)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer.destroy(),this.config=null,this.target=null,this.selector=null,this.canvas=null,this.dragger=null,this.transformer=null)}}const io={convert(t,e){const s=zn.getBase(t),i=Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===i.pointerType&&(i.tangentialPressure=t.tangentialPressure,i.tiltX=t.tiltX,i.tiltY=t.tiltY,i.twist=t.twist),i},convertMouse(t,e){const s=zn.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const s=io.getTouch(t),i=zn.getBase(t);return Object.assign(Object.assign({},i),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:s.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},ro={getMove(t,e){let{moveSpeed:s}=e,{deltaX:i,deltaY:r}=t;return t.shiftKey&&!i&&(i=r,r=0),i>50&&(i=Math.max(50,i/3)),r>50&&(r=Math.max(50,r/3)),{x:-i*s*2,y:-r*s*2}},getScale(e,s){let i,n=1,{zoomMode:o,zoomSpeed:a}=s;const h=e.deltaY||e.deltaX;if(o?(i=!e.deltaX&&(t.intWheelDeltaY?Math.abs(h)>17:Math.ceil(h)!==h),(e.shiftKey||e.metaKey||e.ctrlKey)&&(i=!0)):i=!e.shiftKey&&(e.metaKey||e.ctrlKey),i){a=r.within(a,0,1);n=1-h/(25*(e.deltaY?s.delta.y:s.delta.x)*(1-a)+10),n<.5&&(n=.5),n>=1.5&&(n=1.5)}return n}},{getMoveEventData:no,getZoomEventData:oo,getRotateEventData:ao}=zn;class ho extends so{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:s}=this;for(let s in e)e[s]=e[s].bind(this),t.addEventListener(s,e[s]);for(let t in s)s[t]=s[t].bind(this),window.addEventListener(t,s[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)window.removeEventListener(t,e[t]),this.windowEvents={}}getLocal(t){const{clientBounds:e}=this.canvas;return{x:t.clientX-e.x,y:t.clientY-e.y}}getTouches(t){const e=[];for(let s=0,i=t.length;s<i;s++)e.push(t[s]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view}onKeyDown(t){Kr.setDownCode(t.code)}onKeyUp(t){Kr.setUpCode(t.code)}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.pointerDown(io.convert(t,this.getLocal(t)))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerMove(io.convert(t,this.getLocal(t)))}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.useMultiTouch||this.preventWindowPointer(t)||this.pointerUp(io.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.pointerDown(io.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerMove(io.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.useTouch||this.usePointer||this.preventWindowPointer(t)||this.pointerUp(io.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.useTouch||this.usePointer||this.pointerCancel()}onTouchStart(t){if(t.preventDefault(),this.multiTouchStart(t),this.usePointer)return;this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0;const e=io.getTouch(t);this.pointerDown(io.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.multiTouchMove(t),this.usePointer||this.preventWindowPointer(t))return;const e=io.getTouch(t);this.pointerMove(io.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.usePointer||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout((()=>{this.useTouch=!1}),500);const e=io.getTouch(t);this.pointerUp(io.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),s=this.getKeepTouchList(this.touches,e);s.length>1&&(this.multiTouch(zn.getBase(t),s),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let s;const i=[];return t.forEach((t=>{s=e.find((e=>e.identifier===t.identifier)),s&&i.push({from:this.getLocal(t),to:this.getLocal(s)})})),i}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}onWheel(t){this.preventDefaultWheel(t);const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):ro.getScale(t,e),i=this.getLocal(t),r=zn.getBase(t);1!==s?this.zoom(oo(i,s,r)):this.move(no(i,e.getMove?e.getMove(t,e):ro.getMove(t,e),r))}onGesturestart(t){this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){this.preventDefaultWheel(t);const e=this.getLocal(t),s=zn.getBase(t),i=t.scale/this.lastGestureScale,n=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=r.within(o,0,1),this.zoom(oo(e,i*i,s)),this.rotate(ao(e,n/Math.PI*180*(o/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.preventDefaultWheel(t),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}const{mineType:lo,fileType:co}=pt;function uo(s,i){t.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>t.toDataURL(lo(e),s),canvasToBolb:(t,e,s)=>new Promise((i=>t.toBlob(i,lo(e),s))),canvasSaveAs:(t,e,s)=>new Promise((i=>{let r=document.createElement("a");r.href=t.toDataURL(lo(co(e)),s),r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),i()})),loadImage:t=>new Promise(((e,s)=>{const i=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>{e(i)},i.onerror=t=>{s(t)},t.startsWith("data:")||t.includes("?"),i.src=t}))},t.canvas=e.canvas(),t.conicGradientSupport=!!t.canvas.context.createConicGradient}Object.assign(e,{canvas:(t,e)=>new Nn(t,e),image:t=>new dn(t),hitCanvas:(t,e)=>new Nn(t,e),interaction:(t,e,s,i)=>new ho(t,e,s,i)}),t.name="web",t.requestRender=function(t){window.requestAnimationFrame(t)},t.devicePixelRatio=devicePixelRatio,t.realtimeLayout=!0;const{userAgent:_o}=navigator;_o.indexOf("Firefox")>-1?(t.conicGradientRotate90=!0,t.intWheelDeltaY=!0):_o.indexOf("Safari")>-1&&-1===_o.indexOf("Chrome")&&(t.fullImageShadow=!0),_o.indexOf("Windows")>-1?(t.os="Windows",t.intWheelDeltaY=!0):_o.indexOf("Mac")>-1?t.os="Mac":_o.indexOf("Linux")>-1&&(t.os="Linux");const po=Z.get("LeaferTypeCreator"),go={list:{},register(t,e){fo[t]?po.repeat(t):fo[t]=e},run(t,e){const s=go.list[t];s?s(e):po.error("no",t)}},{list:fo}=go;go.register("user",(function(t){const{config:e}=t;e.move.dragOut=!1})),go.register("design",(function(t){const{MOVE:e}=nn,{ZOOM:s}=hn;t.__eventIds.push(t.on_(e,(e=>{Tr.moveWorld(t.moveLayer,e.moveX,e.moveY)})),t.on_(s,(e=>{const{scaleX:s}=t.zoomLayer.__,{min:i,max:r}=t.config.zoom;let{scale:n}=e;n*s<i?n=i/s:n*s>r&&(n=r/s),1!==n&&Tr.zoomOfWorld(t.zoomLayer,e,n)})))}));const yo={},mo={},vo={},wo={export(t,e,s){return function(t){xo||(xo=new _n);return new Promise((e=>{xo.add((()=>ft(this,void 0,void 0,(function*(){return yield t(e)})))),xo.running||xo.start()}))}((i=>new Promise((r=>{const{leafer:n}=t;n?n.waitViewLoaded((()=>ft(this,void 0,void 0,(function*(){let t,o,a,{canvas:h}=n,{unreal:l}=h;switch(l&&(h=h.getSameCanvas(),h.backgroundColor=n.config.fill,n.__render(h,{})),typeof s){case"object":s.quality&&(t=s.quality),s.blob&&(o=!0);break;case"number":t=s;break;case"boolean":o=s}a=e.includes(".")?yield h.saveAs(e,t):o?yield h.toBlob(e,t):h.toDataURL(e,t),i({data:a}),r(),l&&h.recycle()})))):(i({data:!1}),r())}))))}};let xo;const{copy:bo,toOffsetOutBounds:Bo}=H,Eo={},To={};function ko(e,s,i,r){const{bounds:n,shapeBounds:o}=r;if(t.fullImageShadow){if(bo(Eo,e.bounds),Eo.x+=s.x-o.x,Eo.y+=s.y-o.y,i){const{matrix:t}=r;Eo.x-=(n.x+(t?t.e:0)+n.width/2)*(i-1),Eo.y-=(n.y+(t?t.f:0)+n.height/2)*(i-1),Eo.width*=i,Eo.height*=i}e.copyWorld(r.canvas,e.bounds,Eo)}else i&&(bo(Eo,s),Eo.x-=s.width/2*(i-1),Eo.y-=s.height/2*(i-1),Eo.width*=i,Eo.height*=i),e.copyWorld(r.canvas,o,i?Eo:s)}const{toOffsetOutBounds:Co}=H,Ro={};var Lo=Object.freeze({__proto__:null,blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__world.a),s.copyWorldToInner(e,t.__world,t.__layout.renderBounds),s.filter="none"},innerShadow:function(t,e,s,i){let r,n;const{__world:o,__layout:a}=t,{innerShadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;Co(d,Ro),h.forEach(((t,i)=>{p.save(),p.setWorldShadow(Ro.offsetX+t.x*u,Ro.offsetY+t.y*_,t.blur*u),n=t.spread?1-2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ko(p,Ro,n,s),p.restore(),l?(p.copyWorld(p,d,o,"copy"),p.copyWorld(l,o,o,"source-out"),r=o):(p.copyWorld(s.canvas,c,d,"source-out"),r=d),p.fillWorld(r,t.color,"source-in"),e.copyWorldToInner(p,r,a.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()},shadow:function(t,e,s,i){let r,n;const{__world:o,__layout:a}=t,{shadow:h}=t.__,{worldCanvas:l,bounds:d,shapeBounds:c,scaleX:u,scaleY:_}=s,p=e.getSameCanvas(),g=h.length-1;Bo(d,To),h.forEach(((t,i)=>{p.setWorldShadow(To.offsetX+t.x*u,To.offsetY+t.y*_,t.blur*u,t.color),n=t.spread?1+2*t.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ko(p,To,n,s),r=d,t.box&&(p.restore(),p.save(),l&&(p.copyWorld(p,d,o,"copy"),r=o),l?p.copyWorld(l,o,o,"destination-out"):p.copyWorld(s.canvas,c,d,"destination-out")),e.copyWorldToInner(p,r,a.renderBounds,t.blendMode),g&&i<g&&p.clear()})),p.recycle()}});function Po(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)s=i[t],s.text?e.fillText(s.text,s.x,s.y):s.data&&s.data.forEach((t=>{e.fillText(t.char,t.x,s.y)})),r&&e.fillRect(s.x,s.y+r,s.width,n)}function Oo(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(s,t.__.strokeWidth,t.__),Ao(t,e);break;case"inside":So(t,e,s,"inside");break;case"outside":So(t,e,s,"outside")}}function So(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(s,2*r,t.__),o.font=n,Ao(t,o),o.blendMode="outside"===i?"destination-out":"destination-in",Po(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}function Do(t,e,s){const{strokeAlign:i}=t.__;switch(i){case"center":e.setStroke(void 0,t.__.strokeWidth,t.__),Mo(t,s,e);break;case"inside":So(t,e,s,"inside");break;case"outside":!function(t,e,s,i){const{strokeWidth:r,__font:n}=t.__,o=e.getSameCanvas(!0);o.setStroke(void 0,2*r,t.__),o.font=n,Mo(t,s,o),o.blendMode="outside"===i?"destination - out":"destination -in ",Po(t,o),o.blendMode="normal",e.copyWorldToInner(o,t.__world,t.__layout.renderBounds),o.recycle()}(t,e,s,"outside")}}function Mo(t,e,s){e.forEach((e=>{s.strokeStyle=e.style,e.blendMode?(s.saveBlendMode(e.blendMode),Ao(t,s),s.restoreBlendMode()):Ao(t,s)}))}function Ao(t,e){let s;const{rows:i,decorationY:r,decorationHeight:n}=t.__.__textDrawData;for(let t=0,o=i.length;t<o;t++)s=i[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)})),r&&e.strokeRect(s.x,s.y+r,s.width,n)}function Io(t,e){t.forEach((t=>{e.strokeStyle=t.style,t.blendMode?(e.saveBlendMode(t.blendMode),e.stroke(),e.restoreBlendMode()):e.stroke()}))}const{getSpread:Wo,getOuterOf:No,getByMove:Fo,getIntersectData:zo}=H;const Uo={string(t,e){if("string"==typeof t)return t;let s=void 0===t.a?1:t.a;e&&(s*=e);const i=t.r+","+t.g+","+t.b;return 1===s?"rgb("+i+")":"rgba("+i+","+s+")"}},{get:Ho,rotateOfOuter:Yo,translate:jo,scaleOfOuter:Xo,scale:Vo,rotate:Go}=f;function Ko(e,s,i,r){const{type:n,blendMode:o}=i;let a={type:n,style:"rgba(255,255,255,0)"};o&&(a.blendMode=o);const{imageManager:h}=e.leafer,l=h.get(i);if(l.ready){if(qo(e,s,l)){let e,{opacity:s,mode:n,offset:o,scale:h,rotation:d}=i,{width:c,height:u}=l;const _=r.width===c&&r.height===u;switch(n){case"strench":_||(c=r.width,u=r.height),(r.x||r.y)&&(e=Ho(),jo(e,r.x,r.y));break;case"clip":(o||h||d)&&(e=function(t,e,s,i){const r=Ho();jo(r,t.x,t.y),e&&jo(r,e.x,e.y);s&&("number"==typeof s?Vo(r,s):Vo(r,s.x,s.y));i&&Go(r,i);return r}(r,o,h,d));break;case"repeat":(!_||h||d)&&(e=function(t,e,s,i,r){const n=Ho();if(r)switch(Go(n,r),r){case 90:jo(n,s,0);break;case 180:jo(n,e,s);break;case 270:jo(n,0,e)}jo(n,t.x,t.y),i&&Xo(n,t,i);return n}(r,c,u,h,d));break;default:_&&!d||(e=function(t,e,s,i,r){const n=Ho(),o=r&&180!==r,a=e.width/(o?i:s),h=e.height/(o?s:i),l="fit"===t?Math.min(a,h):Math.max(a,h),d=e.x+(e.width-s*l)/2,c=e.y+(e.height-i*l)/2;jo(n,d,c),Vo(n,l),r&&Yo(n,{x:e.x+e.width/2,y:e.y+e.height/2},r);return n}(n,r,c,u,d))}!function(e,s,i,r){let n=t.canvas.createPattern(s,r?"repeat":"no-repeat");i&&(n.setTransform?n.setTransform(i):e.transform=i);e.style=n}(a,l.getCanvas(c,u,s),e,"repeat"===n)}}else h.load(l,(()=>{e.leafer&&(qo(e,s,l)&&e.forceUpdate("width"),e.hasEvent(ir.LOADED)&&e.emitEvent(new ir(ir.LOADED,e,l,s,i)))}),(t=>{e.hasEvent(ir.ERROR)&&e.emitEvent(new ir(ir.ERROR,e,l,s,i,t))}));return a}function qo(t,e,s){const{__:i}=t;return!("fill"===e&&i&&!(i.__naturalWidth&&i.__naturalHeight||(i.__naturalWidth=s.width,i.__naturalHeight=s.height,i.__getInput("width")&&i.__getInput("height"))))||(t.forceUpdate("width"),!1)}const Zo={x:.5,y:0},Qo={x:.5,y:1};function $o(t,e,s){let i;for(let r=0,n=e.length;r<n;r++)i=e[r],t.addColorStop(i.offset,Uo.string(i.color,s))}const{set:Jo,getAngle:ta,getDistance:ea}=T,{get:sa,rotateOfOuter:ia,scaleOfOuter:ra}=f,na={x:.5,y:.5},oa={x:.5,y:1},aa={},ha={};const{set:la,getAngle:da,getDistance:ca}=T,{get:ua,rotateOfOuter:_a,scaleOfOuter:pa}=f,ga={x:.5,y:.5},fa={x:.5,y:1},ya={},ma={};function va(t,e){let s,i=t.__.__input[e];const r=[];i instanceof Array||(i=[i]);for(let n=0,o=i.length;n<o;n++)s=wa(t,i[n],e),s&&r.push(s);t.__["_"+e]=r.length?r:void 0}function wa(e,s,i){if("object"!=typeof s||!1===s.visible||0===s.opacity)return;const{boxBounds:r}=e.__layout;switch(s.type){case"solid":let{type:n,blendMode:o,color:a,opacity:h}=s;return{type:n,blendMode:o,style:Uo.string(a,h)};case"image":return Ko(e,i,s,r);case"linear":return function(e,s){let{from:i,to:r,type:n,blendMode:o,opacity:a}=e;i||(i=Zo),r||(r=Qo);const h=t.canvas.createLinearGradient(s.x+i.x*s.width,s.y+i.y*s.height,s.x+r.x*s.width,s.y+r.y*s.height);$o(h,e.stops,a);const l={type:n,style:h};return o&&(l.blendMode=o),l}(s,r);case"radial":return function(e,s){let{from:i,to:r,type:n,opacity:o,blendMode:a,stretch:h}=e;i||(i=na),r||(r=oa);const{x:l,y:d,width:c,height:u}=s;let _;Jo(aa,l+i.x*c,d+i.y*u),Jo(ha,l+r.x*c,d+r.y*u),(c!==u||h)&&(_=sa(),ra(_,aa,c/u*(h||1),1),ia(_,aa,ta(aa,ha)+90));const p=t.canvas.createRadialGradient(aa.x,aa.y,0,aa.x,aa.y,ea(aa,ha));$o(p,e.stops,o);const g={type:n,style:p,transform:_};return a&&(g.blendMode=a),g}(s,r);case"angular":return function(e,s){let{from:i,to:r,type:n,opacity:o,blendMode:a,stretch:h}=e;i||(i=ga),r||(r=fa);const{x:l,y:d,width:c,height:u}=s;la(ya,l+i.x*c,d+i.y*u),la(ma,l+r.x*c,d+r.y*u);const _=ua(),p=da(ya,ma);t.conicGradientRotate90?(pa(_,ya,c/u*(h||1),1),_a(_,ya,p+90)):(pa(_,ya,1,c/u*(h||1)),_a(_,ya,p));const g=t.conicGradientSupport?t.canvas.createConicGradient(0,ya.x,ya.y):t.canvas.createRadialGradient(ya.x,ya.y,0,ya.x,ya.y,ca(ya,ma));$o(g,e.stops,o);const f={type:n,style:g,transform:_};return a&&(f.blendMode=a),f}(s,r);default:return s.r?{type:"solid",style:Uo.string(s)}:void 0}}var xa=Object.freeze({__proto__:null,computeFill:function(t){va(t,"fill")},computeStroke:function(t){va(t,"stroke")},drawText:Po,drawTextStroke:Ao,fill:function(t,e,s){e.fillStyle=s,t.__.__font?Po(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()},fills:function(t,e,s){let i;const{windingRule:r,__font:n}=t.__;for(let o=0,a=s.length;o<a;o++)if(i=s[o],e.fillStyle=i.style,i.transform){e.save();const{a:s,b:o,c:a,d:h,e:l,f:d}=i.transform;e.transform(s,o,a,h,l,d),i.blendMode&&(e.blendMode=i.blendMode),n?Po(t,e):r?e.fill(r):e.fill(),e.restore()}else i.blendMode?(e.saveBlendMode(i.blendMode),n?Po(t,e):r?e.fill(r):e.fill(),e.restoreBlendMode()):n?Po(t,e):r?e.fill(r):e.fill()},shape:function(t,e,s){const i=e.getSameCanvas();let r,n,o,a;const{__world:h}=t;let{a:l,d:d}=h;if(e.bounds.includes(h,s.matrix))s.matrix?(l*=s.matrix.a,d*=s.matrix.d,r=o=No(h,s.matrix)):r=o=h,a=i;else{const{renderShapeSpread:i}=t.__layout,c=zo(i?Wo(e.bounds,i*l):e.bounds,h,s.matrix);n=e.bounds.getFitMatrix(c),n.a<1&&(a=e.getSameCanvas(),t.__renderShape(a,s),l*=n.a,d*=n.d),o=No(h,n),r=Fo(o,-n.e,-n.f),s.matrix&&n.multiply(s.matrix),s=Object.assign(Object.assign({},s),{matrix:n})}return t.__renderShape(i,s),{canvas:i,matrix:n,bounds:r,worldCanvas:a,shapeBounds:o,scaleX:l,scaleY:d}},stroke:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(r)if(o)Oo(t,e,s);else switch(n){case"center":e.setStroke(s,r,i),e.stroke();break;case"inside":e.save(),e.setStroke(s,2*r,i),e.clip(i.windingRule),e.stroke(),e.restore();break;case"outside":const n=e.getSameCanvas(!0);n.setStroke(s,2*r,t.__),t.__drawRenderPath(n),n.stroke(),n.clip(i.windingRule),n.clearWorld(t.__layout.renderBounds),e.copyWorldToInner(n,t.__world,t.__layout.renderBounds),n.recycle()}},strokeText:Oo,strokes:function(t,e,s){const i=t.__,{strokeWidth:r,strokeAlign:n,__font:o}=i;if(r)if(o)Do(t,e,s);else switch(n){case"center":e.setStroke(void 0,r,i),Io(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*r,i),e.clip(i.windingRule),Io(s,e),e.restore();break;case"outside":const{renderBounds:n}=t.__layout,o=e.getSameCanvas(!0);t.__drawRenderPath(o),o.setStroke(void 0,2*r,t.__),Io(s,o),o.clip(i.windingRule),o.clearWorld(n),e.copyWorldToInner(o,t.__world,n),o.recycle()}},strokesText:Do});Object.assign(yo,Lo),Object.assign(mo,xa);class ba extends _t{setFill(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("fill",t),this.__leaf.__layout.boxChanged?this._fill=t:mo.computeFill(this.__leaf),this.__isFills=!0):(this._fill=t,this.__input&&this.__removeInput("fill"),this.__isFills&&(this.__isFills=!1)),this.__naturalWidth&&(this.__naturalWidth=this.__naturalHeight=void 0)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&(this.__setInput("stroke",t),this.__leaf.__layout.boxChanged?this._stroke=t:mo.computeStroke(this.__leaf),this.__isStrokes=!0):(this._stroke=t,this.__input&&this.__removeInput("stroke"),this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this.__setInput("shadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._shadow=t.length?t:null):this._shadow=t?!1===t.visible?null:[t]:null}setInnerShadow(t){this.__setInput("innerShadow",t),t instanceof Array?(t.some((t=>!1===t.visible))&&(t=t.filter((t=>!1!==t.visible))),this._innerShadow=t.length?t:null):this._innerShadow=t?!1===t.visible?null:[t]:null}}const Ba={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value/100*e:t.value:t};class Ea extends ba{}class Ta extends Ea{get __boxStroke(){return!0}}class ka extends ba{get __boxStroke(){return!0}}const{parse:Ca}=ze;const Ra={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class La extends ka{}function Pa(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})}}function Oa(t){return(e,s)=>{wi(e,s,t,{set(t){this.__setAttr(s,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})}}const Sa={__updateStrokeSpread(){let t=0,e=0;const{stroke:s,hitStroke:i,strokeAlign:r,strokeWidth:o}=this.__;if((s||"all"===i)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!this.__.__boxStroke)){const{miterLimit:e,strokeCap:s}=this.__,i="Line"!==this.__tag?1/Math.sin(e*n/2)*Math.sqrt(o)-t:0,r="none"===s?0:o;t+=Math.max(i,r)}return this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let n=t=Math.ceil(t);return s&&s.forEach((t=>{n=Math.max(n,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),r&&(n=Math.max(n,r)),this.__layout.renderShapeSpread=n,t}},Da={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this));const t=this.__hitCanvas;this.__drawHitPath(t),t.setStrokeOptions(this.__)},__hit(e){const{__hitCanvas:s}=this;"miniapp"===t.name&&this.__drawHitPath(s);const{fill:i,hitFill:r,windingRule:n}=this.__,o=i&&"path"===r||"all"===r,a=s.hitFill(e,n);if(o&&a)return!0;const{stroke:h,hitStroke:l,strokeWidth:d,strokeAlign:c}=this.__,u=h&&"path"===l||"all"===l,_=2*e.radiusX;let p=_;if(u)switch(c){case"inside":if(p+=2*d,!o&&a&&s.hitStroke(e,p))return!0;p=_;break;case"center":p+=d;break;case"outside":if(p+=2*d,!o){if(!a&&s.hitStroke(e,p))return!0;p=_}}return!!p&&s.hitStroke(e,p)}},Ma={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r}=this.__;t.__useEffect=!!(e||s||i||r)}t.__checkSingle();t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?t.__complex=!0:t.__complex&&(t.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;this.__drawRenderPath(t),s&&mo.fill(this,t,s),r&&this.__drawAfterFill(t,e),i&&mo.stroke(this,t,i)},__draw(t,e){if(this.__.__complex){const{fill:s,stroke:i,__drawAfterFill:r}=this.__;if(this.__drawRenderPath(t),this.__.__useEffect){const n=mo.shape(this,t,e),{shadow:o,innerShadow:a}=this.__;o&&yo.shadow(this,t,n,e),s&&(this.__.__isFills?mo.fills(this,t,s):mo.fill(this,t,s)),r&&this.__drawAfterFill(t,e),a&&yo.innerShadow(this,t,n,e),i&&(this.__.__isStrokes?mo.strokes(this,t,i):mo.stroke(this,t,i)),n.worldCanvas&&n.worldCanvas.recycle(),n.canvas.recycle()}else s&&(this.__.__isFills?mo.fills(this,t,s):mo.fill(this,t,s)),r&&this.__drawAfterFill(t,e),i&&(this.__.__isStrokes?mo.strokes(this,t,i):mo.stroke(this,t,i))}else this.__drawFast(t,e)},__renderShape(t,e){if(!this.__worldOpacity)return;t.setWorld(this.__world,e.matrix);const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&mo.fill(this,t,"#000000"),i&&mo.stroke(this,t,"#000000")}},Aa={__drawFast(t,e){const{width:s,height:i,fill:r,stroke:n,__drawAfterFill:o}=this.__;if(r&&(t.fillStyle=r,t.fillRect(0,0,s,i)),o&&this.__drawAfterFill(t,e),n){const{strokeAlign:e,strokeWidth:r}=this.__;t.setStroke(n,r,this.__);const o=r/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(o,o,s-r,i-r);break;case"outside":t.strokeRect(-o,-o,s+r,i+r)}}}};let Ia=class extends Wr{constructor(t){super(t)}set(t){Object.assign(this,t)}get(){return this.__.__getInputData()}getPath(t){const e=this.__.path;return e?t?ze.toCanvasData(e,!0):e:[]}getPathString(t){return ze.stringify(this.getPath(t))}__onUpdateSize(){if(this.__.__input){const{fill:t,stroke:e}=this.__.__input;t&&mo.computeFill(this),e&&mo.computeStroke(this)}}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?pi.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){}export(t,e){return wo.export(this,t,e)}static one(t,e,s,i,r){return st.get(t.tag||this.prototype.__tag,t,e,s,i,r)}};gt([Ii(ba)],Ia.prototype,"__",void 0),gt([xi("")],Ia.prototype,"id",void 0),gt([xi("")],Ia.prototype,"name",void 0),gt([xi("")],Ia.prototype,"className",void 0),gt([Pi("pass-through")],Ia.prototype,"blendMode",void 0),gt([Oi(1)],Ia.prototype,"opacity",void 0),gt([Oi(!0)],Ia.prototype,"visible",void 0),gt([Di(!1)],Ia.prototype,"isMask",void 0),gt([Mi(!1)],Ia.prototype,"isEraser",void 0),gt([Si(0)],Ia.prototype,"zIndex",void 0),gt([xi()],Ia.prototype,"locked",void 0),gt([bi(0)],Ia.prototype,"x",void 0),gt([bi(0)],Ia.prototype,"y",void 0),gt([Ti(100)],Ia.prototype,"width",void 0),gt([Ti(100)],Ia.prototype,"height",void 0),gt([Bi(1)],Ia.prototype,"scaleX",void 0),gt([Bi(1)],Ia.prototype,"scaleY",void 0),gt([Ei(0)],Ia.prototype,"rotation",void 0),gt([Ei(0)],Ia.prototype,"skewX",void 0),gt([Ei(0)],Ia.prototype,"skewY",void 0),gt([xi(!1)],Ia.prototype,"draggable",void 0),gt([Ai(!0)],Ia.prototype,"hittable",void 0),gt([Ai("path")],Ia.prototype,"hitFill",void 0),gt([Ri("path")],Ia.prototype,"hitStroke",void 0),gt([Ai(!0)],Ia.prototype,"hitChildren",void 0),gt([Ai(!0)],Ia.prototype,"hitSelf",void 0),gt([Pi()],Ia.prototype,"fill",void 0),gt([Ri()],Ia.prototype,"stroke",void 0),gt([Ri("inside")],Ia.prototype,"strokeAlign",void 0),gt([Ri(1)],Ia.prototype,"strokeWidth",void 0),gt([Ri("none")],Ia.prototype,"strokeCap",void 0),gt([Ri("miter")],Ia.prototype,"strokeJoin",void 0),gt([Ri()],Ia.prototype,"dashPattern",void 0),gt([Ri()],Ia.prototype,"dashOffset",void 0),gt([Ri(10)],Ia.prototype,"miterLimit",void 0),gt([ki()],Ia.prototype,"cornerRadius",void 0),gt([ki()],Ia.prototype,"cornerSmoothing",void 0),gt([Pa()],Ia.prototype,"shadow",void 0),gt([Pa()],Ia.prototype,"innerShadow",void 0),gt([Pa()],Ia.prototype,"blur",void 0),gt([Pa()],Ia.prototype,"backgroundBlur",void 0),gt([Pa()],Ia.prototype,"grayscale",void 0),gt([Yi(As.drawPathByData)],Ia.prototype,"__drawPathByData",null),Ia=gt([Vi(Sa),Vi(Da),Vi(Ma),ji()],Ia);let Wa=class extends Ia{get __tag(){return"Group"}set mask(t){this.__hasMask&&this.__removeMask(),t&&(t.isMask=!0,this.addAt(t,0))}get mask(){return this.children.find((t=>t.isMask))}constructor(t){super(t),this.isBranch=!0,this.children=[]}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){}remove(t){}removeAll(){}};gt([Ii(Ea)],Wa.prototype,"__",void 0),Wa=gt([Vi(Vr),Gi()],Wa);let Na=class extends Ia{get __tag(){return"Rect"}constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:r}=this.__;r?t.roundRect(0,0,s,i,r):t.rect(0,0,s,i)}};gt([Ii(ka)],Na.prototype,"__",void 0),Na=gt([Vi(Aa),Gi()],Na);const Fa=Na.prototype,za=Wa.prototype,Ua={},{copy:Ha,add:Ya}=H;let ja=class extends Wa{get __tag(){return"Box"}constructor(t){super(t),this.isBranchLeaf=!0,this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){let t=this.__updateRectRenderSpread()||super.__updateRenderSpread();return this.__.__drawAfterFill="hide"===this.__.overflow,t||(t=this.__.__drawAfterFill?0:1),t}__updateBoxBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.__drawAfterFill){const{renderBounds:t}=this.__layout;Ha(Ua,t),super.__updateRenderBounds(),Ya(t,Ua)}}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__drawPathByData(t,e){}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.__renderGroup(t,e))}__drawAfterFill(t,e){t.save(),t.clip(),this.__renderGroup(t,e),t.restore(),this.__.stroke&&this.__drawRenderPath(t)}};gt([Ii(Ta)],ja.prototype,"__",void 0),gt([Li("show")],ja.prototype,"overflow",void 0),gt([Yi(Fa.__updateStrokeSpread)],ja.prototype,"__updateStrokeSpread",null),gt([Yi(Fa.__updateRenderSpread)],ja.prototype,"__updateRectRenderSpread",null),gt([Yi(Fa.__updateBoxBounds)],ja.prototype,"__updateBoxBounds",null),gt([Yi(Fa.__updateStrokeBounds)],ja.prototype,"__updateStrokeBounds",null),gt([Yi(Fa.__updateRenderBounds)],ja.prototype,"__updateRectRenderBounds",null),gt([Yi(Fa.__updateChange)],ja.prototype,"__updateRectChange",null),gt([Yi(Fa.__drawPathByData)],ja.prototype,"__drawPathByData",null),gt([Yi(Fa.__render)],ja.prototype,"__renderRect",null),gt([Yi(za.__render)],ja.prototype,"__renderGroup",null),ja=gt([ji(),Gi()],ja);let Xa=class extends ja{get __tag(){return"Frame"}constructor(t){super(t),this.__.fill||(this.__.fill="#FFFFFF")}};gt([Ii(class extends Ta{})],Xa.prototype,"__",void 0),gt([Li("hide")],Xa.prototype,"overflow",void 0),Xa=gt([Gi()],Xa);const{moveTo:Va,closePath:Ga,ellipse:Ka}=rs;let qa=class extends Ia{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:r}=this.__,n=t/2,o=e/2,a=this.__.path=[];s?i||r?(s<1&&Ka(a,n,o,n*s,o*s,0,i,r,!1),Ka(a,n,o,n,o,0,r,i,!0),s<1&&Ga(a)):(s<1&&(Ka(a,n,o,n*s,o*s),Va(a,t,o)),Ka(a,n,o,n,o,0,0,360,!0)):i||r?(Va(a,n,o),Ka(a,n,o,n,o,0,i,r,!1),Ga(a)):Ka(a,n,o,n,o)}};gt([Ii(class extends ba{get __boxStroke(){return!0}})],qa.prototype,"__",void 0),gt([ki(0)],qa.prototype,"innerRadius",void 0),gt([ki(0)],qa.prototype,"startAngle",void 0),gt([ki(0)],qa.prototype,"endAngle",void 0),qa=gt([Gi()],qa);const{sin:Za,cos:Qa,PI:$a}=Math,{moveTo:Ja,lineTo:th,closePath:eh}=rs;let sh=class extends Ia{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,r=e/2,n=this.__.path=[];Ja(n,i,0);for(let t=1;t<s;t++)th(n,i+i*Za(2*t*$a/s),r-r*Qa(2*t*$a/s));eh(n)}};gt([Ii(class extends ba{})],sh.prototype,"__",void 0),gt([ki(3)],sh.prototype,"sides",void 0),sh=gt([Gi()],sh);const{sin:ih,cos:rh,PI:nh}=Math,{moveTo:oh,lineTo:ah,closePath:hh}=rs;let lh=class extends Ia{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,r=t/2,n=e/2,o=this.__.path=[];oh(o,r,0);for(let t=1;t<2*s;t++)ah(o,r+(t%2==0?r:r*i)*ih(t*nh/s),n-(t%2==0?n:n*i)*rh(t*nh/s));hh(o)}};gt([Ii(class extends ba{})],lh.prototype,"__",void 0),gt([ki(5)],lh.prototype,"points",void 0),gt([ki(.382)],lh.prototype,"innerRadius",void 0),lh=gt([Gi()],lh);const{moveTo:dh,lineTo:ch}=rs,{rotate:uh,getAngle:_h,getDistance:ph,defaultPoint:gh}=T,{setPoint:fh,addPoint:yh,toBounds:mh}=L,vh={};let wh=class extends Ia{get __tag(){return"Line"}get toPoint(){if(this.__toPoint&&!this.__layout.boxChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&uh(s,e),this.__toPoint=s,s}set toPoint(t){this.width=ph(gh,t),this.rotation=_h(gh,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];dh(t,0,0);const e=this.toPoint;ch(t,e.x,e.y)}__updateBoxBounds(){fh(vh,0,0),yh(vh,this.__toPoint.x,this.__toPoint.y),mh(vh,this.__layout.boxBounds)}};gt([Ii(class extends ba{})],wh.prototype,"__",void 0),gt([Ti()],wh.prototype,"rotation",void 0),gt([Ci("center")],wh.prototype,"strokeAlign",void 0),wh=gt([Gi()],wh);let xh=class extends Na{get __tag(){return"Image"}get ready(){return!!this.image&&this.image.ready}constructor(t){super(t)}__updateBoxBounds(){let t;const{url:e}=this,s=this.fill;s?s.url!==e&&(t=!0):e&&(t=!0),t&&(this.image&&(this.image=null),this.fill={type:"image",mode:"strench",url:e},this.once(ir.LOADED,(t=>this.image=t.image))),super.__updateBoxBounds()}destroy(){this.image=null,super.destroy()}};gt([Ii(La)],xh.prototype,"__",void 0),gt([Ti("")],xh.prototype,"url",void 0),xh=gt([Gi()],xh);let bh=class extends Na{get __tag(){return"Canvas"}constructor(t){super(t),this.canvas=e.canvas(this.__),this.context=this.canvas.context,this.__.__drawAfterFill=!0}draw(t,e,s,i){t.__layout.checkUpdate();const r=new R(t.__world);r.invert();const n=new R;e&&n.translate(e.x,e.y),s&&("number"==typeof s?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.preMultiply(n),t.__render(this.canvas,{matrix:r}),this.paint()}paint(){this.forceUpdate("fill")}__drawAfterFill(t,e){const s=this.canvas.view,{width:i,height:r}=this;this.__.cornerRadius?(t.save(),t.clip(),t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r),t.restore()):t.drawImage(this.canvas.view,0,0,s.width,s.height,0,0,i,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e}=this.__;t.smooth!==e&&(t.smooth=e),t.resize(this.__)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null,this.context=null),super.destroy()}};gt([Ii(La)],bh.prototype,"__",void 0),gt([Oa(100)],bh.prototype,"width",void 0),gt([Oa(100)],bh.prototype,"height",void 0),gt([Oa(t.devicePixelRatio)],bh.prototype,"pixelRatio",void 0),gt([Oa(!0)],bh.prototype,"smooth",void 0),gt([Ai("all")],bh.prototype,"hitFill",void 0),bh=gt([Gi()],bh);const Bh=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Eh=Bh+"_#~&*+\\=|≮≯≈≠=…",Th=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 kh(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Ch=kh("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Rh=kh("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Lh=kh(Bh),Ph=kh(Eh),Oh=kh("- —/~|┆·");var Sh;!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"}(Sh||(Sh={}));const{Letter:Dh,Single:Mh,Before:Ah,After:Ih,Symbol:Wh,Break:Nh}=Sh;function Fh(t){return Ch[t]?Dh:Oh[t]?Nh:Rh[t]?Ah:Lh[t]?Ih:Ph[t]?Wh:Th.test(t)?Mh:Dh}const zh={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function Uh(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:Hh}=zh,{Letter:Yh,Single:jh,Before:Xh,After:Vh,Symbol:Gh,Break:Kh}=Sh;let qh,Zh,Qh,$h,Jh,tl,el,sl,il,rl,nl,ol,al,hl,ll=[];function dl(t,e){qh.data.push({char:t,width:e}),Qh+=e}function cl(){$h+=Qh,qh.width=Qh,Zh.words.push(qh),qh={data:[]},Qh=0}function ul(){ol&&(al.paraNumber++,Zh.paraStart=!0,ol=!1),Zh.width=$h,hl.width&&Hh(Zh),ll.push(Zh),Zh={words:[]},$h=0}const _l=0,pl=1,gl=2;const fl={getDrawData(e,s){"string"!=typeof e&&(e=String(e));let i=0,n=0,{width:o,height:a,padding:h}=s;const{textDecoration:l,textOverflow:d,__font:c}=s;if(o||(o=0),h){const[t,e,s,l]=r.fourNumber(h);o&&(i=l,o-=e+l),a&&(n=t,a-=t+s)}const u={bounds:{x:i,y:n,width:o,height:a},rows:[],paraNumber:0,font:t.canvas.font=c};return function(e,s,i){al=e,ll=e.rows,hl=e.bounds;const{__letterSpacing:r,paraIndent:n,textCase:o}=i,{canvas:a}=t,{width:h,height:l}=hl;if(h||l||r||"none"!==o){ol=!0,il=null,Qh=$h=0,qh={data:[]},Zh={words:[]};for(let t=0,e=s.length;t<e;t++)tl=s[t],"\n"===tl?(Qh&&cl(),Zh.paraEnd=!0,ul(),ol=!0):(sl=Fh(tl),sl===Yh&&"none"!==o&&(tl=Uh(tl,o,!Qh)),el=a.measureText(tl).width,r&&(el+=r),rl=sl===jh&&(il===jh||il===Yh)||il===jh&&sl!==Vh,nl=!(sl!==Xh&&sl!==jh||il!==Gh&&il!==Vh),Jh=ol&&n?h-n:h,h&&$h+Qh+el>Jh&&(nl||(nl=sl===Yh&&il==Vh),rl||nl||sl===Kh||sl===Xh||sl===jh||Qh+el>Jh?(Qh&&cl(),ul()):ul())," "===tl&&!0!==ol&&$h+Qh===0||(sl===Kh?(" "===tl&&Qh&&cl(),dl(tl,el),cl()):rl||nl?(Qh&&cl(),dl(tl,el)):dl(tl,el)),il=sl);Qh&&cl(),$h&&ul(),ll.length>0&&(ll[ll.length-1].paraEnd=!0)}else s.split("\n").forEach((t=>{al.paraNumber++,ll.push({x:n||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(u,e,s),function(t,e){const{rows:s,bounds:i}=t,{__lineHeight:r,__baseLine:n,textAlign:o,verticalAlign:a,paraSpacing:h,textOverflow:l}=e;let d,{x:c,y:u,width:_,height:p}=i,g=r*s.length+(h?h*(t.paraNumber-1):0),f=n;if(p){if("show"!==l&&g>p)g=Math.max(p,r),t.overflow=s.length;else switch(a){case"middle":u+=(p-g)/2;break;case"bottom":u+=p-g}f+=u}for(let e=0,n=s.length;e<n;e++){switch(d=s[e],d.x=c,o){case"center":d.x+=(_-d.width)/2;break;case"right":d.x+=_-d.width}d.paraStart&&h&&e>0&&(f+=h),d.y=f,f+=r,t.overflow>e&&f>g&&(d.isOverflow=!0,t.overflow=e+1),d.width>i.width&&(i.width=d.width)}i.y=u,i.height=g}(u,s),function(t,e,s,i){const{rows:r}=t,{textAlign:n,paraIndent:o,letterSpacing:a}=e;let h,l,d,c,u;r.forEach((t=>{t.words&&(d=o&&t.paraStart?o:0,l=s&&"justify"===n&&t.words.length>1?(s-t.width-d)/(t.words.length-1):0,c=a||t.isOverflow?_l:l>.01?pl:gl,c===gl?(t.text="",t.x+=d,t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))):(t.x+=d,h=t.x,t.data=[],t.words.forEach((e=>{c===pl?(u={char:"",x:h},h=function(t,e,s){return t.forEach((t=>{s.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,s){return t.forEach((t=>{" "!==t.char&&(t.x=e,s.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&l&&(h+=l,t.width+=l)}))),t.words=null)}))}(u,s,o),u.overflow&&function(e,s){const{rows:i,overflow:r}=e;if(i.splice(r),"hide"!==s){"ellipsis"===s&&(s="...");const n=t.canvas.measureText(s).width,o=i[r-1];let a,h,l=o.data.length-1;const{x:d,width:c}=e.bounds,u=d+c-n;for(let t=l;t>-1&&(a=o.data[t],h=a.x+a.width,!(t===l&&h<u));t--){if(h<u&&" "!==a.char){o.data.splice(t+1),o.width-=a.width;break}o.width-=a.width}o.width+=n,o.data.push({char:s,x:h})}}(u,d),"none"!==l&&function(t,e){const{fontSize:s}=e;switch(t.decorationHeight=s/11,e.textDecoration){case"under":t.decorationY=.15*s;break;case"delete":t.decorationY=.35*-s}}(u,s),u}},{copyAndSpread:yl,includes:ml,spread:vl}=H;let wl=class extends Ia{get __tag(){return"Text"}get textDrawData(){return this.__layout.checkUpdate(),this.__.__textDrawData}constructor(t){super(t)}__drawHitPath(t){const{__lineHeight:e,__baseLine:s,__textDrawData:i}=this.__;t.beginPath(),i.rows.forEach((i=>t.rect(i.x,i.y-s,i.width,e)))}__drawPathByData(t,e){const{x:s,y:i,width:r,height:n}=this.__layout.boxBounds;t.rect(s,i,r,n)}__drawRenderPath(t){t.font=this.__.__font}__updateTextDrawData(){const t=this.__;t.__textDrawData=fl.getDrawData(t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{width:s,height:i,lineHeight:r,letterSpacing:n,fontFamily:o,fontSize:a,fontWeight:h,italic:l,textCase:d}=t;t.__lineHeight=Ba.number(r,a),t.__letterSpacing=Ba.number(n,a),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*a)/2,t.__font=`${l?"italic ":""}${"small-caps"===d?"small-caps ":""}${"normal"!==h?h+" ":""}${a}px ${o}`,this.__updateTextDrawData();const{bounds:c}=t.__textDrawData,u=e.boxBounds;t.__lineHeight<a&&vl(c,a/2),s&&i?super.__updateBoxBounds():(u.x=s?0:c.x,u.y=i?0:c.y,u.width=s||c.width,u.height=i||c.height);const _=ml(u,c)?u:c;_!==e.contentBounds&&(e.contentBounds=_,e.renderChanged=!0)}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.__layout.boxBounds===this.__layout.contentBounds?0:1),t}__updateRenderBounds(){yl(this.__layout.renderBounds,this.__layout.contentBounds,this.__layout.renderSpread)}};gt([Ii(class extends ba{setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),this._fontWeight=Ra[t]||400):(this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t)}})],wl.prototype,"__",void 0),gt([Ti(0)],wl.prototype,"width",void 0),gt([Ti(0)],wl.prototype,"height",void 0),gt([Ti(0)],wl.prototype,"padding",void 0),gt([Ci("outside")],wl.prototype,"strokeAlign",void 0),gt([Ti("")],wl.prototype,"text",void 0),gt([Ti("L")],wl.prototype,"fontFamily",void 0),gt([Ti(12)],wl.prototype,"fontSize",void 0),gt([Ti("normal")],wl.prototype,"fontWeight",void 0),gt([Ti(!1)],wl.prototype,"italic",void 0),gt([Ti("none")],wl.prototype,"textCase",void 0),gt([Ti("none")],wl.prototype,"textDecoration",void 0),gt([Ti(0)],wl.prototype,"letterSpacing",void 0),gt([Ti({type:"percent",value:150})],wl.prototype,"lineHeight",void 0),gt([Ti(0)],wl.prototype,"paraIndent",void 0),gt([Ti(0)],wl.prototype,"paraSpacing",void 0),gt([Ti("left")],wl.prototype,"textAlign",void 0),gt([Ti("top")],wl.prototype,"verticalAlign",void 0),gt([Ti("show")],wl.prototype,"textOverflow",void 0),wl=gt([Gi()],wl);const{toBounds:xl}=_i;let bl=class extends Ia{get __tag(){return"Path"}constructor(t){super(t)}__updateBoxBounds(){xl(this.__.path,this.__layout.boxBounds)}};gt([Ii(class extends ba{setPath(t){"string"==typeof t?(this.__setInput("path",t),this._path=Ca(t)):(this.__input&&this.__removeInput("path"),this._path=t)}})],bl.prototype,"__",void 0),gt([ki()],bl.prototype,"path",void 0),gt([ki()],bl.prototype,"windingRule",void 0),gt([Ci("center")],bl.prototype,"strokeAlign",void 0),bl=gt([Gi()],bl);let Bl=class extends Wa{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new bl(t);return this.pathStyle=t,this.path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this.path.length=0,this.paint(),this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,n){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,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}moveToEllipse(t,e,s,i,r,n,o,a){return this}moveToArc(t,e,s,i,r,n){return this}paint(){this.pathElement.forceUpdate("path")}};gt([Ii(class extends Ea{})],Bl.prototype,"__",void 0),Bl=gt([Vi(ws,["beginPath"]),Gi()],Bl);const El=Z.get("Leafer");let Tl=class extends Wa{get __tag(){return"Leafer"}get isApp(){return!1}get viewLoaded(){return this.viewReady&&!this.watcher.changed&&this.imageManager.tasker.isComplete}constructor(t,e){super(e),this.zoomLayer=this,this.moveLayer=this,this.config={type:"design",start:!0,hittable:!0,smooth:!0,zoom:{min:.02,max:256},move:{dragOut:!0,autoDistance:2}},this.__eventIds=[],this.__controllers=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t)}init(t,s){if(this.canvas)return;let i;this.__setLeafer(this),t&&ct.assign(this.config,t);const{config:r}=this;go.run(r.type,this),this.canvas=e.canvas(r),this.__controllers.push(this.renderer=e.renderer(this,this.canvas,r),this.watcher=e.watcher(this,r),this.layouter=e.layouter(this,r)),this.isApp&&this.__setApp(),this.__checkAutoLayout(r),this.view=this.canvas.view,s?(this.__bindApp(s),i=s.running):(this.selector=e.selector(this),this.__controllers.unshift(this.interaction=e.interaction(this,this.canvas,this.selector,r)),this.canvasManager=new at,this.hitCanvasManager=new dt,this.imageManager=new pn(this,r),i=r.start),this.hittable=r.hittable,this.fill=r.fill,this.canvasManager.add(this.canvas),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),fn.onLeafer(this)}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.ready?this.emitLeafer(dr.RESTART):this.emitLeafer(dr.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render(),this.running=!0)}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(dr.STOP))}resize(t){const e=ct.copyAttrs({},t,Tt);Object.keys(e).forEach((t=>this[t]=e[t]))}forceLayout(){this.__layout.checkUpdate(!0)}forceFullRender(){this.renderer.addBlock(this.canvas.bounds),this.viewReady&&this.renderer.update()}__doResize(t){if(!this.canvas||this.canvas.isSameSize(t))return;const e=ct.copyAttrs({},this.canvas,Tt);this.canvas.resize(t),this.__onResize(new rr(t,e))}__onResize(t){this.emitEvent(t),ct.copyAttrs(this.__,t,Tt),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,this.imageManager=t.imageManager}__setLeafer(t){this.leafer=t,this.isLeafer=!!t,this.__level=1}setZoomLayer(t,e){this.zoomLayer=t,this.moveLayer=e||t}waitViewLoaded(e){let s;const i=()=>{this.viewLoaded&&(s&&this.off_(s),t.requestRender(e))};this.running||this.start(),i(),this.viewLoaded||(s=this.on_(lr.AFTER,i))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new G(t),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){this.canvas&&(Tt.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t&&(this.canvas.hittable=e)),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Tt.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=ct.copyAttrs({},this.canvas,Tt);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.forceFullRender()}__onReady(){this.ready||(this.ready=!0,this.emitLeafer(dr.BEFORE_READY),this.emitLeafer(dr.READY),this.emitLeafer(dr.AFTER_READY))}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(dr.VIEW_READY))}__checkUpdateLayout(){this.__layout.checkUpdate()}emitLeafer(t){this.emitEvent(new dr(t,this))}__listenEvents(){const t=J.start("FirstCreate "+this.innerName);this.once(dr.START,(()=>J.end(t))),this.once(ar.END,(()=>this.__onReady())),this.once(lr.END,(()=>this.__onViewReady())),this.on(ar.CHECK_UPDATE,(()=>this.__checkUpdateLayout()))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){if(this.canvas)try{this.stop(),this.emitEvent(new dr(dr.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>t.destroy())),this.__controllers.length=0,this.selector.destroy(),this.canvasManager.destroy(),this.hitCanvasManager.destroy(),this.imageManager.destroy(),this.canvas.destroy(),this.canvas=null,this.config=this.userConfig=this.view=null,super.destroy()}catch(t){El.error(t)}}};gt([Ii(class extends Ea{})],Tl.prototype,"__",void 0),gt([Ti()],Tl.prototype,"pixelRatio",void 0),Tl=gt([Gi()],Tl);let kl=class extends Tl{constructor(){super(...arguments),this.children=[]}get __tag(){return"App"}get isApp(){return!0}__setApp(){const{canvas:t}=this,{realCanvas:e,view:s}=this.config;e||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(sr.CHANGE,(()=>{Z.showHitView&&this.children.forEach((t=>{t.forceUpdate("blendMode")}))})))}start(){super.start(),this.children.forEach((t=>{t.start()}))}stop(){this.children.forEach((t=>{t.stop()})),super.stop()}addLeafer(t){const e=new Tl(t);return this.add(e),e}add(t){t.view||t.init(this.__getChildConfig(t.userConfig),this),super.add(t),t.once(ar.END,(()=>{!this.ready&&this.children.every((t=>t.ready))&&this.__onReady()})),t.once(lr.END,(()=>{!this.viewReady&&this.children.every((t=>t.viewReady))&&this.__onViewReady()})),this.realCanvas&&this.__eventIds.push(t.on_(lr.END,this.__onChildRenderEnd,this))}waitViewLoaded(e){const s=()=>{this.children.every((t=>t.viewLoaded))&&t.requestRender(e)};this.children.forEach((t=>{t.waitViewLoaded(s)})),this.running||this.start()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){this.children.forEach((e=>{t.copyWorld(e.canvas)}))}__onResize(t){this.children.forEach((e=>{e.resize(t)})),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>{t.__layout.checkUpdate()}))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&ct.assign(e,t),this.autoLayout&&ct.copyAttrs(e,this,Tt),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}destroy(){this.children.forEach((t=>{t.destroy()})),this.children.length=0,super.destroy()}};kl=gt([Gi()],kl);var Cl=Object.freeze({__proto__:null,Animate:vo,AnimateEvent:hr,get App(){return kl},AutoBounds:G,BezierHelper:Gt,Bounds:V,BoundsHelper:H,get Box(){return ja},get Branch(){return Vr},BranchHelper:Or,BranchRender:Er,get Canvas(){return bh},CanvasManager:at,ChildEvent:er,Creator:e,DataHelper:ct,Debug:Z,get DragEvent(){return en},get DropEvent(){return rn},Effect:yo,get Ellipse(){return qa},EllipseHelper:se,Event:tr,EventCreator:nt,Export:wo,FileHelper:pt,get Frame(){return Xa},get Group(){return Wa},HitCanvasManager:dt,get Image(){return xh},ImageEvent:ir,ImageManager:pn,IncrementId:s,Interaction:ho,get KeyEvent(){return ln},Keyboard:Kr,LayoutEvent:ar,Layouter:On,get Leaf(){return Wr},LeafBounds:mr,LeafBoundsHelper:Pr,LeafData:_t,LeafDataProxy:cr,LeafEventer:$i,LeafHelper:Tr,LeafHit:xr,LeafLevelList:lt,LeafList:ht,LeafMask:Br,LeafMatrix:gr,LeafRender:br,get Leafer(){return Tl},LeaferCanvas:Nn,LeaferCanvasBase:kt,LeaferEvent:dr,LeaferImage:dn,LeaferImageBase:dn,LeaferTypeCreator:go,get Line(){return wh},MathHelper:r,Matrix:R,MatrixHelper:f,get MoveEvent(){return nn},NeedConvertToCanvasCommandMap:Ot,OneRadian:n,PI2:o,PI_2:a,Paint:mo,get Path(){return bl},PathBounds:_i,PathCommandDataHelper:rs,PathCommandMap:Lt,PathConvert:ze,PathCorner:pi,PathCreator:ws,PathDrawer:As,PathHelper:Ct,PathNumberCommandLengthMap:At,PathNumberCommandMap:Mt,get Pen(){return Bl},Platform:t,PluginManager:fn,Point:C,PointHelper:T,PointerButton:qr,get PointerEvent(){return $r},get Polygon(){return sh},PropertyEvent:sr,get Rect(){return Na},RectHelper:It,RectRender:Aa,RenderEvent:lr,Renderer:Dn,ResizeEvent:rr,get RotateEvent(){return on},Run:J,Selector:In,get Star(){return lh},StringNumberMap:q,get SwipeEvent(){return an},TaskItem:cn,TaskProcessor:_n,get Text(){return wl},TransformEvent:nr,TwoPointBounds:K,TwoPointBoundsHelper:L,get UI(){return Ia},UIBounds:Sa,UICreator:st,UIEvent:Qr,UIHit:Da,UIRender:Ma,WaitHelper:Mr,WatchEvent:or,Watcher:mn,get ZoomEvent(){return hn},affectRenderBoundsType:Li,affectStrokeBoundsType:Ci,aliasType:vi,boundsType:Ti,canvasPatch:fi,canvasSizeAttrs:Tt,dataProcessor:Ii,dataType:xi,defineDataProcessor:Fi,defineKey:yi,defineLeafAttr:wi,effectType:Pa,eraserType:Mi,getDescriptor:mi,hitType:Ai,layoutProcessor:Wi,maskType:Di,opacityType:Oi,pathType:ki,positionType:bi,registerUI:Gi,registerUIEvent:Ki,resizeType:Oa,rewrite:Yi,rewriteAble:ji,rotationType:Ei,scaleType:Bi,setDefaultValue:Ni,sortType:Si,strokeType:Ri,surfaceType:Pi,useCanvas:uo,useModule:Vi,usePlugin:yn});fn.power=Cl,uo();export{vo as Animate,hr as AnimateEvent,kl as App,G as AutoBounds,Gt as BezierHelper,V as Bounds,H as BoundsHelper,ja as Box,Vr as Branch,Or as BranchHelper,Er as BranchRender,bh as Canvas,at as CanvasManager,er as ChildEvent,e as Creator,ct as DataHelper,Z as Debug,en as DragEvent,rn as DropEvent,yo as Effect,qa as Ellipse,se as EllipseHelper,tr as Event,nt as EventCreator,wo as Export,pt as FileHelper,Xa as Frame,Wa as Group,dt as HitCanvasManager,xh as Image,ir as ImageEvent,pn as ImageManager,s as IncrementId,ho as Interaction,ln as KeyEvent,Kr as Keyboard,ar as LayoutEvent,On as Layouter,Wr as Leaf,mr as LeafBounds,Pr as LeafBoundsHelper,_t as LeafData,cr as LeafDataProxy,$i as LeafEventer,Tr as LeafHelper,xr as LeafHit,lt as LeafLevelList,ht as LeafList,Br as LeafMask,gr as LeafMatrix,br as LeafRender,Tl as Leafer,Nn as LeaferCanvas,kt as LeaferCanvasBase,dr as LeaferEvent,dn as LeaferImage,dn as LeaferImageBase,go as LeaferTypeCreator,wh as Line,r as MathHelper,R as Matrix,f as MatrixHelper,nn as MoveEvent,Ot as NeedConvertToCanvasCommandMap,n as OneRadian,o as PI2,a as PI_2,mo as Paint,bl as Path,_i as PathBounds,rs as PathCommandDataHelper,Lt as PathCommandMap,ze as PathConvert,pi as PathCorner,ws as PathCreator,As as PathDrawer,Ct as PathHelper,At as PathNumberCommandLengthMap,Mt as PathNumberCommandMap,Bl as Pen,t as Platform,fn as PluginManager,C as Point,T as PointHelper,qr as PointerButton,$r as PointerEvent,sh as Polygon,sr as PropertyEvent,Na as Rect,It as RectHelper,Aa as RectRender,lr as RenderEvent,Dn as Renderer,rr as ResizeEvent,on as RotateEvent,J as Run,In as Selector,lh as Star,q as StringNumberMap,an as SwipeEvent,cn as TaskItem,_n as TaskProcessor,wl as Text,nr as TransformEvent,K as TwoPointBounds,L as TwoPointBoundsHelper,Ia as UI,Sa as UIBounds,st as UICreator,Qr as UIEvent,Da as UIHit,Ma as UIRender,Mr as WaitHelper,or as WatchEvent,mn as Watcher,hn as ZoomEvent,Li as affectRenderBoundsType,Ci as affectStrokeBoundsType,vi as aliasType,Ti as boundsType,fi as canvasPatch,Tt as canvasSizeAttrs,Ii as dataProcessor,xi as dataType,Fi as defineDataProcessor,yi as defineKey,wi as defineLeafAttr,Pa as effectType,Mi as eraserType,mi as getDescriptor,Ai as hitType,Wi as layoutProcessor,Di as maskType,Oi as opacityType,ki as pathType,bi as positionType,Gi as registerUI,Ki as registerUIEvent,Oa as resizeType,Yi as rewrite,ji as rewriteAble,Ei as rotationType,Bi as scaleType,Ni as setDefaultValue,Si as sortType,Ri as strokeType,Pi as surfaceType,uo as useCanvas,Vi as useModule,yn as usePlugin};
|