UNPKG

jbxl-workflow

Version:

流程图

66 lines 865 kB
(function(Ie,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("@antv/x6"),require("vue"),require("element-plus"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","@antv/x6","vue","element-plus","dayjs"],W):(Ie=typeof globalThis<"u"?globalThis:Ie||self,W(Ie.workflow={},Ie.X6,Ie.Vue,Ie.ElementPlus,Ie.dayjs))})(this,function(Ie,W,e,ie,ye){"use strict";var $P=Object.defineProperty;var Am=Ie=>{throw TypeError(Ie)};var UP=(Ie,W,e)=>W in Ie?$P(Ie,W,{enumerable:!0,configurable:!0,writable:!0,value:e}):Ie[W]=e;var Rr=(Ie,W,e)=>UP(Ie,typeof W!="symbol"?W+"":W,e),Mm=(Ie,W,e)=>W.has(Ie)||Am("Cannot "+e);var Om=(Ie,W,e)=>(Mm(Ie,W,"read from private field"),e?e.call(Ie):W.get(Ie)),Rm=(Ie,W,e)=>W.has(Ie)?Am("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(Ie):W.set(Ie,e),Im=(Ie,W,e,ie)=>(Mm(Ie,W,"write to private field"),ie?ie.call(Ie,e):W.set(Ie,e),e);var Mr;W.Graph.prototype.isHistoryEnabled=function(){const t=this.getPlugin("history");return t?t.isEnabled():!1},W.Graph.prototype.enableHistory=function(){const t=this.getPlugin("history");return t&&t.enable(),this},W.Graph.prototype.disableHistory=function(){const t=this.getPlugin("history");return t&&t.disable(),this},W.Graph.prototype.toggleHistory=function(t){const n=this.getPlugin("history");return n&&n.toggleEnabled(t),this},W.Graph.prototype.undo=function(t){const n=this.getPlugin("history");return n&&n.undo(t),this},W.Graph.prototype.redo=function(t){const n=this.getPlugin("history");return n&&n.redo(t),this},W.Graph.prototype.undoAndCancel=function(t){const n=this.getPlugin("history");return n&&n.cancel(t),this},W.Graph.prototype.canUndo=function(){const t=this.getPlugin("history");return t?t.canUndo():!1},W.Graph.prototype.canRedo=function(){const t=this.getPlugin("history");return t?t.canRedo():!1},W.Graph.prototype.cleanHistory=function(t){const n=this.getPlugin("history");return n&&n.clean(t),this},W.Graph.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()},W.Graph.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()},W.Graph.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()},W.Graph.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var Uc=function(t,n,o,a){var r=arguments.length,l=r<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,o):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(t,n,o,a);else for(var i=t.length-1;i>=0;i--)(s=t[i])&&(l=(r<3?s(l):r>3?s(n,o,l):s(n,o))||l);return r>3&&l&&Object.defineProperty(n,o,l),l};class Xo extends W.Basecoat{constructor(n={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:o=0}=n;this.stackSize=o,this.options=ct.getOptions(n),this.validator=new Xo.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(n){this.graph=n,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(n){return n!=null?n!==this.isEnabled()&&(n?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(n={}){if(!this.disabled){const o=this.undoStack.pop();o&&(this.revertCommand(o,n),this.redoStack.push(o),this.notify("undo",o,n))}return this}redo(n={}){if(!this.disabled){const o=this.redoStack.pop();o&&(this.applyCommand(o,n),this.undoStackPush(o),this.notify("redo",o,n))}return this}cancel(n={}){if(!this.disabled){const o=this.undoStack.pop();o&&(this.revertCommand(o,n),this.redoStack=[],this.notify("cancel",o,n))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const n=this.undoStack.length;return this.stackSize-n}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(n={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,n),this}get disabled(){return this.options.enabled!==!0}validate(n,...o){return this.validator.validate(n,...o),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((n,o)=>{this.handlers[o]=this.addCommand.bind(this,n),this.model.on(n,this.handlers[o])}),this.validator.on("invalid",n=>this.trigger("invalid",n))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((n,o)=>{this.model.off(n,this.handlers[o])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(n){return{batch:n?n.batch:!1,data:{}}}revertCommand(n,o){this.freezed=!0;const a=Array.isArray(n)?ct.sortBatchCommands(n):[n];for(let r=a.length-1;r>=0;r-=1){const l=a[r],s=Object.assign(Object.assign({},o),W.ObjectExt.pick(l.options,this.options.revertOptionsList||[]));this.executeCommand(l,!0,s)}this.freezed=!1}applyCommand(n,o){this.freezed=!0;const a=Array.isArray(n)?ct.sortBatchCommands(n):[n];for(let r=0;r<a.length;r+=1){const l=a[r],s=Object.assign(Object.assign({},o),W.ObjectExt.pick(l.options,this.options.applyOptionsList||[]));this.executeCommand(l,!1,s)}this.freezed=!1}executeCommand(n,o,a){const r=this.model,l=r.getCell(n.data.id),s=n.event;if(ct.isAddEvent(s)&&o||ct.isRemoveEvent(s)&&!o)l&&l.remove(a);else if(ct.isAddEvent(s)&&!o||ct.isRemoveEvent(s)&&o){const i=n.data;i.node?r.addNode(i.props,a):i.edge&&r.addEdge(i.props,a)}else if(ct.isChangeEvent(s)){const i=n.data,c=i.key;if(c&&l){const d=o?i.prev[c]:i.next[c];i.key==="attrs"&&this.ensureUndefinedAttrs(d,o?i.next[c]:i.prev[c])&&(a.dirty=!0),l.prop(c,d,a)}}else{const i=this.options.executeCommand;i&&W.FunctionExt.call(i,this,n,o,a)}}addCommand(n,o){if(this.freezed||this.disabled)return;const a=o,r=a.options||{};if(r.dryrun||ct.isAddEvent(n)&&this.options.ignoreAdd||ct.isRemoveEvent(n)&&this.options.ignoreRemove||ct.isChangeEvent(n)&&this.options.ignoreChange)return;const l=this.options.beforeAddCommand;if(l!=null&&W.FunctionExt.call(l,this,n,o)===!1)return;n==="cell:change:*"&&(n=`cell:change:${a.key}`);const s=a.cell,i=W.Model.isModel(s);let c;if(this.batchCommands){c=this.batchCommands[Math.max(this.lastBatchIndex,0)];const u=i&&!c.modelChange||c.data.id!==s.id,f=c.event!==n;if(this.lastBatchIndex>=0&&(u||f)){const p=this.batchCommands.findIndex(m=>(i&&m.modelChange||m.data.id===s.id)&&m.event===n);p<0||ct.isAddEvent(n)||ct.isRemoveEvent(n)?c=this.createCommand({batch:!0}):(c=this.batchCommands[p],this.batchCommands.splice(p,1)),this.batchCommands.push(c),this.lastBatchIndex=this.batchCommands.length-1}}else c=this.createCommand({batch:!1});if(ct.isAddEvent(n)||ct.isRemoveEvent(n)){const u=c.data;return c.event=n,c.options=r,u.id=s.id,u.props=W.ObjectExt.cloneDeep(s.toJSON()),s.isEdge()?u.edge=!0:s.isNode()&&(u.node=!0),this.push(c,r)}if(ct.isChangeEvent(n)){const u=o.key,f=c.data;return(!c.batch||!c.event)&&(c.event=n,c.options=r,f.key=u,f.prev==null&&(f.prev={}),f.prev[u]=W.ObjectExt.cloneDeep(s.previous(u)),i?c.modelChange=!0:f.id=s.id),f.next==null&&(f.next={}),f.next[u]=W.ObjectExt.cloneDeep(s.prop(u)),this.push(c,r)}const d=this.options.afterAddCommand;d&&W.FunctionExt.call(d,this,n,o,c),this.push(c,r)}initBatchCommand(n){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(n){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const o=this.filterBatchCommand(this.batchCommands);o.length>0&&(this.redoStack=[],this.undoStackPush(o),this.consolidateCommands(),this.notify("add",o,n)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(n){let o=n.slice();const a=[];for(;o.length>0;){const r=o.shift(),l=r.event,s=r.data.id;if(l!=null&&(s!=null||r.modelChange)){if(ct.isAddEvent(l)){const i=o.findIndex(c=>ct.isRemoveEvent(c.event)&&c.data.id===s);if(i>=0){o=o.filter((c,d)=>i<d||c.data.id!==s);continue}}else if(ct.isRemoveEvent(l)){const i=o.findIndex(c=>ct.isAddEvent(c.event)&&c.data.id===s);if(i>=0){o.splice(i,1);continue}}else if(ct.isChangeEvent(l)){const i=r.data;if(W.ObjectExt.isEqual(i.prev,i.next))continue}a.push(r)}}return a}notify(n,o,a){const r=o==null?null:Array.isArray(o)?o:[o];this.emit(n,{cmds:r,options:a}),this.graph.trigger(`history:${n}`,{cmds:r,options:a}),this.emit("change",{cmds:r,options:a}),this.graph.trigger("history:change",{cmds:r,options:a})}push(n,o){this.redoStack=[],n.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:n,options:o})):(this.undoStackPush(n),this.consolidateCommands(),this.notify("add",n,o))}consolidateCommands(){var n;const o=this.undoStack[this.undoStack.length-1],a=this.undoStack[this.undoStack.length-2];if(!Array.isArray(o))return;const r=new Set(o.map(s=>s.event));if(r.size!==2||!r.has("cell:change:parent")||!r.has("cell:change:children")||!o.every(s=>{var i;return s.batch&&((i=s.options)===null||i===void 0?void 0:i.ui)})||!Array.isArray(a)||a.length!==1)return;const l=a[0];l.event!=="cell:change:position"||!(!((n=l.options)===null||n===void 0)&&n.ui)||(a.push(...o),this.undoStack.pop())}undoStackPush(n){if(this.stackSize===0){this.undoStack.push(n);return}this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(n)}ensureUndefinedAttrs(n,o){let a=!1;return n!==null&&o!==null&&typeof n=="object"&&typeof o=="object"&&Object.keys(o).forEach(r=>{n[r]===void 0&&o[r]!==void 0?(n[r]=void 0,a=!0):typeof n[r]=="object"&&typeof o[r]=="object"&&(a=this.ensureUndefinedAttrs(n[r],o[r]))}),a}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}Uc([W.Basecoat.dispose()],Xo.prototype,"dispose",null),function(t){class n extends W.Basecoat{constructor(a){super(),this.map={},this.command=a.history,this.cancelInvalid=a.cancelInvalid!==!1,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:a}){return Array.isArray(a)?a.every(r=>this.isValidCommand(r)):this.isValidCommand(a)}isValidCommand(a){if(a.options&&a.options.validation===!1)return!0;const r=a.event&&this.map[a.event]||[];let l=null;return r.forEach(s=>{let i=0;const c=d=>{const u=s[i];i+=1;try{if(u)u(d,a,c);else{l=d;return}}catch(f){c(f)}};c(l)}),l?(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:l}),!1):!0}validate(a,...r){const l=Array.isArray(a)?a:a.split(/\s+/);return r.forEach(s=>{if(typeof s!="function")throw new Error(`${l.join(" ")} requires callback functions.`)}),l.forEach(s=>{this.map[s]==null&&(this.map[s]=[]),this.map[s].push(r)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}Uc([W.Basecoat.dispose()],n.prototype,"dispose",null),t.Validator=n}(Xo||(Xo={}));var ct;(function(t){function n(s){return s==="cell:added"}t.isAddEvent=n;function o(s){return s==="cell:removed"}t.isRemoveEvent=o;function a(s){return s!=null&&s.startsWith("cell:change:")}t.isChangeEvent=a;function r(s){const i=["cell:added","cell:removed","cell:change:*"],c=["batch:start","batch:stop"],d=s.eventNames?s.eventNames.filter(u=>!(t.isChangeEvent(u)||i.includes(u)||c.includes(u))):i;return Object.assign(Object.assign({enabled:!0},s),{eventNames:d,applyOptionsList:s.applyOptionsList||["propertyPath"],revertOptionsList:s.revertOptionsList||["propertyPath"]})}t.getOptions=r;function l(s){const i=[];for(let c=0,d=s.length;c<d;c+=1){const u=s[c];let f=null;if(t.isAddEvent(u.event)){const p=u.data.id;for(let m=0;m<c;m+=1)if(s[m].data.id===p){f=m;break}}f!==null?i.splice(f,0,u):i.push(u)}return i}t.sortBatchCommands=l})(ct||(ct={}));var Lm=function(t,n,o,a){var r=arguments.length,l=r<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,o):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(t,n,o,a);else for(var i=t.length-1;i>=0;i--)(s=t[i])&&(l=(r<3?s(l):r>3?s(n,o,l):s(n,o))||l);return r>3&&l&&Object.defineProperty(n,o,l),l};class Hc extends W.View{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(zt.classNames.box)}get $boxes(){return W.Dom.children(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(n){super(),this.options=n,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new W.Collection([],{comparator:zt.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){const n=this.graph,o=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!0),n.on("scale",this.onGraphTransformed,this),n.on("translate",this.onGraphTransformed,this),n.model.on("updated",this.onModelUpdated,this),o.on("added",this.onCellAdded,this),o.on("removed",this.onCellRemoved,this),o.on("reseted",this.onReseted,this),o.on("updated",this.onCollectionUpdated,this),o.on("node:change:position",this.onNodePositionChanged,this),o.on("cell:changed",this.onCellChanged,this)}stopListening(){const n=this.graph,o=this.collection;this.undelegateEvents(),n.off("scale",this.onGraphTransformed,this),n.off("translate",this.onGraphTransformed,this),n.model.off("updated",this.onModelUpdated,this),o.off("added",this.onCellAdded,this),o.off("removed",this.onCellRemoved,this),o.off("reseted",this.onReseted,this),o.off("updated",this.onCollectionUpdated,this),o.off("node:change:position",this.onNodePositionChanged,this),o.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:n,options:o}){const{showNodeSelectionBox:a,pointerEvents:r}=this.options,{ui:l,selection:s,translateBy:i,snapped:c}=o,d=(a!==!0||r&&this.getPointerEventsValue(r)==="none")&&!this.translating&&!s,u=l&&i&&n.id===i;if(d&&(u||c)){this.translating=!0;const f=n.position(),p=n.previous("position"),m=f.x-p.x,h=f.y-p.y;(m!==0||h!==0)&&this.translateSelectedNodes(m,h,n,o),this.translating=!1}}onModelUpdated({removed:n}){n&&n.length&&this.unselect(n)}isEmpty(){return this.length<=0}isSelected(n){return this.collection.has(n)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(n,o={}){o.dryrun=!0;const a=this.filter(Array.isArray(n)?n:[n]);return this.collection.add(a,o),this}unselect(n,o={}){return o.dryrun=!0,this.collection.remove(Array.isArray(n)?n:[n],o),this}reset(n,o={}){if(n){if(o.batch){const d=this.filter(Array.isArray(n)?n:[n]);return this.collection.reset(d,Object.assign(Object.assign({},o),{ui:!0})),this}const a=this.cells,r=this.filter(Array.isArray(n)?n:[n]),l={},s={};a.forEach(d=>l[d.id]=d),r.forEach(d=>s[d.id]=d);const i=[],c=[];return r.forEach(d=>{l[d.id]||i.push(d)}),a.forEach(d=>{s[d.id]||c.push(d)}),c.length&&this.unselect(c,Object.assign(Object.assign({},o),{ui:!0})),i.length&&this.select(i,Object.assign(Object.assign({},o),{ui:!0})),c.length===0&&i.length===0&&this.updateContainer(),this}return this.clean(o)}clean(n={}){return this.length&&(n.batch===!1?this.unselect(this.cells,n):this.collection.reset([],Object.assign(Object.assign({},n),{ui:!0}))),this}setFilter(n){this.options.filter=n}setContent(n){this.options.content=n}startSelecting(n){n=this.normalizeEvent(n),this.clean();let o,a;const r=this.graph.container;if(n.offsetX!=null&&n.offsetY!=null&&r.contains(n.target))o=n.offsetX,a=n.offsetY;else{const l=W.Dom.offset(r),s=r.scrollLeft,i=r.scrollTop;o=n.clientX-l.left+window.pageXOffset+s,a=n.clientY-l.top+window.pageYOffset+i}W.Dom.css(this.container,{top:a,left:o,width:1,height:1}),this.setEventData(n,{action:"selecting",clientX:n.clientX,clientY:n.clientY,offsetX:o,offsetY:a,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(zt.documentEvents,n.data)}filter(n){const o=this.options.filter;return n.filter(a=>Array.isArray(o)?o.some(r=>typeof r=="string"?a.shape===r:a.id===r.id):typeof o=="function"?W.FunctionExt.call(o,this.graph,a):!0)}stopSelecting(n){const o=this.graph,a=this.getEventData(n);switch(a.action){case"selecting":{let l=W.Dom.width(this.container),s=W.Dom.height(this.container);const i=W.Dom.offset(this.container),c=o.pageToLocal(i.left,i.top),d=o.transform.getScale();l/=d.sx,s/=d.sy;const u=new W.Rectangle(c.x,c.y,l,s),f=this.getCellViewsInArea(u).map(p=>p.cell);this.reset(f,{batch:!0}),this.hideRubberband();break}case"translating":{const l=o.snapToGrid(n.clientX,n.clientY);if(!this.options.following){const s=a;this.updateSelectedNodesPosition({dx:s.clientX-s.originX,dy:s.clientY-s.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",n,l.x,l.y);break}default:{this.clean();break}}}onMouseUp(n){this.getEventData(n).action&&(this.stopSelecting(n),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(n){this.options.following||n.stopPropagation();const o=this.normalizeEvent(n);this.options.movable&&this.startTranslating(o);const a=this.getCellViewFromElem(o.target);this.setEventData(o,{activeView:a});const r=this.graph.snapToGrid(o.clientX,o.clientY);this.notifyBoxEvent("box:mousedown",o,r.x,r.y),this.delegateDocumentEvents(zt.documentEvents,o.data)}startTranslating(n){this.graph.model.startBatch("move-selection");const o=this.graph.snapToGrid(n.clientX,n.clientY);this.setEventData(n,{action:"translating",clientX:o.x,clientY:o.y,originX:o.x,originY:o.y})}getRestrictArea(){const n=this.graph.options.translating.restrict,o=typeof n=="function"?W.FunctionExt.call(n,this.graph,null):n;return typeof o=="number"?this.graph.transform.getGraphArea().inflate(o):o===!0?this.graph.transform.getGraphArea():o||null}getSelectionOffset(n,o){let a=n.x-o.clientX,r=n.y-o.clientY;const l=this.getRestrictArea();if(l){const s=this.collection.toArray(),i=W.Cell.getCellsBBox(s,{deep:!0})||W.Rectangle.create(),c=l.x-i.x,d=l.y-i.y,u=l.x+l.width-(i.x+i.width),f=l.y+l.height-(i.y+i.height);if(a<c&&(a=c),r<d&&(r=d),u<a&&(a=u),f<r&&(r=f),!this.options.following){const p=n.x-o.originX,m=n.y-o.originY;a=p<=c||p>=u?0:a,r=m<=d||m>=f?0:r}}return{dx:a,dy:r}}updateElementPosition(n,o,a){const r=W.Dom.css(n,"left"),l=W.Dom.css(n,"top"),s=r?parseFloat(r):0,i=l?parseFloat(l):0;W.Dom.css(n,"left",s+o),W.Dom.css(n,"top",i+a)}updateSelectedNodesPosition(n){const{dx:o,dy:a}=n;if(o||a)if(this.translateSelectedNodes(o,a),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const r=this.graph.transform.getScale();for(let l=0,s=this.$boxes,i=s.length;l<i;l+=1)this.updateElementPosition(s[l],o*r.sx,a*r.sy);this.updateElementPosition(this.selectionContainer,o*r.sx,a*r.sy)}}autoScrollGraph(n,o){const a=this.graph.getPlugin("scroller");return a?a.autoScroll(n,o):{scrollerX:0,scrollerY:0}}adjustSelection(n){const o=this.normalizeEvent(n),a=this.getEventData(o);switch(a.action){case"selecting":{const l=a;l.moving!==!0&&(W.Dom.appendTo(this.container,this.graph.container),this.showRubberband(),l.moving=!0);const{scrollerX:s,scrollerY:i}=this.autoScrollGraph(o.clientX,o.clientY);l.scrollerX+=s,l.scrollerY+=i;const c=o.clientX-l.clientX+l.scrollerX,d=o.clientY-l.clientY+l.scrollerY,u=parseInt(W.Dom.css(this.container,"left")||"0",10),f=parseInt(W.Dom.css(this.container,"top")||"0",10);W.Dom.css(this.container,{left:c<0?l.offsetX+c:u,top:d<0?l.offsetY+d:f,width:Math.abs(c),height:Math.abs(d)});break}case"translating":{const l=this.graph.snapToGrid(o.clientX,o.clientY),s=a,i=this.getSelectionOffset(l,s);this.options.following?this.updateSelectedNodesPosition(i):this.updateContainerPosition(i),i.dx&&(s.clientX=l.x),i.dy&&(s.clientY=l.y),this.notifyBoxEvent("box:mousemove",n,l.x,l.y);break}}this.boxesUpdated=!1}translateSelectedNodes(n,o,a,r){const l={},s=[];if(a&&(l[a.id]=!0),this.collection.toArray().forEach(i=>{i.getDescendants({deep:!0}).forEach(c=>{l[c.id]=!0})}),r&&r.translateBy){const i=this.graph.getCellById(r.translateBy);i&&(l[i.id]=!0,i.getDescendants({deep:!0}).forEach(c=>{l[c.id]=!0}),s.push(i))}this.collection.toArray().forEach(i=>{if(!l[i.id]){const c=Object.assign(Object.assign({},r),{selection:this.cid,exclude:s});i.translate(n,o,c),this.graph.model.getConnectedEdges(i).forEach(d=>{l[d.id]||(d.translate(n,o,c),l[d.id]=!0)})}})}getCellViewsInArea(n){const o=this.graph,a={strict:this.options.strict};let r=[];return this.options.rubberNode&&(r=r.concat(o.model.getNodesInArea(n,a).map(l=>o.renderer.findViewByCell(l)).filter(l=>l!=null))),this.options.rubberEdge&&(r=r.concat(o.model.getEdgesInArea(n,a).map(l=>o.renderer.findViewByCell(l)).filter(l=>l!=null))),r}notifyBoxEvent(n,o,a,r){const s=this.getEventData(o).activeView;this.trigger(n,{e:o,view:s,x:a,y:r,cell:s.cell})}getSelectedClassName(n){return this.prefixClassName(`${n.isNode()?"node":"edge"}-selected`)}addCellSelectedClassName(n){const o=this.graph.renderer.findViewByCell(n);o&&o.addClass(this.getSelectedClassName(n))}removeCellUnSelectedClassName(n){const o=this.graph.renderer.findViewByCell(n);o&&o.removeClass(this.getSelectedClassName(n))}destroySelectionBox(n){this.removeCellUnSelectedClassName(n),this.canShowSelectionBox(n)&&(W.Dom.remove(this.container.querySelector(`[data-cell-id="${n.id}"]`)),this.$boxes.length===0&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(n){n.forEach(o=>this.removeCellUnSelectedClassName(o)),this.hide(),W.Dom.remove(this.$boxes),this.boxCount=0}hide(){W.Dom.removeClass(this.container,this.prefixClassName(zt.classNames.rubberband)),W.Dom.removeClass(this.container,this.prefixClassName(zt.classNames.selected))}showRubberband(){W.Dom.addClass(this.container,this.prefixClassName(zt.classNames.rubberband))}hideRubberband(){W.Dom.removeClass(this.container,this.prefixClassName(zt.classNames.rubberband))}showSelected(){W.Dom.removeAttribute(this.container,"style"),W.Dom.addClass(this.container,this.prefixClassName(zt.classNames.selected))}createContainer(){this.container=document.createElement("div"),W.Dom.addClass(this.container,this.prefixClassName(zt.classNames.root)),this.options.className&&W.Dom.addClass(this.container,this.options.className),this.selectionContainer=document.createElement("div"),W.Dom.addClass(this.selectionContainer,this.prefixClassName(zt.classNames.inner)),this.selectionContent=document.createElement("div"),W.Dom.addClass(this.selectionContent,this.prefixClassName(zt.classNames.content)),W.Dom.append(this.selectionContainer,this.selectionContent),W.Dom.attr(this.selectionContainer,"data-selection-length",this.collection.length),W.Dom.prepend(this.container,this.selectionContainer)}updateContainerPosition(n){(n.dx||n.dy)&&this.updateElementPosition(this.selectionContainer,n.dx,n.dy)}updateContainer(){const n={x:1/0,y:1/0},o={x:0,y:0};this.collection.toArray().filter(l=>this.canShowSelectionBox(l)).forEach(l=>{const s=this.graph.renderer.findViewByCell(l);if(s){const i=s.getBBox({useCellGeometry:!0});n.x=Math.min(n.x,i.x),n.y=Math.min(n.y,i.y),o.x=Math.max(o.x,i.x+i.width),o.y=Math.max(o.y,i.y+i.height)}}),W.Dom.css(this.selectionContainer,{position:"absolute",pointerEvents:"none",left:n.x,top:n.y,width:o.x-n.x,height:o.y-n.y}),W.Dom.attr(this.selectionContainer,"data-selection-length",this.collection.length);const r=this.options.content;if(r)if(typeof r=="function"){const l=W.FunctionExt.call(r,this.graph,this,this.selectionContent);l&&(this.selectionContent.innerHTML=l)}else this.selectionContent.innerHTML=r;this.collection.length>0&&!this.container.parentNode?W.Dom.appendTo(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(n){return n.isNode()&&this.options.showNodeSelectionBox===!0||n.isEdge()&&this.options.showEdgeSelectionBox===!0}getPointerEventsValue(n){return typeof n=="string"?n:n(this.cells)}createSelectionBox(n){if(this.addCellSelectedClassName(n),this.canShowSelectionBox(n)){const o=this.graph.renderer.findViewByCell(n);if(o){const a=o.getBBox({useCellGeometry:!0}),r=this.boxClassName,l=document.createElement("div"),s=this.options.pointerEvents;W.Dom.addClass(l,r),W.Dom.addClass(l,`${r}-${n.isNode()?"node":"edge"}`),W.Dom.attr(l,"data-cell-id",n.id),W.Dom.css(l,{position:"absolute",left:a.x,top:a.y,width:a.width,height:a.height,pointerEvents:s?this.getPointerEventsValue(s):"auto"}),W.Dom.appendTo(l,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let n=0,o=this.$boxes,a=o.length;n<a;n+=1){const r=o[n],l=W.Dom.attr(r,"data-cell-id");W.Dom.remove(r),this.boxCount-=1;const s=this.collection.get(l);s&&this.createSelectionBox(s)}this.updateContainer()}return 0}getCellViewFromElem(n){const o=n.getAttribute("data-cell-id");if(o){const a=this.collection.get(o);if(a)return this.graph.renderer.findViewByCell(a)}return null}onCellRemoved({cell:n}){this.destroySelectionBox(n),this.updateContainer()}onReseted({previous:n,current:o}){this.destroyAllSelectionBoxes(n),o.forEach(a=>{this.listenCellRemoveEvent(a),this.createSelectionBox(a)}),this.updateContainer()}onCellAdded({cell:n}){this.listenCellRemoveEvent(n),this.createSelectionBox(n),this.updateContainer()}listenCellRemoveEvent(n){n.off("removed",this.onCellRemoved,this),n.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:n,removed:o,options:a}){n.forEach(l=>{this.trigger("cell:selected",{cell:l,options:a}),l.isNode()?this.trigger("node:selected",{cell:l,options:a,node:l}):l.isEdge()&&this.trigger("edge:selected",{cell:l,options:a,edge:l})}),o.forEach(l=>{this.trigger("cell:unselected",{cell:l,options:a}),l.isNode()?this.trigger("node:unselected",{cell:l,options:a,node:l}):l.isEdge()&&this.trigger("edge:unselected",{cell:l,options:a,edge:l})});const r={added:n,removed:o,options:a,selected:this.cells.filter(l=>!!this.graph.getCellById(l.id))};this.trigger("selection:changed",r)}dispose(){this.clean(),this.remove(),this.off()}}Lm([W.View.dispose()],Hc.prototype,"dispose",null);var zt;(function(t){const n="widget-selection";t.classNames={root:n,inner:`${n}-inner`,box:`${n}-box`,content:`${n}-content`,rubberband:`${n}-rubberband`,selected:`${n}-selected`},t.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"};function o(a){return a.getAncestors().length}t.depthComparator=o})(zt||(zt={}));const Fm=`.x6-widget-selection { position: absolute; top: 0; left: 0; display: none; width: 0; height: 0; touch-action: none; } .x6-widget-selection-rubberband { display: block; overflow: visible; opacity: 0.3; } .x6-widget-selection-selected { display: block; } .x6-widget-selection-box { cursor: move; } .x6-widget-selection-inner[data-selection-length='0'], .x6-widget-selection-inner[data-selection-length='1'] { display: none; } .x6-widget-selection-content { position: absolute; top: 100%; right: -20px; left: -20px; margin-top: 30px; padding: 6px; line-height: 14px; text-align: center; border-radius: 6px; } .x6-widget-selection-content:empty { display: none; } .x6-widget-selection-rubberband { background-color: #3498db; border: 2px solid #2980b9; } .x6-widget-selection-box { box-sizing: content-box !important; margin-top: -4px; margin-left: -4px; padding-right: 4px; padding-bottom: 4px; border: 2px dashed #feb663; box-shadow: 2px 2px 5px #d3d3d3; } .x6-widget-selection-inner { box-sizing: content-box !important; margin-top: -8px; margin-left: -8px; padding-right: 12px; padding-bottom: 12px; border: 2px solid #feb663; box-shadow: 2px 2px 5px #d3d3d3; } .x6-widget-selection-content { color: #fff; font-size: 10px; background-color: #6a6b8a; } `;W.Graph.prototype.isSelectionEnabled=function(){const t=this.getPlugin("selection");return t?t.isEnabled():!1},W.Graph.prototype.enableSelection=function(){const t=this.getPlugin("selection");return t&&t.enable(),this},W.Graph.prototype.disableSelection=function(){const t=this.getPlugin("selection");return t&&t.disable(),this},W.Graph.prototype.toggleSelection=function(t){const n=this.getPlugin("selection");return n&&n.toggleEnabled(t),this},W.Graph.prototype.isMultipleSelection=function(){const t=this.getPlugin("selection");return t?t.isMultipleSelection():!1},W.Graph.prototype.enableMultipleSelection=function(){const t=this.getPlugin("selection");return t&&t.enableMultipleSelection(),this},W.Graph.prototype.disableMultipleSelection=function(){const t=this.getPlugin("selection");return t&&t.disableMultipleSelection(),this},W.Graph.prototype.toggleMultipleSelection=function(t){const n=this.getPlugin("selection");return n&&n.toggleMultipleSelection(t),this},W.Graph.prototype.isSelectionMovable=function(){const t=this.getPlugin("selection");return t?t.isSelectionMovable():!1},W.Graph.prototype.enableSelectionMovable=function(){const t=this.getPlugin("selection");return t&&t.enableSelectionMovable(),this},W.Graph.prototype.disableSelectionMovable=function(){const t=this.getPlugin("selection");return t&&t.disableSelectionMovable(),this},W.Graph.prototype.toggleSelectionMovable=function(t){const n=this.getPlugin("selection");return n&&n.toggleSelectionMovable(t),this},W.Graph.prototype.isRubberbandEnabled=function(){const t=this.getPlugin("selection");return t?t.isRubberbandEnabled():!1},W.Graph.prototype.enableRubberband=function(){const t=this.getPlugin("selection");return t&&t.enableRubberband(),this},W.Graph.prototype.disableRubberband=function(){const t=this.getPlugin("selection");return t&&t.disableRubberband(),this},W.Graph.prototype.toggleRubberband=function(t){const n=this.getPlugin("selection");return n&&n.toggleRubberband(t),this},W.Graph.prototype.isStrictRubberband=function(){const t=this.getPlugin("selection");return t?t.isStrictRubberband():!1},W.Graph.prototype.enableStrictRubberband=function(){const t=this.getPlugin("selection");return t&&t.enableStrictRubberband(),this},W.Graph.prototype.disableStrictRubberband=function(){const t=this.getPlugin("selection");return t&&t.disableStrictRubberband(),this},W.Graph.prototype.toggleStrictRubberband=function(t){const n=this.getPlugin("selection");return n&&n.toggleStrictRubberband(t),this},W.Graph.prototype.setRubberbandModifiers=function(t){const n=this.getPlugin("selection");return n&&n.setRubberbandModifiers(t),this},W.Graph.prototype.setSelectionFilter=function(t){const n=this.getPlugin("selection");return n&&n.setSelectionFilter(t),this},W.Graph.prototype.setSelectionDisplayContent=function(t){const n=this.getPlugin("selection");return n&&n.setSelectionDisplayContent(t),this},W.Graph.prototype.isSelectionEmpty=function(){const t=this.getPlugin("selection");return t?t.isEmpty():!0},W.Graph.prototype.cleanSelection=function(t){const n=this.getPlugin("selection");return n&&n.clean(t),this},W.Graph.prototype.resetSelection=function(t,n){const o=this.getPlugin("selection");return o&&o.reset(t,n),this},W.Graph.prototype.getSelectedCells=function(){const t=this.getPlugin("selection");return t?t.getSelectedCells():[]},W.Graph.prototype.getSelectedCellCount=function(){const t=this.getPlugin("selection");return t?t.getSelectedCellCount():0},W.Graph.prototype.isSelected=function(t){const n=this.getPlugin("selection");return n?n.isSelected(t):!1},W.Graph.prototype.select=function(t,n){const o=this.getPlugin("selection");return o&&o.select(t,n),this},W.Graph.prototype.unselect=function(t,n){const o=this.getPlugin("selection");return o&&o.unselect(t,n),this};var zm=function(t,n,o,a){var r=arguments.length,l=r<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,o):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(t,n,o,a);else for(var i=t.length-1;i>=0;i--)(s=t[i])&&(l=(r<3?s(l):r>3?s(n,o,l):s(n,o))||l);return r>3&&l&&Object.defineProperty(n,o,l),l};class Zo extends W.Basecoat{get rubberbandDisabled(){return this.options.enabled!==!0||this.options.rubberband!==!0}get disabled(){return this.options.enabled!==!0}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(n={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},Zo.defaultOptions),n),W.CssLoader.ensure(this.name,Fm)}init(n){this.graph=n,this.selectionImpl=new Hc(Object.assign(Object.assign({},this.options),{graph:n})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(n){return n!=null?n!==this.isEnabled()&&(n?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(n){return n!=null?n!==this.isMultipleSelection()&&(n?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return this.options.movable!==!1}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(n){return n!=null?n!==this.isSelectionMovable()&&(n?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(n){return n!=null?n!==this.isRubberbandEnabled()&&(n?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return this.selectionImpl.options.strict===!0}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(n){return n!=null?n!==this.isStrictRubberband()&&(n?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(n){this.setModifiers(n)}setSelectionFilter(n){return this.setFilter(n),this}setSelectionDisplayContent(n){return this.setContent(n),this}isEmpty(){return this.length<=0}clean(n={}){return this.selectionImpl.clean(n),this}reset(n,o={}){return this.selectionImpl.reset(n?this.getCells(n):[],o),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(n){return this.selectionImpl.isSelected(n)}select(n,o={}){const a=this.getCells(n);return a.length&&(this.isMultiple()?this.selectionImpl.select(a,o):this.reset(a.slice(0,1),o)),this}unselect(n,o={}){return this.selectionImpl.unselect(this.getCells(n),o),this}setup(){this.selectionImpl.on("*",(n,o)=>{this.trigger(n,o),this.graph.trigger(n,o)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:n}){if(!this.allowBlankMouseDown(n))return;const o=this.graph.panning.allowPanning(n,!0),a=this.graph.getPlugin("scroller"),r=a&&a.allowPanning(n,!0);(this.allowRubberband(n,!0)||this.allowRubberband(n)&&!r&&!o)&&this.startRubberband(n)}allowBlankMouseDown(n){const o=this.options.eventTypes;return(o==null?void 0:o.includes("leftMouseDown"))&&n.button===0||(o==null?void 0:o.includes("mouseWheelDown"))&&n.button===1}onBlankClick(){this.clean()}allowRubberband(n,o){return!this.rubberbandDisabled&&W.ModifierKey.isMatch(n,this.options.modifiers,o)}allowMultipleSelection(n){return this.isMultiple()&&W.ModifierKey.isMatch(n,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:n}){this.movedMap.set(n,!0)}onCellMouseUp({e:n,cell:o}){const a=this.options;let r=this.disabled;!r&&this.movedMap.has(o)&&(r=a.selectCellOnMoved===!1,r||(r=a.selectNodeOnMoved===!1&&o.isNode()),r||(r=a.selectEdgeOnMoved===!1&&o.isEdge())),r||(this.allowMultipleSelection(n)?this.unselectMap.has(o)?this.unselectMap.delete(o):this.isSelected(o)?this.unselect(o):this.select(o):this.reset(o)),this.movedMap.delete(o)}onBoxMouseDown({e:n,cell:o}){this.disabled||this.allowMultipleSelection(n)&&(this.unselect(o),this.unselectMap.set(o,!0))}getCells(n){return(Array.isArray(n)?n:[n]).map(o=>typeof o=="string"?this.graph.getCellById(o):o).filter(o=>o!=null)}startRubberband(n){return this.rubberbandDisabled||this.selectionImpl.startSelecting(n),this}isMultiple(){return this.options.multiple!==!1}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(n){return this.options.modifiers=n,this}setContent(n){return this.selectionImpl.setContent(n),this}setFilter(n){return this.selectionImpl.setFilter(n),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),W.CssLoader.clean(this.name)}}zm([W.Basecoat.dispose()],Zo.prototype,"dispose",null),function(t){t.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]}}(Zo||(Zo={}));function Tn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bs={exports:{}},Kc;function $m(){return Kc||(Kc=1,function(t){(function(n,o,a){if(!n)return;for(var r={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},l={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},s={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},i={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},c,d=1;d<20;++d)r[111+d]="f"+d;for(d=0;d<=9;++d)r[d+96]=d.toString();function u(S,v,N){if(S.addEventListener){S.addEventListener(v,N,!1);return}S.attachEvent("on"+v,N)}function f(S){if(S.type=="keypress"){var v=String.fromCharCode(S.which);return S.shiftKey||(v=v.toLowerCase()),v}return r[S.which]?r[S.which]:l[S.which]?l[S.which]:String.fromCharCode(S.which).toLowerCase()}function p(S,v){return S.sort().join(",")===v.sort().join(",")}function m(S){var v=[];return S.shiftKey&&v.push("shift"),S.altKey&&v.push("alt"),S.ctrlKey&&v.push("ctrl"),S.metaKey&&v.push("meta"),v}function h(S){if(S.preventDefault){S.preventDefault();return}S.returnValue=!1}function b(S){if(S.stopPropagation){S.stopPropagation();return}S.cancelBubble=!0}function C(S){return S=="shift"||S=="ctrl"||S=="alt"||S=="meta"}function y(){if(!c){c={};for(var S in r)S>95&&S<112||r.hasOwnProperty(S)&&(c[r[S]]=S)}return c}function x(S,v,N){return N||(N=y()[S]?"keydown":"keypress"),N=="keypress"&&v.length&&(N="keydown"),N}function E(S){return S==="+"?["+"]:(S=S.replace(/\+{2}/g,"+plus"),S.split("+"))}function g(S,v){var N,B,O,M=[];for(N=E(S),O=0;O<N.length;++O)B=N[O],i[B]&&(B=i[B]),v&&v!="keypress"&&s[B]&&(B=s[B],M.push("shift")),C(B)&&M.push(B);return v=x(B,M,v),{key:B,modifiers:M,action:v}}function w(S,v){return S===null||S===o?!1:S===v?!0:w(S.parentNode,v)}function k(S){var v=this;if(S=S||o,!(v instanceof k))return new k(S);v.target=S,v._callbacks={},v._directMap={};var N={},B,O=!1,M=!1,A=!1;function Y(D){D=D||{};var K=!1,_;for(_ in N){if(D[_]){K=!0;continue}N[_]=0}K||(A=!1)}function L(D,K,_,z,$,U){var H,I,Z=[],q=_.type;if(!v._callbacks[D])return[];for(q=="keyup"&&C(D)&&(K=[D]),H=0;H<v._callbacks[D].length;++H)if(I=v._callbacks[D][H],!(!z&&I.seq&&N[I.seq]!=I.level)&&q==I.action&&(q=="keypress"&&!_.metaKey&&!_.ctrlKey||p(K,I.modifiers))){var ne=!z&&I.combo==$,se=z&&I.seq==z&&I.level==U;(ne||se)&&v._callbacks[D].splice(H,1),Z.push(I)}return Z}function j(D,K,_,z){v.stopCallback(K,K.target||K.srcElement,_,z)||D(K,_)===!1&&(h(K),b(K))}v._handleKey=function(D,K,_){var z=L(D,K,_),$,U={},H=0,I=!1;for($=0;$<z.length;++$)z[$].seq&&(H=Math.max(H,z[$].level));for($=0;$<z.length;++$){if(z[$].seq){if(z[$].level!=H)continue;I=!0,U[z[$].seq]=1,j(z[$].callback,_,z[$].combo,z[$].seq);continue}I||j(z[$].callback,_,z[$].combo)}var Z=_.type=="keypress"&&M;_.type==A&&!C(D)&&!Z&&Y(U),M=I&&_.type=="keydown"};function R(D){typeof D.which!="number"&&(D.which=D.keyCode);var K=f(D);if(K){if(D.type=="keyup"&&O===K){O=!1;return}v.handleKey(K,m(D),D)}}function V(){clearTimeout(B),B=setTimeout(Y,1e3)}function T(D,K,_,z){N[D]=0;function $(q){return function(){A=q,++N[D],V()}}function U(q){j(_,q,D),z!=="keyup"&&(O=f(q)),setTimeout(Y,10)}for(var H=0;H<K.length;++H){var I=H+1===K.length,Z=I?U:$(z||g(K[H+1]).action);P(K[H],Z,z,D,H)}}function P(D,K,_,z,$){v._directMap[D+":"+_]=K,D=D.replace(/\s+/g," ");var U=D.split(" "),H;if(U.length>1){T(D,U,K,_);return}H=g(D,_),v._callbacks[H.key]=v._callbacks[H.key]||[],L(H.key,H.modifiers,{type:H.action},z,D,$),v._callbacks[H.key][z?"unshift":"push"]({callback:K,modifiers:H.modifiers,action:H.action,seq:z,level:$,combo:D})}v._bindMultiple=function(D,K,_){for(var z=0;z<D.length;++z)P(D[z],K,_)},u(S,"keypress",R),u(S,"keydown",R),u(S,"keyup",R)}k.prototype.bind=function(S,v,N){var B=this;return S=S instanceof Array?S:[S],B._bindMultiple.call(B,S,v,N),B},k.prototype.unbind=function(S,v){var N=this;return N.bind.call(N,S,function(){},v)},k.prototype.trigger=function(S,v){var N=this;return N._directMap[S+":"+v]&&N._directMap[S+":"+v]({},S),N},k.prototype.reset=function(){var S=this;return S._callbacks={},S._directMap={},S},k.prototype.stopCallback=function(S,v){var N=this;if((" "+v.className+" ").indexOf(" mousetrap ")>-1||w(v,N.target))return!1;if("composedPath"in S&&typeof S.composedPath=="function"){var B=S.composedPath()[0];B!==S.target&&(v=B)}return v.tagName=="INPUT"||v.tagName=="SELECT"||v.tagName=="TEXTAREA"||v.isContentEditable},k.prototype.handleKey=function(){var S=this;return S._handleKey.apply(S,arguments)},k.addKeycodes=function(S){for(var v in S)S.hasOwnProperty(v)&&(r[v]=S[v]);c=null},k.init=function(){var S=k(o);for(var v in S)v.charAt(0)!=="_"&&(k[v]=function(N){return function(){return S[N].apply(S,arguments)}}(v))},k.init(),n.Mousetrap=k,t.exports&&(t.exports=k)})(typeof window<"u"?window:null,typeof window<"u"?document:null)}(bs)),bs.exports}var Um=$m();const Hm=Tn(Um);var Km=function(t,n,o,a){var r=arguments.length,l=r<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,o):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(t,n,o,a);else for(var i=t.length-1;i>=0;i--)(s=t[i])&&(l=(r<3?s(l):r>3?s(n,o,l):s(n,o))||l);return r>3&&l&&Object.defineProperty(n,o,l),l};class Jo extends W.Disposable{get graph(){return this.options.graph}constructor(n){super(),this.options=n;const o=this.graph.getPlugin("scroller");this.container=o?o.container:this.graph.container,n.global?this.target=document:(this.target=this.container,this.disabled||this.target.setAttribute("tabindex","-1"),this.graph.on("cell:mouseup",this.focus,this),this.graph.on("blank:mouseup",this.focus,this)),this.mousetrap=Jo.createMousetrap(this)}get disabled(){return this.options.enabled!==!0}enable(){this.disabled&&(this.options.enabled=!0,this.target instanceof HTMLElement&&this.target.setAttribute("tabindex","-1"))}disable(){this.disabled||(this.options.enabled=!1,this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))}on(n,o,a){this.mousetrap.bind(this.getKeys(n),o,a)}off(n,o){this.mousetrap.unbind(this.getKeys(n),o)}clear(){this.mousetrap.reset()}trigger(n,o){this.mousetrap.trigger(n,o)}focus(n){if(this.isInputEvent(n.e))return;this.target.focus({preventScroll:!0})}getKeys(n){return(Array.isArray(n)?n:[n]).map(o=>this.formatkey(o))}formatkey(n){const o=n.toLocaleLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command").replace("arrowup","up").replace("arrowright","right").replace("arrowdown","down").replace("arrowleft","left"),a=this.options.format;return a?W.FunctionExt.call(a,this.graph,o):o}isGraphEvent(n){const o=n.target,a=n.currentTarget;return o?o===this.target||a===this.target||o===document.body?!0:W.Dom.contains(this.container,o):!1}isInputEvent(n){var o;const a=n.target,r=(o=a==null?void 0:a.tagName)===null||o===void 0?void 0:o.toLowerCase();let l=["input","textarea"].includes(r);return W.Dom.attr(a,"contenteditable")==="true"&&(l=!0),l}isEnabledForEvent(n){const o=!this.disabled&&this.isGraphEvent(n),a=this.isInputEvent(n);if(o){if(a&&(n.key==="Backspace"||n.key==="Delete"))return!1;if(this.options.guard)return W.FunctionExt.call(this.options.guard,this.graph,n)}return o}dispose(){this.mousetrap.reset()}}Km([W.Disposable.dispose()],Jo.prototype,"dispose",null),function(t){function n(o){const a=new Hm(o.target),r=a.stopCallback;return a.stopCallback=(l,s,i)=>o.isEnabledForEvent(l)?r?r.call(a,l,s,i):!1:!0,a}t.createMousetrap=n}(Jo||(Jo={})),W.Graph.prototype.isKeyboardEnabled=function(){const t=this.getPlugin("keyboard");return t?t.isEnabled():!1},W.Graph.prototype.enableKeyboard=function(){const t=this.getPlugin("keyboard");return t&&t.enable(),this},W.Graph.prototype.disableKeyboard=function(){const t=this.getPlugin("keyboard");return t&&t.disable(),this},W.Graph.prototype.toggleKeyboard=function(t){const n=this.getPlugin("keyboard");return n&&n.toggleEnabled(t),this},W.Graph.prototype.bindKey=function(t,n,o){const a=this.getPlugin("keyboard");return a&&a.bindKey(t,n,o),this},W.Graph.prototype.unbindKey=function(t,n){const o=this.getPlugin("keyboard");return o&&o.unbindKey(t,n),this},W.Graph.prototype.clearKeys=function(){const t=this.getPlugin("keyboard");return t&&t.clear(),this},W.Graph.prototype.triggerKey=function(t,n){const o=this.getPlugin("keyboard");return o&&o.trigger(t,n),this};var jm=function(t,n,o,a){var r=arguments.length,l=r<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,o):a,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(t,n,o,a);else for(var i=t.length-1;i>=0;i--)(s=t[i])&&(l=(r<3?s(l):r>3?s(n,o,l):s(n,o))||l);return r>3&&l&&Object.defineProperty(n,o,l),l};class jc extends W.Disposable{constructor(n={}){super(),this.name="keyboard",this.options=Object.assign({enabled:!0},n)}init(n){this.keyboardImpl=new Jo(Object.assign(Object.assign({},this.options),{graph:n}))}isEnabled(){return!this.keyboardImpl.disabled}enable(){this.keyboardImpl.enable()}disable(){this.keyboardImpl.disable()}toggleEnabled(n){return n!=null?n!==this.isEnabled()&&(n?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}bindKey(n,o,a){return this.keyboardImpl.on(n,o,a),this}trigger(n,o){return this.keyboardImpl.trigger(n,o),this}clear(){return this.keyboardImpl.clear(),this}unbindKey(n,o){return this.keyboardImpl.off(n,o),this}dispose(){this.keyboardImpl.dispose()}}jm([W.Disposable.dispose()],jc.prototype,"dispose",null);var Ir={exports:{}},Wm=Ir.exports,Wc;function Ym(){return Wc||(Wc=1,function(t,n){(function(o,a){t.exports=a()})(Wm,function(){return function(o,a,r){r.updateLocale=function(l,s){var i=r.Ls[l];if(i)return(s?Object.keys(s):[]).forEach(function(c){i[c]=s[c]}),i}}})}(Ir)),Ir.exports}var Gm=Ym();const qm=Tn(Gm);var Lr={exports:{}},Xm=Lr.exports,Yc;function Zm(){return Yc||(Yc=1,function(t,n){(function(o,a){t.exports=a()})(Xm,function(){var o="month",a="quarter";return function(r,l){var s=l.prototype;s.quarter=function(d){return this.$utils().u(d)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(d-1))};var i=s.add;s.add=function(d,u){return d=Number(d),this.$utils().p(u)===a?this.add(3*d,o):i.bind(this)(d,u)};var c=s.startOf;s.startOf=function(d,u){var f=this.$utils(),p=!!f.u(u)||u;if(f.p(d)===a){var m=this.quarter()-1;return p?this.month(3*m).startOf(o).startOf("day"):this.month(3*m+2).endOf(o).endOf("day")}return c.bind(this)(d,u)}}})}(Lr)),Lr.exports}Zm();var Fr={exports:{}},Jm=Fr.exports,Gc;function Qm(){return Gc||(Gc=1,function(t,n){(function(o,a){t.exports=a()})(Jm,function(){var o={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},a=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,l=/\d\d/,s=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,c={},d=function(C){return(C=+C)+(C>68?1900:2e3)},u=function(C){return function(y){this[C]=+y}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(C){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var x=y.mat