New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@idraw/board

Package Overview
Dependencies
Maintainers
0
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@idraw/board - npm Package Compare versions

Comparing version 0.4.0-beta.35 to 0.4.0-beta.36

12

dist/esm/index.js

@@ -12,3 +12,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

};
var _Board_instances, _Board_opts, _Board_middlewareMap, _Board_middlewares, _Board_activeMiddlewareObjs, _Board_watcher, _Board_renderer, _Board_sharer, _Board_viewer, _Board_calculator, _Board_eventHub, _Board_hasDestroyed, _Board_init, _Board_handlePointStart, _Board_handlePointEnd, _Board_handlePointMove, _Board_handleHover, _Board_handleDoubleClick, _Board_handleContextMenu, _Board_handleWheel, _Board_handleWheelScale, _Board_handleScrollX, _Board_handleScrollY, _Board_handleResize, _Board_handleClear, _Board_handleBeforeDrawFrame, _Board_handleAfterDrawFrame, _Board_resetActiveMiddlewareObjs;
var _Board_instances, _Board_opts, _Board_middlewareMap, _Board_middlewares, _Board_activeMiddlewareObjs, _Board_watcher, _Board_renderer, _Board_sharer, _Board_viewer, _Board_calculator, _Board_eventHub, _Board_hasDestroyed, _Board_init, _Board_handlePointStart, _Board_handlePointEnd, _Board_handlePointMove, _Board_handlePointLeave, _Board_handleHover, _Board_handleDoubleClick, _Board_handleContextMenu, _Board_handleWheel, _Board_handleWheelScale, _Board_handleScrollX, _Board_handleScrollY, _Board_handleResize, _Board_handleClear, _Board_handleBeforeDrawFrame, _Board_handleAfterDrawFrame, _Board_resetActiveMiddlewareObjs;
import { Renderer } from '@idraw/renderer';

@@ -206,2 +206,3 @@ import { calcElementsContextSize, EventEmitter } from '@idraw/util';

__classPrivateFieldGet(this, _Board_watcher, "f").on('pointMove', __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointMove).bind(this));
__classPrivateFieldGet(this, _Board_watcher, "f").on('pointLeave', __classPrivateFieldGet(this, _Board_instances, "m", _Board_handlePointLeave).bind(this));
__classPrivateFieldGet(this, _Board_watcher, "f").on('hover', __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleHover).bind(this));

@@ -245,2 +246,11 @@ __classPrivateFieldGet(this, _Board_watcher, "f").on('wheel', __classPrivateFieldGet(this, _Board_instances, "m", _Board_handleWheel).bind(this));

}
}, _Board_handlePointLeave = function _Board_handlePointLeave(e) {
var _a;
for (let i = 0; i < __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f").length; i++) {
const obj = __classPrivateFieldGet(this, _Board_activeMiddlewareObjs, "f")[i];
const result = (_a = obj === null || obj === void 0 ? void 0 : obj.pointLeave) === null || _a === void 0 ? void 0 : _a.call(obj, e);
if (result === false) {
return;
}
}
}, _Board_handleHover = function _Board_handleHover(e) {

@@ -247,0 +257,0 @@ var _a;

11

dist/esm/lib/watcher.js

@@ -78,5 +78,2 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

__classPrivateFieldGet(this, _BoardWatcher_store, "f").set('hasPointDown', false);
if (!__classPrivateFieldGet(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
return;
}
e.preventDefault();

@@ -131,4 +128,9 @@ const point = __classPrivateFieldGet(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);

if (!__classPrivateFieldGet(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
if (__classPrivateFieldGet(this, _BoardWatcher_store, "f").get('inCanvas') === true) {
__classPrivateFieldGet(this, _BoardWatcher_store, "f").set('inCanvas', false);
__classPrivateFieldGet(this, _BoardWatcher_onPointLeave, "f").call(this, e);
}
return;
}
__classPrivateFieldGet(this, _BoardWatcher_store, "f").set('inCanvas', true);
e.preventDefault();

@@ -141,3 +143,3 @@ const point = __classPrivateFieldGet(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);

});
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null } });
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null, inCanvas: true } });
__classPrivateFieldSet(this, _BoardWatcher_store, store, "f");

@@ -156,3 +158,2 @@ __classPrivateFieldSet(this, _BoardWatcher_opts, opts, "f");

container.addEventListener('mouseup', __classPrivateFieldGet(this, _BoardWatcher_onPointEnd, "f"));
container.addEventListener('mouseleave', __classPrivateFieldGet(this, _BoardWatcher_onPointLeave, "f"));
container.addEventListener('wheel', __classPrivateFieldGet(this, _BoardWatcher_onWheel, "f"), { passive: false });

@@ -159,0 +160,0 @@ container.addEventListener('click', __classPrivateFieldGet(this, _BoardWatcher_onClick, "f"));

@@ -1,1 +0,1 @@

var iDrawBoard=function(t){"use strict";var e,i,n,o,a,s,r,l,h,c,f,d,u,v,w,g,p,y,m,b,x,S,I,M,k,z,P,O,E,W,C,A,R,T,L,V,j,D,$,B,X,Y,H,F,U,N,G,Q,q,K,J,Z,_,tt,et,it,nt,ot,at,st,rt,lt,ht,ct,ft,dt,ut,vt,wt,gt,pt,yt,mt,bt=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},xt=(t,e,i)=>(bt(t,e,"read from private field"),i?i.call(t):e.get(t)),St=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},It=(t,e,i,n)=>(bt(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),Mt=(t,e,i)=>(bt(t,e,"access private method"),i);function kt(t){return"string"==typeof t&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function zt(t,e){if(1===e)return t;let i=1;const n=/^\#[0-9a-f]{6,6}$/i;let o=t;if(n.test(t)?i=parseInt(t.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(t)&&(i=parseInt(t.substring(7,9).replace(/^\#/,"0x")),o=t.substring(0,7)),i*=e,n.test(o)&&i>0&&i<1){const t=Math.max(0,Math.min(255,Math.ceil(256*i)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function Pt(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function Ot(t){let e=0;for(let i=0;i<t.length;i++)e+=t.charCodeAt(i)*t.charCodeAt(i)*i*i;return e.toString(16).substring(0,4)}function Et(t){const e=t.length,i=Math.floor(e/2),n=t.substring(0,4).padEnd(4,"0"),o=t.substring(0,4).padEnd(4,"0");return`@assets/${Ot(e.toString(16).padEnd(4,n))}${Ot(t.substring(i-4,i).padEnd(4,n)).padEnd(4,"f")}-${Ot(t.substring(i-8,i-4).padEnd(4,n)).padEnd(4,"f")}-${Ot(t.substring(i-12,i-8).padEnd(4,n)).padEnd(4,"f")}-${Ot(t.substring(i-16,i-12).padEnd(4,o)).padEnd(4,"f")}-${Ot(t.substring(i,i+4).padEnd(4,o)).padEnd(4,"f")}${Ot(t.substring(i+4,i+8).padEnd(4,o)).padEnd(4,"f")}${Ot(o.padEnd(4,n).padEnd(4,o))}`}function Wt(t){return function t(e){const i=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return e;if("Array"===i){const i=[];return e.forEach((e=>{i.push(t(e))})),i}if("Object"===i){const i={};Object.keys(e).forEach((n=>{i[n]=t(e[n])}));return Object.getOwnPropertySymbols(e).forEach((n=>{i[n]=t(e[n])})),i}}(t)}function Ct(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const At={type(t,e){const i=Ct(t);return!0===e?i.toLocaleLowerCase():i},array:t=>"Array"===Ct(t),json:t=>"Object"===Ct(t),function:t=>"Function"===Ct(t),asyncFunction:t=>"AsyncFunction"===Ct(t),boolean:t=>"Boolean"===Ct(t),string:t=>"String"===Ct(t),number:t=>"Number"===Ct(t),undefined:t=>"Undefined"===Ct(t),null:t=>"Null"===Ct(t),promise:t=>"Promise"===Ct(t)};var Rt=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))};const{Image:Tt}=window;function Lt(t){return new Promise(((e,i)=>{const n=new Tt;n.crossOrigin="anonymous",n.onload=function(){e(n)},n.onabort=i,n.onerror=i,n.src=t}))}function Vt(t){return Rt(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,i)=>{const n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(n),o.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},o.onerror=function(t){i(t)}}))}(t);return yield Lt(e)}))}function jt(t,e){return Rt(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&amp;");const i=yield function(t,e){const{width:i,height:n}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${n||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),s=new FileReader;s.readAsDataURL(a),s.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},s.onerror=function(t){o(t)}}))}(t,e);return yield Lt(i)}))}function Dt(t){return"number"==typeof t&&(t>0||t<=0)}function $t(t){return"number"==typeof t&&t>=0}function Bt(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function Xt(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const Yt={x:function(t){return Dt(t)},y:function(t){return Dt(t)},w:$t,h:function(t){return"number"==typeof t&&t>=0},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:Dt,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return $t(t)},borderRadius:function(t){return Dt(t)&&t>=0},color:function(t){return kt(t)},imageSrc:function(t){return Xt(t)||Bt(t)},imageURL:Bt,imageBase64:Xt,svg:function(t){return"string"==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test(`${t}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${t}`.trim())},html:function(t){let e=!1;if("string"==typeof t){let i=document.createElement("div");i.innerHTML=t,i.children.length>0&&(e=!0),i=null}return e},text:function(t){return"string"==typeof t},fontSize:function(t){return Dt(t)&&t>0},lineHeight:function(t){return Dt(t)&&t>0},textAlign:function(t){return["center","left","right"].includes(t)},fontFamily:function(t){return"string"==typeof t&&t.length>0},fontWeight:function(t){return["bold"].includes(t)},strokeWidth:function(t){return Dt(t)&&t>0}};var Ht,Ft=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Ut{constructor(){Ht.set(this,void 0),function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,i):o?o.value=i:e.set(t,i)}(this,Ht,new Map,"f")}on(t,e){if(Ft(this,Ht,"f").has(t)){const i=Ft(this,Ht,"f").get(t)||[];null==i||i.push(e),Ft(this,Ht,"f").set(t,i)}else Ft(this,Ht,"f").set(t,[e])}off(t,e){if(Ft(this,Ht,"f").has(t)){const i=Ft(this,Ht,"f").get(t);if(Array.isArray(i))for(let t=0;t<(null==i?void 0:i.length);t++)if(i[t]===e){i.splice(t,1);break}Ft(this,Ht,"f").set(t,i||[])}}trigger(t,e){const i=Ft(this,Ht,"f").get(t);return!!Array.isArray(i)&&(i.forEach((t=>{t(e)})),!0)}has(t){if(Ft(this,Ht,"f").has(t)){const e=Ft(this,Ht,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){Ft(this,Ht,"f").clear()}}function Nt(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}Ht=new WeakMap;var Gt,Qt,qt,Kt,Jt,Zt=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},_t=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class te{constructor(t){Gt.add(this),Qt.set(this,void 0),qt.set(this,void 0),Kt.set(this,void 0),Zt(this,qt,Wt(t.defaultStorage),"f"),Zt(this,Qt,_t(this,Gt,"m",Jt).call(this),"f"),Zt(this,Kt,t.defaultStatic||{},"f")}set(t,e){_t(this,Qt,"f")[t]=e}get(t){return _t(this,Qt,"f")[t]}setStatic(t,e){_t(this,Kt,"f")[t]=e}getStatic(t){return _t(this,Kt,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?Wt(_t(this,Qt,"f")):Object.assign({},_t(this,Qt,"f"))}clear(){Zt(this,Qt,_t(this,Gt,"m",Jt).call(this),"f")}destroy(){Zt(this,Qt,null,"f"),Zt(this,Kt,null,"f")}}function ee(t){return t/180*Math.PI}function ie(t,e,i){const n=ne(e);!function(t,e,i,n){const o=ee(e||0);i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(o),t.translate(-i.x,-i.y)),n(t),i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(-o),t.translate(-i.x,-i.y))}(t,e.angle||0,n,(()=>{i(t)}))}function ne(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function oe(t){const e=Math.min(t[0].x,t[1].x,t[2].x,t[3].x),i=Math.min(t[0].y,t[1].y,t[2].y,t[3].y);return ne({x:e,y:i,w:Math.max(t[0].x,t[1].x,t[2].x,t[3].x)-e,h:Math.max(t[0].y,t[1].y,t[2].y,t[3].y)-i})}function ae(t,e,i){const n=function(t,e){const i=e.x-t.x,n=e.y-t.y;if(0===i){if(n<0)return 0;if(n>0)return Math.PI}else if(0===n){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&n<0?Math.atan(Math.abs(i)/Math.abs(n)):i>0&&n>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):0}(t,e);let o=n+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const a=function(t,e){const i=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===i?i:Math.sqrt(i)}(t,e);let s=0,r=0;return 0===o?(s=0,r=0-a):o>0&&o<Math.PI/2?(s=Math.sin(o)*a,r=0-Math.cos(o)*a):o===Math.PI/2?(s=a,r=0):o>Math.PI/2&&o<Math.PI?(s=Math.sin(Math.PI-o)*a,r=Math.cos(Math.PI-o)*a):o===Math.PI?(s=0,r=a):o>Math.PI&&o<1.5*Math.PI?(s=0-Math.sin(o-Math.PI)*a,r=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(s=0-a,r=0):o>1.5*Math.PI&&o<2*Math.PI?(s=0-Math.sin(2*Math.PI-o)*a,r=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(s=0,r=0-a),s+=t.x,r+=t.y,{x:s,y:r}}function se(t,e,i){const{x:n,y:o,w:a,h:s}=t;let r={x:n,y:o},l={x:n+a,y:o},h={x:n+a,y:o+s},c={x:n,y:o+s};if(i&&(i>0||i<0)){const t=ee(function(t){if(!(t>0||t<0)||0===t)return 0;let e=t%360;e<0&&(e+=360);return e}(i));r=ae(e,r,t),l=ae(e,l,t),h=ae(e,h,t),c=ae(e,c,t)}return[r,l,h,c]}function re(t){const{angle:e=0}=t;return se(t,ne(t),e)}function le(t,e,i){return[ae(t,{x:e[0].x,y:e[0].y},i),ae(t,{x:e[1].x,y:e[1].y},i),ae(t,{x:e[2].x,y:e[2].y},i),ae(t,{x:e[3].x,y:e[3].y},i)]}function he(t,e){var i;const n=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;n.push(a),o=a.detail.children}return n}function ce(t){const{x:e,y:i,h:n,w:o}=t;return[{x:e,y:i},{x:e+o,y:i},{x:e+o,y:i+n},{x:e,y:i+n}]}function fe(t){const{x:e,y:i,w:n,h:o,angle:a=0}=t;return 0===a?ce(t):se(t,ne({x:e,y:i,w:n,h:o,angle:a}),a)}function de(t,e){const{groupQueue:i}=e;if(!(i.length>0))return[fe(t)];const n=function(t){const e=[];let i=0,n=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:s,y:r,w:l,h:h,angle:c=0}=a[t];let f;if(i+=s,n+=r,0===t){const t={x:i,y:n,w:l,h:h,angle:c};f=fe({x:s,y:r,w:l,h:h,angle:c}),o.push({center:ne(t),angle:c,radian:ee(c)})}else{f=ce({x:i,y:n,w:l,h:h,angle:c});for(let t=0;t<o.length;t++){const{center:e,radian:i}=o[t];f=le(e,f,i)}const t=oe(f);(c>0||c<0)&&(f=le(t,f,ee(c))),o.push({center:t,angle:c,radian:ee(c)})}e.push(f)}return e}([...i,t]);return n}function ue(t,e){const{viewScaleInfo:i}=e,{x:n,y:o,w:a,h:s,angle:r}=t,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:n*l+c,y:o*l+h,w:a*l,h:s*l,angle:r}}function ve(t,e){const{viewScaleInfo:i}=e,{x:n,y:o}=t,{scale:a,offsetTop:s,offsetLeft:r}=i;return{x:n*a+r,y:o*a+s}}function we(t,e){const{context2d:i,element:n,viewScaleInfo:o}=e,{angle:a=0}=n,{x:s,y:r,w:l,h:h}=ue(n,{viewScaleInfo:o}),c=re({x:s,y:r,w:l,h:h,angle:a});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let t=1;t<c.length;t++)i.lineTo(c[t].x,c[t].y);i.closePath()}return!!i.isPointInPath(t.x,t.y)}function ge(t,e){const{groupQueue:i}=e,n=function(t,e){return de(t,e).pop()||null}(t,{groupQueue:i}),o=Nt(n[0],n[1]),a=Nt(n[1],n[2]),s=Nt(n[2],n[3]),r=Nt(n[3],n[0]),l=n[0],h=n[1],c=n[2],f=n[3],d=Math.max(l.x,h.x,c.x,f.x),u=Math.max(l.y,h.y,c.y,f.y);return{center:{x:(d+Math.min(l.x,h.x,c.x,f.x))/2,y:(u+Math.min(l.y,h.y,c.y,f.y))/2},topLeft:l,topRight:h,bottomLeft:f,bottomRight:c,top:o,right:a,left:r,bottom:s}}function pe(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),i=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),n=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},s={x:n,y:o},r={x:e,y:o},l={x:e,y:i},h={x:n,y:i},c=Nt(s,r),f=Nt(h,l),d=Nt(s,h);return{center:a,topLeft:s,topRight:r,bottomLeft:h,bottomRight:l,top:c,right:Nt(r,l),left:d,bottom:f}}function ye(t,e){const i=function(t){const{viewScaleInfo:e,viewSizeInfo:i}=t,{scale:n,offsetTop:o,offsetLeft:a}=e,{width:s,height:r}=i,l=0-a/n,h=0-o/n,c=s/n,f=r/n,d=ne({x:l,y:h,w:c,h:f}),u={x:l,y:h},v={x:l+c,y:h},w={x:l,y:h+f},g={x:l+c,y:h+f},p={x:l,y:d.y},y={x:d.x,y:h},m={x:l+c,y:d.y},b={x:d.x,y:h+f};return{center:d,topLeft:u,topRight:v,bottomLeft:w,bottomRight:g,left:p,top:y,right:m,bottom:b}}(e);let n=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const i=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),n=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),s=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),r=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),h=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return i<=r&&n>=s&&o<=h&&a>=l||r<=a&&r>=a&&r<=a&&r>=a}(a.rangeRectInfo,i),a.isVisibleInView?n++:o++})),{viewVisibleInfoMap:t,visibleCount:n,invisibleCount:o}}function me(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}Qt=new WeakMap,qt=new WeakMap,Kt=new WeakMap,Gt=new WeakSet,Jt=function(){return Wt(_t(this,qt,"f"))};const be={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function xe(t,e){const{viewScaleInfo:i}=e,{scale:n}=i;let{borderRadius:o,borderDash:a}=t.detail;const s=Array.isArray(a)&&a.length>0,{boxSizing:r=be.boxSizing,borderWidth:l}=t.detail;Array.isArray(l)&&(o=0);let{x:h,y:c,w:f,h:d}=t,u=[0,0,0,0];if("number"==typeof o){const t=o*n;u=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(u=[o[0]*n,o[1]*n,o[2]*n,o[3]*n]);let v=0;return"number"==typeof l&&(v=(l||0)*n),"border-box"!==r||s?"content-box"===r?(h=t.x-v/2,c=t.y-v/2,f=t.w+v,d=t.h+v):(h=t.x,c=t.y,f=t.w,d=t.h):(h=t.x+v/2,c=t.y+v/2,f=t.w-v,d=t.h-v),f=Math.max(f,1),d=Math.max(d,1),u=u.map((t=>Math.min(t,f/2,d/2))),{x:h,y:c,w:f,h:d,radiusList:u}}const Se=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function Ie(t,e,i){if("string"==typeof e)return e;const{viewElementSize:n,viewScaleInfo:o,opacity:a=1}=i,{x:s,y:r}=n,{scale:l}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:i,end:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l},c={x:s+n.x*l,y:r+n.y*l},f=t.createLinearGradient(h.x,h.y,c.x,c.y);return o.forEach((t=>{f.addColorStop(t.offset,zt(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:i,outer:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l,radius:i.radius*l},c={x:s+n.x*l,y:r+n.y*l,radius:n.radius*l},f=t.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return o.forEach((t=>{f.addColorStop(t.offset,zt(t.color,a))})),f}return"#000000"}const Me={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function ke(t){var e,i,n,o;let a=1;return void 0!==(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.opacity)&&(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.opacity)<=1&&(a=null===(o=null==t?void 0:t.detail)||void 0===o?void 0:o.opacity),a}function ze(t,e,i){const{pattern:n,renderContent:o,originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=ke(a)*h,{clipPath:f,clipPathStrokeColor:d,clipPathStrokeWidth:u}=a.detail,v=()=>{t.globalAlpha=c,Pe(t,e,{pattern:n,viewScaleInfo:r,viewSizeInfo:l}),null==o||o(),Oe(t,e,{viewScaleInfo:r,viewSizeInfo:l}),t.globalAlpha=h};f?(function(t,e,i){const{renderContent:n,originElem:o,calcElemSize:a,viewSizeInfo:s}=i,r=s.devicePixelRatio,{clipPath:l}=(null==o?void 0:o.detail)||{};if(l&&a&&l.commands){const{x:i,y:o,w:s,h:h}=a,{originW:c,originH:f,originX:d,originY:u}=l,v=s/c,w=h/f,g=i-d*v,p=o-u*w;t.save(),t.translate(g,p),t.scale(r*v,r*w);const y=me(l.commands||[]),m=new Path2D(y);t.clip(m),t.translate(0-g,0-p),t.setTransform(1,0,0,1,0,0),ie(t,Object.assign({},e),(()=>{null==n||n()})),t.restore()}else null==n||n()}(t,e,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,renderContent:()=>{v()}}),"number"==typeof u&&u>0&&d&&function(t,e,i){const{renderContent:n,originElem:o,calcElemSize:a,viewSizeInfo:s,parentOpacity:r}=i,l=s.devicePixelRatio,{clipPath:h,clipPathStrokeColor:c,clipPathStrokeWidth:f}=(null==o?void 0:o.detail)||{};if(h&&a&&h.commands&&"number"==typeof f&&f>0&&c){const{x:i,y:o,w:s,h:d}=a,{originW:u,originH:v,originX:w,originY:g}=h,p=s/u,y=d/v,m=i-w*p,b=o-g*y;t.save(),t.globalAlpha=r,t.translate(m,b),t.scale(l*p,l*y);const x=me(h.commands||[]),S=new Path2D(x);t.strokeStyle=c,t.lineWidth=f,t.stroke(S),t.translate(0-m,0-b),t.setTransform(1,0,0,1,0,0),ie(t,Object.assign({},e),(()=>{null==n||n()})),t.restore()}else null==n||n()}(t,e,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,parentOpacity:h})):v()}function Pe(t,e,i){var n,o;const{pattern:a,viewScaleInfo:s,viewSizeInfo:r}=i,l=[];if(e.detail.background||a){const{x:i,y:h,w:c,h:f,radiusList:d}=xe(e,{viewScaleInfo:s,viewSizeInfo:r});if(t.beginPath(),t.moveTo(i+d[0],h),t.arcTo(i+c,h,i+c,h+f,d[1]),t.arcTo(i+c,h+f,i,h+f,d[2]),t.arcTo(i,h+f,i,h,d[3]),t.arcTo(i,h,i+c,h,d[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(At.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null===(n=e.detail.background)||void 0===n?void 0:n.type)){const n=Ie(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});t.fillStyle=n}else if("radial-gradient"===(null===(o=e.detail.background)||void 0===o?void 0:o.type)){const n=Ie(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});if(t.fillStyle=n,l&&l.length>0)for(let e=0;e<(null==l?void 0:l.length);e++){const n=l[e];"translate"===n.method?t.translate(n.args[0]+i,n.args[1]+h):"rotate"===n.method?t.rotate(...n.args):"scale"===n.method&&t.scale(...n.args)}}t.fill(),l&&l.length>0&&t.setTransform(1,0,0,1,0,0)}}function Oe(t,e,i){if(0===e.detail.borderWidth)return;if(!kt(e.detail.borderColor))return;const{viewScaleInfo:n}=i,{scale:o}=n;let a=Me.borderColor;!0===kt(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderWidth:s,borderRadius:r,borderDash:l,boxSizing:h=Me.boxSizing}=e.detail;let c=0;"number"==typeof s&&(c=s||1),c*=o;let f=[0,0,0,0];if("number"==typeof r){const t=r*o;f=[t,t,t,t]}else Array.isArray(r)&&4===(null==r?void 0:r.length)&&(f=[r[0]*o,r[1]*o,r[2]*o,r[3]*o]);t.strokeStyle=a;let d=[];Array.isArray(l)&&l.length>0&&(d=l.map((t=>Math.ceil(t*o))));let u=0,v=0,w=0,g=0;if(Array.isArray(s)&&(u=(s[0]||0)*o,v=(s[1]||0)*o,w=(s[2]||0)*o,g=(s[3]||0)*o),g||v||u||w){t.lineCap="butt";let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i+=g/2,n+=u/2,o=o-g/2-v/2,a=a-u/2-w/2):"content-box"===h?(i-=g/2,n-=u/2,o=o+g/2+v/2,a=a+u/2+w/2):(i=e.x,n=e.y,o=e.w,a=e.h),u&&(t.beginPath(),t.lineWidth=u,t.moveTo(i-g/2,n),t.lineTo(i+o+v/2,n),t.closePath(),t.stroke()),v&&(t.beginPath(),t.lineWidth=v,t.moveTo(i+o,n-u/2),t.lineTo(i+o,n+a+w/2),t.closePath(),t.stroke()),w&&(t.beginPath(),t.lineWidth=w,t.moveTo(i-g/2,n+a),t.lineTo(i+o+v/2,n+a),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(i,n-u/2),t.lineTo(i,n+a+w/2),t.closePath(),t.stroke())}else{let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i=e.x+c/2,n=e.y+c/2,o=e.w-c,a=e.h-c):"content-box"===h?(i=e.x-c/2,n=e.y-c/2,o=e.w+c,a=e.h+c):(i=e.x,n=e.y,o=e.w,a=e.h),d.length>0?t.lineCap="butt":t.lineCap="square",o=Math.max(o,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(d),t.lineWidth=c,t.beginPath(),t.moveTo(i+f[0],n),t.arcTo(i+o,n,i+o,n+a,f[1]),t.arcTo(i+o,n+a,i,n+a,f[2]),t.arcTo(i,n+a,i,n,f[3]),t.arcTo(i,n,i+o,n,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function Ee(t,e,i){const{detail:n}=e,{viewScaleInfo:o,renderContent:a}=i,{shadowColor:s,shadowOffsetX:r,shadowOffsetY:l,shadowBlur:h}=n;Yt.number(h)?(t.save(),t.shadowColor=s||Me.shadowColor,t.shadowOffsetX=(r||0)*o.scale,t.shadowOffsetY=(l||0)*o.scale,t.shadowBlur=(h||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}const We={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};var Ce=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i};const Ae=.4;function Re(t,e,i){var n,o,a;if(!0===(null===(n=null==e?void 0:e.operations)||void 0===n?void 0:n.invisible))return;const{w:s,h:r}=e,{scale:l}=i.viewScaleInfo;if(l<1&&(s*l<Ae||r*l<Ae)||0===i.parentOpacity)return;const{overrideElementMap:h}=i;if(!(null===(a=null===(o=null==h?void 0:h[e.uuid])||void 0===o?void 0:o.operations)||void 0===a?void 0:a.invisible))try{switch(e.type){case"rect":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ue(e,{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});ie(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{Ee(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{ze(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}(t,e,i);break;case"circle":!function(t,e,i){const{detail:n,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:s,parentOpacity:r}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:f=0,borderDash:d}=n;let u=0;"number"==typeof f&&f>0?u=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(u=f[0]),u*=a.scale;const{x:v,y:w,w:g,h:p}=ue({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,y=Object.assign(Object.assign({},e),{x:v,y:w,w:g,h:p,angle:o});ie(t,{x:v,y:w,w:g,h:p,angle:o},(()=>{Ee(t,y,{viewScaleInfo:a,viewSizeInfo:s,renderContent:()=>{let e=g/2,i=p/2;const n=v+e,o=w+i,s=e,f=i;if(u>0&&("content-box"===c||("center-line"===c?(e-=u/2,i-=u/2):(e-=u,i-=u))),e>=0&&i>=0){const c=ke(y)*r;t.globalAlpha=c,t.beginPath();const m=Ie(t,l,{viewElementSize:{x:v,y:w,w:g,h:p},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=m,t.circle(n,o,s,f,0,0,2*Math.PI),t.closePath(),t.fill(),t.globalAlpha=r,"number"==typeof u&&u>0){const s=u/2+e,r=u/2+i;if(t.beginPath(),d){const e=d.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=h,t.lineWidth=u,t.circle(n,o,s,r,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}(t,e,i);break;case"text":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ue(e,{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});ie(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{Ee(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{ze(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a})}});{const o=Object.assign(Object.assign({},We),e.detail),a=o.fontSize||We.fontSize,c=a*n.scale;if(c<2)return;const f=(o.lineHeight||a)*n.scale;t.fillStyle=e.detail.color||We.color,t.textBaseline="top",t.$setFont({fontWeight:o.fontWeight,fontSize:c,fontFamily:(i=o.fontFamily,[i,...Se].join(", "))});let d=o.text.replace(/\r\n/gi,"\n");"lowercase"===o.textTransform?d=d.toLowerCase():"uppercase"===o.textTransform&&(d=d.toUpperCase());const u=f,v=d.split("\n"),w=[];let g=0;v.forEach(((e,i)=>{if("maxContent"===o.minInlineSize)w.push({text:e,width:t.$undoPixelRatio(t.measureText(e).width)});else{let r="",c="",f=e.split(c);if("normal"===o.wordBreak){const t=" ",i=e.split(t);f=[],i.forEach(((e,n)=>{f.push(e),n<i.length-1&&f.push(t)}))}if(1===f.length&&"visible"===o.overflow)w.push({text:f[0],width:t.$undoPixelRatio(t.measureText(f[0]).width)});else if(f.length>0){for(let e=0;e<f.length&&(a=t.$doPixelRatio(l),s=t.measureText(r+f[e]).width,n.scale<.5&&a<s&&(a-s)/a>-.15||a>=s?r+=f[e]||"":(w.push({text:r,width:t.$undoPixelRatio(t.measureText(r).width)}),r=f[e]||"",g++),!((g+1)*u>h&&"hidden"===o.overflow));e++)if(f.length-1===e&&(g+1)*u<=h){w.push({text:r,width:t.$undoPixelRatio(t.measureText(r).width)}),i<v.length-1&&g++;break}}else w.push({text:"",width:0})}var a,s}));let p=0,y=0;u>c&&(y=(u-c)/2),w.length*u<h&&("top"===e.detail.verticalAlign?p=0:"bottom"===e.detail.verticalAlign?p+=h-w.length*u:p+=(h-w.length*u)/2);{const e=r+p;void 0!==o.textShadowColor&&kt(o.textShadowColor)&&(t.shadowColor=o.textShadowColor),void 0!==o.textShadowOffsetX&&Yt.number(o.textShadowOffsetX)&&(t.shadowOffsetX=o.textShadowOffsetX),void 0!==o.textShadowOffsetY&&Yt.number(o.textShadowOffsetY)&&(t.shadowOffsetY=o.textShadowOffsetY),void 0!==o.textShadowBlur&&Yt.number(o.textShadowBlur)&&(t.shadowBlur=o.textShadowBlur),w.forEach(((i,n)=>{let a=s;"center"===o.textAlign?a=s+(l-i.width)/2:"right"===o.textAlign&&(a=s+(l-i.width)),t.fillText(i.text,a,e+u*n+y)}))}}var i}))}(t,e,i);break;case"image":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ue(e,{viewScaleInfo:o})||e,d=Object.assign(Object.assign({},e),{x:r,y:l,w:h,h:c,angle:f});ie(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{Ee(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{ze(t,d,{originElem:e,calcElemSize:{x:r,y:l,w:h,h:c,angle:f},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s,renderContent:()=>{if(n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"image"===e.type&&n){t.globalAlpha=ke(e)*s;const{x:i,y:r,w:l,h:h,radiusList:c}=xe(d,{viewScaleInfo:o,viewSizeInfo:a}),{detail:f}=e,{scaleMode:u,originW:v=0,originH:w=0}=f,g=t.$undoPixelRatio(v),p=t.$undoPixelRatio(w);if(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(i+c[0],r),t.arcTo(i+l,r,i+l,r+h,c[1]),t.arcTo(i+l,r+h,i,r+h,c[2]),t.arcTo(i,r+h,i,r,c[3]),t.arcTo(i,r,i+l,r,c[0]),t.closePath(),t.fill(),t.clip(),u&&w&&v){let o=0,a=0,s=g,c=p;const f=i,d=r,v=l,w=h;if(g>e.w||p>e.h)if("fill"===u){const t=Math.max(e.w/g,e.h/p),i=p*t;o=(g*t-e.w)/2/t,a=(i-e.h)/2/t,s=e.w/t,c=e.h/t}else if("tile"===u)o=0,a=0,s=e.w,c=e.h;else if("fit"===u){const t=Math.min(e.w/g,e.h/p);o=(g-e.w/t)/2,a=(p-e.h/t)/2,s=e.w/t,c=e.h/t}t.drawImage(n,o,a,s,c,f,d,v,w)}else t.drawImage(n,i,r,l,h);t.globalAlpha=s,t.restore()}}})}})}))}(t,e,i);break;case"svg":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ue(e,{viewScaleInfo:o,viewSizeInfo:a})||e;ie(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"svg"===e.type&&n&&(t.globalAlpha=ke(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"html":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ue(e,{viewScaleInfo:o,viewSizeInfo:a})||e;ie(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"html"===e.type&&n&&(t.globalAlpha=ke(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"path":!function(t,e,i){var n,o;const{detail:a}=e,{originX:s,originY:r,originW:l,originH:h,fillRule:c}=a,{viewScaleInfo:f,viewSizeInfo:d,parentOpacity:u}=i,{x:v,y:w,w:g,h:p,angle:y}=ue(e,{viewScaleInfo:f})||e,m=g/l,b=p/h,x=v-s*m,S=w-r*b,I=e.detail,M=Ce(I,["clipPath","clipPathStrokeColor","clipPathStrokeWidth"]),k=f.scale*d.devicePixelRatio,z=Object.assign(Object.assign({},e),{x:v,y:w,w:g,h:p,angle:y});let P=Object.assign({},z);P.detail=M;let O=Object.assign({},e);O.detail=M,a.fill&&"string"!==a.fill&&(null===(o=null===(n=a.fill)||void 0===n?void 0:n.type)||void 0===o?void 0:o.includes("gradient"))&&(P=Object.assign(Object.assign({},z),{detail:Object.assign(Object.assign({},z.detail),{background:a.fill,clipPath:{commands:a.commands,originX:s,originY:r,originW:l,originH:h}})}),O.detail=Object.assign({},P.detail)),ie(t,{x:v,y:w,w:g,h:p,angle:y},(()=>{ze(t,P,{originElem:O,calcElemSize:{x:v,y:w,w:g,h:p,angle:y},viewScaleInfo:f,viewSizeInfo:d,parentOpacity:u,renderContent:()=>{Ee(t,z,{viewScaleInfo:f,viewSizeInfo:d,renderContent:()=>{t.save(),t.translate(x,S),t.scale(k*m/f.scale,k*b/f.scale);const e=me(a.commands||[]),i=new Path2D(e);a.fill&&("string"==typeof a.fill?t.fillStyle=a.fill:t.fillStyle="transparent"),a.fill&&t.fill(i,c),a.stroke&&0!==a.strokeWidth&&(t.strokeStyle=a.stroke,t.lineWidth=(a.strokeWidth||1)/d.devicePixelRatio,t.lineCap=a.strokeLineCap||"square",t.stroke(i)),t.translate(-x,-S),t.restore()}})}})}))}(t,e,i);break;case"group":{const n=Object.assign(Object.assign({},i.elementAssets||{}),e.detail.assets||{});!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ue({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});ie(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{t.globalAlpha=ke(e)*a,Ee(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{ze(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:s,y:r,w:l,h:h,radiusList:c}=xe(f,{viewScaleInfo:n,viewSizeInfo:o});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+c[0],r),t.arcTo(s+l,r,s+l,r+h,c[1]),t.arcTo(s+l,r+h,s,r+h,c[2]),t.arcTo(s,r+h,s,r,c[3]),t.arcTo(s,r,s+l,r,c[0]),t.closePath(),t.fill(),t.clip()),Array.isArray(e.detail.children)){const{parentElementSize:n}=i,o={x:n.x+e.x,y:n.y+e.y,w:e.w||n.w,h:e.h||n.h,angle:e.angle},{calculator:s}=i;for(let n=0;n<e.detail.children.length;n++){let r=e.detail.children[n];if(r=Object.assign(Object.assign({},r),{x:o.x+r.x,y:o.y+r.y}),!0===i.forceDrawAll||(null==s?void 0:s.needRender(r)))try{Re(t,r,Object.assign(Object.assign({},i),{parentOpacity:a*ke(e)}))}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}(t,e,Object.assign(Object.assign({},i),{elementAssets:n}));break}}}catch(t){console.error(t)}}const Te={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function Le(t,e,i){var n;const{elements:o=[]}=e,{parentOpacity:a}=i;for(let e=0;e<o.length;e++){const s=o[e],r=Object.assign(Object.assign({},s),{detail:Object.assign(Object.assign({},Te),null==s?void 0:s.detail)});if(!0===i.forceDrawAll||(null===(n=i.calculator)||void 0===n?void 0:n.needRender(r)))try{Re(t,r,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(t){console.error(t)}}}var Ve,je,De,$e,Be,Xe,Ye,He,Fe,Ue,Ne,Ge,Qe=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))},qe=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},Ke=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i};const Je=["image","svg","html"],Ze=t=>{var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),"string"==typeof o&&o?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${o}`)?o:Et(o):Et(`${Pt()}-${t.uuid}-${Pt()}-${Pt()}`)};class _e extends Ut{constructor(){super(),Ve.add(this),je.set(this,{}),De.set(this,{}),$e.set(this,{}),Be.set(this,!1),qe(this,Ve,"m",Xe).call(this,"image",((t,e)=>Qe(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.src])||void 0===i?void 0:i.value)||t.detail.src,o=yield Lt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),qe(this,Ve,"m",Xe).call(this,"html",((t,e)=>Qe(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.html])||void 0===i?void 0:i.value)||t.detail.html,o=yield jt(n,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),qe(this,Ve,"m",Xe).call(this,"svg",((t,e)=>Qe(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.svg])||void 0===i?void 0:i.value)||t.detail.svg,o=yield Vt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))))}isDestroyed(){return qe(this,Be,"f")}destroy(){Ke(this,Be,!0,"f"),this.clear(),Ke(this,je,null,"f"),Ke(this,De,null,"f"),Ke(this,$e,null,"f")}load(t,e){!0!==qe(this,Be,"f")&&(qe(this,Ve,"m",Ge).call(this,t)||Je.includes(t.type)&&qe(this,Ve,"m",Ne).call(this,t,e))}getContent(t){var e,i;const n=Ze(t);return(null===(i=null===(e=qe(this,$e,"f"))||void 0===e?void 0:e[n])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return qe(this,$e,"f")}setLoadItemMap(t){Ke(this,$e,t,"f")}}je=new WeakMap,De=new WeakMap,$e=new WeakMap,Be=new WeakMap,Ve=new WeakSet,Xe=function(t,e){qe(this,je,"f")[t]=e},Ye=function(t){var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),o},He=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:qe(this,Ve,"m",Ye).call(this,t)}},Fe=function(t){const e=Ze(t.element),i=qe(this,$e,"f")[e];qe(this,Be,"f")||(i?i.startTime<t.startTime&&(qe(this,$e,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(qe(this,$e,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},Ue=function(t){var e;const i=Ze(t.element),n=null===(e=qe(this,$e,"f"))||void 0===e?void 0:e[i];qe(this,Be,"f")||(n?n.startTime<t.startTime&&(qe(this,$e,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(qe(this,$e,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},Ne=function(t,e){const i=qe(this,Ve,"m",He).call(this,t),n=Ze(t);if(qe(this,De,"f")[n])return;qe(this,De,"f")[n]=i;const o=qe(this,je,"f")[t.type];"function"!=typeof o||qe(this,Be,"f")||(i.startTime=Date.now(),o(t,e).then((t=>{qe(this,Be,"f")||(i.content=t.content,i.endTime=Date.now(),i.status="load",qe(this,Ve,"m",Fe).call(this,i))})).catch((e=>{console.warn(`Load element source "${i.source}" fail`,e,t),i.endTime=Date.now(),i.status="error",i.error=e,qe(this,Ve,"m",Ue).call(this,i)})))},Ge=function(t){var e;const i=Ze(t),n=null===(e=qe(this,De,"f"))||void 0===e?void 0:e[i];return!(!n||"error"!==n.status||!n.source||n.source!==qe(this,Ve,"m",Ye).call(this,t))};var ti,ei,ii,ni,oi,ai=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},si=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class ri extends Ut{constructor(t){super(),ti.add(this),ei.set(this,void 0),ii.set(this,new _e),ni.set(this,!1),ai(this,ei,t,"f"),si(this,ti,"m",oi).call(this)}isDestroyed(){return si(this,ni,"f")}destroy(){this.clear(),ai(this,ei,null,"f"),si(this,ii,"f").destroy(),ai(this,ii,null,"f"),ai(this,ni,!0,"f")}updateOptions(t){ai(this,ei,t,"f")}drawData(t,e){const i=si(this,ii,"f"),{calculator:n,sharer:o}=si(this,ei,"f"),a=si(this,ei,"f").viewContext;a.clearRect(0,0,a.canvas.width,a.canvas.height);const s={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height},r=Object.assign({loader:i,calculator:n,parentElementSize:s,elementAssets:t.assets,parentOpacity:1,overrideElementMap:null==o?void 0:o.getActiveOverrideElemenentMap()},e);!function(t,e,i){if("string"==typeof(null==e?void 0:e.background)){const{viewSizeInfo:n}=i,{width:o,height:a}=n;t.globalAlpha=1,t.fillStyle=e.background,t.fillRect(0,0,o,a)}}(a,t.global,r),t.layout?function(t,e,i,n){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,r=Object.assign({uuid:"layout",type:"group"},e),{x:l,y:h,w:c,h:f}=ue(r,{viewScaleInfo:o})||r,d=Object.assign(Object.assign({},r),{x:l,y:h,w:c,h:f,angle:0});if(t.globalAlpha=1,Ee(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{Pe(t,d,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:n,viewSizeInfo:o}=i,a=Object.assign({uuid:"layout",type:"group"},e),s=ue(a,{viewScaleInfo:n})||a,r=Object.assign(Object.assign({},a),s),{x:l,y:h,w:c,h:f,radiusList:d}=xe(r,{viewScaleInfo:n,viewSizeInfo:o});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(l+d[0],h),t.arcTo(l+c,h,l+c,h+f,d[1]),t.arcTo(l+c,h+f,l,h+f,d[2]),t.arcTo(l,h+f,l,h,d[3]),t.arcTo(l,h,l+c,h,d[0]),t.closePath(),t.fill(),t.clip()}n(t),"hidden"===e.detail.overflow&&t.restore(),Oe(t,d,{viewScaleInfo:o,viewSizeInfo:a}),t.globalAlpha=s}(a,t.layout,r,(()=>{Le(a,t,r)})):Le(a,t,r)}scale(t){const{sharer:e}=si(this,ei,"f");if(!e)return;const{data:i,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s,width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}=e.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:t,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s},viewSizeInfo:{width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}})}setLoadItemMap(t){si(this,ii,"f").setLoadItemMap(t)}getLoadItemMap(){return si(this,ii,"f").getLoadItemMap()}getLoader(){return si(this,ii,"f")}}ei=new WeakMap,ii=new WeakMap,ni=new WeakMap,ti=new WeakSet,oi=function(){const t=si(this,ii,"f");t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))};class li{constructor(t){St(this,e,void 0),St(this,i,void 0),It(this,e,t),It(this,i,new te({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){It(this,e,null)}needRender(t){const e=xt(this,i).get("viewVisibleInfoMap")[t.uuid];return!e||e.isVisibleInView}isPointInElement(t,i,n,o){return we(t,{context2d:xt(this,e).viewContext,element:i,viewScaleInfo:n,viewSizeInfo:o})}getPointElement(t,i){return function(t,e){var i,n,o;const{context2d:a,data:s,viewScaleInfo:r,viewSizeInfo:l,groupQueue:h}=e,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let e=h.length-1;e>=0;e--){let o=0,s=0,f=0;for(let t=0;t<=e;t++)o+=h[t].x,s+=h[t].y,f+=h[t].angle||0;const d=h[e];if(d&&"group"===d.type&&Array.isArray(null===(i=d.detail)||void 0===i?void 0:i.children))for(let i=0;i<d.detail.children.length;i++){const u=d.detail.children[i];if(!0!==(null===(n=null==u?void 0:u.operations)||void 0===n?void 0:n.invisible)){if(!u)break;if(we(t,{context2d:a,element:{x:o+u.x,y:s+u.y,w:u.w,h:u.h,angle:f+(u.angle||0)},viewScaleInfo:r,viewSizeInfo:l})){c.element=u,(e<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=s.elements.length-1;e>=0;e--){const i=s.elements[e];if(!0!==(null===(o=null==i?void 0:i.operations)||void 0===o?void 0:o.invisible)&&we(t,{context2d:a,element:i,viewScaleInfo:r,viewSizeInfo:l})){c.index=e,c.element=i;break}}return c}(t,{...i,context2d:xt(this,e).viewContext})}resetViewVisibleInfoMap(t,e){if(t){const{viewVisibleInfoMap:n,invisibleCount:o,visibleCount:a}=function(t,e){const i={},n=[],o=e=>{const a={isVisibleInView:!0,isGroup:"group"===e.type,position:[...n]};let s=null;s=ge(e,{groupQueue:he(t,n)||[]}),i[e.uuid]=Object.assign(Object.assign({},a),{originRectInfo:s,rangeRectInfo:Yt.angle(e.angle)?pe(s):s}),"group"===e.type&&e.detail.children.forEach(((t,e)=>{n.push(e),o(t),n.pop()}))};return t.forEach(((t,e)=>{n.push(e),o(t),n.pop()})),ye(i,e)}(t.elements,e);xt(this,i).set("viewVisibleInfoMap",n),xt(this,i).set("invisibleCount",o),xt(this,i).set("visibleCount",a)}}updateVisiableStatus(t){const{viewVisibleInfoMap:e,invisibleCount:n,visibleCount:o}=ye(xt(this,i).get("viewVisibleInfoMap"),t);xt(this,i).set("viewVisibleInfoMap",e),xt(this,i).set("invisibleCount",n),xt(this,i).set("visibleCount",o)}calcViewRectInfoFromOrigin(t,e){const n=xt(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:v,bottomRight:w}=n.originRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const g={viewScaleInfo:a,viewSizeInfo:s};return{center:ve(r,g),left:ve(l,g),right:ve(h,g),bottom:ve(c,g),top:ve(f,g),topLeft:ve(d,g),topRight:ve(u,g),bottomLeft:ve(v,g),bottomRight:ve(w,g)}}calcViewRectInfoFromRange(t,e){const n=xt(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:v,bottomRight:w}=n.rangeRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const g={viewScaleInfo:a,viewSizeInfo:s};return{center:ve(r,g),left:ve(l,g),right:ve(h,g),bottom:ve(c,g),top:ve(f,g),topLeft:ve(d,g),topRight:ve(u,g),bottomLeft:ve(v,g),bottomRight:ve(w,g)}}modifyViewVisibleInfoMap(t,e){const{modifyOptions:n,viewScaleInfo:o,viewSizeInfo:a}=e,{type:s,content:r}=n,l=t.elements,h=xt(this,i).get("viewVisibleInfoMap");if("deleteElement"===s){const{element:t}=r,e=[],n=t=>{e.push(t.uuid),"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{n(t)}))};n(t),e.forEach((t=>{delete h[t]})),xt(this,i).set("viewVisibleInfoMap",h)}else if("addElement"===s||"updateElement"===s){const{position:e}=r,n=function(t,e){let i=null,n=e;for(let e=0;e<t.length;e++){const o=n[t[e]];if(e<t.length-1&&"group"===o.type)n=o.detail.children;else{if(e!==t.length-1)break;i=o}}return i}(e,t.elements),c=he(l,e);if(n)if("updateElement"===s&&"group"===n.type)this.resetViewVisibleInfoMap(t,{viewScaleInfo:o,viewSizeInfo:a});else{const t=ge(n,{groupQueue:c||[]}),r={originRectInfo:t,rangeRectInfo:Yt.angle(n.angle)?pe(t):t,isVisibleInView:!0,isGroup:"group"===(null==n?void 0:n.type),position:[...e]};h[n.uuid]=r,xt(this,i).set("viewVisibleInfoMap",h),"updateElement"===s&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:a})}}else"moveElement"===s&&this.resetViewVisibleInfoMap(t,{viewScaleInfo:o,viewSizeInfo:a})}}function hi(t){return t>0||t<0||0===t}e=new WeakMap,i=new WeakMap;class ci extends Ut{constructor(t){super(),St(this,s),St(this,g),St(this,y),St(this,b),St(this,n,void 0),St(this,o,void 0),St(this,a,!1),St(this,l,(t=>{if(!Mt(this,g,p).call(this,t))return;const e=Mt(this,y,m).call(this,t);if(!Mt(this,b,x).call(this,e))return;t.preventDefault(),t.stopPropagation();const i=t.deltaX>0||t.deltaX<0?t.deltaX:0,n=t.deltaY>0||t.deltaY<0?t.deltaY:0;!0===t.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:n,point:e}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:n,point:e})})),St(this,h,(t=>{if(2!==t.button)return;if(!Mt(this,g,p).call(this,t))return;t.preventDefault();const e=Mt(this,y,m).call(this,t);Mt(this,b,x).call(this,e)&&this.trigger("contextMenu",{point:e})})),St(this,c,(t=>{if(!Mt(this,g,p).call(this,t))return;t.preventDefault();const e=Mt(this,y,m).call(this,t);if(!Mt(this,b,x).call(this,e))return;const i=Date.now(),n=xt(this,o).get("prevClickPoint");n&&i-n.t<=500&&Math.abs(n.x-e.x)<=5&&Math.abs(n.y-e.y)<=5?this.trigger("doubleClick",{point:e}):xt(this,o).set("prevClickPoint",e)})),St(this,f,(t=>{if(xt(this,o).set("hasPointDown",!1),!Mt(this,g,p).call(this,t))return;t.preventDefault();const e=Mt(this,y,m).call(this,t);this.trigger("pointLeave",{point:e})})),St(this,d,(t=>{if(xt(this,o).set("hasPointDown",!1),!Mt(this,g,p).call(this,t))return;t.preventDefault();const e=Mt(this,y,m).call(this,t);this.trigger("pointEnd",{point:e})})),St(this,u,(t=>{if(!Mt(this,g,p).call(this,t))return;t.preventDefault(),t.stopPropagation();const e=Mt(this,y,m).call(this,t);Mt(this,b,x).call(this,e)?!0===xt(this,o).get("hasPointDown")&&this.trigger("pointMove",{point:e}):xt(this,o).get("hasPointDown")&&(this.trigger("pointLeave",{point:e}),xt(this,o).set("hasPointDown",!1))})),St(this,v,(t=>{if(0!==t.button)return;if(!Mt(this,g,p).call(this,t))return;t.preventDefault();const e=Mt(this,y,m).call(this,t);Mt(this,b,x).call(this,e)&&(xt(this,o).set("hasPointDown",!0),this.trigger("pointStart",{point:e}))})),St(this,w,(t=>{if(!Mt(this,g,p).call(this,t))return;t.preventDefault();const e=Mt(this,y,m).call(this,t);Mt(this,b,x).call(this,e)&&this.trigger("hover",{point:e})}));const e=new te({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});It(this,o,e),It(this,n,t),Mt(this,s,r).call(this)}onEvents(){if(xt(this,a))return;const t=window;t.addEventListener("mousemove",xt(this,w)),t.addEventListener("mousedown",xt(this,v)),t.addEventListener("mousemove",xt(this,u)),t.addEventListener("mouseup",xt(this,d)),t.addEventListener("mouseleave",xt(this,f)),t.addEventListener("wheel",xt(this,l),{passive:!1}),t.addEventListener("click",xt(this,c)),t.addEventListener("contextmenu",xt(this,h))}offEvents(){const t=window;t.removeEventListener("mousemove",xt(this,w)),t.removeEventListener("mousedown",xt(this,v)),t.removeEventListener("mousemove",xt(this,u)),t.removeEventListener("mouseup",xt(this,d)),t.removeEventListener("mouseleave",xt(this,f)),t.removeEventListener("wheel",xt(this,l)),t.removeEventListener("click",xt(this,c)),t.removeEventListener("contextmenu",xt(this,h))}destroy(){this.offEvents(),xt(this,o).destroy(),It(this,a,!0)}}n=new WeakMap,o=new WeakMap,a=new WeakMap,s=new WeakSet,r=function(){this.onEvents()},l=new WeakMap,h=new WeakMap,c=new WeakMap,f=new WeakMap,d=new WeakMap,u=new WeakMap,v=new WeakMap,w=new WeakMap,g=new WeakSet,p=function(t){return t.target===xt(this,n).boardContent.boardContext.canvas},y=new WeakSet,m=function(t){const e=xt(this,n).boardContent.boardContext.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top,t:Date.now()}},b=new WeakSet,x=function(t){const e=xt(this,n).sharer.getActiveViewSizeInfo(),{width:i,height:o}=e;return!!(hi(t.x)&&hi(t.y)&&t.x<=i&&t.y<=o)};const fi={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0,overrideElementMap:null};class di{constructor(){St(this,S,void 0),St(this,I,void 0);const t=new te({defaultStorage:fi}),e=new te({defaultStorage:{}});It(this,S,t),It(this,I,e)}getActiveStorage(t){return xt(this,S).get(t)}setActiveStorage(t,e){return xt(this,S).set(t,e)}getActiveStoreSnapshot(t){return xt(this,S).getSnapshot(t)}getSharedStorage(t){return xt(this,I).get(t)}setSharedStorage(t,e){return xt(this,I).set(t,e)}getSharedStoreSnapshot(t){return xt(this,I).getSnapshot(t)}getActiveViewScaleInfo(){return{scale:xt(this,S).get("scale"),offsetTop:xt(this,S).get("offsetTop"),offsetBottom:xt(this,S).get("offsetBottom"),offsetLeft:xt(this,S).get("offsetLeft"),offsetRight:xt(this,S).get("offsetRight")}}setActiveViewScaleInfo(t){const{scale:e,offsetTop:i,offsetBottom:n,offsetLeft:o,offsetRight:a}=t;xt(this,S).set("scale",e),xt(this,S).set("offsetTop",i),xt(this,S).set("offsetBottom",n),xt(this,S).set("offsetLeft",o),xt(this,S).set("offsetRight",a)}setActiveViewSizeInfo(t){xt(this,S).set("width",t.width),xt(this,S).set("height",t.height),xt(this,S).set("devicePixelRatio",t.devicePixelRatio),xt(this,S).set("contextWidth",t.contextWidth),xt(this,S).set("contextHeight",t.contextHeight)}getActiveViewSizeInfo(){return{width:xt(this,S).get("width"),height:xt(this,S).get("height"),devicePixelRatio:xt(this,S).get("devicePixelRatio"),contextWidth:xt(this,S).get("contextWidth"),contextHeight:xt(this,S).get("contextHeight")}}getActiveOverrideElemenentMap(){return xt(this,S).get("overrideElementMap")}setActiveOverrideElemenentMap(t){xt(this,S).set("overrideElementMap",t)}}S=new WeakMap,I=new WeakMap;const{requestAnimationFrame:ui}=window;class vi extends Ut{constructor(t){super(),St(this,P),St(this,E),St(this,M,void 0),St(this,k,[]),St(this,z,"FREE"),It(this,M,t),Mt(this,P,O).call(this)}resetViewVisibleInfoMap(t,e){t&&xt(this,M).calculator.resetViewVisibleInfoMap(t,e)}drawFrame(){const{sharer:t}=xt(this,M),e=t.getActiveStoreSnapshot(),i=t.getSharedStoreSnapshot();xt(this,k).push({activeStore:e,sharedStore:i}),Mt(this,E,W).call(this)}scale(t){const{scale:e,point:i,ignoreUpdateVisibleStatus:n}=t,{sharer:o}=xt(this,M),{moveX:a,moveY:s}=function(t){const{scale:e,point:i,viewScaleInfo:n}=t,{offsetLeft:o,offsetTop:a}=n,s=e/n.scale,r=i.x,l=i.y;return{moveX:r-r*s+(o*s-o),moveY:l-l*s+(a*s-a)}}({scale:e,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",e),n||xt(this,M).calculator.updateVisiableStatus({viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()}),{moveX:a,moveY:s}}scroll(t){const{sharer:e}=xt(this,M),i=e.getActiveViewScaleInfo(),{moveX:n,moveY:o,ignoreUpdateVisibleStatus:a}=t,s=function(t){const{moveX:e=0,moveY:i=0,viewScaleInfo:n,viewSizeInfo:o}=t,{scale:a}=n,{width:s,height:r,contextWidth:l,contextHeight:h}=o;let c=n.offsetLeft,f=n.offsetRight,d=n.offsetTop,u=n.offsetBottom;return c+=e,d+=i,f=s-(l*a+c),u=r-(h*a+d),{scale:a,offsetTop:d,offsetLeft:c,offsetRight:f,offsetBottom:u}}({moveX:n,moveY:o,viewScaleInfo:i,viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(s),a||xt(this,M).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),s}updateViewScaleInfo(t){const{sharer:e}=xt(this,M),i=function(t,e){const{scale:i,offsetX:n,offsetY:o}=t,{viewSizeInfo:a}=e,{width:s,height:r,contextWidth:l,contextHeight:h}=a,c=0-n*i,f=0-o*i;return{scale:i,offsetLeft:c,offsetTop:f,offsetRight:s-(l*i+c/i),offsetBottom:r-(h*i+f/i)}}(t,{viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(i),xt(this,M).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),i}resize(t={},e){const{sharer:i}=xt(this,M),n={...i.getActiveViewSizeInfo(),...t},{width:o,height:a,devicePixelRatio:s}=n,{underlayContext:r,boardContext:l,overlayContext:h,viewContext:c}=xt(this,M).boardContent;return l.canvas.width=o*s,l.canvas.height=a*s,l.canvas.style.width=`${o}px`,l.canvas.style.height=`${a}px`,r.canvas.width=o*s,r.canvas.height=a*s,h.canvas.width=o*s,h.canvas.height=a*s,c.canvas.width=o*s,c.canvas.height=a*s,i.setActiveViewSizeInfo(n),(null==e?void 0:e.ignoreUpdateVisibleStatus)||xt(this,M).calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}M=new WeakMap,k=new WeakMap,z=new WeakMap,P=new WeakSet,O=function(){const{renderer:t}=xt(this,M);t.on("load",(()=>{this.drawFrame()}))},E=new WeakSet,W=function(){if("DRAWING"===xt(this,z)||0===xt(this,k).length)return;It(this,z,"DRAWING");const t=xt(this,k).shift(),{renderer:e,boardContent:i,beforeDrawFrame:n,afterDrawFrame:o}=xt(this,M);if(t){const{scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h,width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:v}=t.activeStore,w={scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h},g={width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:v};(null==t?void 0:t.activeStore.data)&&e.drawData(t.activeStore.data,{viewScaleInfo:w,viewSizeInfo:g}),n({snapshot:t}),i.drawView(),o({snapshot:t})}0!==xt(this,k).length?It(this,z,"DRAWING")&&ui((()=>{Mt(this,E,W).call(this)})):It(this,z,"COMPLETE")};return C=new WeakMap,A=new WeakMap,R=new WeakMap,T=new WeakMap,L=new WeakMap,V=new WeakMap,j=new WeakMap,D=new WeakMap,$=new WeakMap,B=new WeakMap,X=new WeakMap,Y=new WeakSet,H=function(){xt(this,L).on("pointStart",Mt(this,F,U).bind(this)),xt(this,L).on("pointEnd",Mt(this,N,G).bind(this)),xt(this,L).on("pointMove",Mt(this,Q,q).bind(this)),xt(this,L).on("hover",Mt(this,K,J).bind(this)),xt(this,L).on("wheel",Mt(this,it,nt).bind(this)),xt(this,L).on("wheelScale",Mt(this,ot,at).bind(this)),xt(this,L).on("scrollX",Mt(this,st,rt).bind(this)),xt(this,L).on("scrollY",Mt(this,lt,ht).bind(this)),xt(this,L).on("resize",Mt(this,ct,ft).bind(this)),xt(this,L).on("doubleClick",Mt(this,Z,_).bind(this)),xt(this,L).on("contextMenu",Mt(this,tt,et).bind(this)),xt(this,V).on("load",(()=>{xt(this,B).trigger("loadResource")}))},F=new WeakSet,U=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointStart)?void 0:e.call(n,t)))return}},N=new WeakSet,G=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointEnd)?void 0:e.call(n,t)))return}},Q=new WeakSet,q=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointMove)?void 0:e.call(n,t)))return}},K=new WeakSet,J=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.hover)?void 0:e.call(n,t)))return}},Z=new WeakSet,_=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.doubleClick)?void 0:e.call(n,t)))return}},tt=new WeakSet,et=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.contextMenu)?void 0:e.call(n,t)))return}},it=new WeakSet,nt=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.wheel)?void 0:e.call(n,t)))return}},ot=new WeakSet,at=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.wheelScale)?void 0:e.call(n,t)))return}},st=new WeakSet,rt=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.scrollX)?void 0:e.call(n,t)))return}},lt=new WeakSet,ht=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.scrollY)?void 0:e.call(n,t)))return}},ct=new WeakSet,ft=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.resize)?void 0:e.call(n,t)))return}},dt=new WeakSet,ut=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.clear)?void 0:e.call(n,t)))return}},vt=new WeakSet,wt=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.beforeDrawFrame)?void 0:e.call(n,t)))return}},gt=new WeakSet,pt=function(t){var e;for(let i=0;i<xt(this,T).length;i++){const n=xt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.afterDrawFrame)?void 0:e.call(n,t)))return}},yt=new WeakSet,mt=function(){const t=[],e=xt(this,A);xt(this,R).forEach((i=>{const n=e.get(i);"enable"===(null==n?void 0:n.status)&&(null==n?void 0:n.middlewareObject)&&t.push(n.middlewareObject)})),It(this,T,t)},t.Board=class{constructor(t){St(this,Y),St(this,F),St(this,N),St(this,Q),St(this,K),St(this,Z),St(this,tt),St(this,it),St(this,ot),St(this,st),St(this,lt),St(this,ct),St(this,dt),St(this,vt),St(this,gt),St(this,yt),St(this,C,void 0),St(this,A,new WeakMap),St(this,R,[]),St(this,T,[]),St(this,L,void 0),St(this,V,void 0),St(this,j,void 0),St(this,D,void 0),St(this,$,void 0),St(this,B,new Ut),St(this,X,!1);const{boardContent:e}=t,i=new di,n=new li({viewContext:e.viewContext}),o=new ci({boardContent:e,sharer:i}),a=new ri({viewContext:e.viewContext,sharer:i,calculator:n});It(this,C,t),It(this,j,i),It(this,L,o),It(this,V,a),It(this,$,n),It(this,D,new vi({boardContent:t.boardContent,sharer:i,renderer:a,calculator:xt(this,$),beforeDrawFrame:t=>{Mt(this,vt,wt).call(this,t)},afterDrawFrame:t=>{Mt(this,gt,pt).call(this,t)}})),Mt(this,Y,H).call(this),Mt(this,yt,mt).call(this)}isDestroyed(){return xt(this,X)}destroy(){xt(this,L).destroy(),xt(this,V).destroy(),xt(this,$).destroy(),xt(this,B).destroy(),It(this,X,!0)}getSharer(){return xt(this,j)}getViewer(){return xt(this,D)}getRenderer(){return xt(this,V)}setData(t,e){const{modifiedOptions:i}=e||{},n=xt(this,j);xt(this,j).setActiveStorage("data",t);const o=n.getActiveViewSizeInfo(),a=n.getActiveViewScaleInfo(),s=function(t,e){const i={x:0,y:0,w:0,h:0};t.forEach((t=>{const e={x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle};if(e.angle&&(e.angle>0||e.angle<0)){const t=re(e);if(4===t.length){const i=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y];e.x=Math.min(...i),e.y=Math.min(...n),e.w=Math.abs(Math.max(...i)-Math.min(...i)),e.h=Math.abs(Math.max(...n)-Math.min(...n))}}const n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),a=Math.max(e.x+e.w,i.x+i.w),s=Math.max(e.y+e.h,i.y+i.h);i.x=n,i.y=o,i.w=Math.abs(a-n),i.h=Math.abs(s-o)})),(null==e?void 0:e.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const n={contextWidth:i.w,contextHeight:i.h};return(null==e?void 0:e.viewWidth)&&(null==e?void 0:e.viewHeight)&&(null==e?void 0:e.viewWidth)>0&&(null==e?void 0:e.viewHeight)>0&&(e.viewWidth>i.x+i.w&&(n.contextWidth=e.viewWidth-i.x),e.viewHeight>i.y+i.h&&(n.contextHeight=e.viewHeight-i.y)),n}(t.elements,{viewWidth:o.width,viewHeight:o.height,extend:!0});xt(this,D).resetViewVisibleInfoMap(t,{viewSizeInfo:o,viewScaleInfo:a}),xt(this,D).drawFrame();const r={...o,...s};return xt(this,j).setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:t}=xt(this,j).getActiveStoreSnapshot();return t}use(t,e){var i,n,o;if(xt(this,A).has(t)){const e=xt(this,A).get(t);if(e)return null==(n=(i=e.middlewareObject).use)||n.call(i),e.status="enable",xt(this,A).set(t,e),void Mt(this,yt,mt).call(this)}const{boardContent:a,container:s}=xt(this,C),r=t({boardContent:a,sharer:xt(this,j),viewer:xt(this,D),calculator:xt(this,$),eventHub:xt(this,B),container:s},e);null==(o=r.use)||o.call(r),xt(this,R).push(t),xt(this,T).push(r),xt(this,A).set(t,{status:"enable",middlewareObject:r,config:e}),Mt(this,yt,mt).call(this)}disuse(t){var e,i;const n=xt(this,A).get(t);n&&(null==(i=(e=n.middlewareObject).disuse)||i.call(e),n.status="disable",xt(this,A).set(t,n),Mt(this,yt,mt).call(this))}scale(t){const e=xt(this,D),{ignoreUpdateVisibleStatus:i}=t,{moveX:n,moveY:o}=e.scale({...t,ignoreUpdateVisibleStatus:!0});e.scroll({moveX:n,moveY:o,ignoreUpdateVisibleStatus:i})}scroll(t){return xt(this,D).scroll(t)}updateViewScaleInfo(t){return xt(this,D).updateViewScaleInfo(t)}resize(t,e){const i=xt(this,D).resize(t,e),{width:n,height:o,devicePixelRatio:a}=t,{boardContent:s}=xt(this,C);s.viewContext.$resize({width:n,height:o,devicePixelRatio:a}),s.overlayContext.$resize({width:n,height:o,devicePixelRatio:a}),s.boardContext.$resize({width:n,height:o,devicePixelRatio:a}),s.underlayContext.$resize({width:n,height:o,devicePixelRatio:a}),xt(this,D).drawFrame(),xt(this,L).trigger("resize",i),xt(this,j).setActiveViewSizeInfo(t)}clear(){const{boardContent:t}=xt(this,C),{underlayContext:e,overlayContext:i,viewContext:n,boardContext:o}=t;e.clearRect(0,0,e.canvas.width,e.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),Mt(this,dt,ut).call(this)}getEventHub(){return xt(this,B)}onWatcherEvents(){xt(this,L).onEvents()}offWatcherEvents(){xt(this,L).offEvents()}},t.Calculator=li,t.Sharer=di,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
var iDrawBoard=function(t){"use strict";var e,i,n,o,a,s,r,l,h,c,f,d,u,v,g,w,p,y,m,b,x,S,I,M,z,P,O,E,C,k,A,R,T,W,L,V,j,D,$,B,X,Y,H,F,U,N,G,Q,q,K,J,Z,_,tt,et,it=t=>{throw TypeError(t)},nt=(t,e,i)=>e.has(t)||it("Cannot "+i),ot=(t,e,i)=>(nt(t,e,"read from private field"),i?i.call(t):e.get(t)),at=(t,e,i)=>e.has(t)?it("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),st=(t,e,i,n)=>(nt(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),rt=(t,e,i)=>(nt(t,e,"access private method"),i);function lt(t){return"string"==typeof t&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function ht(t,e){if(1===e)return t;let i=1;const n=/^\#[0-9a-f]{6,6}$/i;let o=t;if(n.test(t)?i=parseInt(t.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(t)&&(i=parseInt(t.substring(7,9).replace(/^\#/,"0x")),o=t.substring(0,7)),i*=e,n.test(o)&&i>0&&i<1){const t=Math.max(0,Math.min(255,Math.ceil(256*i)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function ct(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function ft(t){let e=0;for(let i=0;i<t.length;i++)e+=t.charCodeAt(i)*t.charCodeAt(i)*i*i;return e.toString(16).substring(0,4)}function dt(t){const e=t.length,i=Math.floor(e/2),n=t.substring(0,4).padEnd(4,"0"),o=t.substring(0,4).padEnd(4,"0");return`@assets/${ft(e.toString(16).padEnd(4,n))}${ft(t.substring(i-4,i).padEnd(4,n)).padEnd(4,"f")}-${ft(t.substring(i-8,i-4).padEnd(4,n)).padEnd(4,"f")}-${ft(t.substring(i-12,i-8).padEnd(4,n)).padEnd(4,"f")}-${ft(t.substring(i-16,i-12).padEnd(4,o)).padEnd(4,"f")}-${ft(t.substring(i,i+4).padEnd(4,o)).padEnd(4,"f")}${ft(t.substring(i+4,i+8).padEnd(4,o)).padEnd(4,"f")}${ft(o.padEnd(4,n).padEnd(4,o))}`}function ut(t){return function t(e){const i=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return e;if("Array"===i){const i=[];return e.forEach((e=>{i.push(t(e))})),i}if("Object"===i){const i={};Object.keys(e).forEach((n=>{i[n]=t(e[n])}));return Object.getOwnPropertySymbols(e).forEach((n=>{i[n]=t(e[n])})),i}}(t)}function vt(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const gt={type(t,e){const i=vt(t);return!0===e?i.toLocaleLowerCase():i},array:t=>"Array"===vt(t),json:t=>"Object"===vt(t),function:t=>"Function"===vt(t),asyncFunction:t=>"AsyncFunction"===vt(t),boolean:t=>"Boolean"===vt(t),string:t=>"String"===vt(t),number:t=>"Number"===vt(t),undefined:t=>"Undefined"===vt(t),null:t=>"Null"===vt(t),promise:t=>"Promise"===vt(t)};var wt=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))};const{Image:pt}=window;function yt(t){return new Promise(((e,i)=>{const n=new pt;n.crossOrigin="anonymous",n.onload=function(){e(n)},n.onabort=i,n.onerror=i,n.src=t}))}function mt(t){return wt(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,i)=>{const n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(n),o.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},o.onerror=function(t){i(t)}}))}(t);return yield yt(e)}))}function bt(t,e){return wt(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&amp;");const i=yield function(t,e){const{width:i,height:n}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${n||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),s=new FileReader;s.readAsDataURL(a),s.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},s.onerror=function(t){o(t)}}))}(t,e);return yield yt(i)}))}function xt(t){return"number"==typeof t&&(t>0||t<=0)}function St(t){return"number"==typeof t&&t>=0}function It(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function Mt(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const zt={x:function(t){return xt(t)},y:function(t){return xt(t)},w:St,h:function(t){return"number"==typeof t&&t>=0},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:xt,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return St(t)},borderRadius:function(t){return xt(t)&&t>=0},color:function(t){return lt(t)},imageSrc:function(t){return Mt(t)||It(t)},imageURL:It,imageBase64:Mt,svg:function(t){return"string"==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test(`${t}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${t}`.trim())},html:function(t){let e=!1;if("string"==typeof t){let i=document.createElement("div");i.innerHTML=t,i.children.length>0&&(e=!0),i=null}return e},text:function(t){return"string"==typeof t},fontSize:function(t){return xt(t)&&t>0},lineHeight:function(t){return xt(t)&&t>0},textAlign:function(t){return["center","left","right"].includes(t)},fontFamily:function(t){return"string"==typeof t&&t.length>0},fontWeight:function(t){return["bold"].includes(t)},strokeWidth:function(t){return xt(t)&&t>0}};var Pt,Ot=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Et{constructor(){Pt.set(this,void 0),function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,i):o?o.value=i:e.set(t,i)}(this,Pt,new Map,"f")}on(t,e){if(Ot(this,Pt,"f").has(t)){const i=Ot(this,Pt,"f").get(t)||[];null==i||i.push(e),Ot(this,Pt,"f").set(t,i)}else Ot(this,Pt,"f").set(t,[e])}off(t,e){if(Ot(this,Pt,"f").has(t)){const i=Ot(this,Pt,"f").get(t);if(Array.isArray(i))for(let t=0;t<(null==i?void 0:i.length);t++)if(i[t]===e){i.splice(t,1);break}Ot(this,Pt,"f").set(t,i||[])}}trigger(t,e){const i=Ot(this,Pt,"f").get(t);return!!Array.isArray(i)&&(i.forEach((t=>{t(e)})),!0)}has(t){if(Ot(this,Pt,"f").has(t)){const e=Ot(this,Pt,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){Ot(this,Pt,"f").clear()}}function Ct(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}Pt=new WeakMap;var kt,At,Rt,Tt,Wt,Lt=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},Vt=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class jt{constructor(t){kt.add(this),At.set(this,void 0),Rt.set(this,void 0),Tt.set(this,void 0),Lt(this,Rt,ut(t.defaultStorage),"f"),Lt(this,At,Vt(this,kt,"m",Wt).call(this),"f"),Lt(this,Tt,t.defaultStatic||{},"f")}set(t,e){Vt(this,At,"f")[t]=e}get(t){return Vt(this,At,"f")[t]}setStatic(t,e){Vt(this,Tt,"f")[t]=e}getStatic(t){return Vt(this,Tt,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?ut(Vt(this,At,"f")):Object.assign({},Vt(this,At,"f"))}clear(){Lt(this,At,Vt(this,kt,"m",Wt).call(this),"f")}destroy(){Lt(this,At,null,"f"),Lt(this,Tt,null,"f")}}function Dt(t){return t/180*Math.PI}function $t(t,e,i){const n=Bt(e);!function(t,e,i,n){const o=Dt(e||0);i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(o),t.translate(-i.x,-i.y)),n(t),i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(-o),t.translate(-i.x,-i.y))}(t,e.angle||0,n,(()=>{i(t)}))}function Bt(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function Xt(t){const e=Math.min(t[0].x,t[1].x,t[2].x,t[3].x),i=Math.min(t[0].y,t[1].y,t[2].y,t[3].y);return Bt({x:e,y:i,w:Math.max(t[0].x,t[1].x,t[2].x,t[3].x)-e,h:Math.max(t[0].y,t[1].y,t[2].y,t[3].y)-i})}function Yt(t,e,i){const n=function(t,e){const i=e.x-t.x,n=e.y-t.y;if(0===i){if(n<0)return 0;if(n>0)return Math.PI}else if(0===n){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&n<0?Math.atan(Math.abs(i)/Math.abs(n)):i>0&&n>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):0}(t,e);let o=n+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const a=function(t,e){const i=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===i?i:Math.sqrt(i)}(t,e);let s=0,r=0;return 0===o?(s=0,r=0-a):o>0&&o<Math.PI/2?(s=Math.sin(o)*a,r=0-Math.cos(o)*a):o===Math.PI/2?(s=a,r=0):o>Math.PI/2&&o<Math.PI?(s=Math.sin(Math.PI-o)*a,r=Math.cos(Math.PI-o)*a):o===Math.PI?(s=0,r=a):o>Math.PI&&o<1.5*Math.PI?(s=0-Math.sin(o-Math.PI)*a,r=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(s=0-a,r=0):o>1.5*Math.PI&&o<2*Math.PI?(s=0-Math.sin(2*Math.PI-o)*a,r=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(s=0,r=0-a),s+=t.x,r+=t.y,{x:s,y:r}}function Ht(t,e,i){const{x:n,y:o,w:a,h:s}=t;let r={x:n,y:o},l={x:n+a,y:o},h={x:n+a,y:o+s},c={x:n,y:o+s};if(i&&(i>0||i<0)){const t=Dt(function(t){if(!(t>0||t<0)||0===t||360===t)return 0;let e=t%360;e<0?e+=360:360===t&&(e=0);return e}(i));r=Yt(e,r,t),l=Yt(e,l,t),h=Yt(e,h,t),c=Yt(e,c,t)}return[r,l,h,c]}function Ft(t){const{angle:e=0}=t;return Ht(t,Bt(t),e)}function Ut(t,e,i){return[Yt(t,{x:e[0].x,y:e[0].y},i),Yt(t,{x:e[1].x,y:e[1].y},i),Yt(t,{x:e[2].x,y:e[2].y},i),Yt(t,{x:e[3].x,y:e[3].y},i)]}function Nt(t,e){var i;const n=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;n.push(a),o=a.detail.children}return n}function Gt(t){const{x:e,y:i,h:n,w:o}=t;return[{x:e,y:i},{x:e+o,y:i},{x:e+o,y:i+n},{x:e,y:i+n}]}function Qt(t){const{x:e,y:i,w:n,h:o,angle:a=0}=t;return 0===a?Gt(t):Ht(t,Bt({x:e,y:i,w:n,h:o,angle:a}),a)}function qt(t,e){const{groupQueue:i}=e;if(!(i.length>0))return[Qt(t)];const n=function(t){const e=[];let i=0,n=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:s,y:r,w:l,h:h,angle:c=0}=a[t];let f;if(i+=s,n+=r,0===t){const t={x:i,y:n,w:l,h:h,angle:c};f=Qt({x:s,y:r,w:l,h:h,angle:c}),o.push({center:Bt(t),angle:c,radian:Dt(c)})}else{f=Gt({x:i,y:n,w:l,h:h,angle:c});for(let t=0;t<o.length;t++){const{center:e,radian:i}=o[t];f=Ut(e,f,i)}const t=Xt(f);(c>0||c<0)&&(f=Ut(t,f,Dt(c))),o.push({center:t,angle:c,radian:Dt(c)})}e.push(f)}return e}([...i,t]);return n}function Kt(t,e){const{viewScaleInfo:i}=e,{x:n,y:o,w:a,h:s,angle:r}=t,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:n*l+c,y:o*l+h,w:a*l,h:s*l,angle:r}}function Jt(t,e){const{viewScaleInfo:i}=e,{x:n,y:o}=t,{scale:a,offsetTop:s,offsetLeft:r}=i;return{x:n*a+r,y:o*a+s}}function Zt(t,e){const{context2d:i,element:n,viewScaleInfo:o}=e,{angle:a=0}=n,{x:s,y:r,w:l,h:h}=Kt(n,{viewScaleInfo:o}),c=Ft({x:s,y:r,w:l,h:h,angle:a});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let t=1;t<c.length;t++)i.lineTo(c[t].x,c[t].y);i.closePath()}return!!i.isPointInPath(t.x,t.y)}function _t(t,e){const{groupQueue:i}=e,n=function(t,e){return qt(t,e).pop()||null}(t,{groupQueue:i}),o=Ct(n[0],n[1]),a=Ct(n[1],n[2]),s=Ct(n[2],n[3]),r=Ct(n[3],n[0]),l=n[0],h=n[1],c=n[2],f=n[3],d=Math.max(l.x,h.x,c.x,f.x),u=Math.max(l.y,h.y,c.y,f.y);return{center:{x:(d+Math.min(l.x,h.x,c.x,f.x))/2,y:(u+Math.min(l.y,h.y,c.y,f.y))/2},topLeft:l,topRight:h,bottomLeft:f,bottomRight:c,top:o,right:a,left:r,bottom:s}}function te(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),i=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),n=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},s={x:n,y:o},r={x:e,y:o},l={x:e,y:i},h={x:n,y:i},c=Ct(s,r),f=Ct(h,l),d=Ct(s,h);return{center:a,topLeft:s,topRight:r,bottomLeft:h,bottomRight:l,top:c,right:Ct(r,l),left:d,bottom:f}}function ee(t,e){const i=function(t){const{viewScaleInfo:e,viewSizeInfo:i}=t,{scale:n,offsetTop:o,offsetLeft:a}=e,{width:s,height:r}=i,l=0-a/n,h=0-o/n,c=s/n,f=r/n,d=Bt({x:l,y:h,w:c,h:f}),u={x:l,y:h},v={x:l+c,y:h},g={x:l,y:h+f},w={x:l+c,y:h+f},p={x:l,y:d.y},y={x:d.x,y:h},m={x:l+c,y:d.y},b={x:d.x,y:h+f};return{center:d,topLeft:u,topRight:v,bottomLeft:g,bottomRight:w,left:p,top:y,right:m,bottom:b}}(e);let n=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const i=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),n=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),s=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),r=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),h=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return i<=r&&n>=s&&o<=h&&a>=l||r<=a&&r>=a&&r<=a&&r>=a}(a.rangeRectInfo,i),a.isVisibleInView?n++:o++})),{viewVisibleInfoMap:t,visibleCount:n,invisibleCount:o}}function ie(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}At=new WeakMap,Rt=new WeakMap,Tt=new WeakMap,kt=new WeakSet,Wt=function(){return ut(Vt(this,Rt,"f"))};const ne={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function oe(t,e){const{viewScaleInfo:i}=e,{scale:n}=i;let{borderRadius:o,borderDash:a}=t.detail;const s=Array.isArray(a)&&a.length>0,{boxSizing:r=ne.boxSizing,borderWidth:l}=t.detail;Array.isArray(l)&&(o=0);let{x:h,y:c,w:f,h:d}=t,u=[0,0,0,0];if("number"==typeof o){const t=o*n;u=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(u=[o[0]*n,o[1]*n,o[2]*n,o[3]*n]);let v=0;return"number"==typeof l&&(v=(l||0)*n),"border-box"!==r||s?"content-box"===r?(h=t.x-v/2,c=t.y-v/2,f=t.w+v,d=t.h+v):(h=t.x,c=t.y,f=t.w,d=t.h):(h=t.x+v/2,c=t.y+v/2,f=t.w-v,d=t.h-v),f=Math.max(f,1),d=Math.max(d,1),u=u.map((t=>Math.min(t,f/2,d/2))),{x:h,y:c,w:f,h:d,radiusList:u}}const ae=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function se(t,e,i){if("string"==typeof e)return e;const{viewElementSize:n,viewScaleInfo:o,opacity:a=1}=i,{x:s,y:r}=n,{scale:l}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:i,end:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l},c={x:s+n.x*l,y:r+n.y*l},f=t.createLinearGradient(h.x,h.y,c.x,c.y);return o.forEach((t=>{f.addColorStop(t.offset,ht(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:i,outer:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l,radius:i.radius*l},c={x:s+n.x*l,y:r+n.y*l,radius:n.radius*l},f=t.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return o.forEach((t=>{f.addColorStop(t.offset,ht(t.color,a))})),f}return"#000000"}const re={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function le(t){var e,i,n,o;let a=1;return void 0!==(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.opacity)&&(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.opacity)<=1&&(a=null===(o=null==t?void 0:t.detail)||void 0===o?void 0:o.opacity),a}function he(t,e,i){const{pattern:n,renderContent:o,originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=le(a)*h,{clipPath:f,clipPathStrokeColor:d,clipPathStrokeWidth:u}=a.detail,v=()=>{t.globalAlpha=c,ce(t,e,{pattern:n,viewScaleInfo:r,viewSizeInfo:l}),null==o||o(),fe(t,e,{viewScaleInfo:r,viewSizeInfo:l}),t.globalAlpha=h};f?(function(t,e,i){const{renderContent:n,originElem:o,calcElemSize:a,viewSizeInfo:s}=i,r=s.devicePixelRatio,{clipPath:l}=(null==o?void 0:o.detail)||{};if(l&&a&&l.commands){const{x:i,y:o,w:s,h:h}=a,{originW:c,originH:f,originX:d,originY:u}=l,v=s/c,g=h/f,w=i-d*v,p=o-u*g;t.save(),t.translate(w,p),t.scale(r*v,r*g);const y=ie(l.commands||[]),m=new Path2D(y);t.clip(m),t.translate(0-w,0-p),t.setTransform(1,0,0,1,0,0),$t(t,Object.assign({},e),(()=>{null==n||n()})),t.restore()}else null==n||n()}(t,e,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,renderContent:()=>{v()}}),"number"==typeof u&&u>0&&d&&function(t,e,i){const{renderContent:n,originElem:o,calcElemSize:a,viewSizeInfo:s,parentOpacity:r}=i,l=s.devicePixelRatio,{clipPath:h,clipPathStrokeColor:c,clipPathStrokeWidth:f}=(null==o?void 0:o.detail)||{};if(h&&a&&h.commands&&"number"==typeof f&&f>0&&c){const{x:i,y:o,w:s,h:d}=a,{originW:u,originH:v,originX:g,originY:w}=h,p=s/u,y=d/v,m=i-g*p,b=o-w*y;t.save(),t.globalAlpha=r,t.translate(m,b),t.scale(l*p,l*y);const x=ie(h.commands||[]),S=new Path2D(x);t.strokeStyle=c,t.lineWidth=f,t.stroke(S),t.translate(0-m,0-b),t.setTransform(1,0,0,1,0,0),$t(t,Object.assign({},e),(()=>{null==n||n()})),t.restore()}else null==n||n()}(t,e,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,parentOpacity:h})):v()}function ce(t,e,i){var n,o;const{pattern:a,viewScaleInfo:s,viewSizeInfo:r}=i,l=[];if(e.detail.background||a){const{x:i,y:h,w:c,h:f,radiusList:d}=oe(e,{viewScaleInfo:s,viewSizeInfo:r});if(t.beginPath(),t.moveTo(i+d[0],h),t.arcTo(i+c,h,i+c,h+f,d[1]),t.arcTo(i+c,h+f,i,h+f,d[2]),t.arcTo(i,h+f,i,h,d[3]),t.arcTo(i,h,i+c,h,d[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(gt.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null===(n=e.detail.background)||void 0===n?void 0:n.type)){const n=se(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});t.fillStyle=n}else if("radial-gradient"===(null===(o=e.detail.background)||void 0===o?void 0:o.type)){const n=se(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});if(t.fillStyle=n,l&&l.length>0)for(let e=0;e<(null==l?void 0:l.length);e++){const n=l[e];"translate"===n.method?t.translate(n.args[0]+i,n.args[1]+h):"rotate"===n.method?t.rotate(...n.args):"scale"===n.method&&t.scale(...n.args)}}t.fill(),l&&l.length>0&&t.setTransform(1,0,0,1,0,0)}}function fe(t,e,i){if(0===e.detail.borderWidth)return;if(!lt(e.detail.borderColor))return;const{viewScaleInfo:n}=i,{scale:o}=n;let a=re.borderColor;!0===lt(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderWidth:s,borderRadius:r,borderDash:l,boxSizing:h=re.boxSizing}=e.detail;let c=0;"number"==typeof s&&(c=s||1),c*=o;let f=[0,0,0,0];if("number"==typeof r){const t=r*o;f=[t,t,t,t]}else Array.isArray(r)&&4===(null==r?void 0:r.length)&&(f=[r[0]*o,r[1]*o,r[2]*o,r[3]*o]);t.strokeStyle=a;let d=[];Array.isArray(l)&&l.length>0&&(d=l.map((t=>Math.ceil(t*o))));let u=0,v=0,g=0,w=0;if(Array.isArray(s)&&(u=(s[0]||0)*o,v=(s[1]||0)*o,g=(s[2]||0)*o,w=(s[3]||0)*o),w||v||u||g){t.lineCap="butt";let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i+=w/2,n+=u/2,o=o-w/2-v/2,a=a-u/2-g/2):"content-box"===h?(i-=w/2,n-=u/2,o=o+w/2+v/2,a=a+u/2+g/2):(i=e.x,n=e.y,o=e.w,a=e.h),u&&(t.beginPath(),t.lineWidth=u,t.moveTo(i-w/2,n),t.lineTo(i+o+v/2,n),t.closePath(),t.stroke()),v&&(t.beginPath(),t.lineWidth=v,t.moveTo(i+o,n-u/2),t.lineTo(i+o,n+a+g/2),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(i-w/2,n+a),t.lineTo(i+o+v/2,n+a),t.closePath(),t.stroke()),w&&(t.beginPath(),t.lineWidth=w,t.moveTo(i,n-u/2),t.lineTo(i,n+a+g/2),t.closePath(),t.stroke())}else{let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i=e.x+c/2,n=e.y+c/2,o=e.w-c,a=e.h-c):"content-box"===h?(i=e.x-c/2,n=e.y-c/2,o=e.w+c,a=e.h+c):(i=e.x,n=e.y,o=e.w,a=e.h),d.length>0?t.lineCap="butt":t.lineCap="square",o=Math.max(o,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(d),t.lineWidth=c,t.beginPath(),t.moveTo(i+f[0],n),t.arcTo(i+o,n,i+o,n+a,f[1]),t.arcTo(i+o,n+a,i,n+a,f[2]),t.arcTo(i,n+a,i,n,f[3]),t.arcTo(i,n,i+o,n,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function de(t,e,i){const{detail:n}=e,{viewScaleInfo:o,renderContent:a}=i,{shadowColor:s,shadowOffsetX:r,shadowOffsetY:l,shadowBlur:h}=n;zt.number(h)?(t.save(),t.shadowColor=s||re.shadowColor,t.shadowOffsetX=(r||0)*o.scale,t.shadowOffsetY=(l||0)*o.scale,t.shadowBlur=(h||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}const ue={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};var ve=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i};const ge=.4;function we(t,e,i){var n,o,a;if(!0===(null===(n=null==e?void 0:e.operations)||void 0===n?void 0:n.invisible))return;const{w:s,h:r}=e,{scale:l}=i.viewScaleInfo;if(l<1&&(s*l<ge||r*l<ge)||0===i.parentOpacity)return;const{overrideElementMap:h}=i;if(!(null===(a=null===(o=null==h?void 0:h[e.uuid])||void 0===o?void 0:o.operations)||void 0===a?void 0:a.invisible))try{switch(e.type){case"rect":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=Kt(e,{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});$t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{de(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{he(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}(t,e,i);break;case"circle":!function(t,e,i){const{detail:n,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:s,parentOpacity:r}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:f=0,borderDash:d}=n;let u=0;"number"==typeof f&&f>0?u=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(u=f[0]),u*=a.scale;const{x:v,y:g,w:w,h:p}=Kt({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,y=Object.assign(Object.assign({},e),{x:v,y:g,w:w,h:p,angle:o});$t(t,{x:v,y:g,w:w,h:p,angle:o},(()=>{de(t,y,{viewScaleInfo:a,viewSizeInfo:s,renderContent:()=>{let e=w/2,i=p/2;const n=v+e,o=g+i,s=e,f=i;if(u>0&&("content-box"===c||("center-line"===c?(e-=u/2,i-=u/2):(e-=u,i-=u))),e>=0&&i>=0){const c=le(y)*r;t.globalAlpha=c,t.beginPath();const m=se(t,l,{viewElementSize:{x:v,y:g,w:w,h:p},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=m,t.circle(n,o,s,f,0,0,2*Math.PI),t.closePath(),t.fill(),t.globalAlpha=r,"number"==typeof u&&u>0){const s=u/2+e,r=u/2+i;if(t.beginPath(),d){const e=d.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=h,t.lineWidth=u,t.circle(n,o,s,r,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}(t,e,i);break;case"text":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=Kt(e,{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});$t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{de(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{he(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a})}});{const o=Object.assign(Object.assign({},ue),e.detail),a=o.fontSize||ue.fontSize,c=a*n.scale;if(c<2)return;const f=(o.lineHeight||a)*n.scale;t.fillStyle=e.detail.color||ue.color,t.textBaseline="top",t.$setFont({fontWeight:o.fontWeight,fontSize:c,fontFamily:(i=o.fontFamily,[i,...ae].join(", "))});let d=o.text.replace(/\r\n/gi,"\n");"lowercase"===o.textTransform?d=d.toLowerCase():"uppercase"===o.textTransform&&(d=d.toUpperCase());const u=f,v=d.split("\n"),g=[];let w=0;v.forEach(((e,i)=>{if("maxContent"===o.minInlineSize)g.push({text:e,width:t.$undoPixelRatio(t.measureText(e).width)});else{let r="",c="",f=e.split(c);if("normal"===o.wordBreak){const t=" ",i=e.split(t);f=[],i.forEach(((e,n)=>{f.push(e),n<i.length-1&&f.push(t)}))}if(1===f.length&&"visible"===o.overflow)g.push({text:f[0],width:t.$undoPixelRatio(t.measureText(f[0]).width)});else if(f.length>0){for(let e=0;e<f.length&&(a=t.$doPixelRatio(l),s=t.measureText(r+f[e]).width,n.scale<.5&&a<s&&(a-s)/a>-.15||a>=s?r+=f[e]||"":(g.push({text:r,width:t.$undoPixelRatio(t.measureText(r).width)}),r=f[e]||"",w++),!((w+1)*u>h&&"hidden"===o.overflow));e++)if(f.length-1===e&&(w+1)*u<=h){g.push({text:r,width:t.$undoPixelRatio(t.measureText(r).width)}),i<v.length-1&&w++;break}}else g.push({text:"",width:0})}var a,s}));let p=0,y=0;u>c&&(y=(u-c)/2),g.length*u<h&&("top"===e.detail.verticalAlign?p=0:"bottom"===e.detail.verticalAlign?p+=h-g.length*u:p+=(h-g.length*u)/2);{const e=r+p;void 0!==o.textShadowColor&&lt(o.textShadowColor)&&(t.shadowColor=o.textShadowColor),void 0!==o.textShadowOffsetX&&zt.number(o.textShadowOffsetX)&&(t.shadowOffsetX=o.textShadowOffsetX),void 0!==o.textShadowOffsetY&&zt.number(o.textShadowOffsetY)&&(t.shadowOffsetY=o.textShadowOffsetY),void 0!==o.textShadowBlur&&zt.number(o.textShadowBlur)&&(t.shadowBlur=o.textShadowBlur),g.forEach(((i,n)=>{let a=s;"center"===o.textAlign?a=s+(l-i.width)/2:"right"===o.textAlign&&(a=s+(l-i.width)),t.fillText(i.text,a,e+u*n+y)}))}}var i}))}(t,e,i);break;case"image":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=Kt(e,{viewScaleInfo:o})||e,d=Object.assign(Object.assign({},e),{x:r,y:l,w:h,h:c,angle:f});$t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{de(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{he(t,d,{originElem:e,calcElemSize:{x:r,y:l,w:h,h:c,angle:f},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s,renderContent:()=>{if(n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"image"===e.type&&n){t.globalAlpha=le(e)*s;const{x:i,y:r,w:l,h:h,radiusList:c}=oe(d,{viewScaleInfo:o,viewSizeInfo:a}),{detail:f}=e,{scaleMode:u,originW:v=0,originH:g=0}=f,w=t.$undoPixelRatio(v),p=t.$undoPixelRatio(g);if(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(i+c[0],r),t.arcTo(i+l,r,i+l,r+h,c[1]),t.arcTo(i+l,r+h,i,r+h,c[2]),t.arcTo(i,r+h,i,r,c[3]),t.arcTo(i,r,i+l,r,c[0]),t.closePath(),t.fill(),t.clip(),u&&g&&v){let o=0,a=0,s=w,c=p;const f=i,d=r,v=l,g=h;if(w>e.w||p>e.h)if("fill"===u){const t=Math.max(e.w/w,e.h/p),i=p*t;o=(w*t-e.w)/2/t,a=(i-e.h)/2/t,s=e.w/t,c=e.h/t}else if("tile"===u)o=0,a=0,s=e.w,c=e.h;else if("fit"===u){const t=Math.min(e.w/w,e.h/p);o=(w-e.w/t)/2,a=(p-e.h/t)/2,s=e.w/t,c=e.h/t}t.drawImage(n,o,a,s,c,f,d,v,g)}else t.drawImage(n,i,r,l,h);t.globalAlpha=s,t.restore()}}})}})}))}(t,e,i);break;case"svg":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=Kt(e,{viewScaleInfo:o,viewSizeInfo:a})||e;$t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"svg"===e.type&&n&&(t.globalAlpha=le(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"html":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=Kt(e,{viewScaleInfo:o,viewSizeInfo:a})||e;$t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"html"===e.type&&n&&(t.globalAlpha=le(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"path":!function(t,e,i){var n,o;const{detail:a}=e,{originX:s,originY:r,originW:l,originH:h,fillRule:c}=a,{viewScaleInfo:f,viewSizeInfo:d,parentOpacity:u}=i,{x:v,y:g,w:w,h:p,angle:y}=Kt(e,{viewScaleInfo:f})||e,m=w/l,b=p/h,x=v-s*m,S=g-r*b,I=e.detail,M=ve(I,["clipPath","clipPathStrokeColor","clipPathStrokeWidth"]),z=f.scale*d.devicePixelRatio,P=Object.assign(Object.assign({},e),{x:v,y:g,w:w,h:p,angle:y});let O=Object.assign({},P);O.detail=M;let E=Object.assign({},e);E.detail=M,a.fill&&"string"!==a.fill&&(null===(o=null===(n=a.fill)||void 0===n?void 0:n.type)||void 0===o?void 0:o.includes("gradient"))&&(O=Object.assign(Object.assign({},P),{detail:Object.assign(Object.assign({},P.detail),{background:a.fill,clipPath:{commands:a.commands,originX:s,originY:r,originW:l,originH:h}})}),E.detail=Object.assign({},O.detail)),$t(t,{x:v,y:g,w:w,h:p,angle:y},(()=>{he(t,O,{originElem:E,calcElemSize:{x:v,y:g,w:w,h:p,angle:y},viewScaleInfo:f,viewSizeInfo:d,parentOpacity:u,renderContent:()=>{de(t,P,{viewScaleInfo:f,viewSizeInfo:d,renderContent:()=>{t.save(),t.translate(x,S),t.scale(z*m/f.scale,z*b/f.scale);const e=ie(a.commands||[]),i=new Path2D(e);a.fill&&("string"==typeof a.fill?t.fillStyle=a.fill:t.fillStyle="transparent"),a.fill&&t.fill(i,c),a.stroke&&0!==a.strokeWidth&&(t.strokeStyle=a.stroke,t.lineWidth=(a.strokeWidth||1)/d.devicePixelRatio,t.lineCap=a.strokeLineCap||"square",t.stroke(i)),t.translate(-x,-S),t.restore()}})}})}))}(t,e,i);break;case"group":{const n=Object.assign(Object.assign({},i.elementAssets||{}),e.detail.assets||{});!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=Kt({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});$t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{t.globalAlpha=le(e)*a,de(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{he(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:s,y:r,w:l,h:h,radiusList:c}=oe(f,{viewScaleInfo:n,viewSizeInfo:o});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+c[0],r),t.arcTo(s+l,r,s+l,r+h,c[1]),t.arcTo(s+l,r+h,s,r+h,c[2]),t.arcTo(s,r+h,s,r,c[3]),t.arcTo(s,r,s+l,r,c[0]),t.closePath(),t.fill(),t.clip()),Array.isArray(e.detail.children)){const{parentElementSize:n}=i,o={x:n.x+e.x,y:n.y+e.y,w:e.w||n.w,h:e.h||n.h,angle:e.angle},{calculator:s}=i;for(let n=0;n<e.detail.children.length;n++){let r=e.detail.children[n];if(r=Object.assign(Object.assign({},r),{x:o.x+r.x,y:o.y+r.y}),!0===i.forceDrawAll||(null==s?void 0:s.needRender(r)))try{we(t,r,Object.assign(Object.assign({},i),{parentOpacity:a*le(e)}))}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}(t,e,Object.assign(Object.assign({},i),{elementAssets:n}));break}}}catch(t){console.error(t)}}const pe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,minInlineSize:"auto",wordBreak:"break-all",overflow:"hidden"};function ye(t,e,i){var n;const{elements:o=[]}=e,{parentOpacity:a}=i;for(let e=0;e<o.length;e++){const s=o[e],r=Object.assign(Object.assign({},s),{detail:Object.assign(Object.assign({},pe),null==s?void 0:s.detail)});if(!0===i.forceDrawAll||(null===(n=i.calculator)||void 0===n?void 0:n.needRender(r)))try{we(t,r,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(t){console.error(t)}}}var me,be,xe,Se,Ie,Me,ze,Pe,Oe,Ee,Ce,ke,Ae=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))},Re=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},Te=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i};const We=["image","svg","html"],Le=t=>{var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),"string"==typeof o&&o?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${o}`)?o:dt(o):dt(`${ct()}-${t.uuid}-${ct()}-${ct()}`)};class Ve extends Et{constructor(){super(),me.add(this),be.set(this,{}),xe.set(this,{}),Se.set(this,{}),Ie.set(this,!1),Re(this,me,"m",Me).call(this,"image",((t,e)=>Ae(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.src])||void 0===i?void 0:i.value)||t.detail.src,o=yield yt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),Re(this,me,"m",Me).call(this,"html",((t,e)=>Ae(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.html])||void 0===i?void 0:i.value)||t.detail.html,o=yield bt(n,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),Re(this,me,"m",Me).call(this,"svg",((t,e)=>Ae(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.svg])||void 0===i?void 0:i.value)||t.detail.svg,o=yield mt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))))}isDestroyed(){return Re(this,Ie,"f")}destroy(){Te(this,Ie,!0,"f"),this.clear(),Te(this,be,null,"f"),Te(this,xe,null,"f"),Te(this,Se,null,"f")}load(t,e){!0!==Re(this,Ie,"f")&&(Re(this,me,"m",ke).call(this,t)||We.includes(t.type)&&Re(this,me,"m",Ce).call(this,t,e))}getContent(t){var e,i;const n=Le(t);return(null===(i=null===(e=Re(this,Se,"f"))||void 0===e?void 0:e[n])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Re(this,Se,"f")}setLoadItemMap(t){Te(this,Se,t,"f")}}be=new WeakMap,xe=new WeakMap,Se=new WeakMap,Ie=new WeakMap,me=new WeakSet,Me=function(t,e){Re(this,be,"f")[t]=e},ze=function(t){var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),o},Pe=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Re(this,me,"m",ze).call(this,t)}},Oe=function(t){const e=Le(t.element),i=Re(this,Se,"f")[e];Re(this,Ie,"f")||(i?i.startTime<t.startTime&&(Re(this,Se,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(Re(this,Se,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},Ee=function(t){var e;const i=Le(t.element),n=null===(e=Re(this,Se,"f"))||void 0===e?void 0:e[i];Re(this,Ie,"f")||(n?n.startTime<t.startTime&&(Re(this,Se,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(Re(this,Se,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},Ce=function(t,e){const i=Re(this,me,"m",Pe).call(this,t),n=Le(t);if(Re(this,xe,"f")[n])return;Re(this,xe,"f")[n]=i;const o=Re(this,be,"f")[t.type];"function"!=typeof o||Re(this,Ie,"f")||(i.startTime=Date.now(),o(t,e).then((t=>{Re(this,Ie,"f")||(i.content=t.content,i.endTime=Date.now(),i.status="load",Re(this,me,"m",Oe).call(this,i))})).catch((e=>{console.warn(`Load element source "${i.source}" fail`,e,t),i.endTime=Date.now(),i.status="error",i.error=e,Re(this,me,"m",Ee).call(this,i)})))},ke=function(t){var e;const i=Le(t),n=null===(e=Re(this,xe,"f"))||void 0===e?void 0:e[i];return!(!n||"error"!==n.status||!n.source||n.source!==Re(this,me,"m",ze).call(this,t))};var je,De,$e,Be,Xe,Ye=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},He=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Fe extends Et{constructor(t){super(),je.add(this),De.set(this,void 0),$e.set(this,new Ve),Be.set(this,!1),Ye(this,De,t,"f"),He(this,je,"m",Xe).call(this)}isDestroyed(){return He(this,Be,"f")}destroy(){this.clear(),Ye(this,De,null,"f"),He(this,$e,"f").destroy(),Ye(this,$e,null,"f"),Ye(this,Be,!0,"f")}updateOptions(t){Ye(this,De,t,"f")}drawData(t,e){const i=He(this,$e,"f"),{calculator:n,sharer:o}=He(this,De,"f"),a=He(this,De,"f").viewContext;a.clearRect(0,0,a.canvas.width,a.canvas.height);const s={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height},r=Object.assign({loader:i,calculator:n,parentElementSize:s,elementAssets:t.assets,parentOpacity:1,overrideElementMap:null==o?void 0:o.getActiveOverrideElemenentMap()},e);!function(t,e,i){if("string"==typeof(null==e?void 0:e.background)){const{viewSizeInfo:n}=i,{width:o,height:a}=n;t.globalAlpha=1,t.fillStyle=e.background,t.fillRect(0,0,o,a)}}(a,t.global,r),t.layout?function(t,e,i,n){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,r=Object.assign({uuid:"layout",type:"group"},e),{x:l,y:h,w:c,h:f}=Kt(r,{viewScaleInfo:o})||r,d=Object.assign(Object.assign({},r),{x:l,y:h,w:c,h:f,angle:0});if(t.globalAlpha=1,de(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{ce(t,d,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:n,viewSizeInfo:o}=i,a=Object.assign({uuid:"layout",type:"group"},e),s=Kt(a,{viewScaleInfo:n})||a,r=Object.assign(Object.assign({},a),s),{x:l,y:h,w:c,h:f,radiusList:d}=oe(r,{viewScaleInfo:n,viewSizeInfo:o});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(l+d[0],h),t.arcTo(l+c,h,l+c,h+f,d[1]),t.arcTo(l+c,h+f,l,h+f,d[2]),t.arcTo(l,h+f,l,h,d[3]),t.arcTo(l,h,l+c,h,d[0]),t.closePath(),t.fill(),t.clip()}n(t),"hidden"===e.detail.overflow&&t.restore(),fe(t,d,{viewScaleInfo:o,viewSizeInfo:a}),t.globalAlpha=s}(a,t.layout,r,(()=>{ye(a,t,r)})):ye(a,t,r)}scale(t){const{sharer:e}=He(this,De,"f");if(!e)return;const{data:i,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s,width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}=e.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:t,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s},viewSizeInfo:{width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}})}setLoadItemMap(t){He(this,$e,"f").setLoadItemMap(t)}getLoadItemMap(){return He(this,$e,"f").getLoadItemMap()}getLoader(){return He(this,$e,"f")}}De=new WeakMap,$e=new WeakMap,Be=new WeakMap,je=new WeakSet,Xe=function(){const t=He(this,$e,"f");t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))};class Ue{constructor(t){at(this,e),at(this,i),st(this,e,t),st(this,i,new jt({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){st(this,e,null)}needRender(t){const e=ot(this,i).get("viewVisibleInfoMap")[t.uuid];return!e||e.isVisibleInView}isPointInElement(t,i,n,o){return Zt(t,{context2d:ot(this,e).viewContext,element:i,viewScaleInfo:n,viewSizeInfo:o})}getPointElement(t,i){return function(t,e){var i,n,o;const{context2d:a,data:s,viewScaleInfo:r,viewSizeInfo:l,groupQueue:h}=e,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let e=h.length-1;e>=0;e--){let o=0,s=0,f=0;for(let t=0;t<=e;t++)o+=h[t].x,s+=h[t].y,f+=h[t].angle||0;const d=h[e];if(d&&"group"===d.type&&Array.isArray(null===(i=d.detail)||void 0===i?void 0:i.children))for(let i=0;i<d.detail.children.length;i++){const u=d.detail.children[i];if(!0!==(null===(n=null==u?void 0:u.operations)||void 0===n?void 0:n.invisible)){if(!u)break;if(Zt(t,{context2d:a,element:{x:o+u.x,y:s+u.y,w:u.w,h:u.h,angle:f+(u.angle||0)},viewScaleInfo:r,viewSizeInfo:l})){c.element=u,(e<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=s.elements.length-1;e>=0;e--){const i=s.elements[e];if(!0!==(null===(o=null==i?void 0:i.operations)||void 0===o?void 0:o.invisible)&&Zt(t,{context2d:a,element:i,viewScaleInfo:r,viewSizeInfo:l})){c.index=e,c.element=i;break}}return c}(t,{...i,context2d:ot(this,e).viewContext})}resetViewVisibleInfoMap(t,e){if(t){const{viewVisibleInfoMap:n,invisibleCount:o,visibleCount:a}=function(t,e){const i={},n=[],o=e=>{const a={isVisibleInView:!0,isGroup:"group"===e.type,position:[...n]};let s=null;s=_t(e,{groupQueue:Nt(t,n)||[]}),i[e.uuid]=Object.assign(Object.assign({},a),{originRectInfo:s,rangeRectInfo:zt.angle(e.angle)?te(s):s}),"group"===e.type&&e.detail.children.forEach(((t,e)=>{n.push(e),o(t),n.pop()}))};return t.forEach(((t,e)=>{n.push(e),o(t),n.pop()})),ee(i,e)}(t.elements,e);ot(this,i).set("viewVisibleInfoMap",n),ot(this,i).set("invisibleCount",o),ot(this,i).set("visibleCount",a)}}updateVisiableStatus(t){const{viewVisibleInfoMap:e,invisibleCount:n,visibleCount:o}=ee(ot(this,i).get("viewVisibleInfoMap"),t);ot(this,i).set("viewVisibleInfoMap",e),ot(this,i).set("invisibleCount",n),ot(this,i).set("visibleCount",o)}calcViewRectInfoFromOrigin(t,e){const n=ot(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:v,bottomRight:g}=n.originRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const w={viewScaleInfo:a,viewSizeInfo:s};return{center:Jt(r,w),left:Jt(l,w),right:Jt(h,w),bottom:Jt(c,w),top:Jt(f,w),topLeft:Jt(d,w),topRight:Jt(u,w),bottomLeft:Jt(v,w),bottomRight:Jt(g,w)}}calcViewRectInfoFromRange(t,e){const n=ot(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:v,bottomRight:g}=n.rangeRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const w={viewScaleInfo:a,viewSizeInfo:s};return{center:Jt(r,w),left:Jt(l,w),right:Jt(h,w),bottom:Jt(c,w),top:Jt(f,w),topLeft:Jt(d,w),topRight:Jt(u,w),bottomLeft:Jt(v,w),bottomRight:Jt(g,w)}}modifyViewVisibleInfoMap(t,e){const{modifyOptions:n,viewScaleInfo:o,viewSizeInfo:a}=e,{type:s,content:r}=n,l=t.elements,h=ot(this,i).get("viewVisibleInfoMap");if("deleteElement"===s){const{element:t}=r,e=[],n=t=>{e.push(t.uuid),"group"===t.type&&Array.isArray(t.detail.children)&&t.detail.children.forEach((t=>{n(t)}))};n(t),e.forEach((t=>{delete h[t]})),ot(this,i).set("viewVisibleInfoMap",h)}else if("addElement"===s||"updateElement"===s){const{position:e}=r,n=function(t,e){let i=null,n=e;for(let e=0;e<t.length;e++){const o=n[t[e]];if(e<t.length-1&&"group"===o.type)n=o.detail.children;else{if(e!==t.length-1)break;i=o}}return i}(e,t.elements),c=Nt(l,e);if(n)if("updateElement"===s&&"group"===n.type)this.resetViewVisibleInfoMap(t,{viewScaleInfo:o,viewSizeInfo:a});else{const t=_t(n,{groupQueue:c||[]}),r={originRectInfo:t,rangeRectInfo:zt.angle(n.angle)?te(t):t,isVisibleInView:!0,isGroup:"group"===(null==n?void 0:n.type),position:[...e]};h[n.uuid]=r,ot(this,i).set("viewVisibleInfoMap",h),"updateElement"===s&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:a})}}else"moveElement"===s&&this.resetViewVisibleInfoMap(t,{viewScaleInfo:o,viewSizeInfo:a})}}function Ne(t){return t>0||t<0||0===t}e=new WeakMap,i=new WeakMap;class Ge extends Et{constructor(t){super(),at(this,s),at(this,n),at(this,o),at(this,a,!1),at(this,l,(t=>{if(!rt(this,s,w).call(this,t))return;const e=rt(this,s,p).call(this,t);if(!rt(this,s,y).call(this,e))return;t.preventDefault(),t.stopPropagation();const i=t.deltaX>0||t.deltaX<0?t.deltaX:0,n=t.deltaY>0||t.deltaY<0?t.deltaY:0;!0===t.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:n,point:e}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:n,point:e})})),at(this,h,(t=>{if(2!==t.button)return;if(!rt(this,s,w).call(this,t))return;t.preventDefault();const e=rt(this,s,p).call(this,t);rt(this,s,y).call(this,e)&&this.trigger("contextMenu",{point:e})})),at(this,c,(t=>{if(!rt(this,s,w).call(this,t))return;t.preventDefault();const e=rt(this,s,p).call(this,t);if(!rt(this,s,y).call(this,e))return;const i=Date.now(),n=ot(this,o).get("prevClickPoint");n&&i-n.t<=500&&Math.abs(n.x-e.x)<=5&&Math.abs(n.y-e.y)<=5?this.trigger("doubleClick",{point:e}):ot(this,o).set("prevClickPoint",e)})),at(this,f,(t=>{ot(this,o).set("hasPointDown",!1),t.preventDefault();const e=rt(this,s,p).call(this,t);this.trigger("pointLeave",{point:e})})),at(this,d,(t=>{if(ot(this,o).set("hasPointDown",!1),!rt(this,s,w).call(this,t))return;t.preventDefault();const e=rt(this,s,p).call(this,t);this.trigger("pointEnd",{point:e})})),at(this,u,(t=>{if(!rt(this,s,w).call(this,t))return;t.preventDefault(),t.stopPropagation();const e=rt(this,s,p).call(this,t);rt(this,s,y).call(this,e)?!0===ot(this,o).get("hasPointDown")&&this.trigger("pointMove",{point:e}):ot(this,o).get("hasPointDown")&&(this.trigger("pointLeave",{point:e}),ot(this,o).set("hasPointDown",!1))})),at(this,v,(t=>{if(0!==t.button)return;if(!rt(this,s,w).call(this,t))return;t.preventDefault();const e=rt(this,s,p).call(this,t);rt(this,s,y).call(this,e)&&(ot(this,o).set("hasPointDown",!0),this.trigger("pointStart",{point:e}))})),at(this,g,(t=>{if(!rt(this,s,w).call(this,t))return void(!0===ot(this,o).get("inCanvas")&&(ot(this,o).set("inCanvas",!1),ot(this,f).call(this,t)));ot(this,o).set("inCanvas",!0),t.preventDefault();const e=rt(this,s,p).call(this,t);rt(this,s,y).call(this,e)&&this.trigger("hover",{point:e})}));const e=new jt({defaultStorage:{hasPointDown:!1,prevClickPoint:null,inCanvas:!0}});st(this,o,e),st(this,n,t),rt(this,s,r).call(this)}onEvents(){if(ot(this,a))return;const t=window;t.addEventListener("mousemove",ot(this,g)),t.addEventListener("mousedown",ot(this,v)),t.addEventListener("mousemove",ot(this,u)),t.addEventListener("mouseup",ot(this,d)),t.addEventListener("wheel",ot(this,l),{passive:!1}),t.addEventListener("click",ot(this,c)),t.addEventListener("contextmenu",ot(this,h))}offEvents(){const t=window;t.removeEventListener("mousemove",ot(this,g)),t.removeEventListener("mousedown",ot(this,v)),t.removeEventListener("mousemove",ot(this,u)),t.removeEventListener("mouseup",ot(this,d)),t.removeEventListener("mouseleave",ot(this,f)),t.removeEventListener("wheel",ot(this,l)),t.removeEventListener("click",ot(this,c)),t.removeEventListener("contextmenu",ot(this,h))}destroy(){this.offEvents(),ot(this,o).destroy(),st(this,a,!0)}}n=new WeakMap,o=new WeakMap,a=new WeakMap,s=new WeakSet,r=function(){this.onEvents()},l=new WeakMap,h=new WeakMap,c=new WeakMap,f=new WeakMap,d=new WeakMap,u=new WeakMap,v=new WeakMap,g=new WeakMap,w=function(t){return t.target===ot(this,n).boardContent.boardContext.canvas},p=function(t){const e=ot(this,n).boardContent.boardContext.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top,t:Date.now()}},y=function(t){const e=ot(this,n).sharer.getActiveViewSizeInfo(),{width:i,height:o}=e;return!!(Ne(t.x)&&Ne(t.y)&&t.x<=i&&t.y<=o)};const Qe={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0,overrideElementMap:null};class qe{constructor(){at(this,m),at(this,b);const t=new jt({defaultStorage:Qe}),e=new jt({defaultStorage:{}});st(this,m,t),st(this,b,e)}getActiveStorage(t){return ot(this,m).get(t)}setActiveStorage(t,e){return ot(this,m).set(t,e)}getActiveStoreSnapshot(t){return ot(this,m).getSnapshot(t)}getSharedStorage(t){return ot(this,b).get(t)}setSharedStorage(t,e){return ot(this,b).set(t,e)}getSharedStoreSnapshot(t){return ot(this,b).getSnapshot(t)}getActiveViewScaleInfo(){return{scale:ot(this,m).get("scale"),offsetTop:ot(this,m).get("offsetTop"),offsetBottom:ot(this,m).get("offsetBottom"),offsetLeft:ot(this,m).get("offsetLeft"),offsetRight:ot(this,m).get("offsetRight")}}setActiveViewScaleInfo(t){const{scale:e,offsetTop:i,offsetBottom:n,offsetLeft:o,offsetRight:a}=t;ot(this,m).set("scale",e),ot(this,m).set("offsetTop",i),ot(this,m).set("offsetBottom",n),ot(this,m).set("offsetLeft",o),ot(this,m).set("offsetRight",a)}setActiveViewSizeInfo(t){ot(this,m).set("width",t.width),ot(this,m).set("height",t.height),ot(this,m).set("devicePixelRatio",t.devicePixelRatio),ot(this,m).set("contextWidth",t.contextWidth),ot(this,m).set("contextHeight",t.contextHeight)}getActiveViewSizeInfo(){return{width:ot(this,m).get("width"),height:ot(this,m).get("height"),devicePixelRatio:ot(this,m).get("devicePixelRatio"),contextWidth:ot(this,m).get("contextWidth"),contextHeight:ot(this,m).get("contextHeight")}}getActiveOverrideElemenentMap(){return ot(this,m).get("overrideElementMap")}setActiveOverrideElemenentMap(t){ot(this,m).set("overrideElementMap",t)}}m=new WeakMap,b=new WeakMap;const{requestAnimationFrame:Ke}=window;class Je extends Et{constructor(t){super(),at(this,M),at(this,x),at(this,S,[]),at(this,I,"FREE"),st(this,x,t),rt(this,M,z).call(this)}resetViewVisibleInfoMap(t,e){t&&ot(this,x).calculator.resetViewVisibleInfoMap(t,e)}drawFrame(){const{sharer:t}=ot(this,x),e=t.getActiveStoreSnapshot(),i=t.getSharedStoreSnapshot();ot(this,S).push({activeStore:e,sharedStore:i}),rt(this,M,P).call(this)}scale(t){const{scale:e,point:i,ignoreUpdateVisibleStatus:n}=t,{sharer:o}=ot(this,x),{moveX:a,moveY:s}=function(t){const{scale:e,point:i,viewScaleInfo:n}=t,{offsetLeft:o,offsetTop:a}=n,s=e/n.scale,r=i.x,l=i.y;return{moveX:r-r*s+(o*s-o),moveY:l-l*s+(a*s-a)}}({scale:e,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",e),n||ot(this,x).calculator.updateVisiableStatus({viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()}),{moveX:a,moveY:s}}scroll(t){const{sharer:e}=ot(this,x),i=e.getActiveViewScaleInfo(),{moveX:n,moveY:o,ignoreUpdateVisibleStatus:a}=t,s=function(t){const{moveX:e=0,moveY:i=0,viewScaleInfo:n,viewSizeInfo:o}=t,{scale:a}=n,{width:s,height:r,contextWidth:l,contextHeight:h}=o;let c=n.offsetLeft,f=n.offsetRight,d=n.offsetTop,u=n.offsetBottom;return c+=e,d+=i,f=s-(l*a+c),u=r-(h*a+d),{scale:a,offsetTop:d,offsetLeft:c,offsetRight:f,offsetBottom:u}}({moveX:n,moveY:o,viewScaleInfo:i,viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(s),a||ot(this,x).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),s}updateViewScaleInfo(t){const{sharer:e}=ot(this,x),i=function(t,e){const{scale:i,offsetX:n,offsetY:o}=t,{viewSizeInfo:a}=e,{width:s,height:r,contextWidth:l,contextHeight:h}=a,c=0-n*i,f=0-o*i;return{scale:i,offsetLeft:c,offsetTop:f,offsetRight:s-(l*i+c/i),offsetBottom:r-(h*i+f/i)}}(t,{viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(i),ot(this,x).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),i}resize(t={},e){const{sharer:i}=ot(this,x),n={...i.getActiveViewSizeInfo(),...t},{width:o,height:a,devicePixelRatio:s}=n,{underlayContext:r,boardContext:l,overlayContext:h,viewContext:c}=ot(this,x).boardContent;return l.canvas.width=o*s,l.canvas.height=a*s,l.canvas.style.width=`${o}px`,l.canvas.style.height=`${a}px`,r.canvas.width=o*s,r.canvas.height=a*s,h.canvas.width=o*s,h.canvas.height=a*s,c.canvas.width=o*s,c.canvas.height=a*s,i.setActiveViewSizeInfo(n),(null==e?void 0:e.ignoreUpdateVisibleStatus)||ot(this,x).calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}x=new WeakMap,S=new WeakMap,I=new WeakMap,M=new WeakSet,z=function(){const{renderer:t}=ot(this,x);t.on("load",(()=>{this.drawFrame()}))},P=function(){if("DRAWING"===ot(this,I)||0===ot(this,S).length)return;st(this,I,"DRAWING");const t=ot(this,S).shift(),{renderer:e,boardContent:i,beforeDrawFrame:n,afterDrawFrame:o}=ot(this,x);if(t){const{scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h,width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:v}=t.activeStore,g={scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h},w={width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:v};(null==t?void 0:t.activeStore.data)&&e.drawData(t.activeStore.data,{viewScaleInfo:g,viewSizeInfo:w}),n({snapshot:t}),i.drawView(),o({snapshot:t})}0!==ot(this,S).length?st(this,I,"DRAWING")&&Ke((()=>{rt(this,M,P).call(this)})):st(this,I,"COMPLETE")};return O=new WeakMap,E=new WeakMap,C=new WeakMap,k=new WeakMap,A=new WeakMap,R=new WeakMap,T=new WeakMap,W=new WeakMap,L=new WeakMap,V=new WeakMap,j=new WeakMap,D=new WeakSet,$=function(){ot(this,A).on("pointStart",rt(this,D,B).bind(this)),ot(this,A).on("pointEnd",rt(this,D,X).bind(this)),ot(this,A).on("pointMove",rt(this,D,Y).bind(this)),ot(this,A).on("pointLeave",rt(this,D,H).bind(this)),ot(this,A).on("hover",rt(this,D,F).bind(this)),ot(this,A).on("wheel",rt(this,D,G).bind(this)),ot(this,A).on("wheelScale",rt(this,D,Q).bind(this)),ot(this,A).on("scrollX",rt(this,D,q).bind(this)),ot(this,A).on("scrollY",rt(this,D,K).bind(this)),ot(this,A).on("resize",rt(this,D,J).bind(this)),ot(this,A).on("doubleClick",rt(this,D,U).bind(this)),ot(this,A).on("contextMenu",rt(this,D,N).bind(this)),ot(this,R).on("load",(()=>{ot(this,V).trigger("loadResource")}))},B=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.pointStart)?void 0:e.call(n,t)))return}},X=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.pointEnd)?void 0:e.call(n,t)))return}},Y=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.pointMove)?void 0:e.call(n,t)))return}},H=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.pointLeave)?void 0:e.call(n,t)))return}},F=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.hover)?void 0:e.call(n,t)))return}},U=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.doubleClick)?void 0:e.call(n,t)))return}},N=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.contextMenu)?void 0:e.call(n,t)))return}},G=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.wheel)?void 0:e.call(n,t)))return}},Q=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.wheelScale)?void 0:e.call(n,t)))return}},q=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.scrollX)?void 0:e.call(n,t)))return}},K=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.scrollY)?void 0:e.call(n,t)))return}},J=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.resize)?void 0:e.call(n,t)))return}},Z=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.clear)?void 0:e.call(n,t)))return}},_=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.beforeDrawFrame)?void 0:e.call(n,t)))return}},tt=function(t){var e;for(let i=0;i<ot(this,k).length;i++){const n=ot(this,k)[i];if(!1===(null==(e=null==n?void 0:n.afterDrawFrame)?void 0:e.call(n,t)))return}},et=function(){const t=[],e=ot(this,E);ot(this,C).forEach((i=>{const n=e.get(i);"enable"===(null==n?void 0:n.status)&&(null==n?void 0:n.middlewareObject)&&t.push(n.middlewareObject)})),st(this,k,t)},t.Board=class{constructor(t){at(this,D),at(this,O),at(this,E,new WeakMap),at(this,C,[]),at(this,k,[]),at(this,A),at(this,R),at(this,T),at(this,W),at(this,L),at(this,V,new Et),at(this,j,!1);const{boardContent:e}=t,i=new qe,n=new Ue({viewContext:e.viewContext}),o=new Ge({boardContent:e,sharer:i}),a=new Fe({viewContext:e.viewContext,sharer:i,calculator:n});st(this,O,t),st(this,T,i),st(this,A,o),st(this,R,a),st(this,L,n),st(this,W,new Je({boardContent:t.boardContent,sharer:i,renderer:a,calculator:ot(this,L),beforeDrawFrame:t=>{rt(this,D,_).call(this,t)},afterDrawFrame:t=>{rt(this,D,tt).call(this,t)}})),rt(this,D,$).call(this),rt(this,D,et).call(this)}isDestroyed(){return ot(this,j)}destroy(){ot(this,A).destroy(),ot(this,R).destroy(),ot(this,L).destroy(),ot(this,V).destroy(),st(this,j,!0)}getSharer(){return ot(this,T)}getViewer(){return ot(this,W)}getRenderer(){return ot(this,R)}setData(t,e){const{modifiedOptions:i}=e||{},n=ot(this,T);ot(this,T).setActiveStorage("data",t);const o=n.getActiveViewSizeInfo(),a=n.getActiveViewScaleInfo(),s=function(t,e){const i={x:0,y:0,w:0,h:0};t.forEach((t=>{const e={x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle};if(e.angle&&(e.angle>0||e.angle<0)){const t=Ft(e);if(4===t.length){const i=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y];e.x=Math.min(...i),e.y=Math.min(...n),e.w=Math.abs(Math.max(...i)-Math.min(...i)),e.h=Math.abs(Math.max(...n)-Math.min(...n))}}const n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),a=Math.max(e.x+e.w,i.x+i.w),s=Math.max(e.y+e.h,i.y+i.h);i.x=n,i.y=o,i.w=Math.abs(a-n),i.h=Math.abs(s-o)})),(null==e?void 0:e.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const n={contextWidth:i.w,contextHeight:i.h};return(null==e?void 0:e.viewWidth)&&(null==e?void 0:e.viewHeight)&&(null==e?void 0:e.viewWidth)>0&&(null==e?void 0:e.viewHeight)>0&&(e.viewWidth>i.x+i.w&&(n.contextWidth=e.viewWidth-i.x),e.viewHeight>i.y+i.h&&(n.contextHeight=e.viewHeight-i.y)),n}(t.elements,{viewWidth:o.width,viewHeight:o.height,extend:!0});ot(this,W).resetViewVisibleInfoMap(t,{viewSizeInfo:o,viewScaleInfo:a}),ot(this,W).drawFrame();const r={...o,...s};return ot(this,T).setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:t}=ot(this,T).getActiveStoreSnapshot();return t}use(t,e){var i,n,o;if(ot(this,E).has(t)){const e=ot(this,E).get(t);if(e)return null==(n=(i=e.middlewareObject).use)||n.call(i),e.status="enable",ot(this,E).set(t,e),void rt(this,D,et).call(this)}const{boardContent:a,container:s}=ot(this,O),r=t({boardContent:a,sharer:ot(this,T),viewer:ot(this,W),calculator:ot(this,L),eventHub:ot(this,V),container:s},e);null==(o=r.use)||o.call(r),ot(this,C).push(t),ot(this,k).push(r),ot(this,E).set(t,{status:"enable",middlewareObject:r,config:e}),rt(this,D,et).call(this)}disuse(t){var e,i;const n=ot(this,E).get(t);n&&(null==(i=(e=n.middlewareObject).disuse)||i.call(e),n.status="disable",ot(this,E).set(t,n),rt(this,D,et).call(this))}scale(t){const e=ot(this,W),{ignoreUpdateVisibleStatus:i}=t,{moveX:n,moveY:o}=e.scale({...t,ignoreUpdateVisibleStatus:!0});e.scroll({moveX:n,moveY:o,ignoreUpdateVisibleStatus:i})}scroll(t){return ot(this,W).scroll(t)}updateViewScaleInfo(t){return ot(this,W).updateViewScaleInfo(t)}resize(t,e){const i=ot(this,W).resize(t,e),{width:n,height:o,devicePixelRatio:a}=t,{boardContent:s}=ot(this,O);s.viewContext.$resize({width:n,height:o,devicePixelRatio:a}),s.overlayContext.$resize({width:n,height:o,devicePixelRatio:a}),s.boardContext.$resize({width:n,height:o,devicePixelRatio:a}),s.underlayContext.$resize({width:n,height:o,devicePixelRatio:a}),ot(this,W).drawFrame(),ot(this,A).trigger("resize",i),ot(this,T).setActiveViewSizeInfo(t)}clear(){const{boardContent:t}=ot(this,O),{underlayContext:e,overlayContext:i,viewContext:n,boardContext:o}=t;e.clearRect(0,0,e.canvas.width,e.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),rt(this,D,Z).call(this)}getEventHub(){return ot(this,V)}onWatcherEvents(){ot(this,A).onEvents()}offWatcherEvents(){ot(this,A).offEvents()}},t.Calculator=Ue,t.Sharer=qe,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
{
"name": "@idraw/board",
"version": "0.4.0-beta.35",
"version": "0.4.0-beta.36",
"description": "",

@@ -24,8 +24,8 @@ "main": "dist/esm/index.js",

"devDependencies": {
"@idraw/types": "^0.4.0-beta.35"
"@idraw/types": "^0.4.0-beta.36"
},
"dependencies": {},
"peerDependencies": {
"@idraw/util": "^0.4.0-beta.35",
"@idraw/renderer": "^0.4.0-beta.35"
"@idraw/util": "^0.4.0-beta.36",
"@idraw/renderer": "^0.4.0-beta.36"
},

@@ -32,0 +32,0 @@ "publishConfig": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc