@idraw/core 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/board/index.js
CHANGED
|
@@ -32,7 +32,8 @@ export class Board {
|
|
|
32
32
|
const sharer = new Sharer();
|
|
33
33
|
const watcher = new BoardWatcher({
|
|
34
34
|
boardContent,
|
|
35
|
-
sharer
|
|
35
|
+
sharer,
|
|
36
|
+
disabled: opts === null || opts === void 0 ? void 0 : opts.disableWatcher
|
|
36
37
|
});
|
|
37
38
|
const renderer = new Renderer({
|
|
38
39
|
viewContext: boardContent.viewContext,
|
|
@@ -149,6 +149,9 @@ export class BoardWatcher extends EventEmitter {
|
|
|
149
149
|
__classPrivateFieldGet(this, _BoardWatcher_instances, "m", _BoardWatcher_init).call(this);
|
|
150
150
|
}
|
|
151
151
|
onEvents() {
|
|
152
|
+
if (__classPrivateFieldGet(this, _BoardWatcher_opts, "f").disabled === true) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
152
155
|
if (__classPrivateFieldGet(this, _BoardWatcher_hasDestroyed, "f")) {
|
|
153
156
|
return;
|
|
154
157
|
}
|
|
@@ -163,6 +166,9 @@ export class BoardWatcher extends EventEmitter {
|
|
|
163
166
|
container.addEventListener('contextmenu', __classPrivateFieldGet(this, _BoardWatcher_onContextMenu, "f"));
|
|
164
167
|
}
|
|
165
168
|
offEvents() {
|
|
169
|
+
if (__classPrivateFieldGet(this, _BoardWatcher_opts, "f").disabled === true) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
166
172
|
const container = window;
|
|
167
173
|
const canvas = __classPrivateFieldGet(this, _BoardWatcher_opts, "f").boardContent.boardContext.canvas;
|
|
168
174
|
container.removeEventListener('mousemove', __classPrivateFieldGet(this, _BoardWatcher_onHover, "f"));
|
|
@@ -151,6 +151,7 @@ export const MiddlewareSelector = (opts, config) => {
|
|
|
151
151
|
const groupQueue = getGroupQueueFromList(elem.uuid, (data === null || data === void 0 ? void 0 : data.elements) || []);
|
|
152
152
|
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
153
153
|
updateSelectedElementList(elements);
|
|
154
|
+
pointStartElementSizeList = [Object.assign(Object.assign({}, getElementSize(elements[0])), { uuid: elements[0].uuid })];
|
|
154
155
|
viewer.drawFrame();
|
|
155
156
|
}
|
|
156
157
|
};
|
|
@@ -633,33 +634,35 @@ export const MiddlewareSelector = (opts, config) => {
|
|
|
633
634
|
type = 'resizeElement';
|
|
634
635
|
}
|
|
635
636
|
if (hasChangedData) {
|
|
636
|
-
const startSize = pointStartElementSizeList[0];
|
|
637
637
|
let modifyRecord = null;
|
|
638
|
-
if (
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
638
|
+
if (Array.isArray(pointStartElementSizeList) && pointStartElementSizeList.length) {
|
|
639
|
+
const startSize = pointStartElementSizeList[0];
|
|
640
|
+
if (selectedElements.length === 1) {
|
|
641
|
+
modifyRecord = {
|
|
642
|
+
type: 'resizeElement',
|
|
643
|
+
time: 0,
|
|
644
|
+
content: {
|
|
645
|
+
method: 'modifyElement',
|
|
646
|
+
uuid: startSize.uuid,
|
|
647
|
+
before: toFlattenElement(startSize),
|
|
648
|
+
after: toFlattenElement(getElementSize(selectedElements[0]))
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
if (selectedElements[0].type === 'group' && startResizeGroupRecord && endResizeGroupRecord) {
|
|
652
|
+
modifyRecord = Object.assign(Object.assign({}, endResizeGroupRecord), { content: Object.assign(Object.assign({}, endResizeGroupRecord.content), { before: startResizeGroupRecord.content.before }) });
|
|
647
653
|
}
|
|
648
|
-
};
|
|
649
|
-
if (selectedElements[0].type === 'group' && startResizeGroupRecord && endResizeGroupRecord) {
|
|
650
|
-
modifyRecord = Object.assign(Object.assign({}, endResizeGroupRecord), { content: Object.assign(Object.assign({}, endResizeGroupRecord.content), { before: startResizeGroupRecord.content.before }) });
|
|
651
654
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
}
|
|
655
|
+
else if (selectedElements.length > 1) {
|
|
656
|
+
modifyRecord = {
|
|
657
|
+
type: 'resizeElements',
|
|
658
|
+
time: 0,
|
|
659
|
+
content: {
|
|
660
|
+
method: 'modifyElements',
|
|
661
|
+
before: pointStartElementSizeList.map((item) => (Object.assign(Object.assign({}, toFlattenElement(item)), { uuid: item.uuid }))),
|
|
662
|
+
after: selectedElements.map((item) => (Object.assign(Object.assign({}, toFlattenElement(getElementSize(item))), { uuid: item.uuid })))
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
}
|
|
663
666
|
}
|
|
664
667
|
eventHub.trigger(coreEventKeys.CHANGE, { data, type, selectedElements, hoverElement, modifyRecord });
|
|
665
668
|
hasChangedData = false;
|
|
@@ -123,6 +123,7 @@ export const MiddlewareTextEditor = (opts) => {
|
|
|
123
123
|
alignItems = 'end';
|
|
124
124
|
}
|
|
125
125
|
textarea.style.display = 'inline-flex';
|
|
126
|
+
textarea.style.flexDirection = 'column';
|
|
126
127
|
textarea.style.justifyContent = justifyContent;
|
|
127
128
|
textarea.style.alignItems = alignItems;
|
|
128
129
|
textarea.style.position = 'absolute';
|
package/dist/index.global.js
CHANGED
|
@@ -4543,6 +4543,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4543
4543
|
__privateMethod(this, _BoardWatcher_instances, init_fn).call(this);
|
|
4544
4544
|
}
|
|
4545
4545
|
onEvents() {
|
|
4546
|
+
if (__privateGet(this, _opts).disabled === true) {
|
|
4547
|
+
return;
|
|
4548
|
+
}
|
|
4546
4549
|
if (__privateGet(this, _hasDestroyed)) {
|
|
4547
4550
|
return;
|
|
4548
4551
|
}
|
|
@@ -4557,6 +4560,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4557
4560
|
container.addEventListener("contextmenu", __privateGet(this, _onContextMenu));
|
|
4558
4561
|
}
|
|
4559
4562
|
offEvents() {
|
|
4563
|
+
if (__privateGet(this, _opts).disabled === true) {
|
|
4564
|
+
return;
|
|
4565
|
+
}
|
|
4560
4566
|
const container = window;
|
|
4561
4567
|
const canvas = __privateGet(this, _opts).boardContent.boardContext.canvas;
|
|
4562
4568
|
container.removeEventListener("mousemove", __privateGet(this, _onHover));
|
|
@@ -4885,7 +4891,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4885
4891
|
const sharer = new Sharer();
|
|
4886
4892
|
const watcher = new BoardWatcher({
|
|
4887
4893
|
boardContent,
|
|
4888
|
-
sharer
|
|
4894
|
+
sharer,
|
|
4895
|
+
disabled: opts == null ? void 0 : opts.disableWatcher
|
|
4889
4896
|
});
|
|
4890
4897
|
const renderer = new Renderer({
|
|
4891
4898
|
viewContext: boardContent.viewContext,
|
|
@@ -7804,6 +7811,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7804
7811
|
const groupQueue = getGroupQueueFromList(elem.uuid, (data2 == null ? void 0 : data2.elements) || []);
|
|
7805
7812
|
sharer.setSharedStorage(keyGroupQueue, groupQueue);
|
|
7806
7813
|
updateSelectedElementList(elements);
|
|
7814
|
+
pointStartElementSizeList = [{ ...getElementSize(elements[0]), uuid: elements[0].uuid }];
|
|
7807
7815
|
viewer.drawFrame();
|
|
7808
7816
|
}
|
|
7809
7817
|
};
|
|
@@ -8259,44 +8267,46 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8259
8267
|
if (data2 && ["drag", "drag-list", "drag-list-end", "resize"].includes(actionType)) {
|
|
8260
8268
|
let type2 = "resizeElement";
|
|
8261
8269
|
if (hasChangedData) {
|
|
8262
|
-
const startSize = pointStartElementSizeList[0];
|
|
8263
8270
|
let modifyRecord = null;
|
|
8264
|
-
if (
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8271
|
+
if (Array.isArray(pointStartElementSizeList) && pointStartElementSizeList.length) {
|
|
8272
|
+
const startSize = pointStartElementSizeList[0];
|
|
8273
|
+
if (selectedElements.length === 1) {
|
|
8274
|
+
modifyRecord = {
|
|
8275
|
+
type: "resizeElement",
|
|
8276
|
+
time: 0,
|
|
8277
|
+
content: {
|
|
8278
|
+
method: "modifyElement",
|
|
8279
|
+
uuid: startSize.uuid,
|
|
8280
|
+
before: toFlattenElement(startSize),
|
|
8281
|
+
after: toFlattenElement(getElementSize(selectedElements[0]))
|
|
8282
|
+
}
|
|
8283
|
+
};
|
|
8284
|
+
if (selectedElements[0].type === "group" && startResizeGroupRecord && endResizeGroupRecord) {
|
|
8285
|
+
modifyRecord = {
|
|
8286
|
+
...endResizeGroupRecord,
|
|
8287
|
+
content: {
|
|
8288
|
+
...endResizeGroupRecord.content,
|
|
8289
|
+
before: startResizeGroupRecord.content.before
|
|
8290
|
+
}
|
|
8291
|
+
};
|
|
8273
8292
|
}
|
|
8274
|
-
}
|
|
8275
|
-
if (selectedElements[0].type === "group" && startResizeGroupRecord && endResizeGroupRecord) {
|
|
8293
|
+
} else if (selectedElements.length > 1) {
|
|
8276
8294
|
modifyRecord = {
|
|
8277
|
-
|
|
8295
|
+
type: "resizeElements",
|
|
8296
|
+
time: 0,
|
|
8278
8297
|
content: {
|
|
8279
|
-
|
|
8280
|
-
before:
|
|
8298
|
+
method: "modifyElements",
|
|
8299
|
+
before: pointStartElementSizeList.map((item) => ({
|
|
8300
|
+
...toFlattenElement(item),
|
|
8301
|
+
uuid: item.uuid
|
|
8302
|
+
})),
|
|
8303
|
+
after: selectedElements.map((item) => ({
|
|
8304
|
+
...toFlattenElement(getElementSize(item)),
|
|
8305
|
+
uuid: item.uuid
|
|
8306
|
+
}))
|
|
8281
8307
|
}
|
|
8282
8308
|
};
|
|
8283
8309
|
}
|
|
8284
|
-
} else if (selectedElements.length > 1) {
|
|
8285
|
-
modifyRecord = {
|
|
8286
|
-
type: "resizeElements",
|
|
8287
|
-
time: 0,
|
|
8288
|
-
content: {
|
|
8289
|
-
method: "modifyElements",
|
|
8290
|
-
before: pointStartElementSizeList.map((item) => ({
|
|
8291
|
-
...toFlattenElement(item),
|
|
8292
|
-
uuid: item.uuid
|
|
8293
|
-
})),
|
|
8294
|
-
after: selectedElements.map((item) => ({
|
|
8295
|
-
...toFlattenElement(getElementSize(item)),
|
|
8296
|
-
uuid: item.uuid
|
|
8297
|
-
}))
|
|
8298
|
-
}
|
|
8299
|
-
};
|
|
8300
8310
|
}
|
|
8301
8311
|
eventHub.trigger(coreEventKeys.CHANGE, { data: data2, type: type2, selectedElements, hoverElement, modifyRecord });
|
|
8302
8312
|
hasChangedData = false;
|
|
@@ -9373,6 +9383,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
9373
9383
|
alignItems = "end";
|
|
9374
9384
|
}
|
|
9375
9385
|
textarea.style.display = "inline-flex";
|
|
9386
|
+
textarea.style.flexDirection = "column";
|
|
9376
9387
|
textarea.style.justifyContent = justifyContent;
|
|
9377
9388
|
textarea.style.alignItems = alignItems;
|
|
9378
9389
|
textarea.style.position = "absolute";
|
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var iDrawCore=function(e){"use strict";var t,i,o,n,r,l,a,s,h,c,d,u,f,g,v,m,y,p,w,x,S,b,A,I,M,z,R,C,E,T,P,L,O,k,W,D,j,Y,N,B,F,G,V,X,H,Z,Q,U,$,J,K,q,_,ee,te,ie,oe,ne,re,le,ae,se,he,ce,de,ue,fe,ge,ve,me=e=>{throw TypeError(e)},ye=(e,t,i)=>t.has(e)||me("Cannot "+i),pe=(e,t,i)=>(ye(e,t,"read from private field"),i?i.call(e):t.get(e)),we=(e,t,i)=>t.has(e)?me("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),xe=(e,t,i,o)=>(ye(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),Se=(e,t,i)=>(ye(e,t,"access private method"),i);function be(e){return"string"==typeof e&&(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function Ae(e,t){if(1===t)return e;let i=1;const o=/^#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^#/,"0x")):/^#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function Ie(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function Me(e,t){let i=0;for(let t=0;t<e.length;t++)i+=e.charCodeAt(t);return(i+t).toString(16).substring(0,4)}function ze(e,t){const i=e.length,o=function(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i);return t}(t),n=Math.floor(i/2),r=e.substring(0,4).padStart(4,"0"),l=e.substring(0,4).padStart(4,"0");return`@assets/${Me(i.toString(16).padStart(4,r),o).padStart(4,"0")}${Me(e.substring(n-4,n).padStart(4,r),o).padStart(4,"0")}-${Me(e.substring(n-8,n-4).padStart(4,r),o).padStart(4,"0")}-${Me(e.substring(n-12,n-8).padStart(4,r),o).padStart(4,"0")}-${Me(e.substring(n-16,n-12).padStart(4,l),o).padStart(4,"0")}-${Me(e.substring(n,n+4).padStart(4,l),o).padStart(4,"0")}${Me(e.substring(n+4,n+8).padStart(4,l),o).padStart(4,"0")}${Me(l.padStart(4,r).padStart(4,l),o)}`}function Re(e){return/^@assets\/[0-9a-z-]{0,}$/.test(`${e}`)}function Ce(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function Ee(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const Te={type(e,t){const i=Ee(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===Ee(e),json:e=>"Object"===Ee(e),function:e=>"Function"===Ee(e),asyncFunction:e=>"AsyncFunction"===Ee(e),boolean:e=>"Boolean"===Ee(e),string:e=>"String"===Ee(e),number:e=>"Number"===Ee(e),undefined:e=>"Undefined"===Ee(e),null:e=>"Null"===Ee(e),promise:e=>"Promise"===Ee(e)};var Pe=function(e,t,i,o){return new(i||(i=Promise))((function(n,r){function l(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,a)}s((o=o.apply(e,t||[])).next())}))};const{Image:Le}=window;function Oe(e){return new Promise(((t,i)=>{const o=new Le;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function ke(e){return Pe(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield Oe(t)}))}function We(e,t){return Pe(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const r=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),l=new FileReader;l.readAsDataURL(r),l.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},l.onerror=function(e){n(e)}}))}(e,t);return yield Oe(i)}))}function De(e){return"number"==typeof e&&e>=0}function je(e){return"number"==typeof e&&(e>0||e<=0)}function Ye(e){return je(e)}function Ne(e){return je(e)}function Be(e){return De(e)}function Fe(e){return De(e)}function Ge(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function Ve(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}function Xe(e){return["rect","circle","text","image","svg","html","group"].includes(e)}const He={positiveNum:De,data:function(e){return!!(Array(null==e?void 0:e.elements)&&(null==e?void 0:e.elements.length)>=0)},element:function(e){return!!e&&(Xe(null==e?void 0:e.type)&&Ye(null==e?void 0:e.x)&&Ne(null==e?void 0:e.y)&&Be(null==e?void 0:e.w)&&Fe(null==e?void 0:e.h))},layout:function(e){return!!e&&(Ye(null==e?void 0:e.x)&&Ne(null==e?void 0:e.y)&&Be(null==e?void 0:e.w)&&Fe(null==e?void 0:e.h))},type:Xe,x:Ye,y:Ne,w:Be,h:Fe,angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:je,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return De(e)||Array.isArray(e)&&De(e[0])&&De(e[1])&&De(e[2])&&De(e[3])},borderRadius:function(e){return De(e)||Array.isArray(e)&&De(e[0])&&De(e[1])&&De(e[2])&&De(e[3])},color:function(e){return be(e)},imageSrc:function(e){return Ve(e)||Ge(e)},imageURL:Ge,imageBase64:Ve,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return je(e)&&e>0},lineHeight:function(e){return je(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return je(e)&&e>0}};var Ze,Qe,Ue=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},$e=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Je{constructor(e,t){Ze.set(this,void 0),Qe.set(this,void 0),Ue(this,Ze,e,"f"),Ue(this,Qe,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/$e(this,Qe,"f").devicePixelRatio}$doPixelRatio(e){return $e(this,Qe,"f").devicePixelRatio*e}$getContext(){return $e(this,Ze,"f")}$setContext(e){Ue(this,Ze,e,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),$e(this,Ze,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return $e(this,Qe,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:r}=$e(this,Ze,"f");r.width=t*o,r.height=i*o,Ue(this,Qe,Object.assign(Object.assign({},$e(this,Qe,"f")),{devicePixelRatio:o}),"f"),!0===n&&(r.style.width=`${t}px`,r.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=$e(this,Qe,"f"),{width:t,height:i}=$e(this,Ze,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return $e(this,Ze,"f").canvas}get fillStyle(){return $e(this,Ze,"f").fillStyle}set fillStyle(e){$e(this,Ze,"f").fillStyle=e}get strokeStyle(){return $e(this,Ze,"f").strokeStyle}set strokeStyle(e){$e(this,Ze,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio($e(this,Ze,"f").lineWidth)}set lineWidth(e){$e(this,Ze,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return $e(this,Ze,"f").textAlign}set textAlign(e){$e(this,Ze,"f").textAlign=e}get textBaseline(){return $e(this,Ze,"f").textBaseline}set textBaseline(e){$e(this,Ze,"f").textBaseline=e}get globalAlpha(){return $e(this,Ze,"f").globalAlpha}set globalAlpha(e){$e(this,Ze,"f").globalAlpha=e}get shadowColor(){return $e(this,Ze,"f").shadowColor}set shadowColor(e){$e(this,Ze,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio($e(this,Ze,"f").shadowOffsetX)}set shadowOffsetX(e){$e(this,Ze,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio($e(this,Ze,"f").shadowOffsetY)}set shadowOffsetY(e){$e(this,Ze,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio($e(this,Ze,"f").shadowBlur)}set shadowBlur(e){$e(this,Ze,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return $e(this,Ze,"f").lineCap}set lineCap(e){$e(this,Ze,"f").lineCap=e}get globalCompositeOperation(){return $e(this,Ze,"f").globalCompositeOperation}set globalCompositeOperation(e){$e(this,Ze,"f").globalCompositeOperation=e}fill(...e){return $e(this,Ze,"f").fill(...e)}arc(e,t,i,o,n,r){return $e(this,Ze,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,r)}rect(e,t,i,o){return $e(this,Ze,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return $e(this,Ze,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return $e(this,Ze,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return $e(this,Ze,"f").beginPath()}closePath(){return $e(this,Ze,"f").closePath()}lineTo(e,t){return $e(this,Ze,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return $e(this,Ze,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return $e(this,Ze,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}bezierCurveTo(e,t,i,o,n,r){return $e(this,Ze,"f").bezierCurveTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(r))}quadraticCurveTo(e,t,i,o){return $e(this,Ze,"f").quadraticCurveTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}getLineDash(){return $e(this,Ze,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return $e(this,Ze,"f").setLineDash(t)}stroke(e){return e?$e(this,Ze,"f").stroke(e):$e(this,Ze,"f").stroke()}translate(e,t){return $e(this,Ze,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return $e(this,Ze,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],r=e[4],l=e[e.length-4],a=e[e.length-3],s=e[e.length-2],h=e[e.length-1];return 9===e.length?$e(this,Ze,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(r),this.$doPixelRatio(l),this.$doPixelRatio(a),this.$doPixelRatio(s),this.$doPixelRatio(h)):$e(this,Ze,"f").drawImage(t,this.$doPixelRatio(l),this.$doPixelRatio(a),this.$doPixelRatio(s),this.$doPixelRatio(h))}createPattern(e,t){return $e(this,Ze,"f").createPattern(e,t)}measureText(e){return $e(this,Ze,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?$e(this,Ze,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):$e(this,Ze,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?$e(this,Ze,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):$e(this,Ze,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){$e(this,Ze,"f").save()}restore(){$e(this,Ze,"f").restore()}scale(e,t){$e(this,Ze,"f").scale(e,t)}circle(e,t,i,o,n,r,l,a){$e(this,Ze,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,r,l,a)}isPointInPath(e,t){return $e(this,Ze,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return $e(this,Ze,"f").clip(...e)}setTransform(e,t,i,o,n,r){return $e(this,Ze,"f").setTransform(e,t,i,o,n,r)}getTransform(){return $e(this,Ze,"f").getTransform()}createLinearGradient(e,t,i,o){return $e(this,Ze,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,r){return $e(this,Ze,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(r))}createConicGradient(e,t,i){return $e(this,Ze,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function Ke(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),r=n.getContext("2d").canvas.getContext("2d");return new Je(r,{devicePixelRatio:o,offscreenCanvas:n})}function qe(e,t){const{width:i,height:o,devicePixelRatio:n}=t,r={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d"),a=Ke(r),s=Ke(r),h=Ke(r),c=function(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let r=o;if(!r){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,r=e.getContext("2d")}return new Je(r,e)}(Object.assign({ctx:l},r)),d=Ke(r);return{underlayContext:h,viewContext:a,overlayContext:s,boardContext:c,tempContext:d,drawView:()=>{const{width:e,height:t}=a.$getSize();c.clearRect(0,0,e,t),c.drawImage(h.canvas,0,0,e,t),c.drawImage(a.canvas,0,0,e,t),c.drawImage(s.canvas,0,0,e,t),h.clearRect(0,0,e,t),a.clearRect(0,0,e,t),s.clearRect(0,0,e,t)}}}Ze=new WeakMap,Qe=new WeakMap;var _e,et=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class tt{constructor(){_e.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,_e,new Map,"f")}on(e,t){if(et(this,_e,"f").has(e)){const i=et(this,_e,"f").get(e)||[];null==i||i.push(t),et(this,_e,"f").set(e,i)}else et(this,_e,"f").set(e,[t])}off(e,t){if(et(this,_e,"f").has(e)){const i=et(this,_e,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}et(this,_e,"f").set(e,i||[])}}trigger(e,t){const i=et(this,_e,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(et(this,_e,"f").has(e)){const t=et(this,_e,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){et(this,_e,"f").clear()}}function it(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}_e=new WeakMap;var ot,nt,rt,lt,at,st=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ht=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class ct{constructor(e){ot.add(this),nt.set(this,void 0),rt.set(this,void 0),lt.set(this,void 0),st(this,rt,Ce(e.defaultStorage),"f"),st(this,nt,ht(this,ot,"m",at).call(this),"f"),st(this,lt,e.defaultStatic||{},"f")}set(e,t){ht(this,nt,"f")[e]=t}get(e){return ht(this,nt,"f")[e]}setStatic(e,t){ht(this,lt,"f")[e]=t}getStatic(e){return ht(this,lt,"f")[e]}getSnapshot(e){return!0===(null==e?void 0:e.deepClone)?Ce(ht(this,nt,"f")):Object.assign({},ht(this,nt,"f"))}clear(){st(this,nt,ht(this,ot,"m",at).call(this),"f")}destroy(){st(this,nt,null,"f"),st(this,lt,null,"f")}}function dt(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function ut(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function ft(e){return e/180*Math.PI}function gt(e,t,i,o){const n=ft(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function vt(e,t,i){const o=mt(t);gt(e,t.angle||0,o,(()=>{i(e)}))}function mt(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function yt(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return mt({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function pt(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}function wt(e,t,i){let o=pt(e,t)+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 n=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let r=0,l=0;return 0===o?(r=0,l=0-n):o>0&&o<Math.PI/2?(r=Math.sin(o)*n,l=0-Math.cos(o)*n):o===Math.PI/2?(r=n,l=0):o>Math.PI/2&&o<Math.PI?(r=Math.sin(Math.PI-o)*n,l=Math.cos(Math.PI-o)*n):o===Math.PI?(r=0,l=n):o>Math.PI&&o<1.5*Math.PI?(r=0-Math.sin(o-Math.PI)*n,l=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(r=0-n,l=0):o>1.5*Math.PI&&o<2*Math.PI?(r=0-Math.sin(2*Math.PI-o)*n,l=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(r=0,l=0-n),r+=e.x,l+=e.y,{x:r,y:l}}function xt(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:r,h:l,angle:a=0}=e,s=wt(mt({x:t,y:n,w:r,h:l}),{x:i,y:o},ft(a));i=s.x,o=s.y})),{x:i,y:o}}return e}function St(e,t,i){const{x:o,y:n,w:r,h:l}=e;let a={x:o,y:n},s={x:o+r,y:n},h={x:o+r,y:n+l},c={x:o,y:n+l};if(i&&(i>0||i<0)){const e=ft(It(i));a=wt(t,a,e),s=wt(t,s,e),h=wt(t,h,e),c=wt(t,c,e)}return[a,s,h,c]}function bt(e){const{angle:t=0}=e;return St(e,mt(e),t)}function At(e,t,i){return[wt(e,{x:t[0].x,y:t[0].y},i),wt(e,{x:t[1].x,y:t[1].y},i),wt(e,{x:t[2].x,y:t[2].y},i),wt(e,{x:t[3].x,y:t[3].y},i)]}function It(e){if(!(e>0||e<0)||0===e||360===e)return 0;let t=e%360;return t<0?t+=360:360===e&&(t=0),t}function Mt(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=Mt(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function zt(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=bt(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),r=Math.max(t.x+t.w,i.x+i.w),l=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(r-o),i.h=Math.abs(l-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function Rt(e,t){var i;const o=[];let n=e;if(t.length>1)for(let e=0;e<t.length-1;e++){const r=n[t[e]];if("group"!==(null==r?void 0:r.type)||!Array.isArray(null===(i=null==r?void 0:r.detail)||void 0===i?void 0:i.children))return null;o.push(r),n=r.detail.children}return o}function Ct(e){const{x:t,y:i,w:o,h:n,angle:r}=e;return{x:t,y:i,w:o,h:n,angle:r}}function Et(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===(null==n?void 0:n.type))o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}function Tt(e,t){const i=[];let o=!1;const n=t=>{var r;for(let l=0;l<t.length&&!0!==o;l++){i.push(l);const a=t[l];if(a.uuid===e){o=!0;break}if("group"===a.type&&n((null===(r=null==a?void 0:a.detail)||void 0===r?void 0:r.children)||[]),o)break;i.pop()}};return n(t),i}function Pt(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function Lt(e){const{x:t,y:i,w:o,h:n,angle:r=0}=e;return 0===r?Pt(e):St(e,mt({x:t,y:i,w:o,h:n}),r)}function Ot(e){const t=[];let i=0,o=0;const n=[],r=[...e];for(let e=0;e<r.length;e++){const{x:l,y:a,w:s,h:h,angle:c=0}=r[e];let d;if(i+=l,o+=a,0===e){const e={x:i,y:o,w:s,h:h};d=Lt({x:l,y:a,w:s,h:h,angle:c}),n.push({center:mt(e),angle:c,radian:ft(c)})}else{d=Pt({x:i,y:o,w:s,h:h});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=At(t,d,i)}const e=yt(d);if(c>0||c<0){d=At(e,d,ft(c))}n.push({center:e,angle:c,radian:ft(c)})}t.push(d)}return t}function kt(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Ot([...i,e]):[Lt(e)]}(e,t);return i.pop()||null}function Wt(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:r,h:l,angle:a}=e,{scale:s,offsetTop:h,offsetLeft:c}=i;return{x:o*s+c,y:n*s+h,w:r*s,h:l*s,angle:a}}function Dt(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:r,offsetTop:l,offsetLeft:a}=i;return{x:o*r+a,y:n*r+l}}function jt(e,t){return[Dt(e[0],t),Dt(e[1],t),Dt(e[2],t),Dt(e[3],t)]}function Yt(e,t){const{context2d:i,element:o,viewScaleInfo:n}=t,{angle:r=0}=o,{x:l,y:a,w:s,h:h}=Wt(o,{viewScaleInfo:n}),c=bt({x:l,y:a,w:s,h:h,angle:r});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let e=1;e<c.length;e++)i.lineTo(c[e].x,c[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function Nt(e,t,i){const o=[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],r=Math.min(...o),l=Math.max(...o),a=Math.min(...n),s=Math.max(...n);return e.x>r&&e.x<l&&e.y>a&&e.y<s}function Bt(e,t){const{groupQueue:i}=t,o=kt(e,{groupQueue:i}),n=it(o[0],o[1]),r=it(o[1],o[2]),l=it(o[2],o[3]),a=it(o[3],o[0]),s=o[0],h=o[1],c=o[2],d=o[3],u=Math.max(s.x,h.x,c.x,d.x),f=Math.max(s.y,h.y,c.y,d.y);return{center:{x:(u+Math.min(s.x,h.x,c.x,d.x))/2,y:(f+Math.min(s.y,h.y,c.y,d.y))/2},topLeft:s,topRight:h,bottomLeft:d,bottomRight:c,top:n,right:r,left:a,bottom:l}}function Ft(e){const t=Math.max(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),i=Math.max(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),o=Math.min(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),r={x:e.center.x,y:e.center.y},l={x:o,y:n},a={x:t,y:n},s={x:t,y:i},h={x:o,y:i},c=it(l,a),d=it(h,s),u=it(l,h);return{center:r,topLeft:l,topRight:a,bottomLeft:h,bottomRight:s,top:c,right:it(a,s),left:u,bottom:d}}function Gt(e,t){const{x:i,y:o}=e,{size:n,angle:r}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:r}}function Vt(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n,rotateControllerSize:r,rotateControllerPosition:l}=t,a=(o&&o>0?o:8)/n.scale,{x:s,y:h,w:c,h:d,angle:u=0}=e,f=r,g=l,v=[{uuid:Ie(),x:s,y:h,w:c,h:d,angle:u,type:"group",detail:{children:[]}},...i];let m=0;v.forEach((({angle:e=0})=>{m+=e}));const y=kt(e,{groupQueue:i}),p=kt({x:s,y:h-(g+f/2)/n.scale,h:d+(2*g+f)/n.scale,w:c,angle:u},{groupQueue:[...i]}),w=it(y[0],y[1]),x=it(y[1],y[2]),S=it(y[2],y[3]),b=it(y[3],y[0]),A=y[0],I=y[1],M=y[2],z=y[3],R=Gt(w,{size:a,angle:m}),C=Gt(x,{size:a,angle:m}),E=Gt(S,{size:a,angle:m}),T=Gt(b,{size:a,angle:m}),P=Gt(A,{size:a,angle:m}),L=Gt(I,{size:a,angle:m}),O=Gt(z,{size:a,angle:m}),k=Gt(M,{size:a,angle:m}),W=Lt(P),D=Lt(L),j=Lt(O),Y=Lt(k),N=[W[1],D[0],D[3],W[2]],B=[D[3],D[2],Y[1],Y[0]],F=[j[1],Y[0],Y[3],j[2]],G=[W[3],W[2],j[1],j[0]],V=Lt(R),X=Lt(C),H=Lt(E),Z=Lt(T),Q=it(p[0],p[1]),U=Lt(Gt(Q,{size:1.1*r/n.scale,angle:m}));return{originalElementCenter:mt(e),originalElementSize:Object.assign({},e),elementWrapper:y,left:{type:"left",vertexes:G,center:b,size:a},right:{type:"right",vertexes:B,center:x,size:a},top:{type:"top",vertexes:N,center:w,size:a},bottom:{type:"bottom",vertexes:F,center:S,size:a},topLeft:{type:"top-left",vertexes:W,center:A,size:a},topRight:{type:"top-right",vertexes:D,center:I,size:a},bottomLeft:{type:"bottom-left",vertexes:j,center:z,size:a},bottomRight:{type:"bottom-right",vertexes:Y,center:M,size:a},leftMiddle:{type:"left-middle",vertexes:Z,center:b,size:a},rightMiddle:{type:"right-middle",vertexes:X,center:x,size:a},topMiddle:{type:"top-middle",vertexes:V,center:w,size:a},bottomMiddle:{type:"bottom-middle",vertexes:H,center:S,size:a},rotate:{type:"rotate",vertexes:U,center:Q,size:r}}}function Xt(e,t){const{controllerSize:i,viewScaleInfo:o}=t,n=i&&i>0?i:8,{x:r,y:l,w:a,h:s}=Wt(e,{viewScaleInfo:o}),h=mt({x:r,y:l,w:a,h:s}),c={x:h.x,y:l},d={x:r+a,y:h.y},u={x:h.x,y:l+s},f={x:r,y:h.y},g={x:r,y:l},v={x:r+a,y:l},m={x:r+a,y:l+s},y={x:r,y:l+s},p=Gt(c,{size:n,angle:0}),w=Gt(d,{size:n,angle:0}),x=Gt(u,{size:n,angle:0}),S=Gt(f,{size:n,angle:0}),b=Gt(g,{size:n,angle:0}),A=Gt(v,{size:n,angle:0}),I=Gt(y,{size:n,angle:0}),M=Gt(m,{size:n,angle:0}),z=Lt(b),R=Lt(A),C=Lt(I),E=Lt(M),T=[z[1],R[0],R[3],z[2]],P=[R[3],R[2],E[1],E[0]],L=[C[1],E[0],E[3],C[2]],O=[z[3],z[2],C[1],C[0]],k=Lt(p),W=Lt(w),D=Lt(x);return{left:{type:"left",vertexes:O,center:f,size:n},right:{type:"right",vertexes:P,center:d,size:n},top:{type:"top",vertexes:T,center:c,size:n},bottom:{type:"bottom",vertexes:L,center:u,size:n},topLeft:{type:"top-left",vertexes:z,center:g,size:n},topRight:{type:"top-right",vertexes:R,center:v,size:n},bottomLeft:{type:"bottom-left",vertexes:C,center:y,size:n},bottomRight:{type:"bottom-right",vertexes:E,center:m,size:n},leftMiddle:{type:"left-middle",vertexes:Lt(S),center:f,size:n},rightMiddle:{type:"right-middle",vertexes:W,center:d,size:n},topMiddle:{type:"top-middle",vertexes:k,center:c,size:n},bottomMiddle:{type:"bottom-middle",vertexes:D,center:u,size:n}}}function Ht(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function Zt(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}nt=new WeakMap,rt=new WeakMap,lt=new WeakMap,ot=new WeakSet,at=function(){return Ce(ht(this,rt,"f"))};const Qt="Text Element";const Ut={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 $t(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{borderDash:r}=e.detail,l=Array.isArray(r)&&r.length>0,{boxSizing:a=Ut.boxSizing,borderWidth:s}=e.detail;Array.isArray(s)&&(n=0);let{x:h,y:c,w:d,h:u}=e,f=[0,0,0,0];if("number"==typeof n){const e=n*o;f=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(f=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let g=0;return"number"==typeof s&&(g=(s||0)*o),"border-box"!==a||l?"content-box"===a?(h=e.x-g/2,c=e.y-g/2,d=e.w+g,u=e.h+g):(h=e.x,c=e.y,d=e.w,u=e.h):(h=e.x+g/2,c=e.y+g/2,d=e.w-g,u=e.h-g),d=Math.max(d,1),u=Math.max(u,1),f=f.map((e=>Math.min(e,d/2,u/2))),{x:h,y:c,w:d,h:u,radiusList:f}}function Jt(e,t="",i={},o){return Object.keys(e).forEach((n=>{var r;const l=t?`${t}${function(e){return/^\d+$/.test(e)&&!isNaN(Number(e))}(n)?`[${n}]`:`.${n}`}`:n;if(!(null===(r=null==o?void 0:o.ignorePaths)||void 0===r?void 0:r.includes(l))){const t=e[n];!function(e){return"object"==typeof e&&null!==e&&!(e instanceof Date)||Array.isArray(e)}(t)?i[l]=t:Jt(t,(Array.isArray(t),l),i,o)}})),i}function Kt(e,t){return"object"!=typeof e||null===e?{"":e}:Jt(e,"",{},t)}function qt(e){return Kt(e,{ignorePaths:["detail.children"]})}function _t(e){return Kt(e)}function ei(e){return Kt(e)}function ti(e){return Array.isArray(e)?[...e]:e.split(/\.|\[|\]/).filter((e=>""!==e))}function ii(e,t,i){if(!t)return;const o=ti(t);let n=e;for(const e of o){if(null==n)return i;n=n[e]}return void 0!==n?n:i}function oi(e,t,i){const o=ti(t);if(0===o.length)return e;let n=e;if(n)for(let e=0;e<o.length;e++){const t=o[e];if(e===o.length-1){n[t]=i;break}if(n&&(void 0===(null==n?void 0:n[t])||"object"!=typeof(null==n?void 0:n[t])||null===(null==n?void 0:n[t]))){const i=o[e+1],r=/^\d+$/.test(i);n[t]=r?[]:{}}n=null==n?void 0:n[t]}return e}function ni(e,t){const i=ti(t);if(0===i.length)return e;let o=e;if(o)for(let e=0;e<i.length;e++){const t=i[e];if(e===i.length-1){delete o[t];break}if(o&&(void 0===(null==o?void 0:o[t])||"object"!=typeof(null==o?void 0:o[t])||null===(null==o?void 0:o[t]))){const n=i[e+1],r=/^\d+$/.test(n);o[t]=r?[]:{}}o=null==o?void 0:o[t]}return e}const ri=e=>Zt(e,{decimalPlaces:4});function li(e,t){const i={detail:{}},o={detail:{}},n={type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:e.uuid,before:null,after:null}},{detail:r}=e,{xRatio:l,yRatio:a,maxRatio:s}=t,h=(l+a)/2,{borderWidth:c,borderRadius:d,borderDash:u,shadowOffsetX:f,shadowOffsetY:g,shadowBlur:v}=r;if("number"==typeof c)r.borderWidth=ri(c*h),i.detail.borderWidth=c,o.detail.borderWidth=r.borderWidth;else if(Array.isArray(r.borderWidth)){const e=c;r.borderWidth=[ri(e[0]*a),ri(e[1]*l),ri(e[2]*a),ri(e[3]*l)],i.detail.borderWidth=[...e],o.detail.borderWidth=[...r.borderWidth]}if("number"==typeof d)r.borderRadius=ri(d*h),i.detail.borderRadius=d,o.detail.borderRadius=r.borderRadius;else if(Array.isArray(r.borderRadius)){const e=d;r.borderRadius=[e[0]*l,e[1]*l,e[2]*a,e[3]*a],i.detail.borderRadius=[...e],o.detail.borderRadius=[...r.borderRadius]}return Array.isArray(u)&&(u.forEach(((e,t)=>{r.borderDash[t]=ri(e*s)})),i.detail.borderDash=[...u],o.detail.borderDash=[...r.borderDash]),"number"==typeof f&&(r.shadowOffsetX=ri(f*s),i.detail.shadowOffsetX=f,o.detail.shadowOffsetX=r.shadowOffsetX),"number"==typeof g&&(r.shadowOffsetY=ri(g*s),i.detail.shadowOffsetY=g,o.detail.shadowOffsetY=r.shadowOffsetY),"number"==typeof v&&(r.shadowBlur=ri(v*s),i.detail.shadowBlur=v,o.detail.shadowBlur=r.shadowBlur),n.content.before=qt(i),n.content.after=qt(o),n}function ai(e,t,i){const{type:o,uuid:n}=e,r=function(e,t){const{xRatio:i,yRatio:o}=t,{uuid:n,x:r,y:l,w:a,h:s}=e;e.x=ri(r*i),e.y=ri(l*o),e.w=ri(a*i),e.h=ri(s*o);const h={type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:n,before:{x:r,y:l,w:a,h:s},after:{x:e.x,y:e.y,w:e.w,h:e.h}}},c=li(e,t);return h.content.before=Object.assign(Object.assign({},h.content.before),c.content.before),h.content.after=Object.assign(Object.assign({},h.content.after),c.content.after),h}(e,t),l=Object.assign(Object.assign({},r.content.before),{uuid:n}),a=Object.assign(Object.assign({},r.content.after),{uuid:n});if(null==i||i.content.before.push(l),null==i||i.content.after.push(a),"circle"===o);else if("text"===o){const i=function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:r}=e.detail,l=(i+o)/2,a={},s={};return n&&n>0&&(e.detail.fontSize=ri(n*l),a["detail.fontSize"]=n,s["detail.fontSize"]=e.detail.fontSize),r&&r>0&&(e.detail.lineHeight=ri(r*l),a["detail.lineHeight"]=r,s["detail.lineHeight"]=e.detail.lineHeight),{type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:e.uuid,before:a,after:s}}}(e,t);Object.keys(i.content.before||{}).forEach((e=>{var t;l[e]=null===(t=i.content.before)||void 0===t?void 0:t[e]})),Object.keys(i.content.after||{}).forEach((e=>{var t;a[e]=null===(t=i.content.after)||void 0===t?void 0:t[e]}))}else"image"===o||"svg"===o||"html"===o||"path"===o||"group"===o&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{ai(e,t,i)}))}function si(e,t,i){const o={type:"resizeElements",time:Date.now(),content:{method:"modifyElements",before:[],after:[]}},n=e.uuid,r=e.x,l=e.y,a=e.w,s=e.h,h=Te.number(t.x)?t.x:e.x,c=Te.number(t.y)?t.y:e.y,d=(t.w&&t.w>0?t.w:e.w)||0,u=(t.h&&t.h>0?t.h:e.h)||0,f={uuid:n,x:r,y:l,w:a,h:s},g={uuid:n,x:h,y:c,w:d,h:u};if("deepResize"===(null==i?void 0:i.resizeEffect)){o.content.before.push(f),o.content.after.push(g);const t=d/e.w,i=u/e.h;if(t===i&&1===t)return o;const n=Math.min(t,i),r=Math.max(t,i);e.w=d,e.h=u;const l={xRatio:t,yRatio:i,minRatio:n,maxRatio:r};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{ai(e,l,o)}));const a=li(e,l);return Object.keys(a.content.before||{}).forEach((e=>{var t;f[e]=null===(t=a.content.before)||void 0===t?void 0:t[e]})),Object.keys(a.content.after||{}).forEach((e=>{var t;g[e]=null===(t=a.content.after)||void 0===t?void 0:t[e]})),o}if("fixed"===(null==i?void 0:i.resizeEffect)){o.content.before.push(f),o.content.after.push(g);const t=h-e.x,i=c-e.y,n=d-e.w;return function(e,t,i){if("group"!==e.type||!Array.isArray(e.detail.children))return;const{moveX:o,moveY:n,moveH:r,moveW:l}=t;let a=0,s=0,h=!1;0===o&&0===n||0===r&&0===l||(h=!0,a=-o,s=-n),!0===h&&e.detail.children.forEach((e=>{const{uuid:t,x:o,y:n}=e,r=o+a,l=n+s,h={uuid:t,x:o,y:n},c={uuid:t,x:r,y:l};e.x=r,e.y=l,null==i||i.content.before.push(h),null==i||i.content.after.push(c)}))}(e,{moveX:t,moveY:i,moveH:u-e.h,moveW:n},o),e.w=d,e.h=u,e.x=h,e.y=c,o}return e.w=d,e.h=u,e.x=h,e.y=c,o.content.before.push(f),o.content.after.push(g),o}function hi(e,t,i){const o=function(e,t){let i=0,o=0,n=200,r=200;if(t){const{viewScaleInfo:l,viewSizeInfo:a}=t,{scale:s,offsetLeft:h,offsetTop:c}=l,{width:d,height:u}=a,f=d/4,g=u/4;n=200>=f?f/s:200/s,r=200>=g?g/s:200/s,["circle","svg","image"].includes(e)?n=r=Math.max(n,r):"text"===e&&(r=n/12*2),i=(0-h+d/2-n*s/2)/s,o=(0-c+u/2-r*s/2)/s}return{x:i,y:o,w:n,h:r}}(e,i);let n={};"rect"===e?n={background:"#D9D9D9"}:"circle"===e?n={background:"#D9D9D9",radius:0}:"text"===e?n=function(e){const t={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"};return{text:Qt,color:t.color,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:e.w/12,textAlign:"center",verticalAlign:"middle"}}(o):"svg"===e?n={svg:'<svg t="1701004189871" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3-12.3 12.7-12.1 32.9 0.6 45.3l183.7 179.1-43.4 252.9c-1.2 6.9-0.1 14.1 3.2 20.3 8.2 15.6 27.6 21.7 43.2 13.4L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" fill="#2c2c2c"></path></svg>'}:"image"===e?n={src:"data:image/svg+xml;base64,PHN2ZyAgIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiPjxwYXRoIGQ9Ik05MjggMTYwSDk2Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY2NDBjMCAxNy43IDE0LjMgMzIgMzIgMzJoODMyYzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE5MmMwLTE3LjctMTQuMy0zMi0zMi0zMnogbS00MCA2MzJIMTM2di0zOS45bDEzOC41LTE2NC4zIDE1MC4xIDE3OEw2NTguMSA0ODkgODg4IDc2MS42Vjc5MnogbTAtMTI5LjhMNjY0LjIgMzk2LjhjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDQyNC42IDY2Ni40bC0xNDQtMTcwLjdjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDEzNiA2NTIuN1YyMzJoNzUydjQzMC4yeiIgIGZpbGw9IiM1MTUxNTEiPjwvcGF0aD48cGF0aCBkPSJNMzA0IDQ1NmM0OC42IDAgODgtMzkuNCA4OC04OHMtMzkuNC04OC04OC04OC04OCAzOS40LTg4IDg4IDM5LjQgODggODggODh6IG0wLTExNmMxNS41IDAgMjggMTIuNSAyOCAyOHMtMTIuNSAyOC0yOCAyOC0yOC0xMi41LTI4LTI4IDEyLjUtMjggMjgtMjh6IiAgZmlsbD0iIzUxNTE1MSI+PC9wYXRoPjwvc3ZnPg=="}:"group"===e&&(n={children:[],background:"#D9D9D9",overflow:"hidden"});return Object.assign(Object.assign(Object.assign({uuid:Ie()},o),t),{type:e,detail:Object.assign(Object.assign({},n),t.detail||{})})}function ci(e,t,i){let o=!1;if(1===t.length){const n=t[0];i.splice(n,0,e),o=!0}else if(t.length>1){let n=i;for(let i=0;i<t.length;i++){const r=n[t[i]];if(i===t.length-1){const r=t[i];n.splice(r,0,e),o=!0}else{if(!(i<t.length-1&&"group"===r.type))break;n=r.detail.children}}}return o}function di(e,t){let i=!1;if(1===e.length){const o=e[0];t.splice(o,1),i=!0}else if(e.length>1){let o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t===e.length-1){const n=e[t];o.splice(n,1),i=!0}else{if(!(t<e.length-1&&"group"===n.type))break;o=n.detail.children}}}return i}function ui(e,t,i){const o=qt(t),n=["uuid","type"],r=Object.keys(o);if(r.forEach((t=>{if(!n.includes(t)){const i=o[t];ni(e,t),void 0!==i&&oi(e,t,i)}})),!0===(null==i?void 0:i.strict)){const t=qt(e);Object.keys(t).forEach((t=>{n.includes(t)||r.includes(t)||ni(e,t)}))}return e}function fi(e,t,i){var o,n,r;let l=null;for(let a=0;a<i.length;a++){const s=i[a];if(s.uuid===e){"group"===s.type&&(null===(o=s.operations)||void 0===o?void 0:o.resizeEffect)&&si(s,Object.assign({},t),{resizeEffect:null===(n=s.operations)||void 0===n?void 0:n.resizeEffect}),ui(s,t),l=s;break}"group"===s.type&&(l=fi(e,t,(null===(r=null==s?void 0:s.detail)||void 0===r?void 0:r.children)||[]))}return l}function gi(e,t,i,o){var n,r;const l=Et(e,i);return l&&("group"===l.type&&(null===(n=l.operations)||void 0===n?void 0:n.resizeEffect)&&si(l,Object.assign({},t),{resizeEffect:null===(r=l.operations)||void 0===r?void 0:r.resizeEffect}),ui(l,t,o)),l}const vi=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function mi(e){return[e,...vi].join(", ")}function yi(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:r=1}=i,{x:l,y:a}=o,{scale:s}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:l+i.x*s,y:a+i.y*s},c={x:l+o.x*s,y:a+o.y*s},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,Ae(e.color,r))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:l+i.x*s,y:a+i.y*s,radius:i.radius*s},c={x:l+o.x*s,y:a+o.y*s,radius:o.radius*s},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,Ae(e.color,r))})),d}return"#000000"}const pi={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 wi(e){var t,i,o,n;let r=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(r=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),r}function xi(e,t,i){const{pattern:o,renderContent:n,originElem:r,calcElemSize:l,viewScaleInfo:a,viewSizeInfo:s}=i||{},{parentOpacity:h}=i,c=wi(r)*h,{clipPath:d,clipPathStrokeColor:u,clipPathStrokeWidth:f}=r.detail,g=()=>{e.globalAlpha=c,Si(e,t,{pattern:o,viewScaleInfo:a,viewSizeInfo:s}),null==n||n(),bi(e,t,{viewScaleInfo:a}),e.globalAlpha=h};d?(function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:r,viewSizeInfo:l}=i,a=l.devicePixelRatio,{clipPath:s}=(null==n?void 0:n.detail)||{};if(s&&r&&s.commands){const{x:i,y:n,w:l,h:h}=r,{originW:c,originH:d,originX:u,originY:f}=s,g=l/c,v=h/d,m=i-u*g,y=n-f*v;e.save(),e.translate(m,y),e.scale(a*g,a*v);const p=Ht(s.commands||[]),w=new Path2D(p);e.clip(w,"nonzero"),e.translate(0-m,0-y),e.setTransform(1,0,0,1,0,0),vt(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:r,calcElemSize:l,viewSizeInfo:s,renderContent:()=>{g()}}),"number"==typeof f&&f>0&&u&&function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:r,viewSizeInfo:l,parentOpacity:a}=i,s=l.devicePixelRatio,{clipPath:h,clipPathStrokeColor:c,clipPathStrokeWidth:d}=(null==n?void 0:n.detail)||{};if(h&&r&&h.commands&&"number"==typeof d&&d>0&&c){const{x:i,y:n,w:l,h:u}=r,{originW:f,originH:g,originX:v,originY:m}=h,y=l/f,p=u/g,w=i-v*y,x=n-m*p;e.save(),e.globalAlpha=a,e.translate(w,x),e.scale(s*y,s*p);const S=Ht(h.commands||[]),b=new Path2D(S);e.strokeStyle=c,e.lineWidth=d,e.stroke(b),e.translate(0-w,0-x),e.setTransform(1,0,0,1,0,0),vt(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:r,calcElemSize:l,viewSizeInfo:s,parentOpacity:h})):g()}function Si(e,t,i){var o,n;const{pattern:r,viewScaleInfo:l,viewSizeInfo:a}=i,s=[];if(t.detail.background||r){const{x:i,y:a,w:h,h:c,radiusList:d}=$t(t,{viewScaleInfo:l});if(e.beginPath(),e.moveTo(i+d[0],a),e.arcTo(i+h,a,i+h,a+c,d[1]),e.arcTo(i+h,a+c,i,a+c,d[2]),e.arcTo(i,a+c,i,a,d[3]),e.arcTo(i,a,i+h,a,d[0]),e.closePath(),"string"==typeof r)e.fillStyle=r;else if(["CanvasPattern"].includes(Te.type(r)))e.fillStyle=r;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=yi(e,t.detail.background,{viewElementSize:{x:i,y:a,w:h,h:c},viewScaleInfo:l,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=yi(e,t.detail.background,{viewElementSize:{x:i,y:a,w:h,h:c},viewScaleInfo:l,opacity:e.globalAlpha});if(e.fillStyle=o,s&&s.length>0)for(let t=0;t<(null==s?void 0:s.length);t++){const o=s[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+a):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill("nonzero"),s&&s.length>0&&e.setTransform(1,0,0,1,0,0)}}function bi(e,t,i){if(0===t.detail.borderWidth)return;if(!be(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let r=pi.borderColor;!0===be(t.detail.borderColor)&&(r=t.detail.borderColor);const{borderDash:l,borderWidth:a,borderRadius:s,boxSizing:h=pi.boxSizing}=t.detail;let c=[];Array.isArray(l)&&l.length>0&&(c=l.map((e=>Math.ceil(e*n)))),c.length>0?e.lineCap="butt":e.lineCap="square";let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);let u=0;"number"==typeof a&&(u=a||1),u*=n,e.strokeStyle=r;let f=0,g=0,v=0,m=0;if(Array.isArray(a)&&(f=(a[0]||0)*n,g=(a[1]||0)*n,v=(a[2]||0)*n,m=(a[3]||0)*n),m||g||f||v){e.lineCap="butt";let{x:i,y:o,w:n,h:r}=t;"border-box"===h?(i+=m/2,o+=f/2,n=n-m/2-g/2,r=r-f/2-v/2):"content-box"===h?(i-=m/2,o-=f/2,n=n+m/2+g/2,r=r+f/2+v/2):(i=t.x,o=t.y,n=t.w,r=t.h),f&&(e.beginPath(),e.lineWidth=f,e.moveTo(i-m/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-f/2),e.lineTo(i+n,o+r+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-m/2,o+r),e.lineTo(i+n+g/2,o+r),e.closePath(),e.stroke()),m&&(e.beginPath(),e.lineWidth=m,e.moveTo(i,o-f/2),e.lineTo(i,o+r+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:r}=t;"border-box"===h?(i=t.x+u/2,o=t.y+u/2,n=t.w-u,r=t.h-u):"content-box"===h?(i=t.x-u/2,o=t.y-u/2,n=t.w+u,r=t.h+u):(i=t.x,o=t.y,n=t.w,r=t.h),n=Math.max(n,1),r=Math.max(r,1),d=d.map((e=>Math.min(e,n/2,r/2))),e.setLineDash(c),e.lineWidth=u,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+r,d[1]),e.arcTo(i+n,o+r,i,o+r,d[2]),e.arcTo(i,o+r,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}function Ai(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:r}=i,{shadowColor:l,shadowOffsetX:a,shadowOffsetY:s,shadowBlur:h}=o;He.number(h)?(e.save(),e.shadowColor=l||pi.shadowColor,e.shadowOffsetX=(a||0)*n.scale,e.shadowOffsetY=(s||0)*n.scale,e.shadowBlur=(h||0)*n.scale,r(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,r(),e.restore())}const Ii={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 Mi(e,t,i){var o,n;const{detail:r}=t,{originX:l,originY:a,originW:s,originH:h,fillRule:c}=r,{viewScaleInfo:d,viewSizeInfo:u,parentOpacity:f}=i,{x:g,y:v,w:m,h:y,angle:p}=Wt(t,{viewScaleInfo:d})||t,w=m/s,x=y/h,S=g-l*w,b=v-a*x,A=t.detail,{clipPath:I,clipPathStrokeColor:M,clipPathStrokeWidth:z}=A,R=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(i[o[n]]=e[o[n]])}return i}(A,["clipPath","clipPathStrokeColor","clipPathStrokeWidth"]),C=d.scale*u.devicePixelRatio,E=Object.assign(Object.assign({},t),{x:g,y:v,w:m,h:y,angle:p});let T=Object.assign({},E);T.detail=R;let P=Object.assign({},t);P.detail=R,r.fill&&"string"!==r.fill&&(null===(n=null===(o=r.fill)||void 0===o?void 0:o.type)||void 0===n?void 0:n.includes("gradient"))&&(T=Object.assign(Object.assign({},E),{detail:Object.assign(Object.assign({},E.detail),{background:r.fill,clipPath:{commands:r.commands,originX:l,originY:a,originW:s,originH:h}})}),P.detail=Object.assign({},T.detail)),vt(e,{x:g,y:v,w:m,h:y,angle:p},(()=>{xi(e,T,{originElem:P,calcElemSize:{x:g,y:v,w:m,h:y,angle:p},viewScaleInfo:d,viewSizeInfo:u,parentOpacity:f,renderContent:()=>{Ai(e,E,{viewScaleInfo:d,renderContent:()=>{e.save(),e.translate(S,b),e.scale(C*w/d.scale,C*x/d.scale);const t=Ht(r.commands||[]),i=new Path2D(t);r.fill&&("string"==typeof r.fill?e.fillStyle=r.fill:e.fillStyle="transparent"),r.fill&&e.fill(i,c||"nonzero"),r.stroke&&0!==r.strokeWidth&&(e.strokeStyle=r.stroke,e.lineWidth=(r.strokeWidth||1)/u.devicePixelRatio,e.lineCap=r.strokeLineCap||"square",e.stroke(i)),e.translate(-S,-b),e.restore()}})}})}))}function zi(e,t,i){var o,n,r;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:l,h:a}=t,{scale:s}=i.viewScaleInfo;if(s<1&&(l*s<.4||a*s<.4)||0===i.parentOpacity)return;const{overrideElementMap:h}=i;if(!(null===(r=null===(n=null==h?void 0:h[t.uuid])||void 0===n?void 0:n.operations)||void 0===r?void 0:r.invisible))try{switch(t.type){case"rect":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt(t,{viewScaleInfo:o})||t,d=Object.assign(Object.assign({},t),{x:l,y:a,w:s,h:h,angle:c});vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{Ai(e,d,{viewScaleInfo:o,renderContent:()=>{xi(e,d,{originElem:t,calcElemSize:{x:l,y:a,w:s,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{viewScaleInfo:r,viewSizeInfo:l,parentOpacity:a}=i,{background:s="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:d=0,borderDash:u}=o;let f=0;"number"==typeof d&&d>0?f=d:Array.isArray(d)&&"number"==typeof d[0]&&d[0]>0&&(f=d[0]),f*=r.scale;const{x:g,y:v,w:m,h:y}=Wt({x:t.x,y:t.y,w:t.w,h:t.h},{viewScaleInfo:r})||t,p=Object.assign(Object.assign({},t),{x:g,y:v,w:m,h:y,angle:n});vt(e,{x:g,y:v,w:m,h:y,angle:n},(()=>{Ai(e,p,{viewScaleInfo:r,renderContent:()=>{let t=m/2,i=y/2;const o=g+t,n=v+i,l=t,d=i;if(f>0&&("content-box"===c||("center-line"===c?(t-=f/2,i-=f/2):(t-=f,i-=f))),t>=0&&i>=0){const c=wi(p)*a;e.globalAlpha=c,e.beginPath();const w=yi(e,s,{viewElementSize:{x:g,y:v,w:m,h:y},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=w,e.circle(o,n,l,d,0,0,2*Math.PI),e.closePath(),e.fill("nonzero"),e.globalAlpha=a,"number"==typeof f&&f>0){const l=f/2+t,a=f/2+i;if(e.beginPath(),u){const t=u.map((e=>e*r.scale));e.setLineDash(t)}e.strokeStyle=h,e.lineWidth=f,e.circle(o,n,l,a,0,0,2*Math.PI),e.closePath(),e.stroke(),e.setLineDash([])}}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r,calculator:l}=i,{x:a,y:s,w:h,h:c,angle:d}=Wt(t,{viewScaleInfo:o})||t,u=Object.assign(Object.assign({},t),{x:a,y:s,w:h,h:c,angle:d});vt(e,{x:a,y:s,w:h,h:c,angle:d},(()=>{var f,g;Ai(e,u,{viewScaleInfo:o,renderContent:()=>{xi(e,u,{originElem:t,calcElemSize:{x:a,y:s,w:h,h:c,angle:d},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r})}});{const n=Object.assign(Object.assign({},Ii),t.detail),r=(n.fontSize||Ii.fontSize)*o.scale;if(r<2)return;const{parentOpacity:h}=i,c=wi(t)*h;e.globalAlpha=c,e.fillStyle=t.detail.color||Ii.color,e.textBaseline="top",e.$setFont({fontWeight:n.fontWeight,fontSize:r,fontFamily:mi(n.fontFamily)});{const i=l.getVirtualFlatItem(t.uuid);Array.isArray(null==i?void 0:i.textLines)&&(null===(f=null==i?void 0:i.textLines)||void 0===f?void 0:f.length)>0&&(void 0!==n.textShadowColor&&be(n.textShadowColor)&&(e.shadowColor=n.textShadowColor),void 0!==n.textShadowOffsetX&&He.number(n.textShadowOffsetX)&&(e.shadowOffsetX=n.textShadowOffsetX),void 0!==n.textShadowOffsetY&&He.number(n.textShadowOffsetY)&&(e.shadowOffsetY=n.textShadowOffsetY),void 0!==n.textShadowBlur&&He.number(n.textShadowBlur)&&(e.shadowBlur=n.textShadowBlur),null===(g=null==i?void 0:i.textLines)||void 0===g||g.forEach((t=>{e.fillText(t.text,a+t.x*o.scale,s+t.y*o.scale)})))}e.globalAlpha=h}}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:r,parentOpacity:l}=i,{x:a,y:s,w:h,h:c,angle:d}=Wt(t,{viewScaleInfo:n})||t,u=Object.assign(Object.assign({},t),{x:a,y:s,w:h,h:c,angle:d});vt(e,{x:a,y:s,w:h,h:c,angle:d},(()=>{Ai(e,u,{viewScaleInfo:n,renderContent:()=>{xi(e,u,{originElem:t,calcElemSize:{x:a,y:s,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:r,parentOpacity:l,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=wi(t)*l;const{x:i,y:r,w:a,h:s,radiusList:h}=$t(u,{viewScaleInfo:n}),{detail:c}=t,{scaleMode:d,originW:f=0,originH:g=0}=c,v=e.$undoPixelRatio(f),m=e.$undoPixelRatio(g);if(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+h[0],r),e.arcTo(i+a,r,i+a,r+s,h[1]),e.arcTo(i+a,r+s,i,r+s,h[2]),e.arcTo(i,r+s,i,r,h[3]),e.arcTo(i,r,i+a,r,h[0]),e.closePath(),e.fill("nonzero"),e.clip("nonzero"),d&&g&&f){let n=0,l=0,h=v,c=m;const u=i,f=r,g=a,y=s;if(v>t.w||m>t.h)if("fill"===d){const e=Math.max(t.w/v,t.h/m),i=m*e;n=(v*e-t.w)/2/e,l=(i-t.h)/2/e,h=t.w/e,c=t.h/e}else if("tile"===d)n=0,l=0,h=t.w,c=t.h;else if("fit"===d){const e=Math.min(t.w/v,t.h/m);n=(v-t.w/e)/2,l=(m-t.h/e)/2,h=t.w/e,c=t.h/e}e.drawImage(o,n,l,h,c,u,f,g,y)}else e.drawImage(o,i,r,a,s);e.globalAlpha=l,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt(t,{viewScaleInfo:n})||t;vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=wi(t)*r,e.drawImage(o,l,a,s,h),e.globalAlpha=r)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt(t,{viewScaleInfo:n})||t;vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=wi(t)*r,e.drawImage(o,l,a,s,h),e.globalAlpha=r)}))}(e,t,i);break;case"path":Mi(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},{viewScaleInfo:o})||t,d=Object.assign(Object.assign({},t),{x:l,y:a,w:s,h:h,angle:c});vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{e.globalAlpha=wi(t)*r,Ai(e,d,{viewScaleInfo:o,renderContent:()=>{xi(e,d,{originElem:t,calcElemSize:{x:l,y:a,w:s,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r,renderContent:()=>{const{x:n,y:l,w:a,h:s,radiusList:h}=$t(d,{viewScaleInfo:o});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(n+h[0],l),e.arcTo(n+a,l,n+a,l+s,h[1]),e.arcTo(n+a,l+s,n,l+s,h[2]),e.arcTo(n,l+s,n,l,h[3]),e.arcTo(n,l,n+a,l,h[0]),e.closePath(),e.fill("nonzero"),e.clip("nonzero")),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:l}=i;for(let o=0;o<t.detail.children.length;o++){let a=t.detail.children[o];if(a=Object.assign(Object.assign({},a),{x:n.x+a.x,y:n.y+a.y}),!0===i.forceDrawAll||(null==l?void 0:l.needRender(a)))try{zi(e,a,Object.assign(Object.assign({},i),{parentOpacity:r*wi(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=r}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const Ri={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 Ci(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:r}=i;for(let t=0;t<n.length;t++){const l=n[t],a=Object.assign(Object.assign({},l),{detail:Object.assign(Object.assign({},Ri),null==l?void 0:l.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.needRender(a)))try{zi(e,a,Object.assign(Object.assign({},i),{parentOpacity:r}))}catch(e){console.error(e)}}}var Ei,Ti,Pi,Li,Oi,ki,Wi,Di,ji,Yi,Ni,Bi,Fi=function(e,t,i,o){return new(i||(i=Promise))((function(n,r){function l(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,a)}s((o=o.apply(e,t||[])).next())}))},Gi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},Vi=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const Xi=["image","svg","html"],Hi=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?Re(n)?n:ze(n,e.uuid):ze(`${Ie()}-${e.uuid}-${Ie()}-${Ie()}`,e.uuid)};class Zi extends tt{constructor(){super(),Ei.add(this),Ti.set(this,{}),Pi.set(this,{}),Li.set(this,{}),Oi.set(this,!1),Gi(this,Ei,"m",ki).call(this,"image",((e,t)=>Fi(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield Oe(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Gi(this,Ei,"m",ki).call(this,"html",((e,t)=>Fi(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield We(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Gi(this,Ei,"m",ki).call(this,"svg",((e,t)=>Fi(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield ke(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return Gi(this,Oi,"f")}reset(){!0!==Gi(this,Oi,"f")&&(Vi(this,Pi,{},"f"),Vi(this,Li,{},"f"))}resetElementAsset(e){var t,i,o;if(Xi.includes(e.type)){let n=null,r=null;"image"===e.type&&"string"==typeof(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)?r=e.detail.src:"svg"===e.type&&"string"==typeof(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)?r=e.detail.svg:"html"===e.type&&"string"==typeof(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)&&(r=e.detail.html),"string"==typeof r&&(this.load(e,{}),Re(r)?n=r:e.uuid&&(n=ze(r,e.uuid))),n&&Re(n)&&(delete Gi(this,Li,"f")[n],delete Gi(this,Pi,"f")[n])}}destroy(){Vi(this,Oi,!0,"f"),this.clear(),Vi(this,Ti,null,"f"),Vi(this,Pi,null,"f"),Vi(this,Li,null,"f")}load(e,t){!0!==Gi(this,Oi,"f")&&(Gi(this,Ei,"m",Bi).call(this,e)||Xi.includes(e.type)&&Gi(this,Ei,"m",Ni).call(this,e,t))}getContent(e){var t,i;const o=Hi(e);return(null===(i=null===(t=Gi(this,Li,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Gi(this,Li,"f")}setLoadItemMap(e){Vi(this,Li,e,"f")}}Ti=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Oi=new WeakMap,Ei=new WeakSet,ki=function(e,t){Gi(this,Ti,"f")[e]=t},Wi=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},Di=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Gi(this,Ei,"m",Wi).call(this,e)}},ji=function(e){const t=Hi(e.element),i=Gi(this,Li,"f")[t];Gi(this,Oi,"f")||(i?i.startTime<e.startTime&&(Gi(this,Li,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Gi(this,Li,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},Yi=function(e){var t;const i=Hi(e.element),o=null===(t=Gi(this,Li,"f"))||void 0===t?void 0:t[i];Gi(this,Oi,"f")||(o?o.startTime<e.startTime&&(Gi(this,Li,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Gi(this,Li,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},Ni=function(e,t){const i=Gi(this,Ei,"m",Di).call(this,e),o=Hi(e);if(Gi(this,Pi,"f")[o])return;Gi(this,Pi,"f")[o]=i;const n=Gi(this,Ti,"f")[e.type];"function"!=typeof n||Gi(this,Oi,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{Gi(this,Oi,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",Gi(this,Ei,"m",ji).call(this,i))})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,Gi(this,Ei,"m",Yi).call(this,i)})))},Bi=function(e){var t;const i=Hi(e),o=null===(t=Gi(this,Pi,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==Gi(this,Ei,"m",Wi).call(this,e))};const Qi={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 Ui(e,t){const{w:i,h:o}=e,n=t.tempContext,r=[],l=Object.assign(Object.assign({},Qi),e.detail),a=l.fontSize||Qi.fontSize,s=a;if(s<2)return{};const h=l.lineHeight||a;n.textBaseline="top",n.$setFont({fontWeight:l.fontWeight,fontSize:s,fontFamily:mi(l.fontFamily)});let c=l.text.replace(/\r\n/gi,"\n");"lowercase"===l.textTransform?c=c.toLowerCase():"uppercase"===l.textTransform&&(c=c.toUpperCase());const d=h,u=c.split("\n");let f=0;u.forEach(((e,t)=>{if("maxContent"===l.minInlineSize)r.push({x:0,y:0,text:e,width:n.$undoPixelRatio(n.measureText(e).width)});else{let h="",c="",g=e.split(c);if("normal"===l.wordBreak){c=" ";const t=e.split(c);g=[],t.forEach(((e,i)=>{g.push(e),i<t.length-1&&g.push(c)}))}if(1===g.length&&"visible"===l.overflow)r.push({x:0,y:0,text:g[0],width:n.$undoPixelRatio(n.measureText(g[0]).width)});else if(g.length>0){for(let e=0;e<g.length&&(a=n.$doPixelRatio(i),s=n.measureText(h+g[e]).width,a>=s?h+=g[e]||"":(r.push({x:0,y:0,text:h,width:n.$undoPixelRatio(n.measureText(h).width)}),h=g[e]||"",f++),!((f+1)*d>o&&"hidden"===l.overflow));e++)if(g.length-1===e&&(f+1)*d<=o){r.push({x:0,y:0,text:h,width:n.$undoPixelRatio(n.measureText(h).width)}),t<u.length-1&&f++;break}}else r.push({x:0,y:0,text:"",width:0})}var a,s}));let g=0,v=0;d>s&&(v=(d-s)/2),r.length*d<o&&("top"===l.verticalAlign?g=0:"bottom"===l.verticalAlign?g+=o-r.length*d:g+=(o-r.length*d)/2);{const e=0+g;r.forEach(((t,o)=>{let n=0;"center"===l.textAlign?n=0+(i-t.width)/2:"right"===l.textAlign&&(n=i-t.width+0),r[o].x=n,r[o].y=e+d*o+v}))}return{textLines:r}}function $i(e,t){let i={};return"text"===e.type&&(i=Ui(e,t)),i}function Ji(e,t){const{viewScaleInfo:i,viewSizeInfo:o,tempContext:n}=t,r=function(e,t){const i={},o=[],n=r=>{const l={type:r.type,isVisibleInView:!0,position:[...o]};let a=null;a=Bt(r,{groupQueue:Rt(e,o)||[]});const s=Object.assign(Object.assign(Object.assign({},l),{originRectInfo:a,rangeRectInfo:He.angle(r.angle)?Ft(a):a}),$i(r,t));i[r.uuid]=s,"group"===r.type&&r.detail.children.forEach(((e,t)=>{o.push(t),n(e),o.pop()}))};return e.forEach(((e,t)=>{o.push(t),n(e),o.pop()})),i}(e,{tempContext:n});return Ki(r,{viewScaleInfo:i,viewSizeInfo:o})}function Ki(e,t){const i=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n,offsetLeft:r}=t,{width:l,height:a}=i,s=0-r/o,h=0-n/o,c=l/o,d=a/o,u=mt({x:s,y:h,w:c,h:d}),f={x:s,y:h},g={x:s+c,y:h},v={x:s,y:h+d},m={x:s+c,y:h+d},y={x:s,y:u.y},p={x:u.x,y:h},w={x:s+c,y:u.y},x={x:u.x,y:h+d};return{center:u,topLeft:f,topRight:g,bottomLeft:v,bottomRight:m,left:y,top:p,right:w,bottom:x}}(t);let o=0,n=0;return Object.keys(e).forEach((t=>{const r=e[t];r.isVisibleInView=function(e,t){const i=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),o=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),r=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),l=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),a=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),s=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),h=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y);return i<=a&&o>=l&&n<=h&&r>=s||a<=r&&a>=r&&a<=r&&a>=r}(r.rangeRectInfo,i),r.isVisibleInView?o++:n++})),{virtualFlatItemMap:e,visibleCount:o,invisibleCount:n}}var qi,_i,eo=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},to=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class io{constructor(e){qi.set(this,void 0),_i.set(this,void 0),eo(this,qi,e,"f"),eo(this,_i,new ct({defaultStorage:{virtualFlatItemMap:{},visibleCount:0,invisibleCount:0}}),"f")}toGridNum(e,t){return!0===(null==t?void 0:t.ignore)?e:Math.round(e)}destroy(){eo(this,qi,null,"f")}needRender(e){const t=to(this,_i,"f").get("virtualFlatItemMap")[e.uuid];return!t||t.isVisibleInView}getPointElement(e,t){const i=to(this,qi,"f").tempContext;return function(e,t){var i,o,n;const{context2d:r,data:l,viewScaleInfo:a,viewSizeInfo:s,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,l=0,s=0;for(let e=0;e<=t;e++)n+=h[e].x,l+=h[e].y,s+=h[e].angle||0;const d=h[t];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===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(Yt(e,{context2d:r,element:{x:n+u.x,y:l+u.y,w:u.w,h:u.h,angle:s+(u.angle||0)},viewScaleInfo:a})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=l.elements.length-1;t>=0;t--){const i=l.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&Yt(e,{context2d:r,element:i,viewScaleInfo:a})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}resetVirtualFlatItemMap(e,t){if(e){const{virtualFlatItemMap:i,invisibleCount:o,visibleCount:n}=Ji(e.elements,Object.assign(Object.assign({},t),{tempContext:to(this,qi,"f").tempContext}));to(this,_i,"f").set("virtualFlatItemMap",i),to(this,_i,"f").set("invisibleCount",o),to(this,_i,"f").set("visibleCount",n)}}updateVisiableStatus(e){const{virtualFlatItemMap:t,invisibleCount:i,visibleCount:o}=Ki(to(this,_i,"f").get("virtualFlatItemMap"),e);to(this,_i,"f").set("virtualFlatItemMap",t),to(this,_i,"f").set("invisibleCount",i),to(this,_i,"f").set("visibleCount",o)}calcViewRectInfoFromOrigin(e,t){const i=to(this,_i,"f").get("virtualFlatItemMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:r}=t,{center:l,left:a,right:s,bottom:h,top:c,topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=i.originRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n};return{center:Dt(l,v),left:Dt(a,v),right:Dt(s,v),bottom:Dt(h,v),top:Dt(c,v),topLeft:Dt(d,v),topRight:Dt(u,v),bottomLeft:Dt(f,v),bottomRight:Dt(g,v)}}calcViewRectInfoFromRange(e,t){const i=to(this,_i,"f").get("virtualFlatItemMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:r}=t,{center:l,left:a,right:s,bottom:h,top:c,topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=i.rangeRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n};return{center:Dt(l,v),left:Dt(a,v),right:Dt(s,v),bottom:Dt(h,v),top:Dt(c,v),topLeft:Dt(d,v),topRight:Dt(u,v),bottomLeft:Dt(f,v),bottomRight:Dt(g,v)}}modifyText(e){const t=to(this,_i,"f").get("virtualFlatItemMap"),i=t[e.uuid];if(e&&"text"===e.type){const o=Object.assign(Object.assign({},i),Ui(e,{tempContext:to(this,qi,"f").tempContext}));t[e.uuid]=o,to(this,_i,"f").set("virtualFlatItemMap",t)}}modifyVirtualFlatItemMap(e,t){const{modifyInfo:i,viewScaleInfo:o,viewSizeInfo:n}=t,{type:r,content:l}=i,a=e.elements,s=to(this,_i,"f").get("virtualFlatItemMap");if("deleteElement"===r){const{element:e}=l,t=[],i=e=>{t.push(e.uuid),"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{i(e)}))};i(e),t.forEach((e=>{delete s[e]})),to(this,_i,"f").set("virtualFlatItemMap",s)}else if("addElement"===r||"updateElement"===r){const{position:t}=l,i=Et(t,e.elements),h=Rt(a,t);if(i)if("updateElement"===r&&"group"===i.type)this.resetVirtualFlatItemMap(e,{viewScaleInfo:o,viewSizeInfo:n});else{const e=Bt(i,{groupQueue:h||[]}),l=Object.assign({type:i.type,originRectInfo:e,rangeRectInfo:He.angle(i.angle)?Ft(e):e,isVisibleInView:!0,position:[...t]},$i(i,{tempContext:to(this,qi,"f").tempContext}));s[i.uuid]=l,to(this,_i,"f").set("virtualFlatItemMap",s),"updateElement"===r&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:n})}}else"moveElement"===r&&this.resetVirtualFlatItemMap(e,{viewScaleInfo:o,viewSizeInfo:n})}getVirtualFlatItem(e){return to(this,_i,"f").get("virtualFlatItemMap")[e]||null}}qi=new WeakMap,_i=new WeakMap;var oo,no,ro,lo,ao,so,ho=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},co=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class uo extends tt{constructor(e){super(),oo.add(this),no.set(this,void 0),ro.set(this,new Zi),lo.set(this,void 0),ao.set(this,!1),ho(this,no,e,"f"),ho(this,lo,new io({tempContext:e.tempContext}),"f"),co(this,oo,"m",so).call(this)}isDestroyed(){return co(this,ao,"f")}destroy(){this.clear(),ho(this,no,null,"f"),co(this,ro,"f").destroy(),ho(this,ro,null,"f"),ho(this,ao,!0,"f")}updateOptions(e){ho(this,no,e,"f")}drawData(e,t){const i=co(this,ro,"f"),o=co(this,lo,"f"),{sharer:n}=co(this,no,"f"),r=co(this,no,"f").viewContext;r.clearRect(0,0,r.canvas.width,r.canvas.height);const l={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height};!0===t.forceDrawAll&&co(this,lo,"f").resetVirtualFlatItemMap(e,{viewScaleInfo:t.viewScaleInfo,viewSizeInfo:t.viewSizeInfo});const a=Object.assign({loader:i,calculator:o,parentElementSize:l,elementAssets:e.assets,parentOpacity:1,overrideElementMap:null==n?void 0:n.getActiveOverrideElemenentMap()},t);!function(e,t,i){if("string"==typeof(null==t?void 0:t.background)){const{viewSizeInfo:o}=i,{width:n,height:r}=o;e.globalAlpha=1,e.fillStyle=t.background,e.fillRect(0,0,n,r)}}(r,e.global,a),e.layout?function(e,t,i,o){const{viewScaleInfo:n,viewSizeInfo:r,parentOpacity:l}=i,a=Object.assign({uuid:"layout",type:"group"},t),{x:s,y:h,w:c,h:d}=Wt(a,{viewScaleInfo:n})||a,u=Object.assign(Object.assign({},a),{x:s,y:h,w:c,h:d,angle:0});if(e.globalAlpha=1,Ai(e,u,{viewScaleInfo:n,renderContent:()=>{Si(e,u,{viewScaleInfo:n,viewSizeInfo:r})}}),"hidden"===t.detail.overflow){const{viewScaleInfo:o,viewSizeInfo:n}=i,r=Object.assign({uuid:"layout",type:"group"},t),l=Wt(r,{viewScaleInfo:o})||r,a=Object.assign(Object.assign({},r),l),{x:s,y:h,w:c,h:d,radiusList:u}=$t(a,{viewScaleInfo:o});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(s+u[0],h),e.arcTo(s+c,h,s+c,h+d,u[1]),e.arcTo(s+c,h+d,s,h+d,u[2]),e.arcTo(s,h+d,s,h,u[3]),e.arcTo(s,h,s+c,h,u[0]),e.closePath(),e.fill("nonzero"),e.clip("nonzero")}o(e),"hidden"===t.detail.overflow&&e.restore(),bi(e,u,{viewScaleInfo:n}),e.globalAlpha=l}(r,e.layout,a,(()=>{Ci(r,e,a)})):Ci(r,e,a)}scale(e){const{sharer:t}=co(this,no,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:r,offsetRight:l,width:a,height:s,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:r,offsetRight:l},viewSizeInfo:{width:a,height:s,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){co(this,ro,"f").setLoadItemMap(e)}getLoadItemMap(){return co(this,ro,"f").getLoadItemMap()}getLoader(){return co(this,ro,"f")}getCalculator(){return co(this,lo,"f")}}function fo(e){return e>0||e<0||0===e}no=new WeakMap,ro=new WeakMap,lo=new WeakMap,ao=new WeakMap,oo=new WeakSet,so=function(){const e=co(this,ro,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};class go extends tt{constructor(e){super(),we(this,n),we(this,t),we(this,i),we(this,o,!1),we(this,l,(e=>{if(!Se(this,n,g).call(this,e))return;const t=Se(this,n,v).call(this,e);if(!Se(this,n,m).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),we(this,a,(e=>{if(2!==e.button)return;if(!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)&&this.trigger("contextMenu",{point:t})})),we(this,s,(e=>{if(!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);if(!Se(this,n,m).call(this,t))return;const o=Date.now(),r=pe(this,i).get("prevClickPoint");r&&o-r.t<=500&&Math.abs(r.x-t.x)<=5&&Math.abs(r.y-t.y)<=5?this.trigger("doubleClick",{point:t}):pe(this,i).set("prevClickPoint",t)})),we(this,h,(e=>{pe(this,i).set("hasPointDown",!1),e.preventDefault();const t=Se(this,n,v).call(this,e);this.trigger("pointLeave",{point:t})})),we(this,c,(e=>{if(pe(this,i).set("hasPointDown",!1),!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);this.trigger("pointEnd",{point:t})})),we(this,d,(e=>{if(!Se(this,n,g).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)?!0===pe(this,i).get("hasPointDown")&&this.trigger("pointMove",{point:t}):pe(this,i).get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),pe(this,i).set("hasPointDown",!1))})),we(this,u,(e=>{if(0!==e.button)return;if(!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)&&(pe(this,i).set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),we(this,f,(e=>{if(!Se(this,n,g).call(this,e))return void(!0===pe(this,i).get("inCanvas")&&(pe(this,i).set("inCanvas",!1),pe(this,h).call(this,e)));pe(this,i).set("inCanvas",!0),e.preventDefault();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)&&this.trigger("hover",{point:t})}));const y=new ct({defaultStorage:{hasPointDown:!1,prevClickPoint:null,inCanvas:!0}});xe(this,i,y),xe(this,t,e),Se(this,n,r).call(this)}onEvents(){if(pe(this,o))return;const e=pe(this,t).boardContent.boardContext.canvas,i=window;i.addEventListener("mousemove",pe(this,f)),i.addEventListener("mousedown",pe(this,u)),i.addEventListener("mousemove",pe(this,d)),i.addEventListener("mouseup",pe(this,c)),e.addEventListener("wheel",pe(this,l),{passive:!1}),i.addEventListener("click",pe(this,s)),i.addEventListener("contextmenu",pe(this,a))}offEvents(){const e=window,i=pe(this,t).boardContent.boardContext.canvas;e.removeEventListener("mousemove",pe(this,f)),e.removeEventListener("mousedown",pe(this,u)),e.removeEventListener("mousemove",pe(this,d)),e.removeEventListener("mouseup",pe(this,c)),e.removeEventListener("mouseleave",pe(this,h)),i.removeEventListener("wheel",pe(this,l)),e.removeEventListener("click",pe(this,s)),e.removeEventListener("contextmenu",pe(this,a))}destroy(){this.offEvents(),pe(this,i).destroy(),xe(this,o,!0)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakSet,r=function(){this.onEvents()},l=new WeakMap,a=new WeakMap,s=new WeakMap,h=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,f=new WeakMap,g=function(e){return e.target===pe(this,t).boardContent.boardContext.canvas},v=function(e){const i=pe(this,t).boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top,t:Date.now()}},m=function(e){const i=pe(this,t).sharer.getActiveViewSizeInfo(),{width:o,height:n}=i;return!!(fo(e.x)&&fo(e.y)&&e.x<=o&&e.y<=n)};const vo={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 mo{constructor(){we(this,y),we(this,p);const e=new ct({defaultStorage:vo}),t=new ct({defaultStorage:{}});xe(this,y,e),xe(this,p,t)}getActiveStorage(e){return pe(this,y).get(e)}setActiveStorage(e,t){return pe(this,y).set(e,t)}getActiveStoreSnapshot(e){return pe(this,y).getSnapshot(e)}getSharedStorage(e){return pe(this,p).get(e)}setSharedStorage(e,t){return pe(this,p).set(e,t)}getSharedStoreSnapshot(e){return pe(this,p).getSnapshot(e)}getActiveViewScaleInfo(){return{scale:pe(this,y).get("scale"),offsetTop:pe(this,y).get("offsetTop"),offsetBottom:pe(this,y).get("offsetBottom"),offsetLeft:pe(this,y).get("offsetLeft"),offsetRight:pe(this,y).get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:r}=e;pe(this,y).set("scale",t),pe(this,y).set("offsetTop",i),pe(this,y).set("offsetBottom",o),pe(this,y).set("offsetLeft",n),pe(this,y).set("offsetRight",r)}setActiveViewSizeInfo(e){pe(this,y).set("width",e.width),pe(this,y).set("height",e.height),pe(this,y).set("devicePixelRatio",e.devicePixelRatio),pe(this,y).set("contextWidth",e.contextWidth),pe(this,y).set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:pe(this,y).get("width"),height:pe(this,y).get("height"),devicePixelRatio:pe(this,y).get("devicePixelRatio"),contextWidth:pe(this,y).get("contextWidth"),contextHeight:pe(this,y).get("contextHeight")}}getActiveOverrideElemenentMap(){return pe(this,y).get("overrideElementMap")}setActiveOverrideElemenentMap(e){pe(this,y).set("overrideElementMap",e)}}y=new WeakMap,p=new WeakMap;const{requestAnimationFrame:yo}=window;class po extends tt{constructor(e){super(),we(this,b),we(this,w),we(this,x,[]),we(this,S,"FREE"),xe(this,w,e),Se(this,b,A).call(this)}resetVirtualFlatItemMap(e,t){e&&pe(this,w).calculator.resetVirtualFlatItemMap(e,t)}drawFrame(){const{sharer:e}=pe(this,w),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();pe(this,x).push({activeStore:t,sharedStore:i}),Se(this,b,I).call(this)}scale(e){const{scale:t,point:i,ignoreUpdateVisibleStatus:o}=e,{sharer:n}=pe(this,w),{moveX:r,moveY:l}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:r}=o,l=t/o.scale,a=i.x,s=i.y;return{moveX:a-a*l+(n*l-n),moveY:s-s*l+(r*l-r)}}({scale:t,point:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});return n.setActiveStorage("scale",t),o||pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),{moveX:r,moveY:l}}scroll(e){const{sharer:t}=pe(this,w),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n,ignoreUpdateVisibleStatus:r}=e,l=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:r}=o,{width:l,height:a,contextWidth:s,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,u=o.offsetTop,f=o.offsetBottom;return c+=t,u+=i,d=l-(s*r+c),f=a-(h*r+u),{scale:r,offsetTop:u,offsetLeft:c,offsetRight:d,offsetBottom:f}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(l),r||pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),l}updateViewScaleInfo(e){const{sharer:t}=pe(this,w),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:r}=t,{width:l,height:a,contextWidth:s,contextHeight:h}=r,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:l-(s*i+c/i),offsetBottom:a-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),i}resize(e={},t){const{sharer:i}=pe(this,w),o={...i.getActiveViewSizeInfo(),...e},{width:n,height:r,devicePixelRatio:l}=o,{underlayContext:a,boardContext:s,overlayContext:h,viewContext:c}=pe(this,w).boardContent;return s.canvas.width=n*l,s.canvas.height=r*l,s.canvas.style.width=`${n}px`,s.canvas.style.height=`${r}px`,a.canvas.width=n*l,a.canvas.height=r*l,h.canvas.width=n*l,h.canvas.height=r*l,c.canvas.width=n*l,c.canvas.height=r*l,i.setActiveViewSizeInfo(o),(null==t?void 0:t.ignoreUpdateVisibleStatus)||pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),o}}w=new WeakMap,x=new WeakMap,S=new WeakMap,b=new WeakSet,A=function(){const{renderer:e}=pe(this,w);e.on("load",(()=>{this.drawFrame()}))},I=function(){if("DRAWING"===pe(this,S)||0===pe(this,x).length)return;xe(this,S,"DRAWING");const e=pe(this,x).shift(),{renderer:t,boardContent:i,beforeDrawFrame:o,afterDrawFrame:n}=pe(this,w);if(e){const{scale:r,offsetTop:l,offsetBottom:a,offsetLeft:s,offsetRight:h,width:c,height:d,contextHeight:u,contextWidth:f,devicePixelRatio:g}=e.activeStore,v={scale:r,offsetTop:l,offsetBottom:a,offsetLeft:s,offsetRight:h},m={width:c,height:d,contextHeight:u,contextWidth:f,devicePixelRatio:g};(null==e?void 0:e.activeStore.data)&&t.drawData(e.activeStore.data,{viewScaleInfo:v,viewSizeInfo:m}),o({snapshot:e}),i.drawView(),n({snapshot:e})}0!==pe(this,x).length?"DRAWING"===pe(this,S)&&yo((()=>{Se(this,b,I).call(this)})):xe(this,S,"COMPLETE")};class wo{constructor(e){we(this,W),we(this,M),we(this,z,new Map),we(this,R,[]),we(this,C),we(this,E),we(this,T),we(this,P),we(this,L),we(this,O,new tt),we(this,k,!1);const{boardContent:t}=e,i=new mo,o=new go({boardContent:t,sharer:i}),n=new uo({viewContext:t.viewContext,tempContext:t.tempContext,sharer:i}),r=n.getCalculator();xe(this,M,e),xe(this,T,i),xe(this,C,o),xe(this,E,n),xe(this,L,r),xe(this,P,new po({boardContent:e.boardContent,sharer:i,renderer:n,calculator:pe(this,L),beforeDrawFrame:e=>{Se(this,W,J).call(this,e)},afterDrawFrame:e=>{Se(this,W,K).call(this,e)}})),Se(this,W,D).call(this),Se(this,W,q).call(this)}isDestroyed(){return pe(this,k)}destroy(){pe(this,C).destroy(),pe(this,E).destroy(),pe(this,L).destroy(),pe(this,O).destroy(),xe(this,k,!0)}getSharer(){return pe(this,T)}getViewer(){return pe(this,P)}getRenderer(){return pe(this,E)}setData(e){const t=pe(this,T);pe(this,T).setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=t.getActiveViewScaleInfo(),n=zt(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});pe(this,P).resetVirtualFlatItemMap(e,{viewSizeInfo:i,viewScaleInfo:o}),pe(this,P).drawFrame();const r={...i,...n};return pe(this,T).setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:e}=pe(this,T).getActiveStoreSnapshot();return e}use(e,t){var i,o,n;if(pe(this,z).has(e)){const t=pe(this,z).get(e);return void(t&&"enable"!==t.status&&(t.status="enable",null==(o=(i=t.middlewareObject).use)||o.call(i),Se(this,W,q).call(this)))}const{boardContent:r,container:l}=pe(this,M),a=e({boardContent:r,sharer:pe(this,T),viewer:pe(this,P),calculator:pe(this,L),eventHub:pe(this,O),container:l},t);null==(n=a.use)||n.call(a),pe(this,z).set(e,{status:"enable",middlewareObject:a,config:t}),Se(this,W,q).call(this)}disuse(e){var t,i;if(pe(this,z).has(e)){const o=pe(this,z).get(e);o&&(null==(i=(t=o.middlewareObject).disuse)||i.call(t),o.status="disable"),pe(this,z).delete(e),Se(this,W,q).call(this)}}resetMiddlewareConfig(e,t){var i,o;if(pe(this,z).has(e)){const n=pe(this,z).get(e);n&&(null==(o=(i=n.middlewareObject).resetConfig)||o.call(i,t))}}scale(e){const t=pe(this,P),{ignoreUpdateVisibleStatus:i}=e,{moveX:o,moveY:n}=t.scale({...e,ignoreUpdateVisibleStatus:!0});t.scroll({moveX:o,moveY:n,ignoreUpdateVisibleStatus:i})}scroll(e){return pe(this,P).scroll(e)}updateViewScaleInfo(e){return pe(this,P).updateViewScaleInfo(e)}resize(e,t){const i=pe(this,P).resize(e,t),{width:o,height:n,devicePixelRatio:r}=e,{boardContent:l}=pe(this,M);l.viewContext.$resize({width:o,height:n,devicePixelRatio:r}),l.overlayContext.$resize({width:o,height:n,devicePixelRatio:r}),l.boardContext.$resize({width:o,height:n,devicePixelRatio:r}),l.underlayContext.$resize({width:o,height:n,devicePixelRatio:r}),pe(this,P).drawFrame(),pe(this,C).trigger("resize",i),pe(this,T).setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=pe(this,M),{underlayContext:t,overlayContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),Se(this,W,$).call(this)}getEventHub(){return pe(this,O)}onWatcherEvents(){!0!==pe(this,M).disableWatcher&&pe(this,C).onEvents()}offWatcherEvents(){!0!==pe(this,M).disableWatcher&&pe(this,C).offEvents()}}M=new WeakMap,z=new WeakMap,R=new WeakMap,C=new WeakMap,E=new WeakMap,T=new WeakMap,P=new WeakMap,L=new WeakMap,O=new WeakMap,k=new WeakMap,W=new WeakSet,D=function(){!0!==pe(this,M).disableWatcher&&(pe(this,C).on("pointStart",Se(this,W,j).bind(this)),pe(this,C).on("pointEnd",Se(this,W,Y).bind(this)),pe(this,C).on("pointMove",Se(this,W,N).bind(this)),pe(this,C).on("pointLeave",Se(this,W,B).bind(this)),pe(this,C).on("hover",Se(this,W,F).bind(this)),pe(this,C).on("wheel",Se(this,W,X).bind(this)),pe(this,C).on("wheelScale",Se(this,W,H).bind(this)),pe(this,C).on("scrollX",Se(this,W,Z).bind(this)),pe(this,C).on("scrollY",Se(this,W,Q).bind(this)),pe(this,C).on("resize",Se(this,W,U).bind(this)),pe(this,C).on("doubleClick",Se(this,W,G).bind(this)),pe(this,C).on("contextMenu",Se(this,W,V).bind(this))),pe(this,E).on("load",(()=>{pe(this,O).trigger("loadResource")}))},j=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointStart)?void 0:t.call(o,e)))return}},Y=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointEnd)?void 0:t.call(o,e)))return}},N=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointMove)?void 0:t.call(o,e)))return}},B=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointLeave)?void 0:t.call(o,e)))return}},F=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.hover)?void 0:t.call(o,e)))return}},G=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.doubleClick)?void 0:t.call(o,e)))return}},V=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.contextMenu)?void 0:t.call(o,e)))return}},X=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.wheel)?void 0:t.call(o,e)))return}},H=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.wheelScale)?void 0:t.call(o,e)))return}},Z=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.scrollX)?void 0:t.call(o,e)))return}},Q=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.scrollY)?void 0:t.call(o,e)))return}},U=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.resize)?void 0:t.call(o,e)))return}},$=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.clear)?void 0:t.call(o,e)))return}},J=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.beforeDrawFrame)?void 0:t.call(o,e)))return}},K=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.afterDrawFrame)?void 0:t.call(o,e)))return}},q=function(){const e=[];for(const[t,i]of pe(this,z))"enable"===(null==i?void 0:i.status)&&(null==i?void 0:i.middlewareObject)&&e.push(i.middlewareObject);xe(this,R,e)};const xo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcm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v62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==",So="selectInGroup",bo={CURSOR:"cursor",CHANGE:"change",RULER:"ruler",SCALE:"scale",SELECT_LAYOUT:"selectLayout",SELECT:"select",CLEAR_SELECT:"clearSelect",TEXT_EDIT:"textEdit",TEXT_CHANGE:"textChange",CONTEXT_MENU:"contextMenu",SELECT_IN_GROUP:So,SNAP_TO_GRID:So},Ao={};Object.keys(bo).forEach((e=>{Object.defineProperty(Ao,e,{value:bo[e],writable:!1})}));class Io{constructor(e,t){we(this,ne),we(this,_),we(this,ee),we(this,te,null),we(this,ie,null),we(this,oe,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob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0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),xe(this,ee,e),xe(this,_,t.eventHub),Se(this,ne,re).call(this),Se(this,ne,le).call(this)}}function Mo(e){const{modifiedElement:t,beforeElement:i}=e,{uuid:o,...n}=t,r=qt(n);let l={};Object.keys(r).forEach((e=>{let t=ii(i,e);void 0===t&&/(borderRadius|borderWidth)\[[0-9]{1,}\]$/.test(e)&&(e=e.replace(/\[[0-9]{1,}\]$/,""),t=ii(i,e)),l[e]=t})),l=qt(l);return{type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:o,before:l,after:r}}}_=new WeakMap,ee=new WeakMap,te=new WeakMap,ie=new WeakMap,oe=new WeakMap,ne=new WeakSet,re=function(){const e=pe(this,_);Se(this,ne,ae).call(this,"default"),e.on(Ao.CURSOR,(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?Se(this,ne,ae).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?Se(this,ne,se).call(this,e):"drag-default"===e.type?Se(this,ne,ae).call(this,"drag-default"):"drag-active"===e.type?Se(this,ne,ae).call(this,"drag-active"):Se(this,ne,ae).call(this,"auto"):Se(this,ne,ae).call(this,"auto")}))},le=function(){Oe(xo).then((e=>{xe(this,ie,e)})).catch((e=>{console.error(e)}))},ae=function(e){if(pe(this,te)===e)return;xe(this,te,e);const t=pe(this,oe)[pe(this,te)]||pe(this,oe).auto;let i=0,o=0;(e.startsWith("rotate-")&&pe(this,oe)[pe(this,te)]||"rotate"===e)&&(i=10,o=10),pe(this,ee).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${i} ${o}, auto`},se=function(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=It((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=It(e.angle||0)})),i=It(i);const o=Se(this,ne,he).call(this,i);Se(this,ne,ae).call(this,o)},he=function(e){const t=`rotate-${e}`;if(!pe(this,oe)[t]){const i=pe(this,ie);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,l={x:n/2,y:r/2};o.width=n,o.height=r;const a=o.getContext("2d"),s=ft(e);a.translate(l.x,l.y),a.rotate(s),a.translate(-l.x,-l.y),a.drawImage(i,0,0,n,r),a.translate(l.x,l.y),a.rotate(-s),a.translate(-l.x,-l.y);const h=o.toDataURL("image/png");pe(this,oe)[t]=h}}return t};const zo="SELECT",Ro=Symbol(`${zo}_actionType`),Co=Symbol(`${zo}_resizeType`),Eo=Symbol(`${zo}_areaStart`),To=Symbol(`${zo}_areaEnd`),Po=Symbol(`${zo}_hoverElement`),Lo=Symbol(`${zo}_hoverElementVertexes`),Oo=Symbol(`${zo}_selectedElementList`),ko=Symbol(`${zo}_selectedElementListVertexes`),Wo=Symbol(`${zo}_selectedElementController`),Do=Symbol(`${zo}_selectedElementPosition`),jo=Symbol(`${zo}_groupQueue`),Yo=Symbol(`${zo}_groupQueueVertexesList`),No=Symbol(`${zo}_isMoving`),Bo=Symbol(`${zo}_enableSelectInGroup`),Fo=Symbol(`${zo}_enableSnapToGrid`),Go={activeColor:"#1973ba",activeAreaColor:"#1976d21c",lockedColor:"#5b5959b5",referenceColor:"#f7276e"};function Vo(e,t,i){const{borderColor:o,borderWidth:n,background:r,lineDash:l}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=r,e.setLineDash(l),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill("nonzero")}function Xo(e,t,i,o){const{borderColor:n,borderWidth:r,lineDash:l}=o;e.setLineDash([]),e.lineWidth=r,e.strokeStyle=n,e.setLineDash(l),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}function Ho(e,t,i){const{borderColor:o,borderWidth:n,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function Zo(e,t,i){const{size:o,borderColor:n,borderWidth:r,lineDash:l}=i,a=t.x-o/2,s=t.x+o/2,h=t.y-o/2,c=t.y+o/2;Ho(e,[{x:a,y:h},{x:s,y:h},{x:s,y:c},{x:a,y:c}],{borderColor:n,borderWidth:r,lineDash:l})}function Qo(e,t,i){if(!t)return;const{style:o}=i,{activeColor:n}=o,r={borderColor:n,borderWidth:1,background:"transparent",lineDash:[]};Vo(e,jt(t,i),r)}function Uo(e,t,i){if(!t)return;const{style:o}=i,{lockedColor:n}=o,r={borderColor:n,borderWidth:1,background:"transparent",lineDash:[]};Vo(e,jt(t,i),r);const{controller:l}=i;if(l){const{topLeft:t,topRight:o,bottomLeft:n,bottomRight:a,topMiddle:s,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=l,u={...r,borderWidth:1};Ho(e,jt(s.vertexes,i),u),Ho(e,jt(h.vertexes,i),u),Ho(e,jt(c.vertexes,i),u),Ho(e,jt(d.vertexes,i),u),Ho(e,jt(t.vertexes,i),u),Ho(e,jt(o.vertexes,i),u),Ho(e,jt(n.vertexes,i),u),Ho(e,jt(a.vertexes,i),u)}}function $o(e,t,i){var o;if(!t)return;const{hideControllers:n,style:r,rotateControllerPattern:l,viewSizeInfo:a,element:s}=i,{devicePixelRatio:h=1}=a,{activeColor:c}=r,{elementWrapper:d,topLeft:u,topRight:f,bottomLeft:g,bottomRight:v,rotate:m}=t,y={borderColor:c,borderWidth:2,background:"transparent",lineDash:[]},p={...y,borderWidth:4,background:"#FFFFFF"};if(Vo(e,jt(d,i),y),!n&&(Vo(e,jt(u.vertexes,i),p),Vo(e,jt(f.vertexes,i),p),Vo(e,jt(g.vertexes,i),p),Vo(e,jt(v.vertexes,i),p),!1!==(null==(o=null==s?void 0:s.operations)?void 0:o.rotatable))){!function(e,t,i){const{size:o,background:n}=i,r=t,l=o/2,a=l,s=l;a>=0&&s>=0&&(e.beginPath(),e.fillStyle=n,e.circle(r.x,r.y,a,s,0,0,2*Math.PI),e.closePath(),e.fill("nonzero"))}(e,Dt(m.center,i),{...p,size:m.size});const t=Dt(m.center,i);e.drawImage(l.canvas,0,0,l.canvas.width/h,l.canvas.height/h,t.x-m.size/2,t.y-m.size/2,m.size,m.size)}}function Jo(e,t){const{xLines:i,yLines:o,style:n}=t,{referenceColor:r}=n,l={borderColor:r,borderWidth:1,lineDash:[]},a={...l,size:6};i&&i.forEach((t=>{t.forEach(((i,o)=>{Zo(e,i,a),t[o+1]&&Xo(e,t[o],t[o+1],l)}))})),o&&o.forEach((t=>{t.forEach(((i,o)=>{Zo(e,i,a),t[o+1]&&Xo(e,t[o],t[o+1],l)}))}))}function Ko(e){return e*Math.PI/180}function qo(e,t){return Math.sqrt(e*e+t*t)}function _o(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function en(e,t){const{ctx:i,viewScaleInfo:o,vertexes:n}=t,r=Dt(n[0],{viewScaleInfo:o}),l=Dt(n[1],{viewScaleInfo:o}),a=Dt(n[2],{viewScaleInfo:o}),s=Dt(n[3],{viewScaleInfo:o});return i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(l.x,l.y),i.lineTo(a.x,a.y),i.lineTo(s.x,s.y),i.lineTo(r.x,r.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function tn(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:r}=t;if(!(r&&(null==r?void 0:r.length)>0))return!1;const l=Ot(r),a=l[l.length-1];return!!a&&en(e,{ctx:i,vertexes:a,viewScaleInfo:o})}function on(e,t){var i,o,n,r,l;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:s,data:h,calculator:c,selectedElements:d,viewScaleInfo:u,viewSizeInfo:f,areaSize:g,groupQueue:v,selectedElementController:m}=t;if(m){const{left:t,right:n,top:r,bottom:l,topLeft:h,topRight:c,bottomLeft:f,bottomRight:g,rotate:y}=m,p=[t,n,r,l,h,c,f,g];1===(null==d?void 0:d.length)&&!1!==(null==(o=null==(i=null==d?void 0:d[0])?void 0:i.operations)?void 0:o.rotatable)&&p.push(y);for(let t=0;t<p.length;t++){const i=p[t];if(en(e,{ctx:s,vertexes:i.vertexes,viewScaleInfo:u})){if(a.type=`resize-${i.type}`,d&&(null==d?void 0:d.length)>0)return a.groupQueue=v||[],a.elements=[d[0]],a;break}}}if(v&&Array.isArray(v)&&v.length>0){const t=v[v.length-1];if((null==(n=null==t?void 0:t.detail)?void 0:n.children)&&Array.isArray(null==(r=null==t?void 0:t.detail)?void 0:r.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=kt(o,{groupQueue:v});if(n&&en(e,{ctx:s,vertexes:n,viewScaleInfo:u}))return a.type||(a.type="over-element"),a.groupQueue=v,a.elements=[o],a}return a}if(null!==a.type)return a;if(g&&Array.isArray(d)&&(null==d?void 0:d.length)>1){const{x:t,y:i,w:o,h:n}=g;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=d,a}if(h){const{index:t,element:i}=c.getPointElement(e,{data:h,viewScaleInfo:u,viewSizeInfo:f});if(t>=0&&i&&!0!==(null==(l=null==i?void 0:i.operations)?void 0:l.invisible))return a.elements=[i],a.type="over-element",a}return a}function nn(e,t){const{x:i,y:o,w:n,h:r,angle:l=0}=e,{center:a,start:s,end:h,viewScaleInfo:c}=t,d=Dt(a,{viewScaleInfo:c}),u=It(l),f=function(e,t,i){const o=pt(e,t),n=pt(e,i);return null!==n&&null!==o?n-o:0}(d,s,h);return{x:i,y:o,w:n,h:r,angle:It(u+f/Math.PI*180)}}function rn(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{viewScaleInfo:n}=t;let r=null;for(let t=0;t<e.length;t++){const l=e[t];if(null==(i=null==l?void 0:l.operations)?void 0:i.invisible)continue;const a=Wt(l,{viewScaleInfo:n});if(a.angle&&(a.angle>0||a.angle<0)){const e=bt(a);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];a.x=Math.min(...t),a.y=Math.min(...i),a.w=Math.abs(Math.max(...t)-Math.min(...t)),a.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(r){const e=Math.min(a.x,o.x),t=Math.min(a.y,o.y),i=Math.max(a.x+a.w,o.x+o.w),n=Math.max(a.y+a.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=a.x,o.y=a.y,o.w=a.w,o.h=a.h;r=a}return o}function ln(e){return{minX:e.topLeft.x,minY:e.topLeft.y,maxX:e.bottomRight.x,maxY:e.bottomRight.y,midX:e.center.x,midY:e.center.y}}const an=(e,t)=>{if(0===e.length)throw null;if(1===e.length)return e[0];let i=0,o=e.length-1;for(;i<=o;){const n=Math.floor((i+o)/2);if(e[n]===t)return e[n];e[n]<t?i=n+1:o=n-1}return i>=e.length?e[o]:o<0?e[i]:Math.abs(e[o]-t)<=Math.abs(e[i]-t)?e[o]:e[i]},sn=(e,t)=>Math.abs(e-t)<1e-5;function hn(e,t){var i,o;const{data:n,groupQueue:r,calculator:l,viewScaleInfo:a,viewSizeInfo:s}=t;let h=n.elements||[];(null==r?void 0:r.length)>0&&(h=(null==(o=null==(i=r[r.length-1])?void 0:i.detail)?void 0:o.children)||[]);const c=[];h.forEach((t=>{if(t.uuid!==e){const e=l.calcViewRectInfoFromRange(t.uuid,{checkVisible:!0,viewScaleInfo:a,viewSizeInfo:s});e&&c.push(e)}}));const d=l.calcViewRectInfoFromRange(e,{viewScaleInfo:a,viewSizeInfo:s});if(!d)return null;const u={},f={},g=[],v=[];let m=[],y=[];const p=ln(d);c.forEach((e=>{const t=ln(e);u[t.minX]||(u[t.minX]=[]),u[t.midX]||(u[t.midX]=[]),u[t.maxX]||(u[t.maxX]=[]),f[t.minY]||(f[t.minY]=[]),f[t.midY]||(f[t.midY]=[]),f[t.maxY]||(f[t.maxY]=[]),u[t.minX]=[t.minY,t.midY,t.maxY],u[t.midX]=[t.minY,t.midY,t.maxY],u[t.maxX]=[t.minY,t.midY,t.maxY],m.push(t.minX),m.push(t.midX),m.push(t.maxX),f[t.minY]=[t.minX,t.midX,t.maxX],f[t.midY]=[t.minX,t.midX,t.maxX],f[t.maxY]=[t.minX,t.midX,t.maxX],y.push(t.minY),y.push(t.midY),y.push(t.maxY)})),m=m.sort(((e,t)=>e-t)),y=y.sort(((e,t)=>e-t));let w=null,x=null,S=null,b=null,A=null,I=null,M=null,z=null;if(m.length>0){S=an(m,p.minX),b=an(m,p.midX),A=an(m,p.maxX);const e=Math.abs(S-p.minX),t=Math.abs(b-p.midX),i=Math.abs(A-p.maxX),o=Math.min(e,t,i);o<=2/a.scale&&(sn(o,e)?w=S-p.minX:sn(o,t)?w=b-p.midX:sn(o,i)&&(w=A-p.maxX))}if(y.length>0){I=an(y,p.minY),M=an(y,p.midY),z=an(y,p.maxY);const e=Math.abs(I-p.minY),t=Math.abs(M-p.midY),i=Math.abs(z-p.maxY),o=Math.min(e,t,i);o<=2/a.scale&&(sn(o,e)?x=I-p.minY:sn(o,t)?x=M-p.midY:sn(o,i)&&(x=z-p.maxY))}const R={...p};if(null!==w&&(R.minX+=w,R.midX+=w,R.maxX+=w),null!==x&&(R.minY+=x,R.midY+=x,R.maxY+=x),He.x(w)&&null!==w&&null!==S&&null!==b&&null!==A){if(sn(w,S-p.minX)){const e={x:S,yList:[]};e.yList.push(R.minY),e.yList.push(R.maxY),e.yList.push(...(null==f?void 0:f[S])||[]),g.push(e)}if(sn(w,b-p.minX)){const e={x:b,yList:[]};e.yList.push(R.minY),e.yList.push(R.maxY),e.yList.push(...(null==f?void 0:f[b])||[]),g.push(e)}if(sn(w,A-p.minX)){const e={x:A,yList:[]};e.yList.push(R.minY),e.yList.push(R.maxY),e.yList.push(...(null==f?void 0:f[A])||[]),g.push(e)}}if(He.y(x)&&null!==x&&null!==I&&null!==M&&null!==z){if(sn(x,I-p.minY)){const e={y:I,xList:[]};e.xList.push(R.minX),e.xList.push(R.maxX),e.xList.push(...(null==u?void 0:u[I])||[]),v.push(e)}if(sn(x,M-p.midY)){const e={y:M,xList:[]};e.xList.push(R.minX),e.xList.push(R.maxX),e.xList.push(...(null==u?void 0:u[I])||[]),v.push(e)}if(sn(x,z-p.maxY)){const e={y:z,xList:[]};e.xList.push(R.minX),e.xList.push(R.maxX),e.xList.push(...(null==u?void 0:u[z])||[]),v.push(e)}}const C=[];(null==g?void 0:g.length)>0&&g.forEach(((e,t)=>{C.push([]),e.yList.forEach((i=>{C[t].push({x:e.x,y:i})}))}));const E=[];return(null==v?void 0:v.length)>0&&v.forEach(((e,t)=>{E.push([]),e.xList.forEach((i=>{E[t].push({x:i,y:e.y})}))})),{offsetX:w,offsetY:x,yLines:C,xLines:E}}const cn="LAYOUT_SELECT",dn=Symbol(`${cn}_layoutActionType`),un=Symbol(`${cn}_layoutControlType`),fn=Symbol(`${cn}_layoutController`),gn=Symbol(`${cn}_layoutIsHoverContent`),vn=Symbol(`${cn}_layoutIsHoverController`),mn=Symbol(`${cn}_layoutIsSelected`),yn=Symbol(`${cn}_layoutIsSelected`),pn={activeColor:"#b331c9"};function wn(e,t,i){const{activeColor:o}=i;e.setLineDash([]),e.fillStyle="#FFFFFF",e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.fill("nonzero"),e.strokeStyle=o,e.lineWidth=2,e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function xn(e,t){const{start:i,end:o,style:n}=t,{activeColor:r}=n,l=r;e.setLineDash([]),e.strokeStyle=l,e.lineWidth=2,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,o.y),e.closePath(),e.stroke()}function Sn(e){const{fill:t,devicePixelRatio:i}=e,o=(e=>({uuid:Ie(),type:"path",x:0,y:0,w:200,h:200,detail:{commands:[{type:"M",params:[512,0]},{type:"c",params:[282.8,0,512,229.2,512,512]},{type:"s",params:[-229.2,512,-512,512]},{type:"S",params:[0,794.8,0,512,229.2,0,512,0]},{type:"z",params:[]},{type:"m",params:[309.8,253.8]},{type:"c",params:[0,-10.5,-6.5,-19.8,-15.7,-23.8,-9.7,-4,-21,-2,-28.2,5.6]},{type:"l",params:[-52.5,52]},{type:"c",params:[-56.9,-53.7,-133.9,-85.5,-213.4,-85.5,-170.7,0,-309.8,139.2,-309.8,309.8,0,170.6,139.2,309.8,309.8,309.8,92.4,0,179.5,-40.8,238.4,-111.8,4,-5.2,4,-12.9,-.8,-17.3]},{type:"L",params:[694.3,637]},{type:"c",params:[-2.8,-2.4,-6.5,-3.6,-10.1,-3.6,-3.6,.4,-7.3,2,-9.3,4.8,-39.5,51.2,-98.8,80.3,-163,80.3,-113.8,0,-206.5,-92.8,-206.5,-206.5,0,-113.8,92.8,-206.5,206.5,-206.5,52.8,0,102.9,20.2,140.8,55.3]},{type:"L",params:[597,416.5]},{type:"c",params:[-7.7,7.3,-9.7,18.6,-5.6,27.9,4,9.7,13.3,16.1,23.8,16.1]},{type:"H",params:[796]},{type:"c",params:[14.1,0,25.8,-11.7,25.8,-25.8]},{type:"V",params:[253.8]},{type:"z",params:[]}],fill:"#2c2c2c",stroke:"transparent",strokeWidth:0,originX:0,originY:0,originW:1024,originH:1024,opacity:1,...e}}))({fill:t}),{w:n,h:r}=o,l=Ke({width:n,height:r,devicePixelRatio:i});return zi(l,o,{loader:void 0,viewScaleInfo:{scale:1,offsetTop:0,offsetBottom:0,offsetLeft:0,offsetRight:0},viewSizeInfo:{width:n,height:r,devicePixelRatio:i,contextWidth:n,contextHeight:r},parentElementSize:{x:0,y:0,w:n,h:r},parentOpacity:1}),{context2d:l,fill:t}}const bn="monospace";const An="@middleware/internal-event/show-info-angle",In={textBackground:"#1973bac6",textColor:"#ffffff"},Mn=10,zn="SCROLL",Rn=Symbol(`${zn}_xThumbRect`),Cn=Symbol(`${zn}_yThumbRect`),En=Symbol(`${zn}_hoverXThumbRect`),Tn=Symbol(`${zn}_hoverYThumbRect`),Pn=Symbol(`${zn}_prevPoint`),Ln=Symbol(`${zn}_activePoint`),On=Symbol(`${zn}_activeThumbType`),kn={thumbBackground:"#0000003A",thumbBorderColor:"#0000008A",hoverThumbBackground:"#0000005F",hoverThumbBorderColor:"#000000EE",activeThumbBackground:"#0000005E",activeThumbBorderColor:"#000000F0"};function Wn(e,t,i){const o=e,{x:n,y:r,w:l,h:a}=i;return o.beginPath(),o.rect(n,r,l,a),o.closePath(),!!o.isPointInPath(t.x,t.y)}function Dn(e,t){let{x:i,y:o,h:n,w:r}=t;const{background:l,borderColor:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+r/4+0,r/=2);let h=t.r;h=Math.min(h,r/2,n/2),(r<2*h||n<2*h)&&(h=0),e.globalAlpha=1,e.beginPath(),e.moveTo(i+h,o),e.arcTo(i+r,o,i+r,o+n,h),e.arcTo(i+r,o+n,i,o+n,h),e.arcTo(i,o+n,i,o,h),e.arcTo(i,o,i+r,o,h),e.closePath(),e.fillStyle=l,e.fill("nonzero"),e.beginPath(),e.lineWidth=1,e.strokeStyle=a,e.setLineDash([]),e.moveTo(i+h,o),e.arcTo(i+r,o,i+r,o+n,h),e.arcTo(i+r,o+n,i,o+n,h),e.arcTo(i,o+n,i,o,h),e.arcTo(i,o,i+r,o,h),e.closePath(),e.stroke()}e.restore()}function jn(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:r,style:l}=t,{activeThumbType:a,prevPoint:s,activePoint:h,hoverXThumb:c,hoverYThumb:d}=r,u=function(e){const{viewScaleInfo:t,viewSizeInfo:i,hoverXThumb:o,hoverYThumb:n,style:r}=e,{width:l,height:a}=i,{offsetTop:s,offsetBottom:h,offsetLeft:c,offsetRight:d}=t,u=16,{thumbBackground:f,thumbBorderColor:g,hoverThumbBackground:v,hoverThumbBorderColor:m}=r;let y=0,p=0;y=Math.max(40,l-32-(Math.abs(c)+Math.abs(d))),y>=l&&(y=l),p=Math.max(40,a-32-(Math.abs(s)+Math.abs(h))),p>=a&&(p=a);let w=16;c>0?w=16:d>0?w=l-y-u:c<=0&&y>0&&(0!==c||0!==d)&&(w=16+(l-y)*Math.abs(c)/(Math.abs(c)+Math.abs(d)),w=Math.min(Math.max(0,w-16),l-y));let x=16;return s>0?x=16:h>0?x=a-p-u:s<=0&&p>0&&(0!==s||0!==h)&&(x=16+(a-p)*Math.abs(s)/(Math.abs(s)+Math.abs(h)),x=Math.min(Math.max(0,x-16),a-p)),{lineSize:u,xSize:y,ySize:p,translateY:x,translateX:w,xThumbBackground:o?v:f,yThumbBackground:n?v:f,xThumbBorderColor:o?m:g,yThumbBorderColor:n?m:g,xThumbRect:{x:w,y:a-u,w:y,h:u},yThumbRect:{x:l-u,y:x,w:u,h:p}}}({viewScaleInfo:o,viewSizeInfo:n,hoverXThumb:c,hoverYThumb:d,style:l});let f={...u.xThumbRect},g={...u.yThumbRect};return a&&s&&h&&("X"===a&&r.xThumbRect?(f={...r.xThumbRect},f.x=f.x+(h.x-s.x)):"Y"===a&&r.yThumbRect&&(g={...r.yThumbRect},g.y=g.y+(h.y-s.y))),Dn(i,{axis:"X",...f,r:u.lineSize/2,background:u.xThumbBackground,borderColor:u.xThumbBorderColor}),Dn(i,{axis:"Y",...g,r:u.lineSize/2,background:u.yThumbBackground,borderColor:u.yThumbBorderColor}),{xThumbRect:f,yThumbRect:g}}function Yn(e,t){const{snapshot:i,style:o}=t,n=ut(i),r=dt(i),l=function(e){const{sharedStore:t}=e;return{activePoint:t[Ln]||null,prevPoint:t[Pn]||null,activeThumbType:t[On]||null,xThumbRect:t[Rn]||null,yThumbRect:t[Cn]||null,hoverXThumb:t[En],hoverYThumb:t[Tn]}}(i),{xThumbRect:a,yThumbRect:s}=jn(e,{viewSizeInfo:n,viewScaleInfo:r,scrollInfo:l,style:o});return{xThumbRect:a,yThumbRect:s}}const Nn=16,Bn="monospace",Fn={background:"#FFFFFFA8",borderColor:"#00000080",scaleColor:"#000000",textColor:"#00000080",gridColor:"#AAAAAA20",gridPrimaryColor:"#AAAAAA40",selectedAreaColor:"#19609780"},Gn=[1,2,5,10,20,50,100,200,500];function Vn(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let r=10;r=Zt(r/t,{decimalPlaces:0}),r=function(e){e=Math.max(Gn[0],Math.min(e,Gn[Gn.length-1]));for(let t=0;t<Gn.length-1;t++){const i=Gn[t],o=Gn[t+1];if(!(e>o))return e===i||e===o?e:e<=(i+o)/2?i:o}return e}(r);const l=10*r,a=5*r;let s=0;const h=r*t,c=0-o,d=c%h,u=(c-d+h)/t,f=h-d+0;for(;f+s*h<i;){const e=Zt(u+s*r,{decimalPlaces:0}),t={num:e,position:Zt(f+s*h,{decimalPlaces:0}),showNum:e%l==0,isKeyNum:e%l==0,isSubKeyNum:e%a==0};n.push(t),s++}return{list:n,rulerUnit:r}}const Xn={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"},Hn=Symbol("DRAG_prevPoint");return ce=new WeakMap,de=new WeakMap,ue=new WeakMap,fe=new WeakSet,ge=function(){pe(this,ue).style.position="relative"},ve=function(e){Mt((null==e?void 0:e.elements)||[]),pe(this,ce).setData(e)},e.Board=wo,e.Calculator=io,e.Core=class{constructor(e,t){we(this,fe),we(this,ce),we(this,de),we(this,ue);const{devicePixelRatio:i=1,width:o,height:n,disableWatcher:r=!1}=t;xe(this,ue,e);const l=document.createElement("canvas");l.setAttribute("tabindex","0"),xe(this,de,l),Se(this,fe,ge).call(this),e.appendChild(l);const a=qe(l,{width:o,height:n,devicePixelRatio:i}),s=new wo({boardContent:a,container:e,disableWatcher:r}),h=s.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),xe(this,ce,s),this.resize(h.getActiveViewSizeInfo());const c=s.getEventHub();new Io(e,{eventHub:c})}isDestroyed(){return pe(this,ce).isDestroyed()}destroy(){pe(this,ce).destroy(),pe(this,de).remove()}use(e,t){pe(this,ce).use(e,t)}disuse(e){pe(this,ce).disuse(e)}resetMiddlewareConfig(e,t){pe(this,ce).resetMiddlewareConfig(e,t)}setData(e){pe(this,ce).getRenderer().getLoader().reset(),Se(this,fe,ve).call(this,e)}getData(){return pe(this,ce).getData()}scale(e){pe(this,ce).scale(e);pe(this,ce).getViewer().drawFrame()}resize(e){const t=pe(this,ce),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){pe(this,ce).clear()}on(e,t){pe(this,ce).getEventHub().on(e,t)}off(e,t){pe(this,ce).getEventHub().off(e,t)}trigger(e,t){pe(this,ce).getEventHub().trigger(e,t)}getViewInfo(){const e=pe(this,ce).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){pe(this,ce).getViewer().drawFrame()}forceRender(){const e=pe(this,ce).getRenderer(),t=e.getCalculator(),i=e.getLoader(),o=this.getData();if(o){const{viewScaleInfo:e,viewSizeInfo:i}=this.getViewInfo();t.resetVirtualFlatItemMap(o,{viewScaleInfo:e,viewSizeInfo:i})}i.reset(),this.refresh()}setViewScale(e){pe(this,ce).updateViewScaleInfo(e)}getLoadItemMap(){return pe(this,ce).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){pe(this,ce).onWatcherEvents()}offBoardWatcherEvents(){pe(this,ce).offWatcherEvents()}createElement(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n}=this.getViewInfo();return hi(e,t||{},!0===(null==i?void 0:i.viewCenter)?{viewScaleInfo:o,viewSizeInfo:n}:void 0)}updateElement(e){const t=this.getData()||{elements:[]},i=e.uuid,o=Tt(i,t.elements),n=Et(o,t.elements);if(!n)return null;const r=qt(n),l=qt(gi(o,e,t.elements,{strict:!0}));pe(this,ce).getRenderer().getLoader().resetElementAsset(e),Se(this,fe,ve).call(this,t),this.refresh();return{type:"updateElement",time:Date.now(),content:{method:"updateElement",uuid:i,before:r,after:l}}}modifyElement(e){const{uuid:t,...i}=e,o=this.getData()||{elements:[]},n=Tt(t,o.elements),r=Et(n,o.elements);if(!r)return null;const l=Mo({modifiedElement:e,beforeElement:r});gi(n,i,o.elements);return pe(this,ce).getRenderer().getLoader().resetElementAsset({...e,type:r.type}),Se(this,fe,ve).call(this,o),this.refresh(),l}modifyElements(e){const t=this.getData()||{elements:[]};let i=null;const o=[],n=[];return e.forEach((e=>{const{uuid:i,...r}=e,l=Tt(i,t.elements),a=Et(l,t.elements);if(!a)return null;const s=Mo({modifiedElement:e,beforeElement:a});s.content&&(o.push({...s.content.before,uuid:i}),n.push({...s.content.after,uuid:i})),gi(l,r,t.elements)})),i={type:"modifyElements",time:Date.now(),content:{method:"modifyElements",before:o,after:n}},Se(this,fe,ve).call(this,t),this.refresh(),i}addElement(e,t){var i;const o=this.getData()||{elements:[]};if(t&&(null==(i=null==t?void 0:t.position)?void 0:i.length)){if(null==t?void 0:t.position){ci(e,[...(null==t?void 0:t.position)||[]],o.elements)}}else o.elements.push(e);const n=Tt(e.uuid,o.elements),r={type:"addElement",time:Date.now(),content:{method:"addElement",uuid:e.uuid,position:n,element:Ce(e)}};return Se(this,fe,ve).call(this,o),this.refresh(),r}deleteElement(e){const t=this.getData()||{elements:[]},i=Tt(e,t.elements),o=Et(i,t.elements),n={type:"deleteElement",time:Date.now(),content:{method:"deleteElement",uuid:e,position:i,element:o?Ce(o):null}};if(o){pe(this,ce).getRenderer().getLoader().resetElementAsset(o)}return function(e,t){di(Tt(e,t),t)}(e,t.elements),Se(this,fe,ve).call(this,t),this.refresh(),n}moveElement(e,t){const i=this.getData()||{elements:[]},o=Tt(e,i.elements),n={type:"moveElement",time:Date.now(),content:{method:"moveElement",uuid:e,from:[...o],to:[...t]}},{elements:r}=function(e,t){const i=[...t.from],o=[...t.to];if(0===i.length||0===o.length)return{elements:e,from:i,to:o};if(i.length<=o.length)for(let t=0;t<i.length;t++)if(o[t]!==i[t]);else if(t===i.length-1)return{elements:e,from:i,to:o};const n=Et(i,e);if(n){if(!ci(n,o,e))return{elements:e,from:i,to:o};let t=-1,r=!1;if(i.length>=1&&o.length>=1){if(i.length<=o.length)if(1===i.length)i[0]<o[0]&&(r=!0);else for(let e=0;e<i.length&&i[e]===o[e];e++)if(i.length===i.length-1){r=!0;break}if(i.length>=o.length)if(1===o.length)o[0]<i[0]&&(r=!0);else for(let e=0;e<o.length&&(e===o.length-1&&o[e]<i[e]&&(r=!0),i[e]===o[e]);e++);}if(!0===r)for(let e=0;e<i.length&&o[e]>=0;e++)o[e]!==i[e]&&o[e]<i[e]&&e==o.length-1&&(t=e);t>=0&&(i[t]=i[t]+1),di(i,e)}return{elements:e,from:i,to:o}}(i.elements,{from:o,to:t});return i.elements=r,Se(this,fe,ve).call(this,i),this.refresh(),n}modifyLayout(e){const t=this.getData()||{elements:[]},i={type:"modifyLayout",time:Date.now(),content:{method:"modifyLayout",before:null,after:null}};if(null===e)return t.layout?(i.content.before=_t(t.layout),delete t.layout,Se(this,fe,ve).call(this,t),this.refresh(),i):i;const o=t.layout;let n={};const r=_t(e);return t.layout?(Object.keys(r).forEach((e=>{let t=ii(o,e);void 0===t&&/(borderRadius|borderWidth)\[[0-9]{1,}\]$/.test(e)&&(e=e.replace(/\[[0-9]{1,}\]$/,""),t=ii(o,e)),n[e]=t})),n=_t(n),i.content.before=n):t.layout={},i.content.after=r,function(e,t){const i=_t(t),o=[];Object.keys(i).forEach((t=>{if(!o.includes(t)){const o=i[t];ni(e,t),void 0!==o&&oi(e,t,o)}}))}(t.layout,e),Se(this,fe,ve).call(this,t),this.refresh(),i}modifyGlobal(e){const t=this.getData()||{elements:[]},i={type:"modifyGlobal",time:Date.now(),content:{method:"modifyGlobal",before:null,after:null}};if(null===e)return t.global?(i.content.before=ei(t.global),delete t.global,Se(this,fe,ve).call(this,t),this.refresh(),i):i;const o=t.global;let n={};const r=ei(e);return t.global?(Object.keys(r).forEach((e=>{n[e]=ii(o,e)})),n=ei(n),i.content.before=n):t.global={},i.content.after=r,function(e,t){const i=ei(t),o=[];Object.keys(i).forEach((t=>{if(!o.includes(t)){const o=i[t];ni(e,t),void 0!==o&&oi(e,t,o)}}))}(t.global,e),Se(this,fe,ve).call(this,t),this.refresh(),i}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger(Ao.CURSOR,{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(Hn,o),n=!0,t.trigger(Ao.CURSOR,{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(Hn);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(Hn,t)},pointEnd(){n=!1,i.setSharedStorage(Hn,null),t.trigger(Ao.CURSOR,{type:"drag-default"})}}},e.MiddlewareInfo=(e,t)=>{const{boardContent:i,calculator:o,eventHub:n}=e,{overlayContext:r}=i;let l={...In,...t},a=!0;const s=({show:e})=>{a=e};return{name:"@middleware/info",use(){n.on(An,s)},disuse(){n.off(An,s)},resetConfig(e){l={...l,...e}},beforeDrawFrame({snapshot:e}){var t;const{textBackground:i,textColor:n}=l,s={textBackground:i,textColor:n},{sharedStore:h}=e,c=h[Oo],d=h[Ro],u=h[jo]||[];if(1===c.length){const i=c[0];if(i&&["select","drag","resize"].includes(d)){const n=dt(e),l=ut(e),{x:h,y:c,w:d,h:f,angle:g}=i,v=[...u,{uuid:Ie(),x:h,y:c,w:d,h:f,angle:g,type:"group",detail:{children:[]}}],m={viewScaleInfo:n,viewSizeInfo:l},y=o.calcViewRectInfoFromOrigin(i.uuid,m);let p=0;v.forEach((e=>{p+=e.angle||0}));const w=ft(It(0-p));if(y){const e=null==y?void 0:y.center,o={topLeft:wt(e,y.topLeft,w),topRight:wt(e,y.topRight,w),bottomRight:wt(e,y.bottomRight,w),bottomLeft:wt(e,y.bottomLeft,w),center:wt(e,y.center,w),top:wt(e,y.top,w),right:wt(e,y.right,w),bottom:wt(e,y.bottom,w),left:wt(e,y.left,w)},n=Zt(i.x,{decimalPlaces:2}),l=Zt(i.y,{decimalPlaces:2}),h=Zt(i.w,{decimalPlaces:2}),c=Zt(i.h,{decimalPlaces:2}),d=`${Zt(n,{decimalPlaces:0})},${Zt(l,{decimalPlaces:0})}`,u=`${Zt(h,{decimalPlaces:0})}x${Zt(c,{decimalPlaces:0})}`,f=`${Zt(i.angle||0,{decimalPlaces:0})}°`;!function(e,t){const{point:i,rotateCenter:o,angle:n,text:r,style:l,fontSize:a,lineHeight:s}=t,{textColor:h,textBackground:c}=l;gt(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:a,fontFamily:bn});const t=(s-a)/2,o=e.$undoPixelRatio(e.measureText(r).width),n={x:i.x-o/2-t,y:i.y},l={x:n.x+o+2*t,y:n.y+a+t},d={x:i.x-o/2,y:i.y};e.setLineDash([]),e.fillStyle=c,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(l.x,n.y),e.lineTo(l.x,l.y),e.lineTo(n.x,l.y),e.closePath(),e.fill("nonzero"),e.fillStyle=h,e.textBaseline="top",e.fillText(r,d.x,d.y+t)}))}(r,{point:{x:o.bottom.x,y:o.bottom.y+Mn},rotateCenter:o.center,angle:p,text:u,fontSize:Mn,lineHeight:16,style:s}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:r,style:l,fontSize:a,lineHeight:s}=t,{textBackground:h,textColor:c}=l;gt(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:a,fontFamily:bn});const t=(s-a)/2,o=e.$undoPixelRatio(e.measureText(r).width),n={x:i.x,y:i.y},l={x:n.x+o+2*t,y:n.y+a+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=h,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(l.x,n.y),e.lineTo(l.x,l.y),e.lineTo(n.x,l.y),e.closePath(),e.fill("nonzero"),e.fillStyle=c,e.textBaseline="top",e.fillText(r,d.x,d.y+t)}))}(r,{point:{x:o.topLeft.x,y:o.topLeft.y-20},rotateCenter:o.center,angle:p,text:d,fontSize:Mn,lineHeight:16,style:s}),a&&!1!==(null==(t=i.operations)?void 0:t.rotatable)&&function(e,t){const{point:i,rotateCenter:o,angle:n,text:r,style:l,fontSize:a,lineHeight:s}=t,{textBackground:h,textColor:c}=l;gt(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:a,fontFamily:bn});const t=(s-a)/2,o=e.$undoPixelRatio(e.measureText(r).width),n={x:i.x,y:i.y},l={x:n.x+o+2*t,y:n.y+a+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=h,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(l.x,n.y),e.lineTo(l.x,l.y),e.lineTo(n.x,l.y),e.closePath(),e.fill("nonzero"),e.fillStyle=c,e.textBaseline="top",e.fillText(r,d.x,d.y+t)}))}(r,{point:{x:o.top.x+Mn+4,y:o.top.y-20-18},rotateCenter:o.center,angle:p,text:f,fontSize:Mn,lineHeight:16,style:s})}}}}}},e.MiddlewareLayoutSelector=(e,t)=>{const{sharer:i,boardContent:o,calculator:n,viewer:r,eventHub:l}=e,{overlayContext:a}=o;let s={...pn,...t},h=null,c=null,d=null,u=null;const f=()=>{h=null,i.setSharedStorage(dn,null),i.setSharedStorage(un,null),i.setSharedStorage(fn,null),i.setSharedStorage(gn,null),i.setSharedStorage(vn,null),i.setSharedStorage(mn,null),i.setSharedStorage(yn,null),c=null,d=null},g=()=>{const e=i.getSharedStorage(Ro);return!(!e||"area"===e)&&(f(),!0)},v=()=>{const e=i.getActiveStorage("data");if(null==e?void 0:e.layout){const{x:t,y:i,w:o,h:n}=e.layout;return{x:t,y:i,w:o,h:n}}return null},m=e=>{const t=v();if(t){const{x:o,y:n,w:r,h:l}=t;return function(e,t){return Nt(e,Lt(t))}(e,Wt({x:o-5,y:n-5,w:r+10,h:l+10},{viewScaleInfo:i.getActiveViewScaleInfo()}))}return!1},y=()=>{const e=i.getActiveViewScaleInfo(),t=v();if(t){const o=Xt(t,{viewScaleInfo:e,controllerSize:10});i.setSharedStorage(fn,o)}else i.setSharedStorage(fn,null)},p=e=>{const t=i.getActiveStorage("data"),o=i.getSharedStorage(fn);let n=null;if(o&&(null==t?void 0:t.layout)&&(null==e?void 0:e.point)){let t=null;if(o){const{topLeft:r,top:a,topRight:s,right:h,bottomRight:c,bottom:d,bottomLeft:u,left:f}=o,g=[r,a,s,h,c,d,u,f];for(let i=0;i<g.length;i++){const o=g[i];if(Nt(e.point,o.vertexes)){t=`${o.type}`;break}}t&&(i.setSharedStorage(un,t),l.trigger(Ao.CLEAR_SELECT),n=t)}}return n?i.setSharedStorage(vn,!0):i.setSharedStorage(vn,!1),n},w=e=>{!0!==i.getSharedStorage(yn)&&l.trigger(Ao.CURSOR,{type:e?`resize-${e}`:e,groupQueue:[],element:v()})};return{name:"@middleware/layout-selector",use:()=>{f(),y()},resetConfig(e){s={...s,...e}},hover:e=>{if(!0!==i.getSharedStorage(yn)&&!g()){if(m(e.point)?i.setSharedStorage(gn,!0):(i.setSharedStorage(gn,!1),!0===c&&(r.drawFrame(),c=!1)),!0===i.getSharedStorage(mn)){const t=i.getSharedStorage(dn),o=i.getActiveStorage("data");if(null==o?void 0:o.layout)if("resize"!==t){y();const t=p(e);t?w(t):(w(),i.setSharedStorage(dn,null))}else{const t=p(e);w(t)}return!0!==i.getSharedStorage(vn)&&void 0}return i.getSharedStorage(gn)&&!c&&r.drawFrame(),c=i.getSharedStorage(gn),!0!==i.getSharedStorage(vn)&&void 0}},pointStart:e=>{if(g())return;m(e.point)?i.setSharedStorage(mn,!0):(!0===d&&(f(),r.drawFrame()),i.setSharedStorage(mn,!1));const t=i.getActiveStorage("data");u=(null==t?void 0:t.layout)?Ct(t.layout):null,y();const o=p(e);return h=e.point,o&&i.setSharedStorage(dn,"resize"),!0!==i.getSharedStorage(mn)||d||(r.drawFrame(),l.trigger(Ao.SELECT_LAYOUT)),d=i.getSharedStorage(mn),!0!==i.getSharedStorage(vn)&&void 0},pointMove:e=>{if(!i.getSharedStorage(mn)&&g())return;const t=i.getSharedStorage(dn),o=i.getSharedStorage(un),l=i.getActiveStorage("data");if("resize"===t&&o&&(null==l?void 0:l.layout)){if(h){i.setSharedStorage(yn,!0);const t=i.getActiveStorage("scale"),a=e.point.x-h.x,s=e.point.y-h.y,c=a/t,d=s/t,{x:u,y:f,w:g,h:v,operations:m={}}=l.layout,{position:y="absolute"}=m;"top"===o?"relative"===y?(l.layout.h=n.toGridNum(v-d),r.scroll({moveY:s})):(l.layout.y=n.toGridNum(f+d),l.layout.h=n.toGridNum(v-d)):"right"===o?l.layout.w=n.toGridNum(g+c):"bottom"===o?l.layout.h=n.toGridNum(v+d):"left"===o?"relative"===y?(l.layout.w=n.toGridNum(g-c),r.scroll({moveX:a})):(l.layout.x=n.toGridNum(u+c),l.layout.w=n.toGridNum(g-c)):"top-left"===o?"relative"===y?(l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v-d),r.scroll({moveX:a,moveY:s})):(l.layout.x=n.toGridNum(u+c),l.layout.y=n.toGridNum(f+d),l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v-d)):"top-right"===o?"relative"===y?(r.scroll({moveY:s}),l.layout.w=n.toGridNum(g+c),l.layout.h=n.toGridNum(v-d)):(l.layout.y=n.toGridNum(f+d),l.layout.w=n.toGridNum(g+c),l.layout.h=n.toGridNum(v-d)):"bottom-right"===o?(l.layout.w=n.toGridNum(g+c),l.layout.h=n.toGridNum(v+d)):"bottom-left"===o&&("relative"===y?(r.scroll({moveX:a}),l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v+d)):(l.layout.x=n.toGridNum(u+c),l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v+d)))}return h=e.point,y(),r.drawFrame(),!1}return!["resize"].includes(t)&&void 0},pointEnd:()=>{i.setSharedStorage(yn,!1);const e=i.getSharedStorage(dn),t=i.getSharedStorage(un),o=i.getActiveStorage("data");if(o&&"resize"===e&&t){let e;u&&(e={type:"modifyLayout",time:Date.now(),content:{method:"modifyLayout",before:_t(u),after:_t(Ct(o.layout))}}),l.trigger(Ao.CHANGE,{type:"resizeLayout",data:o,modifyRecord:e})}if(u=null,i.setSharedStorage(dn,null),i.setSharedStorage(un,null),!0===i.getSharedStorage(vn))return!1},beforeDrawFrame:({snapshot:e})=>{var t;if(g())return;const{activeColor:i}=s,o={activeColor:i},{sharedStore:n,activeStore:r}=e,l=n[dn],h=n[gn],c=n[mn];if(null==(t=r.data)?void 0:t.layout){const{x:t,y:i,w:n,h:s}=r.data.layout,d=dt(e),u={x:t,y:i,w:n,h:s},f=Xt(u,{viewScaleInfo:d,controllerSize:10});if(!0===h){const e=Wt(u,{viewScaleInfo:d});!function(e,t){const{layoutSize:i,style:o}=t,{activeColor:n}=o,{x:r,y:l,w:a,h:s}=i;e.setLineDash([]),e.strokeStyle=n,e.lineWidth=1,e.beginPath(),e.moveTo(r,l),e.lineTo(r+a,l),e.lineTo(r+a,l+s),e.lineTo(r,l+s),e.lineTo(r,l),e.closePath(),e.stroke()}(a,{layoutSize:e,style:o})}(l&&["resize"].includes(l)||!0===c)&&function(e,t){const{controller:i,style:o}=t,{topLeft:n,topRight:r,bottomLeft:l,bottomRight:a,topMiddle:s,rightMiddle:h,bottomMiddle:c,leftMiddle:d}=i;xn(e,{start:n.center,end:r.center,centerVertexes:s.vertexes,style:o}),xn(e,{start:r.center,end:a.center,centerVertexes:h.vertexes,style:o}),xn(e,{start:a.center,end:l.center,centerVertexes:c.vertexes,style:o}),xn(e,{start:l.center,end:n.center,centerVertexes:d.vertexes,style:o}),wn(e,n.vertexes,o),wn(e,r.vertexes,o),wn(e,a.vertexes,o),wn(e,l.vertexes,o)}(a,{controller:f,style:o})}},scrollX:()=>{f()},scrollY:()=>{f()},wheelScale:()=>{f()}}},e.MiddlewarePointer=e=>{const{boardContent:t,eventHub:i,sharer:o}=e,n=t.boardContext.canvas,r=e.container||document.body,l=`idraw-middleware-pointer-${Math.random().toString(26).substring(2)}`;let a=document.createElement("div");return{name:"@middleware/pointer",use(){a.setAttribute("id",l),a.style.position="fixed",a.style.top="0",a.style.bottom="unset",a.style.left="0",a.style.right="unset",r.appendChild(a)},disuse(){r.removeChild(a),a.remove(),a=null},contextMenu(e){const{point:t}=e,{left:r,top:l}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:r}=e;return{left:t,top:i,width:o,height:r}})();a.style.left=`${r+t.x}px`,a.style.top=`${l+t.y}px`;const s=o.getSharedStorage(Oo);i.trigger(Ao.CONTEXT_MENU,{pointerContainer:a,selectedElements:s||[]})}}},e.MiddlewareRuler=(e,t)=>{const{boardContent:i,viewer:o,eventHub:n,calculator:r}=e,{overlayContext:l,underlayContext:a}=i;let s={...Fn,...t},h=!0,c=!0;const d=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(h=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(c=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||o.drawFrame()};return{name:"@middleware/ruler",use(){n.on(Ao.RULER,d)},disuse(){n.off(Ao.RULER,d)},resetConfig(e){s={...s,...e}},beforeDrawFrame:({snapshot:e})=>{const{background:t,borderColor:i,scaleColor:o,textColor:n,gridColor:d,gridPrimaryColor:u,selectedAreaColor:f}=s,g={background:t,borderColor:i,scaleColor:o,textColor:n,gridColor:d,gridPrimaryColor:u,selectedAreaColor:f};if(!0===h){const t=dt(e),i=ut(e);!function(e,t){const{viewSizeInfo:i,style:o}=t,{width:n,height:r}=i,{background:l,borderColor:a}=o;e.beginPath();const s=-1;e.moveTo(s,s),e.lineTo(n+1,s),e.lineTo(n+1,Nn),e.lineTo(Nn,Nn),e.lineTo(Nn,r+1),e.lineTo(s,r+1),e.lineTo(s,s),e.closePath(),e.fillStyle=l,e.fill("nonzero"),e.lineWidth=1,e.setLineDash([]),e.strokeStyle=a,e.stroke()}(l,{viewSizeInfo:i,style:g}),function(e,t){const{snapshot:i,calculator:o,style:n}=t,{sharedStore:r}=i,{selectedAreaColor:l}=n,a=r[Oo],s=r[Ro];if(["select","drag","drag-list","drag-list-end"].includes(s)&&a.length>0){const t=dt(i),n=ut(i),r=[],s=[],h=[],c=[],d=[];if(a.forEach((e=>{const i=o.calcViewRectInfoFromRange(e.uuid,{viewScaleInfo:t,viewSizeInfo:n});i&&(r.push(i),s.push(i.left.x),h.push(i.right.x),c.push(i.top.y),d.push(i.bottom.y))})),!(r.length>0))return;const u=Math.min(...s),f=Math.max(...h),g=Math.min(...c),v=Math.max(...d);e.globalAlpha=1,e.beginPath(),e.moveTo(u,0),e.lineTo(f,0),e.lineTo(f,Nn),e.lineTo(u,Nn),e.fillStyle=l,e.closePath(),e.fill("nonzero"),e.beginPath(),e.moveTo(0,g),e.lineTo(Nn,g),e.lineTo(Nn,v),e.lineTo(0,v),e.fillStyle=l,e.closePath(),e.fill("nonzero")}}(l,{snapshot:e,calculator:r,style:g});const{list:o,rulerUnit:n}=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:r}=i;return Vn({scale:o,viewLength:r,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i,style:o}=t,{scaleColor:n,textColor:r}=o;for(let t=0;t<i.length;t++){const o=i[t];o.position<Nn||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=n,e.stroke(),o.isKeyNum&&(e.fillStyle=r,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:Bn}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(l,{scaleList:o,style:g});const{list:s}=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:r}=i;return Vn({scale:o,viewLength:r,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});if(function(e,t){const{scaleList:i,style:o}=t,{scaleColor:n,textColor:r}=o,l=3.2;for(let t=0;t<i.length;t++){const o=i[t];if(!(o.position<Nn)&&(e.beginPath(),e.moveTo(16,o.position),e.lineTo(o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8,o.position),e.closePath(),e.fillStyle=n,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===o.showNum)){const t=l,i=o.position+l,n=`${o.num}`;gt(e,-90,{x:t,y:i},(()=>{e.fillStyle=r,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:Bn}),e.fillText(n,13.2,o.position+l)}))}}}(l,{scaleList:s,style:g}),!0===c){!function(e,t){const{xList:i,yList:o,viewSizeInfo:n,style:r}=t,{width:l,height:a}=n,{gridColor:s,gridPrimaryColor:h}=r;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,a),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=h:e.strokeStyle=s,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(l,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=h:e.strokeStyle=s,e.lineWidth=1,e.closePath(),e.stroke()}}(1===n?l:a,{xList:o,yList:s,viewSizeInfo:i,style:g})}}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:r}=e,{scale:l}=i.getActiveViewScaleInfo();let a=l;if(n<0?a=1.1*l:n>0&&(a=.9*l),a<.05||a>50)return;const{moveX:s,moveY:h}=t.scale({scale:a,point:r});t.scroll({moveX:s,moveY:h}),t.drawFrame();const c=Zt(l);o.trigger(Ao.SCALE,{scale:c})}}},e.MiddlewareScroller=(e,t)=>{const{viewer:i,boardContent:o,sharer:n,eventHub:r}=e,{overlayContext:l}=o;n.setSharedStorage(Rn,null),n.setSharedStorage(Cn,null);let a=!1,s={...kn,...t};const h=()=>{n.setSharedStorage(Pn,null),n.setSharedStorage(Ln,null),n.setSharedStorage(On,null),n.setSharedStorage(En,null),n.setSharedStorage(Tn,null),a=!1};h();const c=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:r}=i;return n&&Wn(e,t,n)?o="X":r&&Wn(e,t,r)&&(o="Y"),o}(l,e,{xThumbRect:n.getSharedStorage(Rn),yThumbRect:n.getSharedStorage(Cn)});return{name:"@middleware/scroller",resetConfig(e){s={...s,...e}},wheel:e=>{i.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),i.drawFrame()},hover:e=>{if(!0===a)return!1;const{point:t}=e,i=c(t);if("X"===i||"Y"===i)return"X"===i?(n.setSharedStorage(En,!0),n.setSharedStorage(Tn,!1)):(n.setSharedStorage(En,!1),n.setSharedStorage(Tn,!0)),r.trigger(Ao.CURSOR,{type:"default"}),!1;n.setSharedStorage(En,!1),n.setSharedStorage(Tn,!1)},pointStart:e=>{const{point:t}=e,i=c(t);if("X"===i||"Y"===i)return a=!0,n.setSharedStorage(On,i),n.setSharedStorage(Pn,t),!1},pointMove:e=>{const{point:t}=e,o=n.getSharedStorage(On);if("X"===o||"Y"===o)return n.setSharedStorage(Ln,t),"X"===o?(e=>{const t=n.getSharedStorage(Pn);if(t){const{offsetLeft:o,offsetRight:r}=n.getActiveViewScaleInfo(),{width:l}=n.getActiveViewSizeInfo(),a=-(e.x-t.x)*(l+Math.abs(o)+Math.abs(r))/l;i.scroll({moveX:a}),i.drawFrame()}})(t):"Y"===o&&(e=>{const t=n.getSharedStorage(Pn);if(t){const{offsetTop:o,offsetBottom:r}=n.getActiveViewScaleInfo(),{height:l}=n.getActiveViewSizeInfo(),a=-(e.y-t.y)*(l+Math.abs(o)+Math.abs(r))/l;i.scroll({moveY:a}),i.drawFrame()}})(t),n.setSharedStorage(Pn,t),!1},pointEnd:()=>{a=!1;const e=n.getSharedStorage(On);if(h(),"X"===e||"Y"===e)return i.scroll({moveX:0,moveY:0}),i.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{thumbBackground:t,thumbBorderColor:i,hoverThumbBackground:o,hoverThumbBorderColor:r,activeThumbBackground:a,activeThumbBorderColor:h}=s,c={thumbBackground:t,thumbBorderColor:i,hoverThumbBackground:o,hoverThumbBorderColor:r,activeThumbBackground:a,activeThumbBorderColor:h},{xThumbRect:d,yThumbRect:u}=Yn(l,{snapshot:e,style:c});n.setSharedStorage(Rn,d),n.setSharedStorage(Cn,u)}}},e.MiddlewareSelector=(e,t)=>{let i={...Go,...t};const{viewer:o,sharer:n,boardContent:r,calculator:l,eventHub:a}=e,{overlayContext:s}=r;let h=null,c=[],d=null,u=null,f=null,g=null,v=Sn({fill:i.activeColor,devicePixelRatio:n.getActiveViewSizeInfo().devicePixelRatio}),m=null,y=null;n.setSharedStorage(Ro,null),n.setSharedStorage(Fo,!0);const p=()=>n.getSharedStorage(Oo),w=e=>{let t=n.getSharedStorage(jo);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const i=Ot(t);return n.setSharedStorage(jo,t),n.setSharedStorage(Yo,i),t.length>0},x=e=>{n.setSharedStorage(Po,e);let t=null;e&&(t=kt(e,{groupQueue:n.getSharedStorage(jo)})),n.setSharedStorage(Lo,t)},S=()=>{const e=n.getSharedStorage(Oo);if(1===e.length){const t=Vt(e[0],{groupQueue:n.getSharedStorage(jo),controllerSize:10,viewScaleInfo:n.getActiveViewScaleInfo(),rotateControllerPosition:22,rotateControllerSize:20});n.setSharedStorage(Wo,t)}},b=(e,t)=>{var i;if(n.setSharedStorage(Oo,e),1===e.length?(S(),n.setSharedStorage(Do,Tt(e[0].uuid,(null==(i=n.getActiveStorage("data"))?void 0:i.elements)||[]))):(n.setSharedStorage(Wo,null),n.setSharedStorage(Do,[])),!0===(null==t?void 0:t.triggerEvent)){const t=e.map((e=>e.uuid)),i=n.getActiveStorage("data"),o=function(e,t){const i=[],o={};let n=!1;const r=t=>{var l;for(let a=0;a<t.length&&!0!==n;a++){i.push(a);const s=t[a];if(e.includes(s.uuid)){if(o[s.uuid]=[...i],Object.keys(o).length===e.length){n=!0;break}}else"group"===s.type&&r((null===(l=null==s?void 0:s.detail)||void 0===l?void 0:l.children)||[]);if(n)break;i.pop()}};return r(t),o}(t,(null==i?void 0:i.elements)||[]);a.trigger(Ao.SELECT,{type:"clickCanvas",uuids:t,positions:e.map((e=>[...o[e.uuid]]))})}},A=()=>({ctx:s,calculator:l,data:n.getActiveStorage("data"),selectedElements:p(),viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:n.getSharedStorage(jo),areaSize:null,selectedElementController:n.getSharedStorage(Wo),selectedElementPosition:n.getSharedStorage(Do)}),I=()=>{m=null,y=null,n.setSharedStorage(Ro,null),n.setSharedStorage(Co,null),n.setSharedStorage(Eo,null),n.setSharedStorage(To,null),n.setSharedStorage(jo,[]),n.setSharedStorage(Yo,[]),n.setSharedStorage(Po,null),n.setSharedStorage(Lo,null),n.setSharedStorage(Oo,[]),n.setSharedStorage(ko,null),n.setSharedStorage(Wo,null),n.setSharedStorage(Do,[]),n.setSharedStorage(No,null)};I();const M=({uuids:e=[],positions:t})=>{let i=[];const r=n.getSharedStorage(Ro),l=n.getActiveStorage("data");i=t&&Array.isArray(t)?function(e,t){const i=[];return e.forEach((e=>{const o=Et(e,t);o&&i.push(o)})),i}(t,(null==l?void 0:l.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let r=0;r<o.length;r++){const l=o[r];e.includes(l.uuid)?i.push(l):"group"===l.type&&t((null===(n=null==l?void 0:l.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==l?void 0:l.elements)||[]);let a=!1;if(r||1!==i.length?"select"===r&&1===i.length&&(a=!0):(n.setSharedStorage(Ro,"select"),a=!0),a){const e=function(e,t){const i=[];return function e(t,o){var n;let r=null;for(let l=0;l<o.length;l++){const a=o[l];if(a.uuid===t){r=a;break}if(!r&&"group"===a.type){i.push(a);const o=e(t,(null===(n=null==a?void 0:a.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){r=o;break}i.pop()}}return r}(e,t),i}(i[0].uuid,(null==l?void 0:l.elements)||[]);n.setSharedStorage(jo,e),b(i),o.drawFrame()}},z=()=>{I(),o.drawFrame()},R=e=>{n.setSharedStorage(Fo,!!e.enable)},C=e=>{n.setSharedStorage(Bo,!!e.enable)};return{name:"@middleware/selector",use(){a.on(Ao.SELECT,M),a.on(Ao.CLEAR_SELECT,z),a.on(Ao.SELECT_IN_GROUP,C),a.on(Ao.SNAP_TO_GRID,R)},disuse(){a.off(Ao.SELECT,M),a.off(Ao.CLEAR_SELECT,z),a.off(Ao.SELECT_IN_GROUP,C),a.off(Ao.SNAP_TO_GRID,R),I(),i=null},resetConfig(e){i={...i,...e}},hover:e=>{var t,i,r,l,h;const c=n.getSharedStorage(mn);if(!0===n.getSharedStorage(yn))return;const d=n.getSharedStorage(Co),u=n.getSharedStorage(Ro),g=n.getSharedStorage(jo),v=e=>{if(!0===c)return;const t=e.type;null===f&&a.trigger(Ao.CURSOR,{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==g?void 0:g.length)>0){if(!tn(e.point,{ctx:s,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:n.getSharedStorage(jo)}))return x(null),void o.drawFrame();const i=on(e.point,A());return v(i),d||["area","drag","drag-list"].includes(u)?(x(null),void o.drawFrame()):1===(null==(t=null==i?void 0:i.elements)?void 0:t.length)?(x(i.elements[0]),void o.drawFrame()):(x(null),void o.drawFrame())}if(d||["area","drag","drag-list"].includes(u))return void x(null);if("drag"===u)return void x(null);const m=p(),y=n.getActiveViewScaleInfo();n.getActiveViewSizeInfo();const w=on(e.point,{...A(),areaSize:rn(m,{viewScaleInfo:y})});if(v(w),null!==w.type){if(!("over-element"===w.type&&"select"===n.getSharedStorage(Ro)&&1===w.elements.length&&w.elements[0].uuid===(null==(r=null==(i=p())?void 0:i[0])?void 0:r.uuid)||"over-element"===w.type&&null===n.getSharedStorage(Ro)&&1===w.elements.length&&w.elements[0].uuid===(null==(l=n.getSharedStorage(Po))?void 0:l.uuid)))return"over-element"===w.type&&1===(null==(h=null==w?void 0:w.elements)?void 0:h.length)?(x(w.elements[0]),void o.drawFrame()):n.getSharedStorage(Po)?(x(null),void o.drawFrame()):void 0}else(n.getSharedStorage(Po)||n.getSharedStorage(Lo))&&(n.setSharedStorage(Po,null),n.setSharedStorage(Lo,null),o.drawFrame())},pointStart:e=>{var t,i,r,l,a,f,g,v,w,S,M,z;h=e.point,d=e.point,m=null,y=null,n.setSharedStorage(Ro,null),n.setSharedStorage(Co,null),n.setSharedStorage(Eo,null),n.setSharedStorage(To,null),n.setSharedStorage(Po,null);const R=n.getSharedStorage(jo);if((null==R?void 0:R.length)>0){if(tn(e.point,{ctx:s,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:R})){const o=on(e.point,A()),s=1===(null==(t=null==o?void 0:o.elements)?void 0:t.length)&&!0===(null==(r=null==(i=o.elements[0])?void 0:i.operations)?void 0:r.locked);x(null),1===(null==(l=null==o?void 0:o.elements)?void 0:l.length)&&(u=Ct(null==o?void 0:o.elements[0])),!0===s?I():"over-element"===o.type&&1===(null==(a=null==o?void 0:o.elements)?void 0:a.length)?(b([o.elements[0]],{triggerEvent:!0}),n.setSharedStorage(Ro,"drag"),c=[{...Ct(null==o?void 0:o.elements[0]),uuid:null==o?void 0:o.elements[0].uuid}]):(null==(f=o.type)?void 0:f.startsWith("resize-"))?(n.setSharedStorage(Co,o.type),n.setSharedStorage(Ro,"resize")):b([],{triggerEvent:!0})}else I();return void o.drawFrame()}const C=rn(p(),{viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),E=on(e.point,{...A(),areaSize:C,groupQueue:[]}),T=1===(null==(g=null==E?void 0:E.elements)?void 0:g.length)&&!0===(null==(w=null==(v=E.elements[0])?void 0:v.operations)?void 0:w.locked);x(null),1===(null==(S=null==E?void 0:E.elements)?void 0:S.length)&&(u=Ct(null==E?void 0:E.elements[0])),!0===T?(I(),n.setSharedStorage(Ro,"area"),n.setSharedStorage(Eo,e.point),b([],{triggerEvent:!0})):"list-area"===E.type?n.setSharedStorage(Ro,"drag-list"):"over-element"===E.type&&1===(null==(M=null==E?void 0:E.elements)?void 0:M.length)?(b([E.elements[0]],{triggerEvent:!0}),n.setSharedStorage(Ro,"drag"),c=[{...Ct(null==E?void 0:E.elements[0]),uuid:null==E?void 0:E.elements[0].uuid}]):(null==(z=E.type)?void 0:z.startsWith("resize-"))?(n.setSharedStorage(Co,E.type),n.setSharedStorage(Ro,"resize")):(I(),n.setSharedStorage(Ro,"area"),n.setSharedStorage(Eo,e.point),b([],{triggerEvent:!0})),o.drawFrame()},pointMove:e=>{var t,i,r;n.setSharedStorage(No,!0);const s=n.getActiveStorage("data"),c=p(),v=n.getActiveStorage("scale")||1,w=n.getActiveViewScaleInfo(),x=n.getActiveViewSizeInfo(),S=h,A=d,I=e.point,M=n.getSharedStorage(Co),z=n.getSharedStorage(Ro),R=n.getSharedStorage(jo),C=n.getSharedStorage(Fo);if("drag"===z){if(g=!0,f="drag",a.trigger(An,{show:!1}),s&&1===(null==c?void 0:c.length)&&u&&A&&I&&!0!==(null==(i=null==(t=c[0])?void 0:t.operations)?void 0:i.locked)){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const r=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:l=0}=e;r.push({x:t,y:i,w:o,h:n,angle:0-l})})),(null==i?void 0:i.length)>0){const i=xt(e,r),l=xt(t,r);o=l.x-i.x,n=l.y-i.y}return{moveX:o,moveY:n}}(A,I,R);let i=l.toGridNum(e/v),o=l.toGridNum(t/v);if(!0===C){const e=hn(c[0].uuid,{calculator:l,data:s,groupQueue:R,viewScaleInfo:w,viewSizeInfo:x});try{e&&(He.x(e.offsetX)&&null!==e.offsetX&&(i=l.toGridNum(i+e.offsetX)),He.y(e.offsetY)&&null!==e.offsetY&&(o=l.toGridNum(o+e.offsetY)))}catch(e){console.error(e)}}c[0].x=l.toGridNum(u.x+i),c[0].y=l.toGridNum(u.y+o),b([c[0]]),l.modifyVirtualFlatItemMap(s,{modifyInfo:{type:"updateElement",content:{element:c[0],position:n.getSharedStorage(Do)||[]}},viewSizeInfo:x,viewScaleInfo:w})}o.drawFrame()}else if("drag-list"===z){if(g=!0,f="drag-list",s&&A&&S&&I&&(null==c?void 0:c.length)>1){const e=(I.x-S.x)/v,t=(I.y-S.y)/v;c.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.locked)&&(i.x=l.toGridNum(i.x+e),i.y=l.toGridNum(i.y+t),l.modifyVirtualFlatItemMap(s,{modifyInfo:{type:"updateElement",content:{element:i,position:Tt(i.uuid,s.elements)||[]}},viewSizeInfo:x,viewScaleInfo:w}))})),n.setActiveStorage("data",s)}o.drawFrame()}else if("resize"===z){if(s&&1===(null==c?void 0:c.length)&&A&&u&&(null==M?void 0:M.startsWith("resize-"))){g=!0,f="resize";const e=[];R.forEach((t=>{const{x:i,y:o,w:n,h:r,angle:l=0}=t;e.push({x:i,y:o,w:n,h:r,angle:0-l})}));let t=A,i=I;if(R.length>0&&(t=xt(A,e),i=xt(I,e)),"resize-rotate"===M){const e=n.getSharedStorage(Wo),t=yt([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),i=nn(u,{center:t,viewScaleInfo:w,start:A,end:I});c[0].angle=l.toGridNum(i.angle||0)}else{const e=function(e,t){var i,o,n,r,l,a,s,h,c;let{x:d,y:u,w:f,h:g,angle:v=0}=e;const m=mt({x:d,y:u,w:f,h:g});v=It(v);const y=ft(v),p=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:w,end:x,resizeType:S,scale:b}=t;let A={...w},I={...x},M={x:A.x,y:m.y},z={x:I.x,y:m.y},R={...M},C={...z},E={x:m.x,y:A.y},T={x:m.x,y:I.y},P={...E},L={...T},O=(C.x-R.x)/b,k=(C.y-R.y)/b,W=qo(O,k),D=(L.x-P.x)/b,j=(L.y-P.y)/b,Y=qo(D,j);(v>0||v<0)&&(A=wt(m,w,0-y),I=wt(m,x,0-y),M={x:A.x,y:m.y},z={x:I.x,y:m.y},R=wt(m,M,y),C=wt(m,z,y),E={x:m.x,y:A.y},T={x:m.x,y:I.y},P=wt(m,E,y),L=wt(m,T,y),O=(C.x-R.x)/b,k=(C.y-R.y)/b,W=qo(O,k),W=_o(W,k),D=(L.x-P.x)/b,j=(L.y-P.y)/b,Y=qo(D,j),Y=_o(Y,j));let N=(x.x-w.x)/b,B=(x.y-w.y)/b;if(!0===p)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(N),Math.abs(B));N=(N>=0?1:-1)*t,B=(B>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(D),Math.abs(j));D=(D>=0?1:-1)*i,j=(j>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(O),Math.abs(k));O=(O>=0?1:-1)*o,k=(k>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(N);N=(N>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?B=N>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(B=N>0?-i:i)}W=Math.abs(W),Y=W/e.w*e.h}switch(S){case"resize-top":if(0===v)g-B>0&&(u+=B,g-=B,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=B/e.h*e.w/2,f-=B/e.h*e.w));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){Y=0-_o(Y,j);const e=Ko(v),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){Y=_o(Y,D);const e=Ko(v-90),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){Y=_o(Y,j);const e=Ko(v-180),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){Y=0-_o(Y,D);const e=Ko(v-270),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+Y>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(f+=Y/e.h*e.w),g+=Y,d=t-f/2,u=i-g/2)}break;case"resize-bottom":if(0===v)e.h+B>0&&(g+=B,!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(d-=B/e.h*e.w/2,f+=B/e.h*e.w));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){Y=_o(Y,j);const e=Ko(v),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){Y=0-_o(Y,D);const e=Ko(v-90),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){Y=_o(Y,D);const e=Ko(v-180),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){Y=_o(Y,D);const e=Ko(v-270),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+Y>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(f+=Y/e.h*e.w),g+=Y,d=t-f/2,u=i-g/2)}break;case"resize-left":if(0===v)e.w-N>0&&(d+=N,f-=N,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(g-=N/e.w*e.h,u+=N/e.w*e.h/2));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){W=0-_o(W,O);const e=Ko(v),o=W/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){W=_o(W,O);const e=Ko(v-90),o=W/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){W=_o(W,k);const e=Ko(v-180),o=W/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){W=_o(W,k);const e=Ko(v-270),o=W/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}f+W>0&&(!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g+=W/e.w*e.h),f+=W,d=t-f/2,u=i-g/2)}break;case"resize-right":if(0===v)e.w+N>0&&(f+=N,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(u-=N*e.h/e.w/2,g+=N*e.h/e.w));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){W=_o(W,k);const e=Ko(v),o=W/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){W=_o(W,B);const e=Ko(v-90),o=W/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){W=_o(W,B);const e=Ko(v-180),o=W/2;t+=o*Math.cos(e),i+=o*Math.sin(e),W=0-W}else if(v<360){W=_o(W,N);const e=Ko(v-270),o=W/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}f+W>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=W/e.w*e.h),f+=W,d=t-f/2,u=i-g/2)}break;case"resize-top-left":if(0===v)f-N>0&&(d+=N,f-=N),g-B>0&&(u+=B,g-=B);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=0-_o(Y,j),W=0-_o(W,p?0-Y:O);const i=Y/2;e+=i*Math.sin(y),t-=i*Math.cos(y);const o=W/2;e-=o*Math.cos(y),t-=o*Math.sin(y)}else if(v<180){Y=_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){Y=_o(Y,j),W=_o(W,p?Y:k);const i=Ko(v-180),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){Y=0-_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}break;case"resize-top-right":if(0===v)f+N>0&&(f+=N),g-B>0&&(u+=B,g-=B);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=0-_o(Y,j),W=_o(W,p?Y:k);const i=Ko(v),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){Y=_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=Ko(v-180);Y=_o(Y,j),W=_o(W,p?Y:0-O);const o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){Y=0-_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+B>0&&(g+=B),e.w-N>0&&(d+=N,f-=N);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=_o(Y,j),W=0-_o(W,p?0-Y:O);const i=Ko(v),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){Y=0-_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){Y=_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){Y=_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+B>0&&(g+=B),e.w+N>0&&(f+=N);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=_o(Y,j),W=_o(W,p?Y:k);const i=Ko(v),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){Y=0-_o(Y,D),W=_o(W,p?Y:B);const i=Ko(v-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){Y=_o(Y,D),W=_o(W,p?Y:0-k);const i=Ko(v-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=W/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){Y=_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}}return{x:d,y:u,w:f,h:g,angle:e.angle}}({...u,operations:c[0].operations},{scale:v,start:t,end:i,resizeType:M}),o={ignore:!!u.angle},n=l.toGridNum(e.x,o),a=l.toGridNum(e.y,o),s=l.toGridNum(e.w,o),h=l.toGridNum(e.h,o);"group"===c[0].type?(y=si(c[0],{x:n,y:a,w:s,h:h},{resizeEffect:null==(r=c[0].operations)?void 0:r.resizeEffect}),m||(m=y),c[0].x=n,c[0].y=a):(c[0].x=n,c[0].y=a,c[0].w=s,c[0].h=h)}b([c[0]]),l.modifyVirtualFlatItemMap(s,{modifyInfo:{type:"updateElement",content:{element:c[0],position:n.getSharedStorage(Do)||[]}},viewSizeInfo:x,viewScaleInfo:w}),o.drawFrame()}}else"area"===z&&(f="area",n.setSharedStorage(To,e.point),o.drawFrame());h=e.point},pointEnd(e){f=null,n.setSharedStorage(No,!1);const t=n.getActiveStorage("data"),i=n.getSharedStorage(Oo),r=n.getSharedStorage(Po),s=n.getSharedStorage(Co),v=n.getSharedStorage(Ro),p=n.getActiveViewSizeInfo();let w=!1;if(h=null,d=null,u=null,"drag"===v&&a.trigger(An,{show:!0}),"resize"===v&&s)n.setSharedStorage(Co,null),w=!0;else if("area"===v){if(n.setSharedStorage(Ro,null),t){const e=n.getSharedStorage(Eo),i=n.getSharedStorage(To);if(e&&i){const{elements:o}=function(e,t){var i;const o=[],n=[],r=[],{viewScaleInfo:l,start:a,end:s}=t;if(!(Array.isArray(e.elements)&&a&&s))return{indexes:o,uuids:n,elements:r};const h=Math.min(a.x,s.x),c=Math.max(a.x,s.x),d=Math.min(a.y,s.y),u=Math.max(a.y,s.y);for(let t=0;t<e.elements.length;t++){const a=e.elements[t];if(!0===(null==(i=null==a?void 0:a.operations)?void 0:i.locked))continue;const s=Wt(a,{viewScaleInfo:l}),f=mt(s);if(f.x>=h&&f.x<=c&&f.y>=d&&f.y<=u&&(o.push(t),n.push(a.uuid),r.push(a),s.angle&&(s.angle>0||s.angle<0))){const e=bt(s);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];s.x=Math.min(...t),s.y=Math.min(...i),s.w=Math.abs(Math.max(...t)-Math.min(...t)),s.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:r}}(t,{start:e,end:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});o.length>0&&(n.setSharedStorage(Ro,"drag-list"),b(o,{triggerEvent:!0}),w=!0)}}}else if("drag-list"===v)n.setSharedStorage(Ro,"drag-list-end"),w=!0;else if(t){l.getPointElement(e.point,{data:t,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}).element?(n.setSharedStorage(Ro,"select"),w=!0):n.setSharedStorage(Ro,null)}null===n.getSharedStorage(Ro)&&(I(),w=!0);(()=>{if(w){if(t&&Array.isArray(null==t?void 0:t.elements)&&["drag","drag-list"].includes(v)){const e=function(e,t,i){const o=zt(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(t.elements,p,{extend:!0});n.setActiveStorage("contextHeight",e.contextSize.contextHeight),n.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(t&&["drag","drag-list","drag-list-end","resize"].includes(v)){let e="resizeElement";if(g){const o=c[0];let n=null;1===i.length?(n={type:"resizeElement",time:0,content:{method:"modifyElement",uuid:o.uuid,before:qt(o),after:qt(Ct(i[0]))}},"group"===i[0].type&&m&&y&&(n={...y,content:{...y.content,before:m.content.before}})):i.length>1&&(n={type:"resizeElements",time:0,content:{method:"modifyElements",before:c.map((e=>({...qt(e),uuid:e.uuid}))),after:i.map((e=>({...qt(Ct(e)),uuid:e.uuid})))}}),a.trigger(Ao.CHANGE,{data:t,type:e,selectedElements:i,hoverElement:r,modifyRecord:n}),g=!1}}o.drawFrame()}})()},pointLeave(){f=null,n.setSharedStorage(Co,null),a.trigger(Ao.CURSOR,{type:"default"})},doubleClick(e){var t,i,r,l,s,h,c,d;if(!1===n.getSharedStorage(Bo))return;const u=on(e.point,A());if(n.setSharedStorage(Wo,null),n.setSharedStorage(Oo,[]),1!==u.elements.length||!0!==(null==(i=null==(t=u.elements[0])?void 0:t.operations)?void 0:i.locked)){if(1===u.elements.length&&"group"===(null==(r=u.elements[0])?void 0:r.type)){if(!0===w(u.elements[0]))return n.setSharedStorage(Ro,null),void o.drawFrame()}else 1!==u.elements.length||"text"!==(null==(l=u.elements[0])?void 0:l.type)||(null==(h=null==(s=u.elements[0])?void 0:s.operations)?void 0:h.invisible)||a.trigger(Ao.TEXT_EDIT,{element:u.elements[0],groupQueue:n.getSharedStorage(jo)||[],position:Tt(null==(c=u.elements[0])?void 0:c.uuid,(null==(d=n.getActiveStorage("data"))?void 0:d.elements)||[]),viewScaleInfo:n.getActiveViewScaleInfo()});n.setSharedStorage(Ro,null)}},wheel(){S()},wheelScale(){S()},contextMenu:e=>{var t,i,r,l,a,h,c,d;const u=n.getSharedStorage(jo);if((null==u?void 0:u.length)>0){if(tn(e.point,{ctx:s,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:u})){const n=on(e.point,A());1===(null==(t=null==n?void 0:n.elements)?void 0:t.length)&&!0!==(null==(r=null==(i=n.elements[0])?void 0:i.operations)?void 0:r.locked)?(I(),b([n.elements[0]],{triggerEvent:!0}),o.drawFrame()):(null==(l=null==n?void 0:n.elements)?void 0:l.length)||I()}return}const f=rn(p(),{viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),g=on(e.point,{...A(),areaSize:f,groupQueue:[]});if(1===(null==(a=null==g?void 0:g.elements)?void 0:a.length)&&!0!==(null==(c=null==(h=g.elements[0])?void 0:h.operations)?void 0:c.locked))return I(),b([g.elements[0]],{triggerEvent:!0}),void o.drawFrame();(null==(d=null==g?void 0:g.elements)?void 0:d.length)||I()},beforeDrawFrame({snapshot:t}){var o;const{activeColor:n,activeAreaColor:r,lockedColor:a,referenceColor:h}=i,c={activeColor:n,activeAreaColor:r,lockedColor:a,referenceColor:h},{activeStore:d,sharedStore:u}=t,{scale:f,offsetLeft:g,offsetTop:m,offsetRight:y,offsetBottom:w,width:x,height:S,contextHeight:b,contextWidth:A,devicePixelRatio:I}=d;v.fill!==n&&(v=Sn({fill:i.activeColor,devicePixelRatio:I}));const M=e.sharer,z={scale:f,offsetLeft:g,offsetTop:m,offsetRight:y,offsetBottom:w},R={width:x,height:S,contextHeight:b,contextWidth:A,devicePixelRatio:I},C=u[Oo],E=C[0],T=u[Po],P=u[Lo],L=u[Ro],O=u[Eo],k=u[To],W=u[jo],D=u[Yo],j=u[No],Y=u[Fo],N={calculator:l,viewScaleInfo:z,viewSizeInfo:R,style:c};let B=u[Wo];var F,G;B&&1===C.length&&E&&(F=E,G=B.originalElementSize,(F.x!==G.x||F.y!==G.y||F.h!==G.h||F.w!==G.w||It(F.angle||0)!==It(G.angle||0))&&(B=Vt(E,{groupQueue:W||[],controllerSize:10,viewScaleInfo:z,rotateControllerPosition:22,rotateControllerSize:20}),M.setSharedStorage(Wo,B)));const V=!!(null==(o=null==T?void 0:T.operations)?void 0:o.locked);if((null==W?void 0:W.length)>0){if(function(e,t,i){const{style:o}=i,{activeColor:n}=o;for(let o=0;o<t.length;o++){const r={borderColor:n,borderWidth:2,background:"transparent",lineDash:[4,4]};Vo(e,jt(t[o],i),r)}}(s,D,N),T&&"drag"!==L&&(V?Uo(s,P,{...N,controller:B,style:c}):Qo(s,P,N)),E&&["select","drag","resize"].includes(L)&&($o(s,B,{...N,element:E,hideControllers:!!j&&"drag"===L,rotateControllerPattern:v.context2d,style:c}),"drag"===L&&!0===Y)){const e=hn(E.uuid,{calculator:l,data:d.data,groupQueue:W,viewScaleInfo:z,viewSizeInfo:R});if(e){const{offsetX:t,offsetY:i,xLines:o,yLines:n}=e;0!==t&&0!==i||Jo(s,{xLines:o,yLines:n,style:c})}}}else if(T&&"drag"!==L&&(V?Uo(s,P,{...N,controller:B,style:c}):Qo(s,P,N)),E&&["select","drag","resize"].includes(L)){if($o(s,B,{...N,element:E,hideControllers:!!j&&"drag"===L,rotateControllerPattern:v.context2d,style:c}),"drag"===L&&!0===Y){const e=hn(E.uuid,{calculator:l,data:d.data,groupQueue:W,viewScaleInfo:z,viewSizeInfo:R});if(e){const{offsetX:t,offsetY:i,xLines:o,yLines:n}=e;0!==t&&0!==i||Jo(s,{xLines:o,yLines:n,style:c})}}}else if("area"===L&&O&&k)!function(e,t){const{start:i,end:o,style:n}=t,{activeColor:r,activeAreaColor:l}=n;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=r,e.fillStyle=l,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill("nonzero")}(s,{start:O,end:k,style:c});else if(["drag-list","drag-list-end"].includes(L)){const e=rn(p(),{viewScaleInfo:M.getActiveViewScaleInfo(),viewSizeInfo:M.getActiveViewSizeInfo()});e&&function(e,t){const{areaSize:i,style:o}=t,{activeColor:n,activeAreaColor:r}=o,{x:l,y:a,w:s,h:h}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=n,e.fillStyle=r,e.beginPath(),e.moveTo(l,a),e.lineTo(l+s,a),e.lineTo(l+s,a+h),e.lineTo(l,a+h),e.closePath(),e.stroke(),e.fill("nonzero")}(s,{areaSize:e,style:c})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o,sharer:n,calculator:r}=e,l=i.boardContext.canvas,a=e.container||document.body;let s=document.createElement("div");s.setAttribute("contenteditable","true");let h=document.createElement("div"),c=document.createElement("div"),d=null,u=[],f="";const g=`idraw-middleware-text-editor-${Math.random().toString(26).substring(2)}`;c.setAttribute("id",g),h.appendChild(s),h.style.position="absolute",c.appendChild(h),c.style.position="fixed",c.style.top="0",c.style.bottom="0",c.style.left="0",c.style.right="0",c.style.display="none",a.appendChild(c);const v=()=>{if(null==d?void 0:d.uuid){const e=n.getActiveOverrideElemenentMap();e&&delete e[d.uuid],n.setActiveOverrideElemenentMap(e),o.drawFrame()}c.style.display="none",d=null,u=[]},m=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:r,w:l,h:a}=t,s=It(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${r}px`,o.style.width=`${l}px`,o.style.height=`${a}px`,o.style.transform=`rotate(${s}deg)`,i.appendChild(o),o},y=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:r,offsetLeft:l}=t;h.children&&Array.from(h.children).forEach((e=>{e.remove()}));let a=h;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:s,w:h,h:c}=t,d={x:i*n,y:s*n,w:h*n,h:c*n,angle:It(t.angle||0)};0===e&&(d.x+=l,d.y+=r),a=m({size:d,parent:a})}const c={...Xn,...i.detail};let d=i.x*n+l,u=i.y*n+r,f=i.w*n,g=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,f=i.w*n,g=i.h*n);let v="center",y="center";"left"===c.textAlign?v="start":"right"===c.textAlign&&(v="end"),"top"===c.verticalAlign?y="start":"bottom"===c.verticalAlign&&(y="end"),s.style.display="inline-flex",s.style.justifyContent=v,s.style.alignItems=y,s.style.position="absolute",s.style.left=d-1+"px",s.style.top=u-1+"px",s.style.width=`${f+2}px`,s.style.height=`${g+2}px`,s.style.transform=`rotate(${It(i.angle||0)}deg)`,s.style.boxSizing="border-box",s.style.border="1px solid #1973ba",s.style.resize="none",s.style.overflow="hidden",s.style.wordBreak="break-all",s.style.borderRadius=("number"==typeof c.borderRadius?c.borderRadius:0)*n+"px",s.style.background=`${c.background||"transparent"}`,s.style.color=`${c.color||"#333333"}`,s.style.fontSize=c.fontSize*n+"px",s.style.lineHeight=(c.lineHeight||c.fontSize)*n+"px",s.style.fontFamily=mi(c.fontFamily),s.style.fontWeight=`${c.fontWeight}`,s.style.padding="0",s.style.margin="0",s.style.outline="none",s.innerText=c.text||"",a.appendChild(s)},p=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=l.getBoundingClientRect(),{left:t,top:i,width:o,height:n}=e;return{left:t,top:i,width:o,height:n}})();h.style.position="absolute",h.style.overflow="hidden",h.style.top=`${t}px`,h.style.left=`${e}px`,h.style.width=`${i}px`,h.style.height=`${o}px`},w=()=>{v()},x=e=>{e.stopPropagation()},S=()=>{d&&u&&(d.detail.text=s.innerText||"",t.trigger(Ao.TEXT_CHANGE,{element:{uuid:d.uuid,detail:{text:d.detail.text}},position:[...u||[]]}),r.modifyText(d),o.drawFrame())},b=()=>{if(d&&u){d.detail.text=s.innerText||"",t.trigger(Ao.TEXT_CHANGE,{element:{uuid:d.uuid,detail:{text:d.detail.text}},position:[...u]});const e=n.getActiveStorage("data")||{elements:[]},i={detail:{text:d.detail.text}};fi(d.uuid,i,e.elements),t.trigger(Ao.CHANGE,{selectedElements:[{...d,detail:{...d.detail,...i.detail}}],data:e,type:"modifyElement",modifyRecord:{type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:d.uuid,before:{"detail.text":f},after:{"detail.text":d.detail.text}}}}),r.modifyText(d),o.drawFrame()}v()},A=e=>{e.stopPropagation()},I=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},z=e=>{e.stopPropagation(),e.preventDefault()};c.addEventListener("click",w),s.addEventListener("click",x),s.addEventListener("input",S),s.addEventListener("blur",b),s.addEventListener("keydown",A),s.addEventListener("keypress",I),s.addEventListener("keyup",M),s.addEventListener("wheel",z);const R=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(d=e.element,u=e.position),(e=>{p(),y(e),c.style.display="block",f="",(null==d?void 0:d.uuid)&&(n.setActiveOverrideElemenentMap({[d.uuid]:{operations:{invisible:!0}}}),f=d.detail.text||"",o.drawFrame())})(e)};return{name:"@middleware/text-editor",use(){t.on(Ao.TEXT_EDIT,R)},disuse(){t.off(Ao.TEXT_EDIT,R),c.removeEventListener("click",w),s.removeEventListener("click",x),s.removeEventListener("input",S),s.removeEventListener("blur",b),s.removeEventListener("keydown",A),s.removeEventListener("keypress",I),s.removeEventListener("keyup",M),s.removeEventListener("wheel",z),h.removeChild(s),c.removeChild(h),a.removeChild(c),s.remove(),h.remove(),c=null,s=null,h=null,c=null,d=null,u=null,f=null}}},e.Sharer=mo,e.coreEventKeys=Ao,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
|
1
|
+
var iDrawCore=function(e){"use strict";var t,i,o,n,r,l,a,s,h,c,d,u,f,g,v,m,y,p,w,x,S,b,A,I,M,z,R,C,E,T,P,L,O,k,W,D,j,Y,N,B,F,G,V,X,H,Z,Q,U,$,J,K,q,_,ee,te,ie,oe,ne,re,le,ae,se,he,ce,de,ue,fe,ge,ve,me=e=>{throw TypeError(e)},ye=(e,t,i)=>t.has(e)||me("Cannot "+i),pe=(e,t,i)=>(ye(e,t,"read from private field"),i?i.call(e):t.get(e)),we=(e,t,i)=>t.has(e)?me("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),xe=(e,t,i,o)=>(ye(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),Se=(e,t,i)=>(ye(e,t,"access private method"),i);function be(e){return"string"==typeof e&&(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function Ae(e,t){if(1===t)return e;let i=1;const o=/^#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^#/,"0x")):/^#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function Ie(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function Me(e,t){let i=0;for(let t=0;t<e.length;t++)i+=e.charCodeAt(t);return(i+t).toString(16).substring(0,4)}function ze(e,t){const i=e.length,o=function(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i);return t}(t),n=Math.floor(i/2),r=e.substring(0,4).padStart(4,"0"),l=e.substring(0,4).padStart(4,"0");return`@assets/${Me(i.toString(16).padStart(4,r),o).padStart(4,"0")}${Me(e.substring(n-4,n).padStart(4,r),o).padStart(4,"0")}-${Me(e.substring(n-8,n-4).padStart(4,r),o).padStart(4,"0")}-${Me(e.substring(n-12,n-8).padStart(4,r),o).padStart(4,"0")}-${Me(e.substring(n-16,n-12).padStart(4,l),o).padStart(4,"0")}-${Me(e.substring(n,n+4).padStart(4,l),o).padStart(4,"0")}${Me(e.substring(n+4,n+8).padStart(4,l),o).padStart(4,"0")}${Me(l.padStart(4,r).padStart(4,l),o)}`}function Re(e){return/^@assets\/[0-9a-z-]{0,}$/.test(`${e}`)}function Ce(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function Ee(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const Te={type(e,t){const i=Ee(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===Ee(e),json:e=>"Object"===Ee(e),function:e=>"Function"===Ee(e),asyncFunction:e=>"AsyncFunction"===Ee(e),boolean:e=>"Boolean"===Ee(e),string:e=>"String"===Ee(e),number:e=>"Number"===Ee(e),undefined:e=>"Undefined"===Ee(e),null:e=>"Null"===Ee(e),promise:e=>"Promise"===Ee(e)};var Pe=function(e,t,i,o){return new(i||(i=Promise))((function(n,r){function l(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,a)}s((o=o.apply(e,t||[])).next())}))};const{Image:Le}=window;function Oe(e){return new Promise(((t,i)=>{const o=new Le;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function ke(e){return Pe(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield Oe(t)}))}function We(e,t){return Pe(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const r=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),l=new FileReader;l.readAsDataURL(r),l.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},l.onerror=function(e){n(e)}}))}(e,t);return yield Oe(i)}))}function De(e){return"number"==typeof e&&e>=0}function je(e){return"number"==typeof e&&(e>0||e<=0)}function Ye(e){return je(e)}function Ne(e){return je(e)}function Be(e){return De(e)}function Fe(e){return De(e)}function Ge(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function Ve(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}function Xe(e){return["rect","circle","text","image","svg","html","group"].includes(e)}const He={positiveNum:De,data:function(e){return!!(Array(null==e?void 0:e.elements)&&(null==e?void 0:e.elements.length)>=0)},element:function(e){return!!e&&(Xe(null==e?void 0:e.type)&&Ye(null==e?void 0:e.x)&&Ne(null==e?void 0:e.y)&&Be(null==e?void 0:e.w)&&Fe(null==e?void 0:e.h))},layout:function(e){return!!e&&(Ye(null==e?void 0:e.x)&&Ne(null==e?void 0:e.y)&&Be(null==e?void 0:e.w)&&Fe(null==e?void 0:e.h))},type:Xe,x:Ye,y:Ne,w:Be,h:Fe,angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:je,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return De(e)||Array.isArray(e)&&De(e[0])&&De(e[1])&&De(e[2])&&De(e[3])},borderRadius:function(e){return De(e)||Array.isArray(e)&&De(e[0])&&De(e[1])&&De(e[2])&&De(e[3])},color:function(e){return be(e)},imageSrc:function(e){return Ve(e)||Ge(e)},imageURL:Ge,imageBase64:Ve,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return je(e)&&e>0},lineHeight:function(e){return je(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return je(e)&&e>0}};var Ze,Qe,Ue=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},$e=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Je{constructor(e,t){Ze.set(this,void 0),Qe.set(this,void 0),Ue(this,Ze,e,"f"),Ue(this,Qe,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/$e(this,Qe,"f").devicePixelRatio}$doPixelRatio(e){return $e(this,Qe,"f").devicePixelRatio*e}$getContext(){return $e(this,Ze,"f")}$setContext(e){Ue(this,Ze,e,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),$e(this,Ze,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return $e(this,Qe,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:r}=$e(this,Ze,"f");r.width=t*o,r.height=i*o,Ue(this,Qe,Object.assign(Object.assign({},$e(this,Qe,"f")),{devicePixelRatio:o}),"f"),!0===n&&(r.style.width=`${t}px`,r.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=$e(this,Qe,"f"),{width:t,height:i}=$e(this,Ze,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return $e(this,Ze,"f").canvas}get fillStyle(){return $e(this,Ze,"f").fillStyle}set fillStyle(e){$e(this,Ze,"f").fillStyle=e}get strokeStyle(){return $e(this,Ze,"f").strokeStyle}set strokeStyle(e){$e(this,Ze,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio($e(this,Ze,"f").lineWidth)}set lineWidth(e){$e(this,Ze,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return $e(this,Ze,"f").textAlign}set textAlign(e){$e(this,Ze,"f").textAlign=e}get textBaseline(){return $e(this,Ze,"f").textBaseline}set textBaseline(e){$e(this,Ze,"f").textBaseline=e}get globalAlpha(){return $e(this,Ze,"f").globalAlpha}set globalAlpha(e){$e(this,Ze,"f").globalAlpha=e}get shadowColor(){return $e(this,Ze,"f").shadowColor}set shadowColor(e){$e(this,Ze,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio($e(this,Ze,"f").shadowOffsetX)}set shadowOffsetX(e){$e(this,Ze,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio($e(this,Ze,"f").shadowOffsetY)}set shadowOffsetY(e){$e(this,Ze,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio($e(this,Ze,"f").shadowBlur)}set shadowBlur(e){$e(this,Ze,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return $e(this,Ze,"f").lineCap}set lineCap(e){$e(this,Ze,"f").lineCap=e}get globalCompositeOperation(){return $e(this,Ze,"f").globalCompositeOperation}set globalCompositeOperation(e){$e(this,Ze,"f").globalCompositeOperation=e}fill(...e){return $e(this,Ze,"f").fill(...e)}arc(e,t,i,o,n,r){return $e(this,Ze,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,r)}rect(e,t,i,o){return $e(this,Ze,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return $e(this,Ze,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return $e(this,Ze,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return $e(this,Ze,"f").beginPath()}closePath(){return $e(this,Ze,"f").closePath()}lineTo(e,t){return $e(this,Ze,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return $e(this,Ze,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return $e(this,Ze,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}bezierCurveTo(e,t,i,o,n,r){return $e(this,Ze,"f").bezierCurveTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(r))}quadraticCurveTo(e,t,i,o){return $e(this,Ze,"f").quadraticCurveTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}getLineDash(){return $e(this,Ze,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return $e(this,Ze,"f").setLineDash(t)}stroke(e){return e?$e(this,Ze,"f").stroke(e):$e(this,Ze,"f").stroke()}translate(e,t){return $e(this,Ze,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return $e(this,Ze,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],r=e[4],l=e[e.length-4],a=e[e.length-3],s=e[e.length-2],h=e[e.length-1];return 9===e.length?$e(this,Ze,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(r),this.$doPixelRatio(l),this.$doPixelRatio(a),this.$doPixelRatio(s),this.$doPixelRatio(h)):$e(this,Ze,"f").drawImage(t,this.$doPixelRatio(l),this.$doPixelRatio(a),this.$doPixelRatio(s),this.$doPixelRatio(h))}createPattern(e,t){return $e(this,Ze,"f").createPattern(e,t)}measureText(e){return $e(this,Ze,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?$e(this,Ze,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):$e(this,Ze,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?$e(this,Ze,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):$e(this,Ze,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){$e(this,Ze,"f").save()}restore(){$e(this,Ze,"f").restore()}scale(e,t){$e(this,Ze,"f").scale(e,t)}circle(e,t,i,o,n,r,l,a){$e(this,Ze,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,r,l,a)}isPointInPath(e,t){return $e(this,Ze,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return $e(this,Ze,"f").clip(...e)}setTransform(e,t,i,o,n,r){return $e(this,Ze,"f").setTransform(e,t,i,o,n,r)}getTransform(){return $e(this,Ze,"f").getTransform()}createLinearGradient(e,t,i,o){return $e(this,Ze,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,r){return $e(this,Ze,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(r))}createConicGradient(e,t,i){return $e(this,Ze,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function Ke(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),r=n.getContext("2d").canvas.getContext("2d");return new Je(r,{devicePixelRatio:o,offscreenCanvas:n})}function qe(e,t){const{width:i,height:o,devicePixelRatio:n}=t,r={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d"),a=Ke(r),s=Ke(r),h=Ke(r),c=function(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let r=o;if(!r){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,r=e.getContext("2d")}return new Je(r,e)}(Object.assign({ctx:l},r)),d=Ke(r);return{underlayContext:h,viewContext:a,overlayContext:s,boardContext:c,tempContext:d,drawView:()=>{const{width:e,height:t}=a.$getSize();c.clearRect(0,0,e,t),c.drawImage(h.canvas,0,0,e,t),c.drawImage(a.canvas,0,0,e,t),c.drawImage(s.canvas,0,0,e,t),h.clearRect(0,0,e,t),a.clearRect(0,0,e,t),s.clearRect(0,0,e,t)}}}Ze=new WeakMap,Qe=new WeakMap;var _e,et=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class tt{constructor(){_e.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,_e,new Map,"f")}on(e,t){if(et(this,_e,"f").has(e)){const i=et(this,_e,"f").get(e)||[];null==i||i.push(t),et(this,_e,"f").set(e,i)}else et(this,_e,"f").set(e,[t])}off(e,t){if(et(this,_e,"f").has(e)){const i=et(this,_e,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}et(this,_e,"f").set(e,i||[])}}trigger(e,t){const i=et(this,_e,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(et(this,_e,"f").has(e)){const t=et(this,_e,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){et(this,_e,"f").clear()}}function it(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}_e=new WeakMap;var ot,nt,rt,lt,at,st=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ht=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class ct{constructor(e){ot.add(this),nt.set(this,void 0),rt.set(this,void 0),lt.set(this,void 0),st(this,rt,Ce(e.defaultStorage),"f"),st(this,nt,ht(this,ot,"m",at).call(this),"f"),st(this,lt,e.defaultStatic||{},"f")}set(e,t){ht(this,nt,"f")[e]=t}get(e){return ht(this,nt,"f")[e]}setStatic(e,t){ht(this,lt,"f")[e]=t}getStatic(e){return ht(this,lt,"f")[e]}getSnapshot(e){return!0===(null==e?void 0:e.deepClone)?Ce(ht(this,nt,"f")):Object.assign({},ht(this,nt,"f"))}clear(){st(this,nt,ht(this,ot,"m",at).call(this),"f")}destroy(){st(this,nt,null,"f"),st(this,lt,null,"f")}}function dt(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function ut(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function ft(e){return e/180*Math.PI}function gt(e,t,i,o){const n=ft(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function vt(e,t,i){const o=mt(t);gt(e,t.angle||0,o,(()=>{i(e)}))}function mt(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function yt(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return mt({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function pt(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}function wt(e,t,i){let o=pt(e,t)+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 n=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let r=0,l=0;return 0===o?(r=0,l=0-n):o>0&&o<Math.PI/2?(r=Math.sin(o)*n,l=0-Math.cos(o)*n):o===Math.PI/2?(r=n,l=0):o>Math.PI/2&&o<Math.PI?(r=Math.sin(Math.PI-o)*n,l=Math.cos(Math.PI-o)*n):o===Math.PI?(r=0,l=n):o>Math.PI&&o<1.5*Math.PI?(r=0-Math.sin(o-Math.PI)*n,l=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(r=0-n,l=0):o>1.5*Math.PI&&o<2*Math.PI?(r=0-Math.sin(2*Math.PI-o)*n,l=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(r=0,l=0-n),r+=e.x,l+=e.y,{x:r,y:l}}function xt(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:r,h:l,angle:a=0}=e,s=wt(mt({x:t,y:n,w:r,h:l}),{x:i,y:o},ft(a));i=s.x,o=s.y})),{x:i,y:o}}return e}function St(e,t,i){const{x:o,y:n,w:r,h:l}=e;let a={x:o,y:n},s={x:o+r,y:n},h={x:o+r,y:n+l},c={x:o,y:n+l};if(i&&(i>0||i<0)){const e=ft(It(i));a=wt(t,a,e),s=wt(t,s,e),h=wt(t,h,e),c=wt(t,c,e)}return[a,s,h,c]}function bt(e){const{angle:t=0}=e;return St(e,mt(e),t)}function At(e,t,i){return[wt(e,{x:t[0].x,y:t[0].y},i),wt(e,{x:t[1].x,y:t[1].y},i),wt(e,{x:t[2].x,y:t[2].y},i),wt(e,{x:t[3].x,y:t[3].y},i)]}function It(e){if(!(e>0||e<0)||0===e||360===e)return 0;let t=e%360;return t<0?t+=360:360===e&&(t=0),t}function Mt(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=Mt(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function zt(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=bt(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),r=Math.max(t.x+t.w,i.x+i.w),l=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(r-o),i.h=Math.abs(l-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function Rt(e,t){var i;const o=[];let n=e;if(t.length>1)for(let e=0;e<t.length-1;e++){const r=n[t[e]];if("group"!==(null==r?void 0:r.type)||!Array.isArray(null===(i=null==r?void 0:r.detail)||void 0===i?void 0:i.children))return null;o.push(r),n=r.detail.children}return o}function Ct(e){const{x:t,y:i,w:o,h:n,angle:r}=e;return{x:t,y:i,w:o,h:n,angle:r}}function Et(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===(null==n?void 0:n.type))o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}function Tt(e,t){const i=[];let o=!1;const n=t=>{var r;for(let l=0;l<t.length&&!0!==o;l++){i.push(l);const a=t[l];if(a.uuid===e){o=!0;break}if("group"===a.type&&n((null===(r=null==a?void 0:a.detail)||void 0===r?void 0:r.children)||[]),o)break;i.pop()}};return n(t),i}function Pt(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function Lt(e){const{x:t,y:i,w:o,h:n,angle:r=0}=e;return 0===r?Pt(e):St(e,mt({x:t,y:i,w:o,h:n}),r)}function Ot(e){const t=[];let i=0,o=0;const n=[],r=[...e];for(let e=0;e<r.length;e++){const{x:l,y:a,w:s,h:h,angle:c=0}=r[e];let d;if(i+=l,o+=a,0===e){const e={x:i,y:o,w:s,h:h};d=Lt({x:l,y:a,w:s,h:h,angle:c}),n.push({center:mt(e),angle:c,radian:ft(c)})}else{d=Pt({x:i,y:o,w:s,h:h});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=At(t,d,i)}const e=yt(d);if(c>0||c<0){d=At(e,d,ft(c))}n.push({center:e,angle:c,radian:ft(c)})}t.push(d)}return t}function kt(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Ot([...i,e]):[Lt(e)]}(e,t);return i.pop()||null}function Wt(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:r,h:l,angle:a}=e,{scale:s,offsetTop:h,offsetLeft:c}=i;return{x:o*s+c,y:n*s+h,w:r*s,h:l*s,angle:a}}function Dt(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:r,offsetTop:l,offsetLeft:a}=i;return{x:o*r+a,y:n*r+l}}function jt(e,t){return[Dt(e[0],t),Dt(e[1],t),Dt(e[2],t),Dt(e[3],t)]}function Yt(e,t){const{context2d:i,element:o,viewScaleInfo:n}=t,{angle:r=0}=o,{x:l,y:a,w:s,h:h}=Wt(o,{viewScaleInfo:n}),c=bt({x:l,y:a,w:s,h:h,angle:r});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let e=1;e<c.length;e++)i.lineTo(c[e].x,c[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function Nt(e,t,i){const o=[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],r=Math.min(...o),l=Math.max(...o),a=Math.min(...n),s=Math.max(...n);return e.x>r&&e.x<l&&e.y>a&&e.y<s}function Bt(e,t){const{groupQueue:i}=t,o=kt(e,{groupQueue:i}),n=it(o[0],o[1]),r=it(o[1],o[2]),l=it(o[2],o[3]),a=it(o[3],o[0]),s=o[0],h=o[1],c=o[2],d=o[3],u=Math.max(s.x,h.x,c.x,d.x),f=Math.max(s.y,h.y,c.y,d.y);return{center:{x:(u+Math.min(s.x,h.x,c.x,d.x))/2,y:(f+Math.min(s.y,h.y,c.y,d.y))/2},topLeft:s,topRight:h,bottomLeft:d,bottomRight:c,top:n,right:r,left:a,bottom:l}}function Ft(e){const t=Math.max(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),i=Math.max(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),o=Math.min(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),r={x:e.center.x,y:e.center.y},l={x:o,y:n},a={x:t,y:n},s={x:t,y:i},h={x:o,y:i},c=it(l,a),d=it(h,s),u=it(l,h);return{center:r,topLeft:l,topRight:a,bottomLeft:h,bottomRight:s,top:c,right:it(a,s),left:u,bottom:d}}function Gt(e,t){const{x:i,y:o}=e,{size:n,angle:r}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:r}}function Vt(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n,rotateControllerSize:r,rotateControllerPosition:l}=t,a=(o&&o>0?o:8)/n.scale,{x:s,y:h,w:c,h:d,angle:u=0}=e,f=r,g=l,v=[{uuid:Ie(),x:s,y:h,w:c,h:d,angle:u,type:"group",detail:{children:[]}},...i];let m=0;v.forEach((({angle:e=0})=>{m+=e}));const y=kt(e,{groupQueue:i}),p=kt({x:s,y:h-(g+f/2)/n.scale,h:d+(2*g+f)/n.scale,w:c,angle:u},{groupQueue:[...i]}),w=it(y[0],y[1]),x=it(y[1],y[2]),S=it(y[2],y[3]),b=it(y[3],y[0]),A=y[0],I=y[1],M=y[2],z=y[3],R=Gt(w,{size:a,angle:m}),C=Gt(x,{size:a,angle:m}),E=Gt(S,{size:a,angle:m}),T=Gt(b,{size:a,angle:m}),P=Gt(A,{size:a,angle:m}),L=Gt(I,{size:a,angle:m}),O=Gt(z,{size:a,angle:m}),k=Gt(M,{size:a,angle:m}),W=Lt(P),D=Lt(L),j=Lt(O),Y=Lt(k),N=[W[1],D[0],D[3],W[2]],B=[D[3],D[2],Y[1],Y[0]],F=[j[1],Y[0],Y[3],j[2]],G=[W[3],W[2],j[1],j[0]],V=Lt(R),X=Lt(C),H=Lt(E),Z=Lt(T),Q=it(p[0],p[1]),U=Lt(Gt(Q,{size:1.1*r/n.scale,angle:m}));return{originalElementCenter:mt(e),originalElementSize:Object.assign({},e),elementWrapper:y,left:{type:"left",vertexes:G,center:b,size:a},right:{type:"right",vertexes:B,center:x,size:a},top:{type:"top",vertexes:N,center:w,size:a},bottom:{type:"bottom",vertexes:F,center:S,size:a},topLeft:{type:"top-left",vertexes:W,center:A,size:a},topRight:{type:"top-right",vertexes:D,center:I,size:a},bottomLeft:{type:"bottom-left",vertexes:j,center:z,size:a},bottomRight:{type:"bottom-right",vertexes:Y,center:M,size:a},leftMiddle:{type:"left-middle",vertexes:Z,center:b,size:a},rightMiddle:{type:"right-middle",vertexes:X,center:x,size:a},topMiddle:{type:"top-middle",vertexes:V,center:w,size:a},bottomMiddle:{type:"bottom-middle",vertexes:H,center:S,size:a},rotate:{type:"rotate",vertexes:U,center:Q,size:r}}}function Xt(e,t){const{controllerSize:i,viewScaleInfo:o}=t,n=i&&i>0?i:8,{x:r,y:l,w:a,h:s}=Wt(e,{viewScaleInfo:o}),h=mt({x:r,y:l,w:a,h:s}),c={x:h.x,y:l},d={x:r+a,y:h.y},u={x:h.x,y:l+s},f={x:r,y:h.y},g={x:r,y:l},v={x:r+a,y:l},m={x:r+a,y:l+s},y={x:r,y:l+s},p=Gt(c,{size:n,angle:0}),w=Gt(d,{size:n,angle:0}),x=Gt(u,{size:n,angle:0}),S=Gt(f,{size:n,angle:0}),b=Gt(g,{size:n,angle:0}),A=Gt(v,{size:n,angle:0}),I=Gt(y,{size:n,angle:0}),M=Gt(m,{size:n,angle:0}),z=Lt(b),R=Lt(A),C=Lt(I),E=Lt(M),T=[z[1],R[0],R[3],z[2]],P=[R[3],R[2],E[1],E[0]],L=[C[1],E[0],E[3],C[2]],O=[z[3],z[2],C[1],C[0]],k=Lt(p),W=Lt(w),D=Lt(x);return{left:{type:"left",vertexes:O,center:f,size:n},right:{type:"right",vertexes:P,center:d,size:n},top:{type:"top",vertexes:T,center:c,size:n},bottom:{type:"bottom",vertexes:L,center:u,size:n},topLeft:{type:"top-left",vertexes:z,center:g,size:n},topRight:{type:"top-right",vertexes:R,center:v,size:n},bottomLeft:{type:"bottom-left",vertexes:C,center:y,size:n},bottomRight:{type:"bottom-right",vertexes:E,center:m,size:n},leftMiddle:{type:"left-middle",vertexes:Lt(S),center:f,size:n},rightMiddle:{type:"right-middle",vertexes:W,center:d,size:n},topMiddle:{type:"top-middle",vertexes:k,center:c,size:n},bottomMiddle:{type:"bottom-middle",vertexes:D,center:u,size:n}}}function Ht(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function Zt(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}nt=new WeakMap,rt=new WeakMap,lt=new WeakMap,ot=new WeakSet,at=function(){return Ce(ht(this,rt,"f"))};const Qt="Text Element";const Ut={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 $t(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{borderDash:r}=e.detail,l=Array.isArray(r)&&r.length>0,{boxSizing:a=Ut.boxSizing,borderWidth:s}=e.detail;Array.isArray(s)&&(n=0);let{x:h,y:c,w:d,h:u}=e,f=[0,0,0,0];if("number"==typeof n){const e=n*o;f=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(f=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let g=0;return"number"==typeof s&&(g=(s||0)*o),"border-box"!==a||l?"content-box"===a?(h=e.x-g/2,c=e.y-g/2,d=e.w+g,u=e.h+g):(h=e.x,c=e.y,d=e.w,u=e.h):(h=e.x+g/2,c=e.y+g/2,d=e.w-g,u=e.h-g),d=Math.max(d,1),u=Math.max(u,1),f=f.map((e=>Math.min(e,d/2,u/2))),{x:h,y:c,w:d,h:u,radiusList:f}}function Jt(e,t="",i={},o){return Object.keys(e).forEach((n=>{var r;const l=t?`${t}${function(e){return/^\d+$/.test(e)&&!isNaN(Number(e))}(n)?`[${n}]`:`.${n}`}`:n;if(!(null===(r=null==o?void 0:o.ignorePaths)||void 0===r?void 0:r.includes(l))){const t=e[n];!function(e){return"object"==typeof e&&null!==e&&!(e instanceof Date)||Array.isArray(e)}(t)?i[l]=t:Jt(t,(Array.isArray(t),l),i,o)}})),i}function Kt(e,t){return"object"!=typeof e||null===e?{"":e}:Jt(e,"",{},t)}function qt(e){return Kt(e,{ignorePaths:["detail.children"]})}function _t(e){return Kt(e)}function ei(e){return Kt(e)}function ti(e){return Array.isArray(e)?[...e]:e.split(/\.|\[|\]/).filter((e=>""!==e))}function ii(e,t,i){if(!t)return;const o=ti(t);let n=e;for(const e of o){if(null==n)return i;n=n[e]}return void 0!==n?n:i}function oi(e,t,i){const o=ti(t);if(0===o.length)return e;let n=e;if(n)for(let e=0;e<o.length;e++){const t=o[e];if(e===o.length-1){n[t]=i;break}if(n&&(void 0===(null==n?void 0:n[t])||"object"!=typeof(null==n?void 0:n[t])||null===(null==n?void 0:n[t]))){const i=o[e+1],r=/^\d+$/.test(i);n[t]=r?[]:{}}n=null==n?void 0:n[t]}return e}function ni(e,t){const i=ti(t);if(0===i.length)return e;let o=e;if(o)for(let e=0;e<i.length;e++){const t=i[e];if(e===i.length-1){delete o[t];break}if(o&&(void 0===(null==o?void 0:o[t])||"object"!=typeof(null==o?void 0:o[t])||null===(null==o?void 0:o[t]))){const n=i[e+1],r=/^\d+$/.test(n);o[t]=r?[]:{}}o=null==o?void 0:o[t]}return e}const ri=e=>Zt(e,{decimalPlaces:4});function li(e,t){const i={detail:{}},o={detail:{}},n={type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:e.uuid,before:null,after:null}},{detail:r}=e,{xRatio:l,yRatio:a,maxRatio:s}=t,h=(l+a)/2,{borderWidth:c,borderRadius:d,borderDash:u,shadowOffsetX:f,shadowOffsetY:g,shadowBlur:v}=r;if("number"==typeof c)r.borderWidth=ri(c*h),i.detail.borderWidth=c,o.detail.borderWidth=r.borderWidth;else if(Array.isArray(r.borderWidth)){const e=c;r.borderWidth=[ri(e[0]*a),ri(e[1]*l),ri(e[2]*a),ri(e[3]*l)],i.detail.borderWidth=[...e],o.detail.borderWidth=[...r.borderWidth]}if("number"==typeof d)r.borderRadius=ri(d*h),i.detail.borderRadius=d,o.detail.borderRadius=r.borderRadius;else if(Array.isArray(r.borderRadius)){const e=d;r.borderRadius=[e[0]*l,e[1]*l,e[2]*a,e[3]*a],i.detail.borderRadius=[...e],o.detail.borderRadius=[...r.borderRadius]}return Array.isArray(u)&&(u.forEach(((e,t)=>{r.borderDash[t]=ri(e*s)})),i.detail.borderDash=[...u],o.detail.borderDash=[...r.borderDash]),"number"==typeof f&&(r.shadowOffsetX=ri(f*s),i.detail.shadowOffsetX=f,o.detail.shadowOffsetX=r.shadowOffsetX),"number"==typeof g&&(r.shadowOffsetY=ri(g*s),i.detail.shadowOffsetY=g,o.detail.shadowOffsetY=r.shadowOffsetY),"number"==typeof v&&(r.shadowBlur=ri(v*s),i.detail.shadowBlur=v,o.detail.shadowBlur=r.shadowBlur),n.content.before=qt(i),n.content.after=qt(o),n}function ai(e,t,i){const{type:o,uuid:n}=e,r=function(e,t){const{xRatio:i,yRatio:o}=t,{uuid:n,x:r,y:l,w:a,h:s}=e;e.x=ri(r*i),e.y=ri(l*o),e.w=ri(a*i),e.h=ri(s*o);const h={type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:n,before:{x:r,y:l,w:a,h:s},after:{x:e.x,y:e.y,w:e.w,h:e.h}}},c=li(e,t);return h.content.before=Object.assign(Object.assign({},h.content.before),c.content.before),h.content.after=Object.assign(Object.assign({},h.content.after),c.content.after),h}(e,t),l=Object.assign(Object.assign({},r.content.before),{uuid:n}),a=Object.assign(Object.assign({},r.content.after),{uuid:n});if(null==i||i.content.before.push(l),null==i||i.content.after.push(a),"circle"===o);else if("text"===o){const i=function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:r}=e.detail,l=(i+o)/2,a={},s={};return n&&n>0&&(e.detail.fontSize=ri(n*l),a["detail.fontSize"]=n,s["detail.fontSize"]=e.detail.fontSize),r&&r>0&&(e.detail.lineHeight=ri(r*l),a["detail.lineHeight"]=r,s["detail.lineHeight"]=e.detail.lineHeight),{type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:e.uuid,before:a,after:s}}}(e,t);Object.keys(i.content.before||{}).forEach((e=>{var t;l[e]=null===(t=i.content.before)||void 0===t?void 0:t[e]})),Object.keys(i.content.after||{}).forEach((e=>{var t;a[e]=null===(t=i.content.after)||void 0===t?void 0:t[e]}))}else"image"===o||"svg"===o||"html"===o||"path"===o||"group"===o&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{ai(e,t,i)}))}function si(e,t,i){const o={type:"resizeElements",time:Date.now(),content:{method:"modifyElements",before:[],after:[]}},n=e.uuid,r=e.x,l=e.y,a=e.w,s=e.h,h=Te.number(t.x)?t.x:e.x,c=Te.number(t.y)?t.y:e.y,d=(t.w&&t.w>0?t.w:e.w)||0,u=(t.h&&t.h>0?t.h:e.h)||0,f={uuid:n,x:r,y:l,w:a,h:s},g={uuid:n,x:h,y:c,w:d,h:u};if("deepResize"===(null==i?void 0:i.resizeEffect)){o.content.before.push(f),o.content.after.push(g);const t=d/e.w,i=u/e.h;if(t===i&&1===t)return o;const n=Math.min(t,i),r=Math.max(t,i);e.w=d,e.h=u;const l={xRatio:t,yRatio:i,minRatio:n,maxRatio:r};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{ai(e,l,o)}));const a=li(e,l);return Object.keys(a.content.before||{}).forEach((e=>{var t;f[e]=null===(t=a.content.before)||void 0===t?void 0:t[e]})),Object.keys(a.content.after||{}).forEach((e=>{var t;g[e]=null===(t=a.content.after)||void 0===t?void 0:t[e]})),o}if("fixed"===(null==i?void 0:i.resizeEffect)){o.content.before.push(f),o.content.after.push(g);const t=h-e.x,i=c-e.y,n=d-e.w;return function(e,t,i){if("group"!==e.type||!Array.isArray(e.detail.children))return;const{moveX:o,moveY:n,moveH:r,moveW:l}=t;let a=0,s=0,h=!1;0===o&&0===n||0===r&&0===l||(h=!0,a=-o,s=-n),!0===h&&e.detail.children.forEach((e=>{const{uuid:t,x:o,y:n}=e,r=o+a,l=n+s,h={uuid:t,x:o,y:n},c={uuid:t,x:r,y:l};e.x=r,e.y=l,null==i||i.content.before.push(h),null==i||i.content.after.push(c)}))}(e,{moveX:t,moveY:i,moveH:u-e.h,moveW:n},o),e.w=d,e.h=u,e.x=h,e.y=c,o}return e.w=d,e.h=u,e.x=h,e.y=c,o.content.before.push(f),o.content.after.push(g),o}function hi(e,t,i){const o=function(e,t){let i=0,o=0,n=200,r=200;if(t){const{viewScaleInfo:l,viewSizeInfo:a}=t,{scale:s,offsetLeft:h,offsetTop:c}=l,{width:d,height:u}=a,f=d/4,g=u/4;n=200>=f?f/s:200/s,r=200>=g?g/s:200/s,["circle","svg","image"].includes(e)?n=r=Math.max(n,r):"text"===e&&(r=n/12*2),i=(0-h+d/2-n*s/2)/s,o=(0-c+u/2-r*s/2)/s}return{x:i,y:o,w:n,h:r}}(e,i);let n={};"rect"===e?n={background:"#D9D9D9"}:"circle"===e?n={background:"#D9D9D9",radius:0}:"text"===e?n=function(e){const t={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"};return{text:Qt,color:t.color,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:e.w/12,textAlign:"center",verticalAlign:"middle"}}(o):"svg"===e?n={svg:'<svg t="1701004189871" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3-12.3 12.7-12.1 32.9 0.6 45.3l183.7 179.1-43.4 252.9c-1.2 6.9-0.1 14.1 3.2 20.3 8.2 15.6 27.6 21.7 43.2 13.4L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" fill="#2c2c2c"></path></svg>'}:"image"===e?n={src:"data:image/svg+xml;base64,PHN2ZyAgIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiPjxwYXRoIGQ9Ik05MjggMTYwSDk2Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY2NDBjMCAxNy43IDE0LjMgMzIgMzIgMzJoODMyYzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE5MmMwLTE3LjctMTQuMy0zMi0zMi0zMnogbS00MCA2MzJIMTM2di0zOS45bDEzOC41LTE2NC4zIDE1MC4xIDE3OEw2NTguMSA0ODkgODg4IDc2MS42Vjc5MnogbTAtMTI5LjhMNjY0LjIgMzk2LjhjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDQyNC42IDY2Ni40bC0xNDQtMTcwLjdjLTMuMi0zLjgtOS0zLjgtMTIuMiAwTDEzNiA2NTIuN1YyMzJoNzUydjQzMC4yeiIgIGZpbGw9IiM1MTUxNTEiPjwvcGF0aD48cGF0aCBkPSJNMzA0IDQ1NmM0OC42IDAgODgtMzkuNCA4OC04OHMtMzkuNC04OC04OC04OC04OCAzOS40LTg4IDg4IDM5LjQgODggODggODh6IG0wLTExNmMxNS41IDAgMjggMTIuNSAyOCAyOHMtMTIuNSAyOC0yOCAyOC0yOC0xMi41LTI4LTI4IDEyLjUtMjggMjgtMjh6IiAgZmlsbD0iIzUxNTE1MSI+PC9wYXRoPjwvc3ZnPg=="}:"group"===e&&(n={children:[],background:"#D9D9D9",overflow:"hidden"});return Object.assign(Object.assign(Object.assign({uuid:Ie()},o),t),{type:e,detail:Object.assign(Object.assign({},n),t.detail||{})})}function ci(e,t,i){let o=!1;if(1===t.length){const n=t[0];i.splice(n,0,e),o=!0}else if(t.length>1){let n=i;for(let i=0;i<t.length;i++){const r=n[t[i]];if(i===t.length-1){const r=t[i];n.splice(r,0,e),o=!0}else{if(!(i<t.length-1&&"group"===r.type))break;n=r.detail.children}}}return o}function di(e,t){let i=!1;if(1===e.length){const o=e[0];t.splice(o,1),i=!0}else if(e.length>1){let o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t===e.length-1){const n=e[t];o.splice(n,1),i=!0}else{if(!(t<e.length-1&&"group"===n.type))break;o=n.detail.children}}}return i}function ui(e,t,i){const o=qt(t),n=["uuid","type"],r=Object.keys(o);if(r.forEach((t=>{if(!n.includes(t)){const i=o[t];ni(e,t),void 0!==i&&oi(e,t,i)}})),!0===(null==i?void 0:i.strict)){const t=qt(e);Object.keys(t).forEach((t=>{n.includes(t)||r.includes(t)||ni(e,t)}))}return e}function fi(e,t,i){var o,n,r;let l=null;for(let a=0;a<i.length;a++){const s=i[a];if(s.uuid===e){"group"===s.type&&(null===(o=s.operations)||void 0===o?void 0:o.resizeEffect)&&si(s,Object.assign({},t),{resizeEffect:null===(n=s.operations)||void 0===n?void 0:n.resizeEffect}),ui(s,t),l=s;break}"group"===s.type&&(l=fi(e,t,(null===(r=null==s?void 0:s.detail)||void 0===r?void 0:r.children)||[]))}return l}function gi(e,t,i,o){var n,r;const l=Et(e,i);return l&&("group"===l.type&&(null===(n=l.operations)||void 0===n?void 0:n.resizeEffect)&&si(l,Object.assign({},t),{resizeEffect:null===(r=l.operations)||void 0===r?void 0:r.resizeEffect}),ui(l,t,o)),l}const vi=["-apple-system",'"system-ui"',' "Segoe UI"'," Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"'," sans-serif"];function mi(e){return[e,...vi].join(", ")}function yi(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:r=1}=i,{x:l,y:a}=o,{scale:s}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:l+i.x*s,y:a+i.y*s},c={x:l+o.x*s,y:a+o.y*s},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,Ae(e.color,r))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:l+i.x*s,y:a+i.y*s,radius:i.radius*s},c={x:l+o.x*s,y:a+o.y*s,radius:o.radius*s},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,Ae(e.color,r))})),d}return"#000000"}const pi={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 wi(e){var t,i,o,n;let r=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(r=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),r}function xi(e,t,i){const{pattern:o,renderContent:n,originElem:r,calcElemSize:l,viewScaleInfo:a,viewSizeInfo:s}=i||{},{parentOpacity:h}=i,c=wi(r)*h,{clipPath:d,clipPathStrokeColor:u,clipPathStrokeWidth:f}=r.detail,g=()=>{e.globalAlpha=c,Si(e,t,{pattern:o,viewScaleInfo:a,viewSizeInfo:s}),null==n||n(),bi(e,t,{viewScaleInfo:a}),e.globalAlpha=h};d?(function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:r,viewSizeInfo:l}=i,a=l.devicePixelRatio,{clipPath:s}=(null==n?void 0:n.detail)||{};if(s&&r&&s.commands){const{x:i,y:n,w:l,h:h}=r,{originW:c,originH:d,originX:u,originY:f}=s,g=l/c,v=h/d,m=i-u*g,y=n-f*v;e.save(),e.translate(m,y),e.scale(a*g,a*v);const p=Ht(s.commands||[]),w=new Path2D(p);e.clip(w,"nonzero"),e.translate(0-m,0-y),e.setTransform(1,0,0,1,0,0),vt(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:r,calcElemSize:l,viewSizeInfo:s,renderContent:()=>{g()}}),"number"==typeof f&&f>0&&u&&function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:r,viewSizeInfo:l,parentOpacity:a}=i,s=l.devicePixelRatio,{clipPath:h,clipPathStrokeColor:c,clipPathStrokeWidth:d}=(null==n?void 0:n.detail)||{};if(h&&r&&h.commands&&"number"==typeof d&&d>0&&c){const{x:i,y:n,w:l,h:u}=r,{originW:f,originH:g,originX:v,originY:m}=h,y=l/f,p=u/g,w=i-v*y,x=n-m*p;e.save(),e.globalAlpha=a,e.translate(w,x),e.scale(s*y,s*p);const S=Ht(h.commands||[]),b=new Path2D(S);e.strokeStyle=c,e.lineWidth=d,e.stroke(b),e.translate(0-w,0-x),e.setTransform(1,0,0,1,0,0),vt(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:r,calcElemSize:l,viewSizeInfo:s,parentOpacity:h})):g()}function Si(e,t,i){var o,n;const{pattern:r,viewScaleInfo:l,viewSizeInfo:a}=i,s=[];if(t.detail.background||r){const{x:i,y:a,w:h,h:c,radiusList:d}=$t(t,{viewScaleInfo:l});if(e.beginPath(),e.moveTo(i+d[0],a),e.arcTo(i+h,a,i+h,a+c,d[1]),e.arcTo(i+h,a+c,i,a+c,d[2]),e.arcTo(i,a+c,i,a,d[3]),e.arcTo(i,a,i+h,a,d[0]),e.closePath(),"string"==typeof r)e.fillStyle=r;else if(["CanvasPattern"].includes(Te.type(r)))e.fillStyle=r;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=yi(e,t.detail.background,{viewElementSize:{x:i,y:a,w:h,h:c},viewScaleInfo:l,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=yi(e,t.detail.background,{viewElementSize:{x:i,y:a,w:h,h:c},viewScaleInfo:l,opacity:e.globalAlpha});if(e.fillStyle=o,s&&s.length>0)for(let t=0;t<(null==s?void 0:s.length);t++){const o=s[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+a):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill("nonzero"),s&&s.length>0&&e.setTransform(1,0,0,1,0,0)}}function bi(e,t,i){if(0===t.detail.borderWidth)return;if(!be(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let r=pi.borderColor;!0===be(t.detail.borderColor)&&(r=t.detail.borderColor);const{borderDash:l,borderWidth:a,borderRadius:s,boxSizing:h=pi.boxSizing}=t.detail;let c=[];Array.isArray(l)&&l.length>0&&(c=l.map((e=>Math.ceil(e*n)))),c.length>0?e.lineCap="butt":e.lineCap="square";let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);let u=0;"number"==typeof a&&(u=a||1),u*=n,e.strokeStyle=r;let f=0,g=0,v=0,m=0;if(Array.isArray(a)&&(f=(a[0]||0)*n,g=(a[1]||0)*n,v=(a[2]||0)*n,m=(a[3]||0)*n),m||g||f||v){e.lineCap="butt";let{x:i,y:o,w:n,h:r}=t;"border-box"===h?(i+=m/2,o+=f/2,n=n-m/2-g/2,r=r-f/2-v/2):"content-box"===h?(i-=m/2,o-=f/2,n=n+m/2+g/2,r=r+f/2+v/2):(i=t.x,o=t.y,n=t.w,r=t.h),f&&(e.beginPath(),e.lineWidth=f,e.moveTo(i-m/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-f/2),e.lineTo(i+n,o+r+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-m/2,o+r),e.lineTo(i+n+g/2,o+r),e.closePath(),e.stroke()),m&&(e.beginPath(),e.lineWidth=m,e.moveTo(i,o-f/2),e.lineTo(i,o+r+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:r}=t;"border-box"===h?(i=t.x+u/2,o=t.y+u/2,n=t.w-u,r=t.h-u):"content-box"===h?(i=t.x-u/2,o=t.y-u/2,n=t.w+u,r=t.h+u):(i=t.x,o=t.y,n=t.w,r=t.h),n=Math.max(n,1),r=Math.max(r,1),d=d.map((e=>Math.min(e,n/2,r/2))),e.setLineDash(c),e.lineWidth=u,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+r,d[1]),e.arcTo(i+n,o+r,i,o+r,d[2]),e.arcTo(i,o+r,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}function Ai(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:r}=i,{shadowColor:l,shadowOffsetX:a,shadowOffsetY:s,shadowBlur:h}=o;He.number(h)?(e.save(),e.shadowColor=l||pi.shadowColor,e.shadowOffsetX=(a||0)*n.scale,e.shadowOffsetY=(s||0)*n.scale,e.shadowBlur=(h||0)*n.scale,r(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,r(),e.restore())}const Ii={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 Mi(e,t,i){var o,n;const{detail:r}=t,{originX:l,originY:a,originW:s,originH:h,fillRule:c}=r,{viewScaleInfo:d,viewSizeInfo:u,parentOpacity:f}=i,{x:g,y:v,w:m,h:y,angle:p}=Wt(t,{viewScaleInfo:d})||t,w=m/s,x=y/h,S=g-l*w,b=v-a*x,A=t.detail,{clipPath:I,clipPathStrokeColor:M,clipPathStrokeWidth:z}=A,R=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(i[o[n]]=e[o[n]])}return i}(A,["clipPath","clipPathStrokeColor","clipPathStrokeWidth"]),C=d.scale*u.devicePixelRatio,E=Object.assign(Object.assign({},t),{x:g,y:v,w:m,h:y,angle:p});let T=Object.assign({},E);T.detail=R;let P=Object.assign({},t);P.detail=R,r.fill&&"string"!==r.fill&&(null===(n=null===(o=r.fill)||void 0===o?void 0:o.type)||void 0===n?void 0:n.includes("gradient"))&&(T=Object.assign(Object.assign({},E),{detail:Object.assign(Object.assign({},E.detail),{background:r.fill,clipPath:{commands:r.commands,originX:l,originY:a,originW:s,originH:h}})}),P.detail=Object.assign({},T.detail)),vt(e,{x:g,y:v,w:m,h:y,angle:p},(()=>{xi(e,T,{originElem:P,calcElemSize:{x:g,y:v,w:m,h:y,angle:p},viewScaleInfo:d,viewSizeInfo:u,parentOpacity:f,renderContent:()=>{Ai(e,E,{viewScaleInfo:d,renderContent:()=>{e.save(),e.translate(S,b),e.scale(C*w/d.scale,C*x/d.scale);const t=Ht(r.commands||[]),i=new Path2D(t);r.fill&&("string"==typeof r.fill?e.fillStyle=r.fill:e.fillStyle="transparent"),r.fill&&e.fill(i,c||"nonzero"),r.stroke&&0!==r.strokeWidth&&(e.strokeStyle=r.stroke,e.lineWidth=(r.strokeWidth||1)/u.devicePixelRatio,e.lineCap=r.strokeLineCap||"square",e.stroke(i)),e.translate(-S,-b),e.restore()}})}})}))}function zi(e,t,i){var o,n,r;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:l,h:a}=t,{scale:s}=i.viewScaleInfo;if(s<1&&(l*s<.4||a*s<.4)||0===i.parentOpacity)return;const{overrideElementMap:h}=i;if(!(null===(r=null===(n=null==h?void 0:h[t.uuid])||void 0===n?void 0:n.operations)||void 0===r?void 0:r.invisible))try{switch(t.type){case"rect":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt(t,{viewScaleInfo:o})||t,d=Object.assign(Object.assign({},t),{x:l,y:a,w:s,h:h,angle:c});vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{Ai(e,d,{viewScaleInfo:o,renderContent:()=>{xi(e,d,{originElem:t,calcElemSize:{x:l,y:a,w:s,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{viewScaleInfo:r,viewSizeInfo:l,parentOpacity:a}=i,{background:s="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:d=0,borderDash:u}=o;let f=0;"number"==typeof d&&d>0?f=d:Array.isArray(d)&&"number"==typeof d[0]&&d[0]>0&&(f=d[0]),f*=r.scale;const{x:g,y:v,w:m,h:y}=Wt({x:t.x,y:t.y,w:t.w,h:t.h},{viewScaleInfo:r})||t,p=Object.assign(Object.assign({},t),{x:g,y:v,w:m,h:y,angle:n});vt(e,{x:g,y:v,w:m,h:y,angle:n},(()=>{Ai(e,p,{viewScaleInfo:r,renderContent:()=>{let t=m/2,i=y/2;const o=g+t,n=v+i,l=t,d=i;if(f>0&&("content-box"===c||("center-line"===c?(t-=f/2,i-=f/2):(t-=f,i-=f))),t>=0&&i>=0){const c=wi(p)*a;e.globalAlpha=c,e.beginPath();const w=yi(e,s,{viewElementSize:{x:g,y:v,w:m,h:y},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=w,e.circle(o,n,l,d,0,0,2*Math.PI),e.closePath(),e.fill("nonzero"),e.globalAlpha=a,"number"==typeof f&&f>0){const l=f/2+t,a=f/2+i;if(e.beginPath(),u){const t=u.map((e=>e*r.scale));e.setLineDash(t)}e.strokeStyle=h,e.lineWidth=f,e.circle(o,n,l,a,0,0,2*Math.PI),e.closePath(),e.stroke(),e.setLineDash([])}}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r,calculator:l}=i,{x:a,y:s,w:h,h:c,angle:d}=Wt(t,{viewScaleInfo:o})||t,u=Object.assign(Object.assign({},t),{x:a,y:s,w:h,h:c,angle:d});vt(e,{x:a,y:s,w:h,h:c,angle:d},(()=>{var f,g;Ai(e,u,{viewScaleInfo:o,renderContent:()=>{xi(e,u,{originElem:t,calcElemSize:{x:a,y:s,w:h,h:c,angle:d},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r})}});{const n=Object.assign(Object.assign({},Ii),t.detail),r=(n.fontSize||Ii.fontSize)*o.scale;if(r<2)return;const{parentOpacity:h}=i,c=wi(t)*h;e.globalAlpha=c,e.fillStyle=t.detail.color||Ii.color,e.textBaseline="top",e.$setFont({fontWeight:n.fontWeight,fontSize:r,fontFamily:mi(n.fontFamily)});{const i=l.getVirtualFlatItem(t.uuid);Array.isArray(null==i?void 0:i.textLines)&&(null===(f=null==i?void 0:i.textLines)||void 0===f?void 0:f.length)>0&&(void 0!==n.textShadowColor&&be(n.textShadowColor)&&(e.shadowColor=n.textShadowColor),void 0!==n.textShadowOffsetX&&He.number(n.textShadowOffsetX)&&(e.shadowOffsetX=n.textShadowOffsetX),void 0!==n.textShadowOffsetY&&He.number(n.textShadowOffsetY)&&(e.shadowOffsetY=n.textShadowOffsetY),void 0!==n.textShadowBlur&&He.number(n.textShadowBlur)&&(e.shadowBlur=n.textShadowBlur),null===(g=null==i?void 0:i.textLines)||void 0===g||g.forEach((t=>{e.fillText(t.text,a+t.x*o.scale,s+t.y*o.scale)})))}e.globalAlpha=h}}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:r,parentOpacity:l}=i,{x:a,y:s,w:h,h:c,angle:d}=Wt(t,{viewScaleInfo:n})||t,u=Object.assign(Object.assign({},t),{x:a,y:s,w:h,h:c,angle:d});vt(e,{x:a,y:s,w:h,h:c,angle:d},(()=>{Ai(e,u,{viewScaleInfo:n,renderContent:()=>{xi(e,u,{originElem:t,calcElemSize:{x:a,y:s,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:r,parentOpacity:l,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=wi(t)*l;const{x:i,y:r,w:a,h:s,radiusList:h}=$t(u,{viewScaleInfo:n}),{detail:c}=t,{scaleMode:d,originW:f=0,originH:g=0}=c,v=e.$undoPixelRatio(f),m=e.$undoPixelRatio(g);if(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+h[0],r),e.arcTo(i+a,r,i+a,r+s,h[1]),e.arcTo(i+a,r+s,i,r+s,h[2]),e.arcTo(i,r+s,i,r,h[3]),e.arcTo(i,r,i+a,r,h[0]),e.closePath(),e.fill("nonzero"),e.clip("nonzero"),d&&g&&f){let n=0,l=0,h=v,c=m;const u=i,f=r,g=a,y=s;if(v>t.w||m>t.h)if("fill"===d){const e=Math.max(t.w/v,t.h/m),i=m*e;n=(v*e-t.w)/2/e,l=(i-t.h)/2/e,h=t.w/e,c=t.h/e}else if("tile"===d)n=0,l=0,h=t.w,c=t.h;else if("fit"===d){const e=Math.min(t.w/v,t.h/m);n=(v-t.w/e)/2,l=(m-t.h/e)/2,h=t.w/e,c=t.h/e}e.drawImage(o,n,l,h,c,u,f,g,y)}else e.drawImage(o,i,r,a,s);e.globalAlpha=l,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt(t,{viewScaleInfo:n})||t;vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=wi(t)*r,e.drawImage(o,l,a,s,h),e.globalAlpha=r)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt(t,{viewScaleInfo:n})||t;vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=wi(t)*r,e.drawImage(o,l,a,s,h),e.globalAlpha=r)}))}(e,t,i);break;case"path":Mi(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r}=i,{x:l,y:a,w:s,h:h,angle:c}=Wt({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},{viewScaleInfo:o})||t,d=Object.assign(Object.assign({},t),{x:l,y:a,w:s,h:h,angle:c});vt(e,{x:l,y:a,w:s,h:h,angle:c},(()=>{e.globalAlpha=wi(t)*r,Ai(e,d,{viewScaleInfo:o,renderContent:()=>{xi(e,d,{originElem:t,calcElemSize:{x:l,y:a,w:s,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:r,renderContent:()=>{const{x:n,y:l,w:a,h:s,radiusList:h}=$t(d,{viewScaleInfo:o});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(n+h[0],l),e.arcTo(n+a,l,n+a,l+s,h[1]),e.arcTo(n+a,l+s,n,l+s,h[2]),e.arcTo(n,l+s,n,l,h[3]),e.arcTo(n,l,n+a,l,h[0]),e.closePath(),e.fill("nonzero"),e.clip("nonzero")),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:l}=i;for(let o=0;o<t.detail.children.length;o++){let a=t.detail.children[o];if(a=Object.assign(Object.assign({},a),{x:n.x+a.x,y:n.y+a.y}),!0===i.forceDrawAll||(null==l?void 0:l.needRender(a)))try{zi(e,a,Object.assign(Object.assign({},i),{parentOpacity:r*wi(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=r}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const Ri={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 Ci(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:r}=i;for(let t=0;t<n.length;t++){const l=n[t],a=Object.assign(Object.assign({},l),{detail:Object.assign(Object.assign({},Ri),null==l?void 0:l.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.needRender(a)))try{zi(e,a,Object.assign(Object.assign({},i),{parentOpacity:r}))}catch(e){console.error(e)}}}var Ei,Ti,Pi,Li,Oi,ki,Wi,Di,ji,Yi,Ni,Bi,Fi=function(e,t,i,o){return new(i||(i=Promise))((function(n,r){function l(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,a)}s((o=o.apply(e,t||[])).next())}))},Gi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},Vi=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const Xi=["image","svg","html"],Hi=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?Re(n)?n:ze(n,e.uuid):ze(`${Ie()}-${e.uuid}-${Ie()}-${Ie()}`,e.uuid)};class Zi extends tt{constructor(){super(),Ei.add(this),Ti.set(this,{}),Pi.set(this,{}),Li.set(this,{}),Oi.set(this,!1),Gi(this,Ei,"m",ki).call(this,"image",((e,t)=>Fi(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield Oe(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Gi(this,Ei,"m",ki).call(this,"html",((e,t)=>Fi(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield We(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Gi(this,Ei,"m",ki).call(this,"svg",((e,t)=>Fi(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield ke(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return Gi(this,Oi,"f")}reset(){!0!==Gi(this,Oi,"f")&&(Vi(this,Pi,{},"f"),Vi(this,Li,{},"f"))}resetElementAsset(e){var t,i,o;if(Xi.includes(e.type)){let n=null,r=null;"image"===e.type&&"string"==typeof(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)?r=e.detail.src:"svg"===e.type&&"string"==typeof(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)?r=e.detail.svg:"html"===e.type&&"string"==typeof(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)&&(r=e.detail.html),"string"==typeof r&&(this.load(e,{}),Re(r)?n=r:e.uuid&&(n=ze(r,e.uuid))),n&&Re(n)&&(delete Gi(this,Li,"f")[n],delete Gi(this,Pi,"f")[n])}}destroy(){Vi(this,Oi,!0,"f"),this.clear(),Vi(this,Ti,null,"f"),Vi(this,Pi,null,"f"),Vi(this,Li,null,"f")}load(e,t){!0!==Gi(this,Oi,"f")&&(Gi(this,Ei,"m",Bi).call(this,e)||Xi.includes(e.type)&&Gi(this,Ei,"m",Ni).call(this,e,t))}getContent(e){var t,i;const o=Hi(e);return(null===(i=null===(t=Gi(this,Li,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Gi(this,Li,"f")}setLoadItemMap(e){Vi(this,Li,e,"f")}}Ti=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Oi=new WeakMap,Ei=new WeakSet,ki=function(e,t){Gi(this,Ti,"f")[e]=t},Wi=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},Di=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Gi(this,Ei,"m",Wi).call(this,e)}},ji=function(e){const t=Hi(e.element),i=Gi(this,Li,"f")[t];Gi(this,Oi,"f")||(i?i.startTime<e.startTime&&(Gi(this,Li,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Gi(this,Li,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},Yi=function(e){var t;const i=Hi(e.element),o=null===(t=Gi(this,Li,"f"))||void 0===t?void 0:t[i];Gi(this,Oi,"f")||(o?o.startTime<e.startTime&&(Gi(this,Li,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Gi(this,Li,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},Ni=function(e,t){const i=Gi(this,Ei,"m",Di).call(this,e),o=Hi(e);if(Gi(this,Pi,"f")[o])return;Gi(this,Pi,"f")[o]=i;const n=Gi(this,Ti,"f")[e.type];"function"!=typeof n||Gi(this,Oi,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{Gi(this,Oi,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",Gi(this,Ei,"m",ji).call(this,i))})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,Gi(this,Ei,"m",Yi).call(this,i)})))},Bi=function(e){var t;const i=Hi(e),o=null===(t=Gi(this,Pi,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==Gi(this,Ei,"m",Wi).call(this,e))};const Qi={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 Ui(e,t){const{w:i,h:o}=e,n=t.tempContext,r=[],l=Object.assign(Object.assign({},Qi),e.detail),a=l.fontSize||Qi.fontSize,s=a;if(s<2)return{};const h=l.lineHeight||a;n.textBaseline="top",n.$setFont({fontWeight:l.fontWeight,fontSize:s,fontFamily:mi(l.fontFamily)});let c=l.text.replace(/\r\n/gi,"\n");"lowercase"===l.textTransform?c=c.toLowerCase():"uppercase"===l.textTransform&&(c=c.toUpperCase());const d=h,u=c.split("\n");let f=0;u.forEach(((e,t)=>{if("maxContent"===l.minInlineSize)r.push({x:0,y:0,text:e,width:n.$undoPixelRatio(n.measureText(e).width)});else{let h="",c="",g=e.split(c);if("normal"===l.wordBreak){c=" ";const t=e.split(c);g=[],t.forEach(((e,i)=>{g.push(e),i<t.length-1&&g.push(c)}))}if(1===g.length&&"visible"===l.overflow)r.push({x:0,y:0,text:g[0],width:n.$undoPixelRatio(n.measureText(g[0]).width)});else if(g.length>0){for(let e=0;e<g.length&&(a=n.$doPixelRatio(i),s=n.measureText(h+g[e]).width,a>=s?h+=g[e]||"":(r.push({x:0,y:0,text:h,width:n.$undoPixelRatio(n.measureText(h).width)}),h=g[e]||"",f++),!((f+1)*d>o&&"hidden"===l.overflow));e++)if(g.length-1===e&&(f+1)*d<=o){r.push({x:0,y:0,text:h,width:n.$undoPixelRatio(n.measureText(h).width)}),t<u.length-1&&f++;break}}else r.push({x:0,y:0,text:"",width:0})}var a,s}));let g=0,v=0;d>s&&(v=(d-s)/2),r.length*d<o&&("top"===l.verticalAlign?g=0:"bottom"===l.verticalAlign?g+=o-r.length*d:g+=(o-r.length*d)/2);{const e=0+g;r.forEach(((t,o)=>{let n=0;"center"===l.textAlign?n=0+(i-t.width)/2:"right"===l.textAlign&&(n=i-t.width+0),r[o].x=n,r[o].y=e+d*o+v}))}return{textLines:r}}function $i(e,t){let i={};return"text"===e.type&&(i=Ui(e,t)),i}function Ji(e,t){const{viewScaleInfo:i,viewSizeInfo:o,tempContext:n}=t,r=function(e,t){const i={},o=[],n=r=>{const l={type:r.type,isVisibleInView:!0,position:[...o]};let a=null;a=Bt(r,{groupQueue:Rt(e,o)||[]});const s=Object.assign(Object.assign(Object.assign({},l),{originRectInfo:a,rangeRectInfo:He.angle(r.angle)?Ft(a):a}),$i(r,t));i[r.uuid]=s,"group"===r.type&&r.detail.children.forEach(((e,t)=>{o.push(t),n(e),o.pop()}))};return e.forEach(((e,t)=>{o.push(t),n(e),o.pop()})),i}(e,{tempContext:n});return Ki(r,{viewScaleInfo:i,viewSizeInfo:o})}function Ki(e,t){const i=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n,offsetLeft:r}=t,{width:l,height:a}=i,s=0-r/o,h=0-n/o,c=l/o,d=a/o,u=mt({x:s,y:h,w:c,h:d}),f={x:s,y:h},g={x:s+c,y:h},v={x:s,y:h+d},m={x:s+c,y:h+d},y={x:s,y:u.y},p={x:u.x,y:h},w={x:s+c,y:u.y},x={x:u.x,y:h+d};return{center:u,topLeft:f,topRight:g,bottomLeft:v,bottomRight:m,left:y,top:p,right:w,bottom:x}}(t);let o=0,n=0;return Object.keys(e).forEach((t=>{const r=e[t];r.isVisibleInView=function(e,t){const i=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),o=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),r=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),l=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),a=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),s=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),h=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y);return i<=a&&o>=l&&n<=h&&r>=s||a<=r&&a>=r&&a<=r&&a>=r}(r.rangeRectInfo,i),r.isVisibleInView?o++:n++})),{virtualFlatItemMap:e,visibleCount:o,invisibleCount:n}}var qi,_i,eo=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},to=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class io{constructor(e){qi.set(this,void 0),_i.set(this,void 0),eo(this,qi,e,"f"),eo(this,_i,new ct({defaultStorage:{virtualFlatItemMap:{},visibleCount:0,invisibleCount:0}}),"f")}toGridNum(e,t){return!0===(null==t?void 0:t.ignore)?e:Math.round(e)}destroy(){eo(this,qi,null,"f")}needRender(e){const t=to(this,_i,"f").get("virtualFlatItemMap")[e.uuid];return!t||t.isVisibleInView}getPointElement(e,t){const i=to(this,qi,"f").tempContext;return function(e,t){var i,o,n;const{context2d:r,data:l,viewScaleInfo:a,viewSizeInfo:s,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,l=0,s=0;for(let e=0;e<=t;e++)n+=h[e].x,l+=h[e].y,s+=h[e].angle||0;const d=h[t];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===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(Yt(e,{context2d:r,element:{x:n+u.x,y:l+u.y,w:u.w,h:u.h,angle:s+(u.angle||0)},viewScaleInfo:a})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=l.elements.length-1;t>=0;t--){const i=l.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&Yt(e,{context2d:r,element:i,viewScaleInfo:a})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}resetVirtualFlatItemMap(e,t){if(e){const{virtualFlatItemMap:i,invisibleCount:o,visibleCount:n}=Ji(e.elements,Object.assign(Object.assign({},t),{tempContext:to(this,qi,"f").tempContext}));to(this,_i,"f").set("virtualFlatItemMap",i),to(this,_i,"f").set("invisibleCount",o),to(this,_i,"f").set("visibleCount",n)}}updateVisiableStatus(e){const{virtualFlatItemMap:t,invisibleCount:i,visibleCount:o}=Ki(to(this,_i,"f").get("virtualFlatItemMap"),e);to(this,_i,"f").set("virtualFlatItemMap",t),to(this,_i,"f").set("invisibleCount",i),to(this,_i,"f").set("visibleCount",o)}calcViewRectInfoFromOrigin(e,t){const i=to(this,_i,"f").get("virtualFlatItemMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:r}=t,{center:l,left:a,right:s,bottom:h,top:c,topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=i.originRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n};return{center:Dt(l,v),left:Dt(a,v),right:Dt(s,v),bottom:Dt(h,v),top:Dt(c,v),topLeft:Dt(d,v),topRight:Dt(u,v),bottomLeft:Dt(f,v),bottomRight:Dt(g,v)}}calcViewRectInfoFromRange(e,t){const i=to(this,_i,"f").get("virtualFlatItemMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:r}=t,{center:l,left:a,right:s,bottom:h,top:c,topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=i.rangeRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n};return{center:Dt(l,v),left:Dt(a,v),right:Dt(s,v),bottom:Dt(h,v),top:Dt(c,v),topLeft:Dt(d,v),topRight:Dt(u,v),bottomLeft:Dt(f,v),bottomRight:Dt(g,v)}}modifyText(e){const t=to(this,_i,"f").get("virtualFlatItemMap"),i=t[e.uuid];if(e&&"text"===e.type){const o=Object.assign(Object.assign({},i),Ui(e,{tempContext:to(this,qi,"f").tempContext}));t[e.uuid]=o,to(this,_i,"f").set("virtualFlatItemMap",t)}}modifyVirtualFlatItemMap(e,t){const{modifyInfo:i,viewScaleInfo:o,viewSizeInfo:n}=t,{type:r,content:l}=i,a=e.elements,s=to(this,_i,"f").get("virtualFlatItemMap");if("deleteElement"===r){const{element:e}=l,t=[],i=e=>{t.push(e.uuid),"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{i(e)}))};i(e),t.forEach((e=>{delete s[e]})),to(this,_i,"f").set("virtualFlatItemMap",s)}else if("addElement"===r||"updateElement"===r){const{position:t}=l,i=Et(t,e.elements),h=Rt(a,t);if(i)if("updateElement"===r&&"group"===i.type)this.resetVirtualFlatItemMap(e,{viewScaleInfo:o,viewSizeInfo:n});else{const e=Bt(i,{groupQueue:h||[]}),l=Object.assign({type:i.type,originRectInfo:e,rangeRectInfo:He.angle(i.angle)?Ft(e):e,isVisibleInView:!0,position:[...t]},$i(i,{tempContext:to(this,qi,"f").tempContext}));s[i.uuid]=l,to(this,_i,"f").set("virtualFlatItemMap",s),"updateElement"===r&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:n})}}else"moveElement"===r&&this.resetVirtualFlatItemMap(e,{viewScaleInfo:o,viewSizeInfo:n})}getVirtualFlatItem(e){return to(this,_i,"f").get("virtualFlatItemMap")[e]||null}}qi=new WeakMap,_i=new WeakMap;var oo,no,ro,lo,ao,so,ho=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},co=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class uo extends tt{constructor(e){super(),oo.add(this),no.set(this,void 0),ro.set(this,new Zi),lo.set(this,void 0),ao.set(this,!1),ho(this,no,e,"f"),ho(this,lo,new io({tempContext:e.tempContext}),"f"),co(this,oo,"m",so).call(this)}isDestroyed(){return co(this,ao,"f")}destroy(){this.clear(),ho(this,no,null,"f"),co(this,ro,"f").destroy(),ho(this,ro,null,"f"),ho(this,ao,!0,"f")}updateOptions(e){ho(this,no,e,"f")}drawData(e,t){const i=co(this,ro,"f"),o=co(this,lo,"f"),{sharer:n}=co(this,no,"f"),r=co(this,no,"f").viewContext;r.clearRect(0,0,r.canvas.width,r.canvas.height);const l={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height};!0===t.forceDrawAll&&co(this,lo,"f").resetVirtualFlatItemMap(e,{viewScaleInfo:t.viewScaleInfo,viewSizeInfo:t.viewSizeInfo});const a=Object.assign({loader:i,calculator:o,parentElementSize:l,elementAssets:e.assets,parentOpacity:1,overrideElementMap:null==n?void 0:n.getActiveOverrideElemenentMap()},t);!function(e,t,i){if("string"==typeof(null==t?void 0:t.background)){const{viewSizeInfo:o}=i,{width:n,height:r}=o;e.globalAlpha=1,e.fillStyle=t.background,e.fillRect(0,0,n,r)}}(r,e.global,a),e.layout?function(e,t,i,o){const{viewScaleInfo:n,viewSizeInfo:r,parentOpacity:l}=i,a=Object.assign({uuid:"layout",type:"group"},t),{x:s,y:h,w:c,h:d}=Wt(a,{viewScaleInfo:n})||a,u=Object.assign(Object.assign({},a),{x:s,y:h,w:c,h:d,angle:0});if(e.globalAlpha=1,Ai(e,u,{viewScaleInfo:n,renderContent:()=>{Si(e,u,{viewScaleInfo:n,viewSizeInfo:r})}}),"hidden"===t.detail.overflow){const{viewScaleInfo:o,viewSizeInfo:n}=i,r=Object.assign({uuid:"layout",type:"group"},t),l=Wt(r,{viewScaleInfo:o})||r,a=Object.assign(Object.assign({},r),l),{x:s,y:h,w:c,h:d,radiusList:u}=$t(a,{viewScaleInfo:o});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(s+u[0],h),e.arcTo(s+c,h,s+c,h+d,u[1]),e.arcTo(s+c,h+d,s,h+d,u[2]),e.arcTo(s,h+d,s,h,u[3]),e.arcTo(s,h,s+c,h,u[0]),e.closePath(),e.fill("nonzero"),e.clip("nonzero")}o(e),"hidden"===t.detail.overflow&&e.restore(),bi(e,u,{viewScaleInfo:n}),e.globalAlpha=l}(r,e.layout,a,(()=>{Ci(r,e,a)})):Ci(r,e,a)}scale(e){const{sharer:t}=co(this,no,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:r,offsetRight:l,width:a,height:s,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:r,offsetRight:l},viewSizeInfo:{width:a,height:s,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){co(this,ro,"f").setLoadItemMap(e)}getLoadItemMap(){return co(this,ro,"f").getLoadItemMap()}getLoader(){return co(this,ro,"f")}getCalculator(){return co(this,lo,"f")}}function fo(e){return e>0||e<0||0===e}no=new WeakMap,ro=new WeakMap,lo=new WeakMap,ao=new WeakMap,oo=new WeakSet,so=function(){const e=co(this,ro,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};class go extends tt{constructor(e){super(),we(this,n),we(this,t),we(this,i),we(this,o,!1),we(this,l,(e=>{if(!Se(this,n,g).call(this,e))return;const t=Se(this,n,v).call(this,e);if(!Se(this,n,m).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),we(this,a,(e=>{if(2!==e.button)return;if(!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)&&this.trigger("contextMenu",{point:t})})),we(this,s,(e=>{if(!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);if(!Se(this,n,m).call(this,t))return;const o=Date.now(),r=pe(this,i).get("prevClickPoint");r&&o-r.t<=500&&Math.abs(r.x-t.x)<=5&&Math.abs(r.y-t.y)<=5?this.trigger("doubleClick",{point:t}):pe(this,i).set("prevClickPoint",t)})),we(this,h,(e=>{pe(this,i).set("hasPointDown",!1),e.preventDefault();const t=Se(this,n,v).call(this,e);this.trigger("pointLeave",{point:t})})),we(this,c,(e=>{if(pe(this,i).set("hasPointDown",!1),!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);this.trigger("pointEnd",{point:t})})),we(this,d,(e=>{if(!Se(this,n,g).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)?!0===pe(this,i).get("hasPointDown")&&this.trigger("pointMove",{point:t}):pe(this,i).get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),pe(this,i).set("hasPointDown",!1))})),we(this,u,(e=>{if(0!==e.button)return;if(!Se(this,n,g).call(this,e))return;e.preventDefault();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)&&(pe(this,i).set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),we(this,f,(e=>{if(!Se(this,n,g).call(this,e))return void(!0===pe(this,i).get("inCanvas")&&(pe(this,i).set("inCanvas",!1),pe(this,h).call(this,e)));pe(this,i).set("inCanvas",!0),e.preventDefault();const t=Se(this,n,v).call(this,e);Se(this,n,m).call(this,t)&&this.trigger("hover",{point:t})}));const y=new ct({defaultStorage:{hasPointDown:!1,prevClickPoint:null,inCanvas:!0}});xe(this,i,y),xe(this,t,e),Se(this,n,r).call(this)}onEvents(){if(!0===pe(this,t).disabled)return;if(pe(this,o))return;const e=pe(this,t).boardContent.boardContext.canvas,i=window;i.addEventListener("mousemove",pe(this,f)),i.addEventListener("mousedown",pe(this,u)),i.addEventListener("mousemove",pe(this,d)),i.addEventListener("mouseup",pe(this,c)),e.addEventListener("wheel",pe(this,l),{passive:!1}),i.addEventListener("click",pe(this,s)),i.addEventListener("contextmenu",pe(this,a))}offEvents(){if(!0===pe(this,t).disabled)return;const e=window,i=pe(this,t).boardContent.boardContext.canvas;e.removeEventListener("mousemove",pe(this,f)),e.removeEventListener("mousedown",pe(this,u)),e.removeEventListener("mousemove",pe(this,d)),e.removeEventListener("mouseup",pe(this,c)),e.removeEventListener("mouseleave",pe(this,h)),i.removeEventListener("wheel",pe(this,l)),e.removeEventListener("click",pe(this,s)),e.removeEventListener("contextmenu",pe(this,a))}destroy(){this.offEvents(),pe(this,i).destroy(),xe(this,o,!0)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakSet,r=function(){this.onEvents()},l=new WeakMap,a=new WeakMap,s=new WeakMap,h=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,f=new WeakMap,g=function(e){return e.target===pe(this,t).boardContent.boardContext.canvas},v=function(e){const i=pe(this,t).boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top,t:Date.now()}},m=function(e){const i=pe(this,t).sharer.getActiveViewSizeInfo(),{width:o,height:n}=i;return!!(fo(e.x)&&fo(e.y)&&e.x<=o&&e.y<=n)};const vo={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 mo{constructor(){we(this,y),we(this,p);const e=new ct({defaultStorage:vo}),t=new ct({defaultStorage:{}});xe(this,y,e),xe(this,p,t)}getActiveStorage(e){return pe(this,y).get(e)}setActiveStorage(e,t){return pe(this,y).set(e,t)}getActiveStoreSnapshot(e){return pe(this,y).getSnapshot(e)}getSharedStorage(e){return pe(this,p).get(e)}setSharedStorage(e,t){return pe(this,p).set(e,t)}getSharedStoreSnapshot(e){return pe(this,p).getSnapshot(e)}getActiveViewScaleInfo(){return{scale:pe(this,y).get("scale"),offsetTop:pe(this,y).get("offsetTop"),offsetBottom:pe(this,y).get("offsetBottom"),offsetLeft:pe(this,y).get("offsetLeft"),offsetRight:pe(this,y).get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:r}=e;pe(this,y).set("scale",t),pe(this,y).set("offsetTop",i),pe(this,y).set("offsetBottom",o),pe(this,y).set("offsetLeft",n),pe(this,y).set("offsetRight",r)}setActiveViewSizeInfo(e){pe(this,y).set("width",e.width),pe(this,y).set("height",e.height),pe(this,y).set("devicePixelRatio",e.devicePixelRatio),pe(this,y).set("contextWidth",e.contextWidth),pe(this,y).set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:pe(this,y).get("width"),height:pe(this,y).get("height"),devicePixelRatio:pe(this,y).get("devicePixelRatio"),contextWidth:pe(this,y).get("contextWidth"),contextHeight:pe(this,y).get("contextHeight")}}getActiveOverrideElemenentMap(){return pe(this,y).get("overrideElementMap")}setActiveOverrideElemenentMap(e){pe(this,y).set("overrideElementMap",e)}}y=new WeakMap,p=new WeakMap;const{requestAnimationFrame:yo}=window;class po extends tt{constructor(e){super(),we(this,b),we(this,w),we(this,x,[]),we(this,S,"FREE"),xe(this,w,e),Se(this,b,A).call(this)}resetVirtualFlatItemMap(e,t){e&&pe(this,w).calculator.resetVirtualFlatItemMap(e,t)}drawFrame(){const{sharer:e}=pe(this,w),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();pe(this,x).push({activeStore:t,sharedStore:i}),Se(this,b,I).call(this)}scale(e){const{scale:t,point:i,ignoreUpdateVisibleStatus:o}=e,{sharer:n}=pe(this,w),{moveX:r,moveY:l}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:r}=o,l=t/o.scale,a=i.x,s=i.y;return{moveX:a-a*l+(n*l-n),moveY:s-s*l+(r*l-r)}}({scale:t,point:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});return n.setActiveStorage("scale",t),o||pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),{moveX:r,moveY:l}}scroll(e){const{sharer:t}=pe(this,w),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n,ignoreUpdateVisibleStatus:r}=e,l=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:r}=o,{width:l,height:a,contextWidth:s,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,u=o.offsetTop,f=o.offsetBottom;return c+=t,u+=i,d=l-(s*r+c),f=a-(h*r+u),{scale:r,offsetTop:u,offsetLeft:c,offsetRight:d,offsetBottom:f}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(l),r||pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),l}updateViewScaleInfo(e){const{sharer:t}=pe(this,w),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:r}=t,{width:l,height:a,contextWidth:s,contextHeight:h}=r,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:l-(s*i+c/i),offsetBottom:a-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),i}resize(e={},t){const{sharer:i}=pe(this,w),o={...i.getActiveViewSizeInfo(),...e},{width:n,height:r,devicePixelRatio:l}=o,{underlayContext:a,boardContext:s,overlayContext:h,viewContext:c}=pe(this,w).boardContent;return s.canvas.width=n*l,s.canvas.height=r*l,s.canvas.style.width=`${n}px`,s.canvas.style.height=`${r}px`,a.canvas.width=n*l,a.canvas.height=r*l,h.canvas.width=n*l,h.canvas.height=r*l,c.canvas.width=n*l,c.canvas.height=r*l,i.setActiveViewSizeInfo(o),(null==t?void 0:t.ignoreUpdateVisibleStatus)||pe(this,w).calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),o}}w=new WeakMap,x=new WeakMap,S=new WeakMap,b=new WeakSet,A=function(){const{renderer:e}=pe(this,w);e.on("load",(()=>{this.drawFrame()}))},I=function(){if("DRAWING"===pe(this,S)||0===pe(this,x).length)return;xe(this,S,"DRAWING");const e=pe(this,x).shift(),{renderer:t,boardContent:i,beforeDrawFrame:o,afterDrawFrame:n}=pe(this,w);if(e){const{scale:r,offsetTop:l,offsetBottom:a,offsetLeft:s,offsetRight:h,width:c,height:d,contextHeight:u,contextWidth:f,devicePixelRatio:g}=e.activeStore,v={scale:r,offsetTop:l,offsetBottom:a,offsetLeft:s,offsetRight:h},m={width:c,height:d,contextHeight:u,contextWidth:f,devicePixelRatio:g};(null==e?void 0:e.activeStore.data)&&t.drawData(e.activeStore.data,{viewScaleInfo:v,viewSizeInfo:m}),o({snapshot:e}),i.drawView(),n({snapshot:e})}0!==pe(this,x).length?"DRAWING"===pe(this,S)&&yo((()=>{Se(this,b,I).call(this)})):xe(this,S,"COMPLETE")};class wo{constructor(e){we(this,W),we(this,M),we(this,z,new Map),we(this,R,[]),we(this,C),we(this,E),we(this,T),we(this,P),we(this,L),we(this,O,new tt),we(this,k,!1);const{boardContent:t}=e,i=new mo,o=new go({boardContent:t,sharer:i,disabled:null==e?void 0:e.disableWatcher}),n=new uo({viewContext:t.viewContext,tempContext:t.tempContext,sharer:i}),r=n.getCalculator();xe(this,M,e),xe(this,T,i),xe(this,C,o),xe(this,E,n),xe(this,L,r),xe(this,P,new po({boardContent:e.boardContent,sharer:i,renderer:n,calculator:pe(this,L),beforeDrawFrame:e=>{Se(this,W,J).call(this,e)},afterDrawFrame:e=>{Se(this,W,K).call(this,e)}})),Se(this,W,D).call(this),Se(this,W,q).call(this)}isDestroyed(){return pe(this,k)}destroy(){pe(this,C).destroy(),pe(this,E).destroy(),pe(this,L).destroy(),pe(this,O).destroy(),xe(this,k,!0)}getSharer(){return pe(this,T)}getViewer(){return pe(this,P)}getRenderer(){return pe(this,E)}setData(e){const t=pe(this,T);pe(this,T).setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=t.getActiveViewScaleInfo(),n=zt(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});pe(this,P).resetVirtualFlatItemMap(e,{viewSizeInfo:i,viewScaleInfo:o}),pe(this,P).drawFrame();const r={...i,...n};return pe(this,T).setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:e}=pe(this,T).getActiveStoreSnapshot();return e}use(e,t){var i,o,n;if(pe(this,z).has(e)){const t=pe(this,z).get(e);return void(t&&"enable"!==t.status&&(t.status="enable",null==(o=(i=t.middlewareObject).use)||o.call(i),Se(this,W,q).call(this)))}const{boardContent:r,container:l}=pe(this,M),a=e({boardContent:r,sharer:pe(this,T),viewer:pe(this,P),calculator:pe(this,L),eventHub:pe(this,O),container:l},t);null==(n=a.use)||n.call(a),pe(this,z).set(e,{status:"enable",middlewareObject:a,config:t}),Se(this,W,q).call(this)}disuse(e){var t,i;if(pe(this,z).has(e)){const o=pe(this,z).get(e);o&&(null==(i=(t=o.middlewareObject).disuse)||i.call(t),o.status="disable"),pe(this,z).delete(e),Se(this,W,q).call(this)}}resetMiddlewareConfig(e,t){var i,o;if(pe(this,z).has(e)){const n=pe(this,z).get(e);n&&(null==(o=(i=n.middlewareObject).resetConfig)||o.call(i,t))}}scale(e){const t=pe(this,P),{ignoreUpdateVisibleStatus:i}=e,{moveX:o,moveY:n}=t.scale({...e,ignoreUpdateVisibleStatus:!0});t.scroll({moveX:o,moveY:n,ignoreUpdateVisibleStatus:i})}scroll(e){return pe(this,P).scroll(e)}updateViewScaleInfo(e){return pe(this,P).updateViewScaleInfo(e)}resize(e,t){const i=pe(this,P).resize(e,t),{width:o,height:n,devicePixelRatio:r}=e,{boardContent:l}=pe(this,M);l.viewContext.$resize({width:o,height:n,devicePixelRatio:r}),l.overlayContext.$resize({width:o,height:n,devicePixelRatio:r}),l.boardContext.$resize({width:o,height:n,devicePixelRatio:r}),l.underlayContext.$resize({width:o,height:n,devicePixelRatio:r}),pe(this,P).drawFrame(),pe(this,C).trigger("resize",i),pe(this,T).setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=pe(this,M),{underlayContext:t,overlayContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),Se(this,W,$).call(this)}getEventHub(){return pe(this,O)}onWatcherEvents(){!0!==pe(this,M).disableWatcher&&pe(this,C).onEvents()}offWatcherEvents(){!0!==pe(this,M).disableWatcher&&pe(this,C).offEvents()}}M=new WeakMap,z=new WeakMap,R=new WeakMap,C=new WeakMap,E=new WeakMap,T=new WeakMap,P=new WeakMap,L=new WeakMap,O=new WeakMap,k=new WeakMap,W=new WeakSet,D=function(){!0!==pe(this,M).disableWatcher&&(pe(this,C).on("pointStart",Se(this,W,j).bind(this)),pe(this,C).on("pointEnd",Se(this,W,Y).bind(this)),pe(this,C).on("pointMove",Se(this,W,N).bind(this)),pe(this,C).on("pointLeave",Se(this,W,B).bind(this)),pe(this,C).on("hover",Se(this,W,F).bind(this)),pe(this,C).on("wheel",Se(this,W,X).bind(this)),pe(this,C).on("wheelScale",Se(this,W,H).bind(this)),pe(this,C).on("scrollX",Se(this,W,Z).bind(this)),pe(this,C).on("scrollY",Se(this,W,Q).bind(this)),pe(this,C).on("resize",Se(this,W,U).bind(this)),pe(this,C).on("doubleClick",Se(this,W,G).bind(this)),pe(this,C).on("contextMenu",Se(this,W,V).bind(this))),pe(this,E).on("load",(()=>{pe(this,O).trigger("loadResource")}))},j=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointStart)?void 0:t.call(o,e)))return}},Y=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointEnd)?void 0:t.call(o,e)))return}},N=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointMove)?void 0:t.call(o,e)))return}},B=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.pointLeave)?void 0:t.call(o,e)))return}},F=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.hover)?void 0:t.call(o,e)))return}},G=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.doubleClick)?void 0:t.call(o,e)))return}},V=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.contextMenu)?void 0:t.call(o,e)))return}},X=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.wheel)?void 0:t.call(o,e)))return}},H=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.wheelScale)?void 0:t.call(o,e)))return}},Z=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.scrollX)?void 0:t.call(o,e)))return}},Q=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.scrollY)?void 0:t.call(o,e)))return}},U=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.resize)?void 0:t.call(o,e)))return}},$=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.clear)?void 0:t.call(o,e)))return}},J=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.beforeDrawFrame)?void 0:t.call(o,e)))return}},K=function(e){var t;for(let i=0;i<pe(this,R).length;i++){const o=pe(this,R)[i];if(!1===(null==(t=null==o?void 0:o.afterDrawFrame)?void 0:t.call(o,e)))return}},q=function(){const e=[];for(const[t,i]of pe(this,z))"enable"===(null==i?void 0:i.status)&&(null==i?void 0:i.middlewareObject)&&e.push(i.middlewareObject);xe(this,R,e)};const xo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAAL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6qC1O4T0xMfKYnb21tnXEDNjc3z+nXbW1t3wFvYz9dCAL7KUThHovFPtGTNjU1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==",So="selectInGroup",bo={CURSOR:"cursor",CHANGE:"change",RULER:"ruler",SCALE:"scale",SELECT_LAYOUT:"selectLayout",SELECT:"select",CLEAR_SELECT:"clearSelect",TEXT_EDIT:"textEdit",TEXT_CHANGE:"textChange",CONTEXT_MENU:"contextMenu",SELECT_IN_GROUP:So,SNAP_TO_GRID:So},Ao={};Object.keys(bo).forEach((e=>{Object.defineProperty(Ao,e,{value:bo[e],writable:!1})}));class Io{constructor(e,t){we(this,ne),we(this,_),we(this,ee),we(this,te,null),we(this,ie,null),we(this,oe,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCA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zgx5J+ZiGeLSk8GaD34ky5Hd23JP1I0h8kPQmGu7y8/L/aNEUiEe3fv1/Dw8Pp6Es6KqlZ0puSXpHbVU4KiPVglqQFkr4j6aeSfi/pvq/13r172rVrlyorK6cFFo1GtXnzZl25ciU4Ch5J+qOkH0v6tqTXzDk5EwGGlNFjOWQOd8px4vUN4E3cpn2pz/jgwQPef/99Ll68yJ07d+jt7WVwcJBIJEJJSQlz586loaGBTZs2UVdXF5w0OoDLwFWcbPsct6r04+bRLHEYCoWyAD1kBDfHleHmsxrccccS3NFHNV/eenBy6iZwCycMOnHz5wBuDh2nyyY6H0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),xe(this,ee,e),xe(this,_,t.eventHub),Se(this,ne,re).call(this),Se(this,ne,le).call(this)}}function Mo(e){const{modifiedElement:t,beforeElement:i}=e,{uuid:o,...n}=t,r=qt(n);let l={};Object.keys(r).forEach((e=>{let t=ii(i,e);void 0===t&&/(borderRadius|borderWidth)\[[0-9]{1,}\]$/.test(e)&&(e=e.replace(/\[[0-9]{1,}\]$/,""),t=ii(i,e)),l[e]=t})),l=qt(l);return{type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:o,before:l,after:r}}}_=new WeakMap,ee=new WeakMap,te=new WeakMap,ie=new WeakMap,oe=new WeakMap,ne=new WeakSet,re=function(){const e=pe(this,_);Se(this,ne,ae).call(this,"default"),e.on(Ao.CURSOR,(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?Se(this,ne,ae).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?Se(this,ne,se).call(this,e):"drag-default"===e.type?Se(this,ne,ae).call(this,"drag-default"):"drag-active"===e.type?Se(this,ne,ae).call(this,"drag-active"):Se(this,ne,ae).call(this,"auto"):Se(this,ne,ae).call(this,"auto")}))},le=function(){Oe(xo).then((e=>{xe(this,ie,e)})).catch((e=>{console.error(e)}))},ae=function(e){if(pe(this,te)===e)return;xe(this,te,e);const t=pe(this,oe)[pe(this,te)]||pe(this,oe).auto;let i=0,o=0;(e.startsWith("rotate-")&&pe(this,oe)[pe(this,te)]||"rotate"===e)&&(i=10,o=10),pe(this,ee).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${i} ${o}, auto`},se=function(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=It((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=It(e.angle||0)})),i=It(i);const o=Se(this,ne,he).call(this,i);Se(this,ne,ae).call(this,o)},he=function(e){const t=`rotate-${e}`;if(!pe(this,oe)[t]){const i=pe(this,ie);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,l={x:n/2,y:r/2};o.width=n,o.height=r;const a=o.getContext("2d"),s=ft(e);a.translate(l.x,l.y),a.rotate(s),a.translate(-l.x,-l.y),a.drawImage(i,0,0,n,r),a.translate(l.x,l.y),a.rotate(-s),a.translate(-l.x,-l.y);const h=o.toDataURL("image/png");pe(this,oe)[t]=h}}return t};const zo="SELECT",Ro=Symbol(`${zo}_actionType`),Co=Symbol(`${zo}_resizeType`),Eo=Symbol(`${zo}_areaStart`),To=Symbol(`${zo}_areaEnd`),Po=Symbol(`${zo}_hoverElement`),Lo=Symbol(`${zo}_hoverElementVertexes`),Oo=Symbol(`${zo}_selectedElementList`),ko=Symbol(`${zo}_selectedElementListVertexes`),Wo=Symbol(`${zo}_selectedElementController`),Do=Symbol(`${zo}_selectedElementPosition`),jo=Symbol(`${zo}_groupQueue`),Yo=Symbol(`${zo}_groupQueueVertexesList`),No=Symbol(`${zo}_isMoving`),Bo=Symbol(`${zo}_enableSelectInGroup`),Fo=Symbol(`${zo}_enableSnapToGrid`),Go={activeColor:"#1973ba",activeAreaColor:"#1976d21c",lockedColor:"#5b5959b5",referenceColor:"#f7276e"};function Vo(e,t,i){const{borderColor:o,borderWidth:n,background:r,lineDash:l}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=r,e.setLineDash(l),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill("nonzero")}function Xo(e,t,i,o){const{borderColor:n,borderWidth:r,lineDash:l}=o;e.setLineDash([]),e.lineWidth=r,e.strokeStyle=n,e.setLineDash(l),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}function Ho(e,t,i){const{borderColor:o,borderWidth:n,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function Zo(e,t,i){const{size:o,borderColor:n,borderWidth:r,lineDash:l}=i,a=t.x-o/2,s=t.x+o/2,h=t.y-o/2,c=t.y+o/2;Ho(e,[{x:a,y:h},{x:s,y:h},{x:s,y:c},{x:a,y:c}],{borderColor:n,borderWidth:r,lineDash:l})}function Qo(e,t,i){if(!t)return;const{style:o}=i,{activeColor:n}=o,r={borderColor:n,borderWidth:1,background:"transparent",lineDash:[]};Vo(e,jt(t,i),r)}function Uo(e,t,i){if(!t)return;const{style:o}=i,{lockedColor:n}=o,r={borderColor:n,borderWidth:1,background:"transparent",lineDash:[]};Vo(e,jt(t,i),r);const{controller:l}=i;if(l){const{topLeft:t,topRight:o,bottomLeft:n,bottomRight:a,topMiddle:s,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=l,u={...r,borderWidth:1};Ho(e,jt(s.vertexes,i),u),Ho(e,jt(h.vertexes,i),u),Ho(e,jt(c.vertexes,i),u),Ho(e,jt(d.vertexes,i),u),Ho(e,jt(t.vertexes,i),u),Ho(e,jt(o.vertexes,i),u),Ho(e,jt(n.vertexes,i),u),Ho(e,jt(a.vertexes,i),u)}}function $o(e,t,i){var o;if(!t)return;const{hideControllers:n,style:r,rotateControllerPattern:l,viewSizeInfo:a,element:s}=i,{devicePixelRatio:h=1}=a,{activeColor:c}=r,{elementWrapper:d,topLeft:u,topRight:f,bottomLeft:g,bottomRight:v,rotate:m}=t,y={borderColor:c,borderWidth:2,background:"transparent",lineDash:[]},p={...y,borderWidth:4,background:"#FFFFFF"};if(Vo(e,jt(d,i),y),!n&&(Vo(e,jt(u.vertexes,i),p),Vo(e,jt(f.vertexes,i),p),Vo(e,jt(g.vertexes,i),p),Vo(e,jt(v.vertexes,i),p),!1!==(null==(o=null==s?void 0:s.operations)?void 0:o.rotatable))){!function(e,t,i){const{size:o,background:n}=i,r=t,l=o/2,a=l,s=l;a>=0&&s>=0&&(e.beginPath(),e.fillStyle=n,e.circle(r.x,r.y,a,s,0,0,2*Math.PI),e.closePath(),e.fill("nonzero"))}(e,Dt(m.center,i),{...p,size:m.size});const t=Dt(m.center,i);e.drawImage(l.canvas,0,0,l.canvas.width/h,l.canvas.height/h,t.x-m.size/2,t.y-m.size/2,m.size,m.size)}}function Jo(e,t){const{xLines:i,yLines:o,style:n}=t,{referenceColor:r}=n,l={borderColor:r,borderWidth:1,lineDash:[]},a={...l,size:6};i&&i.forEach((t=>{t.forEach(((i,o)=>{Zo(e,i,a),t[o+1]&&Xo(e,t[o],t[o+1],l)}))})),o&&o.forEach((t=>{t.forEach(((i,o)=>{Zo(e,i,a),t[o+1]&&Xo(e,t[o],t[o+1],l)}))}))}function Ko(e){return e*Math.PI/180}function qo(e,t){return Math.sqrt(e*e+t*t)}function _o(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function en(e,t){const{ctx:i,viewScaleInfo:o,vertexes:n}=t,r=Dt(n[0],{viewScaleInfo:o}),l=Dt(n[1],{viewScaleInfo:o}),a=Dt(n[2],{viewScaleInfo:o}),s=Dt(n[3],{viewScaleInfo:o});return i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(l.x,l.y),i.lineTo(a.x,a.y),i.lineTo(s.x,s.y),i.lineTo(r.x,r.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function tn(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:r}=t;if(!(r&&(null==r?void 0:r.length)>0))return!1;const l=Ot(r),a=l[l.length-1];return!!a&&en(e,{ctx:i,vertexes:a,viewScaleInfo:o})}function on(e,t){var i,o,n,r,l;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:s,data:h,calculator:c,selectedElements:d,viewScaleInfo:u,viewSizeInfo:f,areaSize:g,groupQueue:v,selectedElementController:m}=t;if(m){const{left:t,right:n,top:r,bottom:l,topLeft:h,topRight:c,bottomLeft:f,bottomRight:g,rotate:y}=m,p=[t,n,r,l,h,c,f,g];1===(null==d?void 0:d.length)&&!1!==(null==(o=null==(i=null==d?void 0:d[0])?void 0:i.operations)?void 0:o.rotatable)&&p.push(y);for(let t=0;t<p.length;t++){const i=p[t];if(en(e,{ctx:s,vertexes:i.vertexes,viewScaleInfo:u})){if(a.type=`resize-${i.type}`,d&&(null==d?void 0:d.length)>0)return a.groupQueue=v||[],a.elements=[d[0]],a;break}}}if(v&&Array.isArray(v)&&v.length>0){const t=v[v.length-1];if((null==(n=null==t?void 0:t.detail)?void 0:n.children)&&Array.isArray(null==(r=null==t?void 0:t.detail)?void 0:r.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=kt(o,{groupQueue:v});if(n&&en(e,{ctx:s,vertexes:n,viewScaleInfo:u}))return a.type||(a.type="over-element"),a.groupQueue=v,a.elements=[o],a}return a}if(null!==a.type)return a;if(g&&Array.isArray(d)&&(null==d?void 0:d.length)>1){const{x:t,y:i,w:o,h:n}=g;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=d,a}if(h){const{index:t,element:i}=c.getPointElement(e,{data:h,viewScaleInfo:u,viewSizeInfo:f});if(t>=0&&i&&!0!==(null==(l=null==i?void 0:i.operations)?void 0:l.invisible))return a.elements=[i],a.type="over-element",a}return a}function nn(e,t){const{x:i,y:o,w:n,h:r,angle:l=0}=e,{center:a,start:s,end:h,viewScaleInfo:c}=t,d=Dt(a,{viewScaleInfo:c}),u=It(l),f=function(e,t,i){const o=pt(e,t),n=pt(e,i);return null!==n&&null!==o?n-o:0}(d,s,h);return{x:i,y:o,w:n,h:r,angle:It(u+f/Math.PI*180)}}function rn(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{viewScaleInfo:n}=t;let r=null;for(let t=0;t<e.length;t++){const l=e[t];if(null==(i=null==l?void 0:l.operations)?void 0:i.invisible)continue;const a=Wt(l,{viewScaleInfo:n});if(a.angle&&(a.angle>0||a.angle<0)){const e=bt(a);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];a.x=Math.min(...t),a.y=Math.min(...i),a.w=Math.abs(Math.max(...t)-Math.min(...t)),a.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(r){const e=Math.min(a.x,o.x),t=Math.min(a.y,o.y),i=Math.max(a.x+a.w,o.x+o.w),n=Math.max(a.y+a.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=a.x,o.y=a.y,o.w=a.w,o.h=a.h;r=a}return o}function ln(e){return{minX:e.topLeft.x,minY:e.topLeft.y,maxX:e.bottomRight.x,maxY:e.bottomRight.y,midX:e.center.x,midY:e.center.y}}const an=(e,t)=>{if(0===e.length)throw null;if(1===e.length)return e[0];let i=0,o=e.length-1;for(;i<=o;){const n=Math.floor((i+o)/2);if(e[n]===t)return e[n];e[n]<t?i=n+1:o=n-1}return i>=e.length?e[o]:o<0?e[i]:Math.abs(e[o]-t)<=Math.abs(e[i]-t)?e[o]:e[i]},sn=(e,t)=>Math.abs(e-t)<1e-5;function hn(e,t){var i,o;const{data:n,groupQueue:r,calculator:l,viewScaleInfo:a,viewSizeInfo:s}=t;let h=n.elements||[];(null==r?void 0:r.length)>0&&(h=(null==(o=null==(i=r[r.length-1])?void 0:i.detail)?void 0:o.children)||[]);const c=[];h.forEach((t=>{if(t.uuid!==e){const e=l.calcViewRectInfoFromRange(t.uuid,{checkVisible:!0,viewScaleInfo:a,viewSizeInfo:s});e&&c.push(e)}}));const d=l.calcViewRectInfoFromRange(e,{viewScaleInfo:a,viewSizeInfo:s});if(!d)return null;const u={},f={},g=[],v=[];let m=[],y=[];const p=ln(d);c.forEach((e=>{const t=ln(e);u[t.minX]||(u[t.minX]=[]),u[t.midX]||(u[t.midX]=[]),u[t.maxX]||(u[t.maxX]=[]),f[t.minY]||(f[t.minY]=[]),f[t.midY]||(f[t.midY]=[]),f[t.maxY]||(f[t.maxY]=[]),u[t.minX]=[t.minY,t.midY,t.maxY],u[t.midX]=[t.minY,t.midY,t.maxY],u[t.maxX]=[t.minY,t.midY,t.maxY],m.push(t.minX),m.push(t.midX),m.push(t.maxX),f[t.minY]=[t.minX,t.midX,t.maxX],f[t.midY]=[t.minX,t.midX,t.maxX],f[t.maxY]=[t.minX,t.midX,t.maxX],y.push(t.minY),y.push(t.midY),y.push(t.maxY)})),m=m.sort(((e,t)=>e-t)),y=y.sort(((e,t)=>e-t));let w=null,x=null,S=null,b=null,A=null,I=null,M=null,z=null;if(m.length>0){S=an(m,p.minX),b=an(m,p.midX),A=an(m,p.maxX);const e=Math.abs(S-p.minX),t=Math.abs(b-p.midX),i=Math.abs(A-p.maxX),o=Math.min(e,t,i);o<=2/a.scale&&(sn(o,e)?w=S-p.minX:sn(o,t)?w=b-p.midX:sn(o,i)&&(w=A-p.maxX))}if(y.length>0){I=an(y,p.minY),M=an(y,p.midY),z=an(y,p.maxY);const e=Math.abs(I-p.minY),t=Math.abs(M-p.midY),i=Math.abs(z-p.maxY),o=Math.min(e,t,i);o<=2/a.scale&&(sn(o,e)?x=I-p.minY:sn(o,t)?x=M-p.midY:sn(o,i)&&(x=z-p.maxY))}const R={...p};if(null!==w&&(R.minX+=w,R.midX+=w,R.maxX+=w),null!==x&&(R.minY+=x,R.midY+=x,R.maxY+=x),He.x(w)&&null!==w&&null!==S&&null!==b&&null!==A){if(sn(w,S-p.minX)){const e={x:S,yList:[]};e.yList.push(R.minY),e.yList.push(R.maxY),e.yList.push(...(null==f?void 0:f[S])||[]),g.push(e)}if(sn(w,b-p.minX)){const e={x:b,yList:[]};e.yList.push(R.minY),e.yList.push(R.maxY),e.yList.push(...(null==f?void 0:f[b])||[]),g.push(e)}if(sn(w,A-p.minX)){const e={x:A,yList:[]};e.yList.push(R.minY),e.yList.push(R.maxY),e.yList.push(...(null==f?void 0:f[A])||[]),g.push(e)}}if(He.y(x)&&null!==x&&null!==I&&null!==M&&null!==z){if(sn(x,I-p.minY)){const e={y:I,xList:[]};e.xList.push(R.minX),e.xList.push(R.maxX),e.xList.push(...(null==u?void 0:u[I])||[]),v.push(e)}if(sn(x,M-p.midY)){const e={y:M,xList:[]};e.xList.push(R.minX),e.xList.push(R.maxX),e.xList.push(...(null==u?void 0:u[I])||[]),v.push(e)}if(sn(x,z-p.maxY)){const e={y:z,xList:[]};e.xList.push(R.minX),e.xList.push(R.maxX),e.xList.push(...(null==u?void 0:u[z])||[]),v.push(e)}}const C=[];(null==g?void 0:g.length)>0&&g.forEach(((e,t)=>{C.push([]),e.yList.forEach((i=>{C[t].push({x:e.x,y:i})}))}));const E=[];return(null==v?void 0:v.length)>0&&v.forEach(((e,t)=>{E.push([]),e.xList.forEach((i=>{E[t].push({x:i,y:e.y})}))})),{offsetX:w,offsetY:x,yLines:C,xLines:E}}const cn="LAYOUT_SELECT",dn=Symbol(`${cn}_layoutActionType`),un=Symbol(`${cn}_layoutControlType`),fn=Symbol(`${cn}_layoutController`),gn=Symbol(`${cn}_layoutIsHoverContent`),vn=Symbol(`${cn}_layoutIsHoverController`),mn=Symbol(`${cn}_layoutIsSelected`),yn=Symbol(`${cn}_layoutIsSelected`),pn={activeColor:"#b331c9"};function wn(e,t,i){const{activeColor:o}=i;e.setLineDash([]),e.fillStyle="#FFFFFF",e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.fill("nonzero"),e.strokeStyle=o,e.lineWidth=2,e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function xn(e,t){const{start:i,end:o,style:n}=t,{activeColor:r}=n,l=r;e.setLineDash([]),e.strokeStyle=l,e.lineWidth=2,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,o.y),e.closePath(),e.stroke()}function Sn(e){const{fill:t,devicePixelRatio:i}=e,o=(e=>({uuid:Ie(),type:"path",x:0,y:0,w:200,h:200,detail:{commands:[{type:"M",params:[512,0]},{type:"c",params:[282.8,0,512,229.2,512,512]},{type:"s",params:[-229.2,512,-512,512]},{type:"S",params:[0,794.8,0,512,229.2,0,512,0]},{type:"z",params:[]},{type:"m",params:[309.8,253.8]},{type:"c",params:[0,-10.5,-6.5,-19.8,-15.7,-23.8,-9.7,-4,-21,-2,-28.2,5.6]},{type:"l",params:[-52.5,52]},{type:"c",params:[-56.9,-53.7,-133.9,-85.5,-213.4,-85.5,-170.7,0,-309.8,139.2,-309.8,309.8,0,170.6,139.2,309.8,309.8,309.8,92.4,0,179.5,-40.8,238.4,-111.8,4,-5.2,4,-12.9,-.8,-17.3]},{type:"L",params:[694.3,637]},{type:"c",params:[-2.8,-2.4,-6.5,-3.6,-10.1,-3.6,-3.6,.4,-7.3,2,-9.3,4.8,-39.5,51.2,-98.8,80.3,-163,80.3,-113.8,0,-206.5,-92.8,-206.5,-206.5,0,-113.8,92.8,-206.5,206.5,-206.5,52.8,0,102.9,20.2,140.8,55.3]},{type:"L",params:[597,416.5]},{type:"c",params:[-7.7,7.3,-9.7,18.6,-5.6,27.9,4,9.7,13.3,16.1,23.8,16.1]},{type:"H",params:[796]},{type:"c",params:[14.1,0,25.8,-11.7,25.8,-25.8]},{type:"V",params:[253.8]},{type:"z",params:[]}],fill:"#2c2c2c",stroke:"transparent",strokeWidth:0,originX:0,originY:0,originW:1024,originH:1024,opacity:1,...e}}))({fill:t}),{w:n,h:r}=o,l=Ke({width:n,height:r,devicePixelRatio:i});return zi(l,o,{loader:void 0,viewScaleInfo:{scale:1,offsetTop:0,offsetBottom:0,offsetLeft:0,offsetRight:0},viewSizeInfo:{width:n,height:r,devicePixelRatio:i,contextWidth:n,contextHeight:r},parentElementSize:{x:0,y:0,w:n,h:r},parentOpacity:1}),{context2d:l,fill:t}}const bn="monospace";const An="@middleware/internal-event/show-info-angle",In={textBackground:"#1973bac6",textColor:"#ffffff"},Mn=10,zn="SCROLL",Rn=Symbol(`${zn}_xThumbRect`),Cn=Symbol(`${zn}_yThumbRect`),En=Symbol(`${zn}_hoverXThumbRect`),Tn=Symbol(`${zn}_hoverYThumbRect`),Pn=Symbol(`${zn}_prevPoint`),Ln=Symbol(`${zn}_activePoint`),On=Symbol(`${zn}_activeThumbType`),kn={thumbBackground:"#0000003A",thumbBorderColor:"#0000008A",hoverThumbBackground:"#0000005F",hoverThumbBorderColor:"#000000EE",activeThumbBackground:"#0000005E",activeThumbBorderColor:"#000000F0"};function Wn(e,t,i){const o=e,{x:n,y:r,w:l,h:a}=i;return o.beginPath(),o.rect(n,r,l,a),o.closePath(),!!o.isPointInPath(t.x,t.y)}function Dn(e,t){let{x:i,y:o,h:n,w:r}=t;const{background:l,borderColor:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+r/4+0,r/=2);let h=t.r;h=Math.min(h,r/2,n/2),(r<2*h||n<2*h)&&(h=0),e.globalAlpha=1,e.beginPath(),e.moveTo(i+h,o),e.arcTo(i+r,o,i+r,o+n,h),e.arcTo(i+r,o+n,i,o+n,h),e.arcTo(i,o+n,i,o,h),e.arcTo(i,o,i+r,o,h),e.closePath(),e.fillStyle=l,e.fill("nonzero"),e.beginPath(),e.lineWidth=1,e.strokeStyle=a,e.setLineDash([]),e.moveTo(i+h,o),e.arcTo(i+r,o,i+r,o+n,h),e.arcTo(i+r,o+n,i,o+n,h),e.arcTo(i,o+n,i,o,h),e.arcTo(i,o,i+r,o,h),e.closePath(),e.stroke()}e.restore()}function jn(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:r,style:l}=t,{activeThumbType:a,prevPoint:s,activePoint:h,hoverXThumb:c,hoverYThumb:d}=r,u=function(e){const{viewScaleInfo:t,viewSizeInfo:i,hoverXThumb:o,hoverYThumb:n,style:r}=e,{width:l,height:a}=i,{offsetTop:s,offsetBottom:h,offsetLeft:c,offsetRight:d}=t,u=16,{thumbBackground:f,thumbBorderColor:g,hoverThumbBackground:v,hoverThumbBorderColor:m}=r;let y=0,p=0;y=Math.max(40,l-32-(Math.abs(c)+Math.abs(d))),y>=l&&(y=l),p=Math.max(40,a-32-(Math.abs(s)+Math.abs(h))),p>=a&&(p=a);let w=16;c>0?w=16:d>0?w=l-y-u:c<=0&&y>0&&(0!==c||0!==d)&&(w=16+(l-y)*Math.abs(c)/(Math.abs(c)+Math.abs(d)),w=Math.min(Math.max(0,w-16),l-y));let x=16;return s>0?x=16:h>0?x=a-p-u:s<=0&&p>0&&(0!==s||0!==h)&&(x=16+(a-p)*Math.abs(s)/(Math.abs(s)+Math.abs(h)),x=Math.min(Math.max(0,x-16),a-p)),{lineSize:u,xSize:y,ySize:p,translateY:x,translateX:w,xThumbBackground:o?v:f,yThumbBackground:n?v:f,xThumbBorderColor:o?m:g,yThumbBorderColor:n?m:g,xThumbRect:{x:w,y:a-u,w:y,h:u},yThumbRect:{x:l-u,y:x,w:u,h:p}}}({viewScaleInfo:o,viewSizeInfo:n,hoverXThumb:c,hoverYThumb:d,style:l});let f={...u.xThumbRect},g={...u.yThumbRect};return a&&s&&h&&("X"===a&&r.xThumbRect?(f={...r.xThumbRect},f.x=f.x+(h.x-s.x)):"Y"===a&&r.yThumbRect&&(g={...r.yThumbRect},g.y=g.y+(h.y-s.y))),Dn(i,{axis:"X",...f,r:u.lineSize/2,background:u.xThumbBackground,borderColor:u.xThumbBorderColor}),Dn(i,{axis:"Y",...g,r:u.lineSize/2,background:u.yThumbBackground,borderColor:u.yThumbBorderColor}),{xThumbRect:f,yThumbRect:g}}function Yn(e,t){const{snapshot:i,style:o}=t,n=ut(i),r=dt(i),l=function(e){const{sharedStore:t}=e;return{activePoint:t[Ln]||null,prevPoint:t[Pn]||null,activeThumbType:t[On]||null,xThumbRect:t[Rn]||null,yThumbRect:t[Cn]||null,hoverXThumb:t[En],hoverYThumb:t[Tn]}}(i),{xThumbRect:a,yThumbRect:s}=jn(e,{viewSizeInfo:n,viewScaleInfo:r,scrollInfo:l,style:o});return{xThumbRect:a,yThumbRect:s}}const Nn=16,Bn="monospace",Fn={background:"#FFFFFFA8",borderColor:"#00000080",scaleColor:"#000000",textColor:"#00000080",gridColor:"#AAAAAA20",gridPrimaryColor:"#AAAAAA40",selectedAreaColor:"#19609780"},Gn=[1,2,5,10,20,50,100,200,500];function Vn(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let r=10;r=Zt(r/t,{decimalPlaces:0}),r=function(e){e=Math.max(Gn[0],Math.min(e,Gn[Gn.length-1]));for(let t=0;t<Gn.length-1;t++){const i=Gn[t],o=Gn[t+1];if(!(e>o))return e===i||e===o?e:e<=(i+o)/2?i:o}return e}(r);const l=10*r,a=5*r;let s=0;const h=r*t,c=0-o,d=c%h,u=(c-d+h)/t,f=h-d+0;for(;f+s*h<i;){const e=Zt(u+s*r,{decimalPlaces:0}),t={num:e,position:Zt(f+s*h,{decimalPlaces:0}),showNum:e%l==0,isKeyNum:e%l==0,isSubKeyNum:e%a==0};n.push(t),s++}return{list:n,rulerUnit:r}}const Xn={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"},Hn=Symbol("DRAG_prevPoint");return ce=new WeakMap,de=new WeakMap,ue=new WeakMap,fe=new WeakSet,ge=function(){pe(this,ue).style.position="relative"},ve=function(e){Mt((null==e?void 0:e.elements)||[]),pe(this,ce).setData(e)},e.Board=wo,e.Calculator=io,e.Core=class{constructor(e,t){we(this,fe),we(this,ce),we(this,de),we(this,ue);const{devicePixelRatio:i=1,width:o,height:n,disableWatcher:r=!1}=t;xe(this,ue,e);const l=document.createElement("canvas");l.setAttribute("tabindex","0"),xe(this,de,l),Se(this,fe,ge).call(this),e.appendChild(l);const a=qe(l,{width:o,height:n,devicePixelRatio:i}),s=new wo({boardContent:a,container:e,disableWatcher:r}),h=s.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),xe(this,ce,s),this.resize(h.getActiveViewSizeInfo());const c=s.getEventHub();new Io(e,{eventHub:c})}isDestroyed(){return pe(this,ce).isDestroyed()}destroy(){pe(this,ce).destroy(),pe(this,de).remove()}use(e,t){pe(this,ce).use(e,t)}disuse(e){pe(this,ce).disuse(e)}resetMiddlewareConfig(e,t){pe(this,ce).resetMiddlewareConfig(e,t)}setData(e){pe(this,ce).getRenderer().getLoader().reset(),Se(this,fe,ve).call(this,e)}getData(){return pe(this,ce).getData()}scale(e){pe(this,ce).scale(e);pe(this,ce).getViewer().drawFrame()}resize(e){const t=pe(this,ce),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){pe(this,ce).clear()}on(e,t){pe(this,ce).getEventHub().on(e,t)}off(e,t){pe(this,ce).getEventHub().off(e,t)}trigger(e,t){pe(this,ce).getEventHub().trigger(e,t)}getViewInfo(){const e=pe(this,ce).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){pe(this,ce).getViewer().drawFrame()}forceRender(){const e=pe(this,ce).getRenderer(),t=e.getCalculator(),i=e.getLoader(),o=this.getData();if(o){const{viewScaleInfo:e,viewSizeInfo:i}=this.getViewInfo();t.resetVirtualFlatItemMap(o,{viewScaleInfo:e,viewSizeInfo:i})}i.reset(),this.refresh()}setViewScale(e){pe(this,ce).updateViewScaleInfo(e)}getLoadItemMap(){return pe(this,ce).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){pe(this,ce).onWatcherEvents()}offBoardWatcherEvents(){pe(this,ce).offWatcherEvents()}createElement(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n}=this.getViewInfo();return hi(e,t||{},!0===(null==i?void 0:i.viewCenter)?{viewScaleInfo:o,viewSizeInfo:n}:void 0)}updateElement(e){const t=this.getData()||{elements:[]},i=e.uuid,o=Tt(i,t.elements),n=Et(o,t.elements);if(!n)return null;const r=qt(n),l=qt(gi(o,e,t.elements,{strict:!0}));pe(this,ce).getRenderer().getLoader().resetElementAsset(e),Se(this,fe,ve).call(this,t),this.refresh();return{type:"updateElement",time:Date.now(),content:{method:"updateElement",uuid:i,before:r,after:l}}}modifyElement(e){const{uuid:t,...i}=e,o=this.getData()||{elements:[]},n=Tt(t,o.elements),r=Et(n,o.elements);if(!r)return null;const l=Mo({modifiedElement:e,beforeElement:r});gi(n,i,o.elements);return pe(this,ce).getRenderer().getLoader().resetElementAsset({...e,type:r.type}),Se(this,fe,ve).call(this,o),this.refresh(),l}modifyElements(e){const t=this.getData()||{elements:[]};let i=null;const o=[],n=[];return e.forEach((e=>{const{uuid:i,...r}=e,l=Tt(i,t.elements),a=Et(l,t.elements);if(!a)return null;const s=Mo({modifiedElement:e,beforeElement:a});s.content&&(o.push({...s.content.before,uuid:i}),n.push({...s.content.after,uuid:i})),gi(l,r,t.elements)})),i={type:"modifyElements",time:Date.now(),content:{method:"modifyElements",before:o,after:n}},Se(this,fe,ve).call(this,t),this.refresh(),i}addElement(e,t){var i;const o=this.getData()||{elements:[]};if(t&&(null==(i=null==t?void 0:t.position)?void 0:i.length)){if(null==t?void 0:t.position){ci(e,[...(null==t?void 0:t.position)||[]],o.elements)}}else o.elements.push(e);const n=Tt(e.uuid,o.elements),r={type:"addElement",time:Date.now(),content:{method:"addElement",uuid:e.uuid,position:n,element:Ce(e)}};return Se(this,fe,ve).call(this,o),this.refresh(),r}deleteElement(e){const t=this.getData()||{elements:[]},i=Tt(e,t.elements),o=Et(i,t.elements),n={type:"deleteElement",time:Date.now(),content:{method:"deleteElement",uuid:e,position:i,element:o?Ce(o):null}};if(o){pe(this,ce).getRenderer().getLoader().resetElementAsset(o)}return function(e,t){di(Tt(e,t),t)}(e,t.elements),Se(this,fe,ve).call(this,t),this.refresh(),n}moveElement(e,t){const i=this.getData()||{elements:[]},o=Tt(e,i.elements),n={type:"moveElement",time:Date.now(),content:{method:"moveElement",uuid:e,from:[...o],to:[...t]}},{elements:r}=function(e,t){const i=[...t.from],o=[...t.to];if(0===i.length||0===o.length)return{elements:e,from:i,to:o};if(i.length<=o.length)for(let t=0;t<i.length;t++)if(o[t]!==i[t]);else if(t===i.length-1)return{elements:e,from:i,to:o};const n=Et(i,e);if(n){if(!ci(n,o,e))return{elements:e,from:i,to:o};let t=-1,r=!1;if(i.length>=1&&o.length>=1){if(i.length<=o.length)if(1===i.length)i[0]<o[0]&&(r=!0);else for(let e=0;e<i.length&&i[e]===o[e];e++)if(i.length===i.length-1){r=!0;break}if(i.length>=o.length)if(1===o.length)o[0]<i[0]&&(r=!0);else for(let e=0;e<o.length&&(e===o.length-1&&o[e]<i[e]&&(r=!0),i[e]===o[e]);e++);}if(!0===r)for(let e=0;e<i.length&&o[e]>=0;e++)o[e]!==i[e]&&o[e]<i[e]&&e==o.length-1&&(t=e);t>=0&&(i[t]=i[t]+1),di(i,e)}return{elements:e,from:i,to:o}}(i.elements,{from:o,to:t});return i.elements=r,Se(this,fe,ve).call(this,i),this.refresh(),n}modifyLayout(e){const t=this.getData()||{elements:[]},i={type:"modifyLayout",time:Date.now(),content:{method:"modifyLayout",before:null,after:null}};if(null===e)return t.layout?(i.content.before=_t(t.layout),delete t.layout,Se(this,fe,ve).call(this,t),this.refresh(),i):i;const o=t.layout;let n={};const r=_t(e);return t.layout?(Object.keys(r).forEach((e=>{let t=ii(o,e);void 0===t&&/(borderRadius|borderWidth)\[[0-9]{1,}\]$/.test(e)&&(e=e.replace(/\[[0-9]{1,}\]$/,""),t=ii(o,e)),n[e]=t})),n=_t(n),i.content.before=n):t.layout={},i.content.after=r,function(e,t){const i=_t(t),o=[];Object.keys(i).forEach((t=>{if(!o.includes(t)){const o=i[t];ni(e,t),void 0!==o&&oi(e,t,o)}}))}(t.layout,e),Se(this,fe,ve).call(this,t),this.refresh(),i}modifyGlobal(e){const t=this.getData()||{elements:[]},i={type:"modifyGlobal",time:Date.now(),content:{method:"modifyGlobal",before:null,after:null}};if(null===e)return t.global?(i.content.before=ei(t.global),delete t.global,Se(this,fe,ve).call(this,t),this.refresh(),i):i;const o=t.global;let n={};const r=ei(e);return t.global?(Object.keys(r).forEach((e=>{n[e]=ii(o,e)})),n=ei(n),i.content.before=n):t.global={},i.content.after=r,function(e,t){const i=ei(t),o=[];Object.keys(i).forEach((t=>{if(!o.includes(t)){const o=i[t];ni(e,t),void 0!==o&&oi(e,t,o)}}))}(t.global,e),Se(this,fe,ve).call(this,t),this.refresh(),i}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger(Ao.CURSOR,{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(Hn,o),n=!0,t.trigger(Ao.CURSOR,{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(Hn);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(Hn,t)},pointEnd(){n=!1,i.setSharedStorage(Hn,null),t.trigger(Ao.CURSOR,{type:"drag-default"})}}},e.MiddlewareInfo=(e,t)=>{const{boardContent:i,calculator:o,eventHub:n}=e,{overlayContext:r}=i;let l={...In,...t},a=!0;const s=({show:e})=>{a=e};return{name:"@middleware/info",use(){n.on(An,s)},disuse(){n.off(An,s)},resetConfig(e){l={...l,...e}},beforeDrawFrame({snapshot:e}){var t;const{textBackground:i,textColor:n}=l,s={textBackground:i,textColor:n},{sharedStore:h}=e,c=h[Oo],d=h[Ro],u=h[jo]||[];if(1===c.length){const i=c[0];if(i&&["select","drag","resize"].includes(d)){const n=dt(e),l=ut(e),{x:h,y:c,w:d,h:f,angle:g}=i,v=[...u,{uuid:Ie(),x:h,y:c,w:d,h:f,angle:g,type:"group",detail:{children:[]}}],m={viewScaleInfo:n,viewSizeInfo:l},y=o.calcViewRectInfoFromOrigin(i.uuid,m);let p=0;v.forEach((e=>{p+=e.angle||0}));const w=ft(It(0-p));if(y){const e=null==y?void 0:y.center,o={topLeft:wt(e,y.topLeft,w),topRight:wt(e,y.topRight,w),bottomRight:wt(e,y.bottomRight,w),bottomLeft:wt(e,y.bottomLeft,w),center:wt(e,y.center,w),top:wt(e,y.top,w),right:wt(e,y.right,w),bottom:wt(e,y.bottom,w),left:wt(e,y.left,w)},n=Zt(i.x,{decimalPlaces:2}),l=Zt(i.y,{decimalPlaces:2}),h=Zt(i.w,{decimalPlaces:2}),c=Zt(i.h,{decimalPlaces:2}),d=`${Zt(n,{decimalPlaces:0})},${Zt(l,{decimalPlaces:0})}`,u=`${Zt(h,{decimalPlaces:0})}x${Zt(c,{decimalPlaces:0})}`,f=`${Zt(i.angle||0,{decimalPlaces:0})}°`;!function(e,t){const{point:i,rotateCenter:o,angle:n,text:r,style:l,fontSize:a,lineHeight:s}=t,{textColor:h,textBackground:c}=l;gt(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:a,fontFamily:bn});const t=(s-a)/2,o=e.$undoPixelRatio(e.measureText(r).width),n={x:i.x-o/2-t,y:i.y},l={x:n.x+o+2*t,y:n.y+a+t},d={x:i.x-o/2,y:i.y};e.setLineDash([]),e.fillStyle=c,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(l.x,n.y),e.lineTo(l.x,l.y),e.lineTo(n.x,l.y),e.closePath(),e.fill("nonzero"),e.fillStyle=h,e.textBaseline="top",e.fillText(r,d.x,d.y+t)}))}(r,{point:{x:o.bottom.x,y:o.bottom.y+Mn},rotateCenter:o.center,angle:p,text:u,fontSize:Mn,lineHeight:16,style:s}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:r,style:l,fontSize:a,lineHeight:s}=t,{textBackground:h,textColor:c}=l;gt(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:a,fontFamily:bn});const t=(s-a)/2,o=e.$undoPixelRatio(e.measureText(r).width),n={x:i.x,y:i.y},l={x:n.x+o+2*t,y:n.y+a+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=h,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(l.x,n.y),e.lineTo(l.x,l.y),e.lineTo(n.x,l.y),e.closePath(),e.fill("nonzero"),e.fillStyle=c,e.textBaseline="top",e.fillText(r,d.x,d.y+t)}))}(r,{point:{x:o.topLeft.x,y:o.topLeft.y-20},rotateCenter:o.center,angle:p,text:d,fontSize:Mn,lineHeight:16,style:s}),a&&!1!==(null==(t=i.operations)?void 0:t.rotatable)&&function(e,t){const{point:i,rotateCenter:o,angle:n,text:r,style:l,fontSize:a,lineHeight:s}=t,{textBackground:h,textColor:c}=l;gt(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:a,fontFamily:bn});const t=(s-a)/2,o=e.$undoPixelRatio(e.measureText(r).width),n={x:i.x,y:i.y},l={x:n.x+o+2*t,y:n.y+a+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=h,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(l.x,n.y),e.lineTo(l.x,l.y),e.lineTo(n.x,l.y),e.closePath(),e.fill("nonzero"),e.fillStyle=c,e.textBaseline="top",e.fillText(r,d.x,d.y+t)}))}(r,{point:{x:o.top.x+Mn+4,y:o.top.y-20-18},rotateCenter:o.center,angle:p,text:f,fontSize:Mn,lineHeight:16,style:s})}}}}}},e.MiddlewareLayoutSelector=(e,t)=>{const{sharer:i,boardContent:o,calculator:n,viewer:r,eventHub:l}=e,{overlayContext:a}=o;let s={...pn,...t},h=null,c=null,d=null,u=null;const f=()=>{h=null,i.setSharedStorage(dn,null),i.setSharedStorage(un,null),i.setSharedStorage(fn,null),i.setSharedStorage(gn,null),i.setSharedStorage(vn,null),i.setSharedStorage(mn,null),i.setSharedStorage(yn,null),c=null,d=null},g=()=>{const e=i.getSharedStorage(Ro);return!(!e||"area"===e)&&(f(),!0)},v=()=>{const e=i.getActiveStorage("data");if(null==e?void 0:e.layout){const{x:t,y:i,w:o,h:n}=e.layout;return{x:t,y:i,w:o,h:n}}return null},m=e=>{const t=v();if(t){const{x:o,y:n,w:r,h:l}=t;return function(e,t){return Nt(e,Lt(t))}(e,Wt({x:o-5,y:n-5,w:r+10,h:l+10},{viewScaleInfo:i.getActiveViewScaleInfo()}))}return!1},y=()=>{const e=i.getActiveViewScaleInfo(),t=v();if(t){const o=Xt(t,{viewScaleInfo:e,controllerSize:10});i.setSharedStorage(fn,o)}else i.setSharedStorage(fn,null)},p=e=>{const t=i.getActiveStorage("data"),o=i.getSharedStorage(fn);let n=null;if(o&&(null==t?void 0:t.layout)&&(null==e?void 0:e.point)){let t=null;if(o){const{topLeft:r,top:a,topRight:s,right:h,bottomRight:c,bottom:d,bottomLeft:u,left:f}=o,g=[r,a,s,h,c,d,u,f];for(let i=0;i<g.length;i++){const o=g[i];if(Nt(e.point,o.vertexes)){t=`${o.type}`;break}}t&&(i.setSharedStorage(un,t),l.trigger(Ao.CLEAR_SELECT),n=t)}}return n?i.setSharedStorage(vn,!0):i.setSharedStorage(vn,!1),n},w=e=>{!0!==i.getSharedStorage(yn)&&l.trigger(Ao.CURSOR,{type:e?`resize-${e}`:e,groupQueue:[],element:v()})};return{name:"@middleware/layout-selector",use:()=>{f(),y()},resetConfig(e){s={...s,...e}},hover:e=>{if(!0!==i.getSharedStorage(yn)&&!g()){if(m(e.point)?i.setSharedStorage(gn,!0):(i.setSharedStorage(gn,!1),!0===c&&(r.drawFrame(),c=!1)),!0===i.getSharedStorage(mn)){const t=i.getSharedStorage(dn),o=i.getActiveStorage("data");if(null==o?void 0:o.layout)if("resize"!==t){y();const t=p(e);t?w(t):(w(),i.setSharedStorage(dn,null))}else{const t=p(e);w(t)}return!0!==i.getSharedStorage(vn)&&void 0}return i.getSharedStorage(gn)&&!c&&r.drawFrame(),c=i.getSharedStorage(gn),!0!==i.getSharedStorage(vn)&&void 0}},pointStart:e=>{if(g())return;m(e.point)?i.setSharedStorage(mn,!0):(!0===d&&(f(),r.drawFrame()),i.setSharedStorage(mn,!1));const t=i.getActiveStorage("data");u=(null==t?void 0:t.layout)?Ct(t.layout):null,y();const o=p(e);return h=e.point,o&&i.setSharedStorage(dn,"resize"),!0!==i.getSharedStorage(mn)||d||(r.drawFrame(),l.trigger(Ao.SELECT_LAYOUT)),d=i.getSharedStorage(mn),!0!==i.getSharedStorage(vn)&&void 0},pointMove:e=>{if(!i.getSharedStorage(mn)&&g())return;const t=i.getSharedStorage(dn),o=i.getSharedStorage(un),l=i.getActiveStorage("data");if("resize"===t&&o&&(null==l?void 0:l.layout)){if(h){i.setSharedStorage(yn,!0);const t=i.getActiveStorage("scale"),a=e.point.x-h.x,s=e.point.y-h.y,c=a/t,d=s/t,{x:u,y:f,w:g,h:v,operations:m={}}=l.layout,{position:y="absolute"}=m;"top"===o?"relative"===y?(l.layout.h=n.toGridNum(v-d),r.scroll({moveY:s})):(l.layout.y=n.toGridNum(f+d),l.layout.h=n.toGridNum(v-d)):"right"===o?l.layout.w=n.toGridNum(g+c):"bottom"===o?l.layout.h=n.toGridNum(v+d):"left"===o?"relative"===y?(l.layout.w=n.toGridNum(g-c),r.scroll({moveX:a})):(l.layout.x=n.toGridNum(u+c),l.layout.w=n.toGridNum(g-c)):"top-left"===o?"relative"===y?(l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v-d),r.scroll({moveX:a,moveY:s})):(l.layout.x=n.toGridNum(u+c),l.layout.y=n.toGridNum(f+d),l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v-d)):"top-right"===o?"relative"===y?(r.scroll({moveY:s}),l.layout.w=n.toGridNum(g+c),l.layout.h=n.toGridNum(v-d)):(l.layout.y=n.toGridNum(f+d),l.layout.w=n.toGridNum(g+c),l.layout.h=n.toGridNum(v-d)):"bottom-right"===o?(l.layout.w=n.toGridNum(g+c),l.layout.h=n.toGridNum(v+d)):"bottom-left"===o&&("relative"===y?(r.scroll({moveX:a}),l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v+d)):(l.layout.x=n.toGridNum(u+c),l.layout.w=n.toGridNum(g-c),l.layout.h=n.toGridNum(v+d)))}return h=e.point,y(),r.drawFrame(),!1}return!["resize"].includes(t)&&void 0},pointEnd:()=>{i.setSharedStorage(yn,!1);const e=i.getSharedStorage(dn),t=i.getSharedStorage(un),o=i.getActiveStorage("data");if(o&&"resize"===e&&t){let e;u&&(e={type:"modifyLayout",time:Date.now(),content:{method:"modifyLayout",before:_t(u),after:_t(Ct(o.layout))}}),l.trigger(Ao.CHANGE,{type:"resizeLayout",data:o,modifyRecord:e})}if(u=null,i.setSharedStorage(dn,null),i.setSharedStorage(un,null),!0===i.getSharedStorage(vn))return!1},beforeDrawFrame:({snapshot:e})=>{var t;if(g())return;const{activeColor:i}=s,o={activeColor:i},{sharedStore:n,activeStore:r}=e,l=n[dn],h=n[gn],c=n[mn];if(null==(t=r.data)?void 0:t.layout){const{x:t,y:i,w:n,h:s}=r.data.layout,d=dt(e),u={x:t,y:i,w:n,h:s},f=Xt(u,{viewScaleInfo:d,controllerSize:10});if(!0===h){const e=Wt(u,{viewScaleInfo:d});!function(e,t){const{layoutSize:i,style:o}=t,{activeColor:n}=o,{x:r,y:l,w:a,h:s}=i;e.setLineDash([]),e.strokeStyle=n,e.lineWidth=1,e.beginPath(),e.moveTo(r,l),e.lineTo(r+a,l),e.lineTo(r+a,l+s),e.lineTo(r,l+s),e.lineTo(r,l),e.closePath(),e.stroke()}(a,{layoutSize:e,style:o})}(l&&["resize"].includes(l)||!0===c)&&function(e,t){const{controller:i,style:o}=t,{topLeft:n,topRight:r,bottomLeft:l,bottomRight:a,topMiddle:s,rightMiddle:h,bottomMiddle:c,leftMiddle:d}=i;xn(e,{start:n.center,end:r.center,centerVertexes:s.vertexes,style:o}),xn(e,{start:r.center,end:a.center,centerVertexes:h.vertexes,style:o}),xn(e,{start:a.center,end:l.center,centerVertexes:c.vertexes,style:o}),xn(e,{start:l.center,end:n.center,centerVertexes:d.vertexes,style:o}),wn(e,n.vertexes,o),wn(e,r.vertexes,o),wn(e,a.vertexes,o),wn(e,l.vertexes,o)}(a,{controller:f,style:o})}},scrollX:()=>{f()},scrollY:()=>{f()},wheelScale:()=>{f()}}},e.MiddlewarePointer=e=>{const{boardContent:t,eventHub:i,sharer:o}=e,n=t.boardContext.canvas,r=e.container||document.body,l=`idraw-middleware-pointer-${Math.random().toString(26).substring(2)}`;let a=document.createElement("div");return{name:"@middleware/pointer",use(){a.setAttribute("id",l),a.style.position="fixed",a.style.top="0",a.style.bottom="unset",a.style.left="0",a.style.right="unset",r.appendChild(a)},disuse(){r.removeChild(a),a.remove(),a=null},contextMenu(e){const{point:t}=e,{left:r,top:l}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:r}=e;return{left:t,top:i,width:o,height:r}})();a.style.left=`${r+t.x}px`,a.style.top=`${l+t.y}px`;const s=o.getSharedStorage(Oo);i.trigger(Ao.CONTEXT_MENU,{pointerContainer:a,selectedElements:s||[]})}}},e.MiddlewareRuler=(e,t)=>{const{boardContent:i,viewer:o,eventHub:n,calculator:r}=e,{overlayContext:l,underlayContext:a}=i;let s={...Fn,...t},h=!0,c=!0;const d=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(h=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(c=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||o.drawFrame()};return{name:"@middleware/ruler",use(){n.on(Ao.RULER,d)},disuse(){n.off(Ao.RULER,d)},resetConfig(e){s={...s,...e}},beforeDrawFrame:({snapshot:e})=>{const{background:t,borderColor:i,scaleColor:o,textColor:n,gridColor:d,gridPrimaryColor:u,selectedAreaColor:f}=s,g={background:t,borderColor:i,scaleColor:o,textColor:n,gridColor:d,gridPrimaryColor:u,selectedAreaColor:f};if(!0===h){const t=dt(e),i=ut(e);!function(e,t){const{viewSizeInfo:i,style:o}=t,{width:n,height:r}=i,{background:l,borderColor:a}=o;e.beginPath();const s=-1;e.moveTo(s,s),e.lineTo(n+1,s),e.lineTo(n+1,Nn),e.lineTo(Nn,Nn),e.lineTo(Nn,r+1),e.lineTo(s,r+1),e.lineTo(s,s),e.closePath(),e.fillStyle=l,e.fill("nonzero"),e.lineWidth=1,e.setLineDash([]),e.strokeStyle=a,e.stroke()}(l,{viewSizeInfo:i,style:g}),function(e,t){const{snapshot:i,calculator:o,style:n}=t,{sharedStore:r}=i,{selectedAreaColor:l}=n,a=r[Oo],s=r[Ro];if(["select","drag","drag-list","drag-list-end"].includes(s)&&a.length>0){const t=dt(i),n=ut(i),r=[],s=[],h=[],c=[],d=[];if(a.forEach((e=>{const i=o.calcViewRectInfoFromRange(e.uuid,{viewScaleInfo:t,viewSizeInfo:n});i&&(r.push(i),s.push(i.left.x),h.push(i.right.x),c.push(i.top.y),d.push(i.bottom.y))})),!(r.length>0))return;const u=Math.min(...s),f=Math.max(...h),g=Math.min(...c),v=Math.max(...d);e.globalAlpha=1,e.beginPath(),e.moveTo(u,0),e.lineTo(f,0),e.lineTo(f,Nn),e.lineTo(u,Nn),e.fillStyle=l,e.closePath(),e.fill("nonzero"),e.beginPath(),e.moveTo(0,g),e.lineTo(Nn,g),e.lineTo(Nn,v),e.lineTo(0,v),e.fillStyle=l,e.closePath(),e.fill("nonzero")}}(l,{snapshot:e,calculator:r,style:g});const{list:o,rulerUnit:n}=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:r}=i;return Vn({scale:o,viewLength:r,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i,style:o}=t,{scaleColor:n,textColor:r}=o;for(let t=0;t<i.length;t++){const o=i[t];o.position<Nn||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=n,e.stroke(),o.isKeyNum&&(e.fillStyle=r,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:Bn}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(l,{scaleList:o,style:g});const{list:s}=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:r}=i;return Vn({scale:o,viewLength:r,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});if(function(e,t){const{scaleList:i,style:o}=t,{scaleColor:n,textColor:r}=o,l=3.2;for(let t=0;t<i.length;t++){const o=i[t];if(!(o.position<Nn)&&(e.beginPath(),e.moveTo(16,o.position),e.lineTo(o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8,o.position),e.closePath(),e.fillStyle=n,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===o.showNum)){const t=l,i=o.position+l,n=`${o.num}`;gt(e,-90,{x:t,y:i},(()=>{e.fillStyle=r,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:Bn}),e.fillText(n,13.2,o.position+l)}))}}}(l,{scaleList:s,style:g}),!0===c){!function(e,t){const{xList:i,yList:o,viewSizeInfo:n,style:r}=t,{width:l,height:a}=n,{gridColor:s,gridPrimaryColor:h}=r;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,a),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=h:e.strokeStyle=s,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(l,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=h:e.strokeStyle=s,e.lineWidth=1,e.closePath(),e.stroke()}}(1===n?l:a,{xList:o,yList:s,viewSizeInfo:i,style:g})}}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:r}=e,{scale:l}=i.getActiveViewScaleInfo();let a=l;if(n<0?a=1.1*l:n>0&&(a=.9*l),a<.05||a>50)return;const{moveX:s,moveY:h}=t.scale({scale:a,point:r});t.scroll({moveX:s,moveY:h}),t.drawFrame();const c=Zt(l);o.trigger(Ao.SCALE,{scale:c})}}},e.MiddlewareScroller=(e,t)=>{const{viewer:i,boardContent:o,sharer:n,eventHub:r}=e,{overlayContext:l}=o;n.setSharedStorage(Rn,null),n.setSharedStorage(Cn,null);let a=!1,s={...kn,...t};const h=()=>{n.setSharedStorage(Pn,null),n.setSharedStorage(Ln,null),n.setSharedStorage(On,null),n.setSharedStorage(En,null),n.setSharedStorage(Tn,null),a=!1};h();const c=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:r}=i;return n&&Wn(e,t,n)?o="X":r&&Wn(e,t,r)&&(o="Y"),o}(l,e,{xThumbRect:n.getSharedStorage(Rn),yThumbRect:n.getSharedStorage(Cn)});return{name:"@middleware/scroller",resetConfig(e){s={...s,...e}},wheel:e=>{i.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),i.drawFrame()},hover:e=>{if(!0===a)return!1;const{point:t}=e,i=c(t);if("X"===i||"Y"===i)return"X"===i?(n.setSharedStorage(En,!0),n.setSharedStorage(Tn,!1)):(n.setSharedStorage(En,!1),n.setSharedStorage(Tn,!0)),r.trigger(Ao.CURSOR,{type:"default"}),!1;n.setSharedStorage(En,!1),n.setSharedStorage(Tn,!1)},pointStart:e=>{const{point:t}=e,i=c(t);if("X"===i||"Y"===i)return a=!0,n.setSharedStorage(On,i),n.setSharedStorage(Pn,t),!1},pointMove:e=>{const{point:t}=e,o=n.getSharedStorage(On);if("X"===o||"Y"===o)return n.setSharedStorage(Ln,t),"X"===o?(e=>{const t=n.getSharedStorage(Pn);if(t){const{offsetLeft:o,offsetRight:r}=n.getActiveViewScaleInfo(),{width:l}=n.getActiveViewSizeInfo(),a=-(e.x-t.x)*(l+Math.abs(o)+Math.abs(r))/l;i.scroll({moveX:a}),i.drawFrame()}})(t):"Y"===o&&(e=>{const t=n.getSharedStorage(Pn);if(t){const{offsetTop:o,offsetBottom:r}=n.getActiveViewScaleInfo(),{height:l}=n.getActiveViewSizeInfo(),a=-(e.y-t.y)*(l+Math.abs(o)+Math.abs(r))/l;i.scroll({moveY:a}),i.drawFrame()}})(t),n.setSharedStorage(Pn,t),!1},pointEnd:()=>{a=!1;const e=n.getSharedStorage(On);if(h(),"X"===e||"Y"===e)return i.scroll({moveX:0,moveY:0}),i.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{thumbBackground:t,thumbBorderColor:i,hoverThumbBackground:o,hoverThumbBorderColor:r,activeThumbBackground:a,activeThumbBorderColor:h}=s,c={thumbBackground:t,thumbBorderColor:i,hoverThumbBackground:o,hoverThumbBorderColor:r,activeThumbBackground:a,activeThumbBorderColor:h},{xThumbRect:d,yThumbRect:u}=Yn(l,{snapshot:e,style:c});n.setSharedStorage(Rn,d),n.setSharedStorage(Cn,u)}}},e.MiddlewareSelector=(e,t)=>{let i={...Go,...t};const{viewer:o,sharer:n,boardContent:r,calculator:l,eventHub:a}=e,{overlayContext:s}=r;let h=null,c=[],d=null,u=null,f=null,g=null,v=Sn({fill:i.activeColor,devicePixelRatio:n.getActiveViewSizeInfo().devicePixelRatio}),m=null,y=null;n.setSharedStorage(Ro,null),n.setSharedStorage(Fo,!0);const p=()=>n.getSharedStorage(Oo),w=e=>{let t=n.getSharedStorage(jo);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const i=Ot(t);return n.setSharedStorage(jo,t),n.setSharedStorage(Yo,i),t.length>0},x=e=>{n.setSharedStorage(Po,e);let t=null;e&&(t=kt(e,{groupQueue:n.getSharedStorage(jo)})),n.setSharedStorage(Lo,t)},S=()=>{const e=n.getSharedStorage(Oo);if(1===e.length){const t=Vt(e[0],{groupQueue:n.getSharedStorage(jo),controllerSize:10,viewScaleInfo:n.getActiveViewScaleInfo(),rotateControllerPosition:22,rotateControllerSize:20});n.setSharedStorage(Wo,t)}},b=(e,t)=>{var i;if(n.setSharedStorage(Oo,e),1===e.length?(S(),n.setSharedStorage(Do,Tt(e[0].uuid,(null==(i=n.getActiveStorage("data"))?void 0:i.elements)||[]))):(n.setSharedStorage(Wo,null),n.setSharedStorage(Do,[])),!0===(null==t?void 0:t.triggerEvent)){const t=e.map((e=>e.uuid)),i=n.getActiveStorage("data"),o=function(e,t){const i=[],o={};let n=!1;const r=t=>{var l;for(let a=0;a<t.length&&!0!==n;a++){i.push(a);const s=t[a];if(e.includes(s.uuid)){if(o[s.uuid]=[...i],Object.keys(o).length===e.length){n=!0;break}}else"group"===s.type&&r((null===(l=null==s?void 0:s.detail)||void 0===l?void 0:l.children)||[]);if(n)break;i.pop()}};return r(t),o}(t,(null==i?void 0:i.elements)||[]);a.trigger(Ao.SELECT,{type:"clickCanvas",uuids:t,positions:e.map((e=>[...o[e.uuid]]))})}},A=()=>({ctx:s,calculator:l,data:n.getActiveStorage("data"),selectedElements:p(),viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:n.getSharedStorage(jo),areaSize:null,selectedElementController:n.getSharedStorage(Wo),selectedElementPosition:n.getSharedStorage(Do)}),I=()=>{m=null,y=null,n.setSharedStorage(Ro,null),n.setSharedStorage(Co,null),n.setSharedStorage(Eo,null),n.setSharedStorage(To,null),n.setSharedStorage(jo,[]),n.setSharedStorage(Yo,[]),n.setSharedStorage(Po,null),n.setSharedStorage(Lo,null),n.setSharedStorage(Oo,[]),n.setSharedStorage(ko,null),n.setSharedStorage(Wo,null),n.setSharedStorage(Do,[]),n.setSharedStorage(No,null)};I();const M=({uuids:e=[],positions:t})=>{let i=[];const r=n.getSharedStorage(Ro),l=n.getActiveStorage("data");i=t&&Array.isArray(t)?function(e,t){const i=[];return e.forEach((e=>{const o=Et(e,t);o&&i.push(o)})),i}(t,(null==l?void 0:l.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let r=0;r<o.length;r++){const l=o[r];e.includes(l.uuid)?i.push(l):"group"===l.type&&t((null===(n=null==l?void 0:l.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==l?void 0:l.elements)||[]);let a=!1;if(r||1!==i.length?"select"===r&&1===i.length&&(a=!0):(n.setSharedStorage(Ro,"select"),a=!0),a){const e=function(e,t){const i=[];return function e(t,o){var n;let r=null;for(let l=0;l<o.length;l++){const a=o[l];if(a.uuid===t){r=a;break}if(!r&&"group"===a.type){i.push(a);const o=e(t,(null===(n=null==a?void 0:a.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){r=o;break}i.pop()}}return r}(e,t),i}(i[0].uuid,(null==l?void 0:l.elements)||[]);n.setSharedStorage(jo,e),b(i),c=[{...Ct(i[0]),uuid:i[0].uuid}],o.drawFrame()}},z=()=>{I(),o.drawFrame()},R=e=>{n.setSharedStorage(Fo,!!e.enable)},C=e=>{n.setSharedStorage(Bo,!!e.enable)};return{name:"@middleware/selector",use(){a.on(Ao.SELECT,M),a.on(Ao.CLEAR_SELECT,z),a.on(Ao.SELECT_IN_GROUP,C),a.on(Ao.SNAP_TO_GRID,R)},disuse(){a.off(Ao.SELECT,M),a.off(Ao.CLEAR_SELECT,z),a.off(Ao.SELECT_IN_GROUP,C),a.off(Ao.SNAP_TO_GRID,R),I(),i=null},resetConfig(e){i={...i,...e}},hover:e=>{var t,i,r,l,h;const c=n.getSharedStorage(mn);if(!0===n.getSharedStorage(yn))return;const d=n.getSharedStorage(Co),u=n.getSharedStorage(Ro),g=n.getSharedStorage(jo),v=e=>{if(!0===c)return;const t=e.type;null===f&&a.trigger(Ao.CURSOR,{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==g?void 0:g.length)>0){if(!tn(e.point,{ctx:s,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:n.getSharedStorage(jo)}))return x(null),void o.drawFrame();const i=on(e.point,A());return v(i),d||["area","drag","drag-list"].includes(u)?(x(null),void o.drawFrame()):1===(null==(t=null==i?void 0:i.elements)?void 0:t.length)?(x(i.elements[0]),void o.drawFrame()):(x(null),void o.drawFrame())}if(d||["area","drag","drag-list"].includes(u))return void x(null);if("drag"===u)return void x(null);const m=p(),y=n.getActiveViewScaleInfo();n.getActiveViewSizeInfo();const w=on(e.point,{...A(),areaSize:rn(m,{viewScaleInfo:y})});if(v(w),null!==w.type){if(!("over-element"===w.type&&"select"===n.getSharedStorage(Ro)&&1===w.elements.length&&w.elements[0].uuid===(null==(r=null==(i=p())?void 0:i[0])?void 0:r.uuid)||"over-element"===w.type&&null===n.getSharedStorage(Ro)&&1===w.elements.length&&w.elements[0].uuid===(null==(l=n.getSharedStorage(Po))?void 0:l.uuid)))return"over-element"===w.type&&1===(null==(h=null==w?void 0:w.elements)?void 0:h.length)?(x(w.elements[0]),void o.drawFrame()):n.getSharedStorage(Po)?(x(null),void o.drawFrame()):void 0}else(n.getSharedStorage(Po)||n.getSharedStorage(Lo))&&(n.setSharedStorage(Po,null),n.setSharedStorage(Lo,null),o.drawFrame())},pointStart:e=>{var t,i,r,l,a,f,g,v,w,S,M,z;h=e.point,d=e.point,m=null,y=null,n.setSharedStorage(Ro,null),n.setSharedStorage(Co,null),n.setSharedStorage(Eo,null),n.setSharedStorage(To,null),n.setSharedStorage(Po,null);const R=n.getSharedStorage(jo);if((null==R?void 0:R.length)>0){if(tn(e.point,{ctx:s,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:R})){const o=on(e.point,A()),s=1===(null==(t=null==o?void 0:o.elements)?void 0:t.length)&&!0===(null==(r=null==(i=o.elements[0])?void 0:i.operations)?void 0:r.locked);x(null),1===(null==(l=null==o?void 0:o.elements)?void 0:l.length)&&(u=Ct(null==o?void 0:o.elements[0])),!0===s?I():"over-element"===o.type&&1===(null==(a=null==o?void 0:o.elements)?void 0:a.length)?(b([o.elements[0]],{triggerEvent:!0}),n.setSharedStorage(Ro,"drag"),c=[{...Ct(null==o?void 0:o.elements[0]),uuid:null==o?void 0:o.elements[0].uuid}]):(null==(f=o.type)?void 0:f.startsWith("resize-"))?(n.setSharedStorage(Co,o.type),n.setSharedStorage(Ro,"resize")):b([],{triggerEvent:!0})}else I();return void o.drawFrame()}const C=rn(p(),{viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),E=on(e.point,{...A(),areaSize:C,groupQueue:[]}),T=1===(null==(g=null==E?void 0:E.elements)?void 0:g.length)&&!0===(null==(w=null==(v=E.elements[0])?void 0:v.operations)?void 0:w.locked);x(null),1===(null==(S=null==E?void 0:E.elements)?void 0:S.length)&&(u=Ct(null==E?void 0:E.elements[0])),!0===T?(I(),n.setSharedStorage(Ro,"area"),n.setSharedStorage(Eo,e.point),b([],{triggerEvent:!0})):"list-area"===E.type?n.setSharedStorage(Ro,"drag-list"):"over-element"===E.type&&1===(null==(M=null==E?void 0:E.elements)?void 0:M.length)?(b([E.elements[0]],{triggerEvent:!0}),n.setSharedStorage(Ro,"drag"),c=[{...Ct(null==E?void 0:E.elements[0]),uuid:null==E?void 0:E.elements[0].uuid}]):(null==(z=E.type)?void 0:z.startsWith("resize-"))?(n.setSharedStorage(Co,E.type),n.setSharedStorage(Ro,"resize")):(I(),n.setSharedStorage(Ro,"area"),n.setSharedStorage(Eo,e.point),b([],{triggerEvent:!0})),o.drawFrame()},pointMove:e=>{var t,i,r;n.setSharedStorage(No,!0);const s=n.getActiveStorage("data"),c=p(),v=n.getActiveStorage("scale")||1,w=n.getActiveViewScaleInfo(),x=n.getActiveViewSizeInfo(),S=h,A=d,I=e.point,M=n.getSharedStorage(Co),z=n.getSharedStorage(Ro),R=n.getSharedStorage(jo),C=n.getSharedStorage(Fo);if("drag"===z){if(g=!0,f="drag",a.trigger(An,{show:!1}),s&&1===(null==c?void 0:c.length)&&u&&A&&I&&!0!==(null==(i=null==(t=c[0])?void 0:t.operations)?void 0:i.locked)){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const r=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:l=0}=e;r.push({x:t,y:i,w:o,h:n,angle:0-l})})),(null==i?void 0:i.length)>0){const i=xt(e,r),l=xt(t,r);o=l.x-i.x,n=l.y-i.y}return{moveX:o,moveY:n}}(A,I,R);let i=l.toGridNum(e/v),o=l.toGridNum(t/v);if(!0===C){const e=hn(c[0].uuid,{calculator:l,data:s,groupQueue:R,viewScaleInfo:w,viewSizeInfo:x});try{e&&(He.x(e.offsetX)&&null!==e.offsetX&&(i=l.toGridNum(i+e.offsetX)),He.y(e.offsetY)&&null!==e.offsetY&&(o=l.toGridNum(o+e.offsetY)))}catch(e){console.error(e)}}c[0].x=l.toGridNum(u.x+i),c[0].y=l.toGridNum(u.y+o),b([c[0]]),l.modifyVirtualFlatItemMap(s,{modifyInfo:{type:"updateElement",content:{element:c[0],position:n.getSharedStorage(Do)||[]}},viewSizeInfo:x,viewScaleInfo:w})}o.drawFrame()}else if("drag-list"===z){if(g=!0,f="drag-list",s&&A&&S&&I&&(null==c?void 0:c.length)>1){const e=(I.x-S.x)/v,t=(I.y-S.y)/v;c.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.locked)&&(i.x=l.toGridNum(i.x+e),i.y=l.toGridNum(i.y+t),l.modifyVirtualFlatItemMap(s,{modifyInfo:{type:"updateElement",content:{element:i,position:Tt(i.uuid,s.elements)||[]}},viewSizeInfo:x,viewScaleInfo:w}))})),n.setActiveStorage("data",s)}o.drawFrame()}else if("resize"===z){if(s&&1===(null==c?void 0:c.length)&&A&&u&&(null==M?void 0:M.startsWith("resize-"))){g=!0,f="resize";const e=[];R.forEach((t=>{const{x:i,y:o,w:n,h:r,angle:l=0}=t;e.push({x:i,y:o,w:n,h:r,angle:0-l})}));let t=A,i=I;if(R.length>0&&(t=xt(A,e),i=xt(I,e)),"resize-rotate"===M){const e=n.getSharedStorage(Wo),t=yt([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),i=nn(u,{center:t,viewScaleInfo:w,start:A,end:I});c[0].angle=l.toGridNum(i.angle||0)}else{const e=function(e,t){var i,o,n,r,l,a,s,h,c;let{x:d,y:u,w:f,h:g,angle:v=0}=e;const m=mt({x:d,y:u,w:f,h:g});v=It(v);const y=ft(v),p=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:w,end:x,resizeType:S,scale:b}=t;let A={...w},I={...x},M={x:A.x,y:m.y},z={x:I.x,y:m.y},R={...M},C={...z},E={x:m.x,y:A.y},T={x:m.x,y:I.y},P={...E},L={...T},O=(C.x-R.x)/b,k=(C.y-R.y)/b,W=qo(O,k),D=(L.x-P.x)/b,j=(L.y-P.y)/b,Y=qo(D,j);(v>0||v<0)&&(A=wt(m,w,0-y),I=wt(m,x,0-y),M={x:A.x,y:m.y},z={x:I.x,y:m.y},R=wt(m,M,y),C=wt(m,z,y),E={x:m.x,y:A.y},T={x:m.x,y:I.y},P=wt(m,E,y),L=wt(m,T,y),O=(C.x-R.x)/b,k=(C.y-R.y)/b,W=qo(O,k),W=_o(W,k),D=(L.x-P.x)/b,j=(L.y-P.y)/b,Y=qo(D,j),Y=_o(Y,j));let N=(x.x-w.x)/b,B=(x.y-w.y)/b;if(!0===p)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(N),Math.abs(B));N=(N>=0?1:-1)*t,B=(B>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(D),Math.abs(j));D=(D>=0?1:-1)*i,j=(j>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(O),Math.abs(k));O=(O>=0?1:-1)*o,k=(k>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(N);N=(N>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?B=N>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(B=N>0?-i:i)}W=Math.abs(W),Y=W/e.w*e.h}switch(S){case"resize-top":if(0===v)g-B>0&&(u+=B,g-=B,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=B/e.h*e.w/2,f-=B/e.h*e.w));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){Y=0-_o(Y,j);const e=Ko(v),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){Y=_o(Y,D);const e=Ko(v-90),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){Y=_o(Y,j);const e=Ko(v-180),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){Y=0-_o(Y,D);const e=Ko(v-270),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+Y>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(f+=Y/e.h*e.w),g+=Y,d=t-f/2,u=i-g/2)}break;case"resize-bottom":if(0===v)e.h+B>0&&(g+=B,!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(d-=B/e.h*e.w/2,f+=B/e.h*e.w));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){Y=_o(Y,j);const e=Ko(v),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){Y=0-_o(Y,D);const e=Ko(v-90),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){Y=_o(Y,D);const e=Ko(v-180),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){Y=_o(Y,D);const e=Ko(v-270),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+Y>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(f+=Y/e.h*e.w),g+=Y,d=t-f/2,u=i-g/2)}break;case"resize-left":if(0===v)e.w-N>0&&(d+=N,f-=N,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(g-=N/e.w*e.h,u+=N/e.w*e.h/2));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){W=0-_o(W,O);const e=Ko(v),o=W/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){W=_o(W,O);const e=Ko(v-90),o=W/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){W=_o(W,k);const e=Ko(v-180),o=W/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){W=_o(W,k);const e=Ko(v-270),o=W/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}f+W>0&&(!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g+=W/e.w*e.h),f+=W,d=t-f/2,u=i-g/2)}break;case"resize-right":if(0===v)e.w+N>0&&(f+=N,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(u-=N*e.h/e.w/2,g+=N*e.h/e.w));else if(v>0||v<0){let t=m.x,i=m.y;if(v<90){W=_o(W,k);const e=Ko(v),o=W/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){W=_o(W,B);const e=Ko(v-90),o=W/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){W=_o(W,B);const e=Ko(v-180),o=W/2;t+=o*Math.cos(e),i+=o*Math.sin(e),W=0-W}else if(v<360){W=_o(W,N);const e=Ko(v-270),o=W/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}f+W>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=W/e.w*e.h),f+=W,d=t-f/2,u=i-g/2)}break;case"resize-top-left":if(0===v)f-N>0&&(d+=N,f-=N),g-B>0&&(u+=B,g-=B);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=0-_o(Y,j),W=0-_o(W,p?0-Y:O);const i=Y/2;e+=i*Math.sin(y),t-=i*Math.cos(y);const o=W/2;e-=o*Math.cos(y),t-=o*Math.sin(y)}else if(v<180){Y=_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){Y=_o(Y,j),W=_o(W,p?Y:k);const i=Ko(v-180),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){Y=0-_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}break;case"resize-top-right":if(0===v)f+N>0&&(f+=N),g-B>0&&(u+=B,g-=B);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=0-_o(Y,j),W=_o(W,p?Y:k);const i=Ko(v),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){Y=_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=Ko(v-180);Y=_o(Y,j),W=_o(W,p?Y:0-O);const o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){Y=0-_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+B>0&&(g+=B),e.w-N>0&&(d+=N,f-=N);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=_o(Y,j),W=0-_o(W,p?0-Y:O);const i=Ko(v),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){Y=0-_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){Y=_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){Y=_o(Y,D),W=_o(W,p?Y:k);const i=Ko(v-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+B>0&&(g+=B),e.w+N>0&&(f+=N);else if(v>0||v<0){let e=m.x,t=m.y;if(v<90){Y=_o(Y,j),W=_o(W,p?Y:k);const i=Ko(v),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=W/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){Y=0-_o(Y,D),W=_o(W,p?Y:B);const i=Ko(v-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=W/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){Y=_o(Y,D),W=_o(W,p?Y:0-k);const i=Ko(v-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=W/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){Y=_o(Y,D),W=_o(W,p?Y:O);const i=Ko(v-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=W/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),f+W>0&&(f+=W),d=e-f/2,u=t-g/2}}return{x:d,y:u,w:f,h:g,angle:e.angle}}({...u,operations:c[0].operations},{scale:v,start:t,end:i,resizeType:M}),o={ignore:!!u.angle},n=l.toGridNum(e.x,o),a=l.toGridNum(e.y,o),s=l.toGridNum(e.w,o),h=l.toGridNum(e.h,o);"group"===c[0].type?(y=si(c[0],{x:n,y:a,w:s,h:h},{resizeEffect:null==(r=c[0].operations)?void 0:r.resizeEffect}),m||(m=y),c[0].x=n,c[0].y=a):(c[0].x=n,c[0].y=a,c[0].w=s,c[0].h=h)}b([c[0]]),l.modifyVirtualFlatItemMap(s,{modifyInfo:{type:"updateElement",content:{element:c[0],position:n.getSharedStorage(Do)||[]}},viewSizeInfo:x,viewScaleInfo:w}),o.drawFrame()}}else"area"===z&&(f="area",n.setSharedStorage(To,e.point),o.drawFrame());h=e.point},pointEnd(e){f=null,n.setSharedStorage(No,!1);const t=n.getActiveStorage("data"),i=n.getSharedStorage(Oo),r=n.getSharedStorage(Po),s=n.getSharedStorage(Co),v=n.getSharedStorage(Ro),p=n.getActiveViewSizeInfo();let w=!1;if(h=null,d=null,u=null,"drag"===v&&a.trigger(An,{show:!0}),"resize"===v&&s)n.setSharedStorage(Co,null),w=!0;else if("area"===v){if(n.setSharedStorage(Ro,null),t){const e=n.getSharedStorage(Eo),i=n.getSharedStorage(To);if(e&&i){const{elements:o}=function(e,t){var i;const o=[],n=[],r=[],{viewScaleInfo:l,start:a,end:s}=t;if(!(Array.isArray(e.elements)&&a&&s))return{indexes:o,uuids:n,elements:r};const h=Math.min(a.x,s.x),c=Math.max(a.x,s.x),d=Math.min(a.y,s.y),u=Math.max(a.y,s.y);for(let t=0;t<e.elements.length;t++){const a=e.elements[t];if(!0===(null==(i=null==a?void 0:a.operations)?void 0:i.locked))continue;const s=Wt(a,{viewScaleInfo:l}),f=mt(s);if(f.x>=h&&f.x<=c&&f.y>=d&&f.y<=u&&(o.push(t),n.push(a.uuid),r.push(a),s.angle&&(s.angle>0||s.angle<0))){const e=bt(s);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];s.x=Math.min(...t),s.y=Math.min(...i),s.w=Math.abs(Math.max(...t)-Math.min(...t)),s.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:r}}(t,{start:e,end:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});o.length>0&&(n.setSharedStorage(Ro,"drag-list"),b(o,{triggerEvent:!0}),w=!0)}}}else if("drag-list"===v)n.setSharedStorage(Ro,"drag-list-end"),w=!0;else if(t){l.getPointElement(e.point,{data:t,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}).element?(n.setSharedStorage(Ro,"select"),w=!0):n.setSharedStorage(Ro,null)}null===n.getSharedStorage(Ro)&&(I(),w=!0);(()=>{if(w){if(t&&Array.isArray(null==t?void 0:t.elements)&&["drag","drag-list"].includes(v)){const e=function(e,t,i){const o=zt(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(t.elements,p,{extend:!0});n.setActiveStorage("contextHeight",e.contextSize.contextHeight),n.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(t&&["drag","drag-list","drag-list-end","resize"].includes(v)){let e="resizeElement";if(g){let o=null;if(Array.isArray(c)&&c.length){const e=c[0];1===i.length?(o={type:"resizeElement",time:0,content:{method:"modifyElement",uuid:e.uuid,before:qt(e),after:qt(Ct(i[0]))}},"group"===i[0].type&&m&&y&&(o={...y,content:{...y.content,before:m.content.before}})):i.length>1&&(o={type:"resizeElements",time:0,content:{method:"modifyElements",before:c.map((e=>({...qt(e),uuid:e.uuid}))),after:i.map((e=>({...qt(Ct(e)),uuid:e.uuid})))}})}a.trigger(Ao.CHANGE,{data:t,type:e,selectedElements:i,hoverElement:r,modifyRecord:o}),g=!1}}o.drawFrame()}})()},pointLeave(){f=null,n.setSharedStorage(Co,null),a.trigger(Ao.CURSOR,{type:"default"})},doubleClick(e){var t,i,r,l,s,h,c,d;if(!1===n.getSharedStorage(Bo))return;const u=on(e.point,A());if(n.setSharedStorage(Wo,null),n.setSharedStorage(Oo,[]),1!==u.elements.length||!0!==(null==(i=null==(t=u.elements[0])?void 0:t.operations)?void 0:i.locked)){if(1===u.elements.length&&"group"===(null==(r=u.elements[0])?void 0:r.type)){if(!0===w(u.elements[0]))return n.setSharedStorage(Ro,null),void o.drawFrame()}else 1!==u.elements.length||"text"!==(null==(l=u.elements[0])?void 0:l.type)||(null==(h=null==(s=u.elements[0])?void 0:s.operations)?void 0:h.invisible)||a.trigger(Ao.TEXT_EDIT,{element:u.elements[0],groupQueue:n.getSharedStorage(jo)||[],position:Tt(null==(c=u.elements[0])?void 0:c.uuid,(null==(d=n.getActiveStorage("data"))?void 0:d.elements)||[]),viewScaleInfo:n.getActiveViewScaleInfo()});n.setSharedStorage(Ro,null)}},wheel(){S()},wheelScale(){S()},contextMenu:e=>{var t,i,r,l,a,h,c,d;const u=n.getSharedStorage(jo);if((null==u?void 0:u.length)>0){if(tn(e.point,{ctx:s,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo(),groupQueue:u})){const n=on(e.point,A());1===(null==(t=null==n?void 0:n.elements)?void 0:t.length)&&!0!==(null==(r=null==(i=n.elements[0])?void 0:i.operations)?void 0:r.locked)?(I(),b([n.elements[0]],{triggerEvent:!0}),o.drawFrame()):(null==(l=null==n?void 0:n.elements)?void 0:l.length)||I()}return}const f=rn(p(),{viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),g=on(e.point,{...A(),areaSize:f,groupQueue:[]});if(1===(null==(a=null==g?void 0:g.elements)?void 0:a.length)&&!0!==(null==(c=null==(h=g.elements[0])?void 0:h.operations)?void 0:c.locked))return I(),b([g.elements[0]],{triggerEvent:!0}),void o.drawFrame();(null==(d=null==g?void 0:g.elements)?void 0:d.length)||I()},beforeDrawFrame({snapshot:t}){var o;const{activeColor:n,activeAreaColor:r,lockedColor:a,referenceColor:h}=i,c={activeColor:n,activeAreaColor:r,lockedColor:a,referenceColor:h},{activeStore:d,sharedStore:u}=t,{scale:f,offsetLeft:g,offsetTop:m,offsetRight:y,offsetBottom:w,width:x,height:S,contextHeight:b,contextWidth:A,devicePixelRatio:I}=d;v.fill!==n&&(v=Sn({fill:i.activeColor,devicePixelRatio:I}));const M=e.sharer,z={scale:f,offsetLeft:g,offsetTop:m,offsetRight:y,offsetBottom:w},R={width:x,height:S,contextHeight:b,contextWidth:A,devicePixelRatio:I},C=u[Oo],E=C[0],T=u[Po],P=u[Lo],L=u[Ro],O=u[Eo],k=u[To],W=u[jo],D=u[Yo],j=u[No],Y=u[Fo],N={calculator:l,viewScaleInfo:z,viewSizeInfo:R,style:c};let B=u[Wo];var F,G;B&&1===C.length&&E&&(F=E,G=B.originalElementSize,(F.x!==G.x||F.y!==G.y||F.h!==G.h||F.w!==G.w||It(F.angle||0)!==It(G.angle||0))&&(B=Vt(E,{groupQueue:W||[],controllerSize:10,viewScaleInfo:z,rotateControllerPosition:22,rotateControllerSize:20}),M.setSharedStorage(Wo,B)));const V=!!(null==(o=null==T?void 0:T.operations)?void 0:o.locked);if((null==W?void 0:W.length)>0){if(function(e,t,i){const{style:o}=i,{activeColor:n}=o;for(let o=0;o<t.length;o++){const r={borderColor:n,borderWidth:2,background:"transparent",lineDash:[4,4]};Vo(e,jt(t[o],i),r)}}(s,D,N),T&&"drag"!==L&&(V?Uo(s,P,{...N,controller:B,style:c}):Qo(s,P,N)),E&&["select","drag","resize"].includes(L)&&($o(s,B,{...N,element:E,hideControllers:!!j&&"drag"===L,rotateControllerPattern:v.context2d,style:c}),"drag"===L&&!0===Y)){const e=hn(E.uuid,{calculator:l,data:d.data,groupQueue:W,viewScaleInfo:z,viewSizeInfo:R});if(e){const{offsetX:t,offsetY:i,xLines:o,yLines:n}=e;0!==t&&0!==i||Jo(s,{xLines:o,yLines:n,style:c})}}}else if(T&&"drag"!==L&&(V?Uo(s,P,{...N,controller:B,style:c}):Qo(s,P,N)),E&&["select","drag","resize"].includes(L)){if($o(s,B,{...N,element:E,hideControllers:!!j&&"drag"===L,rotateControllerPattern:v.context2d,style:c}),"drag"===L&&!0===Y){const e=hn(E.uuid,{calculator:l,data:d.data,groupQueue:W,viewScaleInfo:z,viewSizeInfo:R});if(e){const{offsetX:t,offsetY:i,xLines:o,yLines:n}=e;0!==t&&0!==i||Jo(s,{xLines:o,yLines:n,style:c})}}}else if("area"===L&&O&&k)!function(e,t){const{start:i,end:o,style:n}=t,{activeColor:r,activeAreaColor:l}=n;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=r,e.fillStyle=l,e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill("nonzero")}(s,{start:O,end:k,style:c});else if(["drag-list","drag-list-end"].includes(L)){const e=rn(p(),{viewScaleInfo:M.getActiveViewScaleInfo(),viewSizeInfo:M.getActiveViewSizeInfo()});e&&function(e,t){const{areaSize:i,style:o}=t,{activeColor:n,activeAreaColor:r}=o,{x:l,y:a,w:s,h:h}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=n,e.fillStyle=r,e.beginPath(),e.moveTo(l,a),e.lineTo(l+s,a),e.lineTo(l+s,a+h),e.lineTo(l,a+h),e.closePath(),e.stroke(),e.fill("nonzero")}(s,{areaSize:e,style:c})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o,sharer:n,calculator:r}=e,l=i.boardContext.canvas,a=e.container||document.body;let s=document.createElement("div");s.setAttribute("contenteditable","true");let h=document.createElement("div"),c=document.createElement("div"),d=null,u=[],f="";const g=`idraw-middleware-text-editor-${Math.random().toString(26).substring(2)}`;c.setAttribute("id",g),h.appendChild(s),h.style.position="absolute",c.appendChild(h),c.style.position="fixed",c.style.top="0",c.style.bottom="0",c.style.left="0",c.style.right="0",c.style.display="none",a.appendChild(c);const v=()=>{if(null==d?void 0:d.uuid){const e=n.getActiveOverrideElemenentMap();e&&delete e[d.uuid],n.setActiveOverrideElemenentMap(e),o.drawFrame()}c.style.display="none",d=null,u=[]},m=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:r,w:l,h:a}=t,s=It(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${r}px`,o.style.width=`${l}px`,o.style.height=`${a}px`,o.style.transform=`rotate(${s}deg)`,i.appendChild(o),o},y=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:r,offsetLeft:l}=t;h.children&&Array.from(h.children).forEach((e=>{e.remove()}));let a=h;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:s,w:h,h:c}=t,d={x:i*n,y:s*n,w:h*n,h:c*n,angle:It(t.angle||0)};0===e&&(d.x+=l,d.y+=r),a=m({size:d,parent:a})}const c={...Xn,...i.detail};let d=i.x*n+l,u=i.y*n+r,f=i.w*n,g=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,f=i.w*n,g=i.h*n);let v="center",y="center";"left"===c.textAlign?v="start":"right"===c.textAlign&&(v="end"),"top"===c.verticalAlign?y="start":"bottom"===c.verticalAlign&&(y="end"),s.style.display="inline-flex",s.style.flexDirection="column",s.style.justifyContent=v,s.style.alignItems=y,s.style.position="absolute",s.style.left=d-1+"px",s.style.top=u-1+"px",s.style.width=`${f+2}px`,s.style.height=`${g+2}px`,s.style.transform=`rotate(${It(i.angle||0)}deg)`,s.style.boxSizing="border-box",s.style.border="1px solid #1973ba",s.style.resize="none",s.style.overflow="hidden",s.style.wordBreak="break-all",s.style.borderRadius=("number"==typeof c.borderRadius?c.borderRadius:0)*n+"px",s.style.background=`${c.background||"transparent"}`,s.style.color=`${c.color||"#333333"}`,s.style.fontSize=c.fontSize*n+"px",s.style.lineHeight=(c.lineHeight||c.fontSize)*n+"px",s.style.fontFamily=mi(c.fontFamily),s.style.fontWeight=`${c.fontWeight}`,s.style.padding="0",s.style.margin="0",s.style.outline="none",s.innerText=c.text||"",a.appendChild(s)},p=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=l.getBoundingClientRect(),{left:t,top:i,width:o,height:n}=e;return{left:t,top:i,width:o,height:n}})();h.style.position="absolute",h.style.overflow="hidden",h.style.top=`${t}px`,h.style.left=`${e}px`,h.style.width=`${i}px`,h.style.height=`${o}px`},w=()=>{v()},x=e=>{e.stopPropagation()},S=()=>{d&&u&&(d.detail.text=s.innerText||"",t.trigger(Ao.TEXT_CHANGE,{element:{uuid:d.uuid,detail:{text:d.detail.text}},position:[...u||[]]}),r.modifyText(d),o.drawFrame())},b=()=>{if(d&&u){d.detail.text=s.innerText||"",t.trigger(Ao.TEXT_CHANGE,{element:{uuid:d.uuid,detail:{text:d.detail.text}},position:[...u]});const e=n.getActiveStorage("data")||{elements:[]},i={detail:{text:d.detail.text}};fi(d.uuid,i,e.elements),t.trigger(Ao.CHANGE,{selectedElements:[{...d,detail:{...d.detail,...i.detail}}],data:e,type:"modifyElement",modifyRecord:{type:"modifyElement",time:Date.now(),content:{method:"modifyElement",uuid:d.uuid,before:{"detail.text":f},after:{"detail.text":d.detail.text}}}}),r.modifyText(d),o.drawFrame()}v()},A=e=>{e.stopPropagation()},I=e=>{e.stopPropagation()},M=e=>{e.stopPropagation()},z=e=>{e.stopPropagation(),e.preventDefault()};c.addEventListener("click",w),s.addEventListener("click",x),s.addEventListener("input",S),s.addEventListener("blur",b),s.addEventListener("keydown",A),s.addEventListener("keypress",I),s.addEventListener("keyup",M),s.addEventListener("wheel",z);const R=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(d=e.element,u=e.position),(e=>{p(),y(e),c.style.display="block",f="",(null==d?void 0:d.uuid)&&(n.setActiveOverrideElemenentMap({[d.uuid]:{operations:{invisible:!0}}}),f=d.detail.text||"",o.drawFrame())})(e)};return{name:"@middleware/text-editor",use(){t.on(Ao.TEXT_EDIT,R)},disuse(){t.off(Ao.TEXT_EDIT,R),c.removeEventListener("click",w),s.removeEventListener("click",x),s.removeEventListener("input",S),s.removeEventListener("blur",b),s.removeEventListener("keydown",A),s.removeEventListener("keypress",I),s.removeEventListener("keyup",M),s.removeEventListener("wheel",z),h.removeChild(s),c.removeChild(h),a.removeChild(c),s.remove(),h.remove(),c=null,s=null,h=null,c=null,d=null,u=null,f=null}}},e.Sharer=mo,e.coreEventKeys=Ao,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idraw/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"author": "idrawjs",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@idraw/types": "^0.4.
|
|
24
|
+
"@idraw/types": "^0.4.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@idraw/renderer": "^0.4.
|
|
29
|
-
"@idraw/util": "^0.4.
|
|
28
|
+
"@idraw/renderer": "^0.4.3",
|
|
29
|
+
"@idraw/util": "^0.4.3"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public",
|