leafer-ui 1.0.0-alpha.18 → 1.0.0-alpha.19
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/README.md +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class t{constructor(t){this.list=[],this.leafer=t}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,n=s.length;i<n;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e;const i=this.leafer.creator.canvas(t);return this.add(i),i}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(),this.leafer=null}}class e{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,n=e.length;i<n;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 e;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class s{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 i extends t{constructor(){super(...arguments),this.pathTypeList=new e,this.imageTypeList=new e}get(t){}getImageType(t,e){return this.imageTypeList.push(t),this.leafer.creator.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),this.leafer.creator.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 n={default:(t,e)=>(o(e,t),o(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var n;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(n=t[i])||void 0===n?void 0:n.constructor)===Object?o(t[i],e[i]):t[i]=e[i]}))},clone:t=>JSON.parse(JSON.stringify(t))},{assign:o}=n;class r{constructor(t){this.__leaf=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]}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}destroy(){this.__leaf=null}}const a={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=h;return e[t]?e[t]++:(e[t]=1,0)}},h=a,d={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t)},l=Math.PI/180,{sin:c,cos:u}=Math,_={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,n=1,o=0,r=0){t.a=e,t.b=s,t.c=i,t.d=n,t.e=o,t.f=r},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},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s,t.e*=e,t.f*=s},rotate(t,e){const s=e*l,i=u(s),n=c(s),{a:o,b:r,c:a,d:h,e:d,f:_}=t;t.a=o*i-r*n,t.b=o*n+r*i,t.c=a*i-h*n,t.d=a*n+h*i,t.e=d*i-_*n,t.f=d*n+_*i},times(t,e){const{a:s,b:i,c:n,d:o,e:r,f:a}=t;t.a=e.a*s+e.b*n,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*n,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*n+r,t.f=e.e*i+e.f*o+a},divide(t,e){p.times(t,p.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=p;return p.copy(e,t),p.invert(e),e},invert(t){const{a:e,b:s,c:i,d:n,e:o,f:r}=t,a=1/(e*n-s*i);t.a=n*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*n-r*i)*a,t.f=-(r*e-o*s)*a},toWorldPoint(t,e,s){const{x:i,y:n}=e;s||(s=e),s.x=i*t.a+n*t.c+t.e,s.y=i*t.b+n*t.d+t.f},toLocalPoint(t,e,s,i){const{x:n,y:o}=e,{a:r,b:a,c:h,d:d}=t,l=1/(r*d-a*h);if(s||(s=e),s.x=(n*d-o*h)*l,s.y=(o*r-n*a)*l,!i){const{e:e,f:i}=t;s.x-=(e*d-i*h)*l,s.y-=(i*r-e*a)*l}},empty(t){t.a=1,t.b=0,t.c=0,t.d=1,t.e=0,t.f=0}},p=_,{toLocalPoint:g,toWorldPoint:y}=_,{sin:v,cos:f,abs:m,sqrt:x,atan2:w}=Math,B={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},rotate(t,e,s){s||(s=E.defaultPoint);const i=f(e*l),n=v(e*l),o=t.x-s.x,r=t.y-s.y;t.x=s.x+o*i-r*n,t.y=s.y+o*n-r*i},tempToLocal(t,e){const{tempPoint:s}=E;return E.copy(s,t),g(e,s,s),s},tempToLocalRadiusPoint(t,e){const{tempRadiusPoint:s}=E;return E.copy(s,t),E.toLocalRadiusPoint(t,e,s),s},toLocalRadiusPoint(t,e,s){s||(s=t),g(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toLocal(t,e,s){g(e,t,s)},toWorld(t,e,s){y(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=m(e.x-t.x),i=m(e.y-t.y);return x(s*s+i*i)},getAngle:(t,e)=>E.getAtan2(t,e)/l,getAtan2:(t,e)=>w(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=E.getAtan2(t,e);return{x:t.x+f(i)*s,y:t.y+v(i)*s}}},E=B;class b{constructor(t,e){"object"==typeof t?B.copy(this,t):B.set(this,t,e)}set(t,e){B.set(this,t,e)}copy(t){return B.copy(this,t),this}clone(){return new b(this)}rotate(t,e){B.rotate(this,t,e)}toLocal(t,e){B.toLocal(this,t,e)}toWorld(t,e){B.toWorld(this,t,e)}getCenter(t){return B.getCenter(this,t)}getDistance(t){return B.getDistance(this,t)}getAngle(t){return B.getAngle(this,t)}getAtan2(t){return B.getAtan2(this,t)}}class T{constructor(t,e,s,i,n,o){"object"==typeof t?_.copy(this,t):_.set(this,t,e,s,i,n,o)}set(t,e,s,i,n,o){_.set(this,t,e,s,i,n,o)}copy(t){return _.copy(this,t),this}clone(){return new T(this)}translate(t,e){return this.e+=t,this.f+=e,this}scale(t,e){return _.scale(this,t,e),this}rotate(t){return _.rotate(this,t),this}times(t){_.times(this,t)}divide(t){_.divide(this,t)}invert(){_.invert(this)}toWorldPoint(t,e){_.toWorldPoint(this,t,e)}toLocalPoint(t,e){_.toLocalPoint(this,t,e)}empty(){_.empty(this)}}const R={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},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}},{tempPointBounds:C,setPoint:P,addPoint:L,toBounds:k}=R,{toWorldPoint:S}=_;let M,D,O,A;const W={},I={},N={tempBounds:{},set(t,e=0,s=0,i=0,n=0){t.x=e,t.y=s,t.width=i,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){F.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),F.move(t,e,s),t),getOutOfBounds(t,e){const s=-(F.right(e)-t.x),i=-(F.bottom(e)-t.y),n=Object.assign(Object.assign({},t),{offsetX:s,offsetY:i});return F.move(n,-s,-i),n},tempTimesMatrix:(t,e)=>(F.copy(F.tempBounds,t),F.setByBoundsTimesMatrix(F.tempBounds,F.tempBounds,e),F.tempBounds),timesMatrix(t,e){F.setByBoundsTimesMatrix(t,t,e)},getByTimesMatrix:(t,e)=>(t=Object.assign({},t),F.setByBoundsTimesMatrix(t,t,e),t),divideMatrix(t,e){t.x=(t.x-e.e)/e.a,t.y=(t.y-e.f)/e.d,t.width/=e.a,t.height/=e.d},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return F.copyAndSpread(s,t,e),s},spread(t,e){F.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){M=t.x+t.width,D=t.y+t.height,O=e.x+e.width,A=e.y+e.height,M=M>O?M:O,D=D>A?D:A,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=M-t.x,t.height=D-t.y},addList(t,e){F.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){F.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){F.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){if(!e.length)return void F.empty(t);let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=s?s(e[r]):e[r],(n.width||n.height)&&(o?(o=!1,i||j(t,n)):z(t,n))},setByBoundsTimesMatrix(t,e,s){0===s.b&&0===s.c?(t.x=s.e+e.x*s.a,t.y=s.f+e.y*s.d,t.width=e.width*s.a,t.height=e.height*s.d):(W.x=e.x,W.y=e.y,S(s,W,I),P(C,I.x,I.y),W.x=e.x+e.width,S(s,W,I),L(C,I.x,I.y),W.y=e.y+e.height,S(s,W,I),L(C,I.x,I.y),W.x=e.x,S(s,W,I),L(C,I.x,I.y),k(C,t))},setByPoints(t,e){e.forEach(((t,e)=>{0===e?P(C,t.x,t.y):L(C,t.x,t.y)})),k(C,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=B.tempToLocalRadiusPoint(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=B.tempToLocal(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=F.tempTimesMatrix(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=F.tempTimesMatrix(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=F.tempTimesMatrix(e,s));let{x:i,y:n,width:o,height:r}=e;return M=i+o,D=n+r,O=t.x+t.width,A=t.y+t.height,i=i>t.x?i:t.x,n=n>t.y?n:t.y,M=M<O?M:O,D=D<A?D:A,o=M-i,r=D-n,{x:i,y:n,width:o,height:r}},setByIntersect(t,e,s){F.copy(t,F.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,empty(t){t.x=0,t.y=0,t.width=0,t.height=0}},F=N,{add:z,copy:j}=F;class Y{constructor(t,e,s,i){"object"==typeof t?N.copy(this,t):N.set(this,t,e,s,i)}set(t,e,s,i){N.set(this,t,e,s,i)}copy(t){return N.copy(this,t),this}clone(){return new Y(this)}timesMatrix(t){return N.timesMatrix(this,t),this}divideMatrix(t){return N.divideMatrix(this,t),this}getFitMatrix(t){return N.getFitMatrix(this,t)}spread(t){N.spread(this,t)}ceil(){N.ceil(this)}add(t){N.add(this,t)}addList(t){N.setByList(this,t,!0)}setByList(t,e){N.setByList(this,t,e)}addListWithHandle(t,e){N.setByListWithHandle(this,t,e,!0)}setByListWithHandle(t,e,s){N.setByListWithHandle(this,t,e,s)}setByBoundsTimesMatrix(t,e){N.setByBoundsTimesMatrix(this,t,e)}setByPoints(t){N.setByPoints(this,t)}hitPoint(t,e){return N.hitPoint(this,t,e)}hitRadiusPoint(t,e){return N.hitRadiusPoint(this,t,e)}hit(t,e){return N.hit(this,t,e)}includes(t,e){return N.includes(this,t,e)}getIntersect(t,e){return new Y(N.getIntersectData(this,t,e))}setByIntersect(t,e){N.setByIntersect(this,t,e)}isSame(t){return N.isSame(this,t)}isEmpty(){return N.isEmpty(this)}empty(){N.empty(this)}}class X{constructor(t,e,s,i,n,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,n,o)}set(t=0,e=0,s=0,i=0,n=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=n,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:n,width:o,height:r}=t;this.set(e,s,i,n,o,r)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:n,width:o,height:r}=this;return new Y(n,e,o||t.width-n-s,r||t.height-e-i)}}class H{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}add(t){R.add(this,t)}}const U={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};function G(t,e,s,i){var n,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,s,r):n(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r}function K(t,e,s,i){return new(s||(s=Promise))((function(n,o){function r(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}h((i=i.apply(t,e||[])).next())}))}class V{constructor(t){this.name=t}static get(t){return new V(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)}error(...t){console.error(this.name,...t)}}var q;V.filterList=[],V.excludeList=[],V.__={},G([(t,e)=>{Object.defineProperty(t,e,{get:()=>t.enable?t.__[e]:q,set(t){this.__[e]=t}})}],V,"showRepaint",void 0);const Q=V;const Z=V.get("RunTime");class ${static start(t,e){const s=a.create(a.RUNTIME);return J.currentId=J.idMap[s]=e?performance.now():Date.now(),J.currentName=J.nameMap[s]=t,J.nameToIdMap[t]=s,s}static end(t,e){const s=J.idMap[t],i=J.nameMap[t];J.idMap[t]=void 0,J.nameMap[t]=void 0,J.nameToIdMap[i]=void 0,e?Z.log(i,performance.now()-s,"µs"):Z.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=J.nameToIdMap[t];void 0!==s&&J.end(s,e)}}$.idMap={},$.nameMap={},$.nameToIdMap={};const J=$;function tt(t,e,s){Object.defineProperty(t,e,s)}function et(t,e){return Object.getOwnPropertyDescriptor(t,e)}function st(t){return(e,s)=>{tt(e,s,{get(){return this.__get(t)},set(e){this.__set(t,e)}})}}function it(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t)}}),yt(e,s,t)}}function nt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.positionChanged||this.__layout.positionChange()}}),yt(e,s,t)}}function ot(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}}),yt(e,s,t)}}function rt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}}),yt(e,s,t)}}function at(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.boxBoundsChanged||this.__layout.boxBoundsChange()}}),yt(e,s,t)}}const ht=at;function dt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.eventBoundsChanged||this.__layout.eventBoundsChange()}}),yt(e,s,t)}}function lt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),yt(e,s,t)}}function ct(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}}),yt(e,s,t)}}function ut(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.root?this.__set(s,t):this.__[s]=t,this.__layout.opacityChanged||this.__layout.opacityChange()}}),yt(e,s,t)}}function _t(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.__addParentWait((()=>{this.parent.__layout.childrenSortChanged=!0}))}}),yt(e,s,t)}}function pt(t){return(e,s)=>{tt(e,"__DataProcessor",{get:()=>t})}}function gt(t){return(e,s)=>{tt(e,"__LayoutProcessor",{get:()=>t})}}function yt(t,e,s){const i=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[n];return void 0===t?s:t},set(t){this[n]=t}};void 0===s&&(r.get=function(){return this[n]});const a=et(i,e);a&&(a.set&&(r.set=a.set),a.get&&(r.get=a.get)),i[o]&&(r.set=i[o],delete i[o]),Object.defineProperty(i,e,r)}const vt=new V("rewrite"),ft=[],mt=["destroy","constructor"];function xt(t){return(e,s)=>{ft.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function wt(){return t=>{Bt()}}function Bt(t){ft.length&&(ft.forEach((e=>{t&&vt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ft.length=0)}function Et(t){return e=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!mt.includes(s))if(t.prototype){et(t.prototype,s).writable&&(e.prototype[s]=t.prototype[s])}else e.prototype[s]=t[s]}))}}setTimeout((()=>Bt(!0)));const bt={},Tt=V.get("EventCreator"),Rt={typeList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Ct[e]?Tt.error("register the repeat EventType: ",e):Ct[e]=t)}))},get:(t,...e)=>new Ct[t](...e)},{typeList:Ct}=Rt,Pt=V.get("UICreator"),Lt={list:{},register(t){const{tag:e}=t.prototype;kt[e]?Pt.error("register the repeat UI: ",e):kt[e]=t},get:(t,e)=>new kt[t](e)},{list:kt}=Lt,St={ui:(t,e)=>Lt.get(t,e),event:(t,...e)=>Rt.get(t,...e)};function Mt(){return t=>{Lt.register(t)}}function Dt(){return t=>{Rt.register(t)}}const{setByBoundsTimesMatrix:Ot}=N;class At{constructor(t){this.leaf=t,this.renderBounds=this.eventBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.relativeRenderBounds=this.relativeEventBounds=t.__relative,this.boxBoundsChange()}update(){const{leafer:t}=this.leaf;t&&t.watcher.changed&&(t.running||t.start(),t.layouter.layout())}getTransform(t){return this.update(),"world"===t?this.leaf.__world:this.leaf.__relative}getBounds(t,e){if(this.update(),"world"===t)switch(e){case"render":return this.leaf.__world;case"box":return this.getWorldBoxBounds();case"event":return this.getWorldEventBounds()}else if("local"===t)switch(e){case"render":return this.renderBounds;case"box":return this.boxBounds;case"event":return this.eventBounds}else switch(e){case"render":return this.relativeRenderBounds;case"box":return this.leaf.__relative;case"event":return this.relativeEventBounds}return this.leaf.__world}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ot(this._worldBoxBounds,this.boxBounds,this.leaf.__world),this._worldBoxBounds}getWorldEventBounds(){return this._worldEventBounds||(this._worldEventBounds={}),Ot(this._worldEventBounds,this.eventBounds,this.leaf.__world),this._worldEventBounds}eventBoundsSpreadCancel(){const t=this.renderBounds===this.eventBounds;this.eventBounds=this.boxBounds,this.relativeEventBounds=this.leaf.__relative,t&&this.renderBoundsSpreadCancel()}renderBoundsSpreadCancel(){this.renderBounds=this.eventBounds,this.relativeRenderBounds=this.relativeEventBounds}eventBoundsSpread(){const{x:t,y:e,width:s,height:i}=this.eventBounds;this.eventBounds={x:t,y:e,width:s,height:i},this.relativeEventBounds={x:t,y:e,width:s,height:i},this.renderBoundsSpreadWidth||this.renderBoundsSpreadCancel()}renderBoundsSpread(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.relativeRenderBounds={x:t,y:e,width:s,height:i}}boxBoundsChange(){this.boxBoundsChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange(),this.hitCanvasChanged=!0}localBoxBoundsChange(){this.localBoxBoundsChanged=!0,this.boundsChanged=!0}eventBoundsChange(){this.eventBoundsChanged=!0,this.eventBoundsSpreadWidth||(this.eventBoundsSpreadWidth=1),this.boundsChanged=!0}renderBoundsChange(){this.renderBoundsChanged=!0,this.renderBoundsSpreadWidth||(this.renderBoundsSpreadWidth=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const Wt=V.get("Life"),It={},Nt={on(t,e,s){let i,n,o;if(s){const t="boolean"==typeof s;i=t?s:s.capture,n=!t&&s.once}const r=Ft(this,i,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(o=r[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):r[t]=[h])}))},off(t,e,s){let i,n,o;s&&(i="boolean"==typeof s?s:s.capture);const r=Ft(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(n=r[t],n&&(o=n.findIndex((t=>t.listener===e)),o>-1&&n.splice(o,1),n.length||delete r[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){V.enable&&Wt.log(t);const i=Ft(this,s)[t];if(i){let n;for(let o=0,r=i.length;o<r&&(n=i[o],n.listener(e),n.once&&(this.off(t,n.listener,s),o--,r--),!e||!e.isStopNow);o++);}},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 Ft(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:It)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:It)}}class zt{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}}let jt=class extends zt{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}};jt.ADD="child.add",jt.REMOVE="child.remove",jt=G([Dt()],jt);let Yt=class extends zt{constructor(t,e,s,i,n){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=n}};var Xt;Yt.CHANGE="attr.change",Yt=G([Dt()],Yt);let Ht=Xt=class extends zt{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){const s="object"==typeof t;super(s?Xt.RESIZE:t),s&&Object.assign(this,t),this.old=e}};Ht.RESIZE="resize",Ht=Xt=G([Dt()],Ht);let Ut=class extends zt{constructor(t,e){super(t),e&&Object.assign(this,e)}};Ut.BEFORE="transform.before",Ut.CHANGE="transform.change",Ut.AFTER="transform.after",Ut.PRE_BEFORE="transform.pre_before",Ut.PRE_CHANGE="transform.pre_change",Ut.PRE_AFTER="transform.pre_after",Ut=G([Dt()],Ut);let Gt=class extends zt{constructor(t,e){super(t),this.data=e}};Gt.REQUEST="watch.request",Gt.DATA="watch.data",Gt=G([Dt()],Gt);let Kt=class extends zt{constructor(t,e){super(t),e&&(this.data=e)}};Kt.REQUEST="layout.request",Kt.START="layout.start",Kt.BEFORE_ONCE="layout.before_once",Kt.ONCE="layout.once",Kt.AFTER_ONCE="layout.after_once",Kt.AGAIN="layout.again",Kt.LAYOUT="layout",Kt.END="layout.end",Kt=G([Dt()],Kt);let Vt=class extends zt{};Vt.REQUEST="render.request",Vt.START="render.start",Vt.BEFORE_ONCE="render.before_once",Vt.ONCE="render.once",Vt.AFTER_ONCE="render.after_once",Vt.AGAIN="render.again",Vt.RENDER="render",Vt.END="render.end",Vt=G([Dt()],Vt);const qt={__set(t,e){if(this.root){const s=this.__.__getInput(t);s!==e&&(this.__[t]=e,this.root.emitEvent(new Yt(Yt.CHANGE,this,t,s,e)))}else this.__[t]=e},__get(t){return this.__.__getInput(t)},__updateAttr(t){if(this.root){const e=this.__.__getInput(t);this.root.emitEvent(new Yt(Yt.CHANGE,this,t,e,e))}}},{defaultMatrix:Qt}=_,{sin:Zt,cos:$t}=Math,Jt={__updateWorldMatrix(){const t=this.parent?this.parent.__world:Qt,e=this.__relative,s=this.__world;this.__layout.matrixChanged&&this.__updateRelativeMatrix(),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)},__updateRelativeMatrix(){const t=this.__relative,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:n,skewX:o,skewY:r}=this.__;n||o||r?(n*=l,o&&(o*=l),r&&(r*=l),t.a=s*$t(n+r),t.b=s*Zt(n+r),t.c=i*-Zt(n-o),t.d=i*$t(n-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}},{setByBoundsTimesMatrix:te}=N,ee={__updateWorldBounds(){var t,e,s;if(this.__layout.boundsChanged){let i;const n=this.__layout;n.boxBoundsChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),n.boxBoundsChanged=!1,i=!0),n.localBoxBoundsChanged&&(this.__updateRelativeBoxBounds(),n.localBoxBoundsChanged=!1,n.eventBoundsSpreadWidth&&(n.eventBoundsChanged=!0),n.renderBoundsSpreadWidth&&(n.renderBoundsChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxBoundsChange()),n.eventBoundsChanged&&(n.eventBoundsSpreadWidth=this.__updateEventBoundsSpreadWidth(),n.eventBoundsSpreadWidth?(n.eventBounds===n.boxBounds&&n.eventBoundsSpread(),this.__updateEventBounds(),this.__updateRelativeEventBounds(),n.eventBoundsChanged=!1,n.renderBoundsSpreadWidth&&(n.renderBoundsChanged=!0)):n.eventBoundsSpreadCancel(),null===(e=this.parent)||void 0===e||e.__layout.eventBoundsChange(),i||(i=!0)),n.renderBoundsChanged&&(n.renderBoundsSpreadWidth=this.__updateRenderBoundsSpreadWidth(),n.renderBoundsSpreadWidth?(n.renderBounds!==n.boxBounds&&n.renderBounds!==n.eventBounds||n.renderBoundsSpread(),this.__updateRenderBounds(),this.__updateRelativeRenderBounds(),n.renderBoundsChanged=!1):n.renderBoundsSpreadCancel(),null===(s=this.parent)||void 0===s||s.__layout.renderBoundsChange()),n.boundsChanged=!1,te(this.__world,this.__layout.renderBounds,this.__world),i&&this.__onUpdateSize()}else te(this.__world,this.__layout.renderBounds,this.__world)},__updateRelativeBoxBounds(){te(this.__relative,this.__layout.boxBounds,this.__relative)},__updateRelativeEventBounds(){te(this.__layout.relativeEventBounds,this.__layout.eventBounds,this.__relative)},__updateRelativeRenderBounds(){te(this.__layout.relativeRenderBounds,this.__layout.renderBounds,this.__relative)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height}},{toLocalRadiusPoint:se}=B,ie={},ne={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawRenderPath(this.__hitCanvas)},__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),se(t,this.__world,ie),this.__hit(ie)}},oe={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,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)}},{LEAF:re,create:ae}=a;let he=class{get tag(){return this.constructor.name}get __DataProcessor(){return r}get __LayoutProcessor(){return At}constructor(t){this.innerId=ae(re),this.__relative={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.__renderTime=2,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}__addParentWait(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}__runParentWait(){const t=this.__parentWait.length;for(let e=0;e<t;e++)this.__parentWait[e]();this.__parentWait=null}__setAsLeafer(){this.leafer=this}__setAsRoot(){this.__bindRoot(this),this.__isRoot=!0}__bindRoot(t){if(!this.__isRoot&&(this.root=t,this.leafer=t.leafer,this.__level=this.parent?this.parent.__level+1:1,this.__isBranch)){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindRoot(t)}}__set(t,e){}__get(t){}__updateAttr(t){}__updateWorldOpacity(){}__updateWorldMatrix(){}__updateRelativeMatrix(){}__updateWorldBounds(){}__updateRelativeBoxBounds(){}__updateRelativeEventBounds(){}__updateRelativeRenderBounds(){}__updateBoxBounds(){}__updateEventBounds(){}__updateRenderBounds(){}__updateEventBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){return 0}__onUpdateSize(){}__hitWorld(t){return!0}__hit(t){return!0}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){}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.__isBranch&&(this.children.forEach((t=>{t.destroy()})),this.children=null),this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.root=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null)}};he=G([Et(qt),Et(Jt),Et(ee),Et(ne),Et(Nt),Et(oe)],he);const de={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ce(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ue(e[t])}},updateAllChange(t){if(ue(t),t.__updateChange(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)_e(e[t])}},moveOfWorld(t,e,s){const i={x:e,y:s};t.parent&&_.toLocalPoint(t.parent.__world,i,i,!0),le.move(t,i.x,i.y)},move(t,e,s){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,i){const n=t.parent?B.tempToLocal(s,t.parent.__world):s;this.zoom(t,e,n,i)},zoom(t,e,s,i){i||(i=t);const{x:n,y:o}=i.__,{scaleX:r,scaleY:a}=t.__,h=s.x-n,d=s.y-o,l=(new T).translate(h,d).scale(e).translate(-h,-d);i.x=n-l.e,i.y=o-l.f,t.scaleX=r*e,t.scaleY=a*e},rotateOfWorld(t,e,s,i){const n=t.parent?B.tempToLocal(s,t.parent.__world):s;this.rotate(t,e,n,i)},rotate(t,e,s,i){i||(i=t);const{x:n,y:o}=i.__,{rotation:r}=t.__,a=s.x-n,h=s.y-o,d=(new T).translate(a,h).rotate(e).translate(-a,-h);i.x=n-d.e,i.y=o-d.f,t.rotation=r+e}},le=de,{updateAllWorldMatrix:ce,updateAllWorldOpacity:ue,updateAllChange:_e}=le,pe={worldBounds:t=>t.__world,relativeBoxBounds:t=>t.__relative,relativeEventBounds:t=>t.__layout.relativeEventBounds,relativeRenderBounds:t=>t.__layout.relativeRenderBounds},ge={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,n=s.length;i<n;i++)(t=s[i]).__isBranch&&(t.__tempNumber=1,e.push(t),ye(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++)ve(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:ye,pushAllBranchStack:ve}=ge,{setByListWithHandle:fe}=N,{sort:me}=ge,{relativeBoxBounds:xe,relativeEventBounds:we,relativeRenderBounds:Be}=pe;class Ee extends he{constructor(){super(),this.__isBranch=!0,this.children=[]}__updateEventBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.eventBoundsSpreadWidth)return 1;return 0}__updateRenderBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderBoundsSpreadWidth)return 1;return 0}__updateBoxBounds(){fe(this.__layout.boxBounds,this.children,xe)}__updateEventBounds(){fe(this.__layout.eventBounds,this.children,we)}__updateRenderBounds(){fe(this.__layout.renderBounds,this.children,Be)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__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(me)}}__render(t,e){if(this.__worldOpacity){let s;const{bounds:i,hideBounds:n}=e,{children:o}=this;for(let r=0,a=o.length;r<a;r++)s=o[r],i&&!i.hit(s.__world,e.matrix)||n&&n.includes(s.__world)||s.__render(t,e)}}add(t,e){if(t.parent)t.parent!==this&&console.warn("child had other parent, can not add to this, child innerId:"+t.innerId);else{if(t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.__isBranch&&(this.__childBranchNumber?this.__childBranchNumber++:this.__childBranchNumber=1),this.root){t.__bindRoot(this.root);const e=new jt(jt.ADD,t,this);this.hasEvent(jt.ADD)&&this.emitEvent(e),this.root.emitEvent(e)}t.__parentWait&&t.__runParentWait()}}remove(t){if(t){const e=this.children.indexOf(t);if(e>-1){if(this.children.splice(e,1),t.__isBranch&&(this.__childBranchNumber>1?this.__childBranchNumber--:this.__childBranchNumber=0),this.root){const e=new jt(jt.REMOVE,t,this);this.hasEvent(jt.REMOVE)&&this.emitEvent(e),this.root.emitEvent(e),t.root=null}t.parent=null,this.__layout.boxBoundsChange()}}else this.parent&&this.parent.remove(this)}}const be={};class Te{static isHoldSpaceKey(){return Te.hasDownCode("Space")}static setDownCode(t){be[t]||(be[t]=!0)}static setUpCode(t){be[t]=!1}static hasDownCode(t){return be[t]}}class Re{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class Ce extends zt{get spaceKey(){return Te.isHoldSpaceKey()}get left(){return Re.left(this)}get right(){return Re.right(this)}get middle(){return Re.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}}let Pe=class extends Ce{};Pe.POINTER="pointer",Pe.BEFORE_DOWN="pointer.before_down",Pe.BEFORE_MOVE="pointer.before_move",Pe.BEFORE_UP="pointer.before_up",Pe.DOWN="pointer.down",Pe.MOVE="pointer.move",Pe.UP="pointer.up",Pe.ENTER="pointer.enter",Pe.LEAVE="pointer.leave",Pe.TAP="tap",Pe.CLICK="click",Pe.DOUBLE_CLICK="doubleclick",Pe.LONG_PRESS="longpress",Pe.LONG_TAP="longtap",Pe=G([Dt()],Pe);let Le=class extends Pe{};var ke;Le.DRAG="drag",Le.START="drag.start",Le.END="drag.end",Le=G([Dt()],Le);let Se=ke=class extends Pe{static setList(t){ke.dragList=t instanceof e?t:new e(t)}};Se.DROP="drop",Se.ENTER="drop.enter",Se.LEAVE="drop.leave",Se=ke=G([Dt()],Se);let Me=class extends Le{};Me.MOVE="move",Me.START="move.start",Me.END="move.end",Me=G([Dt()],Me);let De=class extends Ce{};De.ROTATE="rotate",De.START="rotate.start",De.END="rotate.end",De=G([Dt()],De);let Oe=class extends Le{};Oe.SWIPE="swipe",Oe.LEFT="swipe.left",Oe.RIGHT="swipe.right",Oe.UP="swipe.up",Oe.DOWN="swipe.down",Oe=G([Dt()],Oe);let Ae=class extends Ce{};Ae.ZOOM="zoom",Ae.START="zoom.start",Ae.END="zoom.end",Ae=G([Dt()],Ae);let We=class extends Ce{};We.DOWN="key.down",We.PRESS="key.press",We.UP="key.up",We=G([Dt()],We);class Ie{constructor(t,e){this.list=[],this.leafer=t}load(){}destory(){this.leafer=null}}const Ne={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Fe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,rect:5,roundRect:6,ellipse:9,arc:7,arcTo:6},ze={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},je=Ne,Ye={};for(let t in je)Ye[je[t]]=t;const Xe={};for(let t in je)Xe[je[t]]=Fe[t];const He={},{sin:Ue,cos:Ge,sqrt:Ke,atan2:Ve,ceil:qe,abs:Qe,PI:Ze}=Math,{setPoint:$e,addPoint:Je}=R,ts={getFromACommand(t,e,s,i,n,o,r,a,h){const d=a-t,l=h-e,c=n*Ze/180,u=Ue(c),_=Ge(c),p=-_*d*.5-u*l*.5,g=-_*l*.5+u*d*.5,y=s*s,v=i*i,f=g*g,m=p*p,x=y*v-y*f-v*m;let w=0;if(x<0){const t=Ke(1-x/(y*v));s*=t,i*=t}else{w=(o===r?-1:1)*Ke(x/(y*f+v*m))}const B=w*s*g/i,E=-w*i*p/s,b=_*B-u*E+.5*d,T=u*B+_*E+.5*l;let R=Ve((g-E)/i,(p-B)/s),C=Ve((-g-E)/i,(-p-B)/s),P=C-R;0===r&&P>0?P-=2*Ze:1===r&&P<0&&(P+=2*Ze);const L=[],k=qe(Qe(P/Ze*2)),S=P/k,M=Ue(S/2),D=Ue(S/4),O=8/3*D*D/M;R=0,C=Ve((g-E)/i,(p-B)/s);let A,W,I,N,F,z,j,Y,X=C-R,H=X+S,U=Ge(X),G=Ue(X),K=0,V=0;for(let n=0;n<k;n++)A=Ge(H),W=Ue(H),I=_*s*A-u*i*W+b,N=u*s*A+_*i*W+T,F=K+O*(-_*s*G-u*i*U),z=V+O*(-u*s*G+_*i*U),j=I+O*(_*s*W+u*i*A),Y=N+O*(u*s*W-_*i*A),L.push(Ne.C,F+t,z+e,j+t,Y+e,I+t,N+e),K=I,V=N,X=H,U=A,G=W,H+=S;return L},toTwoPointBounds(t,e,s,i,n,o,r,a,h){const d=[];let l,c,u,_,p,g,y,v,f=t,m=s,x=n,w=r;for(let t=0;t<2;++t)if(1==t&&(f=e,m=i,x=o,w=a),l=-3*f+9*m-9*x+3*w,c=6*f-12*m+6*x,u=3*m-3*f,Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;_=-u/c,0<_&&_<1&&d.push(_)}else y=c*c-4*u*l,v=Math.sqrt(y),y<0||(p=(-c+v)/(2*l),0<p&&p<1&&d.push(p),g=(-c-v)/(2*l),0<g&&g<1&&d.push(g));$e(h,t,e),Je(h,r,a);for(let l=0,c=d.length;l<c;l++)es.getPointAndSet(d[l],t,e,s,i,n,o,r,a,He),Je(h,He.x,He.y)},getPointAndSet(t,e,s,i,n,o,r,a,h,d){const l=1-t,c=l*l*l,u=3*l*l*t,_=3*l*t*t,p=t*t*t;d.x=c*e+u*i+_*o+p*a,d.y=c*s+u*n+_*r+p*h},getPoint(t,e,s,i,n,o,r,a,h){const d={};return es.getPointAndSet(t,e,s,i,n,o,r,a,h,d),d}},es=ts,{M:ss,m:is,L:ns,l:os,H:rs,h:as,V:hs,v:ds,C:ls,c:cs,S:us,s:_s,Q:ps,q:gs,T:ys,t:vs,A:fs,a:ms,Z:xs,z:ws}=Ne,{getFromACommand:Bs}=ts,Es={current:{},stringify(t){let e,s,i,n=0,o=t.length,r="";for(;n<o;){s=t[n],e=Xe[s],r+=s===i?" ":Ye[s];for(let s=1;s<e;s++)r+=t[n+s],s===e-1||(r+=" ");i=s,n+=e}return r},parse(t,e=!0){let s,i,n="";const o=[];for(let e=0,r=t.length;e<r;e++)i=t[e],U[i]?n+=i:Ne[i]?(n&&(Ts(o,Number(n)),n=""),bs.name=Ne[i],bs.length=Fe[i],bs.index=0,Ts(o,bs.name),!s&&ze[i]&&(s=!0)):"-"===i?(n&&Ts(o,Number(n)),n=i):n&&(Ts(o,Number(n)),n="");return n&&Ts(o,Number(n)),e&&s?Es.convertToSimple(o):o},convertToSimple(t){let e,s,i,n,o,r=0,a=0,h=0,d=0,l=0,c=t.length;const u=[];for(;l<c;){switch(i=t[l],i){case is:t[l+1]+=r,t[l+2]+=a;case ss:r=t[l+1],a=t[l+2],u.push(ss,r,a),l+=3;break;case as:t[l+1]+=r;case rs:r=t[l+1],u.push(ns,r,a),l+=2;break;case ds:t[l+1]+=a;case hs:a=t[l+1],u.push(ns,r,a),l+=2;break;case os:t[l+1]+=r,t[l+2]+=a;case ns:r=t[l+1],a=t[l+2],u.push(ns,r,a),l+=3;break;case _s:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,i=us;case us:o=n===ls||n===us,h=o?2*r-e:t[l+1],d=o?2*a-s:t[l+2],e=t[l+1],s=t[l+2],r=t[l+3],a=t[l+4],u.push(ls,h,d,e,s,r,a),l+=5;break;case cs:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,t[l+5]+=r,t[l+6]+=a,i=ls;case ls:e=t[l+3],s=t[l+4],r=t[l+5],a=t[l+6],u.push(ls,t[l+1],t[l+2],e,s,r,a),l+=7;break;case vs:t[l+1]+=r,t[l+2]+=a,i=ys;case ys:o=n===ps||n===ys,e=o?2*r-e:t[l+1],s=o?2*a-s:t[l+2],r=t[l+1],a=t[l+2],u.push(ps,e,s,r,a),l+=3;break;case gs:t[l+1]+=r,t[l+2]+=a,t[l+3]+=r,t[l+4]+=a,i=ps;case ps:e=t[l+1],s=t[l+2],r=t[l+3],a=t[l+4],u.push(ps,e,s,r,a),l+=5;break;case ms:t[l+6]+=r,t[l+7]+=a;case fs:u.push(...Bs(r,a,t[l+1],t[l+2],t[l+3],t[l+4],t[l+5],t[l+6],t[l+7])),r=t[l+6],a=t[l+7],l+=8;break;case ws:case xs:u.push(xs),l++}n=i}return u},pushData(t,e){bs.index===bs.length&&(bs.index=1,t.push(bs.name)),t.push(e),bs.index++}},{current:bs,pushData:Ts}=Es,{M:Rs,L:Cs,C:Ps,Q:Ls,Z:ks,ellipse:Ss}=Ne,{toTwoPointBounds:Ms}=ts,{add:Ds,addPoint:Os,setPoint:As}=R,Ws={},Is={smoothCorner:(t,e,s)=>t,toTwoPointBounds(t,e){let s,i,n,o,r,a,h,d=0;const l=t.length;for(;d<l;)switch(s=t[d],0===d&&(s===Rs?As(e,t[1],t[2]):As(e,0,0)),s){case Rs:case Cs:i=t[d+1],n=t[d+2],Os(e,i,n),d+=3;break;case Ps:a=t[d+5],h=t[d+6],Ms(i,n,t[d+1],t[d+2],t[d+3],t[d+4],a,h,Ws),Ds(e,Ws),i=a,n=h,d+=7;break;case Ls:o=t[d+1],r=t[d+2],a=t[d+3],h=t[d+4],Ms(i,n,o,r,o,r,a,h,Ws),Ds(e,Ws),i=a,n=h,d+=5;break;case ks:d+=1}e.minX--,e.minY--,e.maxX++,e.maxY++},drawData(t,e){if(e){let s,i=0,n=e.length;for(;i<n;)switch(s=e[i],s){case Rs:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Cs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ps:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ls:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ks:t.closePath(),i+=1;break;case Ss:t.ellipse(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}}}};let Ns;const{M:Fs,L:zs,C:js,Q:Ys,Z:Xs,rect:Hs,roundRect:Us,ellipse:Gs,arc:Ks,arcTo:Vs}=Ne,qs={begin(t){Ns=t},end(){Ns=null},moveTo(t,e){Ns.push(Fs,t,e)},lineTo(t,e){Ns.push(zs,t,e)},bezierCurveTo(t,e,s,i,n,o){Ns.push(js,t,e,s,i,n,o)},quadraticCurveTo(t,e,s,i){Ns.push(Ys,t,e,s,i)},close(t){Ns.push(Xs),t&&(Ns=null)},rect(t,e,s,i){Ns.push(Hs,t,e,s,i)},roundRect(t,e,s,i,n){Ns.push(Us,t,e,s,i,n)},ellipse(t,e,s,i,n,o,r,a){Ns.push(Gs,t,e,s,i,n,o,r,a)},arc(t,e,s,i,n,o){Ns.push(Ks,t,e,s,i,n,o)},arcTo(t,e,s,i,n){Ns.push(Vs,t,e,s,i,n)}},Qs=V.get("plugin"),Zs={list:[]};function $s(t,e){if(Zs.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:Qs.error(t+" non-existent")})),t.run(s)}else Qs.error("no dependencies")}class Js{constructor(t){this.taskTime=1,this.id=a.create(a.TASK),this.task=t}run(){return K(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 ti=V.get("TaskProcessor");class ei{get isComplete(){return this._isComplete}get running(){return this._running}constructor(t){this.parallel=6,this.params={},this.list=[],this.index=0,t&&(this.params=t,t.parallel&&(this.parallel=t.parallel)),this.init()}get percent(){const t=this.list.length;let e=0,s=0;for(let i=0;i<t;i++)i<=this.index?(s+=this.list[i].taskTime,i===this.index&&(e=s)):e+=this.list[i].taskTime;let i=this._isComplete?1:s/e;return Number.isNaN(i)&&(i=0),i}get total(){return this.list.length}get runIndex(){return this.index}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!1}empty(){this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){this._running=!1,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new Js(t),e)}addParallel(t,e){const s=new Js(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new Js(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.runTask())}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.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.index+this.parallelSuccessNumber+s;if(e.length){if(!this._running)return;i<this.list.length&&(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.nextTask()}nextTask(){setTimeout((()=>{this.run()}),0)}onComplete(){this.stop(),this._isComplete=!0,this.params.onComplete&&this.params.onComplete()}onTask(t){t.complete(),this.params.onTask&&this.params.onTask(),this.index===this.list.length-1&&this.onComplete()}onParallelError(t){ti.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class si{constructor(t,s){this.updatedList=new e,this.totalTimes=0,this.changed=!0,this.config={},this.target=t,s&&(this.config=n.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.changed=!1,this.update()}stop(){this.running=!1}update(){this.running&&(this.changed=!0,this.target.emit(Vt.REQUEST))}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===jt.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new Gt(Gt.DATA,{updatedList:this.updatedList})),this.updatedList=new e,this.totalTimes++,this.changed=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Yt.CHANGE,this.__onAttrChange,this),t.on__([jt.ADD,jt.REMOVE],this.__onChildEvent,this),t.on__(Gt.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.target=null,this.updatedList=null)}}const{updateAllWorldMatrix:ii,updateAllWorldOpacity:ni}=de,{pushAllChildBranch:oi,pushAllParent:ri}=ge;const{worldBounds:ai}=pe,{setByListWithHandle:hi}=N;class di{constructor(t){this.updatedBounds=new Y,this.beforeBounds=new Y,this.afterBounds=new Y,t instanceof Array&&(t=new e(t)),this.updatedList=t}setBefore(){hi(this.beforeBounds,this.updatedList.list,ai)}setAfter(){hi(this.afterBounds,this.updatedList.list,ai),this.__computeChange()}merge(t){this.updatedList.pushList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}__computeChange(){const{updatedBounds:t}=this;t.setByList([this.beforeBounds,this.afterBounds]),t.isEmpty()||(t.spread(2),t.ceil())}destroy(){this.updatedList=null}}const{updateAllWorldMatrix:li,updateAllChange:ci}=de,{pushAllBranchStack:ui,updateWorldBoundsByBranchStack:_i}=ge;class pi{constructor(t,e){this.totalTimes=0,this.changed=!0,this.config={partLayout:{maxTimes:3}},this.__levelList=new s,this.target=t,e&&(this.config=n.default(e,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}layout(){if(!this.running)return;const{target:t}=this,{LAYOUT:e,END:s}=Kt;this.times=0,this.changed=!1,t.emit(Kt.START),this.layoutOnce(),t.emitEvent(new Kt(e,this.layoutedBlocks)),t.emitEvent(new Kt(s,this.layoutedBlocks)),this.layoutedBlocks=null}layoutOnce(){this.totalTimes++,this.times++,this.target.emit(Gt.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout()}partLayout(){var t;if(!(null===(t=this.__updateList)||void 0===t?void 0:t.length))return;const e=$.start("PartLayout"),{target:s,__updateList:i}=this,{BEFORE_ONCE:n,ONCE:o,AFTER_ONCE:r}=Kt,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new Kt(n,a)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&(s.matrixChanged?(ii(t),e.push(t),t.__isBranch&&oi(t,e),ri(t,e)):s.boundsChanged&&(e.push(t),t.__isBranch&&(t.__tempNumber=0),ri(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&&ni(t),t.__updateChange()}))}(i),a.forEach((t=>{t.setAfter()})),s.emitEvent(new Kt(o,a)),s.emitEvent(new Kt(r,a)),this.setBlocks(a),this.__levelList.reset(),this.__updateList=null,$.end(e),this.__checkAgain()}fullLayout(){const t=$.start("FullLayout"),{target:s}=this,{BEFORE_ONCE:i,ONCE:n,AFTER_ONCE:o}=Kt,r=this.getBlocks(new e(s));s.emitEvent(new Kt(i,r)),pi.fullLayout(s),r.forEach((t=>{t.setAfter()})),s.emitEvent(new Kt(n,r)),s.emitEvent(new Kt(o,r)),this.setBlocks(r),$.end(t),this.__checkAgain()}static fullLayout(t){if(li(t),t.__isBranch){const e=[t];ui(t,e),_i(e)}else t.__updateWorldBounds();ci(t)}createBlock(t){return new di(t)}getBlocks(t){return[this.createBlock(t)]}setBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__checkAgain(){this.changed&&this.times<=this.config.partLayout.maxTimes&&this.target.emit(Kt.AGAIN)}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Kt.REQUEST,this.layout,this),t.on__(Kt.AGAIN,this.layoutOnce,this),t.on__(Gt.DATA,this.__onReceiveWatchData,this),t.on__(Vt.REQUEST,this.update,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.target=null)}}const gi=V.get("Renderer");class yi{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=n.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed||this.__requestRender(),this.changed=!0}requestLayout(){this.target.emit(Kt.REQUEST)}render(t){const{target:e}=this;this.times=0,gi.log(e.innerId,"---\x3e"),e.emit(Vt.START),this.renderOnce(t),e.emit(Vt.RENDER),e.emit(Vt.END),gi.log(e.innerId,"---|")}renderOnce(t){const{target:e}=this;this.times++,this.totalTimes++,this.changed=!1,t?(e.emit(Vt.BEFORE_ONCE),t()):(this.requestLayout(),e.emit(Vt.BEFORE_ONCE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),e.emit(Vt.ONCE),e.emit(Vt.AFTER_ONCE),this.updateBlocks=null,this.__checkAgain()}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return gi.warn("PartRender: layoutedBlocks is empty"),void this.fullRender(t.bounds);e.some((t=>t.includes(this.target.__world)))?(this.mergeBlocks(),this.clipRender(this.updateBlocks[0],!0)):e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e.getIntersect(t.bounds))}))}clipRender(t,e){const s=$.start("PartRender"),{canvas:i,target:n}=this;i.save(),i.clearBounds(t),V.showRepaint&&i.strokeBounds(t,"red"),i.clipBounds(t),n.__render(i,e?{}:{bounds:t}),i.restore(),$.end(s)}fullRender(t){const{canvas:e,target:s}=this;yi.fullRender(s,e,t)}static fullRender(t,e,s){const i=$.start("FullRender");s||(s=e.bounds),e.save(),e.clear(),t.__render(e,e.bounds.includes(t.__world)?{}:{bounds:s}),e.restore(),$.end(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Y;e.setByList(t),this.updateBlocks=[e]}}__checkAgain(){this.changed&&this.times<3&&this.target.emit(Vt.AGAIN)}__requestRender(){const t=Date.now();bt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}__onResize(t){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;new Y(0,0,e,s).includes(this.target.__world)||(this.target.__updateAttr("fill"),this.update())}}__onLayoutEnd(t){t.data.map((t=>this.addBlock(t.updatedBounds)))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Vt.REQUEST,this.update,this),t.on__(Kt.END,this.__onLayoutEnd,this),t.on__(Vt.AGAIN,this.renderOnce,this),t.on__(Ht.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:vi}=N;class fi{constructor(t,e){this.target=t,this.selector=e}getHitPointPath(t,s,i){const n=!!i&&i.through;this.exclude=i?i.exclude:null,this.isStop=!1,this.point={x:t.x,y:t.y,radiusX:s,radiusY:s},this.eachFind(this.target.children);const{leaf:o}=this,{defaultPath:r}=this.selector,a=this.getPath(o);let h;if(a.pushList(r.list),n){const t=this.throughPath=new e;this.eachThroughFind(this.target.children),t.pushList(r.list),h={path:a,leaf:o,throughPath:t}}else h={path:a,leaf:o};return this.clear(),h}getPath(t){const s=new e;for(;t;)s.push(t),t=t.parent;return s}eachThroughFind(t){let e;const{point:s}=this;for(let i=t.length-1;i>-1;i--)if(e=t[i],!e.__interactionOff&&vi(e.__world,s)){if(e.__isBranch&&(e.__childrenInteractionOff||this.eachThroughFind(e.children)),this.exclude&&this.exclude.has(e))continue;e.__hitWorld(s)&&this.throughPath.push(e)}}eachFind(t){let e;const{point:s}=this;for(let i=t.length-1;i>-1&&(e=t[i],e.__interactionOff||(vi(e.__world,s)&&(e.__isBranch?(e.__childrenInteractionOff||this.eachFind(e.children),e.__isBranchLeaf&&(this.isStop||this.hitChild(e,s))):this.hitChild(e,s)),!this.isStop));i--);}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&(this.leaf=t,this.isStop=!0)}clear(){this.point=null,this.leaf=null,this.throughPath=null,this.exclude=null}destroy(){this.target=null,this.selector=null}}class mi{constructor(t){this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,this.defaultPath=new e(t),this.pathFinder=new fi(t,this),this.__listenEvents()}getHitPointPath(t,e,s){return this.pathFinder.getHitPointPath(t,e,s)}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,n=s.length;i<n;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__(jt.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.pathFinder.destroy(),this.target=null,this.pathFinder=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}function xi(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 wi=[];function Bi(){return(t,e)=>{wi.push(e)}}class Ei{bindContextMethod(){let t;wi.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}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,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/n*h;n+=s,s=0,r+=t,h-=t}this.context.drawImage(t,e,s,i,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,s,i,n);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,n,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,n,o){}arcTo(t,e,s,i,n){}ellipse(t,e,s,i,n,o,r,a){}rect(t,e,s,i){}roundRect(t,e,s,i,n){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,n,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}G([xi("imageSmoothingEnabled")],Ei.prototype,"smooth",void 0),G([xi("imageSmoothingQuality")],Ei.prototype,"smoothLevel",void 0),G([xi("globalAlpha")],Ei.prototype,"opacity",void 0),G([xi("globalCompositeOperation")],Ei.prototype,"blendMode",void 0),G([xi()],Ei.prototype,"fillStyle",void 0),G([xi()],Ei.prototype,"strokeStyle",void 0),G([xi("lineWidth")],Ei.prototype,"strokeWidth",void 0),G([xi("lineCap")],Ei.prototype,"strokeCap",void 0),G([xi("lineJoin")],Ei.prototype,"strokeJoin",void 0),G([xi("lineDash")],Ei.prototype,"dashPattern",void 0),G([xi("lineDashOffset")],Ei.prototype,"dashOffset",void 0),G([xi()],Ei.prototype,"miterLimit",void 0),G([xi()],Ei.prototype,"shadowBlur",void 0),G([xi()],Ei.prototype,"shadowColor",void 0),G([xi()],Ei.prototype,"shadowOffsetX",void 0),G([xi()],Ei.prototype,"shadowOffsetY",void 0),G([xi()],Ei.prototype,"filter",void 0),G([xi()],Ei.prototype,"font",void 0),G([xi()],Ei.prototype,"fontKerning",void 0),G([xi()],Ei.prototype,"fontStretch",void 0),G([xi()],Ei.prototype,"fontVariantCaps",void 0),G([xi()],Ei.prototype,"textAlign",void 0),G([xi()],Ei.prototype,"textBaseline",void 0),G([xi()],Ei.prototype,"textRendering",void 0),G([xi()],Ei.prototype,"wordSpacing",void 0),G([xi()],Ei.prototype,"letterSpacing",void 0),G([xi()],Ei.prototype,"direction",void 0),G([Bi()],Ei.prototype,"setTransform",null),G([Bi()],Ei.prototype,"resetTransform",null),G([Bi()],Ei.prototype,"getTransform",null),G([Bi()],Ei.prototype,"save",null),G([Bi()],Ei.prototype,"restore",null),G([Bi()],Ei.prototype,"translate",null),G([Bi()],Ei.prototype,"scale",null),G([Bi()],Ei.prototype,"rotate",null),G([Bi()],Ei.prototype,"fill",null),G([Bi()],Ei.prototype,"stroke",null),G([Bi()],Ei.prototype,"clip",null),G([Bi()],Ei.prototype,"fillRect",null),G([Bi()],Ei.prototype,"strokeRect",null),G([Bi()],Ei.prototype,"clearRect",null),G([Bi()],Ei.prototype,"beginPath",null),G([Bi()],Ei.prototype,"moveTo",null),G([Bi()],Ei.prototype,"lineTo",null),G([Bi()],Ei.prototype,"bezierCurveTo",null),G([Bi()],Ei.prototype,"quadraticCurveTo",null),G([Bi()],Ei.prototype,"closePath",null),G([Bi()],Ei.prototype,"arc",null),G([Bi()],Ei.prototype,"arcTo",null),G([Bi()],Ei.prototype,"ellipse",null),G([Bi()],Ei.prototype,"rect",null),G([Bi()],Ei.prototype,"roundRect",null),G([Bi()],Ei.prototype,"createConicGradient",null),G([Bi()],Ei.prototype,"createLinearGradient",null),G([Bi()],Ei.prototype,"createPattern",null),G([Bi()],Ei.prototype,"createRadialGradient",null),G([Bi()],Ei.prototype,"fillText",null),G([Bi()],Ei.prototype,"measureText",null),G([Bi()],Ei.prototype,"strokeText",null);const bi=V.get("LeaferCanvas"),Ti={width:1,height:1,pixelRatio:1};class Ri extends Ei{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}constructor(t,e){if(super(),t||(t=Ti),this.manager=e,this.innerId=a.create(a.CNAVAS),t.view){const{view:e}=t;let s="string"==typeof e?document.getElementById(e):e;if(s)if(s instanceof HTMLCanvasElement)this.view=s;else{if(s===window||s===document){const t=document.createElement("div"),{style:e}=t;e.position="absolute",e.top=e.bottom=e.left=e.right="0px",e.overflow="hidden",document.body.appendChild(t),s=t}this.view=document.createElement("canvas"),s.appendChild(this.view)}else bi.error(`can't find view by id: ${e}`)}this.view||(this.view=document.createElement("canvas")),this.pixelRatio=t.pixelRatio,t.webgl||(this.context=this.view.getContext("2d"),this.smooth=!0,t.fill&&(this.view.style.backgroundColor=t.fill),t.width&&t.height&&this.resize(t),this.bindContextMethod())}debug(){}pixel(t){return t*this.pixelRatio}autoLayout(t,e){const s=s=>{const{x:i,y:n,width:o,height:r}=t.getBoundsFrom(s),{style:a}=this.view;if(a.marginLeft=i+"px",a.marginTop=n+"px",o!==this.width||r!==this.height){const{pixelRatio:t}=this,s={width:o,height:r,pixelRatio:t},i={width:this.width,height:this.height,pixelRatio:this.pixelRatio};this.resize(s),void 0!==this.width&&e(new Ht(s,i))}};this.resizeObserver=new ResizeObserver((t=>{for(const e of t)s(e.contentRect)}));const i=this.view.parentElement;i&&(this.resizeObserver.observe(i),s(i.getBoundingClientRect()))}stopAutoLayout(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}resize(t){const{style:e}=this.view,{width:s,height:i,pixelRatio:n}=t;if(this.isSameSize(t))return;let o;this.context&&this.width&&(o=this.getSameCanvas(),o.copy(this)),Object.assign(this,{width:s,height:i,pixelRatio:n}),this.bounds=new Y(0,0,s,i),e.width=s+"px",e.height=i+"px",this.view.width=s*n,this.view.height=i*n,this.context&&o&&(this.copy(o),o.recycle())}setWorld(t,e,s){const{pixelRatio:i}=this;if(e)if(s)this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,(t.e+e.e)*i,(t.f+e.f)*i);else{const{a:s,b:n,c:o,d:r,e:a,f:h}=e;this.setTransform((t.a*s+t.b*o)*i,(t.a*n+t.b*r)*i,(t.c*s+t.d*o)*i,(t.c*n+t.d*r)*i,(t.e*s+t.f*o+a)*i,(t.e*n+t.f*r+h)*i)}else this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i)}useSameTransform(t){this.setTransform(t.getTransform())}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&(this.strokeCap=s.strokeCap,this.strokeJoin=s.strokeJoin,this.dashPattern=s.dashPattern,this.miterLimit=s.miterLimit)}setShadow(t,e,s,i){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=s*n,this.shadowColor=i||"black"}setBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}hitPath(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t){return this.context.isPointInStroke(t.x,t.y)}replaceBy(t,e,s){t.save(),this.blendMode="copy",this.copy(t,e,s),t.restore()}copy(t,e,s,i){if(e){s||(s=e);const{pixelRatio:n}=this;i&&(this.blendMode=i),this.drawImage(t.view,e.x*n,e.y*n,e.width*n,e.height*n,s.x*n,s.y*n,s.width*n,s.height*n),i&&(this.blendMode="normal")}else this.drawImage(t.view,0,0)}copyWorldToLocal(t,e,s,i){const{pixelRatio:n}=this;i&&(this.blendMode=i),e.b||e.c?(this.save(),this.resetTransform(),this.copy(t,e,N.tempTimesMatrix(s,e)),this.restore()):this.drawImage(t.view,e.x*n,e.y*n,e.width*n,e.height*n,s.x,s.y,s.width,s.height),i&&(this.blendMode="normal")}fillBounds(t,e,s){const{pixelRatio:i}=this;s&&(this.blendMode=s),this.fillStyle=e,this.fillRect(t.x*i,t.y*i,t.width*i,t.height*i),s&&(this.blendMode="normal")}strokeBounds(t,e,s){const{pixelRatio:i}=this;s&&(this.blendMode=s),this.strokeStyle=e,this.strokeRect(t.x*i,t.y*i,t.width*i,t.height*i),s&&(this.blendMode="normal")}clearBounds(t){const{pixelRatio:e}=this;this.clearRect(t.x*e,t.y*e,t.width*e,t.height*e)}clipBounds(t){const{pixelRatio:e}=this;this.beginPath(),this.rect(t.x*e,t.y*e,t.width*e,t.height*e),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:e,height:s,pixelRatio:i}=this,n=this.manager.get({width:e,height:s,pixelRatio:i});return n.manager||(n.manager=this.manager),n.save(),t&&n.useSameTransform(this),n}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:n}=this;t&&(s+=t),e&&(i+=e);const o=this.manager.get({width:s,height:i,pixelRatio:n});return o.manager||(o.manager=this.manager),o.save(),o}recycle(){this.restore(),this.manager.recycle(this)}destroy(){this.view&&(super.destroy(),this.stopAutoLayout(),this.manager=null,this.view&&this.view.parentElement&&this.view.remove(),this.view=null,this.bounds=null)}}CanvasRenderingContext2D.prototype.roundRect||(CanvasRenderingContext2D.prototype.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,n){let o,r,a,h;if(n instanceof Array)switch(n.length){case 4:o=n[0],r=n[1],a=n[2],h=n[3];break;case 2:o=a=n[0],r=h=n[1];break;case 3:o=n[0],r=h=n[1],a=n[2];break;case 1:n=n[0];break;default:n=0}if(void 0===o){if(!n)return void this.rect(t,e,s,i);o=r=a=h=n}const d=Math.min(s/2,i/2);o>d&&(o=d),r>d&&(r=d),a>d&&(a=d),h>d&&(h=d);const l=this;o?l.moveTo(t+o,e):l.moveTo(t,e),r?l.arcTo(t+s,e,t+s,e+i,r):l.lineTo(t+s,e),a?l.arcTo(t+s,e+i,t,e+i,a):l.lineTo(t+s,e+i),h?l.arcTo(t,e+i,t,e,h):l.lineTo(t,e+i),o?l.arcTo(t,e,t+s,e,o):l.lineTo(t,e),l.closePath()});class Ci{constructor(t){this.options=t,this.load()}load(){return new Promise(((t,e)=>{let s=this.options.url,i=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=t=>{console.error(t,this),e(new Error("load Image error"))},i.src=s.includes("?")?s+"&xhr":s+"?xhr"}))}destory(){}}class Pi{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Me.START,this.moveData)}t.path=this.moveData.path,e.emit(Me.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Ae.START,this.zoomData)}t.path=this.zoomData.path,e.emit(Ae.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(De.START,this.rotateData)}t.path=this.rotateData.path,e.emit(De.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(Me.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(Ae.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(De.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Li={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)=>Object.assign(Object.assign({},e),{list:t}),getSwipeDirection:t=>t<-45&&t>-135?Oe.UP:t>45&&t<135?Oe.DOWN:t<=45&&t>=-45?Oe.RIGHT:Oe.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:ki.getSwipeDirection(B.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}),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,s){const i=new e,{list:n}=t;for(let t=0,e=n.length;t<e;t++)n[t].hasEvent(s)&&i.push(n[t]);return i}},ki=Li,{getDragEventData:Si,getDropEventData:Mi,getSwipeEventData:Di,filterPathByEventType:Oi}=Li;class Ai{constructor(t){this.interaction=t}setDragData(t){this.dragData=Si(t,t,t)}getDragList(){return this.dragging?Se.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!Re.middle(t)&&!Re.left(t))return void s.pointerCancel();const{dragData:n}=this;this.moving||(this.moving=(Re.middle(t)||Te.isHoldSpaceKey())&&e,this.moving&&s.emit(Me.START,n)),this.moving||this.dragStart(t,e);const{path:o,throughPath:r}=i;this.dragData=Si(i,n,t),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?s.emit(Me.MOVE,this.dragData):this.dragging&&(s.emit(Le.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=Re.left(t)&&e,this.dragging&&(this.interaction.emit(Le.START,this.dragData),this.dragList=Oi(this.dragData.path,Le.DRAG),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.draggable){this.dragableList=[e];break}}dragDragableList(){if(this.dragableList){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{de.moveOfWorld(s,t,e)}))}}dropEnterOrLeave(t){const{interaction:e}=this,{dropEnterPath:s}=this,{path:i}=t;e.emit(Se.ENTER,t,i,s),e.emit(Se.LEAVE,t,s,i),this.dropEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:n}=s,o=Si(s,t,t);n&&(o.throughPath=n),o.path=i,this.moving&&e.emit(Me.END,o),this.dragging&&(e.emit(Le.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(B.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Di(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Mi(this.getDragList(),t);e.path=this.dropEnterPath,this.interaction.emit(Se.DROP,e),this.interaction.emit(Se.LEAVE,t,this.dropEnterPath)}dragReset(){Se.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dropEnterPath=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,{autoMoveDistance:i}=e.config.pointer;if(!i)return;const n=e.shrinkCanvasBounds,{x:o,y:r}=n,a=N.right(n),h=N.bottom(n),d=t.x<o?i:a<t.x?-i:0,l=t.y<r?i:h<t.y?-i:0;let c=0,u=0;this.autoMoveTimer=setInterval((()=>{c+=d,u+=l,N.move(s,d,l),N.move(this.dragData,d,l),e.move(Object.assign(Object.assign({},t),{moveX:d,moveY:l,totalX:c,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const{pathHasEventType:Wi}=Li;class Ii{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,through:!1,clickTime:120,longPressTime:800,transformTime:500,dragDistance:2,swipeDistance:20,autoMoveDistance:2,ignoreMove:!1}},this.clickCount=0,this.target=t,this.canvas=e,this.selector=s,this.transformer=new Pi(this),this.dragger=new Ai(this),i&&(this.config=n.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(Pe.BEFORE_DOWN,t,this.selector.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getHitPointPath(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(Pe.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),Re.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(Pe.BEFORE_MOVE,t,this.selector.defaultPath),this.downData){const e=B.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.getHitPointPath(t,this.hitRadius,{exclude:this.dragger.getDragList()});t.path=e.path,this.emit(Pe.MOVE,t),this.pointerEnterOrLeave(t),this.dragger.dragging&&this.dragger.dropEnterOrLeave(t)}pointerUp(t){if(!this.downData)return;this.emit(Pe.BEFORE_UP,t,this.selector.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getHitPointPath(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(Pe.UP,t),this.emit(Pe.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.longTap(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()}pointerEnterOrLeave(t){if(this.dragger.moving||this.dragger.dragging)return;const{path:e}=t;this.emit(Pe.ENTER,t,e,this.enterPath),this.emit(Pe.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Pe.LEAVE,t),this.dragger.dragging&&this.emit(Se.LEAVE,t))}tap(t){if(!this.waitTap)return;this.clickCount||this.emit(Pe.TAP,t);Date.now()-this.downTime<this.config.pointer.clickTime+50&&Wi(t.path,Pe.DOUBLE_CLICK)?(this.clickCount++,2===this.clickCount?(this.tapWaitCancel(),this.emit(Pe.DOUBLE_CLICK,t)):(clearTimeout(this.clickTimer),this.clickTimer=window.setTimeout((()=>{this.tapWaitCancel(),this.emit(Pe.CLICK,t)}),this.config.pointer.clickTime))):(this.tapWaitCancel(),this.emit(Pe.CLICK,t))}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.clickTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.clickTimer),this.waitTap=!1,this.clickCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=window.setTimeout((()=>{this.longPressed=!0,this.emit(Pe.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){this.longPressed&&this.emit(Pe.LONG_TAP,t),this.longPressWaitCancel()}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new Y(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Ht.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let n;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let o=s.length-1;o>-1;o--)if(n=s.list[o],n.hasEvent(t,!0)&&(!i||!i.has(n))){e.phase=1;const s=St.event(t,e);if(n.emitEvent(s,!0),s.isStop)return}for(let o=0,r=s.length;o<r;o++)if(n=s.list[o],n.hasEvent(t,!1)&&(!i||!i.has(n))){e.phase=n===e.target?2:3;const s=St.event(t,e);if(n.emitEvent(s),s.isStop)return}}(t,e,s,i)}destroy(){this.target&&(this.running=!1,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 Ni={convert(t,e){const s=Li.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=Li.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=Ni.getTouch(t),i=Li.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]},Fi={getData(t,e){const s=B.getCenter(t[0],t[1]),i=B.getCenter(e[0],e[1]),n={x:i.x-s.x,y:i.y-s.y},o=B.getDistance(t[0],t[1]),r=B.getDistance(e[0],e[1])/o,a=B.getAngle(t[0],t[1]),h=B.getAngle(e[0],e[1]);return{move:n,scale:r,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}};let zi=0;const ji={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n){const e=t.mozInputSource&&t.deltaY%18==0;e?zi++:zi=0,s=(Math.floor(t.deltaY)!==t.deltaY||e&&zi>2)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){o=d.within(o,0,1);i=1-r/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-o)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:Yi,getZoomEventData:Xi,getRotateEventData:Hi}=Li;class Ui extends Ii{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.__onResize(),this.viewEvents={pointerdown:this.onPointerDown.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onTouchStart.bind(this),wheel:this.onWheel.bind(this),gesturestart:this.onGesturestart.bind(this),gesturechange:this.onGesturechange.bind(this),gestureend:this.onGestureend.bind(this)},this.windowEvents={pointermove:this.onPointerMove.bind(this),pointerup:this.onPointerUp.bind(this),pointercancel:this.onPointerCancel.bind(this),mousemove:this.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchmove:this.onTouchMove.bind(this),touchend:this.onTouchEnd.bind(this),touchcancel:this.onTouchCancel.bind(this),keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this)};for(let e in this.viewEvents)t.addEventListener(e,this.viewEvents[e]);for(let t in this.windowEvents)window.addEventListener(t,this.windowEvents[t]);window.oncontextmenu=function(){return!1}}__removeListenEvents(){super.__removeListenEvents();for(let t in this.viewEvents)this.view.removeEventListener(t,this.viewEvents[t]),this.viewEvents={};for(let t in this.windowEvents)window.removeEventListener(t,this.windowEvents[t]),this.windowEvents={}}__onResize(){super.__onResize(),this.clientBounds=new Y(this.view.getBoundingClientRect())}getLocal(t){return{x:t.clientX-this.clientBounds.x,y:t.clientY-this.clientBounds.y}}onKeyDown(t){Te.setDownCode(t.code)}onKeyUp(t){Te.setUpCode(t.code)}onPointerDown(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||(t.preventDefault(),this.pointerDown(Ni.convert(t,this.getLocal(t))))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Ni.convert(t,this.getLocal(t)))}onPointerUp(t){this.useMutiTouch||(t.preventDefault(),this.pointerUp(Ni.convert(t,this.getLocal(t))))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerDown(Ni.convertMouse(t,this.getLocal(t))))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Ni.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerUp(Ni.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=Ni.getTouch(t);this.pointerDown(Ni.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Ni.getTouch(t);this.pointerMove(Ni.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(t.preventDefault(),this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=window.setTimeout((()=>{this.useTouch=!1}),500);const e=Ni.getTouch(t);this.pointerUp(Ni.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Fi.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Fi.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 n=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],o=[this.getLocal(s),this.getLocal(i)],{move:r,angle:a,scale:h,center:d}=Fi.getData(n,o),l=Li.getBase(t);this.rotate(Hi(d,a,l)),this.zoom(Xi(d,h,l)),this.move(Yi(d,r,l)),this.touches=e}}}mutiTouchEnd(){this.touches=null,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){t.preventDefault();const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):ji.getScale(t,e),i=this.getLocal(t),n=Li.getBase(t);1!==s?this.zoom(Xi(i,s,n)):this.move(Yi(i,e.getMove?e.getMove(t,e):ji.getMove(t,e),n))}onGesturestart(t){t.preventDefault(),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){t.preventDefault();const e=this.getLocal(t),s=Li.getBase(t),i=t.scale/this.lastGestureScale,n=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=d.within(o,0,1),this.zoom(Xi(e,i*i,s)),this.rotate(Hi(e,n/Math.PI*180*(o/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){t.preventDefault(),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function Gi(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__.__useEffect=!0,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),yt(e,s,t)}}Object.assign(St,{canvas:(t,e)=>new Ri(t,e),image:t=>new Ci(t),hitCanvas:(t,e)=>new Ri(t,e),watcher:t=>new si(t),layouter:t=>new pi(t),renderer:(t,e,s)=>new yi(t,e,s),selector:t=>new mi(t),interaction:(t,e,s,i)=>new Ui(t,e,s,i)}),bt.requestRender=function(t){window.requestAnimationFrame(t)},bt.canvas=St.canvas();class Ki extends r{setFill(t){"string"==typeof t?(this._fill=t,this.__isFills&&(this.__isFills=!1)):t instanceof Array?(this._fill=t,this.__isFills=!0):"object"==typeof t?(this._fill=[t],this.__isFills=!0):(this._fill=t,this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"==typeof t?(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1)):t instanceof Array?(this._stroke=t,this.__isStrokes=!0):"object"==typeof t?(this._stroke=[t],this.__isStrokes=!0):(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this._shadow=t instanceof Array?t:[t]}setInnerShadow(t){this._innerShadow=t instanceof Array?t:[t]}}class Vi extends Ki{}const{parse:qi}=Es;const{copyAndSpread:Qi}=N,Zi={__updateEventBounds(){Qi(this.__layout.eventBounds,this.__layout.boxBounds,this.__layout.eventBoundsSpreadWidth)},__updateRenderBounds(){Qi(this.__layout.renderBounds,this.__layout.eventBounds,this.__layout.renderBoundsSpreadWidth)},__updateEventBoundsSpreadWidth(){let t=0;const{stroke:e,strokeAlign:s}=this.__;if(e&&"inside"!==s){const{strokeWidth:e,miterLimit:i,path:n}=this.__,o=n?1/Math.sin(i*l/2)*Math.sqrt(e):0;t="center"===s?e/2:e,this.__.__strokeOuterWidth=t,o&&(t+=o-t)}return t||(this.__.__strokeOuterWidth=0),t},__updateRenderBoundsSpreadWidth(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:n}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),n&&(o=Math.max(o,n)),this.__layout.renderShapeBoundsSpreadWidth=o,t}},$i={__hit(t){if(this.__.fill&&this.__hitCanvas.hitPath(t,this.__.windingRule))return!0;if(this.__.__strokeOuterWidth){const e=2*(this.__.__strokeOuterWidth+t.radiusX),{__hitCanvas:s}=this;if(s.strokeWidth!==e&&(s.strokeWidth=e,s.stroke()),s.hitStroke(t))return!0}return!1}},Ji={},tn={},en={},sn={};function nn(t,e){t.forEach((t=>{e.strokeStyle=t.style,e.stroke()}))}var on=Object.freeze({__proto__:null,fill:function(t,e,s){e.fillStyle=s,e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:n}=t.__;for(let t=0,o=s.length;t<o;t++)i=s[t],e.fillStyle=i.style,e.fill(n)},stroke:function(t,e,s){const i=t.__,{strokeWidth:n,strokeAlign:o}=i;switch(o){case"center":e.setStroke(void 0,n,i),e.strokeStyle=s,e.stroke();break;case"inside":e.save(),e.setStroke(void 0,2*n,i),e.clip(i.windingRule),e.strokeStyle=s,e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);t.__drawRenderPath(o),o.setStroke(void 0,2*n,t.__),o.strokeStyle=s,o.stroke(),o.clip(i.windingRule),o.clearBounds(t.__layout.renderBounds),e.copyWorldToLocal(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokes:function(t,e,s){const i=t.__,{strokeWidth:n,strokeAlign:o}=i;switch(o){case"center":e.setStroke(void 0,n,i),nn(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*n,i),e.clip(i.windingRule),nn(s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,r=e.getSameCanvas(!0);t.__drawRenderPath(r),r.setStroke(void 0,2*n,t.__),nn(s,r),r.clip(i.windingRule),r.clearBounds(o),e.copyWorldToLocal(r,t.__world,o),r.recycle()}}});Object.assign(tn,on);const rn={__updateChange(){let t=this.__;t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?this.__complex=!0:this.__complex&&(this.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&tn.fill(this,t,s),i&&tn.stroke(this,t,i)},__draw(t,e){if(this.__complex){const{fill:e,stroke:s}=this.__;this.__drawRenderPath(t),e&&(this.__.__isFills?tn.fills(this,t,e):tn.fill(this,t,e)),s&&(this.__.__isStrokes?tn.strokes(this,t,s):tn.stroke(this,t,s))}else this.__drawFast(t,e)}},an={__render(t,e){const{fill:s,stroke:i}=this.__;i&&(this.__.stroke=void 0),this.__renderRect(t,e);const{clip:n}=this.__;n?(t.save(),t.clip(),this.__renderGroup(t,e),t.restore()):this.__renderGroup(t,e),i&&(this.__.stroke=i,s&&(this.__.fill=void 0),this.__renderRect(t,e),s&&(this.__.fill=s))}},hn={__drawFast(t,e){const{width:s,height:i,fill:n,stroke:o}=this.__;if(n&&(t.fillStyle=n,t.fillRect(0,0,s,i)),o){const{strokeAlign:e,strokeWidth:n}=this.__;t.setStroke(o,n,this.__);const r=n/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(r,r,s-n,i-n);break;case"outside":t.strokeRect(-r,-r,s+n,i+n)}}}},dn={__drawFast(t,e){const{fill:s,stroke:i,content:n,__font:o}=this.__;t.font=o,s&&(t.fillStyle=s,t.fillText(n,0,0)),i&&(t.strokeStyle=i,t.strokeText(n,0,0))}};dn.__draw=dn.__drawFast;let ln=class extends he{get worldTransform(){return this.__layout.getTransform("world")}get relativeTransform(){return this.__layout.getTransform("relative")}get worldBoxBounds(){return this.__layout.getBounds("world","box")}get worldRenderBounds(){return this.__layout.getBounds("world","render")}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?Is.smoothCorner(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){}};G([pt(Ki)],ln.prototype,"__",void 0),G([it("")],ln.prototype,"id",void 0),G([it("")],ln.prototype,"name",void 0),G([it("")],ln.prototype,"className",void 0),G([ut(1)],ln.prototype,"opacity",void 0),G([ut(!0)],ln.prototype,"visible",void 0),G([_t(0)],ln.prototype,"zIndex",void 0),G([nt(0)],ln.prototype,"x",void 0),G([nt(0)],ln.prototype,"y",void 0),G([at(100)],ln.prototype,"width",void 0),G([at(100)],ln.prototype,"height",void 0),G([ot(1)],ln.prototype,"scaleX",void 0),G([ot(1)],ln.prototype,"scaleY",void 0),G([rt(0)],ln.prototype,"rotation",void 0),G([rt(0)],ln.prototype,"skewX",void 0),G([rt(0)],ln.prototype,"skewY",void 0),G([ct()],ln.prototype,"blendMode",void 0),G([at()],ln.prototype,"mask",void 0),G([it()],ln.prototype,"locked",void 0),G([ct()],ln.prototype,"fill",void 0),G([dt()],ln.prototype,"stroke",void 0),G([dt("center")],ln.prototype,"strokeAlign",void 0),G([dt(1)],ln.prototype,"strokeWidth",void 0),G([ct("none")],ln.prototype,"strokeCap",void 0),G([ct("miter")],ln.prototype,"strokeJoin",void 0),G([ct()],ln.prototype,"dashPattern",void 0),G([ct()],ln.prototype,"dashOffset",void 0),G([ct(10)],ln.prototype,"miterLimit",void 0),G([ht()],ln.prototype,"cornerRadius",void 0),G([ht()],ln.prototype,"cornerSmoothing",void 0),G([Gi()],ln.prototype,"shadow",void 0),G([Gi()],ln.prototype,"innerShadow",void 0),G([Gi()],ln.prototype,"blur",void 0),G([Gi()],ln.prototype,"backgroundBlur",void 0),G([Gi()],ln.prototype,"grayscale",void 0),G([xt(Is.drawData)],ln.prototype,"__drawPathByData",null),ln=G([Et(Zi),Et($i),Et(rn),wt()],ln);let cn=class extends ln{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){}};G([pt(Vi)],cn.prototype,"__",void 0),cn=G([Et(Ee),Mt()],cn);let un=class extends ln{constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:n}=this.__;n?t.roundRect(0,0,s,i,n):t.rect(0,0,s,i)}};G([pt(class extends Ki{})],un.prototype,"__",void 0),un=G([Et(hn),Mt()],un);const _n=un.prototype,pn=cn.prototype,gn={},{copy:yn,add:vn}=N;let fn=class extends cn{constructor(t){super(t),this.fill||(this.fill="#FFFFFF"),this.__isBranchLeaf=!0}__drawPathByData(t,e){}__updateBoxBounds(){if(this.__updateRectBoxBounds(),!this.__.clip){const{boxBounds:t}=this.__layout;yn(gn,t),super.__updateBoxBounds(),vn(t,gn)}}__updateEventBounds(){if(this.__updateRectEventBounds(),!this.__.clip){const{eventBounds:t}=this.__layout;yn(gn,t),super.__updateEventBounds(),vn(t,gn)}}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.clip){const{renderBounds:t}=this.__layout;yn(gn,t),super.__updateRenderBounds(),vn(t,gn)}}__updateRectBoxBounds(){}__updateRectEventBounds(){}__updateRectRenderBounds(){}__renderRect(t,e){}__renderGroup(t,e){}};G([pt(class extends Vi{})],fn.prototype,"__",void 0),G([at(!0)],fn.prototype,"clip",void 0),G([xt(_n.__drawPathByData)],fn.prototype,"__drawPathByData",null),G([xt(_n.__updateBoxBounds)],fn.prototype,"__updateRectBoxBounds",null),G([xt(_n.__updateEventBounds)],fn.prototype,"__updateRectEventBounds",null),G([xt(_n.__updateRenderBounds)],fn.prototype,"__updateRectRenderBounds",null),G([xt(_n.__render)],fn.prototype,"__renderRect",null),G([xt(pn.__render)],fn.prototype,"__renderGroup",null),fn=G([Et(an),wt(),Mt()],fn);const{PI:mn}=Math,{begin:xn,moveTo:wn,close:Bn,ellipse:En}=qs;let bn=class extends ln{constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:n}=this.__,o=t/2,r=e/2;xn(this.__.path=[]),s?i||n?(En(o,r,o*(1-s),r*(1-s),0,i*l,n*l,!1),En(o,r,o,r,0,n*l,i*l,!0),Bn()):(En(o,r,o*(1-s),r*(1-s),0,0,2*mn,!1),wn(t,r),En(o,r,o,r,0,0,2*mn,!0)):i||n?(wn(o,r),En(o,r,o,r,0,i*l,n*l,!1),Bn()):En(o,r,o,r,0,0,2*mn,!1)}};G([pt(class extends Ki{})],bn.prototype,"__",void 0),G([ht(0)],bn.prototype,"innerRadius",void 0),G([ht(0)],bn.prototype,"startAngle",void 0),G([ht(0)],bn.prototype,"endAngle",void 0),bn=G([Mt()],bn);const{sin:Tn,cos:Rn,PI:Cn}=Math,{begin:Pn,moveTo:Ln,lineTo:kn,close:Sn}=qs;let Mn=class extends ln{constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,n=e/2;Pn(this.__.path=[]),Ln(i,0);for(let t=1;t<s;t++)kn(i+i*Tn(2*t*Cn/s),n-n*Rn(2*t*Cn/s));Sn()}};G([pt(class extends Ki{})],Mn.prototype,"__",void 0),G([ht(3)],Mn.prototype,"sides",void 0),Mn=G([Mt()],Mn);const{sin:Dn,cos:On,PI:An}=Math,{begin:Wn,moveTo:In,lineTo:Nn,close:Fn}=qs;let zn=class extends ln{constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,n=t/2,o=e/2;Wn(this.__.path=[]),In(n,0);for(let t=1;t<2*s;t++)Nn(n+(t%2==0?n:n*i)*Dn(t*An/s),o-(t%2==0?o:o*i)*On(t*An/s));Fn()}};G([pt(class extends Ki{})],zn.prototype,"__",void 0),G([ht(5)],zn.prototype,"points",void 0),G([ht(.38)],zn.prototype,"innerRadius",void 0),zn=G([Mt()],zn);const{begin:jn,moveTo:Yn,lineTo:Xn,end:Hn}=qs,{rotate:Un,getAngle:Gn,getDistance:Kn,defaultPoint:Vn}=B,{setPoint:qn,addPoint:Qn,toBounds:Zn}=R,$n={};let Jn=class extends ln{get toPoint(){if(this.__toPoint&&!this.__layout.boxBoundsChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Un(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Kn(Vn,t),this.rotation=Gn(Vn,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){jn(this.__.path=[]),Yn(0,0);const t=this.toPoint;Xn(t.x,t.y),Hn()}__updateBoxBounds(){qn($n,0,0),Qn($n,this.__toPoint.x,this.__toPoint.y),Zn($n,this.__layout.boxBounds)}};G([pt(class extends Ki{})],Jn.prototype,"__",void 0),G([at()],Jn.prototype,"rotation",void 0),Jn=G([Mt()],Jn);const{toTwoPointBounds:to}=Is,{toBounds:eo}=R,so={};let io=class extends ln{constructor(t){super(t)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__updateBoxBounds(){to(this.__.path,so),eo(so,this.__layout.boxBounds)}};G([pt(class extends Ki{setPath(t){this._path="string"==typeof t?qi(t):t}})],io.prototype,"__",void 0),G([ht()],io.prototype,"path",void 0),G([ht()],io.prototype,"windingRule",void 0),io=G([Mt()],io);let no=class extends cn{constructor(t){super(t)}__updatePath(){}};G([pt(class extends Ki{})],no.prototype,"__",void 0),G([ht()],no.prototype,"paths",void 0),no=G([Mt()],no);let oo=class extends ln{constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i}=this.__;t.rect(0,0,s,i)}__updateBoxBounds(){const{fontFamily:t,fontSize:e,fontWeight:s,italic:i,textCase:n,lineHeight:o}=this.__,r=this.__layout.boxBounds;this.__.__font=bt.canvas.font=`${i?"italic":""} ${"small-caps"===n?"small-caps":"normal"} ${s||"normal"} ${e}px/${o||e}px ${t}`;const a=bt.canvas.measureText(this.content).width,h=e;r.x=0,r.y=.75*-e,r.width=a,r.height=h}};G([pt(class extends Ki{})],oo.prototype,"__",void 0),G([at("")],oo.prototype,"content",void 0),G([at("arial")],oo.prototype,"fontFamily",void 0),G([at(12)],oo.prototype,"fontSize",void 0),G([at("normal")],oo.prototype,"fontWeight",void 0),G([at(!1)],oo.prototype,"italic",void 0),G([at("normal")],oo.prototype,"textCase",void 0),G([at("normal")],oo.prototype,"textDecoration",void 0),G([at()],oo.prototype,"letterSpacing",void 0),G([at()],oo.prototype,"lineHeight",void 0),G([at()],oo.prototype,"paragraphIndent",void 0),G([at()],oo.prototype,"paragraphSpacing",void 0),oo=G([Et(dn),Mt()],oo);let ro=class extends un{constructor(t){super(t)}__updateBoxBounds(){this.__image=St.image(this)}drawFill(){}};G([pt(class extends Ki{})],ro.prototype,"__",void 0),G([at("")],ro.prototype,"url",void 0),G([at("")],ro.prototype,"thumb",void 0),ro=G([Mt()],ro);class ao extends cn{get isApp(){return!1}constructor(e,s){var n;super(),this.config={zoom:!0,move:!0,start:!0,pixelRatio:devicePixelRatio},this.__eventIds=[],this.__setAsLeafer(),this.__setConfig(e);const{config:o}=this;this.creator=St,this.canvas=St.canvas(o),this.renderer=St.renderer(this,this.canvas,o),this.isApp?this.__level=1:(this.watcher=St.watcher(this),this.layouter=St.layouter(this)),this.__checkAutoLayout(o),s?(null===(n=s.selector)||void 0===n||n.defaultPath.unshift(this),this.selector=s.selector,this.interaction=s.interaction,this.canvasManager=s.canvasManager,this.hitCanvasManager=s.hitCanvasManager,this.imageManager=s.imageManager,s.running&&setTimeout(this.start.bind(this))):(this.selector=St.selector(this),this.interaction=St.interaction(this,this.canvas,this.selector,o),this.canvasManager=new t(this),this.hitCanvasManager=new i(this),this.imageManager=new Ie(this,o),$.start("FullCreate"),o.start&&setTimeout(this.start.bind(this))),this.canvasManager.add(this.canvas),this.__listenEvents()}__listenEvents(){this.once(Kt.END,this.__setAsRoot.bind(this))}__removeListenEvents(){this.off__(this.__eventIds)}__setConfig(t){t&&(this.config=n.default(t,this.config))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new X(t),this.canvas.autoLayout(this.autoLayout,this.__onResize.bind(this)))}start(){var t;this.running||($.endOfName("FullCreate"),this.__interactiveWindow(),null===(t=this.interaction)||void 0===t||t.start(),this.renderer.start(),this.layouter.start(),this.watcher.start(),this.running=!0)}stop(){var t;this.running&&(null===(t=this.interaction)||void 0===t||t.stop(),this.watcher.stop(),this.layouter.stop(),this.renderer.stop(),this.running=!1)}__interactiveWindow(){const{zoom:t,move:e}=this.config;if(e){const{MOVE:e}=Me,{ZOOM:s}=Ae;this.hasEvent(e)||this.__eventIds.push(this.on__(e,(t=>{de.moveOfWorld(this,t.moveX,t.moveY)}))),t&&!this.hasEvent(s)&&this.__eventIds.push(this.on__(s,(t=>{de.zoomOfWorld(this,t.scale,t)})))}}resize(t){if(this.canvas.isSameSize(t))return;const{width:e,height:s,pixelRatio:i}=this.canvas,n={width:e,height:s,pixelRatio:i};this.canvas.resize(t),this.__onResize(new Ht(t,n))}__onResize(t){this.emitEvent(t),setTimeout((()=>{this.canvasManager.clearRecycled()}),0)}destory(){var t;this.canvas&&(super.destroy(),this.__removeListenEvents(),this.parent||(null===(t=this.interaction)||void 0===t||t.destroy(),this.selector.destroy(),this.renderer.destroy(),this.watcher.destroy(),this.layouter.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory()),this.canvas.destroy(),this.canvas=null,this.creator=null,this.config=null,this.interaction=null,this.selector=null,this.renderer=null,this.watcher=null,this.layouter=null,this.canvasManager=null,this.hitCanvasManager=null,this.imageManager=null,this.zoomLayer=null,this.moveLayer=void 0,this.parent=void 0)}}function ho(){return(t,e)=>{const s={get(){return this.canvas[e]},set(t){const{width:s,height:i,pixelRatio:n}=this.canvas,o={width:s,height:i,pixelRatio:n};o[e]=t,this.resize(o)}};Object.defineProperty(t,e,s)}}G([ho()],ao.prototype,"width",void 0),G([ho()],ao.prototype,"height",void 0),G([ho()],ao.prototype,"pixelRatio",void 0);class lo extends ao{get isApp(){return!0}constructor(t){super(t),this.children=[]}start(){this.children.forEach((t=>{t.start()})),this.renderer.start(),this.running=!0}stop(){this.children.forEach((t=>{t.stop()})),this.renderer.stop(),this.running=!1}addLeafer(t){const e=new ao(this.__getChildConfig(t),this);this.add(e);const{renderer:s}=this;return this.__eventIds.push(e.on__(Kt.END,this.__onChildLayoutEnd,this),e.on__(Vt.END,s.update,s),this.on__(Kt.REQUEST,s.mergeBlocks,s)),e}__onChildLayoutEnd(t){const{renderer:e}=this;t.current.config.usePartRender?t.data.map((t=>e.addBlock(t.updatedBounds))):e.addBlock(e.canvas.bounds)}__render(t,e){this.children.forEach((e=>{t.copy(e.canvas)}))}__onResize(t){this.emitEvent(t),this.children.forEach((e=>{e.resize(t)}))}__getChildConfig(t){let e=Object.assign({},this.config);return(t=t?n.default(t,e):e).view=null,this.autoLayout&&(t.width=this.width,t.height=this.height,t.pixelRatio=this.pixelRatio),t}destory(){super.destory();const{children:t}=this;t.length&&(t.forEach((t=>t.destory())),t.length=0)}}export{en as Animate,lo as App,Yt as AttrEvent,X as AutoBounds,ts as BezierHelper,Y as Bounds,N as BoundsHelper,Ee as Branch,ge as BranchHelper,t as CanvasManager,jt as ChildEvent,St as Creator,n as DataHelper,V as Debug,Le as DragEvent,Se as DropEvent,Ji as Effect,bn as Ellipse,zt as Event,Rt as EventCreator,sn as Export,fn as Frame,an as FrameRender,cn as Group,i as HitCanvasManager,ro as Image,Ie as ImageManager,a as IncrementId,Ui as Interaction,We as KeyEvent,Te as Keyboard,Kt as LayoutEvent,pi as Layouter,he as Leaf,ee as LeafBounds,pe as LeafBoundsHelper,r as LeafData,qt as LeafDataProxy,Nt as LeafEventer,de as LeafHelper,ne as LeafHit,s as LeafLevelList,e as LeafList,Jt as LeafMatrix,oe as LeafRender,ao as Leafer,Ri as LeaferCanvas,Ci as LeaferImage,Jn as Line,d as MathHelper,T as Matrix,_ as MatrixHelper,Me as MoveEvent,Xe as NumberPathCommandLengthMap,Ye as NumberPathCommandMap,l as OneRadian,tn as Paint,io as Path,Ne as PathCommandMap,ze as PathCommandNeedConvertMap,Es as PathConvert,qs as PathCreator,Is as PathHelper,bt as Platform,Zs as Plugin,b as Point,B as PointHelper,Re as PointerButton,Pe as PointerEvent,Mn as Polygon,un as Rect,hn as RectRender,Vt as RenderEvent,yi as Renderer,Ht as ResizeEvent,De as RotateEvent,$ as Run,mi as Selector,zn as Star,U as StringNumberMap,Oe as SwipeEvent,Js as TaskItem,ei as TaskProcessor,oo as Text,dn as TextRender,Ut as TransformEvent,H as TwoPointBounds,R as TwoPointBoundsHelper,ln as UI,Zi as UIBounds,Lt as UICreator,Ce as UIEvent,$i as UIHit,rn as UIRender,no as Vector,Gt as WatchEvent,si as Watcher,Ae as ZoomEvent,dt as affectEventBoundsType,lt as affectRenderBoundsType,st as aliasType,at as boundsType,pt as dataProcessor,it as dataType,yt as defineDataProcessor,tt as defineKey,Gi as effectType,et as getDescriptor,gt as layoutProcessor,ut as opacityType,ht as pathType,nt as positionType,Dt as registerEvent,Mt as registerUI,xt as rewrite,wt as rewriteAble,rt as rotationType,ot as scaleType,_t as sortType,ct as surfaceType,Et as useModule,$s as usePlugin};
|
|
1
|
+
class t{constructor(t){this.list=[],this.leafer=t}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,n=s.length;i<n;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e;const i=this.leafer.creator.canvas(t);return this.add(i),i}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(),this.leafer=null}}class e{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,n=e.length;i<n;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 e;return this.list.forEach((e=>{t.push(e)})),t}reset(){this.list=[],this.keys={}}destroy(){this.list=null}}class s{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 i extends t{constructor(){super(...arguments),this.pathTypeList=new e,this.imageTypeList=new e}get(t){}getImageType(t,e){return this.imageTypeList.push(t),this.leafer.creator.hitCanvas(e)}getPathType(t){return this.pathTypeList.push(t),this.leafer.creator.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 n={default:(t,e)=>(o(e,t),o(t,e),t),assign(t,e){let s;Object.keys(e).forEach((i=>{var n;s=e[i],(null==s?void 0:s.constructor)===Object&&(null===(n=t[i])||void 0===n?void 0:n.constructor)===Object?o(t[i],e[i]):t[i]=e[i]}))},clone:t=>JSON.parse(JSON.stringify(t))},{assign:o}=n;class r{constructor(t){this.__leaf=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]}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}destroy(){this.__leaf=null}}const a={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",types:{},create(t){const{types:e}=h;return e[t]?e[t]++:(e[t]=1,0)}},h=a,l={within:(t,e,s)=>(t<e&&(t=e),t>s&&(t=s),t)},d=Math.PI/180,{sin:c,cos:u}=Math,_={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},tempMatrix:{},set(t,e=1,s=0,i=0,n=1,o=0,r=0){t.a=e,t.b=s,t.c=i,t.d=n,t.e=o,t.f=r},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},scale(t,e,s=e){t.a*=e,t.d*=s,t.c*=e,t.b*=s,t.e*=e,t.f*=s},rotate(t,e){const s=e*d,i=u(s),n=c(s),{a:o,b:r,c:a,d:h,e:l,f:_}=t;t.a=o*i-r*n,t.b=o*n+r*i,t.c=a*i-h*n,t.d=a*n+h*i,t.e=l*i-_*n,t.f=l*n+_*i},times(t,e){const{a:s,b:i,c:n,d:o,e:r,f:a}=t;t.a=e.a*s+e.b*n,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*n,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*n+r,t.f=e.e*i+e.f*o+a},divide(t,e){p.times(t,p.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=p;return p.copy(e,t),p.invert(e),e},invert(t){const{a:e,b:s,c:i,d:n,e:o,f:r}=t,a=1/(e*n-s*i);t.a=n*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*n-r*i)*a,t.f=-(r*e-o*s)*a},toWorldPoint(t,e,s){const{x:i,y:n}=e;s||(s=e),s.x=i*t.a+n*t.c+t.e,s.y=i*t.b+n*t.d+t.f},toLocalPoint(t,e,s,i){const{x:n,y:o}=e,{a:r,b:a,c:h,d:l}=t,d=1/(r*l-a*h);if(s||(s=e),s.x=(n*l-o*h)*d,s.y=(o*r-n*a)*d,!i){const{e:e,f:i}=t;s.x-=(e*l-i*h)*d,s.y-=(i*r-e*a)*d}},empty(t){t.a=1,t.b=0,t.c=0,t.d=1,t.e=0,t.f=0}},p=_,{toLocalPoint:g,toWorldPoint:y}=_,{sin:v,cos:f,abs:m,sqrt:x,atan2:w}=Math,B={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},rotate(t,e,s){s||(s=E.defaultPoint);const i=f(e*d),n=v(e*d),o=t.x-s.x,r=t.y-s.y;t.x=s.x+o*i-r*n,t.y=s.y+o*n-r*i},tempToLocal(t,e){const{tempPoint:s}=E;return E.copy(s,t),g(e,s,s),s},tempToLocalRadiusPoint(t,e){const{tempRadiusPoint:s}=E;return E.copy(s,t),E.toLocalRadiusPoint(t,e,s),s},toLocalRadiusPoint(t,e,s){s||(s=t),g(e,t,s),s.radiusX=t.radiusX/e.a,s.radiusY=t.radiusY/e.d},toLocal(t,e,s){g(e,t,s)},toWorld(t,e,s){y(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=m(e.x-t.x),i=m(e.y-t.y);return x(s*s+i*i)},getAngle:(t,e)=>E.getAtan2(t,e)/d,getAtan2:(t,e)=>w(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s){const i=E.getAtan2(t,e);return{x:t.x+f(i)*s,y:t.y+v(i)*s}}},E=B;class b{constructor(t,e){"object"==typeof t?B.copy(this,t):B.set(this,t,e)}set(t,e){B.set(this,t,e)}copy(t){return B.copy(this,t),this}clone(){return new b(this)}rotate(t,e){B.rotate(this,t,e)}toLocal(t,e){B.toLocal(this,t,e)}toWorld(t,e){B.toWorld(this,t,e)}getCenter(t){return B.getCenter(this,t)}getDistance(t){return B.getDistance(this,t)}getAngle(t){return B.getAngle(this,t)}getAtan2(t){return B.getAtan2(this,t)}}class T{constructor(t,e,s,i,n,o){"object"==typeof t?_.copy(this,t):_.set(this,t,e,s,i,n,o)}set(t,e,s,i,n,o){_.set(this,t,e,s,i,n,o)}copy(t){return _.copy(this,t),this}clone(){return new T(this)}translate(t,e){return this.e+=t,this.f+=e,this}scale(t,e){return _.scale(this,t,e),this}rotate(t){return _.rotate(this,t),this}times(t){_.times(this,t)}divide(t){_.divide(this,t)}invert(){_.invert(this)}toWorldPoint(t,e){_.toWorldPoint(this,t,e)}toLocalPoint(t,e){_.toLocalPoint(this,t,e)}empty(){_.empty(this)}}const R={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},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}},{tempPointBounds:C,setPoint:P,addPoint:L,toBounds:k}=R,{toWorldPoint:S}=_;let M,D,O,A;const W={},I={},N={tempBounds:{},set(t,e=0,s=0,i=0,n=0){t.x=e,t.y=s,t.width=i,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s){F.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),F.move(t,e,s),t),getOutOfBounds(t,e){const s=-(F.right(e)-t.x),i=-(F.bottom(e)-t.y),n=Object.assign(Object.assign({},t),{offsetX:s,offsetY:i});return F.move(n,-s,-i),n},tempTimesMatrix:(t,e)=>(F.copy(F.tempBounds,t),F.setByBoundsTimesMatrix(F.tempBounds,F.tempBounds,e),F.tempBounds),timesMatrix(t,e){F.setByBoundsTimesMatrix(t,t,e)},getByTimesMatrix:(t,e)=>(t=Object.assign({},t),F.setByBoundsTimesMatrix(t,t,e),t),divideMatrix(t,e){t.x=(t.x-e.e)/e.a,t.y=(t.y-e.f)/e.d,t.width/=e.a,t.height/=e.d},getFitMatrix(t,e){const s=Math.min(1,Math.min(t.width/e.width,t.height/e.height));return new T(s,0,0,s,-e.x*s,-e.y*s)},getSpread(t,e){const s={};return F.copyAndSpread(s,t,e),s},spread(t,e){F.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){M=t.x+t.width,D=t.y+t.height,O=e.x+e.width,A=e.y+e.height,M=M>O?M:O,D=D>A?D:A,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=M-t.x,t.height=D-t.y},addList(t,e){F.setByListWithHandle(t,e,void 0,!0)},setByList(t,e,s=!1){F.setByListWithHandle(t,e,void 0,s)},addListWithHandle(t,e,s){F.setByListWithHandle(t,e,s,!0)},setByListWithHandle(t,e,s,i=!1){if(!e.length)return void F.empty(t);let n,o=!0;for(let r=0,a=e.length;r<a;r++)n=s?s(e[r]):e[r],(n.width||n.height)&&(o?(o=!1,i||j(t,n)):z(t,n))},setByBoundsTimesMatrix(t,e,s){0===s.b&&0===s.c?(t.x=s.e+e.x*s.a,t.y=s.f+e.y*s.d,t.width=e.width*s.a,t.height=e.height*s.d):(W.x=e.x,W.y=e.y,S(s,W,I),P(C,I.x,I.y),W.x=e.x+e.width,S(s,W,I),L(C,I.x,I.y),W.y=e.y+e.height,S(s,W,I),L(C,I.x,I.y),W.x=e.x,S(s,W,I),L(C,I.x,I.y),k(C,t))},setByPoints(t,e){e.forEach(((t,e)=>{0===e?P(C,t.x,t.y):L(C,t.x,t.y)})),k(C,t)},hitRadiusPoint:(t,e,s)=>(s&&(e=B.tempToLocalRadiusPoint(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=B.tempToLocal(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=F.tempTimesMatrix(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=F.tempTimesMatrix(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=F.tempTimesMatrix(e,s));let{x:i,y:n,width:o,height:r}=e;return M=i+o,D=n+r,O=t.x+t.width,A=t.y+t.height,i=i>t.x?i:t.x,n=n>t.y?n:t.y,M=M<O?M:O,D=D<A?D:A,o=M-i,r=D-n,{x:i,y:n,width:o,height:r}},setByIntersect(t,e,s){F.copy(t,F.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,empty(t){t.x=0,t.y=0,t.width=0,t.height=0}},F=N,{add:z,copy:j}=F;class Y{constructor(t,e,s,i){"object"==typeof t?N.copy(this,t):N.set(this,t,e,s,i)}set(t,e,s,i){N.set(this,t,e,s,i)}copy(t){return N.copy(this,t),this}clone(){return new Y(this)}timesMatrix(t){return N.timesMatrix(this,t),this}divideMatrix(t){return N.divideMatrix(this,t),this}getFitMatrix(t){return N.getFitMatrix(this,t)}spread(t){N.spread(this,t)}ceil(){N.ceil(this)}add(t){N.add(this,t)}addList(t){N.setByList(this,t,!0)}setByList(t,e){N.setByList(this,t,e)}addListWithHandle(t,e){N.setByListWithHandle(this,t,e,!0)}setByListWithHandle(t,e,s){N.setByListWithHandle(this,t,e,s)}setByBoundsTimesMatrix(t,e){N.setByBoundsTimesMatrix(this,t,e)}setByPoints(t){N.setByPoints(this,t)}hitPoint(t,e){return N.hitPoint(this,t,e)}hitRadiusPoint(t,e){return N.hitRadiusPoint(this,t,e)}hit(t,e){return N.hit(this,t,e)}includes(t,e){return N.includes(this,t,e)}getIntersect(t,e){return new Y(N.getIntersectData(this,t,e))}setByIntersect(t,e){N.setByIntersect(this,t,e)}isSame(t){return N.isSame(this,t)}isEmpty(){return N.isEmpty(this)}empty(){N.empty(this)}}class X{constructor(t,e,s,i,n,o){"object"==typeof t?this.copy(t):this.set(t,e,s,i,n,o)}set(t=0,e=0,s=0,i=0,n=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=n,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:n,width:o,height:r}=t;this.set(e,s,i,n,o,r)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:n,width:o,height:r}=this;return new Y(n,e,o||t.width-n-s,r||t.height-e-i)}}class H{constructor(t,e){R.setPoint(this,t,e)}addPoint(t,e){R.addPoint(this,t,e)}add(t){R.add(this,t)}}const U={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};function G(t,e,s,i){var n,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,s,r):n(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r}function K(t,e,s,i){return new(s||(s=Promise))((function(n,o){function r(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}h((i=i.apply(t,e||[])).next())}))}class V{constructor(t){this.name=t}static get(t){return new V(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)}error(...t){console.error(this.name,...t)}}var q;V.filterList=[],V.excludeList=[],V.__={},G([(t,e)=>{Object.defineProperty(t,e,{get:()=>t.enable?t.__[e]:q,set(t){this.__[e]=t}})}],V,"showRepaint",void 0);const Q=V;const Z=V.get("RunTime");class ${static start(t,e){const s=a.create(a.RUNTIME);return J.currentId=J.idMap[s]=e?performance.now():Date.now(),J.currentName=J.nameMap[s]=t,J.nameToIdMap[t]=s,s}static end(t,e){const s=J.idMap[t],i=J.nameMap[t];J.idMap[t]=void 0,J.nameMap[t]=void 0,J.nameToIdMap[i]=void 0,e?Z.log(i,performance.now()-s,"µs"):Z.log(i,Date.now()-s,"ms")}static endOfName(t,e){const s=J.nameToIdMap[t];void 0!==s&&J.end(s,e)}}$.idMap={},$.nameMap={},$.nameToIdMap={};const J=$;function tt(t,e,s){Object.defineProperty(t,e,s)}function et(t,e){return Object.getOwnPropertyDescriptor(t,e)}function st(t){return(e,s)=>{tt(e,s,{get(){return this.__get(t)},set(e){this.__set(t,e)}})}}function it(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t)}}),yt(e,s,t)}}function nt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.positionChanged||this.__layout.positionChange()}}),yt(e,s,t)}}function ot(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.scaleChanged||this.__layout.scaleChange()}}),yt(e,s,t)}}function rt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.rotationChanged||this.__layout.rotationChange()}}),yt(e,s,t)}}function at(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.boxBoundsChanged||this.__layout.boxBoundsChange()}}),yt(e,s,t)}}const ht=at;function lt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.eventBoundsChanged||this.__layout.eventBoundsChange()}}),yt(e,s,t)}}function dt(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),yt(e,s,t)}}function ct(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange()}}),yt(e,s,t)}}function ut(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.root?this.__set(s,t):this.__[s]=t,this.__layout.opacityChanged||this.__layout.opacityChange()}}),yt(e,s,t)}}function _t(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.parent?this.parent.__layout.childrenSortChanged=!0:this.__addParentWait((()=>{this.parent.__layout.childrenSortChanged=!0}))}}),yt(e,s,t)}}function pt(t){return(e,s)=>{tt(e,"__DataProcessor",{get:()=>t})}}function gt(t){return(e,s)=>{tt(e,"__LayoutProcessor",{get:()=>t})}}function yt(t,e,s){const i=t.__DataProcessor.prototype,n="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),r={get(){const t=this[n];return void 0===t?s:t},set(t){this[n]=t}};void 0===s&&(r.get=function(){return this[n]});const a=et(i,e);a&&(a.set&&(r.set=a.set),a.get&&(r.get=a.get)),i[o]&&(r.set=i[o],delete i[o]),Object.defineProperty(i,e,r)}const vt=new V("rewrite"),ft=[],mt=["destroy","constructor"];function xt(t){return(e,s)=>{ft.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function wt(){return t=>{Bt()}}function Bt(t){ft.length&&(ft.forEach((e=>{t&&vt.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()})),ft.length=0)}function Et(t){return e=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach((s=>{if(!mt.includes(s))if(t.prototype){et(t.prototype,s).writable&&(e.prototype[s]=t.prototype[s])}else e.prototype[s]=t[s]}))}}setTimeout((()=>Bt(!0)));const bt={},Tt=V.get("EventCreator"),Rt={typeList:{},register(t){let e;Object.keys(t).forEach((s=>{e=t[s],"string"==typeof e&&(Ct[e]?Tt.error("register the repeat EventType: ",e):Ct[e]=t)}))},get:(t,...e)=>new Ct[t](...e)},{typeList:Ct}=Rt,Pt=V.get("UICreator"),Lt={list:{},register(t){const{tag:e}=t.prototype;kt[e]?Pt.error("register the repeat UI: ",e):kt[e]=t},get:(t,e)=>new kt[t](e)},{list:kt}=Lt,St={ui:(t,e)=>Lt.get(t,e),event:(t,...e)=>Rt.get(t,...e)};function Mt(){return t=>{Lt.register(t)}}function Dt(){return t=>{Rt.register(t)}}const{setByBoundsTimesMatrix:Ot}=N;class At{constructor(t){this.leaf=t,this.renderBounds=this.eventBounds=this.boxBounds={x:0,y:0,width:0,height:0},this.relativeRenderBounds=this.relativeEventBounds=t.__relative,this.boxBoundsChange()}update(){const{leafer:t}=this.leaf;t&&t.watcher.changed&&(t.running||t.start(),t.layouter.layout())}getTransform(t){return this.update(),"world"===t?this.leaf.__world:this.leaf.__relative}getBounds(t,e){if(this.update(),"world"===t)switch(e){case"render":return this.leaf.__world;case"box":return this.getWorldBoxBounds();case"event":return this.getWorldEventBounds()}else if("local"===t)switch(e){case"render":return this.renderBounds;case"box":return this.boxBounds;case"event":return this.eventBounds}else switch(e){case"render":return this.relativeRenderBounds;case"box":return this.leaf.__relative;case"event":return this.relativeEventBounds}return this.leaf.__world}getWorldBoxBounds(){return this._worldBoxBounds||(this._worldBoxBounds={}),Ot(this._worldBoxBounds,this.boxBounds,this.leaf.__world),this._worldBoxBounds}getWorldEventBounds(){return this._worldEventBounds||(this._worldEventBounds={}),Ot(this._worldEventBounds,this.eventBounds,this.leaf.__world),this._worldEventBounds}eventBoundsSpreadCancel(){const t=this.renderBounds===this.eventBounds;this.eventBounds=this.boxBounds,this.relativeEventBounds=this.leaf.__relative,t&&this.renderBoundsSpreadCancel()}renderBoundsSpreadCancel(){this.renderBounds=this.eventBounds,this.relativeRenderBounds=this.relativeEventBounds}eventBoundsSpread(){const{x:t,y:e,width:s,height:i}=this.eventBounds;this.eventBounds={x:t,y:e,width:s,height:i},this.relativeEventBounds={x:t,y:e,width:s,height:i},this.renderBoundsSpreadWidth||this.renderBoundsSpreadCancel()}renderBoundsSpread(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this.renderBounds={x:t,y:e,width:s,height:i},this.relativeRenderBounds={x:t,y:e,width:s,height:i}}boxBoundsChange(){this.boxBoundsChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange(),this.hitCanvasChanged=!0}localBoxBoundsChange(){this.localBoxBoundsChanged=!0,this.boundsChanged=!0}eventBoundsChange(){this.eventBoundsChanged=!0,this.eventBoundsSpreadWidth||(this.eventBoundsSpreadWidth=1),this.boundsChanged=!0}renderBoundsChange(){this.renderBoundsChanged=!0,this.renderBoundsSpreadWidth||(this.renderBoundsSpreadWidth=1),this.boundsChanged=!0}positionChange(){this.positionChanged=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChanged=!0,this.localBoxBoundsChanged||this.localBoxBoundsChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}destroy(){this.leaf=null}}const Wt=V.get("Life"),It={},Nt={on(t,e,s){let i,n,o;if(s){const t="boolean"==typeof s;i=t?s:s.capture,n=!t&&s.once}const r=Ft(this,i,!0),a="string"==typeof t?t.split(" "):t,h=n?{listener:e,once:n}:{listener:e};a.forEach((t=>{t&&(o=r[t],o?-1===o.findIndex((t=>t.listener===e))&&o.push(h):r[t]=[h])}))},off(t,e,s){let i,n,o;s&&(i="boolean"==typeof s?s:s.capture);const r=Ft(this,i);("string"==typeof t?t.split(" "):t).forEach((t=>{t&&(n=r[t],n&&(o=n.findIndex((t=>t.listener===e)),o>-1&&n.splice(o,1),n.length||delete r[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){V.enable&&Wt.log(t);const i=Ft(this,s)[t];if(i){let n;for(let o=0,r=i.length;o<r&&(n=i[o],n.listener(e),n.once&&(this.off(t,n.listener,s),o--,r--),!e||!e.isStopNow);o++);}},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 Ft(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:It)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:It)}}class zt{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}}let jt=class extends zt{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}};jt.ADD="child.add",jt.REMOVE="child.remove",jt=G([Dt()],jt);let Yt=class extends zt{constructor(t,e,s,i,n){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=n}};var Xt;Yt.CHANGE="attr.change",Yt=G([Dt()],Yt);let Ht=Xt=class extends zt{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){const s="object"==typeof t;super(s?Xt.RESIZE:t),s&&Object.assign(this,t),this.old=e}};Ht.RESIZE="resize",Ht=Xt=G([Dt()],Ht);let Ut=class extends zt{constructor(t,e){super(t),e&&Object.assign(this,e)}};Ut.BEFORE="transform.before",Ut.CHANGE="transform.change",Ut.AFTER="transform.after",Ut.PRE_BEFORE="transform.pre_before",Ut.PRE_CHANGE="transform.pre_change",Ut.PRE_AFTER="transform.pre_after",Ut=G([Dt()],Ut);let Gt=class extends zt{constructor(t,e){super(t),this.data=e}};Gt.REQUEST="watch.request",Gt.DATA="watch.data",Gt=G([Dt()],Gt);let Kt=class extends zt{constructor(t,e){super(t),e&&(this.data=e)}};Kt.REQUEST="layout.request",Kt.START="layout.start",Kt.BEFORE_ONCE="layout.before_once",Kt.ONCE="layout.once",Kt.AFTER_ONCE="layout.after_once",Kt.AGAIN="layout.again",Kt.LAYOUT="layout",Kt.END="layout.end",Kt=G([Dt()],Kt);let Vt=class extends zt{};Vt.REQUEST="render.request",Vt.START="render.start",Vt.BEFORE_ONCE="render.before_once",Vt.ONCE="render.once",Vt.AFTER_ONCE="render.after_once",Vt.AGAIN="render.again",Vt.RENDER="render",Vt.END="render.end",Vt=G([Dt()],Vt);const qt={__set(t,e){if(this.root){const s=this.__.__getInput(t);s!==e&&(this.__[t]=e,this.root.emitEvent(new Yt(Yt.CHANGE,this,t,s,e)))}else this.__[t]=e},__get(t){return this.__.__getInput(t)},__updateAttr(t){if(this.root){const e=this.__.__getInput(t);this.root.emitEvent(new Yt(Yt.CHANGE,this,t,e,e))}}},{defaultMatrix:Qt}=_,{sin:Zt,cos:$t}=Math,Jt={__updateWorldMatrix(){const t=this.parent?this.parent.__world:Qt,e=this.__relative,s=this.__world;this.__layout.matrixChanged&&this.__updateRelativeMatrix(),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)},__updateRelativeMatrix(){const t=this.__relative,e=this.__layout;if(e.affectScaleOrRotation){const{scaleX:s,scaleY:i}=this.__;if(e.affectRotation){if(e.scaleChanged||e.rotationChanged){let{rotation:n,skewX:o,skewY:r}=this.__;n||o||r?(n*=d,o&&(o*=d),r&&(r*=d),t.a=s*$t(n+r),t.b=s*Zt(n+r),t.c=i*-Zt(n-o),t.d=i*$t(n-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}},{setByBoundsTimesMatrix:te}=N,ee={__updateWorldBounds(){var t,e,s;if(this.__layout.boundsChanged){let i;const n=this.__layout;n.boxBoundsChanged&&(this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),n.boxBoundsChanged=!1,i=!0),n.localBoxBoundsChanged&&(this.__updateRelativeBoxBounds(),n.localBoxBoundsChanged=!1,n.eventBoundsSpreadWidth&&(n.eventBoundsChanged=!0),n.renderBoundsSpreadWidth&&(n.renderBoundsChanged=!0),null===(t=this.parent)||void 0===t||t.__layout.boxBoundsChange()),n.eventBoundsChanged&&(n.eventBoundsSpreadWidth=this.__updateEventBoundsSpreadWidth(),n.eventBoundsSpreadWidth?(n.eventBounds===n.boxBounds&&n.eventBoundsSpread(),this.__updateEventBounds(),this.__updateRelativeEventBounds(),n.eventBoundsChanged=!1,n.renderBoundsSpreadWidth&&(n.renderBoundsChanged=!0)):n.eventBoundsSpreadCancel(),null===(e=this.parent)||void 0===e||e.__layout.eventBoundsChange(),i||(i=!0)),n.renderBoundsChanged&&(n.renderBoundsSpreadWidth=this.__updateRenderBoundsSpreadWidth(),n.renderBoundsSpreadWidth?(n.renderBounds!==n.boxBounds&&n.renderBounds!==n.eventBounds||n.renderBoundsSpread(),this.__updateRenderBounds(),this.__updateRelativeRenderBounds(),n.renderBoundsChanged=!1):n.renderBoundsSpreadCancel(),null===(s=this.parent)||void 0===s||s.__layout.renderBoundsChange()),n.boundsChanged=!1,te(this.__world,this.__layout.renderBounds,this.__world),i&&this.__onUpdateSize()}else te(this.__world,this.__layout.renderBounds,this.__world)},__updateRelativeBoxBounds(){te(this.__relative,this.__layout.boxBounds,this.__relative)},__updateRelativeEventBounds(){te(this.__layout.relativeEventBounds,this.__layout.eventBounds,this.__relative)},__updateRelativeRenderBounds(){te(this.__layout.relativeRenderBounds,this.__layout.renderBounds,this.__relative)},__updateBoxBounds(){const t=this.__layout.boxBounds;t.x=0,t.y=0,t.width=this.__.width,t.height=this.__.height}},{toLocalRadiusPoint:se}=B,ie={},ne={__updateHitCanvas(){this.__hitCanvas||(this.__hitCanvas=this.leafer.hitCanvasManager.getPathType(this)),this.__drawRenderPath(this.__hitCanvas)},__hitWorld(t){return this.__layout.hitCanvasChanged&&(this.__updateHitCanvas(),this.__layout.hitCanvasChanged=!1),se(t,this.__world,ie),this.__hit(ie)}},oe={__render(t,e){this.__worldOpacity&&(t.setWorld(this.__world,e.matrix),t.opacity=this.__worldOpacity,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)}},{LEAF:re,create:ae}=a;let he=class{get tag(){return this.constructor.name}get __DataProcessor(){return r}get __LayoutProcessor(){return At}constructor(t){this.innerId=ae(re),this.__relative={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.__renderTime=2,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),t&&Object.assign(this,t)}__addParentWait(t){this.__parentWait?this.__parentWait.push(t):this.__parentWait=[t]}__runParentWait(){const t=this.__parentWait.length;for(let e=0;e<t;e++)this.__parentWait[e]();this.__parentWait=null}__setAsLeafer(){this.leafer=this}__setAsRoot(){this.__bindRoot(this),this.__isRoot=!0}__bindRoot(t){if(!this.__isRoot&&(this.root=t,this.leafer=t.leafer,this.__level=this.parent?this.parent.__level+1:1,this.__isBranch)){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindRoot(t)}}__set(t,e){}__get(t){}__updateAttr(t){}__updateWorldOpacity(){}__updateWorldMatrix(){}__updateRelativeMatrix(){}__updateWorldBounds(){}__updateRelativeBoxBounds(){}__updateRelativeEventBounds(){}__updateRelativeRenderBounds(){}__updateBoxBounds(){}__updateEventBounds(){}__updateRenderBounds(){}__updateEventBoundsSpreadWidth(){return 0}__updateRenderBoundsSpreadWidth(){return 0}__onUpdateSize(){}__hitWorld(t){return!0}__hit(t){return!0}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}__updateSortChildren(){}add(t,e){}remove(t){}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.__isBranch&&(this.children.forEach((t=>{t.destroy()})),this.children=null),this.__hitCanvas&&(this.__hitCanvas.destroy(),this.__hitCanvas=null),this.leafer=null,this.root=null,this.parent=null,this.__.destroy(),this.__layout.destroy(),this.__=null,this.__layout=null,this.__captureMap=null,this.__bubbleMap=null)}};he=G([Et(qt),Et(Jt),Et(ee),Et(ne),Et(Nt),Et(oe)],he);const le={updateAllWorldMatrix(t){if(t.__updateWorldMatrix(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ce(e[t])}},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)ue(e[t])}},updateAllChange(t){if(ue(t),t.__updateChange(),t.__isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)_e(e[t])}},moveOfWorld(t,e,s){const i={x:e,y:s};t.parent&&_.toLocalPoint(t.parent.__world,i,i,!0),de.move(t,i.x,i.y)},move(t,e,s){t.x=t.__.x+e,t.y=t.__.y+s},zoomOfWorld(t,e,s,i){const n=t.parent?B.tempToLocal(s,t.parent.__world):s;this.zoom(t,e,n,i)},zoom(t,e,s,i){i||(i=t);const{x:n,y:o}=i.__,{scaleX:r,scaleY:a}=t.__,h=s.x-n,l=s.y-o,d=(new T).translate(h,l).scale(e).translate(-h,-l);i.x=n-d.e,i.y=o-d.f,t.scaleX=r*e,t.scaleY=a*e},rotateOfWorld(t,e,s,i){const n=t.parent?B.tempToLocal(s,t.parent.__world):s;this.rotate(t,e,n,i)},rotate(t,e,s,i){i||(i=t);const{x:n,y:o}=i.__,{rotation:r}=t.__,a=s.x-n,h=s.y-o,l=(new T).translate(a,h).rotate(e).translate(-a,-h);i.x=n-l.e,i.y=o-l.f,t.rotation=r+e}},de=le,{updateAllWorldMatrix:ce,updateAllWorldOpacity:ue,updateAllChange:_e}=de,pe={worldBounds:t=>t.__world,relativeBoxBounds:t=>t.__relative,relativeEventBounds:t=>t.__layout.relativeEventBounds,relativeRenderBounds:t=>t.__layout.relativeRenderBounds},ge={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,n=s.length;i<n;i++)(t=s[i]).__isBranch&&(t.__tempNumber=1,e.push(t),ye(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++)ve(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:ye,pushAllBranchStack:ve}=ge,{setByListWithHandle:fe}=N,{sort:me}=ge,{relativeBoxBounds:xe,relativeEventBounds:we,relativeRenderBounds:Be}=pe;class Ee extends he{constructor(){super(),this.__isBranch=!0,this.children=[]}__updateEventBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.eventBoundsSpreadWidth)return 1;return 0}__updateRenderBoundsSpreadWidth(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderBoundsSpreadWidth)return 1;return 0}__updateBoxBounds(){fe(this.__layout.boxBounds,this.children,xe)}__updateEventBounds(){fe(this.__layout.eventBounds,this.children,we)}__updateRenderBounds(){fe(this.__layout.renderBounds,this.children,Be)}__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1)}__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(me)}}__render(t,e){if(this.__worldOpacity){let s;const{bounds:i,hideBounds:n}=e,{children:o}=this;for(let r=0,a=o.length;r<a;r++)s=o[r],i&&!i.hit(s.__world,e.matrix)||n&&n.includes(s.__world)||s.__render(t,e)}}add(t,e){if(t.parent)t.parent!==this&&console.warn("child had other parent, can not add to this, child innerId:"+t.innerId);else{if(t.parent=this,void 0===e?this.children.push(t):this.children.splice(e,0,t),t.__isBranch&&(this.__childBranchNumber?this.__childBranchNumber++:this.__childBranchNumber=1),this.root){t.__bindRoot(this.root);const e=new jt(jt.ADD,t,this);this.hasEvent(jt.ADD)&&this.emitEvent(e),this.root.emitEvent(e)}t.__parentWait&&t.__runParentWait()}}remove(t){if(t){const e=this.children.indexOf(t);if(e>-1){if(this.children.splice(e,1),t.__isBranch&&(this.__childBranchNumber>1?this.__childBranchNumber--:this.__childBranchNumber=0),this.root){const e=new jt(jt.REMOVE,t,this);this.hasEvent(jt.REMOVE)&&this.emitEvent(e),this.root.emitEvent(e),t.root=null}t.parent=null,this.__layout.boxBoundsChange()}}else this.parent&&this.parent.remove(this)}}const be={};class Te{static isHoldSpaceKey(){return Te.hasDownCode("Space")}static setDownCode(t){be[t]||(be[t]=!0)}static setUpCode(t){be[t]=!1}static hasDownCode(t){return be[t]}}class Re{static left(t){return 1===t.buttons}static right(t){return 2===t.buttons}static middle(t){return 4===t.buttons}}class Ce extends zt{get spaceKey(){return Te.isHoldSpaceKey()}get left(){return Re.left(this)}get right(){return Re.right(this)}get middle(){return Re.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}}let Pe=class extends Ce{};Pe.POINTER="pointer",Pe.BEFORE_DOWN="pointer.before_down",Pe.BEFORE_MOVE="pointer.before_move",Pe.BEFORE_UP="pointer.before_up",Pe.DOWN="pointer.down",Pe.MOVE="pointer.move",Pe.UP="pointer.up",Pe.ENTER="pointer.enter",Pe.LEAVE="pointer.leave",Pe.TAP="tap",Pe.CLICK="click",Pe.DOUBLE_CLICK="doubleclick",Pe.LONG_PRESS="longpress",Pe.LONG_TAP="longtap",Pe=G([Dt()],Pe);let Le=class extends Pe{};var ke;Le.DRAG="drag",Le.START="drag.start",Le.END="drag.end",Le=G([Dt()],Le);let Se=ke=class extends Pe{static setList(t){ke.dragList=t instanceof e?t:new e(t)}};Se.DROP="drop",Se.ENTER="drop.enter",Se.LEAVE="drop.leave",Se=ke=G([Dt()],Se);let Me=class extends Le{};Me.MOVE="move",Me.START="move.start",Me.END="move.end",Me=G([Dt()],Me);let De=class extends Ce{};De.ROTATE="rotate",De.START="rotate.start",De.END="rotate.end",De=G([Dt()],De);let Oe=class extends Le{};Oe.SWIPE="swipe",Oe.LEFT="swipe.left",Oe.RIGHT="swipe.right",Oe.UP="swipe.up",Oe.DOWN="swipe.down",Oe=G([Dt()],Oe);let Ae=class extends Ce{};Ae.ZOOM="zoom",Ae.START="zoom.start",Ae.END="zoom.end",Ae=G([Dt()],Ae);let We=class extends Ce{};We.DOWN="key.down",We.PRESS="key.press",We.UP="key.up",We=G([Dt()],We);class Ie{constructor(t,e){this.list=[],this.leafer=t}load(){}destory(){this.leafer=null}}const Ne={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},Fe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,rect:5,roundRect:6,ellipse:9,arc:7,arcTo:6},ze={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,rect:100,roundRect:101,ellipse:102,arc:103,arcTo:104},je=Ne,Ye={};for(let t in je)Ye[je[t]]=t;const Xe={};for(let t in je)Xe[je[t]]=Fe[t];const He={},{sin:Ue,cos:Ge,sqrt:Ke,atan2:Ve,ceil:qe,abs:Qe,PI:Ze}=Math,{setPoint:$e,addPoint:Je}=R,ts={getFromACommand(t,e,s,i,n,o,r,a,h){const l=a-t,d=h-e,c=n*Ze/180,u=Ue(c),_=Ge(c),p=-_*l*.5-u*d*.5,g=-_*d*.5+u*l*.5,y=s*s,v=i*i,f=g*g,m=p*p,x=y*v-y*f-v*m;let w=0;if(x<0){const t=Ke(1-x/(y*v));s*=t,i*=t}else{w=(o===r?-1:1)*Ke(x/(y*f+v*m))}const B=w*s*g/i,E=-w*i*p/s,b=_*B-u*E+.5*l,T=u*B+_*E+.5*d;let R=Ve((g-E)/i,(p-B)/s),C=Ve((-g-E)/i,(-p-B)/s),P=C-R;0===r&&P>0?P-=2*Ze:1===r&&P<0&&(P+=2*Ze);const L=[],k=qe(Qe(P/Ze*2)),S=P/k,M=Ue(S/2),D=Ue(S/4),O=8/3*D*D/M;R=0,C=Ve((g-E)/i,(p-B)/s);let A,W,I,N,F,z,j,Y,X=C-R,H=X+S,U=Ge(X),G=Ue(X),K=0,V=0;for(let n=0;n<k;n++)A=Ge(H),W=Ue(H),I=_*s*A-u*i*W+b,N=u*s*A+_*i*W+T,F=K+O*(-_*s*G-u*i*U),z=V+O*(-u*s*G+_*i*U),j=I+O*(_*s*W+u*i*A),Y=N+O*(u*s*W-_*i*A),L.push(Ne.C,F+t,z+e,j+t,Y+e,I+t,N+e),K=I,V=N,X=H,U=A,G=W,H+=S;return L},toTwoPointBounds(t,e,s,i,n,o,r,a,h){const l=[];let d,c,u,_,p,g,y,v,f=t,m=s,x=n,w=r;for(let t=0;t<2;++t)if(1==t&&(f=e,m=i,x=o,w=a),d=-3*f+9*m-9*x+3*w,c=6*f-12*m+6*x,u=3*m-3*f,Math.abs(d)<1e-12){if(Math.abs(c)<1e-12)continue;_=-u/c,0<_&&_<1&&l.push(_)}else y=c*c-4*u*d,v=Math.sqrt(y),y<0||(p=(-c+v)/(2*d),0<p&&p<1&&l.push(p),g=(-c-v)/(2*d),0<g&&g<1&&l.push(g));$e(h,t,e),Je(h,r,a);for(let d=0,c=l.length;d<c;d++)es.getPointAndSet(l[d],t,e,s,i,n,o,r,a,He),Je(h,He.x,He.y)},getPointAndSet(t,e,s,i,n,o,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*n+_*r+p*h},getPoint(t,e,s,i,n,o,r,a,h){const l={};return es.getPointAndSet(t,e,s,i,n,o,r,a,h,l),l}},es=ts,{M:ss,m:is,L:ns,l:os,H:rs,h:as,V:hs,v:ls,C:ds,c:cs,S:us,s:_s,Q:ps,q:gs,T:ys,t:vs,A:fs,a:ms,Z:xs,z:ws}=Ne,{getFromACommand:Bs}=ts,Es={current:{},stringify(t){let e,s,i,n=0,o=t.length,r="";for(;n<o;){s=t[n],e=Xe[s],r+=s===i?" ":Ye[s];for(let s=1;s<e;s++)r+=t[n+s],s===e-1||(r+=" ");i=s,n+=e}return r},parse(t,e=!0){let s,i,n="";const o=[];for(let e=0,r=t.length;e<r;e++)i=t[e],U[i]?n+=i:Ne[i]?(n&&(Ts(o,Number(n)),n=""),bs.name=Ne[i],bs.length=Fe[i],bs.index=0,Ts(o,bs.name),!s&&ze[i]&&(s=!0)):"-"===i?(n&&Ts(o,Number(n)),n=i):n&&(Ts(o,Number(n)),n="");return n&&Ts(o,Number(n)),e&&s?Es.convertToSimple(o):o},convertToSimple(t){let e,s,i,n,o,r=0,a=0,h=0,l=0,d=0,c=t.length;const u=[];for(;d<c;){switch(i=t[d],i){case is:t[d+1]+=r,t[d+2]+=a;case ss:r=t[d+1],a=t[d+2],u.push(ss,r,a),d+=3;break;case as:t[d+1]+=r;case rs:r=t[d+1],u.push(ns,r,a),d+=2;break;case ls:t[d+1]+=a;case hs:a=t[d+1],u.push(ns,r,a),d+=2;break;case os:t[d+1]+=r,t[d+2]+=a;case ns:r=t[d+1],a=t[d+2],u.push(ns,r,a),d+=3;break;case _s:t[d+1]+=r,t[d+2]+=a,t[d+3]+=r,t[d+4]+=a,i=us;case us:o=n===ds||n===us,h=o?2*r-e:t[d+1],l=o?2*a-s:t[d+2],e=t[d+1],s=t[d+2],r=t[d+3],a=t[d+4],u.push(ds,h,l,e,s,r,a),d+=5;break;case cs:t[d+1]+=r,t[d+2]+=a,t[d+3]+=r,t[d+4]+=a,t[d+5]+=r,t[d+6]+=a,i=ds;case ds:e=t[d+3],s=t[d+4],r=t[d+5],a=t[d+6],u.push(ds,t[d+1],t[d+2],e,s,r,a),d+=7;break;case vs:t[d+1]+=r,t[d+2]+=a,i=ys;case ys:o=n===ps||n===ys,e=o?2*r-e:t[d+1],s=o?2*a-s:t[d+2],r=t[d+1],a=t[d+2],u.push(ps,e,s,r,a),d+=3;break;case gs:t[d+1]+=r,t[d+2]+=a,t[d+3]+=r,t[d+4]+=a,i=ps;case ps:e=t[d+1],s=t[d+2],r=t[d+3],a=t[d+4],u.push(ps,e,s,r,a),d+=5;break;case ms:t[d+6]+=r,t[d+7]+=a;case fs:u.push(...Bs(r,a,t[d+1],t[d+2],t[d+3],t[d+4],t[d+5],t[d+6],t[d+7])),r=t[d+6],a=t[d+7],d+=8;break;case ws:case xs:u.push(xs),d++}n=i}return u},pushData(t,e){bs.index===bs.length&&(bs.index=1,t.push(bs.name)),t.push(e),bs.index++}},{current:bs,pushData:Ts}=Es,{M:Rs,L:Cs,C:Ps,Q:Ls,Z:ks,ellipse:Ss}=Ne,{toTwoPointBounds:Ms}=ts,{add:Ds,addPoint:Os,setPoint:As}=R,Ws={},Is={smoothCorner:(t,e,s)=>t,toTwoPointBounds(t,e){let s,i,n,o,r,a,h,l=0;const d=t.length;for(;l<d;)switch(s=t[l],0===l&&(s===Rs?As(e,t[1],t[2]):As(e,0,0)),s){case Rs:case Cs:i=t[l+1],n=t[l+2],Os(e,i,n),l+=3;break;case Ps:a=t[l+5],h=t[l+6],Ms(i,n,t[l+1],t[l+2],t[l+3],t[l+4],a,h,Ws),Ds(e,Ws),i=a,n=h,l+=7;break;case Ls:o=t[l+1],r=t[l+2],a=t[l+3],h=t[l+4],Ms(i,n,o,r,o,r,a,h,Ws),Ds(e,Ws),i=a,n=h,l+=5;break;case ks:l+=1}e.minX--,e.minY--,e.maxX++,e.maxY++},drawData(t,e){if(e){let s,i=0,n=e.length;for(;i<n;)switch(s=e[i],s){case Rs:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Cs:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ps:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Ls:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ks:t.closePath(),i+=1;break;case Ss:t.ellipse(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}}}};let Ns;const{M:Fs,L:zs,C:js,Q:Ys,Z:Xs,rect:Hs,roundRect:Us,ellipse:Gs,arc:Ks,arcTo:Vs}=Ne,qs={begin(t){Ns=t},end(){Ns=null},moveTo(t,e){Ns.push(Fs,t,e)},lineTo(t,e){Ns.push(zs,t,e)},bezierCurveTo(t,e,s,i,n,o){Ns.push(js,t,e,s,i,n,o)},quadraticCurveTo(t,e,s,i){Ns.push(Ys,t,e,s,i)},close(t){Ns.push(Xs),t&&(Ns=null)},rect(t,e,s,i){Ns.push(Hs,t,e,s,i)},roundRect(t,e,s,i,n){Ns.push(Us,t,e,s,i,n)},ellipse(t,e,s,i,n,o,r,a){Ns.push(Gs,t,e,s,i,n,o,r,a)},arc(t,e,s,i,n,o){Ns.push(Ks,t,e,s,i,n,o)},arcTo(t,e,s,i,n){Ns.push(Vs,t,e,s,i,n)}},Qs=V.get("plugin"),Zs={list:[]};function $s(t,e){if(Zs.list.push(t),t.dependencies){const s={};t.dependencies.forEach((t=>{e[t]?s[t]=e[t]:Qs.error(t+" non-existent")})),t.run(s)}else Qs.error("no dependencies")}class Js{constructor(t){this.taskTime=1,this.id=a.create(a.TASK),this.task=t}run(){return K(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 ti=V.get("TaskProcessor");class ei{get isComplete(){return this._isComplete}get running(){return this._running}constructor(t){this.parallel=6,this.params={},this.list=[],this.index=0,t&&(this.params=t,t.parallel&&(this.parallel=t.parallel)),this.init()}get percent(){const t=this.list.length;let e=0,s=0;for(let i=0;i<t;i++)i<=this.index?(s+=this.list[i].taskTime,i===this.index&&(e=s)):e+=this.list[i].taskTime;let i=this._isComplete?1:s/e;return Number.isNaN(i)&&(i=0),i}get total(){return this.list.length}get runIndex(){return this.index}init(){this.empty(),this.index=0,this.parallelSuccessNumber=0,this._running=!1,this._isComplete=!1}empty(){this.list=[],this.parallelList=[]}start(){this._running=!0,this._isComplete=!1,this.run()}pause(){this._running=!1}resume(){this._running=!0,this._isComplete=!1,this.run()}skip(){this.index++,this.resume()}stop(){this._running=!1,this.list.forEach((t=>{t.complete()})),this.empty()}add(t,e){this.push(new Js(t),e)}addParallel(t,e){const s=new Js(t);s.parallel=!0,this.push(s,e)}addEmpty(t){this.push(new Js(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.runTask())}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.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.index+this.parallelSuccessNumber+s;if(e.length){if(!this._running)return;i<this.list.length&&(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.nextTask()}nextTask(){setTimeout((()=>{this.run()}),0)}onComplete(){this.stop(),this._isComplete=!0,this.params.onComplete&&this.params.onComplete()}onTask(t){t.complete(),this.params.onTask&&this.params.onTask(),this.index===this.list.length-1&&this.onComplete()}onParallelError(t){ti.error("ParallelError"),this.parallelList.forEach((t=>{t.parallel=!1})),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.params.onError&&this.params.onError(t)}}class si{constructor(t,s){this.updatedList=new e,this.totalTimes=0,this.changed=!0,this.config={},this.target=t,s&&(this.config=n.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.changed=!1,this.update()}stop(){this.running=!1}update(){this.running&&(this.changed=!0,this.target.emit(Vt.REQUEST))}__onAttrChange(t){this.updatedList.push(t.target),this.update()}__onChildEvent(t){this.updatedList.push(t.type===jt.REMOVE?t.parent:t.child),this.update()}__onRquestData(){this.target.emitEvent(new Gt(Gt.DATA,{updatedList:this.updatedList})),this.updatedList=new e,this.totalTimes++,this.changed=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Yt.CHANGE,this.__onAttrChange,this),t.on__([jt.ADD,jt.REMOVE],this.__onChildEvent,this),t.on__(Gt.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.target=null,this.updatedList=null)}}const{updateAllWorldMatrix:ii,updateAllWorldOpacity:ni}=le,{pushAllChildBranch:oi,pushAllParent:ri}=ge;const{worldBounds:ai}=pe,{setByListWithHandle:hi}=N;class li{constructor(t){this.updatedBounds=new Y,this.beforeBounds=new Y,this.afterBounds=new Y,t instanceof Array&&(t=new e(t)),this.updatedList=t}setBefore(){hi(this.beforeBounds,this.updatedList.list,ai)}setAfter(){hi(this.afterBounds,this.updatedList.list,ai),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:di,updateAllChange:ci}=le,{pushAllBranchStack:ui,updateWorldBoundsByBranchStack:_i}=ge;class pi{constructor(t,e){this.totalTimes=0,this.changed=!0,this.config={partLayout:{maxTimes:3}},this.__levelList=new s,this.target=t,e&&(this.config=n.default(e,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}layout(){if(!this.running)return;const{target:t}=this,{LAYOUT:e,END:s}=Kt;this.times=0,this.changed=!1,t.emit(Kt.START),this.layoutOnce(),t.emitEvent(new Kt(e,this.layoutedBlocks)),t.emitEvent(new Kt(s,this.layoutedBlocks)),this.layoutedBlocks=null}layoutOnce(){this.totalTimes++,this.times++,this.target.emit(Gt.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout()}partLayout(){var t;if(!(null===(t=this.__updateList)||void 0===t?void 0:t.length))return;const e=$.start("PartLayout"),{target:s,__updateList:i}=this,{BEFORE_ONCE:n,ONCE:o,AFTER_ONCE:r}=Kt,a=this.getBlocks(i);a.forEach((t=>{t.setBefore()})),s.emitEvent(new Kt(n,a)),i.sort(),function(t,e){let s;t.list.forEach((t=>{s=t.__layout,e.without(t)&&(s.matrixChanged?(ii(t),e.push(t),t.__isBranch&&oi(t,e),ri(t,e)):s.boundsChanged&&(e.push(t),t.__isBranch&&(t.__tempNumber=0),ri(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&&ni(t),t.__updateChange()}))}(i),a.forEach((t=>t.setAfter())),s.emitEvent(new Kt(o,a)),s.emitEvent(new Kt(r,a)),this.setBlocks(a),this.__levelList.reset(),this.__updateList=null,$.end(e),this.__checkAgain()}fullLayout(){const t=$.start("FullLayout"),{target:s}=this,{BEFORE_ONCE:i,ONCE:n,AFTER_ONCE:o}=Kt,r=this.getBlocks(new e(s));s.emitEvent(new Kt(i,r)),pi.fullLayout(s),r.forEach((t=>{t.setAfter()})),s.emitEvent(new Kt(n,r)),s.emitEvent(new Kt(o,r)),this.setBlocks(r),$.end(t),this.__checkAgain()}static fullLayout(t){if(di(t),t.__isBranch){const e=[t];ui(t,e),_i(e)}else t.__updateWorldBounds();ci(t)}createBlock(t){return new li(t)}getBlocks(t){return[this.createBlock(t)]}setBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__checkAgain(){this.changed&&this.times<=this.config.partLayout.maxTimes&&this.target.emit(Kt.AGAIN)}__onReceiveWatchData(t){this.__updateList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Kt.REQUEST,this.layout,this),t.on__(Kt.AGAIN,this.layoutOnce,this),t.on__(Gt.DATA,this.__onReceiveWatchData,this),t.on__(Vt.REQUEST,this.update,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.target=null)}}const gi=V.get("Renderer");class yi{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=n.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed||this.__requestRender(),this.changed=!0}requestLayout(){this.target.emit(Kt.REQUEST)}render(t){const{target:e}=this;this.times=0,gi.log(e.innerId,"---\x3e"),e.emit(Vt.START),this.renderOnce(t),e.emit(Vt.RENDER),e.emit(Vt.END),gi.log(e.innerId,"---|")}renderOnce(t){const{target:e}=this;this.times++,this.totalTimes++,this.changed=!1,t?(e.emit(Vt.BEFORE_ONCE),t()):(this.requestLayout(),e.emit(Vt.BEFORE_ONCE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),e.emit(Vt.ONCE),e.emit(Vt.AFTER_ONCE),this.updateBlocks=null,this.__checkAgain()}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return gi.warn("PartRender: layoutedBlocks is empty"),void this.fullRender(t.bounds);e.some((t=>t.includes(this.target.__world)))?(this.mergeBlocks(),this.clipRender(this.updateBlocks[0],!0)):e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e.getIntersect(t.bounds))}))}clipRender(t,e){const s=$.start("PartRender"),{canvas:i,target:n}=this;t.spread(1+1/this.canvas.pixelRatio),t.ceil(),i.save(),i.clearBounds(t),V.showRepaint&&i.strokeBounds(t,"red"),i.clipBounds(t),n.__render(i,e?{}:{bounds:t}),i.restore(),$.end(s)}fullRender(t){const{canvas:e,target:s}=this;yi.fullRender(s,e,t)}static fullRender(t,e,s){const i=$.start("FullRender");s||(s=e.bounds),e.save(),e.clear(),t.__render(e,e.bounds.includes(t.__world)?{}:{bounds:s}),e.restore(),$.end(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Y;e.setByList(t),this.updateBlocks=[e]}}__checkAgain(){this.changed&&this.times<3&&this.target.emit(Vt.AGAIN)}__requestRender(){const t=Date.now();bt.requestRender((()=>{this.changed&&(this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&this.render())}))}__onResize(t){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;new Y(0,0,e,s).includes(this.target.__world)||(this.target.__updateAttr("fill"),this.update())}}__onLayoutEnd(t){t.data.map((t=>this.addBlock(t.updatedBounds)))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Vt.REQUEST,this.update,this),t.on__(Kt.END,this.__onLayoutEnd,this),t.on__(Vt.AGAIN,this.renderOnce,this),t.on__(Ht.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}const{hitRadiusPoint:vi}=N;class fi{constructor(t,e){this.target=t,this.selector=e}getHitPointPath(t,s,i){const n=!!i&&i.through;this.exclude=i?i.exclude:null,this.isStop=!1,this.point={x:t.x,y:t.y,radiusX:s,radiusY:s},this.eachFind(this.target.children);const{leaf:o}=this,{defaultPath:r}=this.selector,a=this.getPath(o);let h;if(a.pushList(r.list),n){const t=this.throughPath=new e;this.eachThroughFind(this.target.children),t.pushList(r.list),h={path:a,leaf:o,throughPath:t}}else h={path:a,leaf:o};return this.clear(),h}getPath(t){const s=new e;for(;t;)s.push(t),t=t.parent;return s}eachThroughFind(t){let e;const{point:s}=this;for(let i=t.length-1;i>-1;i--)if(e=t[i],!e.__interactionOff&&vi(e.__world,s)){if(e.__isBranch&&(e.__childrenInteractionOff||this.eachThroughFind(e.children)),this.exclude&&this.exclude.has(e))continue;e.__hitWorld(s)&&this.throughPath.push(e)}}eachFind(t){let e;const{point:s}=this;for(let i=t.length-1;i>-1&&(e=t[i],e.__interactionOff||(vi(e.__world,s)&&(e.__isBranch?(e.__childrenInteractionOff||this.eachFind(e.children),e.__isBranchLeaf&&(this.isStop||this.hitChild(e,s))):this.hitChild(e,s)),!this.isStop));i--);}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&(this.leaf=t,this.isStop=!0)}clear(){this.point=null,this.leaf=null,this.throughPath=null,this.exclude=null}destroy(){this.target=null,this.selector=null}}class mi{constructor(t){this.innerIdList={},this.idList={},this.classNameList={},this.tagNameList={},this.target=t,this.defaultPath=new e(t),this.pathFinder=new fi(t,this),this.__listenEvents()}getHitPointPath(t,e,s){return this.pathFinder.getHitPointPath(t,e,s)}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,n=s.length;i<n;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__(jt.REMOVE,this.__onRemoveChild,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}destroy(){this.target&&(this.__removeListenEvents(),this.pathFinder.destroy(),this.target=null,this.pathFinder=null,this.innerIdList=null,this.idList=null,this.classNameList=null,this.tagNameList=null)}}function xi(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 wi=[];function Bi(){return(t,e)=>{wi.push(e)}}class Ei{bindContextMethod(){let t;wi.forEach((e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}))}setTransform(t,e,s,i,n,o){}resetTransform(){}getTransform(){}save(){}restore(){}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,n,o,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/n*h;n+=s,s=0,r+=t,h-=t}this.context.drawImage(t,e,s,i,n,o,r,a,h);break;case 5:this.context.drawImage(t,e,s,i,n);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,n,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,n,o){}arcTo(t,e,s,i,n){}ellipse(t,e,s,i,n,o,r,a){}rect(t,e,s,i){}roundRect(t,e,s,i,n){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,n,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}G([xi("imageSmoothingEnabled")],Ei.prototype,"smooth",void 0),G([xi("imageSmoothingQuality")],Ei.prototype,"smoothLevel",void 0),G([xi("globalAlpha")],Ei.prototype,"opacity",void 0),G([xi("globalCompositeOperation")],Ei.prototype,"blendMode",void 0),G([xi()],Ei.prototype,"fillStyle",void 0),G([xi()],Ei.prototype,"strokeStyle",void 0),G([xi("lineWidth")],Ei.prototype,"strokeWidth",void 0),G([xi("lineCap")],Ei.prototype,"strokeCap",void 0),G([xi("lineJoin")],Ei.prototype,"strokeJoin",void 0),G([xi("lineDash")],Ei.prototype,"dashPattern",void 0),G([xi("lineDashOffset")],Ei.prototype,"dashOffset",void 0),G([xi()],Ei.prototype,"miterLimit",void 0),G([xi()],Ei.prototype,"shadowBlur",void 0),G([xi()],Ei.prototype,"shadowColor",void 0),G([xi()],Ei.prototype,"shadowOffsetX",void 0),G([xi()],Ei.prototype,"shadowOffsetY",void 0),G([xi()],Ei.prototype,"filter",void 0),G([xi()],Ei.prototype,"font",void 0),G([xi()],Ei.prototype,"fontKerning",void 0),G([xi()],Ei.prototype,"fontStretch",void 0),G([xi()],Ei.prototype,"fontVariantCaps",void 0),G([xi()],Ei.prototype,"textAlign",void 0),G([xi()],Ei.prototype,"textBaseline",void 0),G([xi()],Ei.prototype,"textRendering",void 0),G([xi()],Ei.prototype,"wordSpacing",void 0),G([xi()],Ei.prototype,"letterSpacing",void 0),G([xi()],Ei.prototype,"direction",void 0),G([Bi()],Ei.prototype,"setTransform",null),G([Bi()],Ei.prototype,"resetTransform",null),G([Bi()],Ei.prototype,"getTransform",null),G([Bi()],Ei.prototype,"save",null),G([Bi()],Ei.prototype,"restore",null),G([Bi()],Ei.prototype,"translate",null),G([Bi()],Ei.prototype,"scale",null),G([Bi()],Ei.prototype,"rotate",null),G([Bi()],Ei.prototype,"fill",null),G([Bi()],Ei.prototype,"stroke",null),G([Bi()],Ei.prototype,"clip",null),G([Bi()],Ei.prototype,"fillRect",null),G([Bi()],Ei.prototype,"strokeRect",null),G([Bi()],Ei.prototype,"clearRect",null),G([Bi()],Ei.prototype,"beginPath",null),G([Bi()],Ei.prototype,"moveTo",null),G([Bi()],Ei.prototype,"lineTo",null),G([Bi()],Ei.prototype,"bezierCurveTo",null),G([Bi()],Ei.prototype,"quadraticCurveTo",null),G([Bi()],Ei.prototype,"closePath",null),G([Bi()],Ei.prototype,"arc",null),G([Bi()],Ei.prototype,"arcTo",null),G([Bi()],Ei.prototype,"ellipse",null),G([Bi()],Ei.prototype,"rect",null),G([Bi()],Ei.prototype,"roundRect",null),G([Bi()],Ei.prototype,"createConicGradient",null),G([Bi()],Ei.prototype,"createLinearGradient",null),G([Bi()],Ei.prototype,"createPattern",null),G([Bi()],Ei.prototype,"createRadialGradient",null),G([Bi()],Ei.prototype,"fillText",null),G([Bi()],Ei.prototype,"measureText",null),G([Bi()],Ei.prototype,"strokeText",null);const bi=V.get("LeaferCanvas"),Ti={width:1,height:1,pixelRatio:1};class Ri extends Ei{get pixelWidth(){return this.width*this.pixelRatio}get pixelHeight(){return this.height*this.pixelRatio}constructor(t,e){if(super(),t||(t=Ti),this.manager=e,this.innerId=a.create(a.CNAVAS),t.view){const{view:e}=t;let s="string"==typeof e?document.getElementById(e):e;if(s)if(s instanceof HTMLCanvasElement)this.view=s;else{if(s===window||s===document){const t=document.createElement("div"),{style:e}=t;e.position="absolute",e.top=e.bottom=e.left=e.right="0px",e.overflow="hidden",document.body.appendChild(t),s=t}this.view=document.createElement("canvas"),s.appendChild(this.view)}else bi.error(`can't find view by id: ${e}`)}this.view||(this.view=document.createElement("canvas")),this.pixelRatio=t.pixelRatio,t.webgl||(this.context=this.view.getContext("2d"),this.smooth=!0,t.fill&&(this.view.style.backgroundColor=t.fill),t.width&&t.height&&this.resize(t),this.bindContextMethod())}debug(){}pixel(t){return t*this.pixelRatio}autoLayout(t,e){const s=s=>{const{x:i,y:n,width:o,height:r}=t.getBoundsFrom(s),{style:a}=this.view;if(a.marginLeft=i+"px",a.marginTop=n+"px",o!==this.width||r!==this.height){const{pixelRatio:t}=this,s={width:o,height:r,pixelRatio:t},i={width:this.width,height:this.height,pixelRatio:this.pixelRatio};this.resize(s),void 0!==this.width&&e(new Ht(s,i))}};this.resizeObserver=new ResizeObserver((t=>{for(const e of t)s(e.contentRect)}));const i=this.view.parentElement;i&&(this.resizeObserver.observe(i),s(i.getBoundingClientRect()))}stopAutoLayout(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}resize(t){const{style:e}=this.view,{width:s,height:i,pixelRatio:n}=t;if(this.isSameSize(t))return;let o;this.context&&this.width&&(o=this.getSameCanvas(),o.copy(this)),Object.assign(this,{width:s,height:i,pixelRatio:n}),this.bounds=new Y(0,0,s,i),e.width=s+"px",e.height=i+"px",this.view.width=s*n,this.view.height=i*n,this.context&&o&&(this.copy(o),o.recycle())}setWorld(t,e,s){const{pixelRatio:i}=this;if(e)if(s)this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,(t.e+e.e)*i,(t.f+e.f)*i);else{const{a:s,b:n,c:o,d:r,e:a,f:h}=e;this.setTransform((t.a*s+t.b*o)*i,(t.a*n+t.b*r)*i,(t.c*s+t.d*o)*i,(t.c*n+t.d*r)*i,(t.e*s+t.f*o+a)*i,(t.e*n+t.f*r+h)*i)}else this.setTransform(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i)}useSameTransform(t){this.setTransform(t.getTransform())}setStroke(t,e,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&(this.strokeCap=s.strokeCap,this.strokeJoin=s.strokeJoin,this.dashPattern=s.dashPattern,this.miterLimit=s.miterLimit)}setShadow(t,e,s,i){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=s*n,this.shadowColor=i||"black"}setBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}hitPath(t,e){return this.context.isPointInPath(t.x,t.y,e)}hitStroke(t){return this.context.isPointInStroke(t.x,t.y)}replaceBy(t,e,s){t.save(),this.blendMode="copy",this.copy(t,e,s),t.restore()}copy(t,e,s,i){if(e){s||(s=e);const{pixelRatio:n}=this;i&&(this.blendMode=i),this.drawImage(t.view,e.x*n,e.y*n,e.width*n,e.height*n,s.x*n,s.y*n,s.width*n,s.height*n),i&&(this.blendMode="normal")}else this.drawImage(t.view,0,0)}copyWorldToLocal(t,e,s,i){const{pixelRatio:n}=this;i&&(this.blendMode=i),e.b||e.c?(this.save(),this.resetTransform(),this.copy(t,e,N.tempTimesMatrix(s,e)),this.restore()):this.drawImage(t.view,e.x*n,e.y*n,e.width*n,e.height*n,s.x,s.y,s.width,s.height),i&&(this.blendMode="normal")}fillBounds(t,e,s){const{pixelRatio:i}=this;s&&(this.blendMode=s),this.fillStyle=e,this.fillRect(t.x*i,t.y*i,t.width*i,t.height*i),s&&(this.blendMode="normal")}strokeBounds(t,e,s){const{pixelRatio:i}=this;s&&(this.blendMode=s),this.strokeStyle=e,this.strokeRect(t.x*i,t.y*i,t.width*i,t.height*i),s&&(this.blendMode="normal")}clearBounds(t){const{pixelRatio:e}=this;this.clearRect(Math.floor(t.x*e),Math.floor(t.y*e),Math.ceil(t.width*e),Math.ceil(t.height*e))}clipBounds(t){const{pixelRatio:e}=this;this.beginPath(),this.rect(Math.floor(t.x*e),Math.floor(t.y*e),Math.ceil(t.width*e),Math.ceil(t.height*e)),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:e,height:s,pixelRatio:i}=this,n=this.manager.get({width:e,height:s,pixelRatio:i});return n.manager||(n.manager=this.manager),n.save(),t&&n.useSameTransform(this),n}getBiggerCanvas(t,e){let{width:s,height:i,pixelRatio:n}=this;t&&(s+=t),e&&(i+=e);const o=this.manager.get({width:s,height:i,pixelRatio:n});return o.manager||(o.manager=this.manager),o.save(),o}recycle(){this.restore(),this.manager.recycle(this)}destroy(){this.view&&(super.destroy(),this.stopAutoLayout(),this.manager=null,this.view&&this.view.parentElement&&this.view.remove(),this.view=null,this.bounds=null)}}CanvasRenderingContext2D.prototype.roundRect||(CanvasRenderingContext2D.prototype.roundRect=Path2D.prototype.roundRect=function(t,e,s,i,n){let o,r,a,h;if(n instanceof Array)switch(n.length){case 4:o=n[0],r=n[1],a=n[2],h=n[3];break;case 2:o=a=n[0],r=h=n[1];break;case 3:o=n[0],r=h=n[1],a=n[2];break;case 1:n=n[0];break;default:n=0}if(void 0===o){if(!n)return void this.rect(t,e,s,i);o=r=a=h=n}const l=Math.min(s/2,i/2);o>l&&(o=l),r>l&&(r=l),a>l&&(a=l),h>l&&(h=l);const d=this;o?d.moveTo(t+o,e):d.moveTo(t,e),r?d.arcTo(t+s,e,t+s,e+i,r):d.lineTo(t+s,e),a?d.arcTo(t+s,e+i,t,e+i,a):d.lineTo(t+s,e+i),h?d.arcTo(t,e+i,t,e,h):d.lineTo(t,e+i),o?d.arcTo(t,e,t+s,e,o):d.lineTo(t,e),d.closePath()});class Ci{constructor(t){this.options=t,this.load()}load(){return new Promise(((t,e)=>{let s=this.options.url,i=new Image;i.setAttribute("crossOrigin","anonymous"),i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=t=>{console.error(t,this),e(new Error("load Image error"))},i.src=s.includes("?")?s+"&xhr":s+"?xhr"}))}destory(){}}class Pi{constructor(t){this.interaction=t}move(t){const{interaction:e}=this;if(!this.moveData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0}),e.emit(Me.START,this.moveData)}t.path=this.moveData.path,e.emit(Me.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:e}=this;if(!this.zoomData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.zoomData=Object.assign(Object.assign({},t),{scale:1}),e.emit(Ae.START,this.zoomData)}t.path=this.zoomData.path,e.emit(Ae.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;if(!this.rotateData){const{path:s}=e.selector.getHitPointPath(t,e.hitRadius);t.path=s,this.rotateData=Object.assign(Object.assign({},t),{rotation:0}),e.emit(De.START,this.rotateData)}t.path=this.rotateData.path,e.emit(De.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(Me.END,this.moveData),this.moveData=null)}zoomEnd(){this.zoomData&&(this.interaction.emit(Ae.END,this.zoomData),this.zoomData=null)}rotateEnd(){this.rotateData&&(this.interaction.emit(De.END,this.rotateData),this.rotateData=null)}destroy(){clearTimeout(this.transformTimer),this.transformEnd(),this.interaction=null}}const Li={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)=>Object.assign(Object.assign({},e),{list:t}),getSwipeDirection:t=>t<-45&&t>-135?Oe.UP:t>45&&t<135?Oe.DOWN:t<=45&&t>=-45?Oe.RIGHT:Oe.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:ki.getSwipeDirection(B.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}),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,s){const i=new e,{list:n}=t;for(let t=0,e=n.length;t<e;t++)n[t].hasEvent(s)&&i.push(n[t]);return i}},ki=Li,{getDragEventData:Si,getDropEventData:Mi,getSwipeEventData:Di,filterPathByEventType:Oi}=Li;class Ai{constructor(t){this.interaction=t}setDragData(t){this.dragData=Si(t,t,t)}getDragList(){return this.dragging?Se.dragList||this.dragList:null}checkDrag(t,e){const{interaction:s}=this,{downData:i}=s;if(this.moving&&!Re.middle(t)&&!Re.left(t))return void s.pointerCancel();const{dragData:n}=this;this.moving||(this.moving=(Re.middle(t)||Te.isHoldSpaceKey())&&e,this.moving&&s.emit(Me.START,n)),this.moving||this.dragStart(t,e);const{path:o,throughPath:r}=i;this.dragData=Si(i,n,t),r&&(this.dragData.throughPath=r),this.dragData.path=o,this.moving?s.emit(Me.MOVE,this.dragData):this.dragging&&(s.emit(Le.DRAG,this.dragData),this.dragDragableList())}dragStart(t,e){this.dragging||(this.dragging=Re.left(t)&&e,this.dragging&&(this.interaction.emit(Le.START,this.dragData),this.dragList=Oi(this.dragData.path,Le.DRAG),this.getDragableList(this.dragData.path)))}getDragableList(t){let e;for(let s=0,i=t.length;s<i;s++)if(e=t.list[s],e.draggable){this.dragableList=[e];break}}dragDragableList(){if(this.dragableList){const{moveX:t,moveY:e}=this.dragData;this.dragableList.forEach((s=>{le.moveOfWorld(s,t,e)}))}}dropEnterOrLeave(t){const{interaction:e}=this,{dropEnterPath:s}=this,{path:i}=t;e.emit(Se.ENTER,t,i,s),e.emit(Se.LEAVE,t,s,i),this.dropEnterPath=i}dragEnd(t){const{interaction:e}=this,{downData:s}=e;if(!s)return;const{path:i,throughPath:n}=s,o=Si(s,t,t);n&&(o.throughPath=n),o.path=i,this.moving&&e.emit(Me.END,o),this.dragging&&(e.emit(Le.END,o),this.swipe(t,o),this.drop(t)),this.autoMoveCancel(),this.dragReset()}swipe(t,e){const{interaction:s}=this,{downData:i}=s;if(B.getDistance(i,t)>s.config.pointer.swipeDistance){const t=Di(i,this.dragData,e);this.interaction.emit(t.type,t)}}drop(t){const e=Mi(this.getDragList(),t);e.path=this.dropEnterPath,this.interaction.emit(Se.DROP,e),this.interaction.emit(Se.LEAVE,t,this.dropEnterPath)}dragReset(){Se.dragList=null,this.dragList=null,this.dragableList=null,this.dragData=null,this.dropEnterPath=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,{autoMoveDistance:i}=e.config.pointer;if(!i)return;const n=e.shrinkCanvasBounds,{x:o,y:r}=n,a=N.right(n),h=N.bottom(n),l=t.x<o?i:a<t.x?-i:0,d=t.y<r?i:h<t.y?-i:0;let c=0,u=0;this.autoMoveTimer=setInterval((()=>{c+=l,u+=d,N.move(s,l,d),N.move(this.dragData,l,d),e.move(Object.assign(Object.assign({},t),{moveX:l,moveY:d,totalX:c,totalY:u})),e.pointerMoveReal(t)}),10)}autoMoveCancel(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)}destroy(){this.interaction=null,this.dragableList=null}}const{pathHasEventType:Wi}=Li;class Ii{get dragging(){return this.dragger.dragging}get hitRadius(){return this.config.pointer.hitRadius}constructor(t,e,s,i){this.config={wheel:{zoomMode:!1,zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,through:!1,clickTime:120,longPressTime:800,transformTime:500,dragDistance:2,swipeDistance:20,autoMoveDistance:2,ignoreMove:!1}},this.clickCount=0,this.target=t,this.canvas=e,this.selector=s,this.transformer=new Pi(this),this.dragger=new Ai(this),i&&(this.config=n.default(i,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}pointerDown(t){this.emit(Pe.BEFORE_DOWN,t,this.selector.defaultPath);const{hitRadius:e,through:s}=this.config.pointer,i=this.selector.getHitPointPath(t,e,{through:s});i.throughPath&&(t.throughPath=i.throughPath),t.path=i.path,this.emit(Pe.DOWN,t),this.downData=t,this.downTime=Date.now(),this.dragger.setDragData(t),Re.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(Pe.BEFORE_MOVE,t,this.selector.defaultPath),this.downData){const e=B.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.getHitPointPath(t,this.hitRadius,{exclude:this.dragger.getDragList()});t.path=e.path,this.emit(Pe.MOVE,t),this.pointerEnterOrLeave(t),this.dragger.dragging&&this.dragger.dropEnterOrLeave(t)}pointerUp(t){if(!this.downData)return;this.emit(Pe.BEFORE_UP,t,this.selector.defaultPath);const{through:e}=this.config.pointer,s=this.selector.getHitPointPath(t,this.hitRadius,{through:e});s.throughPath&&(t.throughPath=s.throughPath),t.path=s.path,this.emit(Pe.UP,t),this.emit(Pe.UP,this.downData,void 0,t.path),this.touchLeave(t),this.tap(t),this.longTap(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()}pointerEnterOrLeave(t){if(this.dragger.moving||this.dragger.dragging)return;const{path:e}=t;this.emit(Pe.ENTER,t,e,this.enterPath),this.emit(Pe.LEAVE,t,this.enterPath,e),this.enterPath=e}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(Pe.LEAVE,t),this.dragger.dragging&&this.emit(Se.LEAVE,t))}tap(t){if(!this.waitTap)return;this.clickCount||this.emit(Pe.TAP,t);Date.now()-this.downTime<this.config.pointer.clickTime+50&&Wi(t.path,Pe.DOUBLE_CLICK)?(this.clickCount++,2===this.clickCount?(this.tapWaitCancel(),this.emit(Pe.DOUBLE_CLICK,t)):(clearTimeout(this.clickTimer),this.clickTimer=window.setTimeout((()=>{this.tapWaitCancel(),this.emit(Pe.CLICK,t)}),this.config.pointer.clickTime))):(this.tapWaitCancel(),this.emit(Pe.CLICK,t))}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.clickTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.clickTimer),this.waitTap=!1,this.clickCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=window.setTimeout((()=>{this.longPressed=!0,this.emit(Pe.LONG_PRESS,t)}),this.config.pointer.longPressTime)}longTap(t){this.longPressed&&this.emit(Pe.LONG_TAP,t),this.longPressWaitCancel()}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){this.shrinkCanvasBounds=new Y(this.canvas.bounds),this.shrinkCanvasBounds.spread(-2)}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on__(Ht.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off__(this.__eventIds)}emit(t,e,s,i){this.running&&function(t,e,s,i){if(!s&&!e.path)return;let n;e.type=t,s?e=Object.assign(Object.assign({},e),{path:s}):s=e.path,e.target=s.indexAt(0);for(let o=s.length-1;o>-1;o--)if(n=s.list[o],n.hasEvent(t,!0)&&(!i||!i.has(n))){e.phase=1;const s=St.event(t,e);if(n.emitEvent(s,!0),s.isStop)return}for(let o=0,r=s.length;o<r;o++)if(n=s.list[o],n.hasEvent(t,!1)&&(!i||!i.has(n))){e.phase=n===e.target?2:3;const s=St.event(t,e);if(n.emitEvent(s),s.isStop)return}}(t,e,s,i)}destroy(){this.target&&(this.running=!1,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 Ni={convert(t,e){const s=Li.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=Li.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=Ni.getTouch(t),i=Li.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]},Fi={getData(t,e){const s=B.getCenter(t[0],t[1]),i=B.getCenter(e[0],e[1]),n={x:i.x-s.x,y:i.y-s.y},o=B.getDistance(t[0],t[1]),r=B.getDistance(e[0],e[1])/o,a=B.getAngle(t[0],t[1]),h=B.getAngle(e[0],e[1]);return{move:n,scale:r,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}};let zi=0;const ji={getMove:(t,e)=>({x:-t.deltaX*e.moveSpeed*2,y:-t.deltaY*e.moveSpeed*2}),getScale(t,e){let s,i=1,{zoomMode:n,zoomSpeed:o}=e;const r=t.deltaY||t.deltaX;if(n){const e=t.mozInputSource&&t.deltaY%18==0;e?zi++:zi=0,s=(Math.floor(t.deltaY)!==t.deltaY||e&&zi>2)&&0===t.deltaX,(t.shiftKey||t.metaKey||t.ctrlKey)&&(s=!0)}else s=!t.shiftKey&&(t.metaKey||t.ctrlKey);if(s){o=l.within(o,0,1);i=1-r/(25*(t.deltaY?e.delta.y:e.delta.x)*(1-o)+10),i<.5&&(i=.5),i>=1.5&&(i=1.5)}return i}},{getMoveEventData:Yi,getZoomEventData:Xi,getRotateEventData:Hi}=Li;class Ui extends Ii{__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.__onResize(),this.viewEvents={pointerdown:this.onPointerDown.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onTouchStart.bind(this),wheel:this.onWheel.bind(this),gesturestart:this.onGesturestart.bind(this),gesturechange:this.onGesturechange.bind(this),gestureend:this.onGestureend.bind(this)},this.windowEvents={pointermove:this.onPointerMove.bind(this),pointerup:this.onPointerUp.bind(this),pointercancel:this.onPointerCancel.bind(this),mousemove:this.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchmove:this.onTouchMove.bind(this),touchend:this.onTouchEnd.bind(this),touchcancel:this.onTouchCancel.bind(this),keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this)};for(let e in this.viewEvents)t.addEventListener(e,this.viewEvents[e]);for(let t in this.windowEvents)window.addEventListener(t,this.windowEvents[t]);window.oncontextmenu=function(){return!1}}__removeListenEvents(){super.__removeListenEvents();for(let t in this.viewEvents)this.view.removeEventListener(t,this.viewEvents[t]),this.viewEvents={};for(let t in this.windowEvents)window.removeEventListener(t,this.windowEvents[t]),this.windowEvents={}}__onResize(){super.__onResize(),this.clientBounds=new Y(this.view.getBoundingClientRect())}getLocal(t){return{x:t.clientX-this.clientBounds.x,y:t.clientY-this.clientBounds.y}}onKeyDown(t){Te.setDownCode(t.code)}onKeyUp(t){Te.setUpCode(t.code)}onPointerDown(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||(t.preventDefault(),this.pointerDown(Ni.convert(t,this.getLocal(t))))}onPointerMove(t){this.usePointer||(this.usePointer=!0),this.useMutiTouch||this.pointerMove(Ni.convert(t,this.getLocal(t)))}onPointerUp(t){this.useMutiTouch||(t.preventDefault(),this.pointerUp(Ni.convert(t,this.getLocal(t))))}onPointerCancel(){this.useMutiTouch||this.pointerCancel()}onMouseDown(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerDown(Ni.convertMouse(t,this.getLocal(t))))}onMouseMove(t){this.useTouch||this.usePointer||this.pointerMove(Ni.convertMouse(t,this.getLocal(t)))}onMouseUp(t){this.useTouch||this.usePointer||(t.preventDefault(),this.pointerUp(Ni.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=Ni.getTouch(t);this.pointerDown(Ni.convertTouch(t,this.getLocal(e)))}onTouchMove(t){if(this.mutiTouchMove(t),this.usePointer)return;const e=Ni.getTouch(t);this.pointerMove(Ni.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(t.preventDefault(),this.mutiTouchEnd(),this.usePointer)return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=window.setTimeout((()=>{this.useTouch=!1}),500);const e=Ni.getTouch(t);this.pointerUp(Ni.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.usePointer||this.pointerCancel()}mutiTouchStart(t){this.useMutiTouch=t.touches.length>=2,this.touches=this.useMutiTouch?Fi.getTouches(t.touches):void 0,this.useMutiTouch&&this.pointerCancel()}mutiTouchMove(t){if(this.useMutiTouch&&t.touches.length>=2){const e=Fi.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 n=[this.getLocal(this.touches[0]),this.getLocal(this.touches[1])],o=[this.getLocal(s),this.getLocal(i)],{move:r,angle:a,scale:h,center:l}=Fi.getData(n,o),d=Li.getBase(t);this.rotate(Hi(l,a,d)),this.zoom(Xi(l,h,d)),this.move(Yi(l,r,d)),this.touches=e}}}mutiTouchEnd(){this.touches=null,this.useMutiTouch=!1,this.transformEnd()}onWheel(t){t.preventDefault();const{wheel:e}=this.config,s=e.getScale?e.getScale(t,e):ji.getScale(t,e),i=this.getLocal(t),n=Li.getBase(t);1!==s?this.zoom(Xi(i,s,n)):this.move(Yi(i,e.getMove?e.getMove(t,e):ji.getMove(t,e),n))}onGesturestart(t){t.preventDefault(),this.lastGestureScale=1,this.lastGestureRotation=0}onGesturechange(t){t.preventDefault();const e=this.getLocal(t),s=Li.getBase(t),i=t.scale/this.lastGestureScale,n=t.rotation-this.lastGestureRotation;let{rotateSpeed:o}=this.config.wheel;o=l.within(o,0,1),this.zoom(Xi(e,i*i,s)),this.rotate(Hi(e,n/Math.PI*180*(o/4+.1),s)),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){t.preventDefault(),this.transformEnd()}destroy(){this.view&&(super.destroy(),this.view=null,this.touches=null)}}function Gi(t){return(e,s)=>{tt(e,s,{get(){return this.__get(s)},set(t){this.__set(s,t),this.__.__useEffect=!0,this.__layout.renderBoundsChanged||this.__layout.renderBoundsChange()}}),yt(e,s,t)}}Object.assign(St,{canvas:(t,e)=>new Ri(t,e),image:t=>new Ci(t),hitCanvas:(t,e)=>new Ri(t,e),watcher:t=>new si(t),layouter:t=>new pi(t),renderer:(t,e,s)=>new yi(t,e,s),selector:t=>new mi(t),interaction:(t,e,s,i)=>new Ui(t,e,s,i)}),bt.requestRender=function(t){window.requestAnimationFrame(t)},bt.canvas=St.canvas();class Ki extends r{setFill(t){"string"==typeof t?(this._fill=t,this.__isFills&&(this.__isFills=!1)):t instanceof Array?(this._fill=t,this.__isFills=!0):"object"==typeof t?(this._fill=[t],this.__isFills=!0):(this._fill=t,this.__isFills&&(this.__isFills=!1))}setStroke(t){"string"==typeof t?(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1)):t instanceof Array?(this._stroke=t,this.__isStrokes=!0):"object"==typeof t?(this._stroke=[t],this.__isStrokes=!0):(this._stroke=t,this.__isStrokes&&(this.__isStrokes=!1))}setShadow(t){this._shadow=t instanceof Array?t:[t]}setInnerShadow(t){this._innerShadow=t instanceof Array?t:[t]}}class Vi extends Ki{}const{parse:qi}=Es;const{copyAndSpread:Qi}=N,Zi={__updateEventBounds(){Qi(this.__layout.eventBounds,this.__layout.boxBounds,this.__layout.eventBoundsSpreadWidth)},__updateRenderBounds(){Qi(this.__layout.renderBounds,this.__layout.eventBounds,this.__layout.renderBoundsSpreadWidth)},__updateEventBoundsSpreadWidth(){let t=0;const{stroke:e,strokeAlign:s}=this.__;if(e&&"inside"!==s){const{strokeWidth:e,miterLimit:i,path:n}=this.__,o=n?1/Math.sin(i*d/2)*Math.sqrt(e):0;t="center"===s?e/2:e,this.__.__strokeOuterWidth=t,o&&(t+=o-t)}return t||(this.__.__strokeOuterWidth=0),t},__updateRenderBoundsSpreadWidth(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:n}=this.__;e&&e.forEach((e=>{t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)})),i&&(t=Math.max(t,i));let o=t=Math.ceil(t);return s&&s.forEach((t=>{o=Math.max(o,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)})),n&&(o=Math.max(o,n)),this.__layout.renderShapeBoundsSpreadWidth=o,t}},$i={__hit(t){const{__hitCanvas:e}=this;if(this.__.fill&&e.hitPath(t,this.__.windingRule))return!0;const s=2*((this.__.__strokeOuterWidth||0)+t.radiusX);return e.strokeWidth!==s&&(e.strokeWidth=s,e.stroke()),e.hitStroke(t)}},Ji={},tn={},en={},sn={};function nn(t,e){t.forEach((t=>{e.strokeStyle=t.style,e.stroke()}))}var on=Object.freeze({__proto__:null,fill:function(t,e,s){e.fillStyle=s,e.fill(t.__.windingRule)},fills:function(t,e,s){let i;const{windingRule:n}=t.__;for(let t=0,o=s.length;t<o;t++)i=s[t],e.fillStyle=i.style,e.fill(n)},stroke:function(t,e,s){const i=t.__,{strokeWidth:n,strokeAlign:o}=i;switch(o){case"center":e.setStroke(void 0,n,i),e.strokeStyle=s,e.stroke();break;case"inside":e.save(),e.setStroke(void 0,2*n,i),e.clip(i.windingRule),e.strokeStyle=s,e.stroke(),e.restore();break;case"outside":const o=e.getSameCanvas(!0);t.__drawRenderPath(o),o.setStroke(void 0,2*n,t.__),o.strokeStyle=s,o.stroke(),o.clip(i.windingRule),o.clearBounds(t.__layout.renderBounds),e.copyWorldToLocal(o,t.__world,t.__layout.renderBounds),o.recycle()}},strokes:function(t,e,s){const i=t.__,{strokeWidth:n,strokeAlign:o}=i;switch(o){case"center":e.setStroke(void 0,n,i),nn(s,e);break;case"inside":e.save(),e.setStroke(void 0,2*n,i),e.clip(i.windingRule),nn(s,e),e.restore();break;case"outside":const{renderBounds:o}=t.__layout,r=e.getSameCanvas(!0);t.__drawRenderPath(r),r.setStroke(void 0,2*n,t.__),nn(s,r),r.clip(i.windingRule),r.clearBounds(o),e.copyWorldToLocal(r,t.__world,o),r.recycle()}}});Object.assign(tn,on);const rn={__updateChange(){let t=this.__;t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect?this.__complex=!0:this.__complex&&(this.__complex=!1)},__drawFast(t,e){const{fill:s,stroke:i}=this.__;this.__drawRenderPath(t),s&&tn.fill(this,t,s),i&&tn.stroke(this,t,i)},__draw(t,e){if(this.__complex){const{fill:e,stroke:s}=this.__;this.__drawRenderPath(t),e&&(this.__.__isFills?tn.fills(this,t,e):tn.fill(this,t,e)),s&&(this.__.__isStrokes?tn.strokes(this,t,s):tn.stroke(this,t,s))}else this.__drawFast(t,e)}},an={__render(t,e){const{fill:s,stroke:i}=this.__;i&&(this.__.stroke=void 0),this.__renderRect(t,e);const{clip:n}=this.__;n?(t.save(),t.clip(),this.__renderGroup(t,e),t.restore()):this.__renderGroup(t,e),i&&(this.__.stroke=i,s&&(this.__.fill=void 0),this.__renderRect(t,e),s&&(this.__.fill=s))}},hn={__drawFast(t,e){const{width:s,height:i,fill:n,stroke:o}=this.__;if(n&&(t.fillStyle=n,t.fillRect(0,0,s,i)),o){const{strokeAlign:e,strokeWidth:n}=this.__;t.setStroke(o,n,this.__);const r=n/2;switch(e){case"center":t.strokeRect(0,0,s,i);break;case"inside":t.strokeRect(r,r,s-n,i-n);break;case"outside":t.strokeRect(-r,-r,s+n,i+n)}}}},ln={__drawFast(t,e){const{fill:s,stroke:i,content:n,__font:o}=this.__;t.font=o,s&&(t.fillStyle=s,t.fillText(n,0,0)),i&&(t.strokeStyle=i,t.strokeText(n,0,0))}};ln.__draw=ln.__drawFast;let dn=class extends he{get worldTransform(){return this.__layout.getTransform("world")}get relativeTransform(){return this.__layout.getTransform("relative")}get worldBoxBounds(){return this.__layout.getBounds("world","box")}get worldRenderBounds(){return this.__layout.getBounds("world","render")}__updateRenderPath(){if(this.__.path){const{__:t}=this;t.__pathForRender=t.cornerRadius?Is.smoothCorner(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){}};G([pt(Ki)],dn.prototype,"__",void 0),G([it("")],dn.prototype,"id",void 0),G([it("")],dn.prototype,"name",void 0),G([it("")],dn.prototype,"className",void 0),G([ut(1)],dn.prototype,"opacity",void 0),G([ut(!0)],dn.prototype,"visible",void 0),G([_t(0)],dn.prototype,"zIndex",void 0),G([nt(0)],dn.prototype,"x",void 0),G([nt(0)],dn.prototype,"y",void 0),G([at(100)],dn.prototype,"width",void 0),G([at(100)],dn.prototype,"height",void 0),G([ot(1)],dn.prototype,"scaleX",void 0),G([ot(1)],dn.prototype,"scaleY",void 0),G([rt(0)],dn.prototype,"rotation",void 0),G([rt(0)],dn.prototype,"skewX",void 0),G([rt(0)],dn.prototype,"skewY",void 0),G([ct()],dn.prototype,"blendMode",void 0),G([at()],dn.prototype,"mask",void 0),G([it()],dn.prototype,"locked",void 0),G([ct()],dn.prototype,"fill",void 0),G([lt()],dn.prototype,"stroke",void 0),G([lt("center")],dn.prototype,"strokeAlign",void 0),G([lt(1)],dn.prototype,"strokeWidth",void 0),G([ct("none")],dn.prototype,"strokeCap",void 0),G([ct("miter")],dn.prototype,"strokeJoin",void 0),G([ct()],dn.prototype,"dashPattern",void 0),G([ct()],dn.prototype,"dashOffset",void 0),G([ct(10)],dn.prototype,"miterLimit",void 0),G([ht()],dn.prototype,"cornerRadius",void 0),G([ht()],dn.prototype,"cornerSmoothing",void 0),G([Gi()],dn.prototype,"shadow",void 0),G([Gi()],dn.prototype,"innerShadow",void 0),G([Gi()],dn.prototype,"blur",void 0),G([Gi()],dn.prototype,"backgroundBlur",void 0),G([Gi()],dn.prototype,"grayscale",void 0),G([xt(Is.drawData)],dn.prototype,"__drawPathByData",null),dn=G([Et(Zi),Et($i),Et(rn),wt()],dn);let cn=class extends dn{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){}};G([pt(Vi)],cn.prototype,"__",void 0),cn=G([Et(Ee),Mt()],cn);let un=class extends dn{constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i,cornerRadius:n}=this.__;n?t.roundRect(0,0,s,i,n):t.rect(0,0,s,i)}};G([pt(class extends Ki{})],un.prototype,"__",void 0),un=G([Et(hn),Mt()],un);const _n=un.prototype,pn=cn.prototype,gn={},{copy:yn,add:vn}=N;let fn=class extends cn{constructor(t){super(t),this.fill||(this.fill="#FFFFFF"),this.__isBranchLeaf=!0}__drawPathByData(t,e){}__updateBoxBounds(){if(this.__updateRectBoxBounds(),!this.__.clip){const{boxBounds:t}=this.__layout;yn(gn,t),super.__updateBoxBounds(),vn(t,gn)}}__updateEventBounds(){if(this.__updateRectEventBounds(),!this.__.clip){const{eventBounds:t}=this.__layout;yn(gn,t),super.__updateEventBounds(),vn(t,gn)}}__updateRenderBounds(){if(this.__updateRectRenderBounds(),!this.__.clip){const{renderBounds:t}=this.__layout;yn(gn,t),super.__updateRenderBounds(),vn(t,gn)}}__updateRectBoxBounds(){}__updateRectEventBounds(){}__updateRectRenderBounds(){}__renderRect(t,e){}__renderGroup(t,e){}};G([pt(class extends Vi{})],fn.prototype,"__",void 0),G([at(!0)],fn.prototype,"clip",void 0),G([xt(_n.__drawPathByData)],fn.prototype,"__drawPathByData",null),G([xt(_n.__updateBoxBounds)],fn.prototype,"__updateRectBoxBounds",null),G([xt(_n.__updateEventBounds)],fn.prototype,"__updateRectEventBounds",null),G([xt(_n.__updateRenderBounds)],fn.prototype,"__updateRectRenderBounds",null),G([xt(_n.__render)],fn.prototype,"__renderRect",null),G([xt(pn.__render)],fn.prototype,"__renderGroup",null),fn=G([Et(an),wt(),Mt()],fn);const{PI:mn}=Math,{begin:xn,moveTo:wn,close:Bn,ellipse:En}=qs;let bn=class extends dn{constructor(t){super(t)}__updatePath(){const{width:t,height:e,innerRadius:s,startAngle:i,endAngle:n}=this.__,o=t/2,r=e/2;xn(this.__.path=[]),s?i||n?(En(o,r,o*(1-s),r*(1-s),0,i*d,n*d,!1),En(o,r,o,r,0,n*d,i*d,!0),Bn()):(En(o,r,o*(1-s),r*(1-s),0,0,2*mn,!1),wn(t,r),En(o,r,o,r,0,0,2*mn,!0)):i||n?(wn(o,r),En(o,r,o,r,0,i*d,n*d,!1),Bn()):En(o,r,o,r,0,0,2*mn,!1)}};G([pt(class extends Ki{})],bn.prototype,"__",void 0),G([ht(0)],bn.prototype,"innerRadius",void 0),G([ht(0)],bn.prototype,"startAngle",void 0),G([ht(0)],bn.prototype,"endAngle",void 0),bn=G([Mt()],bn);const{sin:Tn,cos:Rn,PI:Cn}=Math,{begin:Pn,moveTo:Ln,lineTo:kn,close:Sn}=qs;let Mn=class extends dn{constructor(t){super(t)}__updatePath(){const{width:t,height:e,sides:s}=this.__,i=t/2,n=e/2;Pn(this.__.path=[]),Ln(i,0);for(let t=1;t<s;t++)kn(i+i*Tn(2*t*Cn/s),n-n*Rn(2*t*Cn/s));Sn()}};G([pt(class extends Ki{})],Mn.prototype,"__",void 0),G([ht(3)],Mn.prototype,"sides",void 0),Mn=G([Mt()],Mn);const{sin:Dn,cos:On,PI:An}=Math,{begin:Wn,moveTo:In,lineTo:Nn,close:Fn}=qs;let zn=class extends dn{constructor(t){super(t)}__updatePath(){const{width:t,height:e,points:s,innerRadius:i}=this.__,n=t/2,o=e/2;Wn(this.__.path=[]),In(n,0);for(let t=1;t<2*s;t++)Nn(n+(t%2==0?n:n*i)*Dn(t*An/s),o-(t%2==0?o:o*i)*On(t*An/s));Fn()}};G([pt(class extends Ki{})],zn.prototype,"__",void 0),G([ht(5)],zn.prototype,"points",void 0),G([ht(.38)],zn.prototype,"innerRadius",void 0),zn=G([Mt()],zn);const{begin:jn,moveTo:Yn,lineTo:Xn,end:Hn}=qs,{rotate:Un,getAngle:Gn,getDistance:Kn,defaultPoint:Vn}=B,{setPoint:qn,addPoint:Qn,toBounds:Zn}=R,$n={};let Jn=class extends dn{get toPoint(){if(this.__toPoint&&!this.__layout.boxBoundsChanged)return this.__toPoint;const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Un(s,e),this.__toPoint=s,s}set toPoint(t){this.width=Kn(Vn,t),this.rotation=Gn(Vn,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){jn(this.__.path=[]),Yn(0,0);const t=this.toPoint;Xn(t.x,t.y),Hn()}__updateBoxBounds(){qn($n,0,0),Qn($n,this.__toPoint.x,this.__toPoint.y),Zn($n,this.__layout.boxBounds)}};G([pt(class extends Ki{})],Jn.prototype,"__",void 0),G([at()],Jn.prototype,"rotation",void 0),Jn=G([Mt()],Jn);const{toTwoPointBounds:to}=Is,{toBounds:eo}=R,so={};let io=class extends dn{constructor(t){super(t)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__updateBoxBounds(){to(this.__.path,so),eo(so,this.__layout.boxBounds)}};G([pt(class extends Ki{setPath(t){this._path="string"==typeof t?qi(t):t}})],io.prototype,"__",void 0),G([ht()],io.prototype,"path",void 0),G([ht()],io.prototype,"windingRule",void 0),io=G([Mt()],io);let no=class extends cn{constructor(t){super(t)}__updatePath(){}};G([pt(class extends Ki{})],no.prototype,"__",void 0),G([ht()],no.prototype,"paths",void 0),no=G([Mt()],no);let oo=class extends dn{constructor(t){super(t)}__drawPathByData(t,e){const{width:s,height:i}=this.__;t.rect(0,0,s,i)}__updateBoxBounds(){const{fontFamily:t,fontSize:e,fontWeight:s,italic:i,textCase:n,lineHeight:o}=this.__,r=this.__layout.boxBounds;this.__.__font=bt.canvas.font=`${i?"italic":""} ${"small-caps"===n?"small-caps":"normal"} ${s||"normal"} ${e}px/${o||e}px ${t}`;const a=bt.canvas.measureText(this.content).width,h=e;r.x=0,r.y=.75*-e,r.width=a,r.height=h}};G([pt(class extends Ki{})],oo.prototype,"__",void 0),G([at("")],oo.prototype,"content",void 0),G([at("arial")],oo.prototype,"fontFamily",void 0),G([at(12)],oo.prototype,"fontSize",void 0),G([at("normal")],oo.prototype,"fontWeight",void 0),G([at(!1)],oo.prototype,"italic",void 0),G([at("normal")],oo.prototype,"textCase",void 0),G([at("normal")],oo.prototype,"textDecoration",void 0),G([at()],oo.prototype,"letterSpacing",void 0),G([at()],oo.prototype,"lineHeight",void 0),G([at()],oo.prototype,"paragraphIndent",void 0),G([at()],oo.prototype,"paragraphSpacing",void 0),oo=G([Et(ln),Mt()],oo);let ro=class extends un{constructor(t){super(t)}__updateBoxBounds(){this.__image=St.image(this)}drawFill(){}};G([pt(class extends Ki{})],ro.prototype,"__",void 0),G([at("")],ro.prototype,"url",void 0),G([at("")],ro.prototype,"thumb",void 0),ro=G([Mt()],ro);class ao extends cn{get isApp(){return!1}constructor(e,s){var n;super(),this.config={zoom:!0,move:!0,start:!0,pixelRatio:devicePixelRatio},this.__eventIds=[],this.__setAsLeafer(),this.__setConfig(e);const{config:o}=this;this.creator=St,this.canvas=St.canvas(o),this.renderer=St.renderer(this,this.canvas,o),this.isApp?this.__level=1:(this.watcher=St.watcher(this),this.layouter=St.layouter(this)),this.__checkAutoLayout(o),s?(null===(n=s.selector)||void 0===n||n.defaultPath.unshift(this),this.selector=s.selector,this.interaction=s.interaction,this.canvasManager=s.canvasManager,this.hitCanvasManager=s.hitCanvasManager,this.imageManager=s.imageManager,s.running&&setTimeout(this.start.bind(this))):(this.selector=St.selector(this),this.interaction=St.interaction(this,this.canvas,this.selector,o),this.canvasManager=new t(this),this.hitCanvasManager=new i(this),this.imageManager=new Ie(this,o),$.start("FullCreate"),o.start&&setTimeout(this.start.bind(this))),this.canvasManager.add(this.canvas),this.__listenEvents()}__listenEvents(){this.once(Kt.END,this.__setAsRoot.bind(this))}__removeListenEvents(){this.off__(this.__eventIds)}__setConfig(t){t&&(this.config=n.default(t,this.config))}__checkAutoLayout(t){t.width&&t.height||(this.autoLayout=new X(t),this.canvas.autoLayout(this.autoLayout,this.__onResize.bind(this)))}start(){var t;this.running||($.endOfName("FullCreate"),this.__interactiveWindow(),null===(t=this.interaction)||void 0===t||t.start(),this.renderer.start(),this.layouter.start(),this.watcher.start(),this.running=!0)}stop(){var t;this.running&&(null===(t=this.interaction)||void 0===t||t.stop(),this.watcher.stop(),this.layouter.stop(),this.renderer.stop(),this.running=!1)}__interactiveWindow(){const{zoom:t,move:e}=this.config;if(e){const{MOVE:e}=Me,{ZOOM:s}=Ae;this.hasEvent(e)||this.__eventIds.push(this.on__(e,(t=>{le.moveOfWorld(this,t.moveX,t.moveY)}))),t&&!this.hasEvent(s)&&this.__eventIds.push(this.on__(s,(t=>{le.zoomOfWorld(this,t.scale,t)})))}}resize(t){if(this.canvas.isSameSize(t))return;const{width:e,height:s,pixelRatio:i}=this.canvas,n={width:e,height:s,pixelRatio:i};this.canvas.resize(t),this.__onResize(new Ht(t,n))}__onResize(t){this.emitEvent(t),setTimeout((()=>{this.canvasManager.clearRecycled()}),0)}destory(){var t;this.canvas&&(super.destroy(),this.__removeListenEvents(),this.parent||(null===(t=this.interaction)||void 0===t||t.destroy(),this.selector.destroy(),this.renderer.destroy(),this.watcher.destroy(),this.layouter.destroy(),this.canvasManager.destory(),this.hitCanvasManager.destory(),this.imageManager.destory()),this.canvas.destroy(),this.canvas=null,this.creator=null,this.config=null,this.interaction=null,this.selector=null,this.renderer=null,this.watcher=null,this.layouter=null,this.canvasManager=null,this.hitCanvasManager=null,this.imageManager=null,this.zoomLayer=null,this.moveLayer=void 0,this.parent=void 0)}}function ho(){return(t,e)=>{const s={get(){return this.canvas[e]},set(t){const{width:s,height:i,pixelRatio:n}=this.canvas,o={width:s,height:i,pixelRatio:n};o[e]=t,this.resize(o)}};Object.defineProperty(t,e,s)}}G([ho()],ao.prototype,"width",void 0),G([ho()],ao.prototype,"height",void 0),G([ho()],ao.prototype,"pixelRatio",void 0);class lo extends ao{get isApp(){return!0}constructor(t){super(t),this.children=[]}start(){this.children.forEach((t=>{t.start()})),this.renderer.start(),this.running=!0}stop(){this.children.forEach((t=>{t.stop()})),this.renderer.stop(),this.running=!1}addLeafer(t){const e=new ao(this.__getChildConfig(t),this);this.add(e);const{renderer:s}=this;return this.__eventIds.push(e.on__(Kt.END,this.__onChildLayoutEnd,this),e.on__(Vt.END,s.update,s),this.on__(Kt.REQUEST,s.mergeBlocks,s)),e}__onChildLayoutEnd(t){const{renderer:e}=this;t.current.config.usePartRender?t.data.map((t=>e.addBlock(t.updatedBounds))):e.addBlock(e.canvas.bounds)}__render(t,e){this.children.forEach((e=>{t.copy(e.canvas)}))}__onResize(t){this.emitEvent(t),this.children.forEach((e=>{e.resize(t)}))}__getChildConfig(t){let e=Object.assign({},this.config);return(t=t?n.default(t,e):e).view=null,this.autoLayout&&(t.width=this.width,t.height=this.height,t.pixelRatio=this.pixelRatio),t}destory(){super.destory();const{children:t}=this;t.length&&(t.forEach((t=>t.destory())),t.length=0)}}export{en as Animate,lo as App,Yt as AttrEvent,X as AutoBounds,ts as BezierHelper,Y as Bounds,N as BoundsHelper,Ee as Branch,ge as BranchHelper,t as CanvasManager,jt as ChildEvent,St as Creator,n as DataHelper,V as Debug,Le as DragEvent,Se as DropEvent,Ji as Effect,bn as Ellipse,zt as Event,Rt as EventCreator,sn as Export,fn as Frame,an as FrameRender,cn as Group,i as HitCanvasManager,ro as Image,Ie as ImageManager,a as IncrementId,Ui as Interaction,We as KeyEvent,Te as Keyboard,Kt as LayoutEvent,pi as Layouter,he as Leaf,ee as LeafBounds,pe as LeafBoundsHelper,r as LeafData,qt as LeafDataProxy,Nt as LeafEventer,le as LeafHelper,ne as LeafHit,s as LeafLevelList,e as LeafList,Jt as LeafMatrix,oe as LeafRender,ao as Leafer,Ri as LeaferCanvas,Ci as LeaferImage,Jn as Line,l as MathHelper,T as Matrix,_ as MatrixHelper,Me as MoveEvent,Xe as NumberPathCommandLengthMap,Ye as NumberPathCommandMap,d as OneRadian,tn as Paint,io as Path,Ne as PathCommandMap,ze as PathCommandNeedConvertMap,Es as PathConvert,qs as PathCreator,Is as PathHelper,bt as Platform,Zs as Plugin,b as Point,B as PointHelper,Re as PointerButton,Pe as PointerEvent,Mn as Polygon,un as Rect,hn as RectRender,Vt as RenderEvent,yi as Renderer,Ht as ResizeEvent,De as RotateEvent,$ as Run,mi as Selector,zn as Star,U as StringNumberMap,Oe as SwipeEvent,Js as TaskItem,ei as TaskProcessor,oo as Text,ln as TextRender,Ut as TransformEvent,H as TwoPointBounds,R as TwoPointBoundsHelper,dn as UI,Zi as UIBounds,Lt as UICreator,Ce as UIEvent,$i as UIHit,rn as UIRender,no as Vector,Gt as WatchEvent,si as Watcher,Ae as ZoomEvent,lt as affectEventBoundsType,dt as affectRenderBoundsType,st as aliasType,at as boundsType,pt as dataProcessor,it as dataType,yt as defineDataProcessor,tt as defineKey,Gi as effectType,et as getDescriptor,gt as layoutProcessor,ut as opacityType,ht as pathType,nt as positionType,Dt as registerEvent,Mt as registerUI,xt as rewrite,wt as rewriteAble,rt as rotationType,ot as scaleType,_t as sortType,ct as surfaceType,Et as useModule,$s as usePlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leafer-ui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.19",
|
|
4
4
|
"author": "Chao (Leafer) Wan",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/leaferjs/ui"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://github.com/leaferjs/ui",
|
|
14
14
|
"bugs": "https://github.com/leaferjs/ui/issues",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"leaferui",
|