@kabel-project/kabel 1.0.7 → 1.0.8
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/comment-renderer/renderer.d.ts +32 -0
- package/dist/comment-renderer/renderer.d.ts.map +1 -0
- package/dist/controllers/base.d.ts +39 -0
- package/dist/controllers/base.d.ts.map +1 -0
- package/dist/controllers/wasd.d.ts +33 -0
- package/dist/controllers/wasd.d.ts.map +1 -0
- package/dist/events/comment-drag-handle.d.ts +2 -0
- package/dist/events/comment-drag-handle.d.ts.map +1 -0
- package/dist/events/comment-input.d.ts +4 -0
- package/dist/events/comment-input.d.ts.map +1 -0
- package/dist/events/connection-line.d.ts +2 -0
- package/dist/events/connection-line.d.ts.map +1 -0
- package/dist/events/connector.d.ts +2 -0
- package/dist/events/connector.d.ts.map +1 -0
- package/dist/events/draggable.d.ts +2 -0
- package/dist/events/draggable.d.ts.map +1 -0
- package/{events/events.ts → dist/events/events.d.ts} +8 -7
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/input-box.d.ts +2 -0
- package/dist/events/input-box.d.ts.map +1 -0
- package/dist/events/node-x-btn.d.ts +2 -0
- package/dist/events/node-x-btn.d.ts.map +1 -0
- package/dist/kabel.js +2 -0
- package/dist/kabel.js.map +1 -0
- package/dist/renderers/apollo/apollo.d.ts +12 -0
- package/dist/renderers/apollo/apollo.d.ts.map +1 -0
- package/dist/renderers/apollo/constants.d.ts +21 -0
- package/dist/renderers/apollo/constants.d.ts.map +1 -0
- package/dist/renderers/apollo/renderer.d.ts +97 -0
- package/dist/renderers/apollo/renderer.d.ts.map +1 -0
- package/{renderers/atlas/atlas.ts → dist/renderers/atlas/atlas.d.ts} +6 -15
- package/dist/renderers/atlas/atlas.d.ts.map +1 -0
- package/dist/renderers/constants.d.ts +51 -0
- package/dist/renderers/constants.d.ts.map +1 -0
- package/dist/renderers/renderer.d.ts +470 -0
- package/dist/renderers/renderer.d.ts.map +1 -0
- package/dist/renderers/representer-node.d.ts +27 -0
- package/dist/renderers/representer-node.d.ts.map +1 -0
- package/dist/renderers/representer.d.ts +13 -0
- package/dist/renderers/representer.d.ts.map +1 -0
- package/dist/src/category.d.ts +48 -0
- package/dist/src/category.d.ts.map +1 -0
- package/{src/colors.ts → dist/src/colors.d.ts} +21 -20
- package/dist/src/colors.d.ts.map +1 -0
- package/dist/src/comment.d.ts +88 -0
- package/dist/src/comment.d.ts.map +1 -0
- package/dist/src/connection.d.ts +52 -0
- package/dist/src/connection.d.ts.map +1 -0
- package/dist/src/context-menu.d.ts +76 -0
- package/dist/src/context-menu.d.ts.map +1 -0
- package/dist/src/coordinates.d.ts +52 -0
- package/dist/src/coordinates.d.ts.map +1 -0
- package/dist/src/core.d.ts +153 -0
- package/dist/src/core.d.ts.map +1 -0
- package/dist/src/ctx-menu-registry.d.ts +22 -0
- package/dist/src/ctx-menu-registry.d.ts.map +1 -0
- package/dist/src/dropdown-menu.d.ts +87 -0
- package/dist/src/dropdown-menu.d.ts.map +1 -0
- package/dist/src/field.d.ts +305 -0
- package/dist/src/field.d.ts.map +1 -0
- package/dist/src/flyout.d.ts +41 -0
- package/dist/src/flyout.d.ts.map +1 -0
- package/dist/src/fonts-manager.d.ts +6 -0
- package/dist/src/fonts-manager.d.ts.map +1 -0
- package/dist/src/grid.d.ts +60 -0
- package/dist/src/grid.d.ts.map +1 -0
- package/dist/src/headless-node.d.ts +11 -0
- package/dist/src/headless-node.d.ts.map +1 -0
- package/dist/src/index.d.ts +38 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/inject-headless.d.ts +4 -0
- package/dist/src/inject-headless.d.ts.map +1 -0
- package/{src/inject.ts → dist/src/inject.d.ts} +142 -213
- package/dist/src/inject.d.ts.map +1 -0
- package/{src/main-workspace.ts → dist/src/main-workspace.d.ts} +31 -51
- package/dist/src/main-workspace.d.ts.map +1 -0
- package/dist/src/mutator.d.ts +2 -0
- package/dist/src/mutator.d.ts.map +1 -0
- package/{src/node-types.ts → dist/src/node-types.d.ts} +26 -27
- package/dist/src/node-types.d.ts.map +1 -0
- package/dist/src/nodesvg.d.ts +266 -0
- package/dist/src/nodesvg.d.ts.map +1 -0
- package/{src/prototypes.ts → dist/src/prototypes.d.ts} +10 -9
- package/dist/src/prototypes.d.ts.map +1 -0
- package/{src/renderer-map.ts → dist/src/renderer-map.d.ts} +51 -86
- package/dist/src/renderer-map.d.ts.map +1 -0
- package/dist/src/toolbox.d.ts +51 -0
- package/dist/src/toolbox.d.ts.map +1 -0
- package/{src/types.ts → dist/src/types.d.ts} +159 -205
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/undo-redo.d.ts +15 -0
- package/dist/src/undo-redo.d.ts.map +1 -0
- package/{src/visual-types.ts → dist/src/visual-types.d.ts} +34 -29
- package/dist/src/visual-types.d.ts.map +1 -0
- package/dist/src/widget-prototypes.d.ts +10 -0
- package/dist/src/widget-prototypes.d.ts.map +1 -0
- package/dist/src/widget.d.ts +62 -0
- package/dist/src/widget.d.ts.map +1 -0
- package/{src/workspace-coords.ts → dist/src/workspace-coords.d.ts} +10 -14
- package/dist/src/workspace-coords.d.ts.map +1 -0
- package/dist/src/workspace-svg.d.ts +371 -0
- package/dist/src/workspace-svg.d.ts.map +1 -0
- package/dist/src/workspace.d.ts +50 -0
- package/dist/src/workspace.d.ts.map +1 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/default.d.ts +4 -0
- package/dist/themes/default.d.ts.map +1 -0
- package/dist/themes/themes.d.ts +6 -0
- package/dist/themes/themes.d.ts.map +1 -0
- package/dist/util/emitter.d.ts +10 -0
- package/dist/util/emitter.d.ts.map +1 -0
- package/dist/util/env.d.ts +7 -0
- package/dist/util/env.d.ts.map +1 -0
- package/{util/escape-html.ts → dist/util/escape-html.d.ts} +16 -22
- package/dist/util/escape-html.d.ts.map +1 -0
- package/dist/util/eventer.d.ts +29 -0
- package/dist/util/eventer.d.ts.map +1 -0
- package/dist/util/has-prop.d.ts +2 -0
- package/dist/util/has-prop.d.ts.map +1 -0
- package/dist/util/parse-color.d.ts +6 -0
- package/dist/util/parse-color.d.ts.map +1 -0
- package/dist/util/path.d.ts +25 -0
- package/dist/util/path.d.ts.map +1 -0
- package/dist/util/styler.d.ts +12 -0
- package/dist/util/styler.d.ts.map +1 -0
- package/dist/util/uid.d.ts +42 -0
- package/dist/util/uid.d.ts.map +1 -0
- package/{util/unescape-html.ts → dist/util/unescape-html.d.ts} +16 -22
- package/dist/util/unescape-html.d.ts.map +1 -0
- package/dist/util/user-state.d.ts +37 -0
- package/dist/util/user-state.d.ts.map +1 -0
- package/{util/wait-anim-frames.ts → dist/util/wait-anim-frames.d.ts} +11 -24
- package/dist/util/wait-anim-frames.d.ts.map +1 -0
- package/dist/util/window-listeners.d.ts +8 -0
- package/dist/util/window-listeners.d.ts.map +1 -0
- package/package.json +4 -1
- package/(1.0.7)kabel.md +0 -18
- package/_READ_ME_MEDIA_/documentation/docs.md +0 -293
- package/_READ_ME_MEDIA_/workspace.png +0 -0
- package/comment-renderer/renderer.ts +0 -228
- package/controllers/base.ts +0 -186
- package/controllers/wasd.ts +0 -132
- package/docs/README.md +0 -98
- package/docs/_media/docs.md +0 -289
- package/docs/_media/workspace.png +0 -0
- package/docs/classes/CommentModel.md +0 -271
- package/docs/classes/CommentRenderer.md +0 -457
- package/docs/classes/ConnectableField.md +0 -597
- package/docs/classes/Connection.md +0 -191
- package/docs/classes/ContextMenuHTML.md +0 -163
- package/docs/classes/Coordinates.md +0 -187
- package/docs/classes/DropdownContainer.md +0 -300
- package/docs/classes/DummyField.md +0 -393
- package/docs/classes/Eventer.md +0 -185
- package/docs/classes/Field.md +0 -461
- package/docs/classes/InjectMsg.md +0 -85
- package/docs/classes/NodeSvg.md +0 -1011
- package/docs/classes/NumberField.md +0 -559
- package/docs/classes/OptConnectField.md +0 -624
- package/docs/classes/Renderer.md +0 -1636
- package/docs/classes/RendererConstants.md +0 -343
- package/docs/classes/Representer.md +0 -95
- package/docs/classes/RepresenterNode.md +0 -175
- package/docs/classes/TextField.md +0 -559
- package/docs/classes/Toolbox.md +0 -172
- package/docs/classes/WASDController.md +0 -616
- package/docs/classes/Widget.md +0 -195
- package/docs/classes/WorkspaceController.md +0 -385
- package/docs/classes/WorkspaceCoords.md +0 -218
- package/docs/classes/WorkspaceSvg.md +0 -1380
- package/docs/functions/clearMainWorkspace.md +0 -20
- package/docs/functions/getMainWorkspace.md +0 -19
- package/docs/functions/inject.md +0 -35
- package/docs/functions/setMainWorkspace.md +0 -28
- package/docs/globals.md +0 -95
- package/docs/interfaces/ColorStyle.md +0 -43
- package/docs/interfaces/ConnectorToFrom.md +0 -57
- package/docs/interfaces/DrawState.md +0 -81
- package/docs/interfaces/FieldConnectionData.md +0 -25
- package/docs/interfaces/FieldOptions.md +0 -63
- package/docs/interfaces/FieldRawBoxData.md +0 -25
- package/docs/interfaces/FieldVisualInfo.md +0 -65
- package/docs/interfaces/GridOptions.md +0 -61
- package/docs/interfaces/InjectOptions.md +0 -133
- package/docs/interfaces/InputFieldJson.md +0 -50
- package/docs/interfaces/KabelCommentRendering.md +0 -31
- package/docs/interfaces/KabelInterface.md +0 -469
- package/docs/interfaces/KabelNodeRendering.md +0 -77
- package/docs/interfaces/KabelUIX.md +0 -105
- package/docs/interfaces/KabelUtils.md +0 -215
- package/docs/interfaces/NodeEvents.md +0 -42
- package/docs/interfaces/NodeJson.md +0 -104
- package/docs/interfaces/NodePrototype.md +0 -82
- package/docs/interfaces/RegisteredEl.md +0 -53
- package/docs/interfaces/SerializedNode.md +0 -128
- package/docs/interfaces/TblxCategoryStruct.md +0 -41
- package/docs/interfaces/TblxFieldStruct.md +0 -28
- package/docs/interfaces/TblxNodeStruct.md +0 -35
- package/docs/interfaces/WidgetOptions.md +0 -115
- package/docs/interfaces/WidgetPrototypeList.md +0 -15
- package/docs/type-aliases/AnyField.md +0 -13
- package/docs/type-aliases/AnyFieldCls.md +0 -13
- package/docs/type-aliases/Color.md +0 -13
- package/docs/type-aliases/Connectable.md +0 -13
- package/docs/type-aliases/EventArgs.md +0 -11
- package/docs/type-aliases/EventSetupFn.md +0 -25
- package/docs/type-aliases/Hex.md +0 -13
- package/docs/type-aliases/RGBObject.md +0 -37
- package/docs/type-aliases/RGBString.md +0 -13
- package/docs/type-aliases/RGBTuple.md +0 -13
- package/docs/type-aliases/TblxObjStruct.md +0 -52
- package/docs/variables/CategoryColors.md +0 -29
- package/docs/variables/FieldMap.md +0 -41
- package/docs/variables/NodePrototypes.md +0 -18
- package/docs/variables/default.md +0 -11
- package/events/comment-drag-handle.ts +0 -61
- package/events/comment-input.ts +0 -291
- package/events/connection-line.ts +0 -68
- package/events/connector.ts +0 -116
- package/events/draggable.ts +0 -119
- package/events/input-box.ts +0 -213
- package/events/node-x-btn.ts +0 -25
- package/index.d.ts +0 -4
- package/renderers/apollo/apollo.ts +0 -21
- package/renderers/apollo/constants.ts +0 -40
- package/renderers/apollo/renderer.ts +0 -331
- package/renderers/constants.ts +0 -87
- package/renderers/renderer.ts +0 -1288
- package/renderers/representer-node.ts +0 -52
- package/renderers/representer.ts +0 -25
- package/src/category.ts +0 -107
- package/src/comment.ts +0 -142
- package/src/connection.ts +0 -114
- package/src/context-menu.ts +0 -194
- package/src/coordinates.ts +0 -74
- package/src/core.ts +0 -202
- package/src/ctx-menu-registry.ts +0 -143
- package/src/dropdown-menu.ts +0 -215
- package/src/field.ts +0 -595
- package/src/flyout.ts +0 -165
- package/src/fonts-manager.ts +0 -38
- package/src/grid.ts +0 -162
- package/src/headless-node.ts +0 -27
- package/src/index.ts +0 -115
- package/src/inject-headless.ts +0 -18
- package/src/mutator.ts +0 -40
- package/src/nodesvg.ts +0 -756
- package/src/styles.css +0 -224
- package/src/toolbox.ts +0 -125
- package/src/undo-redo.ts +0 -87
- package/src/widget-prototypes.ts +0 -11
- package/src/widget.ts +0 -139
- package/src/workspace-svg.ts +0 -736
- package/src/workspace.ts +0 -155
- package/test-server.js +0 -61
- package/themes/dark.ts +0 -32
- package/themes/default.ts +0 -28
- package/themes/themes.ts +0 -9
- package/tsconfig.json +0 -25
- package/typedoc.json +0 -10
- package/util/emitter.ts +0 -33
- package/util/env.ts +0 -11
- package/util/eventer.ts +0 -108
- package/util/has-prop.ts +0 -4
- package/util/parse-color.ts +0 -42
- package/util/path.ts +0 -99
- package/util/styler.ts +0 -41
- package/util/uid.ts +0 -184
- package/util/user-state.ts +0 -68
- package/util/window-listeners.ts +0 -62
- package/webpack.config.js +0 -80
- /package/{docs/_media → dist}/index.html +0 -0
package/dist/kabel.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Kabel=e():t.Kabel=e()}(this,()=>(()=>{function t(r){var s=n[r];if(void 0!==s)return s.exports;var i=n[r]={exports:{}};return e[r].call(i.exports,i,i.exports,t),i.exports}var e={50:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},57:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.RepresenterNode=e.Representer=e.Constants=e.Renderer=void 0;const s=r(n(8219));e.Constants=s.default;const i=r(n(1911));e.Renderer=i.default;const o=r(n(9417));e.Representer=o.default;const a=n(8582);Object.defineProperty(e,"RepresenterNode",{enumerable:1,get:function(){return a.RepresenterNode}})},63:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.UserState=void 0;class n{state;callbacks;constructor(){this.state=new Set,this.callbacks=new Map}setState(t){this.state.has(t)||(this.state.add(t),this.triggerCallbacks(t,1))}removeState(t){this.state.has(t)&&(this.state.delete(t),this.triggerCallbacks(t,0))}hasState(t){return this.state.has(t)}onStateChange(t,e){this.callbacks.has(t)||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)}triggerCallbacks(t,e){const n=this.callbacks.get(t);if(n)for(const t of n)t(e)}}e.UserState=n;const r=new n;e.default=r},185:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(4982)),i=n(2643);e.default=class{container;visible;toolbox;constructor(t){this.toolbox=t,this.container=document.createElement("div"),this.container.className="KabelFlyout",this.visible=0,t?t.workspace._wsTop.appendChild(this.container):document.body.appendChild(this.container)}fill(t){this.clear(),t.forEach(t=>{const e=(0,s.default)(t.type);if(!e)return;const n=this.createNodeElement(e);this.container.appendChild(n)}),this.show()}createNodeElement(t){const e=document.createElement("div");return e.className="KabelFlyoutNode",e.textContent=t.labelText,this.applyNodeStyles(e,t.colors.primary),e.addEventListener("mousedown",e=>this.onNodeMouseDown(e,t)),e}applyNodeStyles(t,e){if(t.style.backgroundColor=(0,i.parseColor)(e),t.style.padding="4px 8px",t.style.cursor="pointer",this.toolbox?.workspace?.renderer?.constants){const e=this.toolbox.workspace.renderer.constants;t.style.fontFamily=e.FONT_FAMILY,t.style.fontSize=`${e.FONT_SIZE}px`,t.style.color=(0,i.parseColor)(e.FONT_COLOR)}}onNodeMouseDown(t,e){if(!this.toolbox)return;const n=this.createGhostNode(e);document.body.appendChild(n);const r=t=>{n.style.left=t.clientX+4+"px",n.style.top=t.clientY+4+"px"},s=t=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.dropNode(t,e),n.remove()};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s),t.preventDefault()}createGhostNode(t){const e=document.createElement("div");return e.className="KabelGhostNode",e.textContent=t.labelText,e.style.position="absolute",e.style.pointerEvents="none",this.applyNodeStyles(e,t.colors.primary),e}dropNode(t,e){if(!this.toolbox)return;const n=this.toolbox.workspace.svg.node.getBoundingClientRect();if(t.clientX>=n.left&&t.clientX<=n.right&&t.clientY>=n.top&&t.clientY<=n.bottom){const{x:r,y:s}=this.toolbox.workspace.screenToWorkspace(t.clientX-n.left,t.clientY-n.top),i=this.toolbox.workspace.spawnAt(e.type,r,s);if(i){for(let t in e.arguments)i.setFieldValue(t,e.arguments[t]);this.toolbox.workspace.drawNode(i.id)}}}show(){this.container.style.display="block",this.visible=1}hide(){this.container.style.display="none",this.visible=0}clear(){this.container.innerHTML=""}}},197:function(t,e,n){"use strict";var r,s=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:1,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:1,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),o=0;o<n.length;o++)"default"!==n[o]&&s(e,t,n[o]);return i(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const l=a(n(8219)),h=a(n(1911)),c=a(n(4222)),u=a(n(8670)),d=a(n(8175)),f=o(n(3800)),p=o(n(4803)),m=n(5651),g=a(n(5242)),_=a(n(6545)),y=a(n(2638)),w=n(2643),v=a(n(7037)),b=o(n(2871)),x=o(n(9772)),C=o(n(748)),E=a(n(50)),M=a(n(5596)),k=a(n(63));n(9890);const O=a(n(4498)),N=a(n(3064)),T=n(3902),D=o(n(4741)),A=a(n(6596)),S=a(n(2110)),L=n(5361),R=a(n(1261)),I=a(n(2020)),F=a(n(6218)),P=a(n(1513)),B=a(n(1538)),j=a(n(6551)),G=a(n(9417)),W=n(8582),H=o(n(5552)),$=o(n(3132)),z=a(n(5053)),X=a(n(4629)),Y=a(n(2143)),V=a(n(4982)),U=o(n(1717)),q=o(n(57)),K=a(n(293)),Z=a(n(9674));T.RendererMap.default=q.Renderer,T.RendererMap[q.Renderer.NAME]=q.Renderer,T.RendererMap[U.Renderer.NAME]=U.Renderer,z.default.isBrowser&&$.loadGoogleFont("Fredoka"),f.default.register=function(t,e){f.FieldMap[t]=e},f.default.unregister=function(t){delete f.FieldMap[t]};const J={env:z.default,UIX:{events:v.default,FontManager:$,userState:k.default,windowListeners:{addWindowListener:H.addWindowListener,removeWindowListener:H.removeWindowListener,clearWindowListeners:H.clearWindowListeners,windowListeners:H.default}},Themes:{Classic:K.default,Dark:Z.default},ContextMenu:L.ContextMenu,Utils:{Path:b,waitFrames:F.default,SVG:x,parseColor:w.parseColor,UID:C,EventEmitter:M.default,hasProp:E.default,styler:D.default,Styler:D.Styler,escapeHTML:R.default,unescapeHTML:I.default},Widget:S.default,CategoryColors:c.default,Connection:u.default,Coordinates:d.default,Field:f.default,DummyField:f.DummyField,FieldMap:f.FieldMap,NumberField:f.NumberField,OptConnectField:f.OptConnectField,TextField:f.TextField,inject:p.default,injectHeadless:Y.default,createHeadlessNode:V.default,InjectMsg:p.InjectMsg,clearMainWorkspace:m.clearMainWorkspace,getMainWorkspace:m.getMainWorkspace,setMainWorkspace:m.setMainWorkspace,NodeSvg:g.default,Nodes:_.default,Widgets:A.default,WorkspaceSvg:y.default,Workspace:X.default,WorkspaceController:O.default,WASDController:N.default,nodeRendering:{SVG:x,rendererMap:T.RMap,Apollo:U,Atlas:q,Renderer:h.default,RendererConstants:l.default,Representer:G.default,RepresenterNode:W.RepresenterNode},atlas:q,apollo:U,commentRendering:{CommentModel:P.default,CommentRenderer:B.default},Dropdown:j.default};Object.defineProperty(J,"_mainWorkspace",{get:()=>(0,m.getMainWorkspace)(),set:t=>null==t||0==t||0===t||"string"==typeof t?(0,m.clearMainWorkspace)():(0,m.setMainWorkspace)(t)}),e.default=J},293:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default={UIStyles:{workspaceBGColor:"#ffffff",toolboxCategoriesBG:{position:"absolute",left:"0",top:"0",width:"20%",height:"100%",background:"rgba(240,240,240,0.9)",overflowY:"auto"},toolboxFlyoutBG:{display:"none",background:"rgba(240,240,240,0.9)",overflowY:"auto",padding:"4px",borderRadius:"4px",boxShadow:"0 2px 6px rgba(0,0,0,0.15)"}}}},471:function(t,e,n){"use strict";function r(t,e){function n(){return{start:Math.min(v,b),end:Math.max(v,b)}}function r(){return v!==b}function s(){if(!r())return 0;const{start:t,end:e}=n();return w=w.slice(0,t)+w.slice(e),v=t,b=t,1}function i(t,e,n){const r=g.getSvg().text(t).font({size:e||12,family:n||"Arial"}),s=g.measureTextBbox(r);return r.remove(),s.width}function a(){const{start:t,end:e}=n(),s=r();var o;p.clear().tspan(w.replace(/ /g," ").replace(/\n/g," ")),p.attr({"xml:space":"preserve"});try{o=p.node,Array.from(o.childNodes).forEach(t=>{1===t.nodeType&&t.setAttribute("xml:space","preserve")})}catch{}if(p.leading(1.2),s){const n=parseFloat(p.attr("font-size"))||14,r=p.attr("font-family")||"Arial",s=w.slice(0,t),o=w.slice(0,e),a=p.bbox(),l=a.x+i(s,n,r),h=Math.max(i(o,n,r)-i(s,n,r),1),c=a.y,u=a.height;C?C.size(h,u):(C=m.parent().rect?.(h,u).fill("#3390ff").attr({"fill-opacity":.35}),C.node.parentNode.insertBefore(C.node,p.node)),C.move(l,c)}else C&&(C.remove(),C=null);if(_){const t=parseFloat(p.attr("font-size"))||14,e=p.attr("font-family")||"Arial",n=i(w.slice(0,v),t,e),r=p.bbox(),s=r.y,o=r.height;x||(x=m.parent().rect(1,o).fill("#000")),x.size(1,o).move(r.x+n,s)}else x&&(x.remove(),x=null);const a=p.bbox(),l=Math.max(16,Math.ceil(a.width)+20+4),h=Math.max(16,Math.ceil(a.height)+8);m.size(l,h),f._tempInputBBox={width:l,height:h,textX:20,textY:4}}function l(t){if(!_){if(_=1,w=f.getText()??"",v=w.length,b=w.length,o.default.setState("typing"),t){const e=p.node.getBoundingClientRect(),n=g.getWs().getZoom(),r=(t.clientX-e.left-4)/n;let s=0;v=0;for(let t=0;t<w.length;t++){const e=i(w[t]);if(s+e/2>=r)break;s+=e,v=t+1}}b=v,a(),y=1,document.addEventListener("keydown",c),document.addEventListener("mousedown",u)}}function h(t=1){_&&(_=0,o.default.removeState("typing"),document.removeEventListener("keydown",c,{capture:1}),document.removeEventListener("mousedown",u),t&&f.setTextNoRedraw(w),a(),f.getWorkspace()?.redraw?.())}function c(t){if(_){if("Escape"===t.key)return t.preventDefault(),void h(0);"Enter"===t.key?(t.preventDefault(),h(1)):"Backspace"===t.key?(t.preventDefault(),r()?s():v>0&&(w=w.slice(0,v-1)+w.slice(v),v--,b=v)):"Delete"===t.key?(t.preventDefault(),r()?s():v<w.length&&(w=w.slice(0,v)+w.slice(v+1))):"ArrowLeft"===t.key?(t.preventDefault(),t.shiftKey?v=Math.max(0,v-1):(v=Math.max(0,v-1),b=v)):"ArrowRight"===t.key?(t.preventDefault(),t.shiftKey?v=Math.min(w.length,v+1):(v=Math.min(w.length,v+1),b=v)):"Home"===t.key?(t.preventDefault(),t.shiftKey?v=0:(v=0,b=v)):"End"===t.key?(t.preventDefault(),t.shiftKey?v=w.length:(v=w.length,b=v)):1!==t.key.length||t.ctrlKey||t.metaKey||(t.preventDefault(),r()&&s(),w=w.slice(0,v)+t.key+w.slice(v),v++,b=v),a(),f.setTextNoRedraw(w)}}function u(t){if(!_)return;if(y)return void(y=0);const e=t.target;e!==m.node&&e!==p.node&&h(1)}const d=e,f=d.comment,p=d.text,m=t,g=d.renderer;let _=0,y=0,w=f.getText()??"",v=w.length,b=w.length,x=null,C=null;const E=t=>l(t),M=t=>l(t);return m.on("mousedown",E),p.on("mousedown",M),a(),()=>{m.off("mousedown",E),p.off("mousedown",M),document.removeEventListener("keydown",c,{capture:1}),document.removeEventListener("mousedown",u)}}var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const i=s(n(7037)),o=s(n(63));i.default.registerEvent("k_commentinp",r),e.default=r},748:(t,e)=>{"use strict";function n(t){if(a?.getRandomValues){const e=new Uint8Array(t);return a.getRandomValues(e),e}const e=new Uint8Array(t);for(let n=0;n<t;n++)e[n]=Math.floor(256*Math.random());return e}function r(){const t=globalThis;if(t?.crypto?.randomUUID)return t.crypto.randomUUID();const e=n(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;const r=[];for(let t=0;t<256;t++)r.push(t.toString(16).padStart(2,"0"));return r[e[0]]+r[e[1]]+r[e[2]]+r[e[3]]+"-"+r[e[4]]+r[e[5]]+"-"+r[e[6]]+r[e[7]]+"-"+r[e[8]]+r[e[9]]+"-"+r[e[10]]+r[e[11]]+r[e[12]]+r[e[13]]+r[e[14]]+r[e[15]]}function s(t){"number"==typeof t||Date.now(),Math.floor(("number"==typeof t?t:Date.now())/4294967296);const e=new Uint8Array(6);let r=BigInt("number"==typeof t?t:Date.now());for(let t=5;t>=0;t--)e[t]=Number(0xffn&r),r>>=8n;let s="",i=0,o=0;for(let t=0;t<6;t++)for(i=i<<8|e[t],o+=8;o>=5;)o-=5,s+=l[i>>>o&31];o>0&&(s+=l[i<<5-o&31]),s=s.slice(0,10);const a=n(10);i=0,o=0;for(let t=0;t<a.length;t++)for(i=i<<8|a[t],o+=8;o>=5;)o-=5,s+=l[i>>>o&31];return o>0&&(s+=l[i<<5-o&31]),s.slice(0,26)}function i(t=21,e=h){if(t<=0)throw new Error("size must be > 0");const r=(1<<Math.ceil(Math.log2(e.length)))-1;let s="";for(;s.length<t;){const t=n(1)[0]&r;t<e.length&&(s+=e[t])}return s}function o(){const t=Date.now().toString(36);return c=c+1&4095,`${t}${c.toString(36).padStart(3,"0")}${Array.from(n(3)).map(t=>(63&t).toString(36).padStart(2,"0")).join("").slice(0,4)}`}Object.defineProperty(e,"__esModule",{value:1}),e.uuidv4=r,e.ulid=s,e.nanoid=i,e.shortId=o,e.generateUID=function(t="uuidv4",e={}){switch(t){case"uuidv4":default:return r();case"ulid":return s();case"nanoid":return i(e.size??21,e.alphabet??h);case"short":return o()}};const a="undefined"!=typeof globalThis&&globalThis.crypto||null,l="0123456789ABCDEFGHJKMNPQRSTVWXYZ",h="_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let c=0},1261:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=function(t){return t.replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}},1513:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.CommentModel=void 0;const s=r(n(2638)),i=r(n(8175)),o=n(748);class a{_text;_isWorkspaceComment;_parent;svgGroup;relativeCoords;svgLine;_tempInputBBox;id;constructor(t){this._parent=t,this._isWorkspaceComment=t instanceof s.default,this._text="",this.relativeCoords=new i.default(0,0),this.id=(0,o.generateUID)("nanoid",{alphabet:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0129384756!)@(#*$&%^"})}setTextNoRedraw(t){return this._text=t}getText(){return this._text}setText(t){const e=this._text=t;return this.getWorkspace().isHeadless||(this.getWorkspace().renderer.clearComments(),this.getWorkspace().renderer.drawComments()),e}isNodeComment(){return!this._isWorkspaceComment}isWorkspaceComment(){return this._isWorkspaceComment}getWorkspace(){return this.isWorkspaceComment()?this._parent:this._parent?.workspace}toJson(){return{text:this.getText(),coords:{x:this.relativeCoords.x,y:this.relativeCoords.y},parent:this.isWorkspaceComment()?null:this._parent.id,id:this.id}}static fromJson(t){const e=new a(null);return e.id=t.id,e.relativeCoords=new i.default(t.coords.x,t.coords.y),e.setTextNoRedraw(t.text),e}}e.CommentModel=a,e.default=a},1538:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(5242)),i=r(n(7037));class o{static get NAME(){return"cr_atlas"}static get COMMENT_G_TAG(){return"KabelCommentGroup"}static get COMMENT_LINE_TAG(){return"KabelCommentLine"}static get COMMENT_TEXT_EL(){return"KabelCommentText"}static get COMMENT_DRAG_EL(){return"KabelCommentDragHandle"}static get RENDERER_TAG_EL(){return"KabelCommentElTag"}workspace;constructor(t){this.workspace=t}encodeForSvg(t){return t.replace(/ /g," ")}ensureTspansPreserve(t){Array.from(t.childNodes).forEach(t=>{1===t.nodeType&&t.setAttribute("xml:space","preserve")})}measureTextBbox(t){return t.bbox()}drawComment(t){const e=this.getSvg();this._removeExistingElements(t);const n=e.group().addClass(o.COMMENT_G_TAG);n.attr({"comment-data":JSON.stringify({id:t.id,isws:t.isWorkspaceComment()})}),t.svgGroup=n;const r=this.encodeForSvg(t.getText()),i=this._createTextElement(n,r,20,4),a=this.measureTextBbox(i),l=this._createBackgroundRect(n,a,4,6),h=this._createDragHandle(n,a,4,6);this._addEventer(l,h,t,i);const{screenPos:c,zoom:u}=this._computeScreenPosition(t);n.attr({transform:`translate(${c.x}, ${c.y}) scale(${u})`}),t._parent instanceof s.default&&t._parent.svgGroup&&this._drawLineToNode(t,4)}refreshCommentTransforms(){for(const t of[...this.workspace.getComments(),...Array.from(this.workspace._nodeDB.values()).map(t=>t.getComment()).filter(t=>!!t)]){if(!t.svgGroup)continue;const{screenPos:e,zoom:n}=this._computeScreenPosition(t);t.svgGroup.attr({transform:`translate(${e.x}, ${e.y}) scale(${n})`}),t.svgLine&&(t.svgLine.remove(),t.svgLine=void 0),t._parent instanceof s.default&&this._drawLineToNode(t,4)}}_removeExistingElements(t){t.svgGroup&&t.svgGroup.remove(),t.svgLine&&t.svgLine.remove()}_createTextElement(t,e,n,r){const s=t.text(e).font({family:"Arial",size:12}).fill("#000").move(n,r).addClass(o.COMMENT_TEXT_EL);return s.node.style.userSelect="none",s.node.style.webkitUserSelect="none",s.node.style.msUserSelect="none",s.node.style.MozUserSelect="none",s}_createBackgroundRect(t,e,n,r){return t.rect(e.width+2*n+2*r+4,e.height+2*n).fill("#ffffcc").stroke({color:"#cccc99",width:1}).radius(4).back()}_createDragHandle(t,e,n,r){return t.circle(2*r).fill("#adad7d").move(n,n+e.height/2-r).addClass(o.COMMENT_DRAG_EL)}_addEventer(t,e,n,r){i.default.addElement(e,"k_draghandle",{comment:n}).tagElement(e,o.RENDERER_TAG_EL),i.default.addElement(t,"k_commentinp",{comment:n,text:r,renderer:this}).tagElement(t,o.RENDERER_TAG_EL)}_computeScreenPosition(t){let e=t.relativeCoords.x,n=t.relativeCoords.y;if(t._parent instanceof s.default){const r=t._parent.relativeCoords;e+=r.x,n+=r.y}return{screenPos:this.workspace.workspaceToScreen(e,n),zoom:this.workspace.getZoom()}}_drawLineToNode(t,e){if(!(t&&t._parent instanceof s.default&&t.svgGroup))return;const n=this.getSvg(),r=this.workspace;t.svgLine&&t.svgLine.remove();const i=t._parent.relativeCoords,a=t._parent.svgGroup.bbox(),l=r.workspaceToScreen(i.x+a.width/2,i.y),h=t._parent.relativeCoords,c=t.relativeCoords,u=h.x+c.x,d=h.y+c.y,f=t.svgGroup.bbox(),p=r.workspaceToScreen(u+(f.width+2*e)/2,d);t.svgLine=n.line(l.x,l.y,p.x,p.y).stroke({color:"#888",width:1,dasharray:"3,2"}).addClass(o.COMMENT_LINE_TAG).back()}clearAllComments(){const t=this.getSvg();t.find(`.${o.COMMENT_G_TAG}`).forEach(t=>t.remove()),t.find(`.${o.COMMENT_LINE_TAG}`).forEach(t=>t.remove()),i.default.destroyByTag(o.RENDERER_TAG_EL);for(let[t,e]of this.workspace._nodeDB){const t=e.getComment();t&&(t.svgGroup=void 0)}for(const t of this.workspace.getComments())t.svgGroup=void 0}clearCommentLines(){this.getSvg().find(`.${o.COMMENT_LINE_TAG}`).forEach(t=>t.remove())}drawAllComments(){for(const t of this.workspace.getComments())this.drawComment(t);for(let[t,e]of this.workspace._nodeDB){const t=e.getComment();t&&this.drawComment(t)}}getSvg(){return this.workspace.svg}getWs(){return this.workspace}}e.default=o},1717:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.RepresenterNode=e.Representer=e.Constants=e.Renderer=void 0;const s=r(n(4529));e.Renderer=s.default;const i=r(n(9081));e.Constants=i.default;const o=r(n(9417));e.Representer=o.default;const a=n(8582);Object.defineProperty(e,"RepresenterNode",{enumerable:1,get:function(){return a.RepresenterNode}})},1911:function(t,e,n){"use strict";var r,s=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:1,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:1,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),o=0;o<n.length;o++)"default"!==n[o]&&s(e,t,n[o]);return i(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const l=a(n(8219)),h=a(n(2638)),c=a(n(5242)),u=o(n(2871)),d=n(2643),f=a(n(3800)),p=a(n(7037)),m=a(n(1261)),g=a(n(2020)),_=a(n(1538));e.default=class{_constants;_currentNode;_nodeGroup;_nodeDraw;_ws;_drawStates;_commentDrawer;representer;constantOverrides;static get NODE_G_TAG(){return"AtlasNodeSVG"}static get ELEMENT_TAG(){return"AtlasElement"}static get CONN_LINE_TAG(){return"AtlasConnectionLine"}static get CONNECTOR_TAG(){return"AtlasConnectionBubble"}static get LINE_X_MARK_TAG(){return"AtlasLineXMark"}static get BACKGROUND_PATTERN(){return"WorkspaceBgPattern"}static get NAME(){return"atlas"}constructor(t,e={}){this._ws=t,this._currentNode=null,this._nodeGroup=null,this._nodeDraw=null,this._drawStates=[],this.constantOverrides=e,this.init()}init(){this.initCommentRenderer(),this.initRepresenter(),this.initConstants()}initConstants(){this._constants=new l.default(this.constantOverrides)}initRepresenter(){const t=n(9417).default;this.representer=new t}initCommentRenderer(){this._commentDrawer=new _.default(this.getWs())}setConnect(t){this.state?.pendingConnections?.push?.(t)}setConstants(t={}){return Object.assign(this._constants,t)}get constants(){if(!this.node)return this._constants;const{primary:t,secondary:e,tertiary:n,...r}=this.node.colors;return{...this._constants,...r}}set constants(t){this.setConstants(t)}get node(){return this._currentNode}get svg(){return this.getWs().svg}get state(){return this._nodeDraw}getWs(){return this._ws}getNodeBaseMeasurements(){const t=this.constants;return{width:t.NODE_BASE_WIDTH,height:t.NODE_BASE_HEIGHT}}measureTextWidth(t,e,n){const r=this.constants;if(!this.svg)return t.length*(e??r.FONT_SIZE)*.6;const s=this.svg.text(t).font({family:n??r.FONT_FAMILY,size:e??r.FONT_SIZE,anchor:"start"}).opacity(0),i=s.bbox().width;return s.remove(),i}measureTextHeight(t,e,n){const r=this.constants;if(!this.svg)return e??r.FONT_SIZE;const s=this.svg.text(t).font({family:n??r.FONT_FAMILY,size:e??r.FONT_SIZE,anchor:"start"}).opacity(0),i=s.bbox().height;return s.remove(),i}measureRawField(t=""){const e=this.constants,n=this.measureTextWidth(t);return{width:Math.max(e.FIELD_RAW_BASE_WIDTH,n+2*e.INPUT_BOX_PADDING),height:e.FIELD_RAW_BASE_HEIGHT}}measureLabel(t){this.constants;const e=t.getLabel?.();return e?{width:this.measureTextWidth(e),height:this.measureTextHeight(e)}:{width:0,height:0}}measureRaw(t){if(!t.hasRaw())return{width:0,height:0};this.constants;const e=this.measureRawField(t.getValue?.()??"");return{width:e.width,height:e.height}}measureCustom(t){if(!t.isCustomEditor())return{width:0,height:0};this.constants;const e=t.measureMyself();return e?{width:e.width,height:e.height}:{width:0,height:0}}getFieldMeasurementPadding(){return{width:this.constants.FIELD_SPACEX,height:0}}measureField(t){const e=[this.getFieldMeasurementPadding(),this.measureLabel(t),this.measureRaw(t),this.measureCustom(t),this.getFieldMeasurementPadding()];let n=0,r=0;for(const{width:t,height:s}of e)n+=t,r=Math.max(r,s);return{width:n,height:r}}measureNodeDimensions(){if(!this.node)return;const t=this.constants,e=this.measureBaseAndLabel(),n=this.measureFields(t.TOPBAR_HEIGHT+t.FIELD_SPACEY,e.width,e.height);return{width:n.width,height:n.height+t.FOOTER_HEIGHT,fields:n.fields}}measureFields(t,e,n){const r=this.constants,s=this.node;let i=t,o=e,a=n;const l=[];for(const t of s.allFields()){const e=this.measureField(t);l.push(e),o=Math.max(o,e.width+2*r.FIELD_MARGIN_X);const n=i+e.height;n+r.FIELD_MARGIN_Y>a&&(a=n+r.FIELD_MARGIN_Y),i+=e.height+r.FIELD_MARGIN_Y}return{width:o,height:a,fields:l}}measureBaseAndLabel(){const t=this.constants,e=this.node,n=this.getNodeBaseMeasurements();let r=n.width,s=n.height;if(e.labelText){const n=this.measureTextWidth(e.labelText,t.FONT_SIZE,t.FONT_FAMILY);r=Math.max(r,n+2*t.TOPBAR_LABEL_MARGIN_X)}return{width:r,height:s}}renderNode(t){this.startNode(t),this.node&&(this.drawNode(),this.representer.build(this.node,this,this.state),this.storeState())}startNode(t){const e=this.getWs();if(t instanceof c.default)this._currentNode=t;else{const n=e.getNode(t);n instanceof c.default?this._currentNode=n:this._currentNode=null}}drawState(t,e){return{id:e,group:t,fieldPosY:0,pendingConnections:[]}}storeState(){this._drawStates.push(this.state)}drawFieldRaw(t,e,n=0){const r=this.constants,s=e.getDisplayValue?.()??"",{width:i,height:o}=this.measureRawField(s),a=t.rect(i,o).fill((0,d.parseColor)(r.FIELD_RAW_COLOR)).stroke({color:(0,d.parseColor)(r.FIELD_RAW_OUTLINE_COLOR),width:r.FIELD_RAW_OUTLINE_STROKE}).radius(3),l=t.text(s).font({family:r.FONT_FAMILY,size:r.FONT_SIZE,anchor:r.INPUT_BOX_TEXT_ANCHOR}).fill((0,d.parseColor)(r.FIELD_RAW_TEXT_COLOR));l.node.style.userSelect="none";const h={box:a,txt:l},c=(o-l.bbox().height)/2;return a.move(n,0),l.move(n+r.INPUT_BOX_PADDING,c),p.default.addElement(a,"k_inputbox",{field:e,text:l,renderer:this,startX:n}).tagElement(a,[this.constructor.ELEMENT_TAG,`node_${this.node.id}`]),{rect:a,txt:l,rawBox:h}}drawFieldLabel(t,e,n=0){const r=this.constants,s=e.getLabel?.();if(!s)return 0;const i=t.text(s).font({family:r.FONT_FAMILY,size:r.FONT_SIZE,anchor:"start"}).fill((0,d.parseColor)(r.FONT_COLOR));i.node.style.userSelect="none";const o=i.bbox(),a=(Math.max(r.FIELD_RAW_BASE_HEIGHT,o.height)-o.height)/2;return i.move(n,a),o.width+r.LABEL_SPACING}drawNodeXButton(){const t=this.node,e=this._nodeDraw;if(!t||!e||!e.group)return;const n=this.constants,r=this.measureNodeDimensions(),s=r?.width??n.NODE_BASE_WIDTH,i=.6*n.TOPBAR_HEIGHT,o=(n.TOPBAR_HEIGHT-i)/2,a=e.group.group().attr({class:"node-x-clse"});p.default.addElement(a,"k_closenode",{workspace:this.getWs(),node:t}).tagElement(a,[this.constructor.ELEMENT_TAG,`node_${t.id}`]),a.rect(i,i).fill("#ffffff00").radius(2).move(s-i-o,o);const l=a.text("×").font({family:n.FONT_FAMILY,size:.8*i,weight:"bold",anchor:"middle"}).fill("#fff").attr({"text-anchor":"middle","dominant-baseline":"middle"});l.node.style.userSelect="none",l.transform({translateX:s-i/2-o,translateY:o+i/2}),e.xButton=a}drawConnector(t,e,n,r,s){const i=this.constants;if(!t||!e)return null;const o=e.bbox(),a=t,l="left"===r?0:o.width;if(i.CONNECTOR_TRIANGLE){const t=i.CONNECTOR_TRI_SIZE;let e=u.roundedTri(t,t,1);"left"===r&&(e=u.rotatePath(e,180,t/2,t/2));const o=a.path(e).fill((0,d.parseColor)(s)).stroke({color:(0,d.parseColor)("#00000000"),width:0});o.attr({class:this.constructor.CONNECTOR_TAG});const h="left"===r?-t:0;return o.transform({translateX:l+h,translateY:n-t/2}),o}{const t=i.CONNECTOR_RADIUS,e=u.circle(t),r=a.path(e).fill((0,d.parseColor)(s)).stroke({color:(0,d.parseColor)("#00000000"),width:0}).move(l-t,n-t);return r.attr({class:this.constructor.CONNECTOR_TAG}),r}}drawNodeLabel(t){const e=this.node,n=this.constants;if(e&&e.labelText){const r=t.text(e.labelText).font({family:n.FONT_FAMILY,size:n.FONT_SIZE,anchor:"start",weight:n.TOPBAR_LABEL_BOLDED?"600":"normal"}).fill((0,d.parseColor)(n.FONT_COLOR));r.node.style.userSelect="none";const s=r.bbox(),i=(n.TOPBAR_HEIGHT-s.height)/2;r.move(n.TOPBAR_LABEL_MARGIN_X,i+n.TOPBAR_LABEL_MARGIN_Y)}}drawNode(){if(!this.node)return;const t=this.node,e=this.drawState(this.createNodeGroup(t),t.id);this._nodeDraw=e;const n=this.measureNodeDimensions();this.drawNodeBase(e,n),this.drawNodeTopbar(e,this.getNodeColors(),n),this.drawNodeXButton(),this.drawNodeLabel(e.group),this.makeNodeDraggable(e.group,e.topbar,t),this.createFieldGroup(e),this.drawAllFieldsForNode(n),this.drawPreviousNextConnections(e,t,e.group,n)}createNodeGroup(t){const e=this.svg.group().attr({"data-node-id":(0,m.default)(t.id),class:this.constructor.NODE_G_TAG}),n=this._ws.workspaceToScreen(t.relativeCoords.x,t.relativeCoords.y);return e.attr({transform:`translate(${n.x}, ${n.y})`}),e}drawNodeBase(t,e){const n=this.constants,r=e?.width??n.NODE_BASE_WIDTH,s=e?.height??n.NODE_BASE_HEIGHT,i=n.CORNER_RADIUS;t.bg=t.group.path(u.roundedRect(r,s,i)).fill((0,d.parseColor)(n.NODE_BG_COLOR)).stroke({color:(0,d.parseColor)(n.NODE_OUTLINE_COLOR),width:2}),t.shadow=t.group.path(u.roundedRect(r,s,i)).fill("rgba(0,0,0,0.2)").move(Number(t.bg.x())+5,Number(t.bg.y())+5).back()}drawNodeTopbar(t,e,n){const r=this.constants,s=n?.width??r.NODE_BASE_WIDTH,i=r.CORNER_RADIUS;t.topbar=t.group.path(u.roundedRect(s,r.TOPBAR_HEIGHT,i)).fill((0,d.parseColor)(e.primary)).stroke({color:(0,d.parseColor)(e.tertiary),width:2})}makeNodeDraggable(t,e,n){p.default.addElement(t,"k_draggable",{dragel:e,group:t,node:n,type:2}).tagElement(t,[this.constructor.ELEMENT_TAG,`node_${n.id}`])}createFieldGroup(t){const e=this.constants,n=t.group.group();n.attr({transform:`translate(0, ${e.TOPBAR_HEIGHT+e.FIELD_SPACEY})`}),t.fieldCol=n}drawFieldForNode(t,e,n,r){const s=this.node,i=this.state,o=this.constants;if(!s||!i||!i.fieldCol)return;const a=i.fieldCol,l=i.group,h=e?.fields[n];if(!h)return;let c=o.FIELD_MARGIN_X;const u=a.group();u.attr({transform:`translate(${c}, ${r})`}),t.svgGroup=u,i.fieldPosY=r;const f=this.drawFieldLabel(u,t);if(t.isCustomEditor())t.drawMyself({measuredWidth:h.width,measuredHeight:h.height,xUsed:f,fieldGroup:u,nodeGroup:l,svg:this.svg,background:i.bg});else{let e,n;if(t.hasRaw()){const{rawBox:n}=this.drawFieldRaw(u,t,f);e=n}if(t.hasConnectable()&&t.connection){const e=(h.height+(t.hasRaw()?0:o.FIELD_MARGIN_Y))/2,a=o.TOPBAR_HEIGHT+o.FIELD_SPACEY+r+e,c=this.drawConnector(l,i.bg,a,"right",(0,d.parseColor)(o.FIELD_CONN_COLOR));if(c){const e={from:t.connection,to:t.connection.getTo()?.previousConnection,fromCircle:c,originCircle:c,originConn:t.connection};n={connector:c,connState:e},this.setConnect(e),p.default.addElement(c,"k_connectbubble",{connection:t.connection,field:t}).tagElement(c,[this.constructor.ELEMENT_TAG,`node_${s.id}`])}}t.onDraw(e,n)}}drawAllFieldsForNode(t=null){const e=this.node;let n=0;const r=this.state,s=this.constants;if(!e||!r||!r.fieldCol)return;r.fieldCol,r.group;const i=t??this.measureNodeDimensions();return e.allFields().forEach((t,e)=>{this.drawFieldForNode(t,i,e,n);const r=i?.fields[e];r&&(n+=r.height+s.FIELD_MARGIN_Y)}),r.fieldPosY=n,n}drawPreviousNextConnections(t,e,n,r=null){if(!t||!e)return;if(!t.bg)return;const s=this.constants,i=this.getNodeColors(),o=t.bg?.bbox(),a=(o?.height??r?.height)-s.FOOTER_HEIGHT;if(e.previousConnection){const r=this.drawConnector(n,t.bg,a,"left",(0,d.parseColor)(i.primary));if(r){const t={from:e.previousConnection,to:this.resolveConnectable(e.previousConnection.getFrom(),e.previousConnection),fromCircle:r,originConn:e.previousConnection,originCircle:r};this.setConnect(t),p.default.addElement(r,"k_connectbubble",{connection:e.previousConnection,node:e}).tagElement(r,[this.constructor.ELEMENT_TAG,`node_${e.id}`]),this._fillOtherNodeConnectorCircle(e.previousConnection,r,1)}}if(e.nextConnection){const r=this.drawConnector(n,t.bg,a,"right",(0,d.parseColor)(i.primary));if(r){const t={from:e.nextConnection,to:this.resolveConnectable(e.nextConnection.getTo(),e.nextConnection),fromCircle:r,originConn:e.nextConnection,originCircle:r};this.setConnect(t),p.default.addElement(r,"k_connectbubble",{connection:e.nextConnection,node:e}).tagElement(r,[this.constructor.ELEMENT_TAG,`node_${e.id}`]),this._fillOtherNodeConnectorCircle(e.nextConnection,r,0)}}}refreshComments(){return this._commentDrawer?.refreshCommentTransforms?.()}clearComments(){return this._commentDrawer?.clearAllComments?.()}drawComments(){return this._commentDrawer?.drawAllComments?.()}getZoom(){return this._ws.getZoom()??1}applyZoomToNode(t,e){const n=this.getZoom(),{x:r,y:s}=this._ws.workspaceToScreen(e.relativeCoords.x,e.relativeCoords.y);t.attr({transform:`translate(${r}, ${s}) scale(${n})`})}refreshNodeTransforms(){const t=this.svg.find(`.${this.constructor.NODE_G_TAG}`),e=this.getZoom();for(let n of t){const t=this._ws.getNode((0,g.default)(n.attr("data-node-id")));if(!t)continue;const{x:r,y:s}=this._ws.workspaceToScreen(t.relativeCoords.x,t.relativeCoords.y);n.attr({transform:`translate(${r}, ${s}) scale(${e})`})}this.refreshConnectionLines(),this.refreshComments()}refreshConnectionLines(){this.clearLines(),this.drawLinesForAllNodes()}getNodeColors(){return this.node.colors??{primary:"#000",secondary:"#000",tertirary:"#000",category:""}}fillAllNodeConnectorBubbles(){for(const t of this._drawStates)for(const e of t.pendingConnections){const{originConn:t}=e;if(t){if(!e.fromCircle){const t=this._drawStates.flatMap(t=>t.pendingConnections).find(t=>t.originConn===e.from&&t.originCircle);t&&(e.fromCircle=t.originCircle)}if(!e.toCircle){const t=this._drawStates.flatMap(t=>t.pendingConnections).find(t=>t.originConn===e.to&&t.originCircle);t&&(e.toCircle=t.originCircle)}}}}resolveConnectable(t,e){if(t&&e){if(e.isPrevious){if(t instanceof c.default)return t.nextConnection;if(t instanceof f.default)return t.connection}if(!e.isPrevious){if(t instanceof c.default)return t.previousConnection;if(t instanceof f.default)return t.connection}}}_fillOtherNodeConnectorCircle(t,e,n){for(const r of this._drawStates)for(const s of r.pendingConnections)n?s.to!==t||s.toCircle||(s.toCircle=e):s.from!==t||s.fromCircle||(s.fromCircle=e)}drawLinesForAllNodes(){const t=this.constants,e=this._ws.svg;this.fillAllNodeConnectorBubbles();const n=new Set;for(const r of this._drawStates)for(const s of r.pendingConnections){const{fromCircle:r,toCircle:i}=s;if(s.from!==s.originConn)continue;if(!r||!i)continue;if(n.has(r)||n.has(i))continue;n.add(r),n.add(i);const o=r.node,a=i.node,l=o.getBBox(),h=a.getBBox(),c=o.getScreenCTM(),u=a.getScreenCTM(),f=l.x+l.width/2,m=l.y+l.height/2,g=h.x+h.width/2,_=h.y+h.height/2,y=f*c.a+m*c.c+c.e,w=f*c.b+m*c.d+c.f,v=g*u.a+_*u.c+u.e,b=g*u.b+_*u.d+u.f;let x;if(t.CONNECTOR_LINE_CURVED){const t=Math.abs(v-y);x=`M ${y} ${w} C ${y+Math.sign(v-y)*Math.max(30,.3*t)} ${w}, ${v-Math.sign(v-y)*Math.max(30,.3*t)} ${b}, ${v} ${b}`}else x=`M ${y} ${w} L ${v} ${b}`;const C=this._ws.getZoom(),E=t.CONNECTOR_LINE_WIDTH*C,M=e.path(x).stroke({color:(0,d.parseColor)(r.fill()),width:E}).fill("none").attr({class:this.constructor.CONN_LINE_TAG});p.default.addElement(M,"k_connline",{fromConn:s.from,toConn:s.to,renderer:this}).tagElement(M,[this.constructor.ELEMENT_TAG,this.constructor.LINE_X_MARK_TAG])}}clearLines(){for(let t of this.getWs().svg.find(`.${this.constructor.CONN_LINE_TAG}`))t.remove();for(let t of this.getWs().svg.find(`.${this.constructor.LINE_X_MARK_TAG}`))t.remove()}clearScreen(){p.default.destroyByTag(this.constructor.ELEMENT_TAG),this._ws.svg.children().forEach(t=>{const e=t.hasClass(this.constructor.BACKGROUND_PATTERN),n="defs"==t.node.tagName,r=t.classes().includes(h.default.BACKGROUND_CLASS);e||n||r||t.remove()}),this._drawStates=[]}undoPendingConnsFor(t){for(let e of this._drawStates)for(let n of e.pendingConnections)n.toCircle==t.originCircle&&delete n.toCircle,n.fromCircle==t.originCircle&&delete n.fromCircle}rerenderNode(t){const e=this._drawStates.findIndex(e=>e.id===t.id);if(-1!==e){const n=this._drawStates[e];for(let t of n.pendingConnections)this.undoPendingConnsFor(t);n.group?.remove(),p.default.destroyByTag(`node_${t.id}`),this._drawStates.splice(e,1)}return this.startNode(t),this.drawNode(),this.representer.build(this.node,this,this.state),this.storeState(),this.refreshNodeTransforms(),t.svg.getRaw()}}},1949:t=>{"use strict";function e(t){return 10===t||13===t||8232===t||8233===t||32===t||9===t||11===t||12===t||160===t||t>=5760&&u.indexOf(t)>=0}function n(t){return t>=48&&t<=57}function r(t){return t>=48&&t<=57||43===t||45===t||46===t}function s(t){this.index=0,this.path=t,this.max=t.length,this.result=[],this.param=0,this.err="",this.segmentStart=0,this.data=[]}function i(t){for(;t.index<t.max&&e(t.path.charCodeAt(t.index));)t.index++}function o(t){var e=t.path.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="SvgPath: arc flag can be 0 or 1 only (at pos "+t.index+")")}function a(t){var e,r=t.index,s=r,i=t.max,o=0,a=0,l=0,h=0;if(s>=i)t.err="SvgPath: missed param (at pos "+s+")";else if(43!==(e=t.path.charCodeAt(s))&&45!==e||(e=++s<i?t.path.charCodeAt(s):0),n(e)||46===e){if(46!==e){if(o=48===e,e=++s<i?t.path.charCodeAt(s):0,o&&s<i&&e&&n(e))return void(t.err="SvgPath: numbers started with `0` such as `09` are illegal (at pos "+r+")");for(;s<i&&n(t.path.charCodeAt(s));)s++,a=1;e=s<i?t.path.charCodeAt(s):0}if(46===e){for(h=1,s++;n(t.path.charCodeAt(s));)s++,l=1;e=s<i?t.path.charCodeAt(s):0}if(101===e||69===e){if(h&&!a&&!l)return void(t.err="SvgPath: invalid float exponent (at pos "+s+")");if(43!==(e=++s<i?t.path.charCodeAt(s):0)&&45!==e||s++,!(s<i&&n(t.path.charCodeAt(s))))return void(t.err="SvgPath: invalid float exponent (at pos "+s+")");for(;s<i&&n(t.path.charCodeAt(s));)s++}t.index=s,t.param=parseFloat(t.path.slice(r,s))+0}else t.err="SvgPath: param should start with 0..9 or `.` (at pos "+s+")"}function l(t){var e,n;n=(e=t.path[t.segmentStart]).toLowerCase();var r=t.data;if("m"===n&&r.length>2&&(t.result.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.result.push([e].concat(r));else for(;r.length>=c[n]&&(t.result.push([e].concat(r.splice(0,c[n]))),c[n]););}function h(t){var e,n,s,h,u,d=t.max;if(t.segmentStart=t.index,n=97==(32|(e=t.path.charCodeAt(t.index))),function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return 1}return 0}(e))if(h=c[t.path[t.index].toLowerCase()],t.index++,i(t),t.data=[],h){for(s=0;;){for(u=h;u>0;u--){if(!n||3!==u&&4!==u?a(t):o(t),t.err.length)return void l(t);t.data.push(t.param),i(t),s=0,t.index<d&&44===t.path.charCodeAt(t.index)&&(t.index++,i(t),s=1)}if(!s){if(t.index>=t.max)break;if(!r(t.path.charCodeAt(t.index)))break}}l(t)}else l(t);else t.err="SvgPath: bad command "+t.path[t.index]+" (at pos "+t.index+")"}var c={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},u=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];t.exports=function(t){var e=new s(t),n=e.max;for(i(e);e.index<n&&!e.err.length;)h(e);return e.result.length&&("mM".indexOf(e.result[0][0])<0?(e.err="SvgPath: string should start with `M` or `m`",e.result=[]):e.result[0][0]="M"),{err:e.err,segments:e.result}}},1972:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(293)),i=r(n(9674)),o={Classic:s.default,Dark:i.default};e.default=o},2020:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=function(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}},2110:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(8175)),i=n(748);class o{workspace;container;coords;width;height;visible;name;id;options;static WIDGET_GLOBAL_ID=0;constructor(t,e={name:`Untitled(${o.WIDGET_GLOBAL_ID++})`}){this.workspace=t,this.coords=e.coords??new s.default(0,0),this.width=e.width??200,this.height=e.height??100,this.visible=0,this.name=e.name,this.id=(0,i.generateUID)("nanoid",{alphabet:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0129384756!)@(#*$&%^"}),this.options=e,this.container=document.createElement("div"),this.container.className=e.className??"KabelWidget",this.container.style.position="absolute",this.container.style.left=`${this.coords.x}px`,this.container.style.top=`${this.coords.y}px`,this.container.style.width=`${this.width}px`,this.container.style.height=`${this.height}px`,this.container.style.background="rgba(255,255,255,0.9)",this.container.style.border="1px solid #aaa",this.container.style.borderRadius="4px",this.container.style.boxShadow="0 2px 6px rgba(0,0,0,0.2)",this.container.style.pointerEvents="auto",this.container.style.zIndex="1000",e.html&&(this.container.innerHTML=e.html),this.workspace.isHeadless||this.workspace._wsTop.appendChild(this.container),this.hide(),void 0!==e.init&&e.init&&e.init(this,this.container)}show(){this.container.style.display="block",this.visible=1}hide(){this.container.style.display="none",this.visible=0}setCoords(t){this.coords=t,this.container.style.left=`${t.x}px`,this.container.style.top=`${t.y}px`}setHTML(t){this.container.innerHTML=t}reanimate(){this.container=document.createElement("div"),this.container.className=this.options.className??"KabelWidget",this.container.style.position="absolute",this.container.style.left=`${this.coords.x}px`,this.container.style.top=`${this.coords.y}px`,this.container.style.width=`${this.width}px`,this.container.style.height=`${this.height}px`,this.container.style.background="rgba(255,255,255,0.9)",this.container.style.border="1px solid #aaa",this.container.style.borderRadius="4px",this.container.style.boxShadow="0 2px 6px rgba(0,0,0,0.2)",this.container.style.pointerEvents="auto",this.container.style.zIndex="1000",this.options.html&&(this.container.innerHTML=this.options.html),this.workspace.isHeadless||(this.workspace._wsTop.appendChild(this.container),this.workspace._addWidgetToDB(this))}destroy(){this.container.remove(),this.workspace._delWidgetFromDB(this)}}e.default=o},2125:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=class{ws;undoStack=[];redoStack=[];isRecording=1;constructor(t){this.ws=t}emitChange(){if(!this.isRecording)return;if(!this.ws.recordHistory)return;const t=this.ws.toJson?this.ws.toJson(1):{};this.undoStack.push({state:t}),this.redoStack.length=0}undo(){if(this.undoStack.length<=1)return;const t=this.undoStack.pop(),e=this.undoStack[this.undoStack.length-1];e&&(this.isRecording=0,this.ws.fromJson?.(e.state),this.isRecording=1,this.redoStack.push(t))}redo(){const t=this.redoStack.pop();t&&(this.isRecording=0,this.ws.fromJson?.(t.state),this.isRecording=1,this.undoStack.push(t))}clear(){this.undoStack=[],this.redoStack=[]}canUndo(){return this.undoStack.length>1}canRedo(){return this.redoStack.length>0}}},2143:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=n(4803),i=n(5651),o=r(n(4629));e.default=function(){try{const t=new o.default;return(0,i.setMainWorkspace)(t),t}catch(t){new s.InjectMsg(`Failed to initialize workspace: ${t.message}`).err()}}},2446:t=>{"use strict";function e(t,n,r){if(!(this instanceof e))return new e(t,n,r);this.rx=t,this.ry=n,this.ax=r}var n=1e-10,r=Math.PI/180;e.prototype.transform=function(t){var e=Math.cos(this.ax*r),s=Math.sin(this.ax*r),i=[this.rx*(t[0]*e+t[2]*s),this.rx*(t[1]*e+t[3]*s),this.ry*(-t[0]*s+t[2]*e),this.ry*(-t[1]*s+t[3]*e)],o=i[0]*i[0]+i[2]*i[2],a=i[1]*i[1]+i[3]*i[3],l=((i[0]-i[3])*(i[0]-i[3])+(i[2]+i[1])*(i[2]+i[1]))*((i[0]+i[3])*(i[0]+i[3])+(i[2]-i[1])*(i[2]-i[1])),h=(o+a)/2;if(l<n*h)return this.rx=this.ry=Math.sqrt(h),this.ax=0,this;var c=i[0]*i[1]+i[2]*i[3],u=h+(l=Math.sqrt(l))/2,d=h-l/2;return this.ax=Math.abs(c)<n&&Math.abs(u-a)<n?90:180*Math.atan(Math.abs(c)>Math.abs(u-a)?(u-o)/c:c/(u-a))/Math.PI,this.ax>=0?(this.rx=Math.sqrt(u),this.ry=Math.sqrt(d)):(this.ax+=90,this.rx=Math.sqrt(d),this.ry=Math.sqrt(u)),this},e.prototype.isDegenerate=function(){return this.rx<n*this.ry||this.ry<n*this.rx},t.exports=e},2448:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(8175));class i extends s.default{constructor(t=0,e=0){super(t,e)}}e.default=i},2638:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(5242)),i=n(9772),o=r(n(2448)),a=r(n(4498)),l=r(n(3064)),h=n(3902),c=r(n(5631)),u=r(n(6545)),d=r(n(4982)),f=r(n(2110)),p=r(n(6596)),m=r(n(9551)),g=r(n(1513)),_=n(3800),y=r(n(6218)),w=r(n(4106)),v=r(n(2125)),b=r(n(4629)),x=r(n(1972)),C=n(2643);class E extends b.default{static get BACKGROUND_CLASS(){return"WorkspaceBackgroundRect"}theme;grid;_camera;_nodeDB;_root;_wsTop;svg;_backgroundRect;renderer;options;noRedraw;controller;toolbox;_widgetDB;_ctxMenu;_commentDB;history;recordHistory=1;recordHistoryRecord;_didMove=0;moveListeners;dragState=null;constructor(t,e,n){super(),this.isHeadless=0,e.style.width="100%",e.style.height="100%",this._root=t,this._wsTop=e,this.svg=(0,i.SVG)().addTo(this._wsTop).size("100%","100%"),this.options=n;let r=h.RMap.resolve(n.renderer);this.renderer=new r(this,this.options.rendererOverrides||{});const s="string"==typeof n.theme&&n.theme in x.default?n.theme:"Classic",u="object"==typeof n.theme&&n.theme?n.theme:x.default[s];this.options.toolbox&&(this.toolbox=new c.default(this)),this._camera=new o.default(0,0),this._nodeDB=new Map,this.noRedraw=0,this.controller=new(n.Controller??function(t){return t?.controls&&t?.controls.wasd?l.default:a.default}(n))(this),this._widgetDB=new Map,this._ctxMenu=new m.default(this),this._commentDB=new Set,this.history=new v.default(this),this.recordHistoryRecord=[],this.moveListeners=[],0!=n.initUndoRedo&&this.history.emitChange(),this.theme={},this._initBackground(),this.setTheme(u)}setTheme(t){try{this.theme=structuredClone(t)}catch{this.theme=Object.assign({},t)}this.toolbox&&this.toolbox.updateStyles(this.theme),this.theme.UIStyles&&this._backgroundRect.fill((0,C.parseColor)(this.theme.UIStyles.workspaceBGColor||"#fffffff"))}get didMove(){return this._didMove}set didMove(t){this._didMove=t,t&&(0,y.default)(1,()=>{this._didMove=0})}setDragState(t){if(!t.node)return void(this.dragState=null);const{node:e,startX:n,startY:r,currentX:s,currentY:i,offsetX:o=0,offsetY:a=0}=t;this.dragState={isDragging:1,node:e,startX:n,startY:r,offsetX:o,offsetY:a,lastX:s,lastY:i,deltaX:s-n,deltaY:i-r}}beginDrag(t,e,n,r=0,s=0){this.dragState={isDragging:1,node:t,startX:e,startY:n,offsetX:r,offsetY:s,lastX:e,lastY:n,deltaX:0,deltaY:0}}updateDrag(t,e){this.dragState&&this.dragState.node&&(this.dragState.lastX=t,this.dragState.lastY=e,this.dragState.deltaX=t-this.dragState.startX,this.dragState.deltaY=e-this.dragState.startY)}endDrag(){this.dragState&&(this.dragState.isDragging=0)}fireMoveListeners(){this.moveListeners.forEach(t=>t())}addMoveListener(t){return this.moveListeners.push(t),()=>{this.removeMoveListener(t)}}removeMoveListener(t){this.moveListeners=this.moveListeners.filter(e=>e!=t)}emitChange(){this.history.emitChange()}toggleHistory(t){this.recordHistoryRecord.push(this.recordHistory),this.recordHistory=t}untoggleHistory(){0==this.recordHistoryRecord.length||this.recordHistoryRecord.length<0||(this.recordHistory=this.recordHistoryRecord.pop())}_initBackground(){try{this._backgroundRect=this.svg.rect(this.svg.width(),this.svg.height()).fill((0,C.parseColor)(this.theme.UIStyles?.workspaceBGColor||"#ffffff")).addClass(E.BACKGROUND_CLASS).addTo(this.svg),this.svg.add(this._backgroundRect),this._backgroundRect.back()}catch(t){console.error(t)}this.options.grid&&(this.grid=new w.default(this,this.svg,this.options.grid))}_updateBackgroundTransform(){this.grid?.updateTransform?.();try{this._backgroundRect.back()}catch(t){console.error(t)}}getZoom(){return this.controller.getZoom()}refreshComments(){this.renderer.refreshComments()}getComments(){return Array.from(this._commentDB)}cloneNode(t){const e=new s.default(t.prototype,this);e.init(),e.fromNode(t),this.redraw()}_addWidgetToDB(t){this._widgetDB.set(t.id,t)}_delWidgetFromDB(t){this._widgetDB.delete(t.id)}newWidget(t){const e=p.default[t];if(!e)return;if(e.cls){const t=new e.cls(this,e);return this._addWidgetToDB(t),t}const n=new f.default(this,e);return this._addWidgetToDB(n),n}getWidget(t){if(this._widgetDB.has(t))return this._widgetDB.get(t)}getContentSize(){const t=this.svg.bbox();return{width:t.width,height:t.height}}getSize(){const t=this._wsTop.getBoundingClientRect();return{width:t.width,height:t.height}}refresh(){this.renderer.refreshNodeTransforms(),this._updateBackgroundTransform()}drawAllNodes(){for(let[t,e]of this._nodeDB)this.drawNode(t)}redraw(){this.noRedraw||(this.renderer.clearScreen(),this.drawAllNodes(),this.refresh(),this.renderer.clearComments(),this.renderer.drawComments())}workspaceToScreen(t,e){const n=this.getZoom();return{x:(t-this._camera.x)*n,y:(e-this._camera.y)*n}}screenToWorkspace(t,e){const n=this.getZoom();return{x:t/n+this._camera.x,y:e/n+this._camera.y}}drawNode(t){return this.renderer.rerenderNode(this._nodeDB.get(t))}addNode(t,e){let n=e||t.id;this._nodeDB.has(n)&&console.warn(`Node with id ${n} already exists, overwriting.`),t.workspace!==this&&(t.workspace=this),this._nodeDB.set(n,t),this.drawNode(n),this.history.emitChange()}newNode(t,e=1){if(!u.default[t])return;const n=(0,d.default)(t);return n?(e&&this.addNode(n),n):void 0}spawnAt(t,e,n){const r=this.newNode(t,0);if(r)return r.relativeCoords.set(e,n),this.addNode(r),this.drawNode(r.id),r}derefNode(t){const e=t.previousConnection?.getFrom?.();e instanceof s.default?e.nextConnection?.disconnectTo():e instanceof _.ConnectableField&&e.hasConnectable()&&e.disconnect();const n=t.nextConnection?.getTo?.();n instanceof s.default&&n.previousConnection?.disconnectFrom();for(let e of t.allFields())e.hasConnectable?.()&&e.disconnect()}removeNodeById(t){const e=this._nodeDB.get(t);e&&(this.derefNode(e),this._nodeDB.delete(t),this.redraw(),this.history.emitChange())}removeNode(t){t&&this.removeNodeById(t.id)}getNode(t){return t instanceof s.default?t:this._nodeDB.get(t)}pan(t,e){this.controller.pan(t,e)}addComment(){const t=new g.default(this);return this._commentDB.add(t),this.redrawComments(),t}getComment(t){return Array.from(this._commentDB).find(e=>e.id===t)}removeComment(t){let e;return e="string"==typeof t?this.getComment(t):t,e?(this._commentDB.delete(e),this.redrawComments(),1):0}redrawComments(){this.renderer.clearComments(),this.renderer.drawComments()}fromJson(t,e=0){this.toggleHistory(0);for(let[t,e]of this._nodeDB.entries())this.removeNode(e);if(t.circular)for(let e of t.nodes)s.default.deserialize(e,this);else for(let e of t.nodes)s.default.fromJson(e,this);this.untoggleHistory(),e&&this.recordHistory&&this.history.emitChange()}toJson(t){const e=[];if(t)for(let[t,n]of this._nodeDB)n.topLevel&&e.push(n.serialize());else for(let[t,n]of this._nodeDB)n.topLevel&&e.push(n.toJson());return{circular:t,nodes:e}}}e.default=E},2643:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.parseColor=function(t){if("string"==typeof t){if(t.startsWith("#")){let e=t.slice(1);return 3===e.length&&(e=e.split("").map(t=>t+t).join("")),`#${e}`}{const e=t.split(",").map(t=>parseInt(t.trim(),10));if(3!==e.length)throw new Error(`Invalid RGB string: ${t}`);const[n,r,s]=e;return!n&&0!==n||!r&&0!==r||!s&&0!==s?(console.warn("Invalid RGB tuple"),"#000"):`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}}if(Array.isArray(t)){const[e,n,r]=t;return`#${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}{const{r:e,g:n,b:r}=t;return`#${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}}},2871:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.roundedRect=function(t,e,n){return`\n\t\tM${n=Math.min(n,t/2,e/2)},0\n\t\tH${t-n}\n\t\tA${n},${n} 0 0 1 ${t},${n}\n\t\tV${e-n}\n\t\tA${n},${n} 0 0 1 ${t-n},${e}\n\t\tH${n}\n\t\tA${n},${n} 0 0 1 0,${e-n}\n\t\tV${n}\n\t\tA${n},${n} 0 0 1 ${n},0\n\t\tZ\n\t`.replace(/\s+/g," ").trim()},e.roundedTri=function(t,e,n){const r=t/2;return`\n\t\tM${r},0\n\t\tL${t-(n=Math.min(n,r,e/2))},${e-n}\n\t\tA${n},${n} 0 0 1 ${t-2*n},${e}\n\t\tL${2*n},${e}\n\t\tA${n},${n} 0 0 1 ${n},${e-n}\n\t\tZ\n\t`.replace(/\s+/g," ").trim()},e.circle=function(t){return`\n\t\tM${t},0\n\t\tA${t},${t} 0 1,0 ${-t},0\n\t\tA${t},${t} 0 1,0 ${t},0\n\t\tZ\n\t`.replace(/\s+/g," ").trim()},e.ellipse=function(t,e){return`\n\t\tM${t},0\n\t\tA${t},${e} 0 1,0 ${-t},0\n\t\tA${t},${e} 0 1,0 ${t},0\n\t\tZ\n\t`.replace(/\s+/g," ").trim()},e.star=function(t,e=5){if(e<2)throw new Error("Star must have at least 2 points");let n="";const r=2*Math.PI/(2*e);for(let s=0;s<2*e;s++){const e=s%2==0?t:t/2,i=e*Math.sin(s*r),o=-e*Math.cos(s*r);n+=0===s?`M${i},${o}`:` L${i},${o}`}return n+=" Z",n},e.polygon=function(t,e=3){if(e<3)throw new Error("Polygon must have at least 3 sides");let n="";const r=2*Math.PI/e;for(let s=0;s<e;s++){const e=t*Math.cos(s*r-Math.PI/2),i=t*Math.sin(s*r-Math.PI/2);n+=0===s?`M${e},${i}`:` L${e},${i}`}return n+=" Z",n},e.rotatePath=function(t,e,n=0,r=0){return new s.default(t).rotate(e,n,r).toString()};const s=r(n(8136))},3044:(t,e,n)=>{"use strict";var r=n(4375),s={matrix:1,scale:1,rotate:1,translate:1,skewX:1,skewY:1},i=/\s*(matrix|translate|scale|rotate|skewX|skewY)\s*\(\s*(.+?)\s*\)[\s,]*/,o=/[\s,]+/;t.exports=function(t){var e,n,a=new r;return t.split(i).forEach(function(t){if(t.length)if(void 0===s[t])switch(n=t.split(o).map(function(t){return+t||0}),e){case"matrix":return void(6===n.length&&a.matrix(n));case"scale":return void(1===n.length?a.scale(n[0],n[0]):2===n.length&&a.scale(n[0],n[1]));case"rotate":return void(1===n.length?a.rotate(n[0],0,0):3===n.length&&a.rotate(n[0],n[1],n[2]));case"translate":return void(1===n.length?a.translate(n[0],0):2===n.length&&a.translate(n[0],n[1]));case"skewX":return void(1===n.length&&a.skewX(n[0]));case"skewY":return void(1===n.length&&a.skewY(n[0]))}else e=t}),a}},3064:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(4498)),i=r(n(63));class o extends s.default{moveSpeed;doAccelerate;accelSpeed;friction;velocity;zoom=1;zoomSpeed;minZoom;maxZoom;isFalloff;constructor(t,e){super(t),this.moveSpeed=t.options.moveSpeed||e||5,this.doAccelerate=t.options?.controls?.wasdSmooth??0,this.accelSpeed=t.options?.controls?.wasdAccelerate??.2,this.friction=t.options?.controls?.wasdFriction??.85,this.velocity={x:0,y:0},this.isFalloff=0,this.zoomSpeed=t.options?.controls?.zoomSpeed??.1,this.minZoom=t.options?.controls?.minZoom??.1,this.maxZoom=t.options?.controls?.maxZoom??4,this.zoom=1,t._wsTop.addEventListener("wheel",this.onWheel.bind(this),{passive:0})}canMove(){return!i.default.hasState("typing")}update(){if(super.update(),!this.canMove())return;let t=0,e=0;if((this.keysDown.has("w")||this.keysDown.has("ArrowUp"))&&(e-=1),(this.keysDown.has("s")||this.keysDown.has("ArrowDown"))&&(e+=1),(this.keysDown.has("a")||this.keysDown.has("ArrowLeft"))&&(t-=1),(this.keysDown.has("d")||this.keysDown.has("ArrowRight"))&&(t+=1),this.doAccelerate)this.velocity.x+=t*this.accelSpeed,this.velocity.y+=e*this.accelSpeed,this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.isFalloff=0==t&&0==e?1:0,(Math.abs(this.velocity.x)>.01||Math.abs(this.velocity.y)>.01)&&this.pan(this.velocity.x,this.velocity.y);else{const n=t*this.moveSpeed,r=e*this.moveSpeed;0===n&&0===r||this.pan(n,r)}}pan(t,e){const n=this.workspace._camera.x,r=this.workspace._camera.y;this.workspace._camera.x+=t,this.workspace._camera.y+=e,n==this.workspace._camera.x&&r==this.workspace._camera.y||(this.isFalloff||(this._throttledFireDidMove(),this.workspace.didMove=1,this.workspace.fireMoveListeners(),this.refreshPos()),this.refreshPos())}onWheel(t){t.preventDefault();let e=this.getZoom()*(1+-t.deltaY*this.zoomSpeed*.01);e=Math.max(this.minZoom,Math.min(this.maxZoom,e));const n=t.clientX,r=t.clientY,s=this.workspace.screenToWorkspace(n,r);this.setZoom(e),this.workspace._camera.x=s.x-n/e,this.workspace._camera.y=s.y-r/e,this.workspace.refresh()}getZoom(){return this.zoom}setZoom(t){this.zoom=t}}e.default=o},3132:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.loadGoogleFont=function(t,e=[400,700]){if(n[t])return n[t];const r=`gf-${t.replace(/\s+/g,"-")}`;if(!document.getElementById(r)){const n=document.createElement("link");n.id=r,n.rel="stylesheet";const s=e.join(";");n.href=`https://fonts.googleapis.com/css2?family=${t.replace(/\s+/g,"+")}:wght@${s}&display=swap`,document.head.appendChild(n)}const s=e.map(e=>document.fonts.load(`${e} 1em ${t}`)),i=Promise.all(s).then(()=>{});return n[t]=i,i};const n={}},3454:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),r(n(7037)).default.registerEvent("k_connline",function(t,e){const n=()=>{e.fromConn.disconnectTo(),e.toConn.disconnectFrom(),t.remove(),o.remove();const n=[];for(let t of e.renderer._drawStates){for(let r of t.pendingConnections)r.from==e.fromConn&&r.to==e.toConn&&n.push(r),(r.from=e.toConn&&r.to==e.fromConn)&&n.push(r);t.pendingConnections=t.pendingConnections.filter(t=>!n.includes(t))}},r=t.bbox(),s=r.x+r.width/2,i=r.y+r.height/2,o=t.parent().text("X").font({family:"Fredoka, sans-serif",size:46,weight:"700",anchor:"middle",leading:"1em"}).addClass(e.renderer.constructor.LINE_X_MARK_TAG).center(s,i).fill("#fff").stroke({color:"#000",width:2}).hide();return o.on("click",n),o.node.style.userSelect="none",t.on("mouseover",()=>o.show()),t.on("mouseout",()=>o.hide()),t.on("click",n),()=>{t.off("click",n),t.off("mouseover"),t.off("mouseout"),o.off("click",n),o.remove()}})},3800:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.FieldMap=e.DropdownField=e.OptConnectField=e.TextField=e.NumberField=e.ConnectableField=e.DummyField=void 0;const s=r(n(8670)),i=r(n(5242)),o=r(n(6551));class a{label;name;type;node;editable;svgGroup;value;static register(t,e){}static unregister(t){}constructor(){this.label="",this.name="",this.type="",this.value=null,this.editable=1}onDraw(t,e){}canEditConnector(){return 0}setEditable(t){this.editable=t,this.node&&this.node?.workspace?.renderer?.rerenderNode?.(this.node)}canEdit(){return this.editable}setName(t){return this.name=t}fromJson(t,e){void 0!==t.name&&(this.name=t.name),void 0!==t.label&&(this.label=t.label),void 0!==t.type&&(this.type=t.type),void 0!==t.value&&(this.value=t.value),t.editable&&this.setEditable(Boolean(t.editable))}getName(){return this.name}getLabel(){return this.label}setLabel(t){return this.label=t}hasRaw(){return 1}hasConnectable(){return 0}isCustomEditor(){return 0}drawMyself(t){}measureMyself(){return{width:null,height:null}}getValue(){return this.value}setValue(t){this.value=t}getDisplayValue(){return this.getValue()}toJson(t,e){return{name:this.name,label:this.label,type:this.type,value:this.getValue()}}}class l{label;name;type;node;editable;svgGroup;constructor(){this.label="",this.name="",this.type="",this.editable=0}onDraw(t,e){}canEditConnector(){return 0}setEditable(t){this.editable=t,this.node&&this.node?.workspace?.renderer?.rerenderNode?.(this.node)}canEdit(){return this.editable}setName(t){return this.name=t}fromJson(t){void 0!==t.name&&(this.name=t.name),void 0!==t.label&&(this.label=t.label),void 0!==t.type&&(this.type=t.type)}hasRaw(){return 0}hasConnectable(){return 0}getName(){return this.name}getLabel(){return this.label}setLabel(t){return this.label=t}isCustomEditor(){return 0}drawMyself(t){}measureMyself(){return{width:0,height:0}}getValue(){return null}setValue(t){}getDisplayValue(){return this.getValue()}toJson(t,e){return{name:this.name,label:this.label,type:this.type,value:this.getValue()}}}e.DummyField=l;class h extends a{connection;constructor(){super(),this.connection=new s.default(this,null),this.value=null}hasConnectable(){return 1}hasRaw(){return 0}disconnect(){const t=this.connection.to;t instanceof i.default&&t?.previousConnection?.from&&(t.previousConnection.from=null,this.connection.to=null)}fromJson(t,e){return super.fromJson(t),t.value&&"object"==typeof t.value&&t.value.id?(this.value=i.default._deserialize(t.value,{},e),this.connection.setTo(this.value)):t.value instanceof i.default?(this.value=t.value,this.connection.setTo(this.value)):this.value=t.value,this}toJson(t,e){let n=this.getValue();return n instanceof i.default&&(n={node:e[n.id]?t?e[n.id]:n.id:n.serialize(e)}),{...super.toJson(1,e),value:n}}}e.ConnectableField=h;class c extends a{constructor(){super()}fromJson(t){super.fromJson(t),void 0!==t.value&&this.setValue(Number(t.value))}setValue(t){this.value=Number(t)}}e.NumberField=c;class u extends a{constructor(){super()}fromJson(t){super.fromJson(t),void 0!==t.value&&this.setValue(String(t.value))}setValue(t){this.value=String(t)}}e.TextField=u;class d extends h{fldType;constructor(){super(),this.fldType="string"}canEditConnector(){return 1}canEdit(){return this.getValue()instanceof i.default?0:this.editable}getValue(){return this.connection&&this.connection.getTo()?this.connection.getTo():this.value}hasRaw(){return 1}hasConnectable(){return 1}setFieldType(t){this.fldType=t}fromJson(t,e){return super.fromJson(t,e),this.fldType=t.fld_type||"string",null!=this.value&&typeof this.value===this.fldType&&this.setValue(this.value),this}setValue(t){"number"===this.fldType?this.value=Number(t):this.value=String(t)}getDisplayValue(){return null==this.value?"number"===this.fldType?"0":"":this.getValue()instanceof i.default?"[NODE]":String(this.value)}toJson(t,e){let n=this.getValue();return n instanceof i.default&&(n={node:t?n.serialize(e):n.id}),{...super.toJson(1,e),fld_type:this.fldType,value:n}}}e.OptConnectField=d;class f extends a{options;_selected;_isOpen;constructor(){super(),this.options=null,this._selected=null,this._isOpen=0}onDraw(t){if(!t||!this.options)return;const{box:e,txt:n}=t,r=()=>this.toggleDropdown(t);e.click(r),n.click(r)}toggleDropdown(t){o.default.getOwner()===this?this.closeDropdown():this.openDropdown(t),t.txt.text(this.getDisplayValue())}openDropdown(t){if(!this.options)return;const e=this.options.map(t=>({label:"string"==typeof t?t:t.text,value:"string"==typeof t?t:t.value}));o.default.show(this,{items:e,width:2*t.box.bbox().width,onSelect:t=>{if(!this.options)return;const e=this.options.find(e=>e===t||"string"!=typeof e&&e.value===t);e&&(this._selected=e,this.setValue(t),this.closeDropdown(),this?.node?.workspace?.emitChange?.(),this?.node?.workspace?.renderer?.rerenderNode?.(this.node))}})}closeDropdown(){o.default.hideIfOwner(this)}canEdit(){return 0}getSelected(){return this._selected}fromJson(t){super.fromJson(t),this.options=t.options||null,this._selected=this.options?.[0]??null,this._selected&&this.setValue("string"==typeof this._selected?this._selected:this._selected.value)}getDisplayValue(){return("string"==typeof this._selected?this._selected:this._selected?.text||"")+" "+(o.default.getOwner()==this?"▲":"▼")}setOptions(t){this.options=t,this._selected=this.options?.[0]??null,this._selected&&this.setValue("string"==typeof this._selected?this._selected:this._selected.value)}toJson(t,e){return{...super.toJson(t,e),options:this.options}}}e.DropdownField=f,e.FieldMap={field_both:d,field_string:u,field_num:c,field_dummy:l,field_str:u,connection:h,dropdown:f},e.default=a},3902:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.RendererMap=e.RMap=void 0;const r={};e.RendererMap=r;class s{static register(t,e){const n=e??t.NAME;r[n]=t}static delete(t){return"default"===t?0:r[t]?(delete r[t],1):0}static get(t){const e=n(1911).default;return r[t]??r.default??e}static list(){return Object.keys(r)}static resolve(t){const e=n(1911).default;return t?"string"==typeof t?s.get(t):"function"==typeof t?t:r.default??e:r.default??e}}e.RMap=s},4106:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1});const r=n(5552);e.default=class{ws;svg;pattern;rect;grid;constructor(t,e,n){this.ws=t,this.svg=e,this.grid={type:n.type??"dotted",spacing:n.spacing??40,dotSize:n.dotSize??2,strokeWidth:n.strokeWidth??2,color:n.color??"#bebebeff"},this.init()}init(){this.rect&&this.rect.remove();const{type:t,spacing:e,dotSize:n,strokeWidth:s,color:i}=this.grid;let o=this.svg.findOne("defs");o||(o=this.svg.defs()),this.pattern=this.svg.pattern(e,e,r=>{"dotted"===t?r.circle(2*n).fill(i).move(e/2-n,e/2-n):r.rect(e,e).stroke({color:i,width:s}).fill("none")}),this.pattern.attr({patternUnits:"userSpaceOnUse"}),o.add(this.pattern);const{width:a,height:l}=this.ws.getSize();this.rect=this.svg.rect(a,l).fill(this.pattern).back().addClass("WorkspaceBgPattern"),(0,r.addWindowListener)("resize",()=>this.resize())}resize(){if(!this.rect)return;const{width:t,height:e}=this.ws.getSize();this.rect.size(t,e).back(),this.ws._backgroundRect.back()}updateTransform(){if(!this.pattern||!this.rect)return;const{type:t,spacing:e,dotSize:n,strokeWidth:r,color:s}=this.grid,i=this.ws.getZoom(),o=e*i;if(this.pattern.attr({width:o,height:o}),this.pattern.clear(),"dotted"===t){const t=Math.max(n*i,.5);this.pattern.circle(2*t).fill(s).move(o/2-t,o/2-t)}else this.pattern.rect(o,o).stroke({color:s,width:r*i}).fill("none");const a=this.ws._camera;this.pattern.attr({patternTransform:`translate(${-a.x*i%o}, ${-a.y*i%o})`}),this.resize(),this.ws._backgroundRect.back()}updateOptions(){const t=this.ws.options.grid;this.grid={type:t.type??"dotted",spacing:t.spacing??40,dotSize:t.dotSize??2,strokeWidth:t.strokeWidth??2,color:t.color??"#bebebeff"},this.init()}setOptions(t){Object.assign(this.grid,t),this.rect?.remove?.(),this.pattern?.remove?.(),this.init()}}},4115:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),r(n(7037)).default.registerEvent("k_closenode",function(t,e){const n=t,r=e.workspace,s=()=>{r.removeNode(e.node)};return n.on("click",s),()=>{n.off("click",s)}})},4222:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default={}},4375:t=>{"use strict";function e(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}function n(){if(!(this instanceof n))return new n;this.queue=[],this.cache=null}n.prototype.matrix=function(t){return 1===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&0===t[4]&&0===t[5]||(this.cache=null,this.queue.push(t)),this},n.prototype.translate=function(t,e){return 0===t&&0===e||(this.cache=null,this.queue.push([1,0,0,1,t,e])),this},n.prototype.scale=function(t,e){return 1===t&&1===e||(this.cache=null,this.queue.push([t,0,0,e,0,0])),this},n.prototype.rotate=function(t,e,n){var r,s,i;return 0!==t&&(this.translate(e,n),r=t*Math.PI/180,s=Math.cos(r),i=Math.sin(r),this.queue.push([s,i,-i,s,0,0]),this.cache=null,this.translate(-e,-n)),this},n.prototype.skewX=function(t){return 0!==t&&(this.cache=null,this.queue.push([1,0,Math.tan(t*Math.PI/180),1,0,0])),this},n.prototype.skewY=function(t){return 0!==t&&(this.cache=null,this.queue.push([1,Math.tan(t*Math.PI/180),0,1,0,0])),this},n.prototype.toArray=function(){if(this.cache)return this.cache;if(!this.queue.length)return this.cache=[1,0,0,1,0,0],this.cache;if(this.cache=this.queue[0],1===this.queue.length)return this.cache;for(var t=1;t<this.queue.length;t++)this.cache=e(this.cache,this.queue[t]);return this.cache},n.prototype.calc=function(t,e,n){var r;return this.queue.length?(this.cache||(this.cache=this.toArray()),[t*(r=this.cache)[0]+e*r[2]+(n?0:r[4]),t*r[1]+e*r[3]+(n?0:r[5])]):[t,e]},t.exports=n},4498:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=class{workspace;keysDown;mouseBtns;mousePos;lastMousePos;isDragging;wheelDelta;movedListeners;_lastMoveFire=0;_moveThrottleMs=100;_queuedMove=0;_moveTimeout=null;_updateInt;constructor(t){this.workspace=t,this.keysDown=new Set,this.mouseBtns=new Set,this.mousePos={x:0,y:0},this.lastMousePos={x:0,y:0},this.isDragging=0,this.wheelDelta=0,this.movedListeners=[],this._setupListeners(),this._updateInt=setInterval(()=>this.update(),16)}addMoveListener(t){this.movedListeners.push(t)}removeMoveListener(t){const e=this.movedListeners.indexOf(t);-1!==e&&this.movedListeners.splice(e,1)}fireDidMove(){"undefined"!=typeof queueMicrotask?queueMicrotask(()=>{for(let t of this.movedListeners)try{t()}catch(t){console.error(t)}}):Promise.resolve().then(()=>{for(let t of this.movedListeners)try{t()}catch(t){console.error(t)}})}_throttledFireDidMove(){const t=performance.now();if(t-this._lastMoveFire>=this._moveThrottleMs)return this._lastMoveFire=t,void this.fireDidMove();if(!this._queuedMove){this._queuedMove=1;const e=this._moveThrottleMs-(t-this._lastMoveFire);this._moveTimeout=setTimeout(()=>{this._queuedMove=0,this._lastMoveFire=performance.now(),this.fireDidMove()},e)}}getZoom(){return 1}canMove(){return 1}_setupListeners(){window.addEventListener("keydown",t=>this.keysDown.add(t.key)),window.addEventListener("keyup",t=>this.keysDown.delete(t.key)),window.addEventListener("mousedown",t=>this.mouseBtns.add(t.button)),window.addEventListener("mouseup",t=>this.mouseBtns.delete(t.button)),window.addEventListener("mousemove",t=>{this.lastMousePos={...this.mousePos},this.mousePos={x:t.clientX,y:t.clientY}}),window.addEventListener("wheel",t=>{this.wheelDelta=t.deltaY}),window.addEventListener("mousedown",t=>{0===t.button&&(this.isDragging=1)}),window.addEventListener("mouseup",t=>{0===t.button&&(this.isDragging=0)})}update(){}pan(t,e){const n=this.workspace._camera.x,r=this.workspace._camera.y;this.workspace._camera.x+=t,this.workspace._camera.y+=e,n==this.workspace._camera.x&&r==this.workspace._camera.y||(this._throttledFireDidMove(),this.workspace.didMove=1,this.workspace.fireMoveListeners(),this.refreshPos())}setCamera(t){const e=this.workspace._camera.x,n=this.workspace._camera.y;this.workspace._camera.x=t.x,this.workspace._camera.y=t.y,e==this.workspace._camera.x&&n==this.workspace._camera.y||(this._throttledFireDidMove(),this.workspace.didMove=1,this.workspace.fireMoveListeners(),this.refreshPos())}centerOn(t){const e=this.workspace.getSize?.()??{width:0,height:0};this.setCamera({x:t.x-e.width/2,y:t.y-e.height/2})}screenToWorkspace(t,e){const n=this.workspace._camera;return{x:t+n.x,y:e+n.y}}workspaceToScreen(t,e){const n=this.workspace._camera;return{x:t-n.x,y:e-n.y}}refreshPos(){this.workspace.refresh?.()}redraw(){this.workspace.redraw?.()}stop(){clearInterval(this._updateInt)}}},4529:function(t,e,n){"use strict";var r,s=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:1,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:1,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),o=0;o<n.length;o++)"default"!==n[o]&&s(e,t,n[o]);return i(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const l=o(n(2871)),h=a(n(1911)),c=a(n(9081)),u=n(2643),d=a(n(7037));console.log(h.default);class f extends h.default{static get NAME(){return"apollo"}static get ElEMENT_TAG(){return"ApolloElement"}constructor(t,e){super(t,e)}get constants(){return super.constants}initConstants(){this._constants=new c.default(this.constantOverrides)}drawNodeTopbar(t,e,n){const r=this.constants,s=n?.width??r.NODE_BASE_WIDTH,i=r.CORNER_RADIUS;t.topbar=t.group.path(l.roundedRect(s,r.TOPBAR_HEIGHT,i)).fill("transparent")}drawNodeBase(t,e){const n=this.constants,r=e?.width??n.NODE_BASE_WIDTH,s=e?.height??n.NODE_BASE_HEIGHT,i=n.CORNER_RADIUS,o=this.constants.SHAPES.Dogear,a=o?.Width??0,l=`M${i},0 H${r-i} Q${r},0 ${r},${i} V${s-(o?.Height??0)} L${r-a},${s} H${i} Q0,${s} 0,${s-i} V${i} Q0,0 ${i},0 Z`,h=this.getNodeColors(),c=(0,u.parseColor)(h.primary),d=(0,u.parseColor)(h.secondary);t.bg=t.group.path(l).fill(c).stroke({color:d,width:2}),this.drawDogEar(t,t.group,r,s,h),t.shadow=t.group.path(l).fill("rgba(0,0,0,0.2)").stroke("none").attr({"pointer-events":"none"}).move(Number(t.bg.x())+5,Number(t.bg.y())+5).back()}drawDogEar(t,e,n,r,s){const i=this.constants.SHAPES.Dogear?.PathMain;if(!i)return;const o=e.path(i).fill((0,u.parseColor)(s.secondary)).stroke({color:(0,u.parseColor)(s.tertiary),width:1}),a=n-this.constants.SHAPES.Dogear.Width,l=r-this.constants.SHAPES.Dogear.Height;o.move(a,l),o.front()}drawPreviousNextConnections(t,e,n,r=null){if(t&&e&&t.bg){if(this.constants,this.getNodeColors(),t.bg.bbox(),e.previousConnection){const r=this.drawPrimaryConnector(n,t.bg,"top",(0,u.parseColor)(this._constants.CONNECTOR_COLOR));if(r){const t={from:e.previousConnection,to:this.resolveConnectable(e.previousConnection.getFrom(),e.previousConnection),fromCircle:r,originConn:e.previousConnection,originCircle:r};this.setConnect(t),d.default.addElement(r,"k_connectbubble",{connection:e.previousConnection,node:e}).tagElement(r,[this.constructor.ELEMENT_TAG,`node_${e.id}`]),this._fillOtherNodeConnectorCircle(e.previousConnection,r,1)}}if(e.nextConnection){const r=this.drawPrimaryConnector(n,t.bg,"bottom",(0,u.parseColor)(this._constants.CONNECTOR_COLOR));if(r){const t={from:e.nextConnection,to:this.resolveConnectable(e.nextConnection.getTo(),e.nextConnection),fromCircle:r,originConn:e.nextConnection,originCircle:r};this.setConnect(t),d.default.addElement(r,"k_connectbubble",{connection:e.nextConnection,node:e}).tagElement(r,[this.constructor.ELEMENT_TAG,`node_${e.id}`]),this._fillOtherNodeConnectorCircle(e.nextConnection,r,0)}}}}drawPrimaryConnector(t,e,n,r){const s=this.constants;if(!t||!e)return;const i=e.bbox(),o=s.CONNECTOR_TRI_SIZE,a=s.CONNECTOR_RADIUS,h=i.width/2;let c,d;if(s.CONNECTOR_TRIANGLE){let e=l.roundedTri(o,o,1);"top"===n?c=-o:(c=i.height,e=l.rotatePath(e,180,o/2,o/2)),d=t.path(e).fill((0,u.parseColor)(r)).stroke({color:(0,u.parseColor)("#00000000"),width:0}).transform({translateX:h-o/2,translateY:c})}else{const e=l.circle(a);c="top"===n?0:i.height,d=t.path(e).fill((0,u.parseColor)(r)).stroke({color:(0,u.parseColor)("#00000000"),width:0}).move(h-a,c-a)}return d.attr({class:this.constructor.CONNECTOR_TAG}),d}drawFieldRaw(t,e,n=0){const r=this.constants,s=e.getDisplayValue?.()??"",{width:i,height:o}=this.measureRawField(s),a=t.rect(i,o).fill((0,u.parseColor)(r.FIELD_RAW_COLOR)).stroke({color:(0,u.parseColor)(r.FIELD_RAW_OUTLINE_COLOR),width:r.FIELD_RAW_OUTLINE_STROKE}).radius(20),l=t.text(s).font({family:r.FONT_FAMILY,size:r.FONT_SIZE,anchor:"start"}).fill((0,u.parseColor)(r.FIELD_RAW_TEXT_COLOR));l.node.style.userSelect="none";const h={box:a,txt:l},c=l.bbox(),f=(o-c.height)/2,p=i-2*r.INPUT_BOX_PADDING,m=n+r.INPUT_BOX_PADDING+Math.max(0,(p-c.width)/2);return a.move(n,0),l.move(m,f),d.default.addElement(a,"k_inputbox",{field:e,text:l,renderer:this,startX:n}).tagElement(a,[this.constructor.ELEMENT_TAG,`node_${this.node.id}`]),{rect:a,txt:l,rawBox:h}}drawNode(){if(!this.node)return;const t=this.getNodeColors(),e=this.node,n=this.drawState(this.createNodeGroup(e),e.id);this._nodeDraw=n;const r=this.measureNodeDimensions();r&&(this.drawNodeBase(n,r),this.drawNodeTopbar(n,t,r),this.drawNodeXButton(),this.drawNodeLabel(n.group),this.makeNodeDraggable(n.group,n.topbar,e),this.createFieldGroup(n),this.drawAllFieldsForNode(r),this.drawPreviousNextConnections(n,e,n.group,r))}}e.default=f},4629:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(6545)),i=r(n(4982)),o=r(n(2110)),a=r(n(6596)),l=r(n(1513));e.default=class{_nodeDB;_widgetDB;_commentDB;isHeadless=1;constructor(){this._nodeDB=new Map,this._widgetDB=new Map,this._commentDB=new Set}addNode(t,e){const n=e||t.id;this._nodeDB.has(n)&&console.warn(`Node with id ${n} already exists, overwriting.`),t.workspace!==this&&(t.workspace=this),this._nodeDB.set(n,t)}newNode(t,e=1){if(!s.default[t])return;const n=(0,i.default)(t);return n?(e&&this.addNode(n),n):void 0}spawnAt(t,e,n){const r=this.newNode(t,0);if(r)return r.relativeCoords.set(e,n),this.addNode(r),r}getNode(t){return t instanceof Object&&t.id?t:this._nodeDB.get(t)}removeNodeById(t){const e=this._nodeDB.get(t);e&&(this.derefNode(e),this._nodeDB.delete(t))}removeNode(t){t&&this.removeNodeById(t.id)}derefNode(t){const e=t.previousConnection?.getFrom?.();e?.nextConnection&&e.nextConnection.disconnectTo?.();const n=t.nextConnection?.getTo?.();n?.previousConnection&&n.previousConnection.disconnectFrom?.();for(let e of t.allFields())e.hasConnectable?.()&&e.disconnect()}newWidget(t){const e=a.default[t];if(!e)return;const n=e.cls?new e.cls(this,e):new o.default(this,e);return this._widgetDB.set(n.id,n),n}getWidget(t){return this._widgetDB.get(t)}addComment(){const t=new l.default(this);return this._commentDB.add(t),t}getComment(t){return Array.from(this._commentDB).find(e=>e.id===t)}removeComment(t){let e;return e="string"==typeof t?this.getComment(t):t,e?(this._commentDB.delete(e),1):0}getComments(){return Array.from(this._commentDB)}_addWidgetToDB(t){this._widgetDB.set(t.id,t)}_delWidgetFromDB(t){this._widgetDB.delete(t.id)}fromJson(t,e=0){for(let[,t]of this._nodeDB.entries())this.removeNode(t);if(t.circular)for(let e of t.nodes)e.constructor.deserialize(e,this);else for(let e of t.nodes)e.constructor.fromJson(e,this)}toJson(t){const e=[];for(let[,n]of this._nodeDB)n.topLevel&&e.push(t?n.serialize():n.toJson());return{circular:t,nodes:e}}}},4741:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.Styler=void 0;class n{styles;constructor(){this.styles=new Map}appendStyles(t,e){if(this.styles.has(t))return;const n=document.createElement("style");n.id=t,n.textContent=e,document.head.appendChild(n),this.styles.set(t,n)}removeStyles(t){const e=this.styles.get(t);e&&(e.remove(),this.styles.delete(t))}updateStyles(t,e){const n=this.styles.get(t);n&&(n.textContent=e)}hasStyles(t){return this.styles.has(t)}}e.Styler=n;const r=new n;e.default=r},4803:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.InjectMsg=void 0,e.default=function(t,e={}){if(!l.default.isBrowser)return void new c("Cannot inject workspace-svg in non-browser environment (use Kabel.injectHeadless).").err();o.default.appendStyles("KabelStyles",h);const n="string"==typeof t?document.querySelector(`#${t}`):t;if(!n)return void new c("Document does not contain root element (Check element ID).").err();if(!document.contains(n))return void new c("Document does not contain root element.").err();const r=document.createElement("div");r.className="KabelWorkspaceWrapper",n.appendChild(r);const a=new i.default(n,r,e);return(0,s.setMainWorkspace)(a),a};const s=n(5651),i=r(n(2638)),o=r(n(4741)),a=r(n(8282)),l=r(n(5053)),h=a.default;class c{msg;constructor(t){this.msg=t}err(){console.error(`Failed to inject workspace: ${this.msg}`)}wrn(){console.warn(`Inject warning: ${this.msg}`)}info(){this.msg}}e.InjectMsg=c},4982:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(5242)),i=r(n(6545));e.default=function(t){const e=i.default[t];if(!e)return;const n=new s.default(e);return n.init(),n}},5053:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1});const n={isNode:"undefined"!=typeof process&&!!process.versions?.node,isBrowser:"undefined"!=typeof window&&"undefined"!=typeof document,isWebWorker:"undefined"!=typeof self&&"function"==typeof self.importScripts};e.default=n},5242:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(8670)),i=r(n(50)),o=n(3800),a=r(n(4222)),l=r(n(8175)),h=n(748),c=r(n(5596)),u=r(n(1513)),d=n(8582),f=r(n(6545));class p extends c.default{previousConnection;nextConnection;type;prototype;colors;labelText;_fieldColumn;relativeCoords;id;svg=null;workspace=null;comment;static REMOVING="REMOVING";static INITING="INITING";constructor(t,e,n){super(),this.type=null,this.comment=null,this.prototype=t,this.colors={primary:"#000000",secondary:"#000000",tertiary:"#000000",category:""},this.previousConnection=new s.default(null,this,1),this.nextConnection=new s.default(this,null,0),this.labelText="",this._fieldColumn=new Set,this.relativeCoords=new l.default(0,0),this.id=(0,h.generateUID)("nanoid",{alphabet:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0129384756!)@(#*$&%^"}),e&&(this.workspace=e),n&&(this.svg=new d.RepresenterNode(this,{id:this.id,pendingConnections:[],group:n},e.renderer))}get topLevel(){return!this.previousConnection?.getFrom()}get svgGroup(){return this.svg?.getRaw?.()}getCommentText(){return this.comment?.getText?.()}getComment(){return this.comment}addComment(){this.comment?console.warn("Comment already exists."):this.comment=new u.default(this)}setCommentText(t){this.comment||(this.comment=new u.default(this)),this.comment.setText(t)}removeComment(){this.comment=null,this.workspace?.redrawComments?.()}allFields(){return Array.from(this._fieldColumn)}getFieldByName(t){return this.allFields().find(e=>e.getName()===t)}getField(t){return this.getFieldByName(t)}getFieldValue(t){const e=this.getFieldByName(t);if(e)return e.getValue()}getFieldDisplayValue(t){const e=this.getFieldByName(t);if(e)return e.getDisplayValue()}setFieldValue(t,e){const n=this.getFieldByName(t);return n&&n.setValue(e),n}init(){this.emit(p.INITING,null),this.prototype?(this.prototype.init&&this.prototype.init.call(this,this.prototype,this),this.workspace&&this.workspace.addNode(this),this.prototype.removed&&this.on(p.REMOVING,()=>{this.prototype?.removed.call(this,this.prototype,this)})):console.warn(`Node with id ${this.id} is missing a prototype.`)}hasCategoryStyle(){return!!this.colors?.category&&this.colors?.category?.length>0}getCategoryName(){return this.colors?.category||null}getStyle(){return this.colors}_appendFieldItem(t){t||console.warn("Falsey field passed to _appendFieldItem."),this._fieldColumn.add(t)}jsonInit(t){if(t.primaryColor&&(this.colors.primary=t.primaryColor),t.secondaryColor&&(this.colors.secondary=t.secondaryColor),t.tertiaryColor&&(this.colors.tertiary=t.tertiaryColor),t.category&&a.default[t.category]){const e=a.default[t.category];Object.assign(this.colors,{category:t.category},e)}this.previousConnection=(0,i.default)(t,"previousConnection")?new s.default(null,this,1):null,this.nextConnection=(0,i.default)(t,"nextConnection")?new s.default(this,null,0):null,t.labelText&&(this.labelText=t.labelText),t.arguments&&this.applyJsonArguments(t.arguments),t.type&&(this.type=t.type)}applyJsonArguments(t){for(let e of t){if(!e.type||!e.name){console.warn(`Invalid argument definition at: ${t.indexOf(e)}.`);continue}const n=o.FieldMap[e.type];if(!n){console.warn(`Missing field constructor for ${e.type}!`);continue}const r=new n;r.fromJson(e),r.node=this,this._appendFieldItem(r)}return this}appendConnection(t){const e=new o.FieldMap.connection;return this._appendFieldItem(e),e.setName(t),e.node=this,e}appendNumber(t){const e=new o.FieldMap.field_num;return this._appendFieldItem(e),e.setName(t),e.node=this,e}appendText(t){const e=new o.FieldMap.field_str;return this._appendFieldItem(e),e.setName(t),e.node=this,e}appendOptLink(t){const e=new o.FieldMap.field_both;return this._appendFieldItem(e),e.setName(t),e.node=this,e}setCategoryName(t){return this.colors.category=t,this}setStyle(t){return Object.assign(this.colors,t),this}setColor(t,e,n){return this.setStyle({primary:t,secondary:e,tertiary:n}),this}setLabelText(t){return this.labelText=t,this}setConnection(t){const e=String(t).toLowerCase(),n="0"==e?0:"1"==e||"true"==e?1:"false"==e?0:3;return 0===n?this.previousConnection=new s.default(null,this,1):1===n?this.nextConnection=new s.default(this,null,0):console.warn("Invalid prevOrNext argument for NodeSvg.setConnection"),this}fromNode(t){if(t){this.type=t.type,this.labelText=t.labelText,this.relativeCoords=new l.default(t.relativeCoords.x,t.relativeCoords.y),this.colors={...t.colors},this.previousConnection=t.previousConnection?new s.default(null,this,1):null,this.nextConnection=t.nextConnection?new s.default(this,null,0):null,this._fieldColumn.clear();for(let e of t._fieldColumn){const t=new(0,e.constructor);t.setName(e.getName()),"getValue"in e&&"setValue"in t&&t.setValue(e.getValue()),"getLabel"in e&&"setLabel"in t&&t.setLabel(e.getLabel()),this._appendFieldItem(t)}return this.workspace=t.workspace,this.prototype=t.prototype,this}}_serializeConnection(t,e){const n={};let r=t.isPrevious?t.getFrom():t.getTo();if(!r)return n;if(r instanceof p){if(e[r.id])return{node:e[r.id]};n.node=r.serialize(e)}else{const t=r;let s;t.node&&(s=e[t.node.id]?e[t.node.id]:t.node.serialize(e)),n.field=1,s&&(n.node=s)}return n}serialize(t={}){if(t[this.id])return t[this.id];const e={id:this.id,type:this.type||"",colors:{primary:this.colors.primary,secondary:this.colors.secondary,tertiary:this.colors.tertiary,category:this.colors.category},label:this.labelText,previousConnection:void 0,nextConnection:void 0,relativeCoords:{x:this.relativeCoords.x,y:this.relativeCoords.y},comment:this.comment?.toJson?.(),fields:[]};return t[this.id]=e,e.fields=this.allFields().map(e=>e.toJson?e.toJson(1,t):{name:e.getName(),type:e.constructor.name,value:e.getValue?e.getValue():void 0}),e.previousConnection=this.previousConnection?this._serializeConnection(this.previousConnection,t):void 0,e.nextConnection=this.nextConnection?this._serializeConnection(this.nextConnection,t):void 0,e}toJson(){const t=this.serialize(),e={},n=t=>{if(e[t.id])return;const r={...t,previousConnection:t.previousConnection?{...t.previousConnection}:void 0,nextConnection:t.nextConnection?{...t.nextConnection}:void 0};if(e[t.id]=r,r.previousConnection?.node){const t=r.previousConnection.node;r.previousConnection.node=t.id,n(t)}if(r.nextConnection?.node){const t=r.nextConnection.node;r.nextConnection.node=t.id,n(t)}if(Array.isArray(r.fields))for(let t of r.fields){t.node&&(n(t.node),t.node=t.node.id);for(let e in t)t[e]?.node&&(n(t[e]?.node),t[e].node=t[e].node.id)}};return n(t),e}static _deserialize(t,e={},n){if(e[t.id])return e[t.id];n&&n.getNode(t.id)&&n.removeNodeById(t.id);const r=new p(f.default[t.type],n);if(r.id=t.id,r.init(),r.type=t.type,r.relativeCoords.set(t.relativeCoords.x,t.relativeCoords.y),r.labelText=t.label||"",t.comment&&n&&(r.comment=u.default.fromJson(t.comment),r.comment._parent=r,r.comment._isWorkspaceComment=0),t.colors){if(t.colors.category&&a.default[t.colors.category]){const e=a.default[t.colors.category];Object.assign(r.colors,e,{category:t.colors.category})}const e={};t.colors.primary&&(e.primary=t.colors.primary),t.colors.secondary&&(e.secondary=t.colors.secondary),t.colors.tertiary&&(e.tertiary=t.colors.tertiary),t.colors.category&&(e.category=t.colors.category),r.setStyle(e)}if(e[r.id]=r,Array.isArray(t.fields)){r._fieldColumn=new Set;for(let e of t.fields){const t=o.FieldMap[e.type];if(!t)continue;const s=new t;s.fromJson(e,n),s.node=r,r._appendFieldItem(s)}}return t.previousConnection?.node&&(r.previousConnection=new s.default(null,r,1),r.previousConnection.setFrom(p._deserialize(t.previousConnection.node,e,n))),t.nextConnection?.node?(r.nextConnection=new s.default(r,null,0),r.nextConnection.setTo(p._deserialize(t.nextConnection.node,e,n))):n?.redraw(),r}static deserialize(t,e){return this._deserialize(t,{},e)}static fromJson(t,e){const n={};for(const e in t)n[e]={...t[e]};for(const t in n){const e=n[t];if(e.previousConnection?.node){const t=e.previousConnection.node;e.previousConnection={...e.previousConnection,node:n[t]}}if(e.nextConnection?.node){const t=e.nextConnection.node;e.nextConnection={...e.nextConnection,node:n[t]}}if(Array.isArray(e.fields))for(const t of e.fields){"string"==typeof t.node&&(t.node=n[t.node]);for(const e in t){const r=t[e];r?.node&&"string"==typeof r.node&&(r.node=n[r.node])}}}const r=Object.values(n).find(t=>!t.previousConnection?.node)??null;return this._deserialize(r,{},e)}}e.default=p},5361:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.ContextMenu=void 0;const s=r(n(1513)),i=r(n(5242)),o=r(n(2638)),a=[],l={registerOption(t,e){const n={id:t,click:e.click,label:e.label,onHoverStart:e.onHoverStart||(()=>{}),onHoverEnd:e.onHoverEnd||(()=>{}),showFor:e.showFor||"any"};a.push(n)},unregisterOption(t){const e=a.findIndex(e=>e.id===t);e>=0&&a.splice(e,1)}};e.ContextMenu=l,l.registerOption("k_delete",{showFor:"node",label:"Delete",click:t=>{const e=t;e.workspace&&e.workspace.removeNode(e)}}),l.registerOption("k_deleteall",{showFor:"ws",label:"Delete all",click:t=>{const e=t;if(window.confirm(`Are you sure you want to delete ${Array.from(e._nodeDB.keys()).length} nodes?`))for(let[t,n]of e._nodeDB)e.removeNodeById(t)}}),l.registerOption("k_addcomment",{showFor:["ws","node"],label:"Add Comment",click:t=>{const e=t;if(e instanceof i.default)e.addComment(),e.setCommentText("Comment!");else if(e instanceof o.default){const t=e.addComment(),n=e.screenToWorkspace(e._ctxMenu.widget.coords.x,e._ctxMenu.widget.coords.y);t.relativeCoords.set(n.x,n.y),t.setText("Comment!")}}}),l.registerOption("k_undo",{showFor:["ws","node","comment"],label:"Undo",click:t=>{t instanceof i.default?t.workspace?.history?.undo():t instanceof s.default?t.getWorkspace()?.history?.undo():t instanceof o.default&&t.history.undo()},onDraw(t,e,n){console.log("onDrawCalled"),e.history.canUndo()||t.classList.add("disabled")}}),l.registerOption("k_redo",{showFor:["ws","node","comment"],label:"Redo",click:t=>{t instanceof i.default?t.workspace?.history?.redo():t instanceof s.default?t.getWorkspace()?.history?.redo():t instanceof o.default&&t.history.redo()},onDraw(t,e,n){console.log("onDrawCalled"),e.history.canRedo()||t.classList.add("disabled")}}),l.registerOption("k_deletecomment",{showFor:"comment",label:"Delete Comment",click:t=>{const e=t;e.isNodeComment()&&e._parent instanceof i.default?e._parent.removeComment():e.getWorkspace().removeComment(e)}}),l.registerOption("k_duplicate",{showFor:"node",label:"Duplicate",click:t=>{const e=t;e.workspace&&e.workspace.cloneNode(e)}}),e.default=a},5552:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.addWindowListener=function(t,e){n[t].push(e)},e.removeWindowListener=function(t,e){const r=n[t],s=r.indexOf(e);-1!==s&&r.splice(s,1)},e.clearWindowListeners=function(t){t?n[t].length=0:Object.keys(n).forEach(t=>{n[t].length=0})};const n={resize:[],scroll:[],blur:[],focus:[],visibilitychange:[],pointerlockchange:[],beforeunload:[]};Object.keys(n).forEach(t=>{window.addEventListener(t,e=>function(t,e){const r=n[t];if(r.length)for(const n of r)try{n(e)}catch(e){console.error(`[Kabel] Error in window listener for '${t}':`,e)}}(t,e))}),e.default=n},5596:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=class{listeners={};on(t,e){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e),this}off(t,e){return this.listeners[t]?(this.listeners[t]=this.listeners[t].filter(t=>t!==e),this):this}emit(t,e){return this.listeners[t]?(this.listeners[t].forEach(t=>t(e)),1):0}once(t,e){const n=r=>{e(r),this.off(t,n)};return this.on(t,n),this}}},5631:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(185)),i=r(n(8442));e.default=class{type;workspace;wsOptions;_flyout;_contents;container;_categories=[];constructor(t){this.workspace=t,this.wsOptions=this.getOptions(),this.type="flyout"==this.wsOptions.toolbox?.type?2:1,this._contents=this.wsOptions.toolbox?.contents??[],this._flyout=new s.default(this),this.container=document.createElement("div"),this.container.className="KabelToolbox",this.container.style.position="absolute",this.container.style.left="0",this.container.style.top="0",this.container.style.width="20%",this.container.style.height="100%",this.container.style.background="rgba(240,240,240,0.9)",this.container.style.overflowY="auto",t._wsTop.appendChild(this.container),1===this.type&&this.initCategoryToolbox(),2===this.type&&this.initFlyoutToolbox()}updateStyles(t){if(!t?.UIStyles)return;const{toolboxCategoriesBG:e,toolboxFlyoutBG:n}=t.UIStyles,r=(t,e)=>{if(e)for(const n in e){const r=n,s=e[r];void 0!==s&&(t.style[r]=s)}};1===this.type&&r(this.container,e),this._flyout?.container&&r(this._flyout.container,n)}getOptions(){return this.workspace.options}initCategoryToolbox(){this._contents.forEach(t=>{const e=new i.default(this,t);this._categories.push(e)}),this.workspace.svg.on("click",()=>this._flyout.hide())}initFlyoutToolbox(){this.container.style.display="none";const t=this._contents;this._flyout.fill(t)}}},5651:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.getMainWorkspace=function(){return n},e.setMainWorkspace=function(t){return n=t},e.clearMainWorkspace=function(){return n=null};let n=null},6180:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(5242)),i=r(n(7037)),o=r(n(63)),a={};i.default.registerEvent("k_draggable",function(t,e){function n(n){if(2===e.type&&e.node){const t=e.node.workspace;if(!t)return;const r=t.screenToWorkspace(n.clientX,n.clientY),s=e.node.relativeCoords;h=r.x-s.x,c=r.y-s.y,t.beginDrag(e.node,r.x,r.y),e.group.front()}else{const e=t.bbox();h=n.clientX-e.x,c=n.clientY-e.y}l=0,o.default.setState("dragging"),document.addEventListener("mousemove",r),document.addEventListener("mouseup",i),1===e.type&&e.ondrag&&e.ondrag(n)}function r(n){if(!l){const t=n.movementX||0,e=n.movementY||0;(Math.abs(t)>2||Math.abs(e)>2)&&(l=1)}if(l)if(2===e.type&&e.node&&e.node instanceof s.default){const r=e.node.workspace;if(!r)return;const s=r.screenToWorkspace(n.clientX,n.clientY),i=s.x-h,o=s.y-c;e.node.relativeCoords.set(i,o),r.updateDrag(i,o),r.refresh();const a=r.workspaceToScreen(i,o);t.attr({transform:`translate(${a.x}, ${a.y}) scale(${r.getZoom()})`}),e.node.emit("NODE_DRAG",null)}else if(1===e.type&&e.onmove){const r=n.clientX-h,s=n.clientY-c;t.move(r,s),e.onmove({x:r,y:s})}else if(3===e.type&&e.id){const r=n.clientX-h,s=n.clientY-c;t.move(r,s),a[e.id]={x:r,y:s}}}function i(t){if(document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i),o.default.removeState("dragging"),1===e.type&&e.enddrag&&e.enddrag(t),2===e.type&&e.node&&e.node instanceof s.default){const t=e.node.workspace;if(!t)return;t.emitChange(),t.endDrag()}l=0}let l=0,h=0,c=0;const u=e.dragel??t;if(3===e.type&&e.id&&a[e.id]){const n=a[e.id];n&&t.move(n.x,n.y)}return u.node.addEventListener("mousedown",n),()=>{u.node.removeEventListener("mousedown",n),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i)}})},6218:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=function(t,e){let n=0;requestAnimationFrame(function r(){n++,n>=t?e():requestAnimationFrame(r)})}},6545:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default={}},6551:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.DropdownContainer=void 0;const s=r(n(3800)),i=r(n(5242));class o{static current=null;owner=null;rootEl;options=null;constraint;offset;currentRemoveListener=null;constructor(){this.rootEl=document.createElement("div"),this.rootEl.className="KabelDropdownMenu",this.rootEl.style.position="absolute",this.rootEl.style.display="none",document.body.appendChild(this.rootEl),this.constraint={x:0,y:0,width:0,height:0},this.offset={dx:0,dy:0}}move(t,e){this.offset.dx=t,this.offset.dy=e,this.updatePosition()}updatePosition(){const{x:t,y:e,height:n}=this.constraint,{dx:r,dy:s}=this.offset;this.rootEl.style.left=`${t+r}px`,this.rootEl.style.top=`${e+n+s}px`}setContent(t){this.rootEl.innerHTML=t}appendChild(t){return this.rootEl.appendChild(t),t}show(t,e){if(!t.svgGroup)return;this.hide(),this.owner=t,e&&(this.options=e),this.currentRemoveListener&&this.currentRemoveListener(),this.currentRemoveListener=null;const n=t.svgGroup.node.getBoundingClientRect();if(this.constraint={x:n.left+window.scrollX,y:n.top+window.scrollY,width:n.width,height:n.height},this.offset={dx:0,dy:0},this.rootEl.innerHTML="",e.width&&(this.rootEl.style.width=`${e.width}px`),this.rootEl.style.display="block",e.items&&e.items.forEach(t=>{const n=document.createElement("div");n.className="KabelDropdownItem",n.textContent=t.label,n.onclick=()=>{e.onSelect?.(t.value,t),this.hide()},this.rootEl.appendChild(n)}),t instanceof i.default){const e=t.workspace;let n=e?.addMoveListener(()=>{this.owner===t?this.hideIfOwner(t):n()});this.currentRemoveListener=n}if(t instanceof s.default){const e=t.node.workspace;let n=e?.addMoveListener(()=>{if(this.owner!==t)return console.log("Disconnecting.."),void n();console.log("Hiding.."),this.hide()});this.currentRemoveListener=n}this.updatePosition(),o.current=this}hide(){o.current===this&&(this.rootEl.style.display="none",this.rootEl.innerHTML="",this.owner=null,this.options=null,o.current=null,this.currentRemoveListener&&this.currentRemoveListener(),this.currentRemoveListener=null)}hideIfOwner(t){this.owner===t&&this.hide()}isVisible(){return o.current===this}getOwner(){return this.owner}static getCurrent(){return o.current}}e.DropdownContainer=o;const a=new o;e.default=a},6596:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default={}},6612:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),r(n(7037)).default.registerEvent("k_draghandle",function(t,e){function n(t){t.preventDefault();const e=i.getWorkspace(),n=i.relativeCoords,l=e.screenToWorkspace(t.clientX,t.clientY);o=n.x-l.x,a=n.y-l.y,document.addEventListener("pointermove",r),document.addEventListener("pointerup",s)}function r(t){const e=i.getWorkspace(),n=e.screenToWorkspace(t.clientX,t.clientY);i.relativeCoords.set(n.x+o,n.y+a),e.refreshComments()}function s(){document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",s)}const i=e.comment;if(!i)return()=>{};let o=0,a=0;return t.node.addEventListener("pointerdown",n),()=>{t.node.removeEventListener("pointerdown",n)}})},7037:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.Eventer=void 0;class n{elements=[];eventRegistry=new Map;registerEvent(t,e){return this.eventRegistry.set(t,e),this}tagElement(t,e){if(!e)return this;const n=Array.isArray(e)?e:[e];for(const e of this.elements)if(e.el===t)for(const t of n)e.tags.includes(t)||e.tags.push(t);return this}destroyByTag(t){let e=0;return this.elements=this.elements.filter(n=>n.tags.includes(t)?(n.destroyFn&&(n.destroyFn(),e=1),0):1),e?1:0}addElement(t,e,n){const r=Array.isArray(e)?e:[e];for(const e of r){const r=this.setupElement(t,e,n);this.elements.push({tags:[],el:t,type:e,args:n,destroyFn:r})}return this}refresh(){for(const t of this.elements)t.destroyFn&&t.destroyFn(),t.destroyFn=this.setupElement(t.el,t.type,t.args)}destroyElement(t,e){let n=0;for(const r of this.elements)r.el!==t||e&&r.type!==e||(r.destroyFn&&(r.destroyFn(),n=1),this.elements=this.elements.filter(t=>t!==r));return n?1:0}setupElement(t,e,n){const r=this.eventRegistry.get(e);if(!r)return;const s=r(t,n);return s instanceof Function?s:void 0}}e.Eventer=n;const r=new n;e.default=r},7892:t=>{"use strict";function e(t,e,n,r){var s=t*n+e*r;return s>1&&(s=1),s<-1&&(s=-1),(t*r-e*n<0?-1:1)*Math.acos(s)}function n(t,e){var n=4/3*Math.tan(e/4),r=Math.cos(t),s=Math.sin(t),i=Math.cos(t+e),o=Math.sin(t+e);return[r,s,r-s*n,s+r*n,i+o*n,o-i*n,i,o]}var r=2*Math.PI;t.exports=function(t,s,i,o,a,l,h,c,u){var d=Math.sin(u*r/360),f=Math.cos(u*r/360),p=f*(t-i)/2+d*(s-o)/2,m=-d*(t-i)/2+f*(s-o)/2;if(0===p&&0===m)return[];if(0===h||0===c)return[];h=Math.abs(h),c=Math.abs(c);var g=p*p/(h*h)+m*m/(c*c);g>1&&(h*=Math.sqrt(g),c*=Math.sqrt(g));var _=function(t,n,s,i,o,a,l,h,c,u){var d=u*(t-s)/2+c*(n-i)/2,f=-c*(t-s)/2+u*(n-i)/2,p=l*l,m=h*h,g=d*d,_=f*f,y=p*m-p*_-m*g;y<0&&(y=0),y/=p*_+m*g;var w=(y=Math.sqrt(y)*(o===a?-1:1))*l/h*f,v=y*-h/l*d,b=u*w-c*v+(t+s)/2,x=c*w+u*v+(n+i)/2,C=(d-w)/l,E=(f-v)/h,M=(-d-w)/l,k=(-f-v)/h,O=e(1,0,C,E),N=e(C,E,M,k);return 0===a&&N>0&&(N-=r),1===a&&N<0&&(N+=r),[b,x,O,N]}(t,s,i,o,a,l,h,c,d,f),y=[],w=_[2],v=_[3],b=Math.max(Math.ceil(Math.abs(v)/(r/4)),1);v/=b;for(var x=0;x<b;x++)y.push(n(w,v)),w+=v;return y.map(function(t){for(var e=0;e<t.length;e+=2){var n=t[e+0],r=t[e+1],s=f*(n*=h)-d*(r*=c),i=d*n+f*r;t[e+0]=s+_[0],t[e+1]=i+_[1]}return t})}},8136:(t,e,n)=>{"use strict";t.exports=n(8257)},8156:function(t,e,n){"use strict";var r,s=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:1,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:1,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),o=0;o<n.length;o++)"default"!==n[o]&&s(e,t,n[o]);return i(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1}),e.WASDController=e.WorkspaceController=e.Representer=e.CommentRenderer=e.RepresenterNode=e.DropdownContainer=e.Widget=e.ContextMenuHTML=e.Toolbox=e.CommentModel=e.Eventer=e.WorkspaceCoords=e.WorkspaceSvg=e.NodePrototypes=e.NodeSvg=e.setMainWorkspace=e.getMainWorkspace=e.clearMainWorkspace=e.InjectMsg=e.inject=e.ConnectableField=e.TextField=e.OptConnectField=e.NumberField=e.FieldMap=e.DummyField=e.Field=e.Coordinates=e.Connection=e.CategoryColors=e.Renderer=e.RendererConstants=void 0;const l=a(n(8219));e.RendererConstants=l.default;const h=a(n(1911));e.Renderer=h.default;const c=a(n(4222));e.CategoryColors=c.default;const u=a(n(8670));e.Connection=u.default;const d=a(n(8175));e.Coordinates=d.default;const f=o(n(3800));e.Field=f.default,Object.defineProperty(e,"DummyField",{enumerable:1,get:function(){return f.DummyField}}),Object.defineProperty(e,"FieldMap",{enumerable:1,get:function(){return f.FieldMap}}),Object.defineProperty(e,"NumberField",{enumerable:1,get:function(){return f.NumberField}}),Object.defineProperty(e,"OptConnectField",{enumerable:1,get:function(){return f.OptConnectField}}),Object.defineProperty(e,"TextField",{enumerable:1,get:function(){return f.TextField}}),Object.defineProperty(e,"ConnectableField",{enumerable:1,get:function(){return f.ConnectableField}});const p=o(n(4803));e.inject=p.default,Object.defineProperty(e,"InjectMsg",{enumerable:1,get:function(){return p.InjectMsg}});const m=n(5651);Object.defineProperty(e,"clearMainWorkspace",{enumerable:1,get:function(){return m.clearMainWorkspace}}),Object.defineProperty(e,"getMainWorkspace",{enumerable:1,get:function(){return m.getMainWorkspace}}),Object.defineProperty(e,"setMainWorkspace",{enumerable:1,get:function(){return m.setMainWorkspace}});const g=a(n(5242));e.NodeSvg=g.default;const _=a(n(6545));e.NodePrototypes=_.default;const y=a(n(2638));e.WorkspaceSvg=y.default;const w=a(n(2448));e.WorkspaceCoords=w.default;const v=n(7037);Object.defineProperty(e,"Eventer",{enumerable:1,get:function(){return v.Eventer}});const b=a(n(197)).default;e.default=b;var x=n(1513);Object.defineProperty(e,"CommentModel",{enumerable:1,get:function(){return a(x).default}});var C=n(5631);Object.defineProperty(e,"Toolbox",{enumerable:1,get:function(){return a(C).default}});var E=n(9551);Object.defineProperty(e,"ContextMenuHTML",{enumerable:1,get:function(){return a(E).default}});var M=n(2110);Object.defineProperty(e,"Widget",{enumerable:1,get:function(){return a(M).default}});var k=n(6551);Object.defineProperty(e,"DropdownContainer",{enumerable:1,get:function(){return k.DropdownContainer}});var O=n(8582);Object.defineProperty(e,"RepresenterNode",{enumerable:1,get:function(){return O.RepresenterNode}});var N=n(1538);Object.defineProperty(e,"CommentRenderer",{enumerable:1,get:function(){return a(N).default}});var T=n(9417);Object.defineProperty(e,"Representer",{enumerable:1,get:function(){return a(T).default}});var D=n(4498);Object.defineProperty(e,"WorkspaceController",{enumerable:1,get:function(){return a(D).default}});var A=n(3064);Object.defineProperty(e,"WASDController",{enumerable:1,get:function(){return a(A).default}})},8175:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1});class n{x;y;constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){this.x=t,this.y=e}clone(){return new n(this.x,this.y)}distanceTo(t){const e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}toString(){return`(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}toObject(){return{x:this.x,y:this.y}}}e.default=n},8219:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default=class{CORNER_RADIUS;NODE_BASE_WIDTH;NODE_BASE_HEIGHT;TOPBAR_HEIGHT;FOOTER_HEIGHT;PADDING_BIG;PADDING_MEDIUM;PADDING_SMALL;FIELD_SPACEY;FIELD_SPACEX;FIELD_RAW_BASE_WIDTH;FIELD_RAW_BASE_HEIGHT;INPUT_BOX_PADDING;INPUT_BOX_TEXT_ANCHOR;LABEL_SPACING;FIELD_RAW_COLOR="#2b2d36ff";FIELD_RAW_TEXT_COLOR="#e0e2e8ff";FIELD_RAW_OUTLINE_COLOR="#1f2027ff";FIELD_RAW_OUTLINE_STROKE;FIELD_CONN_COLOR="#0c7cccff";NODE_BG_COLOR="#2c2d3aff";NODE_OUTLINE_COLOR="#1d1e25ff";CONNECTOR_TRIANGLE;CONNECTION_STROKE_WIDTH;CONNECTION_STROKE_COLOR_CHOICE;CONNECTOR_TRI_SIZE;CONNECTOR_RADIUS;FONT_FAMILY='"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';FONT_SIZE;FONT_COLOR="#e0e2e8ff";FIELD_MARGIN_X;FIELD_MARGIN_Y;TOPBAR_LABEL_MARGIN_X;TOPBAR_LABEL_MARGIN_Y;TOPBAR_LABEL_BOLDED;CONNECTOR_LINE_WIDTH=6;CONNECTOR_LINE_CURVED=1;ZOOM_BASE=1;SHAPES={};constructor(t={}){this.CONNECTOR_TRI_SIZE=8,this.CONNECTOR_RADIUS=10,this.CORNER_RADIUS=6,this.NODE_BASE_WIDTH=200,this.NODE_BASE_HEIGHT=240,this.TOPBAR_HEIGHT=50,this.FOOTER_HEIGHT=25,this.PADDING_BIG=16,this.PADDING_MEDIUM=8,this.PADDING_SMALL=4,this.FIELD_RAW_BASE_WIDTH=80,this.FIELD_RAW_BASE_HEIGHT=42,this.INPUT_BOX_PADDING=6,this.LABEL_SPACING=5,this.INPUT_BOX_TEXT_ANCHOR="middle",this.CONNECTOR_TRIANGLE=0,this.CONNECTION_STROKE_WIDTH=2,this.CONNECTION_STROKE_COLOR_CHOICE=1,this.FIELD_RAW_OUTLINE_STROKE=2,this.FIELD_SPACEY=20,this.FIELD_SPACEX=20,this.FONT_SIZE=20,this.TOPBAR_LABEL_BOLDED=1,this.FIELD_MARGIN_X=16,this.FIELD_MARGIN_Y=16,this.TOPBAR_LABEL_MARGIN_X=12,this.TOPBAR_LABEL_MARGIN_Y=0,Object.assign(this,t)}}},8257:(t,e,n)=>{"use strict";function r(t){if(!(this instanceof r))return new r(t);var e=s(t);this.segments=e.segments,this.err=e.err,this.__stack=[]}var s=n(1949),i=n(3044),o=n(4375),a=n(7892),l=n(2446);r.from=function(t){if("string"==typeof t)return new r(t);if(t instanceof r){var e=new r("");return e.err=t.err,e.segments=t.segments.map(function(t){return t.slice()}),e.__stack=t.__stack.map(function(t){return o().matrix(t.toArray())}),e}throw new Error("SvgPath.from: invalid param type "+t)},r.prototype.__matrix=function(t){var e,n=this;t.queue.length&&this.iterate(function(r,s,i,o){var a,h,c,u;switch(r[0]){case"v":h=0===(a=t.calc(0,r[1],1))[0]?["v",a[1]]:["l",a[0],a[1]];break;case"V":h=(a=t.calc(i,r[1],0))[0]===t.calc(i,o,0)[0]?["V",a[1]]:["L",a[0],a[1]];break;case"h":h=0===(a=t.calc(r[1],0,1))[1]?["h",a[0]]:["l",a[0],a[1]];break;case"H":h=(a=t.calc(r[1],o,0))[1]===t.calc(i,o,0)[1]?["H",a[0]]:["L",a[0],a[1]];break;case"a":case"A":var d=t.toArray(),f=l(r[1],r[2],r[3]).transform(d);if(d[0]*d[3]-d[1]*d[2]<0&&(r[5]=r[5]?"0":"1"),a=t.calc(r[6],r[7],"a"===r[0]),"A"===r[0]&&r[6]===i&&r[7]===o||"a"===r[0]&&0===r[6]&&0===r[7]){h=["a"===r[0]?"l":"L",a[0],a[1]];break}h=f.isDegenerate()?["a"===r[0]?"l":"L",a[0],a[1]]:[r[0],f.rx,f.ry,f.ax,r[4],r[5],a[0],a[1]];break;case"m":u=s>0,h=["m",(a=t.calc(r[1],r[2],u))[0],a[1]];break;default:for(h=[c=r[0]],u=c.toLowerCase()===c,e=1;e<r.length;e+=2)a=t.calc(r[e],r[e+1],u),h.push(a[0],a[1])}n.segments[s]=h},1)},r.prototype.__evaluateStack=function(){var t,e;if(this.__stack.length){if(1===this.__stack.length)return this.__matrix(this.__stack[0]),void(this.__stack=[]);for(t=o(),e=this.__stack.length;--e>=0;)t.matrix(this.__stack[e].toArray());this.__matrix(t),this.__stack=[]}},r.prototype.toString=function(){var t="",e="",n=0;this.__evaluateStack();for(var r=0,s=this.segments.length;r<s;r++){var i=this.segments[r],o=i[0];o!==e||"m"===o||"M"===o?("m"===o&&"z"===e&&(t+=" "),t+=o,n=0):n=1;for(var a=1;a<i.length;a++){var l=i[a];1===a?n&&l>=0&&(t+=" "):l>=0&&(t+=" "),t+=l}e=o}return t},r.prototype.translate=function(t,e){return this.__stack.push(o().translate(t,e||0)),this},r.prototype.scale=function(t,e){return this.__stack.push(o().scale(t,e||0===e?e:t)),this},r.prototype.rotate=function(t,e,n){return this.__stack.push(o().rotate(t,e||0,n||0)),this},r.prototype.skewX=function(t){return this.__stack.push(o().skewX(t)),this},r.prototype.skewY=function(t){return this.__stack.push(o().skewY(t)),this},r.prototype.matrix=function(t){return this.__stack.push(o().matrix(t)),this},r.prototype.transform=function(t){return t.trim()?(this.__stack.push(i(t)),this):this},r.prototype.round=function(t){var e,n=0,r=0,s=0,i=0;return t=t||0,this.__evaluateStack(),this.segments.forEach(function(o){var a=o[0].toLowerCase()===o[0];switch(o[0]){case"H":case"h":return a&&(o[1]+=s),s=o[1]-o[1].toFixed(t),void(o[1]=+o[1].toFixed(t));case"V":case"v":return a&&(o[1]+=i),i=o[1]-o[1].toFixed(t),void(o[1]=+o[1].toFixed(t));case"Z":case"z":return s=n,void(i=r);case"M":case"m":return a&&(o[1]+=s,o[2]+=i),s=o[1]-o[1].toFixed(t),i=o[2]-o[2].toFixed(t),n=s,r=i,o[1]=+o[1].toFixed(t),void(o[2]=+o[2].toFixed(t));case"A":case"a":return a&&(o[6]+=s,o[7]+=i),s=o[6]-o[6].toFixed(t),i=o[7]-o[7].toFixed(t),o[1]=+o[1].toFixed(t),o[2]=+o[2].toFixed(t),o[3]=+o[3].toFixed(t+2),o[6]=+o[6].toFixed(t),void(o[7]=+o[7].toFixed(t));default:return e=o.length,a&&(o[e-2]+=s,o[e-1]+=i),s=o[e-2]-o[e-2].toFixed(t),i=o[e-1]-o[e-1].toFixed(t),void o.forEach(function(e,n){n&&(o[n]=+o[n].toFixed(t))})}}),this},r.prototype.iterate=function(t,e){var n,r,s,i=this.segments,o={},a=0,l=0,h=0,c=0,u=0;if(e||this.__evaluateStack(),i.forEach(function(e,n){var r=t(e,n,l,h);Array.isArray(r)&&(o[n]=r,a=1);var s=e[0]===e[0].toLowerCase();switch(e[0]){case"m":case"M":return l=e[1]+(s?l:0),h=e[2]+(s?h:0),c=l,void(u=h);case"h":case"H":return void(l=e[1]+(s?l:0));case"v":case"V":return void(h=e[1]+(s?h:0));case"z":case"Z":return l=c,void(h=u);default:l=e[e.length-2]+(s?l:0),h=e[e.length-1]+(s?h:0)}}),!a)return this;for(s=[],n=0;n<i.length;n++)if(void 0!==o[n])for(r=0;r<o[n].length;r++)s.push(o[n][r]);else s.push(i[n]);return this.segments=s,this},r.prototype.abs=function(){return this.iterate(function(t,e,n,r){var s,i=t[0],o=i.toUpperCase();if(i!==o)switch(t[0]=o,i){case"v":return void(t[1]+=r);case"a":return t[6]+=n,void(t[7]+=r);default:for(s=1;s<t.length;s++)t[s]+=s%2?n:r}},1),this},r.prototype.rel=function(){return this.iterate(function(t,e,n,r){var s,i=t[0],o=i.toLowerCase();if(i!==o&&(0!==e||"M"!==i))switch(t[0]=o,i){case"V":return void(t[1]-=r);case"A":return t[6]-=n,void(t[7]-=r);default:for(s=1;s<t.length;s++)t[s]-=s%2?n:r}},1),this},r.prototype.unarc=function(){return this.iterate(function(t,e,n,r){var s,i,o,l=[],h=t[0];return"A"!==h&&"a"!==h?null:("a"===h?(i=n+t[6],o=r+t[7]):(i=t[6],o=t[7]),0===(s=a(n,r,i,o,t[4],t[5],t[1],t[2],t[3])).length?[["a"===t[0]?"l":"L",t[6],t[7]]]:(s.forEach(function(t){l.push(["C",t[2],t[3],t[4],t[5],t[6],t[7]])}),l))}),this},r.prototype.unshort=function(){var t,e,n,r,s,i=this.segments;return this.iterate(function(o,a,l,h){var c,u=o[0],d=u.toUpperCase();a&&("T"===d?(c="t"===u,"Q"===(n=i[a-1])[0]?(t=n[1]-l,e=n[2]-h):"q"===n[0]?(t=n[1]-n[3],e=n[2]-n[4]):(t=0,e=0),r=-t,s=-e,c||(r+=l,s+=h),i[a]=[c?"q":"Q",r,s,o[1],o[2]]):"S"===d&&(c="s"===u,"C"===(n=i[a-1])[0]?(t=n[3]-l,e=n[4]-h):"c"===n[0]?(t=n[3]-n[5],e=n[4]-n[6]):(t=0,e=0),r=-t,s=-e,c||(r+=l,s+=h),i[a]=[c?"c":"C",r,s,o[1],o[2],o[3],o[4]]))}),this},t.exports=r},8282:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>r});const r="/* Workspace wrapper: horizontal layout */\r\n.KabelWorkspaceWrapper {\r\n display: flex;\r\n flex-direction: row;\r\n width: 100%;\r\n height: 100%;\r\n background: #f0f0f0;\r\n /* light gray background */\r\n overflow: hidden;\r\n position: relative;\r\n}\r\n\r\n/* Toolbox panel (left) */\r\n.KabelToolbox {\r\n width: 12%;\r\n min-width: 150px;\r\n height: 100%;\r\n background: rgba(240, 240, 240, 0.95);\r\n border-right: 1px solid #ccc;\r\n box-sizing: border-box;\r\n display: flex;\r\n flex-direction: column;\r\n padding: 8px;\r\n overflow-y: auto;\r\n}\r\n\r\n/* Context menu container */\r\n.KabelContextMenu {\r\n position: absolute;\r\n background: #1e1e2f;\r\n color: #000000;\r\n border-radius: 6px;\r\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);\r\n padding: 4px 0;\r\n font-family: 'Segoe UI', sans-serif;\r\n font-size: 14px;\r\n min-width: 160px;\r\n z-index: 9999;\r\n user-select: none;\r\n overflow: visible;\r\n height: auto;\r\n transition: opacity 0.15s ease, transform 0.15s ease;\r\n opacity: 0;\r\n transform: scale(0.95);\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n\r\n/* Show state */\r\n.KabelContextMenu.show {\r\n opacity: 1;\r\n transform: scale(1);\r\n}\r\n\r\n/* Individual option */\r\n.KabelContextOption {\r\n padding: 8px 16px;\r\n cursor: pointer;\r\n transition: background 0.15s ease, color 0.15s ease;\r\n}\r\n.KabelContextOption:hover {\r\n background: #b0adb0;\r\n color: #fff;\r\n}\r\n.KabelContextOption.disabled {\r\n\topacity: 0.35;\r\n\tcursor: not-allowed;\r\n\tcolor: #777; /* dim it so it's obviously off */\r\n\tbackground: transparent;\r\n\tpointer-events: none;\r\n}\r\n\r\n/* make sure hover never triggers visually */\r\n.KabelContextOption.disabled:hover {\r\n\tbackground: transparent;\r\n\tcolor: #777;\r\n}\r\n\r\n/* Optional: active click effect */\r\n.KabelContextOption:active {\r\n background: #fff;\r\n color: #000;\r\n}\r\n\r\n/* Scrollbar if too many options */\r\n.KabelContextMenu::-webkit-scrollbar {\r\n width: 6px;\r\n}\r\n\r\n.KabelContextMenu::-webkit-scrollbar-thumb {\r\n background: rgba(255, 255, 255, 0.2);\r\n border-radius: 3px;\r\n}\r\n\r\n/* Category buttons */\r\n\r\n.KabelCategoryRow {\r\n background: #fff;\r\n border: 1px solid #ccc;\r\n padding: 4px 8px;\r\n margin-bottom: 4px;\r\n border-radius: 4px;\r\n height: 5%;\r\n padding: 6px;\r\n cursor: pointer;\r\n text-align: left;\r\n transition: background 0.2s, color 0.2s;\r\n}\r\n\r\n.KabelToolbox button:hover {\r\n background: #e6e6e6;\r\n color: #333;\r\n}\r\n\r\n.KabelConnectionBubbleHighlight {\r\n stroke: yellow !important;\r\n stroke-width: 6px !important;\r\n stroke-linejoin: round;\r\n stroke-linecap: round;\r\n filter: drop-shadow(0 0 6px rgba(255, 255, 0, 0.9));\r\n}\r\n\r\n.KabelConnectionBubbleHighlightWrong {\r\n stroke: rgb(255, 0, 0) !important;\r\n stroke-width: 6px !important;\r\n stroke-linejoin: round;\r\n stroke-linecap: round;\r\n filter: drop-shadow(0 0 6px rgba(255, 0, 0, 0.9));\r\n}\r\n\r\n/* Container */\r\n.KabelDropdownMenu {\r\n position: absolute;\r\n display: none;\r\n background: #1e1e1e;\r\n color: #f0f0f0;\r\n font-family: sans-serif;\r\n font-size: 14px;\r\n border: 1px solid #333;\r\n border-radius: 6px;\r\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);\r\n padding: 4px 0;\r\n z-index: 9999;\r\n user-select: none;\r\n animation: fadeIn 0.15s ease-out;\r\n}\r\n\r\n/* Dropdown items */\r\n.KabelDropdownItem {\r\n padding: 6px 12px;\r\n cursor: pointer;\r\n transition: background 0.15s;\r\n}\r\n\r\n/* Hover + focus states */\r\n.KabelDropdownItem:hover,\r\n.KabelDropdownItem:focus {\r\n background: #2d2d2d;\r\n}\r\n\r\n/* Active (clicked) state */\r\n.KabelDropdownItem:active {\r\n background: #3a3a3a;\r\n}\r\n\r\n/* Optional: highlight selected value */\r\n.KabelDropdownItem.selected {\r\n background: #444;\r\n font-weight: 600;\r\n}\r\n\r\n/* Smooth open effect */\r\n@keyframes fadeIn {\r\n from {\r\n opacity: 0;\r\n transform: translateY(-3px);\r\n }\r\n\r\n to {\r\n opacity: 1;\r\n transform: translateY(0);\r\n }\r\n}\r\n\r\n\r\n\r\n/* Flyout panel (right) */\r\n.KabelFlyout {\r\n width: 20%;\r\n height: 100%;\r\n background: rgba(255, 255, 255, 0.95);\r\n border-left: 1px solid #ccc;\r\n box-sizing: border-box;\r\n overflow-y: auto;\r\n position: relative;\r\n /* for absolute positioning of nodes inside */\r\n display: none;\r\n /* hidden by default */\r\n padding: 8px;\r\n}\r\n\r\n/* Flyout nodes */\r\n.KabelFlyoutNode {\r\n padding: 6px 10px;\r\n margin-bottom: 4px;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n user-select: none;\r\n transition: background 0.2s;\r\n}\r\n\r\n.KabelFlyoutNode:hover {\r\n background: #e0e0e0;\r\n}\r\n\r\n/* SVG workspace area */\r\n.KabelWorkspaceWrapper svg {\r\n flex: 1;\r\n width: 100%;\r\n height: 100%;\r\n background: #fff;\r\n /* white canvas background */\r\n display: block;\r\n}"},8392:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(7037)),i=r(n(63)),o=r(n(6218)),a={one:null,two:null};s.default.registerEvent("k_connectbubble",function(t,e){if(!e.field||e.field?.canEditConnector)return t.on("click",()=>{const n=e.connection.isPrevious;if(!a.one)return n?(t.addClass("KabelConnectionBubbleHighlightWrong"),void(0,o.default)(10,()=>{t.removeClass("KabelConnectionBubbleHighlightWrong")})):(a.one={conn:e.connection,el:t,args:e},t.addClass("KabelConnectionBubbleHighlight"),void i.default.setState("connecting"));if(!a.two&&e?.node!==a.one?.args?.node){if(!n)return t.addClass("KabelConnectionBubbleHighlightWrong"),void(0,o.default)(10,()=>{t.removeClass("KabelConnectionBubbleHighlightWrong")});if(a.one.conn===e.connection)return;a.two={conn:e.connection,el:t,args:e},t.addClass("KabelConnectionBubbleHighlight")}if(a.one&&a.two){if(a.two.args?.node==a.one.args?.node||a.two.args?.node===a.one?.args?.field?.node)return a.one.el.addClass("KabelConnectionBubbleHighlightWrong"),a.two.el.addClass("KabelConnectionBubbleHighlightWrong"),(0,o.default)(10,()=>{a&&a.one&&a.two&&(a.one.el.removeClass("KabelConnectionBubbleHighlightWrong"),a.two.el.removeClass("KabelConnectionBubbleHighlightWrong"),a.one=null,a.two=null)}),void i.default.removeState("connecting");const{conn:t}=a.one,{conn:e}=a.two;t.disconnectTo(),e.disconnectFrom(),t.to=a.two.args?.node,e.from=a.one.args?.node||a.one.args?.field,(0,o.default)(2,()=>{a.one?.args?.node?(a.one.args.node.workspace?.redraw(),a.one.args.node.workspace.emitChange()):a.two?.args?.node&&(a.two.args.node.workspace?.redraw(),a.two.args.node.workspace.emitChange()),a.one=null,a.two=null,i.default.removeState("connecting")})}}),()=>{t.off("click")}})},8442:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1});const r=n(2643);e.default=class{label;color;contents;_rowDiv;_toolbox;constructor(t,e){this.label=e.name,this.color=e.color,this.contents=e.contents,this._toolbox=t,this._makeDiv()}_makeDiv(){const t=document.createElement("button");t.textContent=this.label,t.className="KabelCategoryRow",t.style.backgroundColor=(0,r.parseColor)(this.color),t.style.color=(0,r.parseColor)("#ffffff"),this._rowDiv=t,t.addEventListener("click",t=>{t.stopPropagation(),this._toolbox._flyout.clear(),this._toolbox._flyout.fill(this.contents),this._toolbox._flyout.show()}),this._toolbox.container.appendChild(t)}refresh(t){void 0!==t.name&&(this.label=t.name,this._rowDiv.textContent=this.label),void 0!==t.color&&(this.color=t.color,this._rowDiv.style.backgroundColor=(0,r.parseColor)(this.color)),void 0!==t.contents&&(this.contents=t.contents)}destroy(){this._rowDiv.remove(),this._toolbox=null}hide(){this._rowDiv.style.display="none"}show(){this._rowDiv.style.display=""}setDisabled(t){this._rowDiv.disabled=t}toJSON(){return{name:this.label,color:this.color,contents:this.contents}}}},8582:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.RepresenterNode=void 0;const r=n(2643);e.RepresenterNode=class{node;state;renderer;constructor(t,e,n){this.renderer=n,this.node=t,this.state=e,t.svg=this}getConstant(t){return this.renderer._constants[t]}moveTo(t,e){this.state.group.move(t,e)}setScale(t){this.state.group.scale(t)}applyTransform(t){this.state.group.attr({transform:t})}getRaw(){return this.state.group}highlight(t="#ff0"){t&&0!=t.length&&"string"==typeof t?this.state.bg.stroke({color:t,width:2}):this.highlight((0,r.parseColor)(this.getConstant("NODE_OUTLINE_COLOR")))}}},8670:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(3800)),i=r(n(5242));e.default=class{from;to;isPrevious;constructor(t,e,n=0){this.from=t,this.to=e,this.isPrevious=n}getTo(){return this.to}getFrom(){return this.from}disconnectTo(){if(this.to){if(this.to instanceof i.default&&this.to.previousConnection){const t=this.to.previousConnection.from;t instanceof i.default&&t.nextConnection?.to&&(t.nextConnection.to=null),t instanceof s.default&&t.hasConnectable?.()&&t.disconnect()}this.to=null}}disconnectFrom(){if(this.from){if(this.from instanceof i.default&&this.from.nextConnection){const t=this.from.nextConnection;t.to instanceof i.default&&t.to.previousConnection?.from?t.to.previousConnection.from=null:t.to instanceof s.default&&t.to.hasConnectable()&&t.to.disconnect(),t.to=null}else this.from instanceof s.default&&this.from.hasConnectable()&&this.from.disconnect();this.from=null}}setTo(t){this.to=t}setFrom(t){this.from=t}isolate(){this.from=null,this.to=null}}},9081:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(8219));class i extends s.default{SHAPES={};CONNECTOR_COLOR="#9912e8ff";FIELD_RAW_COLOR="#343745ff";FIELD_RAW_TEXT_COLOR="#cfd4e4ff";FIELD_RAW_OUTLINE_COLOR="#202128ff";constructor(t){super(t),this.CONNECTOR_LINE_WIDTH=2.5,this.CORNER_RADIUS=10,this.FOOTER_HEIGHT=25,this.CONNECTOR_LINE_WIDTH=7,this.init()}init(){this.SHAPES.Dogear={PathMain:"M -1 1 Q -1 21 0 30 L 26 0 Q 2 -1 0 0 Z",Width:26,Height:30}}}e.default=i},9267:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(7037)),i=r(n(63));s.default.registerEvent("k_inputbox",function(t,e){function n(t){return w.measureTextWidth?w.measureTextWidth(t):8*t.length}function r(){return{start:Math.min(m,g),end:Math.max(m,g)}}function s(){return m!==g}function o(){if(!s())return 0;const{start:t,end:e}=r();return p=p.slice(0,t)+p.slice(e),m=t,g=t,1}function a(){_.text(p);const{start:t,end:i}=r(),{width:o}=w.measureRawField(p),{height:a}=y.bbox(),l=_.bbox(),h=(a-l.height)/2;if(s()){const r=p.slice(0,t),s=p.slice(0,i),o=e.startX+4+n(r),a=Math.max(n(s)-n(r),1),c=h;b?b.size(a,l.height):(b=y.parent().rect(a,l.height).fill("#3390ff").attr({"fill-opacity":.35}),b.node.parentNode.insertBefore(b.node,_.node)),b.move(o,c)}else b&&(b.remove(),b=null);if(d){w.getWs().getZoom();const t=e.startX+4+n(p.slice(0,m)),r=l.height;v||(v=y.parent().rect(1,r).fill(w.constants.FIELD_RAW_TEXT_COLOR)),v.size(1,r).move(t,h)}else v&&(v.remove(),v=null);y.size(Math.max(16,o+8),Math.max(a,l.height+8)),_.move(e.startX+4,h)}function l(t){if(e.field.canEdit()){if(d){if("Escape"===t.key)return t.preventDefault(),void u();if("Enter"===t.key)return t.preventDefault(),void u();if("Backspace"===t.key)!o()&&m>0&&(p=p.slice(0,m-1)+p.slice(m),m--,g=m);else if("Delete"===t.key)!o()&&m<p.length&&(p=p.slice(0,m)+p.slice(m+1));else if("ArrowLeft"===t.key)t.shiftKey?m=Math.max(0,m-1):(m=Math.max(0,m-1),g=m);else if("ArrowRight"===t.key)t.shiftKey?m=Math.min(p.length,m+1):(m=Math.min(p.length,m+1),g=m);else if("Home"===t.key)t.shiftKey||(g=0),m=0;else if("End"===t.key)t.shiftKey||(g=p.length),m=p.length;else{if(1!==t.key.length||t.ctrlKey||t.metaKey)return;s()&&o(),p=p.slice(0,m)+t.key+p.slice(m),m++,g=m}t.preventDefault(),a(),e.field.setValue(p)}}else d&&u()}function h(t){if(!d)return;if(f)return void(f=0);const e=t.target;e!==y.node&&e!==_.node&&u()}function c(t){if(e.field.canEdit()){if(!d){if(d=1,p=e.field.getValue?.()??"",m=p.length,g=p.length,i.default.setState("typing"),t){const e=y.node.getBoundingClientRect(),r=w.getWs().getZoom(),s=(t.clientX-e.left-4)/r;let i=0;m=0;for(let t=0;t<p.length;t++){const e=n(p[t]);if(i+e/2>=s)break;i+=e,m=t+1}}g=m,a(),f=1,document.addEventListener("keydown",l),document.addEventListener("mousedown",h)}}else d&&u()}function u(){d=0,i.default.removeState("typing"),document.removeEventListener("keydown",l),document.removeEventListener("mousedown",h),e.field.setValue(p),a(),w.getWs().redraw(),w.getWs().emitChange()}let d=0,f=0,p=e.field.getDisplayValue?.()??"",m=p.length,g=p.length;const _=e.text,y=t,w=e.renderer;let v=null,b=null;return _.style("user-select","none"),y.style("user-select","none"),y.on("mousedown",t=>c(t)),_.on("mousedown",t=>c(t)),a(),()=>{y.off("mousedown",c),_.off("mousedown",c),document.removeEventListener("keydown",l),document.removeEventListener("mousedown",h)}})},9417:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1});const r=n(8582);e.default=class{nodes=new Map;build(t,e,n){if(!t)return;const s=new r.RepresenterNode(t,n,e);return this.nodes.set(t.id,s),s}get(t){return this.nodes.get(t)}remove(t){this.nodes.delete(t)}}},9551:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:1});const s=r(n(2020)),i=r(n(1513)),o=r(n(8175)),a=r(n(5361)),l=r(n(5242)),h=r(n(2110)),c=r(n(2638));e.default=class{workspace;controller;widget;options;constructor(t){this.workspace=t,this.controller=this.workspace.controller,this.widget=new h.default(this.workspace,{coords:new o.default(0,0),name:"k_contextmenu",className:"KabelContextMenu"}),this.widget.show=()=>{this.widget.container.classList.add("show"),this.widget.container.style.display="flex",this.widget.visible=1},this.widget.hide=()=>{this.widget.container.classList.remove("show"),this.widget.container.style.display="none",this.widget.visible=0},this.widget.container.style.removeProperty("height"),this.widget.container.style.removeProperty("width"),this.widget.hide(),this.options=a.default,this.initListeners()}renderOptions(t){this.widget.container.innerHTML="",this.options.filter(e=>{if(!t)return 0;const n=Array.isArray(e.showFor)?e.showFor:[e.showFor];return n.includes("any")||t instanceof l.default&&n.includes("node")||t instanceof c.default&&n.includes("ws")||t instanceof HTMLElement&&!(t instanceof SVGSVGElement)&&n.includes("html")||t instanceof i.default&&n.includes("comment")?1:0}).forEach((e,n)=>{const r=document.createElement("div");r.className="KabelContextOption",r.textContent=e.label||"Option "+n,r.addEventListener("click",()=>{t&&e.click(t),this.hide()}),e.onDraw&&e.onDraw(r,this.workspace,e),e.onHoverStart&&r.addEventListener("mouseenter",()=>e.onHoverStart?.()),e.onHoverEnd&&r.addEventListener("mouseleave",()=>e.onHoverEnd?.()),this.widget.container.appendChild(r)})}initListeners(){this.controller&&this.controller.addMoveListener(()=>{this.widget.visible&&this.hide()}),this.workspace.svg.node.addEventListener("contextmenu",t=>{t.preventDefault();const e=t.clientX,n=t.clientY;this.widget.setCoords(new o.default(e,n)),this.renderOptions(this.target),this.widget.show()}),document.addEventListener("mousedown",t=>{this.widget.container.contains(t.target)||this.hide()})}hide(){this.widget.hide()}get mousePos(){return this.controller.mousePos}get target(){let t=document.elementFromPoint(this.mousePos.x,this.mousePos.y);if(!t)return null;if(t===this.workspace.svg.node)return this.workspace;if(t&&t.classList?.contains?.("WorkspaceBgPattern"))return this.workspace;for(;t&&t!==document.body;){if("g"===t.tagName.toLowerCase()&&t.hasAttribute("data-node-id")){const e=(0,s.default)(t.getAttribute("data-node-id")),n=this.workspace.getNode(e);if(n)return n}if("g"===t.tagName.toLowerCase()&&t.hasAttribute("comment-data")){const e=JSON.parse(t.getAttribute("comment-data"));if(!e.id&&!e.isws)continue;if(e.isws){for(let t of this.workspace._commentDB)if(t.id===e.id)return t}else for(let[t,n]of this.workspace._nodeDB)if(n.comment&&n.comment.id==e.id)return n.comment}t=t.parentElement}return document.elementFromPoint(this.mousePos.x,this.mousePos.y)}}},9674:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),e.default={UIStyles:{workspaceBGColor:"#121412ff",toolboxCategoriesBG:{position:"absolute",left:"0",top:"0",width:"20%",height:"100%",background:"#1b1b1b",color:"#e0e0e0",overflowY:"auto",border:"none",outline:"none"},toolboxFlyoutBG:{display:"block",background:"#1e1e1e",color:"#e0e0e0",overflowY:"auto",padding:"4px",borderRadius:"4px",boxShadow:"0 2px 6px rgba(0,0,0,0.5)",border:"none",outline:"none"}}}},9772:(t,e)=>{function n(t,e){if(Array.isArray(t))for(const r of t)n(r,e);else if("object"!=typeof t)s(Object.getOwnPropertyNames(e)),lt[t]=Object.assign(lt[t]||{},e);else for(const e in t)n(e,t[e])}function r(t){return lt[t]||{}}function s(t){ht.push(...t)}function i(t,e){let n;const r=t.length,s=[];for(n=0;n<r;n++)s.push(e(t[n]));return s}function o(t,e){let n;const r=t.length,s=[];for(n=0;n<r;n++)e(t[n])&&s.push(t[n]);return s}function a(t){return t%360*Math.PI/180}function l(t){return t.replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})}function h(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t,e,n,r){return null!=e&&null!=n||(r=r||t.bbox(),null==e?e=r.width/r.height*n:null==n&&(n=r.height/r.width*e)),{width:e,height:n}}function u(t,e){const n=t.origin;let r=null!=t.ox?t.ox:null!=t.originX?t.originX:"center",s=null!=t.oy?t.oy:null!=t.originY?t.originY:"center";null!=n&&([r,s]=Array.isArray(n)?n:"object"==typeof n?[n.x,n.y]:[n,n]);const i="string"==typeof r,o="string"==typeof s;if(i||o){const{height:t,width:n,x:a,y:l}=e.bbox();i&&(r=r.includes("left")?a:r.includes("right")?a+n:a+n/2),o&&(s=s.includes("top")?l:s.includes("bottom")?l+t:l+t/2)}return[r,s]}function d(t=null,e=null){wt.window=t,wt.document=e}function f(){vt.window=wt.window,vt.document=wt.document}function p(){wt.window=vt.window,wt.document=vt.document}function m(){return wt.window}function g(t,e=pt){return wt.document.createElementNS(e,t)}function _(t,e=0){if(t instanceof bt)return t;if("object"==typeof t)return Et(t);if(null==t)return new xt[Ct];if("string"==typeof t&&"<"!==t.charAt(0))return Et(wt.document.querySelector(t));const n=e?wt.document.createElement("div"):g("svg");return n.innerHTML=t,t=Et(n.firstChild),n.removeChild(n.firstChild),t}function y(t,e){return e&&(e instanceof wt.window.Node||e.ownerDocument&&e instanceof e.ownerDocument.defaultView.Node)?e:g(t)}function w(t){if(!t)return null;if(t.instance instanceof bt)return t.instance;if("#document-fragment"===t.nodeName)return new xt.Fragment(t);let e=h(t.nodeName||"Dom");return"LinearGradient"===e||"RadialGradient"===e?e="Gradient":xt[e]||(e="Dom"),new xt[e](t)}function v(t,e=t.name,n=0){return xt[e]=t,n&&(xt[Ct]=t),s(Object.getOwnPropertyNames(t.prototype)),t}function b(t){return xt[t]}function x(t){return"Svgjs"+h(t)+Mt++}function C(t){for(let e=t.children.length-1;e>=0;e--)C(t.children[e]);return t.id?(t.id=x(t.nodeName),t):t}function E(t,e){let n,r;for(r=(t=Array.isArray(t)?t:[t]).length-1;r>=0;r--)for(n in e)t[r].prototype[n]=e[n]}function M(t){return function(...e){const n=e[e.length-1];return!n||n.constructor!==Object||n instanceof Array?t.apply(this,e):t.apply(this,e.slice(0,-1)).attr(n)}}function k(t){const e=Math.round(t),n=Math.max(0,Math.min(255,e)).toString(16);return 1===n.length?"0"+n:n}function O(t,e){for(let n=e.length;n--;)if(null==t[e[n]])return 0;return 1}function N(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function T(t,e){return Math.abs(e-t)<1e-6}function D(){if(!D.nodes){const t=_().size(2,0);t.node.style.cssText=["opacity: 0","position: absolute","left: -100%","top: -100%","overflow: hidden"].join(";"),t.attr("focusable","false"),t.attr("aria-hidden","true");const e=t.path().node;D.nodes={svg:t,path:e}}if(!D.nodes.svg.node.parentNode){const t=wt.document.body||wt.document.documentElement;D.nodes.svg.addTo(t)}return D.nodes}function A(t){return!(t.width||t.height||t.x||t.y)}function S(t,e,n){let r;try{if(r=e(t.node),A(r)&&(s=t.node)!==wt.document&&!(wt.document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===wt.document}).call(wt.document.documentElement,s))throw new Error("Element not in the dom")}catch(e){r=n(t)}var s;return r}function L(t,e){return new zt(i((e||wt.document).querySelectorAll(t),function(t){return w(t)}))}function R(t){let e=t.getEventHolder();return e===wt.window&&(e=Vt),e.events||(e.events={}),e.events}function I(t){return t.getEventTarget()}function F(t){let e=t.getEventHolder();e===wt.window&&(e=Vt),e.events&&(e.events={})}function P(t,e,n,r,s){const i=n.bind(r||t),o=_(t),a=R(o),l=I(o);e=Array.isArray(e)?e:e.split(Pt),n._svgjsListenerId||(n._svgjsListenerId=++Yt),e.forEach(function(t){const e=t.split(".")[0],r=t.split(".")[1]||"*";a[e]=a[e]||{},a[e][r]=a[e][r]||{},a[e][r][n._svgjsListenerId]=i,l.addEventListener(e,i,s||0)})}function B(t,e,n,r){const s=_(t),i=R(s),o=I(s);("function"!=typeof n||(n=n._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(Pt)).forEach(function(t){const e=t&&t.split(".")[0],a=t&&t.split(".")[1];let l,h;if(n)i[e]&&i[e][a||"*"]&&(o.removeEventListener(e,i[e][a||"*"][n],r||0),delete i[e][a||"*"][n]);else if(e&&a){if(i[e]&&i[e][a]){for(h in i[e][a])B(o,[e,a].join("."),h);delete i[e][a]}}else if(a)for(t in i)for(l in i[t])a===l&&B(o,[t,a].join("."));else if(e){if(i[e]){for(l in i[e])B(o,[e,l].join("."));delete i[e]}}else{for(t in i)B(o,t);F(s)}})}function j(t,e,n,r){const s=I(t);return e instanceof wt.window.Event||(e=new wt.window.CustomEvent(e,{detail:n,cancelable:1,...r})),s.dispatchEvent(e),e}function G(){}function W(t){return this.attr("rx",t)}function H(t){return this.attr("ry",t)}function $(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function z(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function X(t){return this.attr("cx",t)}function Y(t){return this.attr("cy",t)}function V(t){return null==t?2*this.rx():this.rx(new Qt(t).divide(2))}function U(t){return null==t?2*this.ry():this.ry(new Qt(t).divide(2))}function q(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new Qt(t),fy:new Qt(e)}):this.attr({x1:new Qt(t),y1:new Qt(e)})}function K(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new Qt(t),cy:new Qt(e)}):this.attr({x2:new Qt(t),y2:new Qt(e)})}function Z(t,e){return function(n){return null==n?this[t]:(this[t]=n,e&&e.call(this),this)}}function J(){const t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,r=Math.log(e/100+1e-10),s=-r/Math.sqrt(n*n+r*r),i=3.9/(s*t);this.d=2*s*i,this.k=i*i}function Q(t){return t.segment.length&&t.segment.length-1===ke[t.segment[0].toUpperCase()]}function tt(t,e){t.inNumber&&et(t,0);const n=Bt.test(e);if(n)t.segment=[e];else{const e=t.lastCommand,n=e.toLowerCase(),r=e===n;t.segment=["m"===n?r?"l":"L":e]}return t.inSegment=1,t.lastCommand=t.segment[0],n}function et(t,e){if(!t.inNumber)throw new Error("Parser Error");t.number&&t.segment.push(parseFloat(t.number)),t.inNumber=e,t.number="",t.pointSeen=0,t.hasExponent=0,Q(t)&&nt(t)}function nt(t){t.inSegment=0,t.absolute&&(t.segment=function(t){const e=t.segment[0];return Oe[e](t.segment.slice(1),t.p,t.p0)}(t)),t.segments.push(t.segment)}function rt(t){if(!t.segment.length)return 0;const e="A"===t.segment[0].toUpperCase(),n=t.segment.length;return e&&(4===n||5===n)}function st(t){return"E"===t.lastToken.toUpperCase()}function it(t=[]){Pe.push(...[].concat(t))}function ot(){E(Pe,{to(t){return(new Se).type(this.constructor).from(this.toArray()).to(t)},fromArray(t){return this.init(t),this},toConsumable(){return this.toArray()},morph(t,e,n,r,s){return this.fromArray(t.map(function(t,i){return r.step(t,e[i],n,s[i],s)}))}})}function at(){const t=this._transformationRunners.runners.map(Ze).reduce(Ke,new Ht);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}const lt={},ht=[],ct=new Set(["desc","metadata","title"]),ut=t=>ct.has(t.nodeName),dt=(t,e,n={})=>{const r={...e};for(const t in r)r[t].valueOf()===n[t]&&delete r[t];Object.keys(r).length?t.node.setAttribute("data-svgjs",JSON.stringify(r)):(t.node.removeAttribute("data-svgjs"),t.node.removeAttribute("svgjs:data"))};var ft={__proto__:null,capitalize:h,degrees:function(t){return 180*t/Math.PI%360},filter:o,getOrigin:u,isDescriptive:ut,map:i,proportionalSize:c,radians:a,unCamelCase:l,writeDataToDom:dt};const pt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml",gt="http://www.w3.org/2000/xmlns/",_t="http://www.w3.org/1999/xlink";var yt={__proto__:null,html:mt,svg:pt,xlink:_t,xmlns:gt};const wt={window:"undefined"==typeof window?null:window,document:"undefined"==typeof document?null:document},vt={};class bt{}const xt={},Ct="___SYMBOL___ROOT___";let Et=w,Mt=1e3;n("Dom",{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){const t=this.position();return this.parent().add(this.remove(),t+1),this},backward:function(){const t=this.position();return this.parent().add(this.remove(),t?t-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(t){(t=_(t)).remove();const e=this.position();return this.parent().add(t,e),this},after:function(t){(t=_(t)).remove();const e=this.position();return this.parent().add(t,e+1),this},insertBefore:function(t){return(t=_(t)).before(this),this},insertAfter:function(t){return(t=_(t)).after(this),this}});const kt=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,Ot=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Nt=/rgb\((\d+),(\d+),(\d+)\)/,Tt=/(#[a-z_][a-z0-9\-_]*)/i,Dt=/\)\s*,?\s*/,At=/\s/g,St=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,Lt=/^rgb\(/,Rt=/^(\s+)?$/,It=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ft=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,Pt=/[\s,]+/,Bt=/[MLHVCSQTAZ]/i;var jt={__proto__:null,delimiter:Pt,hex:Ot,isBlank:Rt,isHex:St,isImage:Ft,isNumber:It,isPathLetter:Bt,isRgb:Lt,numberAndUnit:kt,reference:Tt,rgb:Nt,transforms:Dt,whitespace:At};n("Dom",{classes:function(){const t=this.attr("class");return null==t?[]:t.trim().split(Pt)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){const e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter(function(e){return e!==t}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),n("Dom",{css:function(t,e){const n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){const e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){for(const e of t){const t=e;n[e]=this.node.style.getPropertyValue(t)}return n}if("string"==typeof t)return this.node.style.getPropertyValue(t);if("object"==typeof t)for(const e in t)this.node.style.setProperty(e,null==t[e]||Rt.test(t[e])?"":t[e])}return 2===arguments.length&&this.node.style.setProperty(t,null==e||Rt.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),n("Dom",{data:function(t,e,n){if(null==t)return this.data(i(o(this.node.attributes,t=>0===t.nodeName.indexOf("data-")),t=>t.nodeName.slice(5)));if(t instanceof Array){const e={};for(const n of t)e[n]=this.data(n);return e}if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(e){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:1==n||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),n("Dom",{remember:function(t,e){if("object"==typeof arguments[0])for(const e in t)this.remember(e,t[e]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(let t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});class Gt{constructor(...t){this.init(...t)}static isColor(t){return t&&(t instanceof Gt||this.isRgb(t)||this.test(t))}static isRgb(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}static random(t="vibrant",e){const{random:n,round:r,sin:s,PI:i}=Math;if("vibrant"===t){const t=24*n()+57,e=38*n()+45,r=360*n();return new Gt(t,e,r,"lch")}if("sine"===t){const t=r(80*s(2*i*(e=null==e?n():e)/.5+.01)+150),o=r(50*s(2*i*e/.5+4.6)+200),a=r(100*s(2*i*e/.5+2.3)+150);return new Gt(t,o,a)}if("pastel"===t){const t=8*n()+86,e=17*n()+9,r=360*n();return new Gt(t,e,r,"lch")}if("dark"===t){const t=10+10*n(),e=50*n()+86,r=360*n();return new Gt(t,e,r,"lch")}if("rgb"===t){const t=255*n(),e=255*n(),r=255*n();return new Gt(t,e,r)}if("lab"===t){const t=100*n(),e=256*n()-128,r=256*n()-128;return new Gt(t,e,r,"lab")}if("grey"===t){const t=255*n();return new Gt(t,t,t)}throw new Error("Unsupported random color mode")}static test(t){return"string"==typeof t&&(St.test(t)||Lt.test(t))}cmyk(){const{_a:t,_b:e,_c:n}=this.rgb(),[r,s,i]=[t,e,n].map(t=>t/255),o=Math.min(1-r,1-s,1-i);return 1===o?new Gt(0,0,0,1,"cmyk"):new Gt((1-r-o)/(1-o),(1-s-o)/(1-o),(1-i-o)/(1-o),o,"cmyk")}hsl(){const{_a:t,_b:e,_c:n}=this.rgb(),[r,s,i]=[t,e,n].map(t=>t/255),o=Math.max(r,s,i),a=Math.min(r,s,i),l=(o+a)/2,h=o===a,c=o-a;return new Gt(360*(h?0:o===r?((s-i)/c+(s<i?6:0))/6:o===s?((i-r)/c+2)/6:o===i?((r-s)/c+4)/6:0),100*(h?0:l>.5?c/(2-o-a):c/(o+a)),100*l,"hsl")}init(t=0,e=0,n=0,r=0,s="rgb"){if(t=t||0,this.space)for(const t in this.space)delete this[this.space[t]];if("number"==typeof t)s="string"==typeof r?r:s,r="string"==typeof r?0:r,Object.assign(this,{_a:t,_b:e,_c:n,_d:r,space:s});else if(t instanceof Array)this.space=e||("string"==typeof t[3]?t[3]:t[4])||"rgb",Object.assign(this,{_a:t[0],_b:t[1],_c:t[2],_d:t[3]||0});else if(t instanceof Object){const n=function(t,e){const n=O(t,"rgb")?{_a:t.r,_b:t.g,_c:t.b,_d:0,space:"rgb"}:O(t,"xyz")?{_a:t.x,_b:t.y,_c:t.z,_d:0,space:"xyz"}:O(t,"hsl")?{_a:t.h,_b:t.s,_c:t.l,_d:0,space:"hsl"}:O(t,"lab")?{_a:t.l,_b:t.a,_c:t.b,_d:0,space:"lab"}:O(t,"lch")?{_a:t.l,_b:t.c,_c:t.h,_d:0,space:"lch"}:O(t,"cmyk")?{_a:t.c,_b:t.m,_c:t.y,_d:t.k,space:"cmyk"}:{_a:0,_b:0,_c:0,space:"rgb"};return n.space=e||n.space,n}(t,e);Object.assign(this,n)}else if("string"==typeof t)if(Lt.test(t)){const e=t.replace(At,""),[n,r,s]=Nt.exec(e).slice(1,4).map(t=>parseInt(t));Object.assign(this,{_a:n,_b:r,_c:s,_d:0,space:"rgb"})}else{if(!St.test(t))throw Error("Unsupported string format, can't construct Color");{const e=t=>parseInt(t,16),[,n,r,s]=Ot.exec(function(t){return 4===t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}(t)).map(e);Object.assign(this,{_a:n,_b:r,_c:s,_d:0,space:"rgb"})}}const{_a:i,_b:o,_c:a,_d:l}=this,h="rgb"===this.space?{r:i,g:o,b:a}:"xyz"===this.space?{x:i,y:o,z:a}:"hsl"===this.space?{h:i,s:o,l:a}:"lab"===this.space?{l:i,a:o,b:a}:"lch"===this.space?{l:i,c:o,h:a}:"cmyk"===this.space?{c:i,m:o,y:a,k:l}:{};Object.assign(this,h)}lab(){const{x:t,y:e,z:n}=this.xyz();return new Gt(116*e-16,500*(t-e),200*(e-n),"lab")}lch(){const{l:t,a:e,b:n}=this.lab(),r=Math.sqrt(e**2+n**2);let s=180*Math.atan2(n,e)/Math.PI;return s<0&&(s*=-1,s=360-s),new Gt(t,r,s,"lch")}rgb(){if("rgb"===this.space)return this;if("lab"===(t=this.space)||"xyz"===t||"lch"===t){let{x:t,y:e,z:n}=this;if("lab"===this.space||"lch"===this.space){let{l:r,a:s,b:i}=this;if("lch"===this.space){const{c:t,h:e}=this,n=Math.PI/180;s=t*Math.cos(n*e),i=t*Math.sin(n*e)}const o=(r+16)/116,a=s/500+o,l=o-i/200,h=16/116,c=.008856,u=7.787;t=.95047*(a**3>c?a**3:(a-h)/u),e=1*(o**3>c?o**3:(o-h)/u),n=1.08883*(l**3>c?l**3:(l-h)/u)}const r=3.2406*t+-1.5372*e+-.4986*n,s=-.9689*t+1.8758*e+.0415*n,i=.0557*t+-.204*e+1.057*n,o=Math.pow,a=.0031308,l=r>a?1.055*o(r,1/2.4)-.055:12.92*r,h=s>a?1.055*o(s,1/2.4)-.055:12.92*s,c=i>a?1.055*o(i,1/2.4)-.055:12.92*i;return new Gt(255*l,255*h,255*c)}if("hsl"===this.space){let{h:t,s:e,l:n}=this;if(t/=360,e/=100,n/=100,0===e)return n*=255,new Gt(n,n,n);const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r,i=255*N(s,r,t+1/3),o=255*N(s,r,t),a=255*N(s,r,t-1/3);return new Gt(i,o,a)}if("cmyk"===this.space){const{c:t,m:e,y:n,k:r}=this,s=255*(1-Math.min(1,t*(1-r)+r)),i=255*(1-Math.min(1,e*(1-r)+r)),o=255*(1-Math.min(1,n*(1-r)+r));return new Gt(s,i,o)}return this;var t}toArray(){const{_a:t,_b:e,_c:n,_d:r,space:s}=this;return[t,e,n,r,s]}toHex(){const[t,e,n]=this._clamped().map(k);return`#${t}${e}${n}`}toRgb(){const[t,e,n]=this._clamped();return`rgb(${t},${e},${n})`}toString(){return this.toHex()}xyz(){const{_a:t,_b:e,_c:n}=this.rgb(),[r,s,i]=[t,e,n].map(t=>t/255),o=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,a=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92,l=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,h=(.4124*o+.3576*a+.1805*l)/.95047,c=(.2126*o+.7152*a+.0722*l)/1,u=(.0193*o+.1192*a+.9505*l)/1.08883,d=h>.008856?Math.pow(h,1/3):7.787*h+16/116,f=c>.008856?Math.pow(c,1/3):7.787*c+16/116,p=u>.008856?Math.pow(u,1/3):7.787*u+16/116;return new Gt(d,f,p,"xyz")}_clamped(){const{_a:t,_b:e,_c:n}=this.rgb(),{max:r,min:s,round:i}=Math;return[t,e,n].map(t=>r(0,s(i(t),255)))}}class Wt{constructor(...t){this.init(...t)}clone(){return new Wt(this)}init(t,e){const n=Array.isArray(t)?{x:t[0],y:t[1]}:"object"==typeof t?{x:t.x,y:t.y}:{x:t,y:e};return this.x=null==n.x?0:n.x,this.y=null==n.y?0:n.y,this}toArray(){return[this.x,this.y]}transform(t){return this.clone().transformO(t)}transformO(t){Ht.isMatrixLike(t)||(t=new Ht(t));const{x:e,y:n}=this;return this.x=t.a*e+t.c*n+t.e,this.y=t.b*e+t.d*n+t.f,this}}class Ht{constructor(...t){this.init(...t)}static formatTransforms(t){const e="both"===t.flip||1==t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,r=t.flip&&(e||"y"===t.flip)?-1:1,s=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,i=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,o=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,a=t.scale&&t.scale.length?t.scale[1]*r:isFinite(t.scale)?t.scale*r:isFinite(t.scaleY)?t.scaleY*r:r,l=t.shear||0,h=t.rotate||t.theta||0,c=new Wt(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),u=c.x,d=c.y,f=new Wt(t.position||t.px||t.positionX||NaN,t.py||t.positionY||NaN),p=f.x,m=f.y,g=new Wt(t.translate||t.tx||t.translateX,t.ty||t.translateY),_=g.x,y=g.y,w=new Wt(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:o,scaleY:a,skewX:s,skewY:i,shear:l,theta:h,rx:w.x,ry:w.y,tx:_,ty:y,ox:u,oy:d,px:p,py:m}}static fromArray(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}static isMatrixLike(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}static matrixMultiply(t,e,n){const r=t.a*e.a+t.c*e.b,s=t.b*e.a+t.d*e.b,i=t.a*e.c+t.c*e.d,o=t.b*e.c+t.d*e.d,a=t.e+t.a*e.e+t.c*e.f,l=t.f+t.b*e.e+t.d*e.f;return n.a=r,n.b=s,n.c=i,n.d=o,n.e=a,n.f=l,n}around(t,e,n){return this.clone().aroundO(t,e,n)}aroundO(t,e,n){const r=t||0,s=e||0;return this.translateO(-r,-s).lmultiplyO(n).translateO(r,s)}clone(){return new Ht(this)}decompose(t=0,e=0){const n=this.a,r=this.b,s=this.c,i=this.d,o=this.e,a=this.f,l=n*i-r*s,h=l>0?1:-1,c=h*Math.sqrt(n*n+r*r),u=Math.atan2(h*r,h*n),d=180/Math.PI*u,f=Math.cos(u),p=Math.sin(u),m=(n*s+r*i)/l,g=s*c/(m*n-r)||i*c/(m*r+n);return{scaleX:c,scaleY:g,shear:m,rotate:d,translateX:o-t+t*f*c+e*(m*f*c-p*g),translateY:a-e+t*p*c+e*(m*p*c+f*g),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return 1;const e=new Ht(t);return T(this.a,e.a)&&T(this.b,e.b)&&T(this.c,e.c)&&T(this.d,e.d)&&T(this.e,e.e)&&T(this.f,e.f)}flip(t,e){return this.clone().flipO(t,e)}flipO(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}init(t){const e=Ht.fromArray([1,0,0,1,0,0]);return t=t instanceof re?t.matrixify():"string"==typeof t?Ht.fromArray(t.split(Pt).map(parseFloat)):Array.isArray(t)?Ht.fromArray(t):"object"==typeof t&&Ht.isMatrixLike(t)?t:"object"==typeof t?(new Ht).transform(t):6===arguments.length?Ht.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}inverse(){return this.clone().inverseO()}inverseO(){const t=this.a,e=this.b,n=this.c,r=this.d,s=this.e,i=this.f,o=t*r-e*n;if(!o)throw new Error("Cannot invert "+this);const a=r/o,l=-e/o,h=-n/o,c=t/o,u=-(a*s+h*i),d=-(l*s+c*i);return this.a=a,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,this}lmultiply(t){return this.clone().lmultiplyO(t)}lmultiplyO(t){const e=t instanceof Ht?t:new Ht(t);return Ht.matrixMultiply(e,this,this)}multiply(t){return this.clone().multiplyO(t)}multiplyO(t){const e=t instanceof Ht?t:new Ht(t);return Ht.matrixMultiply(this,e,this)}rotate(t,e,n){return this.clone().rotateO(t,e,n)}rotateO(t,e=0,n=0){t=a(t);const r=Math.cos(t),s=Math.sin(t),{a:i,b:o,c:l,d:h,e:c,f:u}=this;return this.a=i*r-o*s,this.b=o*r+i*s,this.c=l*r-h*s,this.d=h*r+l*s,this.e=c*r-u*s+n*s-e*r+e,this.f=u*r+c*s-e*s-n*r+n,this}scale(){return this.clone().scaleO(...arguments)}scaleO(t,e=t,n=0,r=0){3===arguments.length&&(r=n,n=e,e=t);const{a:s,b:i,c:o,d:a,e:l,f:h}=this;return this.a=s*t,this.b=i*e,this.c=o*t,this.d=a*e,this.e=l*t-n*t+n,this.f=h*e-r*e+r,this}shear(t,e,n){return this.clone().shearO(t,e,n)}shearO(t,e=0,n=0){const{a:r,b:s,c:i,d:o,e:a,f:l}=this;return this.a=r+s*t,this.c=i+o*t,this.e=a+l*t-n*t,this}skew(){return this.clone().skewO(...arguments)}skewO(t,e=t,n=0,r=0){3===arguments.length&&(r=n,n=e,e=t),t=a(t),e=a(e);const s=Math.tan(t),i=Math.tan(e),{a:o,b:l,c:h,d:c,e:u,f:d}=this;return this.a=o+l*s,this.b=l+o*i,this.c=h+c*s,this.d=c+h*i,this.e=u+d*s-r*s,this.f=d+u*i-n*i,this}skewX(t,e,n){return this.skew(t,0,e,n)}skewY(t,e,n){return this.skew(0,t,e,n)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}transform(t){if(Ht.isMatrixLike(t))return new Ht(t).multiplyO(this);const e=Ht.formatTransforms(t),{x:n,y:r}=new Wt(e.ox,e.oy).transform(this),s=(new Ht).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-n,-r).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(n,r);if(isFinite(e.px)||isFinite(e.py)){const t=new Wt(n,r).transform(s),i=isFinite(e.px)?e.px-t.x:0,o=isFinite(e.py)?e.py-t.y:0;s.translateO(i,o)}return s.translateO(e.tx,e.ty),s}translate(t,e){return this.clone().translateO(t,e)}translateO(t,e){return this.e+=t||0,this.f+=e||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}v(Ht,"Matrix");class $t{constructor(...t){this.init(...t)}addOffset(){return this.x+=wt.window.pageXOffset,this.y+=wt.window.pageYOffset,new $t(this)}init(t){return t="string"==typeof t?t.split(Pt).map(parseFloat):Array.isArray(t)?t:"object"==typeof t?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0]||0,this.y=t[1]||0,this.width=this.w=t[2]||0,this.height=this.h=t[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return A(this)}merge(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x+this.width,t.x+t.width)-e,s=Math.max(this.y+this.height,t.y+t.height)-n;return new $t(e,n,r,s)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+" "+this.y+" "+this.width+" "+this.height}transform(t){t instanceof Ht||(t=new Ht(t));let e=1/0,n=-1/0,r=1/0,s=-1/0;return[new Wt(this.x,this.y),new Wt(this.x2,this.y),new Wt(this.x,this.y2),new Wt(this.x2,this.y2)].forEach(function(i){i=i.transform(t),e=Math.min(e,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),s=Math.max(s,i.y)}),new $t(e,r,n-e,s-r)}}n({viewbox:{viewbox(t,e,n,r){return null==t?new $t(this.attr("viewBox")):this.attr("viewBox",new $t(t,e,n,r))},zoom(t,e){let{width:n,height:r}=this.attr(["width","height"]);if((n||r)&&"string"!=typeof n&&"string"!=typeof r||(n=this.node.clientWidth,r=this.node.clientHeight),!n||!r)throw new Error("Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element");const s=this.viewbox(),i=n/s.width,o=r/s.height,a=Math.min(i,o);if(null==t)return a;let l=a/t;l===1/0&&(l=Number.MAX_SAFE_INTEGER/100),e=e||new Wt(n/2/i+s.x,r/2/o+s.y);const h=new $t(s).transform(new Ht({scale:l,origin:e}));return this.viewbox(h)}}}),v($t,"Box");class zt extends Array{constructor(t=[],...e){if(super(t,...e),"number"==typeof t)return this;this.length=0,this.push(...t)}}E([zt],{each(t,...e){return"function"==typeof t?this.map((e,n,r)=>t.call(e,e,n,r)):this.map(n=>n[t](...e))},toArray(){return Array.prototype.concat.apply([],this)}});const Xt=["toArray","constructor","each"];zt.extend=function(t){t=t.reduce((t,e)=>(Xt.includes(e)||"_"===e[0]||(e in Array.prototype&&(t["$"+e]=Array.prototype[e]),t[e]=function(...t){return this.each(e,...t)}),t),{}),E([zt],t)};let Yt=0;const Vt={};class Ut extends bt{addEventListener(){}dispatch(t,e,n){return j(this,t,e,n)}dispatchEvent(t){const e=this.getEventHolder().events;if(!e)return 1;const n=e[t.type];for(const e in n)for(const r in n[e])n[e][r](t);return!t.defaultPrevented}fire(t,e,n){return this.dispatch(t,e,n),this}getEventHolder(){return this}getEventTarget(){return this}off(t,e,n){return B(this,t,e,n),this}on(t,e,n,r){return P(this,t,e,n,r),this}removeEventListener(){}}v(Ut,"EventTarget");const qt={duration:400,ease:">",delay:0},Kt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"};var Zt={__proto__:null,attrs:Kt,noop:G,timeline:qt};class Jt extends Array{constructor(...t){super(...t),this.init(...t)}clone(){return new this.constructor(this)}init(t){return"number"==typeof t||(this.length=0,this.push(...this.parse(t))),this}parse(t=[]){return t instanceof Array?t:t.trim().split(Pt).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(" ")}valueOf(){const t=[];return t.push(...this),t}}class Qt{constructor(...t){this.init(...t)}convert(t){return new Qt(this.value,t)}divide(t){return t=new Qt(t),new Qt(this/t,this.unit||t.unit)}init(t,e){return e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(kt))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof Qt&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new Qt(t),new Qt(this-t,this.unit||t.unit)}plus(t){return t=new Qt(t),new Qt(this+t,this.unit||t.unit)}times(t){return t=new Qt(t),new Qt(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}}const te=new Set(["fill","stroke","color","bgcolor","stop-color","flood-color","lighting-color"]),ee=[];class ne extends Ut{constructor(t,e){super(),this.node=t,this.type=t.nodeName,e&&t!==e&&this.attr(e)}add(t,e){return(t=_(t)).removeNamespace&&this.node instanceof wt.window.SVGElement&&t.removeNamespace(),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this}addTo(t,e){return _(t).put(this,e)}children(){return new zt(i(this.node.children,function(t){return w(t)}))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(t=1,e=1){this.writeDataToDom();let n=this.node.cloneNode(t);return e&&(n=C(n)),new this.constructor(n)}each(t,e){const n=this.children();let r,s;for(r=0,s=n.length;r<s;r++)t.apply(n[r],[r,n]),e&&n[r].each(t,e);return this}element(t,e){return this.put(new ne(g(t),e))}first(){return w(this.node.firstChild)}get(t){return w(this.node.childNodes[t])}getEventHolder(){return this.node}getEventTarget(){return this.node}has(t){return this.index(t)>=0}html(t,e){return this.xml(t,e,mt)}id(t){return void 0!==t||this.node.id||(this.node.id=x(this.type)),this.attr("id",t)}index(t){return[].slice.call(this.node.childNodes).indexOf(t.node)}last(){return w(this.node.lastChild)}matches(t){const e=this.node,n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null;return n&&n.call(e,t)}parent(t){let e=this;if(!e.node.parentNode)return null;if(e=w(e.node.parentNode),!t)return e;do{if("string"==typeof t?e.matches(t):e instanceof t)return e}while(e=w(e.node.parentNode));return e}put(t,e){return t=_(t),this.add(t,e),t}putIn(t,e){return _(t).add(this,e)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(t){return this.node.removeChild(t.node),this}replace(t){return t=_(t),this.node.parentNode&&this.node.parentNode.replaceChild(t.node,this.node),t}round(t=2,e=null){const n=10**t,r=this.attr(e);for(const t in r)"number"==typeof r[t]&&(r[t]=Math.round(r[t]*n)/n);return this.attr(r),this}svg(t,e){return this.xml(t,e,pt)}toString(){return this.id()}words(t){return this.node.textContent=t,this}wrap(t){const e=this.parent();if(!e)return this.addTo(t);const n=e.index(this);return e.put(t,n).put(this)}writeDataToDom(){return this.each(function(){this.writeDataToDom()}),this}xml(t,e,n){if("boolean"==typeof t&&(n=e,e=t,t=null),null==t||"function"==typeof t){e=null==e?1:e,this.writeDataToDom();let n=this;if(null!=t){if(n=w(n.node.cloneNode(1)),e){const e=t(n);if(n=e||n,0==e)return""}n.each(function(){const e=t(this),n=e||this;0==e?this.remove():e&&this!==n&&this.replace(n)},1)}return e?n.node.outerHTML:n.node.innerHTML}e=null==e?0:e;const r=g("wrapper",n),s=wt.document.createDocumentFragment();r.innerHTML=t;for(let t=r.children.length;t--;)s.appendChild(r.firstElementChild);const i=this.parent();return e?this.replace(s)&&i:this.add(s)}}E(ne,{attr:function(t,e,n){if(null==t){t={},e=this.node.attributes;for(const n of e)t[n.nodeName]=It.test(n.nodeValue)?parseFloat(n.nodeValue):n.nodeValue;return t}if(t instanceof Array)return t.reduce((t,e)=>(t[e]=this.attr(e),t),{});if("object"==typeof t&&t.constructor===Object)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Kt[t]:It.test(e)?parseFloat(e):e;"number"==typeof(e=ee.reduce((e,n)=>n(t,e,this),e))?e=new Qt(e):te.has(t)&&Gt.isColor(e)?e=new Gt(e):e.constructor===Array&&(e=new Jt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this},find:function(t){return L(t,this.node)},findOne:function(t){return w(this.node.querySelector(t))}}),v(ne,"Dom");class re extends ne{constructor(t,e){super(t,e),this.dom={},this.node.instance=this,(t.hasAttribute("data-svgjs")||t.hasAttribute("svgjs:data"))&&this.setData(JSON.parse(t.getAttribute("data-svgjs"))??JSON.parse(t.getAttribute("svgjs:data"))??{})}center(t,e){return this.cx(t).cy(e)}cx(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)}cy(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)}defs(){const t=this.root();return t&&t.defs()}dmove(t,e){return this.dx(t).dy(e)}dx(t=0){return this.x(new Qt(t).plus(this.x()))}dy(t=0){return this.y(new Qt(t).plus(this.y()))}getEventHolder(){return this}height(t){return this.attr("height",t)}move(t,e){return this.x(t).y(e)}parents(t=this.root()){const e="string"==typeof t;e||(t=_(t));const n=new zt;let r=this;for(;(r=r.parent())&&r.node!==wt.document&&"#document-fragment"!==r.nodeName&&(n.push(r),e||r.node!==t.node)&&(!e||!r.matches(t));)if(r.node===this.root().node)return null;return n}reference(t){if(!(t=this.attr(t)))return null;const e=(t+"").match(Tt);return e?_(e[1]):null}root(){const t=this.parent(b(Ct));return t&&t.root()}setData(t){return this.dom=t,this}size(t,e){const n=c(this,t,e);return this.width(new Qt(n.width)).height(new Qt(n.height))}width(t){return this.attr("width",t)}writeDataToDom(){return dt(this,this.dom),super.writeDataToDom()}x(t){return this.attr("x",t)}y(t){return this.attr("y",t)}}E(re,{bbox:function(){const t=S(this,t=>t.getBBox(),t=>{try{const e=t.clone().addTo(D().svg).show(),n=e.node.getBBox();return e.remove(),n}catch(e){throw new Error(`Getting bbox of element "${t.node.nodeName}" is not possible: ${e.toString()}`)}});return new $t(t)},rbox:function(t){const e=S(this,t=>t.getBoundingClientRect(),t=>{throw new Error(`Getting rbox of element "${t.node.nodeName}" is not possible`)}),n=new $t(e);return t?n.transform(t.screenCTM().inverseO()):n.addOffset()},inside:function(t,e){const n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},point:function(t,e){return new Wt(t,e).transformO(this.screenCTM().inverseO())},ctm:function(){return new Ht(this.node.getCTM())},screenCTM:function(){try{if("function"==typeof this.isRoot&&!this.isRoot()){const t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new Ht(e)}return new Ht(this.node.getScreenCTM())}catch(t){return console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`),new Ht}}}),v(re,"Element");const se={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"===e?t:t+"-"+e}};["fill","stroke"].forEach(function(t){const e={};let r;e[t]=function(e){if(void 0===e)return this.attr(t);if("string"==typeof e||e instanceof Gt||Gt.isRgb(e)||e instanceof re)this.attr(t,e);else for(r=se[t].length-1;r>=0;r--)null!=e[se[t][r]]&&this.attr(se.prefix(t,se[t][r]),e[se[t][r]]);return this},n(["Element","Runner"],e)}),n(["Element","Runner"],{matrix:function(t,e,n,r,s,i){return null==t?new Ht(this):this.attr("transform",new Ht(t,e,n,r,s,i))},rotate:function(t,e,n){return this.transform({rotate:t,ox:e,oy:n},1)},skew:function(t,e,n,r){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:n},1):this.transform({skew:[t,e],ox:n,oy:r},1)},shear:function(t,e,n){return this.transform({shear:t,ox:e,oy:n},1)},scale:function(t,e,n,r){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:n},1):this.transform({scale:[t,e],ox:n,oy:r},1)},translate:function(t,e){return this.transform({translate:[t,e]},1)},relative:function(t,e){return this.transform({relative:[t,e]},1)},flip:function(t="both",e="center"){return-1==="xybothtrue".indexOf(t)&&(e=t,t="both"),this.transform({flip:t,origin:e},1)},opacity:function(t){return this.attr("opacity",t)}}),n("radius",{radius:function(t,e=t){return"radialGradient"===(this._element||this).type?this.attr("r",new Qt(t)):this.rx(t).ry(e)}}),n("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new Wt(this.node.getPointAtLength(t))}}),n(["Element","Runner"],{font:function(t,e){if("object"==typeof t){for(e in t)this.font(e,t[e]);return this}return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}}),n("Element",["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel","contextmenu","wheel","pointerdown","pointermove","pointerup","pointerleave","pointercancel"].reduce(function(t,e){return t[e]=function(t){return null===t?this.off(e):this.on(e,t),this},t},{})),n("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(Dt).slice(0,-1).map(function(t){const e=t.trim().split("(");return[e[0],e[1].split(Pt).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(Ht.fromArray(e[1])):t[e[0]].apply(t,e[1])},new Ht)},toParent:function(t,e){if(this===t)return this;if(ut(this.node))return this.addTo(t,e);const n=this.screenCTM(),r=t.screenCTM().inverse();return this.addTo(t,e).untransform().transform(r.multiply(n)),this},toRoot:function(t){return this.toParent(this.root(),t)},transform:function(t,e){if(null==t||"string"==typeof t){const e=new Ht(this).decompose();return null==t?e:e[t]}Ht.isMatrixLike(t)||(t={...t,origin:u(t,this)});const n=new Ht(1==e?this:e||0).transform(t);return this.attr("transform",n)}});class ie extends re{flatten(){return this.each(function(){if(this instanceof ie)return this.flatten().ungroup()}),this}ungroup(t=this.parent(),e=t.index(this)){return e=-1===e?t.children().length:e,this.each(function(n,r){return r[r.length-n-1].toParent(t,e)}),this.remove()}}v(ie,"Container");class oe extends ie{constructor(t,e=t){super(y("defs",t),e)}flatten(){return this}ungroup(){return this}}v(oe,"Defs");class ae extends re{}v(ae,"Shape");var le={__proto__:null,cx:X,cy:Y,height:U,rx:W,ry:H,width:V,x:$,y:z};class he extends ae{constructor(t,e=t){super(y("ellipse",t),e)}size(t,e){const n=c(this,t,e);return this.rx(new Qt(n.width).divide(2)).ry(new Qt(n.height).divide(2))}}E(he,le),n("Container",{ellipse:M(function(t=0,e=t){return this.put(new he).size(t,e).move(0,0)})}),v(he,"Ellipse");class ce extends ne{constructor(t=wt.document.createDocumentFragment()){super(t)}xml(t,e,n){if("boolean"==typeof t&&(n=e,e=t,t=null),null==t||"function"==typeof t){const t=new ne(g("wrapper",n));return t.add(this.node.cloneNode(1)),t.xml(0,n)}return super.xml(t,0,n)}}v(ce,"Fragment");var ue,de={__proto__:null,from:q,to:K};class fe extends ie{constructor(t,e){super(y(t+"Gradient","string"==typeof t?null:t),e)}attr(t,e,n){return"transform"===t&&(t="gradientTransform"),super.attr(t,e,n)}bbox(){return new $t}targets(){return L("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}E(fe,de),n({Container:{gradient(...t){return this.defs().gradient(...t)}},Defs:{gradient:M(function(t,e){return this.put(new fe(t)).update(e)})}}),v(fe,"Gradient");class pe extends ie{constructor(t,e=t){super(y("pattern",t),e)}attr(t,e,n){return"transform"===t&&(t="patternTransform"),super.attr(t,e,n)}bbox(){return new $t}targets(){return L("svg [fill*="+this.id()+"]")}toString(){return this.url()}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}url(){return"url(#"+this.id()+")"}}n({Container:{pattern(...t){return this.defs().pattern(...t)}},Defs:{pattern:M(function(t,e,n){return this.put(new pe).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})})}}),v(pe,"Pattern");class me extends ae{constructor(t,e=t){super(y("image",t),e)}load(t,e){if(!t)return this;const n=new wt.window.Image;return P(n,"load",function(t){const r=this.parent(pe);0===this.width()&&0===this.height()&&this.size(n.width,n.height),r instanceof pe&&0===r.width()&&0===r.height()&&r.size(this.width(),this.height()),"function"==typeof e&&e.call(this,t)},this),P(n,"load error",function(){B(n)}),this.attr("href",n.src=t,_t)}}ue=function(t,e,n){return"fill"!==t&&"stroke"!==t||Ft.test(e)&&(e=n.root().defs().image(e)),e instanceof me&&(e=n.root().defs().pattern(0,0,t=>{t.add(e)})),e},ee.push(ue),n({Container:{image:M(function(t,e){return this.put(new me).size(0,0).load(t,e)})}}),v(me,"Image");class ge extends Jt{bbox(){let t=-1/0,e=-1/0,n=1/0,r=1/0;return this.forEach(function(s){t=Math.max(s[0],t),e=Math.max(s[1],e),n=Math.min(s[0],n),r=Math.min(s[1],r)}),new $t(n,r,t-n,e-r)}move(t,e){const n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(let n=this.length-1;n>=0;n--)this[n]=[this[n][0]+t,this[n][1]+e];return this}parse(t=[0,0]){const e=[];(t=t instanceof Array?Array.prototype.concat.apply([],t):t.trim().split(Pt).map(parseFloat)).length%2!=0&&t.pop();for(let n=0,r=t.length;n<r;n+=2)e.push([t[n],t[n+1]]);return e}size(t,e){let n;const r=this.bbox();for(n=this.length-1;n>=0;n--)r.width&&(this[n][0]=(this[n][0]-r.x)*t/r.width+r.x),r.height&&(this[n][1]=(this[n][1]-r.y)*e/r.height+r.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){const t=[];for(let e=0,n=this.length;e<n;e++)t.push(this[e].join(","));return t.join(" ")}transform(t){return this.clone().transformO(t)}transformO(t){Ht.isMatrixLike(t)||(t=new Ht(t));for(let e=this.length;e--;){const[n,r]=this[e];this[e][0]=t.a*n+t.c*r+t.e,this[e][1]=t.b*n+t.d*r+t.f}return this}}var _e={__proto__:null,MorphArray:ge,height:function(t){const e=this.bbox();return null==t?e.height:this.size(e.width,t)},width:function(t){const e=this.bbox();return null==t?e.width:this.size(t,e.height)},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}};class ye extends ae{constructor(t,e=t){super(y("line",t),e)}array(){return new ge([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}move(t,e){return this.attr(this.array().move(t,e).toLine())}plot(t,e,n,r){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:r}:new ge(t).toLine(),this.attr(t))}size(t,e){const n=c(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}}E(ye,_e),n({Container:{line:M(function(...t){return ye.prototype.plot.apply(this.put(new ye),null!=t[0]?t:[0,0,0,0])})}}),v(ye,"Line");class we extends ie{constructor(t,e=t){super(y("marker",t),e)}height(t){return this.attr("markerHeight",t)}orient(t){return this.attr("orient",t)}ref(t,e){return this.attr("refX",t).attr("refY",e)}toString(){return"url(#"+this.id()+")"}update(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}width(t){return this.attr("markerWidth",t)}}n({Container:{marker(...t){return this.defs().marker(...t)}},Defs:{marker:M(function(t,e,n){return this.put(new we).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)})},marker:{marker(t,e,n,r){let s=["marker"];return"all"!==t&&s.push(t),s=s.join("-"),t=arguments[1]instanceof we?arguments[1]:this.defs().marker(e,n,r),this.attr(s,t)}}}),v(we,"Marker");const ve={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,n,r){return function(s){return s<0?t>0?e/t*s:n>0?r/n*s:0:s>1?n<1?(1-r)/(1-n)*s+(r-n)/(1-n):t<1?(1-e)/(1-t)*s+(e-t)/(1-t):1:3*s*(1-s)**2*e+3*s**2*(1-s)*r+s**3}},steps:function(t,e="end"){e=e.split("-").reverse()[0];let n=t;return"none"===e?--n:"both"===e&&++n,(r,s=0)=>{let i=Math.floor(r*t);const o=r*i%1==0;return"start"!==e&&"both"!==e||++i,s&&o&&--i,r>=0&&i<0&&(i=0),r<=1&&i>n&&(i=n),i/n}}};class be{done(){return 0}}class xe extends be{constructor(t=qt.ease){super(),this.ease=ve[t]||t}step(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}class Ce extends be{constructor(t){super(),this.stepper=t}done(t){return t.done}step(t,e,n,r){return this.stepper(t,e,n,r)}}class Ee extends Ce{constructor(t=500,e=0){super(),this.duration(t).overshoot(e)}step(t,e,n,r){if("string"==typeof t)return t;if(r.done=n===1/0,n===1/0)return e;if(0===n)return t;n>100&&(n=16),n/=1e3;const s=r.velocity||0,i=-this.d*s-this.k*(t-e),o=t+s*n+i*n*n/2;return r.velocity=s+i*n,r.done=Math.abs(e-o)+Math.abs(s)<.002,r.done?e:o}}E(Ee,{duration:Z("_duration",J),overshoot:Z("_overshoot",J)});class Me extends Ce{constructor(t=.1,e=.01,n=0,r=1e3){super(),this.p(t).i(e).d(n).windup(r)}step(t,e,n,r){if("string"==typeof t)return t;if(r.done=n===1/0,n===1/0)return e;if(0===n)return t;const s=e-t;let i=(r.integral||0)+s*n;const o=(s-(r.error||0))/n,a=this._windup;return 0!=a&&(i=Math.max(-a,Math.min(i,a))),r.error=s,r.integral=i,r.done=Math.abs(s)<.001,r.done?e:t+(this.P*s+this.I*i+this.D*o)}}E(Me,{windup:Z("_windup"),p:Z("P"),i:Z("I"),d:Z("D")});const ke={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Oe={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},Ne="mlhvqtcsaz".split("");for(let t=0,e=Ne.length;t<e;++t)Oe[Ne[t]]=function(t){return function(e,n,r){if("H"===t)e[0]=e[0]+n.x;else if("V"===t)e[0]=e[0]+n.y;else if("A"===t)e[5]=e[5]+n.x,e[6]=e[6]+n.y;else for(let t=0,r=e.length;t<r;++t)e[t]=e[t]+(t%2?n.y:n.x);return Oe[t](e,n,r)}}(Ne[t].toUpperCase());const Te=new Set([" ",",","\t","\n","\r","\f"]);class De extends Jt{bbox(){return D().path.setAttribute("d",this.toString()),new $t(D.nodes.path.getBBox())}move(t,e){const n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(let n,r=this.length-1;r>=0;r--)n=this[r][0],"M"===n||"L"===n||"T"===n?(this[r][1]+=t,this[r][2]+=e):"H"===n?this[r][1]+=t:"V"===n?this[r][1]+=e:"C"===n||"S"===n||"Q"===n?(this[r][1]+=t,this[r][2]+=e,this[r][3]+=t,this[r][4]+=e,"C"===n&&(this[r][5]+=t,this[r][6]+=e)):"A"===n&&(this[r][6]+=t,this[r][7]+=e);return this}parse(t="M0 0"){return Array.isArray(t)&&(t=Array.prototype.concat.apply([],t).toString()),function(t,e=1){let n=0,r="";const s={segment:[],inNumber:0,number:"",lastToken:"",inSegment:0,segments:[],pointSeen:0,hasExponent:0,absolute:e,p0:new Wt,p:new Wt};for(;s.lastToken=r,r=t.charAt(n++);)if(s.inSegment||!tt(s,r))if("."!==r)if(isNaN(parseInt(r)))if(Te.has(r))s.inNumber&&et(s,0);else if("-"!==r&&"+"!==r)if("E"!==r.toUpperCase()){if(Bt.test(r)){if(s.inNumber)et(s,0);else{if(!Q(s))throw new Error("parser Error");nt(s)}--n}}else s.number+=r,s.hasExponent=1;else{if(s.inNumber&&!st(s)){et(s,0),--n;continue}s.number+=r,s.inNumber=1}else{if("0"===s.number||rt(s)){s.inNumber=1,s.number=r,et(s,1);continue}s.inNumber=1,s.number+=r}else{if(s.pointSeen||s.hasExponent){et(s,0),--n;continue}s.inNumber=1,s.pointSeen=1,s.number+=r}return s.inNumber&&et(s,0),s.inSegment&&Q(s)&&nt(s),s.segments}(t)}size(t,e){const n=this.bbox();let r,s;for(n.width=0===n.width?1:n.width,n.height=0===n.height?1:n.height,r=this.length-1;r>=0;r--)s=this[r][0],"M"===s||"L"===s||"T"===s?(this[r][1]=(this[r][1]-n.x)*t/n.width+n.x,this[r][2]=(this[r][2]-n.y)*e/n.height+n.y):"H"===s?this[r][1]=(this[r][1]-n.x)*t/n.width+n.x:"V"===s?this[r][1]=(this[r][1]-n.y)*e/n.height+n.y:"C"===s||"S"===s||"Q"===s?(this[r][1]=(this[r][1]-n.x)*t/n.width+n.x,this[r][2]=(this[r][2]-n.y)*e/n.height+n.y,this[r][3]=(this[r][3]-n.x)*t/n.width+n.x,this[r][4]=(this[r][4]-n.y)*e/n.height+n.y,"C"===s&&(this[r][5]=(this[r][5]-n.x)*t/n.width+n.x,this[r][6]=(this[r][6]-n.y)*e/n.height+n.y)):"A"===s&&(this[r][1]=this[r][1]*t/n.width,this[r][2]=this[r][2]*e/n.height,this[r][6]=(this[r][6]-n.x)*t/n.width+n.x,this[r][7]=(this[r][7]-n.y)*e/n.height+n.y);return this}toString(){return function(t){let e="";for(let n=0,r=t.length;n<r;n++)e+=t[n][0],null!=t[n][1]&&(e+=t[n][1],null!=t[n][2]&&(e+=" ",e+=t[n][2],null!=t[n][3]&&(e+=" ",e+=t[n][3],e+=" ",e+=t[n][4],null!=t[n][5]&&(e+=" ",e+=t[n][5],e+=" ",e+=t[n][6],null!=t[n][7]&&(e+=" ",e+=t[n][7])))));return e+" "}(this)}}const Ae=t=>{const e=typeof t;return"number"===e?Qt:"string"===e?Gt.isColor(t)?Gt:Pt.test(t)?Bt.test(t)?De:Jt:kt.test(t)?Qt:Le:Pe.indexOf(t.constructor)>-1?t.constructor:Array.isArray(t)?Jt:"object"===e?Fe:Le};class Se{constructor(t){this._stepper=t||new xe("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}at(t){return this._morphObj.morph(this._from,this._to,t,this._stepper,this._context)}done(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},1)}from(t){return null==t?this._from:(this._from=this._set(t),this)}stepper(t){return null==t?this._stepper:(this._stepper=t,this)}to(t){return null==t?this._to:(this._to=this._set(t),this)}type(t){return null==t?this._type:(this._type=t,this)}_set(t){this._type||this.type(Ae(t));let e=new this._type(t);return this._type===Gt&&(e=this._to?e[this._to[4]]():this._from?e[this._from[4]]():e),this._type===Fe&&(e=this._to?e.align(this._to):this._from?e.align(this._from):e),e=e.toConsumable(),this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(e.length)).map(Object).map(function(t){return t.done=1,t}),e}}class Le{constructor(...t){this.init(...t)}init(t){return t=Array.isArray(t)?t[0]:t,this.value=t,this}toArray(){return[this.value]}valueOf(){return this.value}}class Re{constructor(...t){this.init(...t)}init(t){return Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,Re.defaults,t),this}toArray(){const t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}Re.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0};const Ie=(t,e)=>t[0]<e[0]?-1:t[0]>e[0]?1:0;class Fe{constructor(...t){this.init(...t)}align(t){const e=this.values;for(let n=0,r=e.length;n<r;++n){if(e[n+1]===t[n+1]){if(e[n+1]===Gt&&t[n+7]!==e[n+7]){const e=t[n+7],r=new Gt(this.values.splice(n+3,5))[e]().toArray();this.values.splice(n+3,0,...r)}n+=e[n+2]+2;continue}if(!t[n+1])return this;const r=(new t[n+1]).toArray(),s=e[n+2]+3;e.splice(n,s,t[n],t[n+1],t[n+2],...r),n+=e[n+2]+2}return this}init(t){if(this.values=[],Array.isArray(t))return void(this.values=t.slice());t=t||{};const e=[];for(const n in t){const r=Ae(t[n]),s=new r(t[n]).toArray();e.push([n,r,s.length,...s])}return e.sort(Ie),this.values=e.reduce((t,e)=>t.concat(e),[]),this}toArray(){return this.values}valueOf(){const t={},e=this.values;for(;e.length;){const n=e.shift(),r=e.shift(),s=e.shift(),i=e.splice(0,s);t[n]=new r(i)}return t}}const Pe=[Le,Re,Fe];class Be extends ae{constructor(t,e=t){super(y("path",t),e)}array(){return this._array||(this._array=new De(this.attr("d")))}clear(){return delete this._array,this}height(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}move(t,e){return this.attr("d",this.array().move(t,e))}plot(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new De(t))}size(t,e){const n=c(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}width(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}x(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}y(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}}Be.prototype.MorphArray=De,n({Container:{path:M(function(t){return this.put(new Be).plot(t||new De)})}}),v(Be,"Path");var je={__proto__:null,array:function(){return this._array||(this._array=new ge(this.attr("points")))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new ge(t))},size:function(t,e){const n=c(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}};class Ge extends ae{constructor(t,e=t){super(y("polygon",t),e)}}n({Container:{polygon:M(function(t){return this.put(new Ge).plot(t||new ge)})}}),E(Ge,_e),E(Ge,je),v(Ge,"Polygon");class We extends ae{constructor(t,e=t){super(y("polyline",t),e)}}n({Container:{polyline:M(function(t){return this.put(new We).plot(t||new ge)})}}),E(We,_e),E(We,je),v(We,"Polyline");class He extends ae{constructor(t,e=t){super(y("rect",t),e)}}E(He,{rx:W,ry:H}),n({Container:{rect:M(function(t,e){return this.put(new He).size(t,e)})}}),v(He,"Rect");class $e{constructor(){this._first=null,this._last=null}first(){return this._first&&this._first.value}last(){return this._last&&this._last.value}push(t){const e=void 0!==t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}remove(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}shift(){const t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}}const ze={nextDraw:null,frames:new $e,timeouts:new $e,immediates:new $e,timer:()=>wt.window.performance||wt.window.Date,transforms:[],frame(t){const e=ze.frames.push({run:t});return null===ze.nextDraw&&(ze.nextDraw=wt.window.requestAnimationFrame(ze._draw)),e},timeout(t,e){e=e||0;const n=ze.timer().now()+e,r=ze.timeouts.push({run:t,time:n});return null===ze.nextDraw&&(ze.nextDraw=wt.window.requestAnimationFrame(ze._draw)),r},immediate(t){const e=ze.immediates.push(t);return null===ze.nextDraw&&(ze.nextDraw=wt.window.requestAnimationFrame(ze._draw)),e},cancelFrame(t){null!=t&&ze.frames.remove(t)},clearTimeout(t){null!=t&&ze.timeouts.remove(t)},cancelImmediate(t){null!=t&&ze.immediates.remove(t)},_draw(t){let e=null;const n=ze.timeouts.last();for(;(e=ze.timeouts.shift())&&(t>=e.time?e.run():ze.timeouts.push(e),e!==n););let r=null;const s=ze.frames.last();for(;r!==s&&(r=ze.frames.shift());)r.run(t);let i=null;for(;i=ze.immediates.shift();)i();ze.nextDraw=ze.timeouts.first()||ze.frames.first()?wt.window.requestAnimationFrame(ze._draw):null}},Xe=function(t){const e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},Ye=function(){const t=wt.window;return(t.performance||t.Date).now()};class Ve extends Ut{constructor(t=Ye){super(),this._timeSource=t,this.terminate()}active(){return!!this._nextFrame}finish(){return this.time(this.getEndTimeOfTimeline()+1),this.pause()}getEndTime(){const t=this.getLastRunnerInfo(),e=t?t.runner.duration():0;return(t?t.start:this._time)+e}getEndTimeOfTimeline(){const t=this._runners.map(t=>t.start+t.runner.duration());return Math.max(0,...t)}getLastRunnerInfo(){return this.getRunnerInfoById(this._lastRunnerId)}getRunnerInfoById(t){return this._runners[this._runnerIds.indexOf(t)]||null}pause(){return this._paused=1,this._continue()}persist(t){return null==t?this._persist:(this._persist=t,this)}play(){return this._paused=0,this.updateTime()._continue()}reverse(t){const e=this.speed();if(null==t)return this.speed(-e);const n=Math.abs(e);return this.speed(t?-n:n)}schedule(t,e,n){if(null==t)return this._runners.map(Xe);let r=0;const s=this.getEndTime();if(e=e||0,null==n||"last"===n||"after"===n)r=s;else if("absolute"===n||"start"===n)r=e,e=0;else if("now"===n)r=this._time;else if("relative"===n){const n=this.getRunnerInfoById(t.id);n&&(r=n.start+e,e=0)}else{if("with-last"!==n)throw new Error('Invalid value for the "when" parameter');{const t=this.getLastRunnerInfo();r=t?t.start:this._time}}t.unschedule(),t.timeline(this);const i=t.persist(),o={persist:null===i?this._persist:i,start:r+e,runner:t};return this._lastRunnerId=t.id,this._runners.push(o),this._runners.sort((t,e)=>t.start-e.start),this._runnerIds=this._runners.map(t=>t.runner.id),this.updateTime()._continue(),this}seek(t){return this.time(this._time+t)}source(t){return null==t?this._timeSource:(this._timeSource=t,this)}speed(t){return null==t?this._speed:(this._speed=t,this)}stop(){return this.time(0),this.pause()}time(t){return null==t?this._time:(this._time=t,this._continue(1))}unschedule(t){const e=this._runnerIds.indexOf(t.id);return e<0||(this._runners.splice(e,1),this._runnerIds.splice(e,1),t.timeline(null)),this}updateTime(){return this.active()||(this._lastSourceTime=this._timeSource()),this}_continue(t=0){return ze.cancelFrame(this._nextFrame),this._nextFrame=null,t?this._stepImmediate():(this._paused||(this._nextFrame=ze.frame(this._step)),this)}_stepFn(t=0){const e=this._timeSource();let n=e-this._lastSourceTime;t&&(n=0);const r=this._speed*n+(this._time-this._lastStepTime);this._lastSourceTime=e,t||(this._time+=r,this._time=this._time<0?0:this._time),this._lastStepTime=this._time,this.fire("time",this._time);for(let t=this._runners.length;t--;){const e=this._runners[t],n=e.runner;this._time-e.start<=0&&n.reset()}let s=0;for(let t=0,e=this._runners.length;t<e;t++){const n=this._runners[t],i=n.runner;let o=r;const a=this._time-n.start;a<=0?s=1:(a<o&&(o=a),i.active()&&(i.step(o).done?1!=n.persist&&i.duration()-i.time()+this._time+n.persist<this._time&&(i.unschedule(),--t,--e):s=1))}return s&&!(this._speed<0&&0===this._time)||this._runnerIds.length&&this._speed<0&&this._time>0?this._continue():(this.pause(),this.fire("finished")),this}terminate(){this._startTime=0,this._speed=1,this._persist=0,this._nextFrame=null,this._paused=1,this._runners=[],this._runnerIds=[],this._lastRunnerId=-1,this._time=0,this._lastSourceTime=0,this._lastStepTime=0,this._step=this._stepFn.bind(this,0),this._stepImmediate=this._stepFn.bind(this,1)}}n({Element:{timeline:function(t){return null==t?(this._timeline=this._timeline||new Ve,this._timeline):(this._timeline=t,this)}}});class Ue extends Ut{constructor(t){super(),this.id=Ue.id++,t="function"==typeof(t=null==t?qt.duration:t)?new Ce(t):t,this._element=null,this._timeline=null,this.done=0,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Ce,this._stepper=this._isDeclarative?t:new xe,this._history={},this.enabled=1,this._time=0,this._lastTime=0,this._reseted=1,this.transforms=new Ht,this.transformId=1,this._haveReversed=0,this._reverse=0,this._loopsDone=0,this._swing=0,this._wait=0,this._times=1,this._frameId=null,this._persist=this._isDeclarative?1:null}static sanitise(t,e,n){let r=1,s=0,i=0;return e=e??qt.delay,n=n||"last","object"!=typeof(t=t??qt.duration)||t instanceof be||(e=t.delay??e,n=t.when??n,s=t.swing||s,r=t.times??r,i=t.wait??i,t=t.duration??qt.duration),{duration:t,delay:e,swing:s,times:r,wait:i,when:n}}active(t){return null==t?this.enabled:(this.enabled=t,this)}addTransform(t){return this.transforms.lmultiplyO(t),this}after(t){return this.on("finished",t)}animate(t,e,n){const r=Ue.sanitise(t,e,n),s=new Ue(r.duration);return this._timeline&&s.timeline(this._timeline),this._element&&s.element(this._element),s.loop(r).schedule(r.delay,r.when)}clearTransform(){return this.transforms=new Ht,this}clearTransformsFromQueue(){this.done&&this._timeline&&this._timeline._runnerIds.includes(this.id)||(this._queue=this._queue.filter(t=>!t.isTransform))}delay(t){return this.animate(0,t)}duration(){return this._times*(this._wait+this._duration)-this._wait}during(t){return this.queue(null,t)}ease(t){return this._stepper=new xe(t),this}element(t){return null==t?this._element:(this._element=t,t._prepareRunner(),this)}finish(){return this.step(1/0)}loop(t,e,n){return"object"==typeof t&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||0,this._wait=n||0,1==this._times&&(this._times=1/0),this}loops(t){const e=this._duration+this._wait;if(null==t){const t=Math.floor(this._time/e),n=(this._time-t*e)/this._duration;return Math.min(t+n,this._times)}const n=t%1,r=e*Math.floor(t)+this._duration*n;return this.time(r)}persist(t){return null==t?this._persist:(this._persist=t,this)}position(t){const e=this._time,n=this._duration,r=this._wait,s=this._times,i=this._swing,o=this._reverse;let a;if(null==t){const t=function(t){const e=i*Math.floor(t%(2*(r+n))/(r+n)),s=e&&!o||!e&&o,a=Math.pow(-1,s)*(t%(r+n))/n+s;return Math.max(Math.min(a,1),0)},l=s*(r+n)-r;return a=e<=0?Math.round(t(1e-5)):e<l?t(e):Math.round(t(l-1e-5)),a}const l=Math.floor(this.loops()),h=i&&l%2==0;return a=l+(h&&!o||o&&h?t:1-t),this.loops(a)}progress(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}queue(t,e,n,r){return this._queue.push({initialiser:t||G,runner:e||G,retarget:n,isTransform:r,initialised:0,finished:0}),this.timeline()&&this.timeline()._continue(),this}reset(){return this._reseted||(this.time(0),this._reseted=1),this}reverse(t){return this._reverse=null==t?!this._reverse:t,this}schedule(t,e,n){if(t instanceof Ve||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this}step(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;const e=this.position(),n=this._lastPosition!==e&&this._time>=0;this._lastPosition=e;const r=this.duration(),s=this._lastTime<=0&&this._time>0,i=this._lastTime<r&&this._time>=r;this._lastTime=this._time,s&&this.fire("start",this);const o=this._isDeclarative;this.done=!o&&!i&&this._time>=r,this._reseted=0;let a=0;return(n||o)&&(this._initialise(n),this.transforms=new Ht,a=this._run(o?t:e),this.fire("step",this)),this.done=this.done||a&&o,i&&this.fire("finished",this),this}time(t){if(null==t)return this._time;const e=t-this._time;return this.step(e),this}timeline(t){return void 0===t?this._timeline:(this._timeline=t,this)}unschedule(){const t=this.timeline();return t&&t.unschedule(this),this}_initialise(t){if(t||this._isDeclarative)for(let e=0,n=this._queue.length;e<n;++e){const n=this._queue[e],r=this._isDeclarative||!n.initialised&&t;t=!n.finished,r&&t&&(n.initialiser.call(this),n.initialised=1)}}_rememberMorpher(t,e){if(this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]},this._isDeclarative){const t=this.timeline();t&&t.play()}}_run(t){let e=1;for(let n=0,r=this._queue.length;n<r;++n){const r=this._queue[n],s=r.runner.call(this,t);r.finished=r.finished||1==s,e=e&&r.finished}return e}_tryRetarget(t,e,n){if(this._history[t]){if(!this._history[t].caller.initialised){const e=this._queue.indexOf(this._history[t].caller);return this._queue.splice(e,1),0}this._history[t].caller.retarget?this._history[t].caller.retarget.call(this,e,n):this._history[t].morpher.to(e),this._history[t].caller.finished=0;const r=this.timeline();return r&&r.play(),1}return 0}}Ue.id=0;class qe{constructor(t=new Ht,e=-1,n=1){this.transforms=t,this.id=e,this.done=n}clearTransformsFromQueue(){}}E([Ue,qe],{mergeWith(t){return new qe(t.transforms.lmultiply(this.transforms),t.id)}});const Ke=(t,e)=>t.lmultiplyO(e),Ze=t=>t.transforms;class Je{constructor(){this.runners=[],this.ids=[]}add(t){if(this.runners.includes(t))return;const e=t.id+1;return this.runners.push(t),this.ids.push(e),this}clearBefore(t){const e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new qe).forEach(t=>t.clearTransformsFromQueue()),this}edit(t,e){const n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t+1),this.runners.splice(n,1,e),this}getByID(t){return this.runners[this.ids.indexOf(t+1)]}length(){return this.ids.length}merge(){let t=null;for(let e=0;e<this.runners.length;++e){const n=this.runners[e];if(!(t&&n.done&&t.done)||n._timeline&&n._timeline._runnerIds.includes(n.id)||t._timeline&&t._timeline._runnerIds.includes(t.id))t=n;else{this.remove(n.id);const r=n.mergeWith(t);this.edit(t.id,r),t=r,--e}}return this}remove(t){const e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}}n({Element:{animate(t,e,n){const r=Ue.sanitise(t,e,n),s=this.timeline();return new Ue(r.duration).loop(r).element(this).timeline(s.play()).schedule(r.delay,r.when)},delay(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore(t){this._transformationRunners.clearBefore(t.id)},_currentTransform(t){return this._transformationRunners.runners.filter(e=>e.id<=t.id).map(Ze).reduce(Ke,new Ht)},_addRunner(t){this._transformationRunners.add(t),ze.cancelImmediate(this._frameId),this._frameId=ze.immediate(at.bind(this))},_prepareRunner(){null==this._frameId&&(this._transformationRunners=(new Je).add(new qe(new Ht(this))))}}}),E(Ue,{attr(t,e){return this.styleAttr("attr",t,e)},css(t,e){return this.styleAttr("css",t,e)},styleAttr(t,e,n){if("string"==typeof e)return this.styleAttr(t,{[e]:n});let r=e;if(this._tryRetarget(t,r))return this;let s=new Se(this._stepper).to(r),i=Object.keys(r);return this.queue(function(){s=s.from(this.element()[t](i))},function(e){return this.element()[t](s.at(e).valueOf()),s.done()},function(e){const n=Object.keys(e),o=(a=i,n.filter(t=>!a.includes(t)));var a;if(o.length){const e=this.element()[t](o),n=new Fe(s.from()).valueOf();Object.assign(n,e),s.from(n)}const l=new Fe(s.to()).valueOf();Object.assign(l,e),s.to(l),i=n,r=e}),this._rememberMorpher(t,s),this},zoom(t,e){if(this._tryRetarget("zoom",t,e))return this;let n=new Se(this._stepper).to(new Qt(t));return this.queue(function(){n=n.from(this.element().zoom())},function(t){return this.element().zoom(n.at(t),e),n.done()},function(t,r){e=r,n.to(t)}),this._rememberMorpher("zoom",n),this},transform(t,e,n){if(e=t.relative||e,this._isDeclarative&&!e&&this._tryRetarget("transform",t))return this;const r=Ht.isMatrixLike(t);n=null!=t.affine?t.affine:null!=n?n:!r;const s=new Se(this._stepper).type(n?Re:Ht);let i,o,a,l,h;return this.queue(function(){o=o||this.element(),i=i||u(t,o),h=new Ht(e?void 0:o),o._addRunner(this),e||o._clearTransformRunnersBefore(this)},function(c){e||this.clearTransform();const{x:u,y:d}=new Wt(i).transform(o._currentTransform(this));let f=new Ht({...t,origin:[u,d]}),p=this._isDeclarative&&a?a:h;if(n){f=f.decompose(u,d),p=p.decompose(u,d);const t=f.rotate,e=p.rotate,n=[t-360,t,t+360],r=n.map(t=>Math.abs(t-e)),s=Math.min(...r),i=r.indexOf(s);f.rotate=n[i]}e&&(r||(f.rotate=t.rotate||0),this._isDeclarative&&l&&(p.rotate=l)),s.from(p),s.to(f);const m=s.at(c);return l=m.rotate,a=new Ht(m),this.addTransform(a),o._addRunner(this),s.done()},function(e){(e.origin||"center").toString()!==(t.origin||"center").toString()&&(i=u(e,o)),t={...e,origin:i}},1),this._isDeclarative&&this._rememberMorpher("transform",s),this},x(t){return this._queueNumber("x",t)},y(t){return this._queueNumber("y",t)},ax(t){return this._queueNumber("ax",t)},ay(t){return this._queueNumber("ay",t)},dx(t=0){return this._queueNumberDelta("x",t)},dy(t=0){return this._queueNumberDelta("y",t)},dmove(t,e){return this.dx(t).dy(e)},_queueNumberDelta(t,e){if(e=new Qt(e),this._tryRetarget(t,e))return this;const n=new Se(this._stepper).to(e);let r=null;return this.queue(function(){r=this.element()[t](),n.from(r),n.to(r+e)},function(e){return this.element()[t](n.at(e)),n.done()},function(t){n.to(r+new Qt(t))}),this._rememberMorpher(t,n),this},_queueObject(t,e){if(this._tryRetarget(t,e))return this;const n=new Se(this._stepper).to(e);return this.queue(function(){n.from(this.element()[t]())},function(e){return this.element()[t](n.at(e)),n.done()}),this._rememberMorpher(t,n),this},_queueNumber(t,e){return this._queueObject(t,new Qt(e))},cx(t){return this._queueNumber("cx",t)},cy(t){return this._queueNumber("cy",t)},move(t,e){return this.x(t).y(e)},amove(t,e){return this.ax(t).ay(e)},center(t,e){return this.cx(t).cy(e)},size(t,e){let n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width(t){return this._queueNumber("width",t)},height(t){return this._queueNumber("height",t)},plot(t,e,n,r){if(4===arguments.length)return this.plot([t,e,n,r]);if(this._tryRetarget("plot",t))return this;const s=new Se(this._stepper).type(this._element.MorphArray).to(t);return this.queue(function(){s.from(this._element.array())},function(t){return this._element.plot(s.at(t)),s.done()}),this._rememberMorpher("plot",s),this},leading(t){return this._queueNumber("leading",t)},viewbox(t,e,n,r){return this._queueObject("viewbox",new $t(t,e,n,r))},update(t){return"object"!=typeof t?this.update({offset:arguments[0],color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}}),E(Ue,{rx:W,ry:H,from:q,to:K}),v(Ue,"Runner");class Qe extends ie{constructor(t,e=t){super(y("svg",t),e),this.namespace()}defs(){return this.isRoot()?w(this.node.querySelector("defs"))||this.put(new oe):this.root().defs()}isRoot(){return!this.node.parentNode||!(this.node.parentNode instanceof wt.window.SVGElement)&&"#document-fragment"!==this.node.parentNode.nodeName}namespace(){return this.isRoot()?this.attr({xmlns:pt,version:"1.1"}).attr("xmlns:xlink",_t,gt):this.root().namespace()}removeNamespace(){return this.attr({xmlns:null,version:null}).attr("xmlns:xlink",null,gt).attr("xmlns:svgjs",null,gt)}root(){return this.isRoot()?this:super.root()}}n({Container:{nested:M(function(){return this.put(new Qe)})}}),v(Qe,"Svg",1);class tn extends ie{constructor(t,e=t){super(y("symbol",t),e)}}n({Container:{symbol:M(function(){return this.put(new tn)})}}),v(tn,"Symbol");var en={__proto__:null,amove:function(t,e){return this.ax(t).ay(e)},ax:function(t){return this.attr("x",t)},ay:function(t){return this.attr("y",t)},build:function(t){return this._build=!!t,this},center:function(t,e,n=this.bbox()){return this.cx(t,n).cy(e,n)},cx:function(t,e=this.bbox()){return null==t?e.cx:this.attr("x",this.attr("x")+t-e.cx)},cy:function(t,e=this.bbox()){return null==t?e.cy:this.attr("y",this.attr("y")+t-e.cy)},length:function(){return this.node.getComputedTextLength()},move:function(t,e,n=this.bbox()){return this.x(t,n).y(e,n)},plain:function(t){return 0==this._build&&this.clear(),this.node.appendChild(wt.document.createTextNode(t)),this},x:function(t,e=this.bbox()){return null==t?e.x:this.attr("x",this.attr("x")+t-e.x)},y:function(t,e=this.bbox()){return null==t?e.y:this.attr("y",this.attr("y")+t-e.y)}};class nn extends ae{constructor(t,e=t){super(y("text",t),e),this.dom.leading=this.dom.leading??new Qt(1.3),this._rebuild=1,this._build=0}leading(t){return null==t?this.dom.leading:(this.dom.leading=new Qt(t),this.rebuild())}rebuild(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){const t=this;let e=0;const n=this.dom.leading;this.each(function(r){if(ut(this.node))return;const s=wt.window.getComputedStyle(this.node).getPropertyValue("font-size"),i=n*new Qt(s);this.dom.newLined&&(this.attr("x",t.attr("x")),"\n"===this.text()?e+=i:(this.attr("dy",r?i+e:0),e=0))}),this.fire("rebuild")}return this}setData(t){return this.dom=t,this.dom.leading=new Qt(t.leading||1.3),this}writeDataToDom(){return dt(this,this.dom,{leading:1.3}),this}text(t){if(void 0===t){const e=this.node.childNodes;let n=0;t="";for(let r=0,s=e.length;r<s;++r)"textPath"===e[r].nodeName||ut(e[r])?0===r&&(n=r+1):(r!==n&&3!==e[r].nodeType&&1==w(e[r]).dom.newLined&&(t+="\n"),t+=e[r].textContent);return t}if(this.clear().build(1),"function"==typeof t)t.call(this,this);else for(let e=0,n=(t=(t+"").split("\n")).length;e<n;e++)this.newLine(t[e]);return this.build(0).rebuild()}}E(nn,en),n({Container:{text:M(function(t=""){return this.put(new nn).text(t)}),plain:M(function(t=""){return this.put(new nn).plain(t)})}}),v(nn,"Text");class rn extends ae{constructor(t,e=t){super(y("tspan",t),e),this._build=0}dx(t){return this.attr("dx",t)}dy(t){return this.attr("dy",t)}newLine(){this.dom.newLined=1;const t=this.parent();if(!(t instanceof nn))return this;const e=t.index(this),n=wt.window.getComputedStyle(this.node).getPropertyValue("font-size"),r=t.dom.leading*new Qt(n);return this.dy(e?r:0).attr("x",t.x())}text(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?(this.clear().build(1),t.call(this,this),this.build(0)):this.plain(t),this)}}E(rn,en),n({Tspan:{tspan:M(function(t=""){const e=new rn;return this._build||this.clear(),this.put(e).text(t)})},Text:{newLine:function(t=""){return this.tspan(t).newLine()}}}),v(rn,"Tspan");class sn extends ae{constructor(t,e=t){super(y("circle",t),e)}radius(t){return this.attr("r",t)}rx(t){return this.attr("r",t)}ry(t){return this.rx(t)}size(t){return this.radius(new Qt(t).divide(2))}}E(sn,{x:$,y:z,cx:X,cy:Y,width:V,height:U}),n({Container:{circle:M(function(t=0){return this.put(new sn).size(t).move(0,0)})}}),v(sn,"Circle");class on extends ie{constructor(t,e=t){super(y("clipPath",t),e)}remove(){return this.targets().forEach(function(t){t.unclip()}),super.remove()}targets(){return L("svg [clip-path*="+this.id()+"]")}}n({Container:{clip:M(function(){return this.defs().put(new on)})},Element:{clipper(){return this.reference("clip-path")},clipWith(t){const e=t instanceof on?t:this.parent().clip().add(t);return this.attr("clip-path","url(#"+e.id()+")")},unclip(){return this.attr("clip-path",null)}}}),v(on,"ClipPath");class an extends re{constructor(t,e=t){super(y("foreignObject",t),e)}}n({Container:{foreignObject:M(function(t,e){return this.put(new an).size(t,e)})}}),v(an,"ForeignObject");var ln={__proto__:null,dmove:function(t,e){return this.children().forEach(n=>{let r;try{r=n.node instanceof m().SVGSVGElement?new $t(n.attr(["x","y","width","height"])):n.bbox()}catch(t){return}const s=new Ht(n),i=s.translate(t,e).transform(s.inverse()),o=new Wt(r.x,r.y).transform(i);n.move(o.x,o.y)}),this},dx:function(t){return this.dmove(t,0)},dy:function(t){return this.dmove(0,t)},height:function(t,e=this.bbox()){return null==t?e.height:this.size(e.width,t,e)},move:function(t=0,e=0,n=this.bbox()){const r=t-n.x,s=e-n.y;return this.dmove(r,s)},size:function(t,e,n=this.bbox()){const r=c(this,t,e,n),s=r.width/n.width,i=r.height/n.height;return this.children().forEach(t=>{const e=new Wt(n).transform(new Ht(t).inverse());t.scale(s,i,e.x,e.y)}),this},width:function(t,e=this.bbox()){return null==t?e.width:this.size(t,e.height,e)},x:function(t,e=this.bbox()){return null==t?e.x:this.move(t,e.y,e)},y:function(t,e=this.bbox()){return null==t?e.y:this.move(e.x,t,e)}};class hn extends ie{constructor(t,e=t){super(y("g",t),e)}}E(hn,ln),n({Container:{group:M(function(){return this.put(new hn)})}}),v(hn,"G");class cn extends ie{constructor(t,e=t){super(y("a",t),e)}target(t){return this.attr("target",t)}to(t){return this.attr("href",t,_t)}}E(cn,ln),n({Container:{link:M(function(t){return this.put(new cn).to(t)})},Element:{unlink(){const t=this.linker();if(!t)return this;const e=t.parent();if(!e)return this.remove();const n=e.index(t);return e.add(this,n),t.remove(),this},linkTo(t){let e=this.linker();return e||(e=new cn,this.wrap(e)),"function"==typeof t?t.call(e,e):e.to(t),this},linker(){const t=this.parent();return t&&"a"===t.node.nodeName.toLowerCase()?t:null}}}),v(cn,"A");class un extends ie{constructor(t,e=t){super(y("mask",t),e)}remove(){return this.targets().forEach(function(t){t.unmask()}),super.remove()}targets(){return L("svg [mask*="+this.id()+"]")}}n({Container:{mask:M(function(){return this.defs().put(new un)})},Element:{masker(){return this.reference("mask")},maskWith(t){const e=t instanceof un?t:this.parent().mask().add(t);return this.attr("mask","url(#"+e.id()+")")},unmask(){return this.attr("mask",null)}}}),v(un,"Mask");class dn extends re{constructor(t,e=t){super(y("stop",t),e)}update(t){return("number"==typeof t||t instanceof Qt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new Qt(t.offset)),this}}n({Gradient:{stop:function(t,e,n){return this.put(new dn).update(t,e,n)}}}),v(dn,"Stop");class fn extends re{constructor(t,e=t){super(y("style",t),e)}addText(t=""){return this.node.textContent+=t,this}font(t,e,n={}){return this.rule("@font-face",{fontFamily:t,src:e,...n})}rule(t,e){return this.addText(function(t,e){if(!t)return"";if(!e)return t;let n=t+"{";for(const t in e)n+=l(t)+":"+e[t]+";";return n+="}",n}(t,e))}}n("Dom",{style(t,e){return this.put(new fn).rule(t,e)},fontface(t,e,n){return this.put(new fn).font(t,e,n)}}),v(fn,"Style");class pn extends nn{constructor(t,e=t){super(y("textPath",t),e)}array(){const t=this.track();return t?t.array():null}plot(t){const e=this.track();let n=null;return e&&(n=e.plot(t)),null==t?n:this}track(){return this.reference("href")}}n({Container:{textPath:M(function(t,e){return t instanceof nn||(t=this.text(t)),t.path(e)})},Text:{path:M(function(t,e=1){const n=new pn;let r;if(t instanceof Be||(t=this.defs().path(t)),n.attr("href","#"+t,_t),e)for(;r=this.node.firstChild;)n.node.appendChild(r);return this.put(n)}),textPath(){return this.findOne("textPath")}},Path:{text:M(function(t){return t instanceof nn||(t=(new nn).addTo(this.parent()).text(t)),t.path(this)}),targets(){return L("svg textPath").filter(t=>(t.attr("href")||"").includes(this.id()))}}}),pn.prototype.MorphArray=De,v(pn,"TextPath");class mn extends ae{constructor(t,e=t){super(y("use",t),e)}use(t,e){return this.attr("href",(e||"")+"#"+t,_t)}}n({Container:{use:M(function(t,e){return this.put(new mn).use(t,e)})}}),v(mn,"Use");const gn=_;E([Qe,tn,me,pe,we],r("viewbox")),E([ye,We,Ge,Be],r("marker")),E(nn,r("Text")),E(Be,r("Path")),E(oe,r("Defs")),E([nn,rn],r("Tspan")),E([He,he,fe,Ue],r("radius")),E(Ut,r("EventTarget")),E(ne,r("Dom")),E(re,r("Element")),E(ae,r("Shape")),E([ie,ce],r("Container")),E(fe,r("Gradient")),E(Ue,r("Runner")),zt.extend([...new Set(ht)]),it([Qt,Gt,$t,Ht,Jt,ge,De,Wt]),ot(),e.A=cn,e.Animator=ze,e.Array=Jt,e.Box=$t,e.Circle=sn,e.ClipPath=on,e.Color=Gt,e.Container=ie,e.Controller=Ce,e.Defs=oe,e.Dom=ne,e.Ease=xe,e.Element=re,e.Ellipse=he,e.EventTarget=Ut,e.ForeignObject=an,e.Fragment=ce,e.G=hn,e.Gradient=fe,e.Image=me,e.Line=ye,e.List=zt,e.Marker=we,e.Mask=un,e.Matrix=Ht,e.Morphable=Se,e.NonMorphable=Le,e.Number=Qt,e.ObjectBag=Fe,e.PID=Me,e.Path=Be,e.PathArray=De,e.Pattern=pe,e.Point=Wt,e.PointArray=ge,e.Polygon=Ge,e.Polyline=We,e.Queue=$e,e.Rect=He,e.Runner=Ue,e.SVG=gn,e.Shape=ae,e.Spring=Ee,e.Stop=dn,e.Style=fn,e.Svg=Qe,e.Symbol=tn,e.Text=nn,e.TextPath=pn,e.Timeline=Ve,e.TransformBag=Re,e.Tspan=rn,e.Use=mn,e.adopt=w,e.assignNewId=C,e.clearEvents=F,e.create=g,e.defaults=Zt,e.dispatch=j,e.easing=ve,e.eid=x,e.extend=E,e.find=L,e.getClass=b,e.getEventTarget=I,e.getEvents=R,e.getWindow=m,e.makeInstance=_,e.makeMorphable=ot,e.mockAdopt=function(t=w){Et=t},e.namespaces=yt,e.nodeOrNew=y,e.off=B,e.on=P,e.parser=D,e.regex=jt,e.register=v,e.registerMorphableType=it,e.registerWindow=d,e.restoreWindow=p,e.root=Ct,e.saveWindow=f,e.utils=ft,e.windowEvents=Vt,e.withWindow=function(t,e){f(),d(t,t.document),e(t,t.document),p()},e.wrapWithAttrCheck=M},9890:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:1}),n(6180),n(9267),n(4115),n(8392),n(6612),n(471),n(3454)}},n={};return t.d=(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:1,get:n[r]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:1})},t(8156).default})());
|
|
2
|
+
//# sourceMappingURL=kabel.js.map
|