").addClass(this.prefixClassName(XA.viewport)),this.options.scalable&&(this.zoomHandle=this.$("
").addClass(this.prefixClassName(XA.zoom)).appendTo(this.$viewport).get(0)),this.$container.append(this.$viewport).css({width:this.options.width,height:this.options.height,padding:this.options.padding}),this.options.container&&this.options.container.appendChild(this.container),this.sourceGraph=this.graph;const n=Object.assign(Object.assign({},this.options.graphOptions),{container:e,model:this.sourceGraph.model,frozen:!0,async:this.sourceGraph.isAsync(),interacting:!1,grid:!1,background:!1,rotating:!1,resizing:!1,embedding:!1,selecting:!1,snapline:!1,clipboard:!1,history:!1,scroller:!1});this.targetGraph=this.options.createGraph?this.options.createGraph(n):new hk(n),this.targetGraph.renderer.unfreeze(),this.updatePaper(this.sourceGraph.options.width,this.sourceGraph.options.height),this.startListening()}get graph(){return this.options.graph}get scroller(){return this.graph.scroller.widget}get graphContainer(){return this.scroller?this.scroller.container:this.graph.container}get $graphContainer(){return this.scroller?this.scroller.$container:this.$(this.graph.container)}startListening(){this.scroller?this.$graphContainer.on(`scroll${this.getEventNamespace()}`,this.updateViewport):(this.sourceGraph.on("translate",this.onSourceGraphTransform,this),this.sourceGraph.on("scale",this.onSourceGraphTransform,this)),this.sourceGraph.on("resize",this.updatePaper,this),this.delegateEvents({mousedown:"startAction",touchstart:"startAction",[`mousedown .${this.prefixClassName("graph")}`]:"scrollTo",[`touchstart .${this.prefixClassName("graph")}`]:"scrollTo"})}stopListening(){this.scroller?this.$graphContainer.off(this.getEventNamespace()):(this.sourceGraph.off("translate",this.onSourceGraphTransform,this),this.sourceGraph.off("scale",this.onSourceGraphTransform,this)),this.sourceGraph.off("resize",this.updatePaper,this),this.undelegateEvents()}onRemove(){this.targetGraph.view.remove(),this.stopListening(),this.targetGraph.dispose()}onSourceGraphTransform(){this.targetGraphTransforming?this.updateViewport():this.updatePaper(this.sourceGraph.options.width,this.sourceGraph.options.height)}updatePaper(t,e){let n,i;"object"===typeof t?(n=t.width,i=t.height):(n=t,i=e);const s=this.sourceGraph.options,r=this.sourceGraph.transform.getScale(),o=this.options.width-2*this.options.padding,a=this.options.height-2*this.options.padding;n/=r.sx,i/=r.sy,this.ratio=Math.min(o/n,a/i);const l=this.ratio,c=s.x*l/r.sx,h=s.y*l/r.sy;return n*=l,i*=l,this.targetGraph.resizeGraph(n,i),this.targetGraph.translate(c,h),this.targetGraph.scale(l,l),this.updateViewport(),this}updateViewport(){const t=this.ratio,e=this.sourceGraph.transform.getScale();let n=null;if(this.scroller)n=this.scroller.clientToLocalPoint(0,0);else{const t=this.sourceGraph.matrix();n=new jy(-t.e/t.a,-t.f/t.d)}const i=this.$(this.targetGraph.container).position(),s=this.targetGraph.translate();s.ty=s.ty||0,this.geometry={top:i.top+n.y*t+s.ty,left:i.left+n.x*t+s.tx,width:this.$graphContainer.innerWidth()*t/e.sx,height:this.$graphContainer.innerHeight()*t/e.sy},this.$viewport.css(this.geometry)}startAction(t){const e=this.normalizeEvent(t),n=e.target===this.zoomHandle?"zooming":"panning",{tx:i,ty:s}=this.sourceGraph.translate(),r={action:n,clientX:e.clientX,clientY:e.clientY,scrollLeft:this.graphContainer.scrollLeft,scrollTop:this.graphContainer.scrollTop,zoom:this.sourceGraph.zoom(),scale:this.sourceGraph.transform.getScale(),geometry:this.geometry,translateX:i,translateY:s};this.targetGraphTransforming=!0,this.delegateDocumentEvents(YA.documentEvents,r)}doAction(t){const e=this.normalizeEvent(t),n=e.clientX,i=e.clientY,s=e.data;switch(s.action){case"panning":{const t=this.sourceGraph.transform.getScale(),e=(n-s.clientX)*t.sx,r=(i-s.clientY)*t.sy;this.scroller?(this.graphContainer.scrollLeft=s.scrollLeft+e/this.ratio,this.graphContainer.scrollTop=s.scrollTop+r/this.ratio):this.sourceGraph.translate(s.translateX-e/this.ratio,s.translateY-r/this.ratio);break}case"zooming":{const t=s.scale,e=s.geometry,i=1+(s.clientX-n)/e.width/t.sx;s.frameId&&cancelAnimationFrame(s.frameId),s.frameId=requestAnimationFrame((()=>{this.sourceGraph.zoom(i*s.zoom,{absolute:!0,minScale:this.options.minScale,maxScale:this.options.maxScale})}));break}default:break}}stopAction(){this.undelegateDocumentEvents(),this.targetGraphTransforming=!1}scrollTo(t){const e=this.normalizeEvent(t);let n,i;const s=this.targetGraph.translate();if(s.ty=s.ty||0,null==e.offsetX){const t=this.$(this.targetGraph.container).offset();n=e.pageX-t.left,i=e.pageY-t.top}else n=e.offsetX,i=e.offsetY;const r=(n-s.tx)/this.ratio,o=(i-s.ty)/this.ratio;this.sourceGraph.centerPoint(r,o)}dispose(){this.remove()}}JA([Ex.dispose()],ZA.prototype,"dispose",null),function(t){t.defaultOptions={width:300,height:200,padding:10,scalable:!0,minScale:.01,maxScale:16,graphOptions:{},createGraph:t=>new hk(t)},t.documentEvents={mousemove:"doAction",touchmove:"doAction",mouseup:"stopAction",touchend:"stopAction"}}(YA||(YA={}));var KA=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},QA=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s
{"string"===typeof t?this.filterShapes[t]=!0:this.filterCells[t.id]=!0})):"function"===typeof t&&(this.filterFunction=t)}onBatchStop({name:t,data:e}){"resize"===t&&this.snapOnResizing(e.cell,e)}captureCursorOffset({view:t,x:e,y:n}){const i=t.getDelegatedView();if(i&&this.isNodeMovable(i)){const i=t.cell.getPosition();this.offset={x:e-i.x,y:n-i.y}}}isNodeMovable(t){return t&&t.cell.isNode()&&t.can("nodeMovable")}snapOnResizing(t,e){if(this.options.resizing&&!e.snapped&&e.ui&&e.direction&&e.trueDirection){const n=this.graph.renderer.findViewByCell(t);if(n&&n.cell.isNode()){const i=t.getBBox(),s=i.bbox(t.getAngle()),r=s.getTopLeft(),o=s.getBottomRight(),a=Ay.normalize(t.getAngle()),l=this.options.tolerance||0;let c,h,u,d,p,g;const f={vertical:0,horizontal:0},m=e.direction,y=e.trueDirection,b=e.relativeDirection;-1!==y.indexOf("right")?f.vertical=o.x:f.vertical=r.x,-1!==y.indexOf("bottom")?f.horizontal=o.y:f.horizontal=r.y,this.model.getNodes().some((e=>{if(this.isIgnored(t,e))return!1;const n=e.getBBox().bbox(e.getAngle()),i=n.getTopLeft(),r=n.getBottomRight(),a={vertical:[i.x,r.x],horizontal:[i.y,r.y]},m={};return Object.keys(a).forEach((t=>{const e=t,n=a[e].map((t=>({position:t,distance:Math.abs(t-f[e])}))).filter((t=>t.distance<=l));m[e]=Ha(n,(t=>t.distance))})),null==c&&m.vertical.length>0&&(c=m.vertical[0].position,h=Math.min(s.y,n.y),u=Math.max(o.y,r.y)-h),null==d&&m.horizontal.length>0&&(d=m.horizontal[0].position,p=Math.min(s.x,n.x),g=Math.max(o.x,r.x)-p),null!=c&&null!=d})),this.hide();let v=0,C=0;null==d&&null==c||(null!=c&&(v=-1!==y.indexOf("right")?c-o.x:r.x-c),null!=d&&(C=-1!==y.indexOf("bottom")?d-o.y:r.y-d));let w=0,x=0;if(a%90===0)90===a||270===a?(w=C,x=v):(w=v,x=C);else{const t=a>=0&&a<90?1:a>=90&&a<180?4:a>=180&&a<270?3:2;null!=d&&null!=c&&(vE&&(S=Math.max(S,e.minWidth)),e.minHeight&&e.minHeight>E&&(A=Math.max(A,e.minHeight)),e.maxWidth&&(S=Math.min(S,e.maxWidth)),e.maxHeight&&(A=Math.min(A,e.maxHeight)),e.preserveAspectRatio&&(x1&&Math.abs(M.width+M.x-c)>1&&(c=void 0),d&&Math.abs(M.y-d)>1&&Math.abs(M.height+M.y-d)>1&&(d=void 0),this.update({verticalLeft:c,verticalTop:h,verticalHeight:u,horizontalTop:d,horizontalLeft:p,horizontalWidth:g})}}}snapOnMoving({view:t,e:e,x:n,y:i}){const s=t.getEventData(e).delegatedView||t;if(!this.isNodeMovable(s))return;const r=s.cell,o=r.getSize(),a=r.getPosition(),l=new Ly(n-this.offset.x,i-this.offset.y,o.width,o.height),c=r.getAngle(),h=l.getCenter(),u=l.bbox(c),d=u.getTopLeft(),p=u.getBottomRight(),g=this.options.tolerance||0;let f,m,y,b,v,C,w=0,x=0;if(this.model.getNodes().some((t=>{if(this.isIgnored(r,t))return!1;const e=t.getBBox().bbox(t.getAngle()),n=e.getCenter(),i=e.getTopLeft(),s=e.getBottomRight();return null==f&&(Math.abs(n.x-h.x)0&&(this.timer=window.setTimeout((()=>{this.unmount()}),e)),this}onRemove(){this.stopListening(),this.hide()}dispose(){this.remove()}}KA([Ex.dispose()],tM.prototype,"dispose",null);var eM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class nM extends jA{init(){this.resetUpdates(),this.startListening(),this.resetViews(this.model.getCells()),!this.isFrozen()&&this.isAsync()&&this.updateViewsAsync()}startListening(){this.model.on("sorted",this.onSortModel,this),this.model.on("reseted",this.onModelReseted,this),this.model.on("batch:stop",this.onBatchStop,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("sorted",this.onSortModel,this),this.model.off("reseted",this.onModelReseted,this),this.model.off("batch:stop",this.onBatchStop,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}resetUpdates(){this.updates={priorities:[{},{},{}],mounted:{},mountedCids:[],unmounted:{},unmountedCids:[],count:0,sort:!1,frozen:!1,freezeKey:null,animationId:null}}onSortModel(){this.model.hasActiveBatch(nM.SORT_DELAYING_BATCHES)||this.sortViews()}onModelReseted({options:t}){this.removeZPivots(),this.resetViews(this.model.getCells(),t)}onBatchStop({name:t,data:e}){if(this.isFrozen())return;const n=this.model;if(!this.isAsync()){const i=nM.UPDATE_DELAYING_BATCHES;i.includes(t)&&!n.hasActiveBatch(i)&&this.updateViews(e)}const i=nM.SORT_DELAYING_BATCHES;i.includes(t)&&!n.hasActiveBatch(i)&&this.sortViews()}onCellAdded({cell:t,options:e}){const n=e.position;this.isAsync()||"number"!==typeof n?this.renderView(t,e):(e.maxPosition===n&&this.freeze({key:"addCells"}),this.renderView(t,e),0===n&&this.unfreeze({key:"addCells"}))}onCellRemoved({cell:t,options:e}){const n=this.findViewByCell(t);n&&this.requestViewUpdate(n,nM.FLAG_REMOVE,n.priority,e)}onCellZIndexChanged({cell:t,options:e}){if("approx"===this.options.sorting){const n=this.findViewByCell(t);n&&this.requestViewUpdate(n,nM.FLAG_INSERT,n.priority,e)}}onCellVisibleChanged({cell:t,current:e,options:n}){e||this.processEdgeOnTerminalVisibleChanged(t,!1);const i=this.findViewByCell(t);!e&&i?this.removeView(t):e&&null==i&&this.renderView(t,n),e&&this.processEdgeOnTerminalVisibleChanged(t,!0)}processEdgeOnTerminalVisibleChanged(t,e){const n=(t,e)=>{const n=t.getSourceCellId();if(n!==e.id)return t.getSourceCell();const i=t.getTargetCellId();return i!==e.id?t.getTargetCell():null};this.model.getConnectedEdges(t).forEach((i=>{const s=n(i,t);(null==s||s.isVisible())&&(e?i.show():i.hide())}))}isEdgeTerminalVisible(t,e){const n="source"===e?t.getSourceCellId():t.getTargetCellId(),i=n?this.model.getCell(n):null;return!(i&&!i.isVisible())}requestConnectedEdgesUpdate(t,e={}){if(Rx.isCellView(t)){const n=t.cell,i=this.model.getConnectedEdges(n);for(let t=0,s=i.length;t=i){s=!1;break t}const p=Ex.views[n];if(!p){delete d[n];continue}let g=d[n];if(0===(g&nM.FLAG_REMOVE)){const t=n in e.unmounted;if(h&&!Em(h,this.graph,{view:p,unmounted:t})){t||(this.registerUnmountedView(p),p.unmount()),e.unmounted[n]|=g,delete d[n],a+=1;continue}t&&(g|=nM.FLAG_INSERT,o+=1),g|=this.registerMountedView(p)}const f=p;let m=this.updateView(p,g,t);if(m>0){const t=f.cell;t&&t.isEdge()&&(f.hasAction(m,"source")&&!this.isEdgeTerminalVisible(t,"source")&&(m=f.removeAction(m,"source"),m|=nM.FLAG_REMOVE),f.hasAction(m,"target")&&!this.isEdgeTerminalVisible(t,"target")&&(m=f.removeAction(m,"target"),m|=nM.FLAG_REMOVE))}m>0&&(d[n]=m,!this.graph.hook.onViewPostponed(f,m,t)||d[n])?(c+=1,s=!1):(r>u&&(r=u),l+=1,delete d[n])}}return{empty:s,priority:r,mountedCount:o,unmountedCount:a,updatedCount:l,postponedCount:c}}updateViewsAsync(t={},e={processed:0,priority:nM.MIN_PRIORITY}){const n=this.updates,i=n.animationId;if(i){if(Ey(i),0===e.processed){const e=t.before;"function"===typeof e&&Em(e,this.graph,this.graph)}const s=this.updateViewsBatch(t),r=this.checkViewImpl({checkView:t.checkView,mountedBatchSize:nM.MOUNT_BATCH_SIZE-s.mountedCount,unmountedBatchSize:nM.MOUNT_BATCH_SIZE-s.unmountedCount});let o=e.processed;const a=n.count,l=r.mountedCount,c=r.unmountedCount;s.updatedCount>0&&(o+=s.updatedCount+s.unmountedCount,e.priority=Math.min(s.priority,e.priority),s.empty&&0===l?(s.priority=e.priority,s.mountedCount+=l,s.unmountedCount+=c,this.graph.trigger("render:done",{stats:s,options:t}),e.processed=0,n.count=0):e.processed=o);const h=t.progress;if(a&&"function"===typeof h&&Em(h,this.graph,{total:a,done:s.empty,current:o}),n.animationId!==i)return}n.animationId=xy((()=>{this.updateViewsAsync(t,e)}))}registerMountedView(t){const e=t.cid,n=this.updates;if(e in n.mounted)return 0;n.mounted[e]=!0,n.mountedCids.push(e);const i=n.unmounted[e]||0;return delete n.unmounted[e],i}registerUnmountedView(t){const e=t.cid,n=this.updates;if(e in n.unmounted)return 0;n.unmounted[e]|=nM.FLAG_INSERT;const i=n.unmounted[e];return n.unmountedCids.push(e),delete n.mounted[e],i}isViewMounted(t){if(null==t)return!1;const e=t.cid;return e in this.updates.mounted}getMountedViews(){return Object.keys(this.updates.mounted).map((t=>Rx.views[t]))}getUnmountedViews(){return Object.keys(this.updates.unmounted).map((t=>Rx.views[t]))}checkMountedViews(t,e){let n=0;if("function"!==typeof t)return n;const i=this.updates,s=i.mounted,r=i.mountedCids,o=null==e?r.length:Math.min(r.length,e);for(let a=0;a0?Math.min(this.updates.unmountedCids.length-n,t.mountedBatchSize):t.mountedBatchSize);return{mountedCount:i,unmountedCount:n}}checkView(t={}){return this.checkViewImpl(t)}isFrozen(){return!!this.options.frozen}freeze(t={}){const e=t.key,n=this.updates,i=this.options.frozen,s=n.freezeKey;if(e&&e!==s){if(i&&s)return;n.frozen=i,n.freezeKey=e}this.options.frozen=!0;const r=n.animationId;n.animationId=null,this.isAsync()&&null!=r&&Ey(r),this.graph.trigger("freeze",{key:e})}unfreeze(t={}){const e=t.key,n=this.updates,i=n.freezeKey;if(e&&i&&e!==i)return;if(n.freezeKey=null,e&&e===i&&n.frozen)return;const s=()=>{this.options.frozen=n.frozen=!1,n.sort&&(this.sortViews(),n.sort=!1);const i=t.after;i&&Em(i,this.graph,this.graph),this.graph.trigger("unfreeze",{key:e})};if(this.isAsync()){this.freeze();const e=t.progress;this.updateViewsAsync(Object.assign(Object.assign({},t),{progress:({done:t,current:n,total:i})=>{e&&Em(e,this.graph,{done:t,current:n,total:i}),t&&s()}}))}else this.updateViews(t),s()}isAsync(){return!!this.options.async}setAsync(t){this.options.async=t}onRemove(){this.freeze(),this.removeViews()}resetViews(t=[],e={}){this.resetUpdates(),this.removeViews(),this.freeze({key:"reset"});for(let n=0,i=t.length;n{const e=this.views[t];e&&this.removeView(e.cell)})),this.views={}}renderView(t,e={}){const n=t.id,i=this.views;let s=0,r=i[n];if(t.isVisible()&&(!t.isEdge()||this.isEdgeTerminalVisible(t,"source")&&this.isEdgeTerminalVisible(t,"target"))){if(r)s=nM.FLAG_INSERT;else{const e=this.graph.hook.createCellView(t);e&&(r=i[t.id]=e,r.graph=this.graph,s=this.registerUnmountedView(r)|r.getBootstrapFlag())}r&&this.requestViewUpdate(r,s,r.priority,e)}}isExactSorting(){return"exact"===this.options.sorting}sortViews(){this.isExactSorting()&&(this.isFrozen()?this.updates.sort=!0:this.sortViewsExact())}sortElements(t,e){const n=t.map((t=>{const e=t.parentNode,n=e.insertBefore(document.createTextNode(""),t.nextSibling);return t=>{if(e===t)throw new Error("You can't sort elements if any one is a descendant of another.");e.insertBefore(t,n),e.removeChild(n)}}));t.sort(e).forEach(((t,e)=>n[e](t)))}sortViewsExact(){const t=this.view.$(this.view.stage).children("[data-cell-id]").toArray(),e=this.model;this.sortElements(t,((t,n)=>{const i=e.getCell(t.getAttribute("data-cell-id")||""),s=e.getCell(n.getAttribute("data-cell-id")||""),r=i.getZIndex()||0,o=s.getZIndex()||0;return r===o?0:ri&&(i=e)}const s=this.view.stage;if(i!==-1/0){const t=e[i];s.insertBefore(n,t.nextSibling)}else s.insertBefore(n,s.firstChild);return n}removeZPivots(){this.zPivots&&Object.keys(this.zPivots).forEach((t=>{const e=this.zPivots[t];e&&e.parentNode&&e.parentNode.removeChild(e)})),this.zPivots={}}insertView(t){const e=this.view.stage;switch(this.options.sorting){case"approx":{const n=t.cell.getZIndex(),i=this.addZPivot(n);e.insertBefore(t.container,i);break}case"exact":default:e.appendChild(t.container);break}}findViewByCell(t){if(null==t)return null;const e=ZS.isCell(t)?t.id:t;return this.views[e]}findViewByElem(t){if(null==t)return null;const e="string"===typeof t?this.view.stage.querySelector(t):t instanceof Element?t:t[0];if(e){const t=this.view.findAttr("data-cell-id",e);if(t)return this.views[t]}return null}findViewsFromPoint(t){const e={x:t.x,y:t.y};return this.model.getCells().map((t=>this.findViewByCell(t))).filter((t=>null!=t&&Yb(t.container,{target:this.view.stage}).containsPoint(e)))}findEdgeViewsInArea(t,e={}){const n=Ly.create(t);return this.model.getEdges().map((t=>this.findViewByCell(t))).filter((t=>{if(t){const i=Yb(t.container,{target:this.view.stage});return 0===i.width?i.inflate(1,0):0===i.height&&i.inflate(0,1),e.strict?n.containsRect(i):n.isIntersectWithRect(i)}return!1}))}findViewsInArea(t,e={}){const n=Ly.create(t);return this.model.getNodes().map((t=>this.findViewByCell(t))).filter((t=>{if(t){const i=Yb(t.container,{target:this.view.stage});return e.strict?n.containsRect(i):n.isIntersectWithRect(i)}return!1}))}dispose(){this.resetUpdates(),this.stopListening()}}eM([jA.dispose()],nM.prototype,"dispose",null),function(t){t.FLAG_INSERT=1<<30,t.FLAG_REMOVE=1<<29,t.MOUNT_BATCH_SIZE=1e3,t.UPDATE_BATCH_SIZE=1e3,t.MIN_PRIORITY=2,t.SORT_DELAYING_BATCHES=["add","to-front","to-back"],t.UPDATE_DELAYING_BATCHES=["translate"]}(nM||(nM={}));var iM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class sM extends jA{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(t={}){let e=t.size||"auto auto",n=t.position||"center";const i=this.graph.transform.getScale(),s=this.graph.translate();if("object"===typeof n){const t=s.tx+i.sx*(n.x||0),e=s.ty+i.sy*(n.y||0);n=`${t}px ${e}px`}"object"===typeof e&&(e=Ly.fromSize(e).scale(i.sx,i.sy),e=`${e.width}px ${e.height}px`),this.elem.style.backgroundSize=e,this.elem.style.backgroundPosition=n}drawBackgroundImage(t,e={}){if(!(t instanceof HTMLImageElement))return void(this.elem.style.backgroundImage="");const n=this.optionsCache;if(n&&n.image!==e.image)return;let i;const s=e.opacity,r=e.size;let o=e.repeat||"no-repeat";const a=vw.registry.get(o);if("function"===typeof a){const n=e.quality||1;t.width*=n,t.height*=n;const s=a(t,e);if(!(s instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");i=s.toDataURL("image/png"),o=e.repeat&&o!==e.repeat?e.repeat:"repeat","object"===typeof r?(r.width*=s.width/t.width,r.height*=s.height/t.height):void 0===r&&(e.size={width:s.width/n,height:s.height/n})}else i=t.src,void 0===r&&(e.size={width:t.width,height:t.height});null!=n&&"object"===typeof e.size&&e.image===n.image&&e.repeat===n.repeat&&e.quality===n.quality&&(n.size=Eu(e.size));const l=this.elem.style;l.backgroundImage=`url(${i})`,l.backgroundRepeat=o,l.opacity=null==s||s>=1?"":`${s}`,this.updateBackgroundImage(e)}updateBackgroundColor(t){this.elem.style.backgroundColor=t||""}updateBackgroundOptions(t){this.graph.options.background=t}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(t){const e=t||{};if(this.updateBackgroundOptions(t),this.updateBackgroundColor(e.color),e.image){this.optionsCache=Eu(e);const n=document.createElement("img");n.onload=()=>this.drawBackgroundImage(n,t),n.setAttribute("crossorigin","anonymous"),n.src=e.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}}iM([jA.dispose()],sM.prototype,"dispose",null);var rM,oM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},aM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s{const n=e.trim();if(n){const e=n.split(":");e.length&&(t[e[0].trim()]=e[1]?e[1].trim():"")}})),Object.keys(t).forEach((e=>{"width"!==e&&"height"!==e&&(s.style[e]="",this.container.style[e]=t[e])}))}this.content=document.createElement("div"),this.$content=this.$(this.content).addClass(this.prefixClassName(rM.contentClass)).css({width:this.graph.options.width,height:this.graph.options.height}),this.background=document.createElement("div"),this.$background=this.$(this.background).addClass(this.prefixClassName(rM.backgroundClass)),this.$content.append(this.background),this.options.pageVisible||this.$content.append(this.graph.view.grid),this.$content.append(s),this.$content.appendTo(this.container),this.startListening(),this.options.pageVisible||this.graph.grid.update(),this.backgroundManager=new lM.Background(this),this.options.autoResize||this.update()}get graph(){return this.options.graph}get model(){return this.graph.model}startListening(){const t=this.graph,e=this.model;t.on("scale",this.onScale,this),t.on("resize",this.onResize,this),t.on("before:print",this.storeScrollPosition,this),t.on("before:export",this.storeScrollPosition,this),t.on("after:print",this.restoreScrollPosition,this),t.on("after:export",this.restoreScrollPosition,this),t.on("render:done",this.onRenderDone,this),t.on("unfreeze",this.onUpdate,this),e.on("reseted",this.onUpdate,this),e.on("cell:added",this.onUpdate,this),e.on("cell:removed",this.onUpdate,this),e.on("cell:changed",this.onUpdate,this),e.on("batch:stop",this.onBatchStop,this),this.delegateBackgroundEvents()}stopListening(){const t=this.graph,e=this.model;t.off("scale",this.onScale,this),t.off("resize",this.onResize,this),t.off("beforeprint",this.storeScrollPosition,this),t.off("beforeexport",this.storeScrollPosition,this),t.off("afterprint",this.restoreScrollPosition,this),t.off("afterexport",this.restoreScrollPosition,this),t.off("render:done",this.onRenderDone,this),t.off("unfreeze",this.onUpdate,this),e.off("reseted",this.onUpdate,this),e.off("cell:added",this.onUpdate,this),e.off("cell:removed",this.onUpdate,this),e.off("cell:changed",this.onUpdate,this),e.off("batch:stop",this.onBatchStop,this),this.undelegateBackgroundEvents()}enableAutoResize(){this.options.autoResize=!0}disableAutoResize(){this.options.autoResize=!1}onUpdate(){!this.graph.isAsync()&&this.options.autoResize&&this.update()}onBatchStop(t){!this.graph.isAsync()&&this.options.autoResize&&nM.UPDATE_DELAYING_BATCHES.includes(t.name)&&this.update()}delegateBackgroundEvents(t){const e=t||BA.events;this.delegatedHandlers=Object.keys(e).reduce(((t,n)=>{const i=e[n];if(-1===n.indexOf(" "))if("function"===typeof i)t[n]=i;else{let e=this.graph.view[i];"function"===typeof e&&(e=e.bind(this.graph.view),t[n]=e)}return t}),{}),this.onBackgroundEvent=this.onBackgroundEvent.bind(this),Object.keys(this.delegatedHandlers).forEach((t=>{this.delegateEvent(t,{guarded:!1},this.onBackgroundEvent)}))}undelegateBackgroundEvents(){Object.keys(this.delegatedHandlers).forEach((t=>{this.undelegateEvent(t,this.onBackgroundEvent)}))}onBackgroundEvent(t){let e=!1;const n=t.target;if(this.options.pageVisible)e=this.options.background?this.background===n:this.content===n;else{const t=this.graph.view;e=t.background===n||t.grid===n}if(e){const e=this.delegatedHandlers[t.type];"function"===typeof e&&e.apply(this.graph,arguments)}}onRenderDone({stats:t}){this.options.autoResize&&t.priority<2&&this.update()}onResize(){this.cachedCenterPoint&&(this.centerPoint(this.cachedCenterPoint.x,this.cachedCenterPoint.y),this.updatePageBreak())}onScale({sx:t,sy:e,ox:n,oy:i}){this.updateScale(t,e),(n||i)&&(this.centerPoint(n,i),this.updatePageBreak());const s=this.options.autoResizeOptions||this.options.fitTocontentOptions;"function"===typeof s&&this.update()}storeScrollPosition(){this.cachedScrollLeft=this.container.scrollLeft,this.cachedScrollTop=this.container.scrollTop}restoreScrollPosition(){this.container.scrollLeft=this.cachedScrollLeft,this.container.scrollTop=this.cachedScrollTop,this.cachedScrollLeft=null,this.cachedScrollTop=null}storeClientSize(){this.cachedClientSize={width:this.container.clientWidth,height:this.container.clientHeight}}restoreClientSize(){this.cachedClientSize=null}beforeManipulation(){(w.IS_IE||w.IS_EDGE)&&this.$container.css("visibility","hidden")}afterManipulation(){(w.IS_IE||w.IS_EDGE)&&this.$container.css("visibility","visible")}updatePageSize(t,e){null!=t&&(this.options.pageWidth=t),null!=e&&(this.options.pageHeight=e),this.updatePageBreak()}updatePageBreak(){if(this.pageBreak&&this.pageBreak.parentNode&&this.pageBreak.parentNode.removeChild(this.pageBreak),this.pageBreak=null,this.options.pageVisible&&this.options.pageBreak){const t=this.graph.options.width,e=this.graph.options.height,n=this.options.pageWidth*this.sx,i=this.options.pageHeight*this.sy;if(t>n||e>i){let s=!1;const r=document.createElement("div");for(let e=1,i=Math.floor(t/n);e").addClass(this.prefixClassName("graph-pagebreak-vertical")).css({left:e*n}).appendTo(r),s=!0;for(let t=1,n=Math.floor(e/i);t").addClass(this.prefixClassName("graph-pagebreak-horizontal")).css({top:t*i}).appendTo(r),s=!0;s&&(jm(r,this.prefixClassName("graph-pagebreak")),this.$(this.graph.view.grid).after(r),this.pageBreak=r)}}}update(){const t=this.getClientSize();this.cachedCenterPoint=this.clientToLocalPoint(t.width/2,t.height/2);let e=this.options.autoResizeOptions||this.options.fitTocontentOptions;"function"===typeof e&&(e=Em(e,this,this));const n=Object.assign({gridWidth:this.options.pageWidth,gridHeight:this.options.pageHeight,allowNewOrigin:"negative"},e);this.graph.fitToContent(this.getFitToContentOptions(n))}getFitToContentOptions(t){const e=this.sx,n=this.sy;return t.gridWidth&&(t.gridWidth*=e),t.gridHeight&&(t.gridHeight*=n),t.minWidth&&(t.minWidth*=e),t.minHeight&&(t.minHeight*=n),"object"===typeof t.padding?t.padding={left:(t.padding.left||0)*e,right:(t.padding.right||0)*e,top:(t.padding.top||0)*n,bottom:(t.padding.bottom||0)*n}:"number"===typeof t.padding&&(t.padding*=e),this.options.autoResize||(t.contentArea=Ly.create()),t}updateScale(t,e){const n=this.graph.options,i=t/this.sx,s=e/this.sy;this.sx=t,this.sy=e,this.graph.translate(n.x*i,n.y*s),this.graph.resizeGraph(n.width*i,n.height*s)}scrollbarPosition(t,e,n){if(null==t&&null==e)return{left:this.container.scrollLeft,top:this.container.scrollTop};const i={};return"number"===typeof t&&(i.scrollLeft=t),"number"===typeof e&&(i.scrollTop=e),n&&n.animation?this.$container.animate(i,n.animation):this.$container.prop(i),this}scrollToPoint(t,e,n){const i=this.getClientSize(),s=this.graph.matrix(),r={};return"number"===typeof t&&(r.scrollLeft=t-i.width/2+s.e+(this.padding.left||0)),"number"===typeof e&&(r.scrollTop=e-i.height/2+s.f+(this.padding.top||0)),n&&n.animation?this.$container.animate(r,n.animation):this.$container.prop(r),this}scrollToContent(t){const e=this.sx,n=this.sy,i=this.graph.getContentArea().getCenter();return this.scrollToPoint(i.x*e,i.y*n,t)}scrollToCell(t,e){const n=this.sx,i=this.sy,s=t.getBBox().getCenter();return this.scrollToPoint(s.x*n,s.y*i,e)}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.graph.matrix(),s=i.a,r=i.d,o=-i.e,a=-i.f,l=o+this.graph.options.width,c=a+this.graph.options.height;let h;if(this.storeClientSize(),"number"===typeof t||"number"===typeof e){h=n;const i=this.getVisibleArea().getCenter();"number"===typeof t?t*=s:t=i.x,"number"===typeof e?e*=r:e=i.y}else h=t,t=(o+l)/2,e=(a+c)/2;if(h&&h.padding)return this.positionPoint({x:t,y:e},"50%","50%",h);const u=this.getPadding(),d=this.getClientSize(),p=d.width/2,g=d.height/2,f=p-u.left-t+o,m=p-u.right+t-l,y=g-u.top-e+a,b=g-u.bottom+e-c;this.addPadding(Math.max(f,0),Math.max(m,0),Math.max(y,0),Math.max(b,0));const v=this.scrollToPoint(t,e,h||void 0);return this.restoreClientSize(),v}centerContent(t){return this.positionContent("center",t)}centerCell(t,e){return this.positionCell(t,"center",e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t,e)}positionCell(t,e,n){const i=t.getBBox();return this.positionRect(i,e,n)}positionRect(t,e,n){const i=Ly.create(t);switch(e){case"center":return this.positionPoint(i.getCenter(),"50%","50%",n);case"top":return this.positionPoint(i.getTopCenter(),"50%",0,n);case"top-right":return this.positionPoint(i.getTopRight(),"100%",0,n);case"right":return this.positionPoint(i.getRightMiddle(),"100%","50%",n);case"bottom-right":return this.positionPoint(i.getBottomRight(),"100%","100%",n);case"bottom":return this.positionPoint(i.getBottomCenter(),"50%","100%",n);case"bottom-left":return this.positionPoint(i.getBottomLeft(),0,"100%",n);case"left":return this.positionPoint(i.getLeftMiddle(),0,"50%",n);case"top-left":return this.positionPoint(i.getTopLeft(),0,0,n);default:return this}}positionPoint(t,e,n,i={}){const{padding:s}=i,r=aM(i,["padding"]),o=cm(s),a=Ly.fromSize(this.getClientSize()),l=a.clone().moveAndExpand({x:o.left,y:o.top,width:-o.right-o.left,height:-o.top-o.bottom});e=am(e,Math.max(0,l.width)),e<0&&(e=l.width+e),n=am(n,Math.max(0,l.height)),n<0&&(n=l.height+n);const c=l.getTopLeft().translate(e,n),h=a.getCenter().diff(c),u=this.zoom(),d=h.scale(1/u,1/u),p=jy.create(t).translate(d);return this.centerPoint(p.x,p.y,r)}zoom(t,e){if(null==t)return this.sx;let n,i;e=e||{};const s=this.getClientSize(),r=this.clientToLocalPoint(s.width/2,s.height/2);let o=t,a=t;if(e.absolute||(o+=this.sx,a+=this.sy),e.scaleGrid&&(o=Math.round(o/e.scaleGrid)*e.scaleGrid,a=Math.round(a/e.scaleGrid)*e.scaleGrid),e.maxScale&&(o=Math.min(e.maxScale,o),a=Math.min(e.maxScale,a)),e.minScale&&(o=Math.max(e.minScale,o),a=Math.max(e.minScale,a)),o=this.graph.transform.clampScale(o),a=this.graph.transform.clampScale(a),e.center){const t=o/this.sx,s=a/this.sy;n=e.center.x-(e.center.x-r.x)/t,i=e.center.y-(e.center.y-r.y)/s}else n=r.x,i=r.y;return this.beforeManipulation(),this.graph.transform.scale(o,a),this.centerPoint(n,i),this.afterManipulation(),this}zoomToRect(t,e={}){const n=Ly.create(t),i=this.graph;e.contentArea=n,null==e.viewportArea&&(e.viewportArea={x:i.options.x,y:i.options.y,width:this.$container.width(),height:this.$container.height()}),this.beforeManipulation(),i.transform.scaleContentToFitImpl(e,!1);const s=n.getCenter();return this.centerPoint(s.x,s.y),this.afterManipulation(),this}zoomToFit(t={}){return this.zoomToRect(this.graph.getContentArea(t),t)}transitionToPoint(t,e,n){let i,s;"object"===typeof t?(n=e,e=t.y,t=t.x):e=e,null==n&&(n={});const r=this.sx,o=Math.max(n.scale||r,1e-6),a=this.getClientSize(),l=new jy(t,e),c=this.clientToLocalPoint(a.width/2,a.height/2);if(r===o){const t=c.diff(l).scale(r,r).round();i=`translate(${t.x}px,${t.y}px)`}else{const t=o/(r-o)*l.distance(c),e=c.clone().move(l,t),n=this.localToBackgroundPoint(e).round();i=`scale(${o/r})`,s=`${n.x}px ${n.y}px`}const h=n.onTransitionEnd;return this.$container.addClass(rM.transitionClassName),this.$content.off(rM.transitionEventName).on(rM.transitionEventName,(n=>{this.syncTransition(o,{x:t,y:e}),"function"===typeof h&&Em(h,this,n.originalEvent)})).css({transform:i,transformOrigin:s,transition:"transform",transitionDuration:n.duration||"1s",transitionDelay:n.delay,transitionTimingFunction:n.timing}),this}syncTransition(t,e){return this.beforeManipulation(),this.graph.scale(t),this.removeTransition(),this.centerPoint(e.x,e.y),this.afterManipulation(),this}removeTransition(){return this.$container.removeClass(rM.transitionClassName),this.$content.off(rM.transitionEventName).css({transform:"",transformOrigin:"",transition:"",transitionDuration:"",transitionDelay:"",transitionTimingFunction:""}),this}transitionToRect(t,e={}){const n=Ly.create(t),i=e.maxScale||1/0,s=e.minScale||Number.MIN_VALUE,r=e.scaleGrid||null,o=e.visibility||1,a=e.center?jy.create(e.center):n.getCenter(),l=this.getClientSize(),c=l.width*o,h=l.height*o;let u=new Ly(a.x-c/2,a.y-h/2,c,h).getMaxUniformScaleToFit(n,a);return u=Math.min(u,i),r&&(u=Math.floor(u/r)*r),u=Math.max(s,u),this.transitionToPoint(a,Object.assign({scale:u},e))}startPanning(t){const e=this.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("pan:start",{e:e}),this.$(document.body).on({"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),this.$(window).on("mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.normalizeEvent(t),n=e.clientX-this.clientX,i=e.clientY-this.clientY;this.container.scrollTop-=i,this.container.scrollLeft-=n,this.clientX=e.clientX,this.clientY=e.clientY,this.trigger("panning",{e:e})}stopPanning(t){this.$(document.body).off(".panning"),this.$(window).off(".panning"),this.trigger("pan:stop",{e:t})}clientToLocalPoint(t,e){let n="object"===typeof t?t.x:t,i="object"===typeof t?t.y:e;const s=this.graph.matrix();return n+=this.container.scrollLeft-this.padding.left-s.e,i+=this.container.scrollTop-this.padding.top-s.f,new jy(n/s.a,i/s.d)}localToBackgroundPoint(t,e){const n="object"===typeof t?jy.create(t):new jy(t,e),i=this.graph.matrix(),s=this.padding;return Hb(n,i).translate(s.left,s.top)}resize(t,e){let n=null!=t?t:this.container.offsetWidth,i=null!=e?e:this.container.offsetHeight;"number"===typeof n&&(n=Math.round(n)),"number"===typeof i&&(i=Math.round(i)),this.options.width=n,this.options.height=i,this.$container.css({width:n,height:i}),this.update()}getClientSize(){return this.cachedClientSize?this.cachedClientSize:{width:this.container.clientWidth,height:this.container.clientHeight}}autoScroll(t,e){const n=10,i=this.container,s=i.getBoundingClientRect();let r=0,o=0;return t<=s.left+n&&(r=-n),e<=s.top+n&&(o=-n),t>=s.right-n&&(r=n),e>=s.bottom-n&&(o=n),0!==r&&(i.scrollLeft+=r),0!==o&&(i.scrollTop+=o),{scrollerX:r,scrollerY:o}}addPadding(t,e,n,i){let s=this.getPadding();this.padding={left:Math.round(s.left+(t||0)),top:Math.round(s.top+(n||0)),bottom:Math.round(s.bottom+(i||0)),right:Math.round(s.right+(e||0))},s=this.padding,this.$content.css({width:s.left+this.graph.options.width+s.right,height:s.top+this.graph.options.height+s.bottom});const r=this.graph.container;return r.style.left=`${this.padding.left}px`,r.style.top=`${this.padding.top}px`,this}getPadding(){const t=this.options.padding;return cm("function"===typeof t?Em(t,this,this):t)}getVisibleArea(){const t=this.graph.matrix(),e=this.getClientSize(),n={x:this.container.scrollLeft||0,y:this.container.scrollTop||0,width:e.width,height:e.height},i=qb(n,t.inverse());return i.x-=(this.padding.left||0)/this.sx,i.y-=(this.padding.top||0)/this.sy,i}isCellVisible(t,e={}){const n=t.getBBox(),i=this.getVisibleArea();return e.strict?i.containsRect(n):i.isIntersectWithRect(n)}isPointVisible(t){return this.getVisibleArea().containsPoint(t)}lock(){return this.$container.css("overflow","hidden"),this}unlock(){return this.$container.css("overflow","scroll"),this}onRemove(){this.stopListening()}dispose(){this.$(this.graph.container).insertBefore(this.$container),this.remove()}}function cM(t,e,n,i={}){if(n){const s=n.graph,r=s.view.normalizeEvent(e),o=s.snapToGrid(r.clientX,r.clientY);n.notify(t,Object.assign({e:r,view:n,node:n.cell,cell:n.cell,x:o.x,y:o.y},i))}}oM([Ex.dispose()],lM.prototype,"dispose",null),function(t){class e extends sM{constructor(t){super(t.graph),this.scroller=t,t.options.background&&this.draw(t.options.background)}get elem(){return this.scroller.background}init(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}updateBackgroundOptions(t){this.scroller.options.background=t}}t.Background=e}(lM||(lM={})),function(t){function e(e){const n=kc({},t.defaultOptions,e);return null==n.pageWidth&&(n.pageWidth=e.graph.options.width),null==n.pageHeight&&(n.pageHeight=e.graph.options.height),n}t.containerClass="graph-scroller",t.panningClass=`${t.containerClass}-panning`,t.pannableClass=`${t.containerClass}-pannable`,t.pagedClass=`${t.containerClass}-paged`,t.contentClass=`${t.containerClass}-content`,t.backgroundClass=`${t.containerClass}-background`,t.transitionClassName="transition-in-progress",t.transitionEventName="transitionend.graph-scroller-transition",t.defaultOptions={padding(){const t=this.getClientSize(),e=Math.max(this.options.minVisibleWidth||0,1)||1,n=Math.max(this.options.minVisibleHeight||0,1)||1,i=Math.max(t.width-e,0),s=Math.max(t.height-n,0);return{left:i,top:s,right:i,bottom:s}},minVisibleWidth:50,minVisibleHeight:50,pageVisible:!1,pageBreak:!1,autoResize:!0},t.getOptions=e}(rM||(rM={}));var hM,uM,dM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class pM extends Ex{constructor(t){super(),this.options=kc({},hM.defaultOptions,t),this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new yA([],{comparator:hM.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.initHandles(),this.startListening()}get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(hM.classNames.box)}get $boxes(){return this.$container.children(`.${this.boxClassName}`)}get handleOptions(){return this.options}startListening(){const t=this.graph,e=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!0),t.on("scale",this.onGraphTransformed,this),t.on("translate",this.onGraphTransformed,this),t.model.on("updated",this.onModelUpdated,this),e.on("added",this.onCellAdded,this),e.on("removed",this.onCellRemoved,this),e.on("reseted",this.onReseted,this),e.on("updated",this.onCollectionUpdated,this),e.on("node:change:position",this.onNodePositionChanged,this),e.on("cell:changed",this.onCellChanged,this)}stopListening(){const t=this.graph,e=this.collection;this.undelegateEvents(),t.off("scale",this.onGraphTransformed,this),t.off("translate",this.onGraphTransformed,this),t.model.off("updated",this.onModelUpdated,this),e.off("added",this.onCellAdded,this),e.off("removed",this.onCellRemoved,this),e.off("reseted",this.onReseted,this),e.off("updated",this.onCollectionUpdated,this),e.off("node:change:position",this.onNodePositionChanged,this),e.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes({async:!1})}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:t,options:e}){const{showNodeSelectionBox:n,pointerEvents:i}=this.options,{ui:s,selection:r}=e;let o=!this.translating;if(o=o&&(!0!==n||"none"===i),o=o&&s&&!r,o){this.translating=!0;const n=t.position(),i=t.previous("position"),s=n.x-i.x,r=n.y-i.y;0===s&&0===r||this.translateSelectedNodes(s,r,t,e),this.translating=!1}}onModelUpdated({removed:t}){t&&t.length&&this.unselect(t)}isEmpty(){return this.length<=0}isSelected(t){return this.collection.has(t)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(t,e={}){e.dryrun=!0;const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.add(n,e),this}unselect(t,e={}){return e.dryrun=!0,this.collection.remove(Array.isArray(t)?t:[t],e),this}reset(t,e={}){if(t){if(e.batch){const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.reset(n,Object.assign(Object.assign({},e),{ui:!0})),this}const n=this.cells,i=this.filter(Array.isArray(t)?t:[t]),s={},r={};n.forEach((t=>s[t.id]=t)),i.forEach((t=>r[t.id]=t));const o=[],a=[];return i.forEach((t=>{s[t.id]||o.push(t)})),n.forEach((t=>{r[t.id]||a.push(t)})),a.length&&this.unselect(a,Object.assign(Object.assign({},e),{ui:!0})),o.length&&this.select(o,Object.assign(Object.assign({},e),{ui:!0})),0===a.length&&0===o.length&&this.updateContainer(),this}return this.clean(e)}clean(t={}){return this.length&&(!1===t.batch?this.unselect(this.cells,t):this.collection.reset([],Object.assign(Object.assign({},t),{ui:!0}))),this}setFilter(t){this.options.filter=t}setContent(t){this.options.content=t}startSelecting(t){let e,n;t=this.normalizeEvent(t),this.clean();const i=this.graph.container;if(null!=t.offsetX&&null!=t.offsetY&&i.contains(t.target))e=t.offsetX,n=t.offsetY;else{const s=this.$(i).offset(),r=i.scrollLeft,o=i.scrollTop;e=t.clientX-s.left+window.pageXOffset+r,n=t.clientY-s.top+window.pageYOffset+o}this.$container.css({top:n,left:e,width:1,height:1}),this.setEventData(t,{action:"selecting",clientX:t.clientX,clientY:t.clientY,offsetX:e,offsetY:n,scrollerX:0,scrollerY:0}),this.delegateDocumentEvents(hM.documentEvents,t.data)}filter(t){const e=this.options.filter;return Array.isArray(e)?t.filter((t=>!e.includes(t)&&!e.includes(t.shape))):"function"===typeof e?t.filter((t=>Em(e,this.graph,t))):t}stopSelecting(t){const e=this.graph,n=this.getEventData(t),i=n.action;switch(i){case"selecting":{let t=this.$container.width(),n=this.$container.height();const i=this.$container.offset(),s=e.pageToLocal(i.left,i.top),r=e.transform.getScale();t/=r.sx,n/=r.sy;const o=new Ly(s.x,s.y,t,n),a=this.getCellViewsInArea(o).map((t=>t.cell));this.reset(a,{batch:!0}),this.hideRubberband();break}case"translating":{const i=e.snapToGrid(t.clientX,t.clientY);if(!this.options.following){const t=n;this.updateSelectedNodesPosition({dx:t.clientX-t.originX,dy:t.clientY-t.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",t,i.x,i.y);break}default:this.clean();break}}onMouseUp(t){const e=this.getEventData(t).action;e&&(this.stopSelecting(t),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(t){this.options.following||t.stopPropagation();const e=this.normalizeEvent(t);this.options.movable&&this.startTranslating(e);const n=this.getCellViewFromElem(e.target);this.setEventData(e,{activeView:n});const i=this.graph.snapToGrid(e.clientX,e.clientY);this.notifyBoxEvent("box:mousedown",e,i.x,i.y),this.delegateDocumentEvents(hM.documentEvents,e.data)}startTranslating(t){this.graph.model.startBatch("move-selection");const e=this.graph.snapToGrid(t.clientX,t.clientY);this.setEventData(t,{action:"translating",clientX:e.x,clientY:e.y,originX:e.x,originY:e.y})}getSelectionOffset(t,e){let n=t.x-e.clientX,i=t.y-e.clientY;const s=this.graph.hook.getRestrictArea();if(s){const r=this.collection.toArray(),o=ZS.getCellsBBox(r,{deep:!0})||Ly.create(),a=s.x-o.x,l=s.y-o.y,c=s.x+s.width-(o.x+o.width),h=s.y+s.height-(o.y+o.height);if(n=c?0:n,i=r<=l||r>=h?0:i}}return{dx:n,dy:i}}updateSelectedNodesPosition(t){const{dx:e,dy:n}=t;if(e||n)if(this.translateSelectedNodes(e,n),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const t=this.graph.transform.getScale();this.$boxes.add(this.$selectionContainer).css({left:"+="+e*t.sx,top:"+="+n*t.sy})}}autoScrollGraph(t,e){const n=this.graph.scroller.widget;return n?n.autoScroll(t,e):{scrollerX:0,scrollerY:0}}adjustSelection(t){const e=this.normalizeEvent(t),n=this.getEventData(e),i=n.action;switch(i){case"selecting":{const t=n;!0!==t.moving&&(this.$container.appendTo(this.graph.container),this.showRubberband(),t.moving=!0);const{scrollerX:i,scrollerY:s}=this.autoScrollGraph(e.clientX,e.clientY);t.scrollerX+=i,t.scrollerY+=s;const r=e.clientX-t.clientX+t.scrollerX,o=e.clientY-t.clientY+t.scrollerY,a=parseInt(this.$container.css("left"),10),l=parseInt(this.$container.css("top"),10);this.$container.css({left:r<0?t.offsetX+r:a,top:o<0?t.offsetY+o:l,width:Math.abs(r),height:Math.abs(o)});break}case"translating":{const i=this.graph.snapToGrid(e.clientX,e.clientY),s=n,r=this.getSelectionOffset(i,s);this.options.following?this.updateSelectedNodesPosition(r):this.updateContainerPosition(r),r.dx&&(s.clientX=i.x),r.dy&&(s.clientY=i.y),this.notifyBoxEvent("box:mousemove",t,i.x,i.y);break}default:break}this.boxesUpdated=!1}translateSelectedNodes(t,e,n,i){const s={},r=[];if(n&&(s[n.id]=!0),this.collection.toArray().forEach((t=>{t.getDescendants({deep:!0}).forEach((t=>{s[t.id]=!0}))})),i&&i.translateBy){const t=this.graph.getCellById(i.translateBy);t&&(s[t.id]=!0,t.getDescendants({deep:!0}).forEach((t=>{s[t.id]=!0})),r.push(t))}this.collection.toArray().forEach((n=>{if(!s[n.id]){const o=Object.assign(Object.assign({},i),{selection:this.cid,exclude:r});n.translate(t,e,o),this.graph.model.getConnectedEdges(n).forEach((n=>{s[n.id]||(n.translate(t,e,o),s[n.id]=!0)}))}}))}getCellViewsInArea(t){const e=this.graph,n={strict:this.options.strict};let i=[];return this.options.rubberNode&&(i=this.options.useCellGeometry?i.concat(e.model.getNodesInArea(t,n).map((t=>e.renderer.findViewByCell(t))).filter((t=>null!=t))):i.concat(e.renderer.findViewsInArea(t,n))),this.options.rubberEdge&&(i=this.options.useCellGeometry?i.concat(e.model.getEdgesInArea(t,n).map((t=>e.renderer.findViewByCell(t))).filter((t=>null!=t))):i.concat(e.renderer.findEdgeViewsInArea(t,n))),i}notifyBoxEvent(t,e,n,i){const s=this.getEventData(e),r=s.activeView;this.trigger(t,{e:e,view:r,x:n,y:i,cell:r.cell})}getSelectedClassName(t){return this.prefixClassName((t.isNode()?"node":"edge")+"-selected")}addCellSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.addClass(this.getSelectedClassName(t))}removeCellUnSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.removeClass(this.getSelectedClassName(t))}destroySelectionBox(t){this.removeCellUnSelectedClassName(t),this.canShowSelectionBox(t)&&(this.$container.find(`[data-cell-id="${t.id}"]`).remove(),0===this.$boxes.length&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(t){t.forEach((t=>this.removeCellUnSelectedClassName(t))),this.hide(),this.$boxes.remove(),this.boxCount=0}hide(){this.$container.removeClass(this.prefixClassName(hM.classNames.rubberband)).removeClass(this.prefixClassName(hM.classNames.selected))}showRubberband(){this.$container.addClass(this.prefixClassName(hM.classNames.rubberband))}hideRubberband(){this.$container.removeClass(this.prefixClassName(hM.classNames.rubberband))}showSelected(){this.$container.removeAttr("style").addClass(this.prefixClassName(hM.classNames.selected))}createContainer(){this.container=document.createElement("div"),this.$container=this.$(this.container),this.$container.addClass(this.prefixClassName(hM.classNames.root)),this.options.className&&this.$container.addClass(this.options.className),this.$selectionContainer=this.$("").addClass(this.prefixClassName(hM.classNames.inner)),this.$selectionContent=this.$("").addClass(this.prefixClassName(hM.classNames.content)),this.$selectionContainer.append(this.$selectionContent),this.$selectionContainer.attr("data-selection-length",this.collection.length),this.$container.prepend(this.$selectionContainer),this.$handleContainer=this.$selectionContainer}updateContainerPosition(t){(t.dx||t.dy)&&this.$selectionContainer.css({left:`+=${t.dx}`,top:`+=${t.dy}`})}updateContainer(){const t={x:1/0,y:1/0},e={x:0,y:0},n=this.collection.toArray().filter((t=>this.canShowSelectionBox(t)));n.forEach((n=>{const i=this.graph.renderer.findViewByCell(n);if(i){const n=i.getBBox({useCellGeometry:this.options.useCellGeometry});t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x+n.width),e.y=Math.max(e.y,n.y+n.height)}})),this.$selectionContainer.css({position:"absolute",pointerEvents:"none",left:t.x,top:t.y,width:e.x-t.x,height:e.y-t.y}).attr("data-selection-length",this.collection.length);const i=this.options.content;if(i)if("function"===typeof i){const t=Em(i,this.graph,this,this.$selectionContent[0]);t&&this.$selectionContent.html(t)}else this.$selectionContent.html(i);this.collection.length>0&&!this.container.parentNode?this.$container.appendTo(this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(t){return t.isNode()&&!0===this.options.showNodeSelectionBox||t.isEdge()&&!0===this.options.showEdgeSelectionBox}createSelectionBox(t){if(this.addCellSelectedClassName(t),this.canShowSelectionBox(t)){const e=this.graph.renderer.findViewByCell(t);if(e){const n=e.getBBox({useCellGeometry:this.options.useCellGeometry}),i=this.boxClassName;this.$("").addClass(i).addClass(`${i}-${t.isNode()?"node":"edge"}`).attr("data-cell-id",t.id).css({position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:this.options.pointerEvents||"auto"}).appendTo(this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(t={}){this.collection.length>0&&(this.boxesUpdated=!0,this.graph.renderer.requestViewUpdate(this,1,2,t))}confirmUpdate(){return this.boxCount&&(this.hide(),this.$boxes.each(((t,e)=>{const n=this.$(e).remove().attr("data-cell-id"),i=this.collection.get(n);i&&this.createSelectionBox(i)})),this.updateContainer()),0}getCellViewFromElem(t){const e=t.getAttribute("data-cell-id");if(e){const t=this.collection.get(e);if(t)return this.graph.renderer.findViewByCell(t)}return null}onCellRemoved({cell:t}){this.destroySelectionBox(t),this.updateContainer()}onReseted({previous:t,current:e}){this.destroyAllSelectionBoxes(t),e.forEach((t=>{this.listenCellRemoveEvent(t),this.createSelectionBox(t)})),this.updateContainer()}onCellAdded({cell:t}){this.listenCellRemoveEvent(t),this.createSelectionBox(t),this.updateContainer()}listenCellRemoveEvent(t){t.off("removed",this.onCellRemoved,this),t.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:t,removed:e,options:n}){t.forEach((t=>{this.trigger("cell:selected",{cell:t,options:n}),this.graph.trigger("cell:selected",{cell:t,options:n}),t.isNode()?(this.trigger("node:selected",{cell:t,options:n,node:t}),this.graph.trigger("node:selected",{cell:t,options:n,node:t})):t.isEdge()&&(this.trigger("edge:selected",{cell:t,options:n,edge:t}),this.graph.trigger("edge:selected",{cell:t,options:n,edge:t}))})),e.forEach((t=>{this.trigger("cell:unselected",{cell:t,options:n}),this.graph.trigger("cell:unselected",{cell:t,options:n}),t.isNode()?(this.trigger("node:unselected",{cell:t,options:n,node:t}),this.graph.trigger("node:unselected",{cell:t,options:n,node:t})):t.isEdge()&&(this.trigger("edge:unselected",{cell:t,options:n,edge:t}),this.graph.trigger("edge:unselected",{cell:t,options:n,edge:t}))}));const i={added:t,removed:e,options:n,selected:this.cells};this.trigger("selection:changed",i),this.graph.trigger("selection:changed",i)}deleteSelectedCells(){const t=this.collection.toArray();this.clean(),this.graph.model.removeCells(t,{selection:this.cid})}startRotate({e:t}){const e=this.collection.toArray(),n=ZS.getCellsBBox(e).getCenter(),i=this.graph.snapToGrid(t.clientX,t.clientY),s=e.reduce(((t,e)=>(t[e.id]=Ay.normalize(e.getAngle()),t)),{});this.setEventData(t,{center:n,angles:s,start:i.theta(n)})}doRotate({e:t}){const e=this.getEventData(t),n=this.graph.options.rotating.grid,i="function"===typeof n?Em(n,this.graph,null):n,s=this.graph.snapToGrid(t.clientX,t.clientY),r=e.start-s.theta(e.center);e.rotated||(e.rotated=!0),Math.abs(r)>.001&&(this.collection.toArray().forEach((t=>{const n=ww.snapToGrid(e.angles[t.id]+r,i||15);t.rotate(n,{absolute:!0,center:e.center,selection:this.cid})})),this.updateSelectionBoxes())}stopRotate({e:t}){const e=this.getEventData(t);e.rotated&&(e.rotated=!1,this.collection.toArray().forEach((e=>{cM("node:rotated",t,this.graph.findViewByCell(e))})))}startResize({e:t}){const e=this.graph.getGridSize(),n=this.collection.toArray(),i=ZS.getCellsBBox(n),s=n.map((t=>t.getBBox())),r=s.reduce(((t,e)=>e.widthe.height.001||Math.abs(o-l)>.001)&&(this.graph.model.resizeCells(a,l,i.cells,{selection:this.cid}),s.width=a,s.height=l,this.updateSelectionBoxes())}stopResize({e:t}){const e=this.eventData(t);e.resized&&(e.resized=!1,this.collection.toArray().forEach((e=>{cM("node:resized",t,this.graph.findViewByCell(e))})))}dispose(){this.clean(),this.remove()}}dM([Ex.dispose()],pM.prototype,"dispose",null),$u(pM,VA),function(t){const e="widget-selection";function n(t){return t.getAncestors().length}t.classNames={root:e,inner:`${e}-inner`,box:`${e}-box`,content:`${e}-content`,rubberband:`${e}-rubberband`,selected:`${e}-selected`},t.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.defaultOptions={movable:!0,following:!0,strict:!1,useCellGeometry:!1,content(t){return ug('<%= length %> node<%= length > 1 ? "s":"" %> selected.')({length:t.length})},handles:[{name:"remove",position:"nw",events:{mousedown:"deleteSelectedCells"}},{name:"rotate",position:"sw",events:{mousedown:"startRotate",mousemove:"doRotate",mouseup:"stopRotate"}},{name:"resize",position:"se",events:{mousedown:"startResize",mousemove:"doResize",mouseup:"stopResize"}}]},t.depthComparator=n}(hM||(hM={}));class gM extends qA{get node(){return this.cell}get containerClassName(){return this.prefixClassName("widget-transform")}get resizeClassName(){return`${this.containerClassName}-resize`}get rotateClassName(){return`${this.containerClassName}-rotate`}init(t){this.options=Object.assign(Object.assign({},uM.defaultOptions),t),this.render(),this.startListening()}startListening(){this.delegateEvents({[`mousedown .${this.resizeClassName}`]:"startResizing",[`touchstart .${this.resizeClassName}`]:"startResizing",[`mousedown .${this.rotateClassName}`]:"startRotating",[`touchstart .${this.rotateClassName}`]:"startRotating"}),this.model.on("*",this.update,this),this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this),this.node.on("removed",this.remove,this),this.model.on("reseted",this.remove,this),this.view.on("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.on("cell:knob:mouseup",this.onKnobMouseUp,this),super.startListening()}stopListening(){this.undelegateEvents(),this.model.off("*",this.update,this),this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this),this.node.off("removed",this.remove,this),this.model.off("reseted",this.remove,this),this.view.off("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.off("cell:knob:mouseup",this.onKnobMouseUp,this),super.stopListening()}renderHandles(){this.container=document.createElement("div"),this.$container=this.$(this.container);const t=this.$("").prop("draggable",!1),e=t.clone().addClass(this.rotateClassName),n=uM.POSITIONS.map((e=>t.clone().addClass(this.resizeClassName).attr("data-position",e)));this.empty(),this.$container.append(n,e)}render(){return this.renderHandles(),this.view.addClass(uM.NODE_CLS),this.$container.addClass(this.containerClassName).toggleClass("no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing).toggleClass("no-resize",!this.options.resizable).toggleClass("no-rotate",!this.options.rotatable),this.options.className&&this.$container.addClass(this.options.className),this.graph.container.appendChild(this.container),this.update()}update(){const t=this.graph.matrix(),e=this.node.getBBox();e.x*=t.a,e.x+=t.e,e.y*=t.d,e.y+=t.f,e.width*=t.a,e.height*=t.d;const n=Ay.normalize(this.node.getAngle()),i=0!==n?`rotate(${n}deg)`:"";return this.$container.css({transform:i,width:e.width,height:e.height,left:e.x,top:e.y}),this.updateResizerDirections(),this}remove(){return this.view.removeClass(uM.NODE_CLS),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){const t=Ay.normalize(this.node.getAngle()),e=Math.floor(t*(uM.DIRECTIONS.length/360));if(e!==this.prevShift){const t=uM.DIRECTIONS.slice(e).concat(uM.DIRECTIONS.slice(0,e)),n=t=>`${this.containerClassName}-cursor-${t}`;this.$container.find(`.${this.resizeClassName}`).removeClass(uM.DIRECTIONS.map((t=>n(t))).join(" ")).each(((e,i)=>{this.$(i).addClass(n(t[e]))})),this.prevShift=e}}getTrueDirection(t){const e=Ay.normalize(this.node.getAngle());let n=uM.POSITIONS.indexOf(t);return n+=Math.floor(e*(uM.POSITIONS.length/360)),n%=uM.POSITIONS.length,uM.POSITIONS[n]}toValidResizeDirection(t){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[t]||t}startResizing(t){t.stopPropagation(),this.model.startBatch("resize",{cid:this.cid});const e=this.$(t.target).attr("data-position"),n=this.graph.findViewByCell(this.node);this.prepareResizing(t,e),this.startAction(t),cM("node:resize:mousedown",t,n)}prepareResizing(t,e){const n=this.getTrueDirection(e);let i=0,s=0;e.split("-").forEach((t=>{i={left:-1,right:1}[t]||i,s={top:-1,bottom:1}[t]||s}));const r=this.toValidResizeDirection(e),o={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[r],a=Ay.normalize(this.node.getAngle());this.setEventData(t,{selector:o,direction:r,trueDirection:n,relativeDirection:e,angle:a,resizeX:i,resizeY:s,action:"resizing"})}startRotating(t){t.stopPropagation(),this.model.startBatch("rotate",{cid:this.cid});const e=this.graph.findViewByCell(this.node),n=this.node.getBBox().getCenter(),i=this.normalizeEvent(t),s=this.graph.snapToGrid(i.clientX,i.clientY);this.setEventData(t,{center:n,action:"rotating",angle:Ay.normalize(this.node.getAngle()),start:jy.create(s).theta(n)}),this.startAction(t),cM("node:rotate:mousedown",t,e)}onMouseMove(t){const e=this.graph.findViewByCell(this.node);let n=this.getEventData(t);if(n.action){const i=this.normalizeEvent(t);let s=i.clientX,r=i.clientY;const o=this.graph.scroller.widget,a=this.options.restrictedResizing;if(!0===a||"number"===typeof a){const t=!0===a?0:a,e=o?Math.max(t,8):t,n=this.graph.container.getBoundingClientRect();s=sm(s,n.left+e,n.right-e),r=sm(r,n.top+e,n.bottom-e)}else this.options.autoScrollOnResizing&&o&&o.autoScroll(s,r);const l=this.graph.snapToGrid(s,r),c=this.graph.getGridSize(),h=this.node,u=this.options;if("resizing"===n.action){n=n,n.resized||(e&&(e.addClass("node-resizing"),cM("node:resize",t,e)),n.resized=!0);const i=h.getBBox(),s=jy.create(l).rotate(n.angle,i.getCenter()).diff(i[n.selector]);let r=n.resizeX?s.x*n.resizeX:i.width,o=n.resizeY?s.y*n.resizeY:i.height;const a=r,d=o;if(r=ww.snapToGrid(r,c),o=ww.snapToGrid(o,c),r=Math.max(r,u.minWidth||c),o=Math.max(o,u.minHeight||c),r=Math.min(r,u.maxWidth||1/0),o=Math.min(o,u.maxHeight||1/0),u.preserveAspectRatio){const t=i.width*o/i.height,e=i.height*r/i.width;r{const r=n[s];i[s]="function"===typeof r?r.call(t,e):r})),i}t.parseOptionGroup=e})(fM||(fM={})),function(t){function e(e){const{grid:n,panning:i,selecting:s,embedding:r,snapline:o,resizing:a,rotating:l,knob:c,clipboard:h,history:u,scroller:d,minimap:p,keyboard:g,mousewheel:f}=e,m=mM(e,["grid","panning","selecting","embedding","snapline","resizing","rotating","knob","clipboard","history","scroller","minimap","keyboard","mousewheel"]),y=e.container;if(null==y)throw new Error("Ensure the container of the graph is specified and valid");null==m.width&&(m.width=y.clientWidth),null==m.height&&(m.height=y.clientHeight);const b=kc({},t.defaults,m),v={size:10,visible:!1};b.grid="number"===typeof n?{size:n,visible:!1}:"boolean"===typeof n?Object.assign(Object.assign({},v),{visible:n}):Object.assign(Object.assign({},v),n);const C=["panning","selecting","embedding","snapline","resizing","rotating","knob","clipboard","history","scroller","minimap","keyboard","mousewheel"];return C.forEach((t=>{const n=e[t];"boolean"===typeof n?b[t].enabled=n:b[t]=Object.assign(Object.assign({},b[t]),n)})),b.background&&b.scroller.enabled&&null==b.scroller.background&&(b.scroller.background=b.background,delete b.background),b}t.get=e}(fM||(fM={})),function(t){t.defaults={x:0,y:0,grid:{size:10,visible:!1},scaling:{min:.01,max:16},background:!1,highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:ww.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:ww.prefix("available-magnet")}}},connecting:{snap:!1,multi:!0,dangling:!0,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",strategy:null,router:"normal",connector:"normal",validateConnection({type:t,sourceView:e,targetView:n}){const i="target"===t?n:e;return null!=i},createEdge(){return new PA}},transforming:{clearAll:!0,clearOnBlankMouseDown:!0},resizing:{enabled:!1,minWidth:0,minHeight:0,maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,orthogonal:!0,restricted:!1,autoScroll:!0,preserveAspectRatio:!1,allowReverse:!0},rotating:{enabled:!1,grid:15},translating:{restrict:!1},knob:{enabled:!1,clearAll:!0,clearOnBlankMouseDown:!0},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},selecting:{enabled:!1,rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,movable:!0,strict:!1,useCellGeometry:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,content:null,handles:null},panning:{enabled:!1,eventTypes:["leftMouseDown"]},snapline:{enabled:!1},clipboard:{enabled:!1},history:{enabled:!1},scroller:{enabled:!1},keyboard:{enabled:!1},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},async:!1,frozen:!1,sorting:"exact",moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},guard:()=>!1}}(fM||(fM={}));var yM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s{const e=null!=t.opacity&&Number.isFinite(t.opacity)?t.opacity:1;return``})),r=`<${n}>${s.join("")}${n}>`,o=Object.assign({id:e},t.attrs);rb.create(r,o).appendTo(this.defs)}return e}marker(t){const{id:e,refX:n,refY:i,markerUnits:s,markerOrient:r,tagName:o,children:a}=t,l=yM(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let c=e;if(c||(c=`marker-${this.cid}-${Yf(JSON.stringify(t))}`),!this.isDefined(c)){"path"!==o&&delete l.d;const t=rb.create("marker",{refX:n,refY:i,id:c,overflow:"visible",orient:null!=r?r:"auto",markerUnits:s||"userSpaceOnUse"},a?a.map((t=>{var{tagName:e}=t,n=yM(t,["tagName"]);return rb.create(`${e}`||"path",dy(Object.assign(Object.assign({},l),n)))})):[rb.create(o||"path",dy(l))]);this.defs.appendChild(t.node)}return c}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}var vM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},CM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s{const o=`pattern_${r}`,a=n.a||1,l=n.d||1,{update:c,markup:h}=t,u=CM(t,["update","markup"]),d=Object.assign(Object.assign(Object.assign({},u),s[r]),{sx:a,sy:l,ox:n.e||0,oy:n.f||0,width:e*a,height:e*l});i.has(o)||i.add(o,rb.create("pattern",{id:o,patternUnits:"userSpaceOnUse"},rb.createVectors(h)).node);const p=i.get(o);"function"===typeof c&&c(p.childNodes[0],d);let g=d.ox%d.width;g<0&&(g+=d.width);let f=d.oy%d.height;f<0&&(f+=d.height),hy(p,{x:g,y:f,width:d.width,height:d.height})}));const r=(new XMLSerializer).serializeToString(i.root),o=`url(data:image/svg+xml;base64,${btoa(r)})`;this.elem.style.backgroundImage=o}getInstance(){return this.instance||(this.instance=new tw),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(null==e)return[Object.assign(Object.assign({},tw.presets.dot),t.args)];const n=tw.registry.get(e);if(n){let e=t.args||[];return Array.isArray(e)||(e=[e]),Array.isArray(n)?n.map(((t,n)=>Object.assign(Object.assign({},t),e[n]))):[Object.assign(Object.assign({},n),e[0])]}return tw.registry.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}vM([jA.dispose()],wM.prototype,"dispose",null);class xM extends jA{getClientMatrix(){return Lb(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new jy(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){const n="number"===typeof t?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y);return n.snapToGrid(this.graph.getGridSize())}localToGraphPoint(t,e){const n=jy.create(t,e);return Hb(n,this.graph.matrix())}localToClientPoint(t,e){const n=jy.create(t,e);return Hb(n,this.getClientMatrix())}localToPagePoint(t,e){const n="number"===typeof t?this.localToGraphPoint(t,e):this.localToGraphPoint(t);return n.translate(this.getPageOffset())}localToGraphRect(t,e,n,i){const s=Ly.create(t,e,n,i);return qb(s,this.graph.matrix())}localToClientRect(t,e,n,i){const s=Ly.create(t,e,n,i);return qb(s,this.getClientMatrix())}localToPageRect(t,e,n,i){const s="number"===typeof t?this.localToGraphRect(t,e,n,i):this.localToGraphRect(t);return s.translate(this.getPageOffset())}graphToLocalPoint(t,e){const n=jy.create(t,e);return Hb(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){const n=jy.create(t,e);return Hb(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){const n=jy.create(t,e);return Hb(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const n=jy.create(t,e),i=n.diff(this.getPageOffset());return this.graphToLocalPoint(i)}graphToLocalRect(t,e,n,i){const s=Ly.create(t,e,n,i);return qb(s,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,i){const s=Ly.create(t,e,n,i);return qb(s,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,i){const s=Ly.create(t,e,n,i);return qb(s,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,i){const s=Ly.create(t,e,n,i),r=this.getPageOffset();return s.x-=r.x,s.y-=r.y,this.graphToLocalRect(s)}}var EM,SM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class AM extends jA{constructor(){super(...arguments),this.widget=this.graph.hook.createSnapline()}dispose(){this.widget.dispose()}}SM([jA.dispose()],AM.prototype,"dispose",null),function(t){function e(t){const e=[],n=[];return Array.isArray(t)?e.push(...t):t.split("|").forEach((t=>{-1===t.indexOf("&")?e.push(t):n.push(...t.split("&"))})),{or:e,and:n}}function n(t,n){if(null!=t&&null!=n){const i=e(t),s=e(n),r=i.or.sort(),o=s.or.sort(),a=i.and.sort(),l=s.and.sort(),c=(t,e)=>t.length===e.length&&(0===t.length||t.every(((t,n)=>t===e[n])));return c(r,o)&&c(a,l)}return null==t&&null==n}function i(t,n,i){if(null==n||Array.isArray(n)&&0===n.length)return!i||!0!==t.altKey&&!0!==t.ctrlKey&&!0!==t.metaKey&&!0!==t.shiftKey;const{or:s,and:r}=e(n),o=e=>{const n=`${e.toLowerCase()}Key`;return!0===t[n]};return s.some((t=>o(t)))&&r.every((t=>o(t)))}t.parse=e,t.equals=n,t.isMatch=i}(EM||(EM={}));var MM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class kM extends jA{get widgetOptions(){return this.options.scroller}get pannable(){return!!this.widgetOptions&&("object"===typeof this.widgetOptions.pannable?this.widgetOptions.pannable.enabled:!!this.widgetOptions.pannable)}init(){this.widget=this.graph.hook.createScroller(),this.startListening(),this.updateClassName(),this.widget&&this.widget.center()}startListening(){let t=[];const e=this.widgetOptions.pannable;t="object"===typeof e?e.eventTypes||[]:["leftMouseDown"],t.includes("leftMouseDown")&&(this.graph.on("blank:mousedown",this.preparePanning,this),this.graph.on("node:unhandled:mousedown",this.preparePanning,this),this.graph.on("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&(this.onRightMouseDown=this.onRightMouseDown.bind(this),this.view.$(this.widget.container).on("mousedown",this.onRightMouseDown))}stopListening(){let t=[];const e=this.widgetOptions.pannable;t="object"===typeof e?e.eventTypes||[]:["leftMouseDown"],t.includes("leftMouseDown")&&(this.graph.off("blank:mousedown",this.preparePanning,this),this.graph.off("node:unhandled:mousedown",this.preparePanning,this),this.graph.off("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&this.view.$(this.widget.container).off("mousedown",this.onRightMouseDown)}onRightMouseDown(t){2===t.button&&this.allowPanning(t,!0)&&this.widget&&(this.updateClassName(!0),this.widget.startPanning(t),this.widget.once("pan:stop",(()=>this.updateClassName(!1))))}preparePanning({e:t}){this.widget&&(this.allowPanning(t,!0)||this.allowPanning(t)&&!this.graph.selection.allowRubberband(t,!0))&&(this.updateClassName(!0),this.widget.startPanning(t),this.widget.once("pan:stop",(()=>this.updateClassName(!1))))}allowPanning(t,e){return this.widget&&this.pannable&&EM.isMatch(t,this.widgetOptions.modifiers,e)&&this.graph.hook.allowPanning(t)}updateClassName(t){if(null==this.widget)return;const e=this.widget.container,n=this.view.prefixClassName("graph-scroller-pannable");this.pannable?(jm(e,n),e.dataset.panning=(!!t).toString()):Lm(e,n)}enablePanning(){this.pannable||(this.widgetOptions.pannable=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.pannable=!1,this.updateClassName())}lock(){this.widget&&this.widget.lock()}unlock(){this.widget&&this.widget.unlock()}update(){this.widget&&this.widget.update()}enableAutoResize(){this.widget&&this.widget.enableAutoResize()}disableAutoResize(){this.widget&&this.widget.disableAutoResize()}resize(t,e){this.widget&&this.widget.resize(t,e)}dispose(){this.widget&&this.widget.dispose(),this.stopListening()}}MM([jA.dispose()],kM.prototype,"dispose",null);var OM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},PM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class NM extends jA{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:t,magnet:e,options:n={}}){const i=this.resolveHighlighter(n);if(!i)return;const s=this.getHighlighterId(e,i);if(!this.highlights[s]){const n=i.highlighter;n.highlight(t,e,Object.assign({},i.args)),this.highlights[s]={cellView:t,magnet:e,highlighter:n,args:i.args}}}onCellUnhighlight({magnet:t,options:e={}}){const n=this.resolveHighlighter(e);if(!n)return;const i=this.getHighlighterId(t,n);this.unhighlight(i)}resolveHighlighter(t){const e=this.options;let n=t.highlighter;if(null==n){const i=t.type;n=i&&e.highlighting[i]||e.highlighting.default}if(null==n)return null;const i="string"===typeof n?{name:n}:n,s=i.name,r=Pw.registry.get(s);return null==r?Pw.registry.onNotFound(s):(Pw.check(s,r),{name:s,highlighter:r,args:i.args||{}})}getHighlighterId(t,e){return $m(t),e.name+t.id+JSON.stringify(e.args)}unhighlight(t){const e=this.highlights[t];e&&(e.highlighter.unhighlight(e.cellView,e.magnet,e.args),delete this.highlights[t])}dispose(){Object.keys(this.highlights).forEach((t=>this.unhighlight(t))),this.stopListening()}}DM([NM.dispose()],NM.prototype,"dispose",null);var jM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class LM extends jA{constructor(){super(...arguments),this.widgets=new Map}get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get isSelectionEnabled(){return!0===this.options.selecting.enabled}init(){this.startListening(),this.resize()}startListening(){this.graph.on("node:mouseup",this.onNodeMouseUp,this),this.graph.on("node:selected",this.onNodeSelected,this),this.graph.on("node:unselected",this.onNodeUnSelected,this)}stopListening(){this.graph.off("node:mouseup",this.onNodeMouseUp,this),this.graph.off("node:selected",this.onNodeSelected,this),this.graph.off("node:unselected",this.onNodeUnSelected,this)}onNodeMouseUp({node:t}){if(!this.isSelectionEnabled){const e=this.graph.hook.createTransform(t,{clearAll:!0});e&&this.widgets.set(t,e)}}onNodeSelected({node:t}){if(this.isSelectionEnabled){const e=this.graph.hook.createTransform(t,{clearAll:!1});e&&this.widgets.set(t,e)}}onNodeUnSelected({node:t}){if(this.isSelectionEnabled){const e=this.widgets.get(t);e&&e.dispose(),this.widgets.delete(t)}}getMatrix(){const t=this.viewport.getAttribute("transform");return t!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=t),Lb(this.viewportMatrix)}setMatrix(t){const e=Lb(t),n=Rb(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=void 0===t?this.options.width:t,i=void 0===e?this.options.height:e;this.options.width=n,this.options.height=i,"number"===typeof n&&(n=Math.round(n)),"number"===typeof i&&(i=Math.round(i)),this.container.style.width=null==n?"":`${n}px`,this.container.style.height=null==i?"":`${i}px`;const s=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},s)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return nm(t)||(t=this.container.clientWidth),nm(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return _b(this.getMatrix())}scale(t,e=t,n=0,i=0){if(t=this.clampScale(t),e=this.clampScale(e),n||i){const s=this.getTranslation(),r=s.tx-n*(t-1),o=s.ty-i*(e-1);r===s.tx&&o===s.ty||this.translate(r,o)}const s=this.getMatrix();return s.a=t,s.d=e,this.setMatrix(s),this.graph.trigger("scale",{sx:t,sy:e,ox:n,oy:i}),this}clampScale(t){const e=this.graph.options.scaling;return sm(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,i=t;const s=this.getScale(),r=this.getComputedSize();let o=r.width/2,a=r.height/2;if(e.absolute||(n+=s.sx,i+=s.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,i=Math.round(i/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),i=Math.min(e.maxScale,i)),e.minScale&&(n=Math.max(e.minScale,n),i=Math.max(e.minScale,i)),e.center&&(o=e.center.x,a=e.center.y),n=this.clampScale(n),i=this.clampScale(i),o||a){const t=this.getTranslation(),e=o-(o-t.tx)*(n/s.sx),r=a-(a-t.ty)*(i/s.sy);e===t.tx&&r===t.ty||this.translate(e,r)}return this.scale(n,i),this}getRotation(){return Vb(this.getMatrix())}rotate(t,e,n){if(null==e||null==n){const t=Yb(this.graph.view.stage);e=t.width/2,n=t.height/2}const i=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(i),this}getTranslation(){return Gb(this.getMatrix())}translate(t,e){const n=this.getMatrix();n.e=t||0,n.f=e||0,this.setMatrix(n);const i=this.getTranslation();return this.options.x=i.tx,this.options.y=i.ty,this.graph.trigger("translate",Object.assign({},i)),this}setOrigin(t,e){return this.translate(t||0,e||0)}fitToContent(t,e,n,i){if("object"===typeof t){const s=t;t=s.gridWidth||1,e=s.gridHeight||1,n=s.padding||0,i=s}else t=t||1,e=e||1,n=n||0,null==i&&(i={});const s=cm(n),r=i.border||0,o=i.contentArea?Ly.create(i.contentArea):this.getContentArea(i);r>0&&o.inflate(r);const a=this.getScale(),l=this.getTranslation(),c=a.sx,h=a.sy;o.x*=c,o.y*=h,o.width*=c,o.height*=h;let u=Math.max(Math.ceil((o.width+o.x)/t),1)*t,d=Math.max(Math.ceil((o.height+o.y)/e),1)*e,p=0,g=0;("negative"===i.allowNewOrigin&&o.x<0||"positive"===i.allowNewOrigin&&o.x>=0||"any"===i.allowNewOrigin)&&(p=Math.ceil(-o.x/t)*t,p+=s.left,u+=p),("negative"===i.allowNewOrigin&&o.y<0||"positive"===i.allowNewOrigin&&o.y>=0||"any"===i.allowNewOrigin)&&(g=Math.ceil(-o.y/e)*e,g+=s.top,d+=g),u+=s.right,d+=s.bottom,u=Math.max(u,i.minWidth||0),d=Math.max(d,i.minHeight||0),u=Math.min(u,i.maxWidth||Number.MAX_SAFE_INTEGER),d=Math.min(d,i.maxHeight||Number.MAX_SAFE_INTEGER);const f=this.getComputedSize(),m=u!==f.width||d!==f.height,y=p!==l.tx||g!==l.ty;return y&&this.translate(p,g),m&&this.resize(u,d),new Ly(-p/c,-g/h,u/c,d/h)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,i;if(t.contentArea){const e=t.contentArea;n=this.graph.localToGraph(e),i=jy.create(e)}else n=this.getContentBBox(t),i=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const s=cm(t.padding),r=t.minScale||0,o=t.maxScale||Number.MAX_SAFE_INTEGER,a=t.minScaleX||r,l=t.maxScaleX||o,c=t.minScaleY||r,h=t.maxScaleY||o;let u;if(t.viewportArea)u=t.viewportArea;else{const t=this.getComputedSize(),e=this.getTranslation();u={x:e.tx,y:e.ty,width:t.width,height:t.height}}u=Ly.create(u).moveAndExpand({x:s.left,y:s.top,width:-s.left-s.right,height:-s.top-s.bottom});const d=this.getScale();let p=u.width/n.width*d.sx,g=u.height/n.height*d.sy;!1!==t.preserveAspectRatio&&(p=g=Math.min(p,g));const f=t.scaleGrid;if(f&&(p=f*Math.floor(p/f),g=f*Math.floor(g/f)),p=sm(p,a,l),g=sm(g,c,h),this.scale(p,g),e){const t=this.options,e=u.x-i.x*p-t.x,n=u.y-i.y*g-t.y;this.translate(e,n)}}getContentArea(t={}){return t.useCellGeometry?this.model.getAllCellsBBox()||new Ly:Yb(this.graph.view.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=Ly.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=Ly.create(t),i=this.graph;e.contentArea=n,null==e.viewportArea&&(e.viewportArea={x:i.options.x,y:i.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);const s=n.getCenter();return this.centerPoint(s.x,s.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),i=this.getScale(),s=this.getTranslation(),r=n.width/2,o=n.height/2;t="number"===typeof t?t:r,e="number"===typeof e?e:o,t=r-t*i.sx,e=o-e*i.sy,s.tx===t&&s.ty===e||this.translate(t,e)}centerContent(t){const e=this.graph.getContentArea(t),n=e.getCenter();this.centerPoint(n.x,n.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){const i=this.getComputedSize();e=am(e,Math.max(0,i.width)),e<0&&(e=i.width+e),n=am(n,Math.max(0,i.height)),n<0&&(n=i.height+n);const s=this.getTranslation(),r=this.getScale(),o=e-t.x*r.sx,a=n-t.y*r.sy;s.tx===o&&s.ty===a||this.translate(o,a)}positionRect(t,e){const n=Ly.create(t);switch(e){case"center":return this.positionPoint(n.getCenter(),"50%","50%");case"top":return this.positionPoint(n.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(n.getTopRight(),"100%",0);case"right":return this.positionPoint(n.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(n.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(n.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(n.getBottomLeft(),0,"100%");case"left":return this.positionPoint(n.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(t,e){const n=t.getBBox();return this.positionRect(n,e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t)}dispose(){this.widgets.forEach((t=>t.dispose())),this.widgets.clear(),this.stopListening()}}jM([LM.dispose()],LM.prototype,"dispose",null);var FM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class BM extends jA{constructor(){super(...arguments),this.movedMap=new WeakMap,this.unselectMap=new WeakMap}get widgetOptions(){return this.options.selecting}get rubberbandDisabled(){return!0!==this.widgetOptions.enabled||!0!==this.widgetOptions.rubberband}get disabled(){return!0!==this.widgetOptions.enabled}get length(){return this.widget.length}get cells(){return this.widget.cells}init(){this.widget=this.graph.hook.createSelection(),this.startListening()}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.widget.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.widget.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!this.graph.scroller.allowPanning(t,!0)&&!this.graph.panning.allowPanning(t,!0))&&this.startRubberband(t)}onBlankClick(){this.clean()}allowRubberband(t,e){return!this.rubberbandDisabled&&EM.isMatch(t,this.widgetOptions.modifiers,e)&&this.graph.hook.allowRubberband(t)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){const n=this.widgetOptions;let i=this.disabled;!i&&this.movedMap.has(e)&&(i=!1===n.selectCellOnMoved,i||(i=!1===n.selectNodeOnMoved&&e.isNode()),i||(i=!1===n.selectEdgeOnMoved&&e.isEdge())),i||(!1===n.multiple||!t.ctrlKey&&!t.metaKey?this.reset(e):this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){this.disabled||!1!==this.widgetOptions.multiple&&(t.ctrlKey||t.metaKey)&&(this.unselect(e),this.unselectMap.set(e,!0))}isEmpty(){return this.length<=0}isSelected(t){return this.widget.isSelected(t)}getCells(t){return(Array.isArray(t)?t:[t]).map((t=>"string"===typeof t?this.graph.getCellById(t):t)).filter((t=>null!=t))}select(t,e={}){const n=this.getCells(t);return n.length&&(this.isMultiple()?this.widget.select(n,e):this.reset(n.slice(0,1),e)),this}unselect(t,e={}){return this.widget.unselect(this.getCells(t),e),this}reset(t,e={}){return this.widget.reset(t?this.getCells(t):[],e),this}clean(t={}){return this.widget.clean(t),this}enable(){return this.disabled&&(this.widgetOptions.enabled=!0),this}disable(){return this.disabled||(this.widgetOptions.enabled=!1),this}startRubberband(t){return this.rubberbandDisabled||this.widget.startSelecting(t),this}enableRubberband(){return this.rubberbandDisabled&&(this.widgetOptions.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.widgetOptions.rubberband=!1),this}isMultiple(){return!1!==this.widgetOptions.multiple}enableMultiple(){return this.widgetOptions.multiple=!0,this}disableMultiple(){return this.widgetOptions.multiple=!1,this}setModifiers(t){return this.widgetOptions.modifiers=t,this}setContent(t){return this.widget.setContent(t),this}setFilter(t){return this.widget.setFilter(t),this}dispose(){this.stopListening(),this.widget.dispose()}}FM([jA.dispose()],BM.prototype,"dispose",null);var RM,$M=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},zM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s0}canRedo(){return!this.disabled&&this.redoStack.length>0}validate(t,...e){return this.validator.validate(t,...e),this}dispose(){this.validator.dispose(),this.clean(),this.stopListening()}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach(((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])})),this.validator.on("invalid",(t=>this.trigger("invalid",t)))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach(((t,e)=>{this.model.off(t,this.handlers[e])})),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:!!t&&t.batch,data:{}}}revertCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?RM.sortBatchCommands(t):[t];for(let i=n.length-1;i>=0;i-=1){const t=n[i],s=Object.assign(Object.assign({},e),Pl(t.options,this.options.revertOptionsList||[]));this.executeCommand(t,!0,s)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?RM.sortBatchCommands(t):[t];for(let i=0;i=0&&(e||n)){const e=this.batchCommands.findIndex((e=>(o&&e.modelChange||e.data.id===r.id)&&e.event===t));e<0||RM.isAddEvent(t)||RM.isRemoveEvent(t)?a=this.createCommand({batch:!0}):(a=this.batchCommands[e],this.batchCommands.splice(e,1)),this.batchCommands.push(a),this.lastBatchIndex=this.batchCommands.length-1}}else a=this.createCommand({batch:!1});if(RM.isAddEvent(t)||RM.isRemoveEvent(t)){const e=a.data;return a.event=t,a.options=i,e.id=r.id,e.props=ku(r.toJSON()),r.isEdge()?e.edge=!0:r.isNode()&&(e.node=!0),this.push(a,i)}if(RM.isChangeEvent(t)){const n=e.key,s=a.data;return a.batch&&a.event||(a.event=t,a.options=i,s.key=n,null==s.prev&&(s.prev={}),s.prev[n]=Eu(r.previous(n)),o?a.modelChange=!0:s.id=r.id),null==s.next&&(s.next={}),s.next[n]=Eu(r.prop(n)),this.push(a,i)}const l=this.options.afterAddCommand;l&&Em(l,this,t,e,a),this.push(a,i)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStack.push(e),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice();const n=[];while(e.length>0){const t=e.shift(),i=t.event,s=t.data.id;if(null!=i&&(null!=s||t.modelChange)){if(RM.isAddEvent(i)){const t=e.findIndex((t=>RM.isRemoveEvent(t.event)&&t.data.id===s));if(t>=0){e=e.filter(((e,n)=>tRM.isAddEvent(t.event)&&t.data.id===s));if(t>=0){e.splice(t,1);continue}}else if(RM.isChangeEvent(i)){const e=t.data;if(Pc(e.prev,e.next))continue}n.push(t)}}return n}notify(t,e,n){const i=null==e?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:i,options:n}),this.emit("change",{cmds:i,options:n})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStack.push(t),this.notify("add",t,e))}}$M([px.dispose()],IM.prototype,"dispose",null),function(t){class e extends px{constructor(t){super(),this.map={},this.command=t.history,this.cancelInvalid=!1!==t.cancelInvalid,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:t}){return Array.isArray(t)?t.every((t=>this.isValidCommand(t))):this.isValidCommand(t)}isValidCommand(t){if(t.options&&!1===t.options.validation)return!0;const e=t.event&&this.map[t.event]||[];let n=null;return e.forEach((e=>{let i=0;const s=r=>{const o=e[i];i+=1;try{if(!o)return void(n=r);o(r,t,s)}catch(r){s(r)}};s(n)})),!n||(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:n}),!1)}validate(t,...e){const n=Array.isArray(t)?t:t.split(/\s+/);return e.forEach((t=>{if("function"!==typeof t)throw new Error(`${n.join(" ")} requires callback functions.`)})),n.forEach((t=>{null==this.map[t]&&(this.map[t]=[]),this.map[t].push(e)})),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}$M([px.dispose()],e.prototype,"dispose",null),t.Validator=e}(IM||(IM={})),function(t){function e(t){return"cell:added"===t}function n(t){return"cell:removed"===t}function i(t){return null!=t&&t.startsWith("cell:change:")}function s(e){const{graph:n}=e,i=zM(e,["graph"]),s=["cell:added","cell:removed","cell:change:*"],r=["batch:start","batch:stop"],o=e.eventNames?e.eventNames.filter((e=>!(t.isChangeEvent(e)||s.includes(e)||r.includes(e)))):s;return Object.assign(Object.assign({},i),{eventNames:o,applyOptionsList:e.applyOptionsList||["propertyPath"],revertOptionsList:e.revertOptionsList||["propertyPath"]})}function r(e){const n=[];for(let i=0,s=e.length;i=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class VM extends jA{get widgetOptions(){return this.options.minimap}init(){this.widget=this.graph.hook.createMiniMap()}dispose(){this.widget&&this.widget.dispose()}}_M([jA.dispose()],VM.prototype,"dispose",null);var GM=n(441),HM=n.n(GM),UM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class qM extends ux{constructor(t){super(),this.options=t;const e=this.graph.scroller.widget;this.container=e?e.container:this.graph.container,t.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=qM.createMousetrap(this)}get graph(){return this.options.graph}get disabled(){return!0!==this.options.enabled}enable(){this.disabled&&(this.options.enabled=!0,this.graph.options.keyboard.enabled=!0,this.target instanceof HTMLElement&&this.target.setAttribute("tabindex","-1"))}disable(){this.disabled||(this.options.enabled=!1,this.graph.options.keyboard.enabled=!1,this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))}on(t,e,n){this.mousetrap.bind(this.getKeys(t),e,n)}off(t,e){this.mousetrap.unbind(this.getKeys(t),e)}focus(t){const e=this.isInputEvent(t.e);if(e)return;const n=this.target;n.focus({preventScroll:!0})}getKeys(t){return(Array.isArray(t)?t:[t]).map((t=>this.formatkey(t)))}formatkey(t){const e=t.toLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command"),n=this.options.format;return n?Em(n,this.graph,e):e}isGraphEvent(t){const e=t.srcElement||t.target;return!!e&&(e===this.target||e===document.body||Km(this.container,e))}isInputEvent(t){const e=t.target,n=e&&e.tagName.toLowerCase();return"input"===n}isEnabledForEvent(t){const e=!this.disabled&&this.isGraphEvent(t),n=this.isInputEvent(t);if(e){const e=t.keyCode||t.which;if(n&&(8===e||46===e))return!1;if(this.options.guard)return Em(this.options.guard,this.graph,t)}return e}dispose(){this.mousetrap.reset()}}UM([ux.dispose()],qM.prototype,"dispose",null),function(t){function e(t){const e=new(HM())(t.target),n=e.stopCallback;return e.stopCallback=(i,s,r)=>!t.isEnabledForEvent(i)||!!n&&n.call(e,i,s,r),e}t.createMousetrap=e}(qM||(qM={}));var WM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class XM extends ux{constructor(t){super(),this.options=t,this.cumulatedFactor=1;const e=this.graph.scroller.widget;this.container=e?e.container:this.graph.container,this.target=this.options.global?document:this.container,this.mousewheelHandle=new hv(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.options.enabled&&this.enable(!0)}get graph(){return this.options.graph}get disabled(){return!0!==this.options.enabled}enable(t){(this.disabled||t)&&(this.options.enabled=!0,this.graph.options.mousewheel.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.options.enabled=!1,this.graph.options.mousewheel.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(t){const e=t.originalEvent||t,n=this.options.guard;return(null==n||n.call(this.graph,e))&&EM.isMatch(e,this.options.modifiers)}onMouseWheel(t){const e=t.originalEvent||t,n=this.options.guard;if((null==n||n.call(this.graph,e))&&EM.isMatch(e,this.options.modifiers)){const e=this.options.factor||1.2;null==this.currentScale&&(this.startPos={x:t.clientX,y:t.clientY},this.currentScale=this.graph.scroller.widget?this.graph.scroller.widget.zoom():this.graph.transform.getScale().sx);const n=t.deltaY;n<0?this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*e*20)/20/this.currentScale:this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/e)*20)/20/this.currentScale,this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const i=this.graph.scroller.widget,s=this.currentScale;let r=this.graph.transform.clampScale(s*this.cumulatedFactor);const o=this.options.minScale||Number.MIN_SAFE_INTEGER,a=this.options.maxScale||Number.MAX_SAFE_INTEGER;if(r=sm(r,o,a),r!==s)if(i)if(this.options.zoomAtMousePosition){const t=this.graph.coord.clientToLocalPoint(this.startPos);i.zoom(r,{absolute:!0,center:t.clone()})}else i.zoom(r,{absolute:!0});else if(this.options.zoomAtMousePosition){const t=this.graph.coord.clientToGraphPoint(this.startPos);this.graph.zoom(r,{absolute:!0,center:t.clone()})}else this.graph.zoom(r,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}WM([ux.dispose()],XM.prototype,"dispose",null);var YM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class JM extends jA{show(t={}){const e=Object.assign(Object.assign({},JM.defaultOptions),t),n=this.createPrintPages(e);e.ready(n,(t=>this.showPrintWindow(t,e)),{sheetSize:this.getSheetSize(e)})}get className(){return this.view.prefixClassName("graph-print")}showPrintWindow(t,e){if(t){const n=v()(document.body),i=v()(this.view.container),s=this.view.prefixClassName("graph-printing");n.addClass(s);const r=i.children().detach();t.forEach((t=>{t.removeClass(`${this.className}-preview`).addClass(`${this.className}-ready`).appendTo(n)}));let o=!1;const a=()=>{o||(o=!0,n.removeClass(s),t.forEach((t=>t.remove())),i.append(r),v()(`#${this.styleSheetId}`).remove(),this.graph.trigger("after:print",e),v()(window).off("afterprint",a))};v()(window).one("afterprint",a),setTimeout(a,200),window.print()}}createPrintPage(t,e){this.graph.trigger("before:print",e);const n=v()("").addClass(this.className),i=v()("").addClass(this.view.prefixClassName("graph-print-inner")).css("position","relative");e.size&&n.addClass(`${this.className}-size-${e.size}`);const s=rb.create(this.view.svg).clone(),r=s.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`);i.append(s.node);const o=this.getSheetSize(e),a=this.graph.transform.getGraphArea(),l=this.graph.transform.getScale(),c=this.graph.translate(),h=Lb().translate(c.tx/l.sx,c.ty/l.sy),u=this.getPageInfo(a,t,o),d=u.scale,p=u.bbox;return i.css({left:0,top:0}),s.attr({width:p.width*d,height:p.height*d,style:"position:relative",viewBox:[p.x,p.y,p.width,p.height].join(" ")}),r.attr("transform",Rb(h)),n.append(i),n.addClass(`${this.className}-preview`),{$page:n,sheetSize:o}}createPrintPages(t){let e;const n=this.getPrintArea(t),i=[];if(t.page){const s=this.getPageSize(n,t.page),r=this.getPageAreas(n,s);r.forEach((n=>{e=this.createPrintPage(n,t),i.push(e.$page)}))}else e=this.createPrintPage(n,t),i.push(e.$page);if(e){const n={width:e.sheetSize.cssWidth,height:e.sheetSize.cssHeight};this.updatePrintStyle(n,t)}return i}get styleSheetId(){return this.view.prefixClassName("graph-print-style")}updatePrintStyle(t,e){const n=Object.keys(t).reduce(((e,n)=>`${e} ${n}:${t[n]};`),""),i=cm(e.margin),s=e.marginUnit||"",r=e.sheetUnit||"",o=`\n @media print {\n .${this.className}.${this.className}-ready {\n ${n}\n }\n\n @page {\n margin:\n ${[i.top+s,i.right+s,i.bottom+s,i.left+s].join(" ")};\n size: ${e.sheet.width+r} ${e.sheet.height+r};\n\n .${this.className}.${this.className}-preview {\n ${n}\n }\n }`,a=this.styleSheetId,l=v()(`#${a}`);l.length?l.html(o):v()("head").append(`''`)}getPrintArea(t){let e=t.area;if(!e){const n=cm(t.padding);e=this.graph.getContentArea().moveAndExpand({x:-n.left,y:-n.top,width:n.left+n.right,height:n.top+n.bottom})}return e}getPageSize(t,e){if("object"===typeof e){const n=e,i={width:n.width,height:n.height};return null==i.width&&(i.width=Math.ceil(t.width/(n.columns||1))),null==i.height&&(i.height=Math.ceil(t.height/(n.rows||1))),i}return{width:t.width,height:t.height}}getPageAreas(t,e){const n=[],i=e.width,s=e.height;for(let r=0,o=0;re(t)}}(JM||(JM={}));class ZM extends jA{toSVG(t,e={}){this.graph.trigger("before:export",e);const n=this.view.svg,i=rb.create(n).clone();let s=i.node;const r=i.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),o=e.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),a=e.preserveDimensions;if(a){const t="boolean"===typeof a?o:a;i.attr({width:t.width,height:t.height})}if(i.removeAttribute("style").attr("viewBox",[o.x,o.y,o.width,o.height].join(" ")),r.removeAttribute("transform"),!1!==e.copyStyles){const t=n.ownerDocument,e=Array.from(n.querySelectorAll("*")),i=Array.from(s.querySelectorAll("*")),r=t.styleSheets.length,o=[];for(let n=r-1;n>=0;n-=1)o[n]=t.styleSheets[n],t.styleSheets[n].disabled=!0;const a={};e.forEach(((t,e)=>{const n=window.getComputedStyle(t,null),i={};Object.keys(n).forEach((t=>{i[t]=n.getPropertyValue(t)})),a[e]=i})),r!==t.styleSheets.length&&o.forEach(((e,n)=>{t.styleSheets[n]=e}));for(let n=0;n{const n=window.getComputedStyle(t,null),i=a[e],s={};Object.keys(n).forEach((t=>{rm(t)||n.getPropertyValue(t)===i[t]||(s[t]=n.getPropertyValue(t))})),l[e]=s})),i.forEach(((t,e)=>{v()(t).css(l[e])}))}const l=e.stylesheet;if("string"===typeof l){const t=n.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(l);i.prepend(rb.create("style",{type:"text/css"},[t]))}const c=()=>{const n=e.beforeSerialize;if("function"===typeof n){const t=Em(n,this.graph,s);t instanceof SVGSVGElement&&(s=t)}const i=(new XMLSerializer).serializeToString(s).replace(/ /g," ");this.graph.trigger("after:export",e),t(i)};if(e.serializeImages){const t=i.find("image").map((t=>new Promise((e=>{const n=t.attr("xlink:href")||t.attr("href");by.imageToDataUri(n,((n,i)=>{!n&&i&&t.attr("xlink:href",i),e()}))}))));Promise.all(t).then(c)}else c()}toDataURL(t,e){let n=e.viewBox||this.graph.getContentBBox();const i=cm(e.padding);e.width&&e.height&&(i.left+i.right>=e.width&&(i.left=i.right=0),i.top+i.bottom>=e.height&&(i.top=i.bottom=0));const s=new Ly(-i.left,-i.top,i.left+i.right,i.top+i.bottom);if(e.width&&e.height){const t=n.width+i.left+i.right,r=n.height+i.top+i.bottom;s.scale(t/e.width,r/e.height)}n=Ly.create(n).moveAndExpand(s);const r="number"===typeof e.width&&"number"===typeof e.height?{width:e.width,height:e.height}:n;let o=e.ratio?parseFloat(e.ratio):1;Number.isFinite(o)&&0!==o||(o=1);const a={width:Math.max(Math.round(r.width*o),1),height:Math.max(Math.round(r.height*o),1)};{const t=document.createElement("canvas"),e=t.getContext("2d");t.width=a.width,t.height=a.height;const n=a.width-1,i=a.height-1;e.fillStyle="rgb(1,1,1)",e.fillRect(n,i,1,1);const s=e.getImageData(n,i,1,1).data;if(1!==s[0]||1!==s[1]||1!==s[2])throw new Error("size exceeded")}const l=new Image;l.onload=()=>{const n=document.createElement("canvas");n.width=a.width,n.height=a.height;const i=n.getContext("2d");i.fillStyle=e.backgroundColor||"white",i.fillRect(0,0,a.width,a.height);try{i.drawImage(l,0,0,a.width,a.height);const s=n.toDataURL(e.type,e.quality);t(s)}catch(s){}},this.toSVG((t=>{l.src=`data:image/svg+xml,${encodeURIComponent(t)}`}),Object.assign(Object.assign({},e),{viewBox:n,serializeImages:!0,preserveDimensions:Object.assign({},a)}))}toPNG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/png"}))}toJPEG(t,e={}){this.toDataURL(t,Object.assign(Object.assign({},e),{type:"image/jpeg"}))}}class KM extends jA{constructor(){super(...arguments),this.widgets=new Map}get isSelectionEnabled(){return!0===this.options.selecting.enabled}init(){this.startListening()}startListening(){this.graph.on("node:mouseup",this.onNodeMouseUp,this),this.graph.on("node:selected",this.onNodeSelected,this),this.graph.on("node:unselected",this.onNodeUnSelected,this)}stopListening(){this.graph.off("node:mouseup",this.onNodeMouseUp,this),this.graph.off("node:selected",this.onNodeSelected,this),this.graph.off("node:unselected",this.onNodeUnSelected,this)}onNodeMouseUp({node:t}){if(!this.isSelectionEnabled){const e=this.graph.hook.createKnob(t,{clearAll:!0});e&&this.widgets.set(t,e)}}onNodeSelected({node:t}){if(this.isSelectionEnabled){const e=this.graph.hook.createKnob(t,{clearAll:!1});e&&this.widgets.set(t,e)}}onNodeUnSelected({node:t}){if(this.isSelectionEnabled){const e=this.widgets.get(t);e&&e.forEach((t=>t.dispose())),this.widgets.delete(t)}}}var QM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class tk extends jA{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.startListening(),this.updateClassName()}startListening(){const t=this.widgetOptions.eventTypes;t&&(t.includes("leftMouseDown")&&(this.graph.on("blank:mousedown",this.preparePanning,this),this.graph.on("node:unhandled:mousedown",this.preparePanning,this),this.graph.on("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&(this.onRightMouseDown=this.onRightMouseDown.bind(this),this.view.$(this.graph.container).on("mousedown",this.onRightMouseDown)),t.includes("mouseWheel")&&(this.mousewheelHandle=new hv(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()))}stopListening(){const t=this.widgetOptions.eventTypes;t&&(t.includes("leftMouseDown")&&(this.graph.off("blank:mousedown",this.preparePanning,this),this.graph.off("node:unhandled:mousedown",this.preparePanning,this),this.graph.off("edge:unhandled:mousedown",this.preparePanning,this)),t.includes("rightMouseDown")&&this.view.$(this.graph.container).off("mousedown",this.onRightMouseDown),t.includes("mouseWheel")&&this.mousewheelHandle&&this.mousewheelHandle.disable())}preparePanning({e:t}){(this.allowPanning(t,!0)||this.allowPanning(t)&&!this.graph.selection.allowRubberband(t,!0))&&this.startPanning(t)}allowPanning(t,e){return this.pannable&&EM.isMatch(t,this.widgetOptions.modifiers,e)&&this.graph.hook.allowPanning(t)}startPanning(t){const e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(),this.view.$(document.body).on({"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),this.view.$(window).on("mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.view.normalizeEvent(t),n=e.clientX-this.clientX,i=e.clientY-this.clientY;this.clientX=e.clientX,this.clientY=e.clientY,this.graph.translateBy(n,i)}stopPanning(t){this.panning=!1,this.updateClassName(),this.view.$(document.body).off(".panning"),this.view.$(window).off(".panning")}updateClassName(){const t=this.view.container,e=this.view.prefixClassName("graph-panning"),n=this.view.prefixClassName("graph-pannable");this.pannable?this.panning?(jm(t,e),Lm(t,n)):(Lm(t,e),jm(t,n)):(Lm(t,e),Lm(t,n))}onRightMouseDown(t){2===t.button&&this.allowPanning(t,!0)&&this.startPanning(t)}allowMouseWheel(t){return this.pannable&&!t.ctrlKey}onMouseWheel(t,e,n){t.ctrlKey||this.graph.translateBy(-e,-n)}autoPanning(t,e){const n=10,i=this.graph.getGraphArea();let s=0,r=0;t<=i.left+n&&(s=-n),e<=i.top+n&&(r=-n),t>=i.right-n&&(s=n),e>=i.bottom-n&&(r=n),0===s&&0===r||this.graph.translateBy(-s,-r)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}QM([jA.dispose()],tk.prototype,"dispose",null);var ek=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class nk extends jA{hasScroller(){return null!=this.graph.scroller.widget}getContainer(){return this.hasScroller()?this.graph.scroller.widget.container:this.graph.container}init(){const t=this.options.autoResize;if(t){const e="boolean"===typeof t?this.getContainer():t;fv.bind(e,(()=>{const t=this.getContainer(),e=t.offsetWidth,n=t.offsetHeight;this.resize(e,n)}))}}resize(t,e){this.hasScroller()?this.resizeScroller(t,e):this.resizeGraph(t,e)}resizeGraph(t,e){this.graph.transform.resize(t,e)}resizeScroller(t,e){this.graph.scroller.resize(t,e)}resizePage(t,e){const n=this.graph.scroller.widget;n&&n.updatePageSize(t,e)}dispose(){fv.clear(this.getContainer())}}ek([jA.dispose()],nk.prototype,"dispose",null);var ik,sk=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},rk=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s{const r=s.value,o=e||i;s.value=function(...e){const n=this.options[o];if(null!=n){this.getNativeValue=r.bind(this,...e);const i=Em(n,this.graph,...e);if(this.getNativeValue=null,null!=i||!0===t&&null===i)return i}return r.call(this,...e)}}}function n(t){return(e,n,i)=>{const s=i.value,r=t||n;i.value=function(...t){let e=s.call(this,...t);const n=this.options[r];return null!=n&&(e=Em(n,this.graph,...t)&&e),e}}}t.hook=e,t.after=n})(ik||(ik={}));class ok extends jA{createModel(){if(this.options.model)return this.options.model;const t=new bA;return t.graph=this.graph,t}createView(){return new BA(this.graph)}createRenderer(){return new nM(this.graph)}createDefsManager(){return new bM(this.graph)}createGridManager(){return new wM(this.graph)}createCoordManager(){return new xM(this.graph)}createKnobManager(){return new KM(this.graph)}createTransform(t,e){const n=this.getTransformOptions(t);return n.resizable||n.rotatable?new gM(Object.assign(Object.assign({node:t,graph:this.graph},n),e)):(n.clearAll&&gM.removeInstances(this.graph),null)}createKnob(t,e){const n=fM.parseOptionGroup(this.graph,t,this.options.knob),i=Object.assign(Object.assign({},n),e);i.clearAll&&WA.removeInstances(this.graph),i.clearAll=!1;const s=t.prop("knob"),r=[],o=Array.isArray(s)?s:[s];return o.forEach(((e,s)=>{e&&!1!==e.enabled&&("function"===typeof e.enabled&&!1===e.enabled.call(this.graph,t)||n.enabled&&r.push(new WA(Object.assign({node:t,index:s,graph:this.graph},i))))})),r}getTransformOptions(t){const e=fM.parseOptionGroup(this.graph,t,this.options.resizing),n=fM.parseOptionGroup(this.graph,t,this.options.rotating),i=fM.parseOptionGroup(this.graph,t,this.options.transforming),s=Object.assign(Object.assign({},i),{resizable:e.enabled,minWidth:e.minWidth,maxWidth:e.maxWidth,minHeight:e.minHeight,maxHeight:e.maxHeight,orthogonalResizing:e.orthogonal,restrictedResizing:null!=e.restrict?e.restrict:e.restricted,autoScrollOnResizing:e.autoScroll,preserveAspectRatio:e.preserveAspectRatio,allowReverse:e.allowReverse,rotatable:n.enabled,rotateGrid:n.grid});return s}createTransformManager(){return new LM(this.graph)}createHighlightManager(){return new NM(this.graph)}createBackgroundManager(){return new sM(this.graph)}createClipboard(){return new uk}createClipboardManager(){return new TM(this.graph)}createSnapline(){return new tM(Object.assign({graph:this.graph},this.options.snapline))}createSnaplineManager(){return new AM(this.graph)}createSelection(){return new pM(Object.assign({graph:this.graph},this.options.selecting))}createSelectionManager(){return new BM(this.graph)}allowRubberband(t){return!0}createHistoryManager(){return new IM(Object.assign({graph:this.graph},this.options.history))}createScroller(){return this.options.scroller.enabled?new lM(Object.assign({graph:this.graph},this.options.scroller)):null}createScrollerManager(){return new kM(this.graph)}allowPanning(t){return!0}createMiniMap(){const t=this.options.minimap,{enabled:e}=t,n=rk(t,["enabled"]);return e?new ZA(Object.assign({graph:this.graph},n)):null}createMiniMapManager(){return new VM(this.graph)}createKeyboard(){return new qM(Object.assign({graph:this.graph},this.options.keyboard))}createMouseWheel(){return new XM(Object.assign({graph:this.graph},this.options.mousewheel))}createPrintManager(){return new JM(this.graph)}createFormatManager(){return new ZM(this.graph)}createPanningManager(){return new tk(this.graph)}createSizeManager(){return new nk(this.graph)}allowConnectToBlank(t){const e=this.options.connecting,n=null!=e.allowBlank?e.allowBlank:e.dangling;if("function"!==typeof n)return!!n;const i=this.graph.findViewByCell(t),s=t.getSourceCell(),r=t.getTargetCell(),o=this.graph.findViewByCell(s),a=this.graph.findViewByCell(r);return Em(n,this.graph,{edge:t,edgeView:i,sourceCell:s,targetCell:r,sourceView:o,targetView:a,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:i.sourceMagnet,targetMagnet:i.targetMagnet})}validateEdge(t,e,n){if(!this.allowConnectToBlank(t)){const e=t.getSourceCellId(),n=t.getTargetCellId();if(!e||!n)return!1}const i=this.options.connecting.validateEdge;return!i||Em(i,this.graph,{edge:t,type:e,previous:n})}validateMagnet(t,e,n){if("passive"!==e.getAttribute("magnet")){const i=this.options.connecting.validateMagnet;return!i||Em(i,this.graph,{e:n,magnet:e,view:t,cell:t.cell})}return!1}getDefaultEdge(t,e){let n;const i=this.options.connecting.createEdge;return i&&(n=Em(i,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),null==n&&(n=new PA),n}validateConnection(t,e,n,i,s,r,o){const a=this.options.connecting,l=a.allowLoop,c=a.allowNode,h=a.allowEdge,u=a.allowPort,d=null!=a.allowMulti?a.allowMulti:a.multi,p=a.validateConnection,g=r?r.cell:null,f="target"===s?n:t,m="target"===s?i:e;let y=!0;const b=a=>{const l="source"===s?o?o.port:null:g?g.getSourcePortId():null,c="target"===s?o?o.port:null:g?g.getTargetPortId():null;return Em(a,this.graph,{edge:g,edgeView:r,sourceView:t,targetView:n,sourcePort:l,targetPort:c,sourceMagnet:e,targetMagnet:i,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:s})};if(null!=l&&("boolean"===typeof l?l||t!==n||(y=!1):y=b(l)),y&&null!=u&&("boolean"===typeof u?!u&&m&&(y=!1):y=b(u)),y&&null!=h&&("boolean"===typeof h?!h&&pA.isEdgeView(f)&&(y=!1):y=b(h)),y&&null!=c&&("boolean"===typeof c?c||null==f||gA.isNodeView(f)&&null==m&&(y=!1):y=b(c)),y&&null!=d&&r){const t=r.cell,e="source"===s?o:t.getSource(),n="target"===s?o:t.getTarget(),i=o?this.graph.getCellById(o.cell):null;if(e&&n&&e.cell&&n.cell&&i)if("function"===typeof d)y=b(d);else{const t=this.model.getConnectedEdges(i,{outgoing:"source"===s,incoming:"target"===s});if(t.length)if("withPort"===d){const i=t.some((t=>{const i=t.getSource(),s=t.getTarget();return i&&s&&i.cell===e.cell&&s.cell===n.cell&&null!=i.port&&i.port===e.port&&null!=s.port&&s.port===n.port}));i&&(y=!1)}else if(!d){const i=t.some((t=>{const i=t.getSource(),s=t.getTarget();return i&&s&&i.cell===e.cell&&s.cell===n.cell}));i&&(y=!1)}}}return y&&null!=p&&(y=b(p)),y}getRestrictArea(t){const e=this.options.translating.restrict,n="function"===typeof e?Em(e,this.graph,t):e;return"number"===typeof n?this.graph.transform.getGraphArea().inflate(n):!0===n?this.graph.transform.getGraphArea():n||null}onViewUpdated(t,e,n){e&nM.FLAG_INSERT||n.mounting||this.graph.renderer.requestConnectedEdgesUpdate(t,n)}onViewPostponed(t,e,n){return this.graph.renderer.forcePostponedViewUpdate(t,e)}getCellView(t){return null}createCellView(t){const e={graph:this.graph},n=this.getCellView(t);if(n)return new n(t,e);const i=t.view;if(null!=i&&"string"===typeof i){const n=Rx.registry.get(i);return n?new n(t,e):Rx.registry.onNotFound(i)}return t.isNode()?new gA(t,e):t.isEdge()?new pA(t,e):null}getHTMLComponent(t){let e=t.getHTML();return"string"===typeof e&&(e=TA.componentRegistry.get(e)||e),pc(e)&&(e=e.render),"function"===typeof e?Em(e,this.graph,t):e}shouldUpdateHTMLComponent(t){let e=t.getHTML();if("string"===typeof e&&(e=TA.componentRegistry.get(e)||e),pc(e)){const n=e.shouldComponentUpdate;return"function"===typeof n?Em(n,this.graph,t):!!n}return!1}onEdgeLabelRendered(t){}onPortRendered(t){}onToolItemCreated(t){}}sk([ik.hook()],ok.prototype,"createModel",null),sk([ik.hook()],ok.prototype,"createView",null),sk([ik.hook()],ok.prototype,"createRenderer",null),sk([ik.hook()],ok.prototype,"createDefsManager",null),sk([ik.hook()],ok.prototype,"createGridManager",null),sk([ik.hook()],ok.prototype,"createCoordManager",null),sk([ik.hook()],ok.prototype,"createKnobManager",null),sk([ik.hook()],ok.prototype,"createTransform",null),sk([ik.hook()],ok.prototype,"createKnob",null),sk([ik.hook()],ok.prototype,"createTransformManager",null),sk([ik.hook()],ok.prototype,"createHighlightManager",null),sk([ik.hook()],ok.prototype,"createBackgroundManager",null),sk([ik.hook()],ok.prototype,"createClipboard",null),sk([ik.hook()],ok.prototype,"createClipboardManager",null),sk([ik.hook()],ok.prototype,"createSnapline",null),sk([ik.hook()],ok.prototype,"createSnaplineManager",null),sk([ik.hook()],ok.prototype,"createSelection",null),sk([ik.hook()],ok.prototype,"createSelectionManager",null),sk([ik.hook()],ok.prototype,"allowRubberband",null),sk([ik.hook()],ok.prototype,"createHistoryManager",null),sk([ik.hook()],ok.prototype,"createScroller",null),sk([ik.hook()],ok.prototype,"createScrollerManager",null),sk([ik.hook()],ok.prototype,"allowPanning",null),sk([ik.hook()],ok.prototype,"createMiniMap",null),sk([ik.hook()],ok.prototype,"createMiniMapManager",null),sk([ik.hook()],ok.prototype,"createKeyboard",null),sk([ik.hook()],ok.prototype,"createMouseWheel",null),sk([ik.hook()],ok.prototype,"createPrintManager",null),sk([ik.hook()],ok.prototype,"createFormatManager",null),sk([ik.hook()],ok.prototype,"createPanningManager",null),sk([ik.hook()],ok.prototype,"createSizeManager",null),sk([ik.after()],ok.prototype,"onViewUpdated",null),sk([ik.after()],ok.prototype,"onViewPostponed",null),sk([ik.hook()],ok.prototype,"getCellView",null),sk([ik.hook(!0)],ok.prototype,"createCellView",null),sk([ik.hook()],ok.prototype,"getHTMLComponent",null),sk([ik.hook()],ok.prototype,"shouldUpdateHTMLComponent",null),sk([ik.hook()],ok.prototype,"onEdgeLabelRendered",null),sk([ik.hook()],ok.prototype,"onPortRendered",null),sk([ik.hook()],ok.prototype,"onToolItemCreated",null);var ak,lk,ck=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class hk extends px{constructor(t){super(),this.options=fM.get(t),this.css=new zA(this),this.hook=new ok(this),this.view=this.hook.createView(),this.defs=this.hook.createDefsManager(),this.coord=this.hook.createCoordManager(),this.transform=this.hook.createTransformManager(),this.knob=this.hook.createKnobManager(),this.highlight=this.hook.createHighlightManager(),this.grid=this.hook.createGridManager(),this.background=this.hook.createBackgroundManager(),this.model=this.hook.createModel(),this.renderer=this.hook.createRenderer(),this.clipboard=this.hook.createClipboardManager(),this.snapline=this.hook.createSnaplineManager(),this.selection=this.hook.createSelectionManager(),this.history=this.hook.createHistoryManager(),this.scroller=this.hook.createScrollerManager(),this.minimap=this.hook.createMiniMapManager(),this.keyboard=this.hook.createKeyboard(),this.mousewheel=this.hook.createMouseWheel(),this.print=this.hook.createPrintManager(),this.format=this.hook.createFormatManager(),this.panning=this.hook.createPanningManager(),this.size=this.hook.createSizeManager()}get container(){return this.view.container}get[Symbol.toStringTag](){return hk.toStringTag}isNode(t){return t.isNode()}isEdge(t){return t.isEdge()}resetCells(t,e={}){return this.model.resetCells(t,e),this}clearCells(t={}){return this.model.clear(t),this}toJSON(t={}){return this.model.toJSON(t)}parseJSON(t){return this.model.parseJSON(t)}fromJSON(t,e={}){return this.model.fromJSON(t,e),this}getCellById(t){return this.model.getCell(t)}addNode(t,e={}){return this.model.addNode(t,e)}addNodes(t,e={}){return this.addCell(t.map((t=>tA.isNode(t)?t:this.createNode(t))),e)}createNode(t){return this.model.createNode(t)}removeNode(t,e={}){return this.model.removeCell(t,e)}addEdge(t,e={}){return this.model.addEdge(t,e)}addEdges(t,e={}){return this.addCell(t.map((t=>uA.isEdge(t)?t:this.createEdge(t))),e)}removeEdge(t,e={}){return this.model.removeCell(t,e)}createEdge(t){return this.model.createEdge(t)}addCell(t,e={}){return this.model.addCell(t,e),this}removeCell(t,e={}){return this.model.removeCell(t,e)}removeCells(t,e={}){return this.model.removeCells(t,e)}removeConnectedEdges(t,e={}){return this.model.removeConnectedEdges(t,e)}disconnectConnectedEdges(t,e={}){return this.model.disconnectConnectedEdges(t,e),this}hasCell(t){return this.model.has(t)}getCell(t){return this.model.getCell(t)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(t){return this.model.getOutgoingEdges(t)}getIncomingEdges(t){return this.model.getIncomingEdges(t)}getConnectedEdges(t,e={}){return this.model.getConnectedEdges(t,e)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(t){return this.model.isRoot(t)}isLeafNode(t){return this.model.isLeaf(t)}getNeighbors(t,e={}){return this.model.getNeighbors(t,e)}isNeighbor(t,e,n={}){return this.model.isNeighbor(t,e,n)}getSuccessors(t,e={}){return this.model.getSuccessors(t,e)}isSuccessor(t,e,n={}){return this.model.isSuccessor(t,e,n)}getPredecessors(t,e={}){return this.model.getPredecessors(t,e)}isPredecessor(t,e,n={}){return this.model.isPredecessor(t,e,n)}getCommonAncestor(...t){return this.model.getCommonAncestor(...t)}getSubGraph(t,e={}){return this.model.getSubGraph(t,e)}cloneSubGraph(t,e={}){return this.model.cloneSubGraph(t,e)}cloneCells(t){return this.model.cloneCells(t)}getNodesFromPoint(t,e){return this.model.getNodesFromPoint(t,e)}getNodesInArea(t,e,n,i,s){return this.model.getNodesInArea(t,e,n,i,s)}getNodesUnderNode(t,e={}){return this.model.getNodesUnderNode(t,e)}searchCell(t,e,n={}){return this.model.search(t,e,n),this}getShortestPath(t,e,n={}){return this.model.getShortestPath(t,e,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(t,e={}){return this.model.getCellsBBox(t,e)}startBatch(t,e={}){this.model.startBatch(t,e)}stopBatch(t,e={}){this.model.stopBatch(t,e)}batchUpdate(t,e,n){const i="string"===typeof t?t:"update",s="string"===typeof t?e:t,r="function"===typeof e?n:e;this.startBatch(i,r);const o=s();return this.stopBatch(i,r),o}updateCellId(t,e){return this.model.updateCellId(t,e)}isFrozen(){return this.renderer.isFrozen()}freeze(t={}){return this.renderer.freeze(t),this}unfreeze(t={}){return this.renderer.unfreeze(t),this}isAsync(){return this.renderer.isAsync()}setAsync(t){return this.renderer.setAsync(t),this}findView(t){return ZS.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return Ly.isRectangleLike(t)?this.findViewsInArea(t):jy.isPointLike(t)?this.findViewsFromPoint(t):[]}findViewByCell(t){return this.renderer.findViewByCell(t)}findViewByElem(t){return this.renderer.findViewByElem(t)}findViewsFromPoint(t,e){const n="number"===typeof t?{x:t,y:e}:t;return this.renderer.findViewsFromPoint(n)}findViewsInArea(t,e,n,i,s){const r="number"===typeof t?{x:t,y:e,width:n,height:i}:t,o="number"===typeof t?s:e;return this.renderer.findViewsInArea(r,o)}isViewMounted(t){return this.renderer.isViewMounted(t)}getMountedViews(){return this.renderer.getMountedViews()}getUnmountedViews(){return this.renderer.getUnmountedViews()}matrix(t){return"undefined"===typeof t?this.transform.getMatrix():(this.transform.setMatrix(t),this)}resize(t,e){return this.size.resize(t,e),this}resizeGraph(t,e){return this.size.resizeGraph(t,e),this}resizeScroller(t,e){return this.size.resizeScroller(t,e),this}resizePage(t,e){return this.size.resizePage(t,e),this}scale(t,e=t,n=0,i=0){return"undefined"===typeof t?this.transform.getScale():(this.transform.scale(t,e,n,i),this)}zoom(t,e){const n=this.scroller.widget;if(n){if("undefined"===typeof t)return n.zoom();n.zoom(t,e)}else{if("undefined"===typeof t)return this.transform.getZoom();this.transform.zoom(t,e)}return this}zoomTo(t,e={}){const n=this.scroller.widget;n?n.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})):this.transform.zoom(t,Object.assign(Object.assign({},e),{absolute:!0}))}zoomToRect(t,e={}){const n=this.scroller.widget;return n?n.zoomToRect(t,e):this.transform.zoomToRect(t,e),this}zoomToFit(t={}){const e=this.scroller.widget;return e?e.zoomToFit(t):this.transform.zoomToFit(t),this}rotate(t,e,n){return"undefined"===typeof t?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return"undefined"===typeof t?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){const n=this.translate(),i=n.tx+t,s=n.ty+e;return this.translate(i,s)}getArea(){return this.transform.getGraphArea()}getGraphArea(){return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,i){return this.transform.fitToContent(t,e,n,i)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.scroller.widget;return i?i.centerPoint(t,e,n):this.transform.centerPoint(t,e),this}centerContent(t){const e=this.scroller.widget;return e?e.centerContent(t):this.transform.centerContent(t),this}centerCell(t,e){const n=this.scroller.widget;return n?n.centerCell(t,e):this.transform.centerCell(t),this}positionPoint(t,e,n,i={}){const s=this.scroller.widget;return s?s.positionPoint(t,e,n,i):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){const i=this.scroller.widget;return i?i.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){const i=this.scroller.widget;return i?i.positionCell(t,e,n):this.transform.positionCell(t,e),this}positionContent(t,e){const n=this.scroller.widget;return n?n.positionContent(t,e):this.transform.positionContent(t,e),this}getClientMatrix(){return this.coord.getClientMatrix()}getClientOffset(){return this.coord.getClientOffset()}getPageOffset(){return this.coord.getPageOffset()}snapToGrid(t,e){return this.coord.snapToGrid(t,e)}pageToLocal(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.pageToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.pageToLocalRect(t,e,n,i):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.localToPageRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToPageRect(t,e,n,i):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.clientToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToLocalRect(t,e,n,i):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.localToClientRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToClientRect(t,e,n,i):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.localToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToGraphRect(t,e,n,i):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.graphToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.graphToLocalRect(t,e,n,i):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,i){return Ly.isRectangleLike(t)?this.coord.clientToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToGraphRect(t,e,n,i):this.coord.clientToGraphPoint(t,e)}defineFilter(t){return this.defs.filter(t)}defineGradient(t){return this.defs.gradient(t)}defineMarker(t){return this.defs.marker(t)}getGridSize(){return this.grid.getGridSize()}setGridSize(t){return this.grid.setGridSize(t),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(t){return this.grid.draw(t),this}updateBackground(){return this.background.update(),this}drawBackground(t,e){const n=this.scroller.widget;return null==n||null!=this.options.background&&e?this.background.draw(t):n.backgroundManager.draw(t),this}clearBackground(t){const e=this.scroller.widget;return null==e||null!=this.options.background&&t?this.background.clear():e.backgroundManager.clear(),this}isClipboardEnabled(){return!this.clipboard.disabled}enableClipboard(){return this.clipboard.enable(),this}disableClipboard(){return this.clipboard.disable(),this}toggleClipboard(t){return null!=t?t!==this.isClipboardEnabled()&&(t?this.enableClipboard():this.disableClipboard()):this.isClipboardEnabled()?this.disableClipboard():this.enableClipboard(),this}isClipboardEmpty(){return this.clipboard.isEmpty()}getCellsInClipboard(){return this.clipboard.cells}cleanClipboard(){return this.clipboard.clean(),this}copy(t,e={}){return this.clipboard.copy(t,e),this}cut(t,e={}){return this.clipboard.cut(t,e),this}paste(t={},e=this){return this.clipboard.paste(t,e)}isHistoryEnabled(){return!this.history.disabled}enableHistory(){return this.history.enable(),this}disableHistory(){return this.history.disable(),this}toggleHistory(t){return null!=t?t!==this.isHistoryEnabled()&&(t?this.enableHistory():this.disableHistory()):this.isHistoryEnabled()?this.disableHistory():this.enableHistory(),this}undo(t={}){return this.history.undo(t),this}undoAndCancel(t={}){return this.history.cancel(t),this}redo(t={}){return this.history.redo(t),this}canUndo(){return this.history.canUndo()}canRedo(){return this.history.canRedo()}cleanHistory(t={}){this.history.clean(t)}isKeyboardEnabled(){return!this.keyboard.disabled}enableKeyboard(){return this.keyboard.enable(),this}disableKeyboard(){return this.keyboard.disable(),this}toggleKeyboard(t){return null!=t?t!==this.isKeyboardEnabled()&&(t?this.enableKeyboard():this.disableKeyboard()):this.isKeyboardEnabled()?this.disableKeyboard():this.enableKeyboard(),this}bindKey(t,e,n){return this.keyboard.on(t,e,n),this}unbindKey(t,e){return this.keyboard.off(t,e),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(t){return null==t?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():t?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){const t=this.scroller.widget;return t?this.scroller.pannable:this.panning.pannable}enablePanning(){const t=this.scroller.widget;return t?this.scroller.enablePanning():this.panning.enablePanning(),this}disablePanning(){const t=this.scroller.widget;return t?this.scroller.disablePanning():this.panning.disablePanning(),this}togglePanning(t){return null==t?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}lockScroller(){var t;null===(t=this.scroller.widget)||void 0===t||t.lock()}unlockScroller(){var t;null===(t=this.scroller.widget)||void 0===t||t.unlock()}updateScroller(){var t;null===(t=this.scroller.widget)||void 0===t||t.update()}getScrollbarPosition(){const t=this.scroller.widget;return t.scrollbarPosition()}setScrollbarPosition(t,e,n){const i=this.scroller.widget;return i.scrollbarPosition(t,e,n),this}scrollToPoint(t,e,n){const i=this.scroller.widget;return i.scrollToPoint(t,e,n),this}scrollToContent(t){const e=this.scroller.widget;return e.scrollToContent(t),this}scrollToCell(t,e){const n=this.scroller.widget;return n.scrollToCell(t,e),this}transitionToPoint(t,e,n){const i=this.scroller.widget;return i.transitionToPoint(t,e,n),this}transitionToRect(t,e={}){const n=this.scroller.widget;return n.transitionToRect(t,e),this}isSelectionEnabled(){return!this.selection.disabled}enableSelection(){return this.selection.enable(),this}disableSelection(){return this.selection.disable(),this}toggleSelection(t){return null!=t?t!==this.isSelectionEnabled()&&(t?this.enableSelection():this.disableSelection()):this.isSelectionEnabled()?this.disableSelection():this.enableSelection(),this}isMultipleSelection(){return this.selection.isMultiple()}enableMultipleSelection(){return this.selection.enableMultiple(),this}disableMultipleSelection(){return this.selection.disableMultiple(),this}toggleMultipleSelection(t){return null!=t?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return!1!==this.selection.widget.options.movable}enableSelectionMovable(){return this.selection.widget.options.movable=!0,this}disableSelectionMovable(){return this.selection.widget.options.movable=!1,this}toggleSelectionMovable(t){return null!=t?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.selection.rubberbandDisabled}enableRubberband(){return this.selection.enableRubberband(),this}disableRubberband(){return this.selection.disableRubberband(),this}toggleRubberband(t){return null!=t?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return!0===this.selection.widget.options.strict}enableStrictRubberband(){return this.selection.widget.options.strict=!0,this}disableStrictRubberband(){return this.selection.widget.options.strict=!1,this}toggleStrictRubberband(t){return null!=t?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(t){this.selection.setModifiers(t)}setSelectionFilter(t){return this.selection.setFilter(t),this}setSelectionDisplayContent(t){return this.selection.setContent(t),this}isSelectionEmpty(){return this.selection.isEmpty()}cleanSelection(t){return this.selection.clean(t),this}resetSelection(t,e){return this.selection.reset(t,e),this}getSelectedCells(){return this.selection.cells}getSelectedCellCount(){return this.selection.length}isSelected(t){return this.selection.isSelected(t)}select(t,e){return this.selection.select(t,e),this}unselect(t,e){return this.selection.unselect(t,e),this}isSnaplineEnabled(){return!this.snapline.widget.disabled}enableSnapline(){return this.snapline.widget.enable(),this}disableSnapline(){return this.snapline.widget.disable(),this}toggleSnapline(t){if(null==t)return this.isSnaplineEnabled()?this.disableSnapline():this.enableSnapline(),this;t!==this.isSnaplineEnabled()&&(t?this.enableSnapline():this.disableSnapline())}hideSnapline(){return this.snapline.widget.hide(),this}setSnaplineFilter(t){return this.snapline.widget.setFilter(t),this}isSnaplineOnResizingEnabled(){return!0===this.snapline.widget.options.resizing}enableSnaplineOnResizing(){return this.snapline.widget.options.resizing=!0,this}disableSnaplineOnResizing(){return this.snapline.widget.options.resizing=!1,this}toggleSnaplineOnResizing(t){return null!=t?t!==this.isSnaplineOnResizingEnabled()&&(t?this.enableSnaplineOnResizing():this.disableSnaplineOnResizing()):this.isSnaplineOnResizingEnabled()?this.disableSnaplineOnResizing():this.enableSnaplineOnResizing(),this}isSharpSnapline(){return!0===this.snapline.widget.options.sharp}enableSharpSnapline(){return this.snapline.widget.options.sharp=!0,this}disableSharpSnapline(){return this.snapline.widget.options.sharp=!1,this}toggleSharpSnapline(t){return null!=t?t!==this.isSharpSnapline()&&(t?this.enableSharpSnapline():this.disableSharpSnapline()):this.isSharpSnapline()?this.disableSharpSnapline():this.enableSharpSnapline(),this}getSnaplineTolerance(){return this.snapline.widget.options.tolerance}setSnaplineTolerance(t){return this.snapline.widget.options.tolerance=t,this}removeTools(){return this.emit("tools:remove"),this}hideTools(){return this.emit("tools:hide"),this}showTools(){return this.emit("tools:show"),this}toSVG(t,e={}){this.format.toSVG(t,e)}toDataURL(t,e){this.format.toDataURL(t,e)}toPNG(t,e={}){this.format.toPNG(t,e)}toJPEG(t,e={}){this.format.toJPEG(t,e)}printPreview(t){this.print.show(t)}dispose(){this.clearCells(),this.off(),this.css.dispose(),this.hook.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.knob.dispose(),this.highlight.dispose(),this.background.dispose(),this.clipboard.dispose(),this.snapline.dispose(),this.selection.dispose(),this.history.dispose(),this.keyboard.dispose(),this.mousewheel.dispose(),this.print.dispose(),this.format.dispose(),this.minimap.dispose(),this.panning.dispose(),this.scroller.dispose(),this.view.dispose(),this.renderer.dispose(),this.size.dispose()}}ck([LA.checkScroller()],hk.prototype,"lockScroller",null),ck([LA.checkScroller()],hk.prototype,"unlockScroller",null),ck([LA.checkScroller()],hk.prototype,"updateScroller",null),ck([LA.checkScroller()],hk.prototype,"getScrollbarPosition",null),ck([LA.checkScroller()],hk.prototype,"setScrollbarPosition",null),ck([LA.checkScroller()],hk.prototype,"scrollToPoint",null),ck([LA.checkScroller()],hk.prototype,"scrollToContent",null),ck([LA.checkScroller()],hk.prototype,"scrollToCell",null),ck([LA.checkScroller()],hk.prototype,"transitionToPoint",null),ck([LA.checkScroller()],hk.prototype,"transitionToRect",null),ck([px.dispose()],hk.prototype,"dispose",null),function(t){t.View=BA,t.Hook=ok,t.Renderer=nM,t.Keyboard=qM,t.MouseWheel=XM,t.BaseManager=jA,t.DefsManager=bM,t.GridManager=wM,t.CoordManager=xM,t.PrintManager=JM,t.FormatManager=ZM,t.MiniMapManager=VM,t.HistoryManager=IM,t.SnaplineManager=AM,t.ScrollerManager=kM,t.ClipboardManager=TM,t.TransformManager=LM,t.HighlightManager=NM,t.BackgroundManager=sM,t.SelectionManager=BM}(hk||(hk={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.hook&&null!=i.view&&null!=i.model}t.toStringTag=`X6.${t.name}`,t.isGraph=e}(hk||(hk={})),function(t){function e(e,n){const i=e instanceof HTMLElement?new t({container:e}):new t(e);return null!=n&&i.fromJSON(n),i}t.render=e}(hk||(hk={})),function(t){t.registerNode=tA.registry.register,t.registerEdge=uA.registry.register,t.registerView=Rx.registry.register,t.registerAttr=YC.registry.register,t.registerGrid=tw.registry.register,t.registerFilter=gw.registry.register,t.registerNodeTool=tE.registry.register,t.registerEdgeTool=eE.registry.register,t.registerBackground=vw.registry.register,t.registerHighlighter=Pw.registry.register,t.registerPortLayout=Gw.registry.register,t.registerPortLabelLayout=ax.registry.register,t.registerMarker=NC.registry.register,t.registerRouter=MS.registry.register,t.registerConnector=HS.registry.register,t.registerAnchor=CE.registry.register,t.registerEdgeAnchor=kE.registry.register,t.registerConnectionPoint=BE.registry.register,t.registerConnectionStrategy=Dx.registry.register,t.registerHTMLComponent=TA.componentRegistry.register}(hk||(hk={})),function(t){t.unregisterNode=tA.registry.unregister,t.unregisterEdge=uA.registry.unregister,t.unregisterView=Rx.registry.unregister,t.unregisterAttr=YC.registry.unregister,t.unregisterGrid=tw.registry.unregister,t.unregisterFilter=gw.registry.unregister,t.unregisterNodeTool=tE.registry.unregister,t.unregisterEdgeTool=eE.registry.unregister,t.unregisterBackground=vw.registry.unregister,t.unregisterHighlighter=Pw.registry.unregister,t.unregisterPortLayout=Gw.registry.unregister,t.unregisterPortLabelLayout=ax.registry.unregister,t.unregisterMarker=NC.registry.unregister,t.unregisterRouter=MS.registry.unregister,t.unregisterConnector=HS.registry.unregister,t.unregisterAnchor=CE.registry.unregister,t.unregisterEdgeAnchor=kE.registry.unregister,t.unregisterConnectionPoint=BE.registry.unregister,t.unregisterConnectionStrategy=Dx.registry.unregister,t.unregisterHTMLComponent=TA.componentRegistry.unregister}(hk||(hk={}));class uk{constructor(){this.cells=[]}copy(t,e,n={}){this.options=Object.assign({},n);const i=bA.isModel(e)?e:e.model,s=i.cloneSubGraph(t,n);this.cells=Ha(Object.keys(s).map((t=>s[t])),(t=>t.isEdge()?2:1)),this.serialize(n)}cut(t,e,n={}){this.copy(t,e,n);const i=hk.isGraph(e)?e.model:e;i.batchUpdate("cut",(()=>{t.forEach((t=>t.remove()))}))}paste(t,e={}){const n=Object.assign(Object.assign({},this.options),e),{offset:i,edgeProps:s,nodeProps:r}=n;let o=20,a=20;i&&(o="number"===typeof i?i:i.dx,a="number"===typeof i?i:i.dy),this.deserialize(n);const l=this.cells;l.forEach((t=>{t.model=null,t.removeProp("zIndex"),(o||a)&&t.translate(o,a),r&&t.isNode()&&t.prop(r),s&&t.isEdge()&&t.prop(s)}));const c=hk.isGraph(t)?t.model:t;return c.batchUpdate("paste",(()=>{c.addCells(this.cells)})),this.copy(l,t,e),l}serialize(t){!1!==t.useLocalStorage&&ak.save(this.cells)}deserialize(t){if(t.useLocalStorage){const t=ak.fetch();t&&(this.cells=t)}}isEmpty(){return this.cells.length<=0}clean(){this.options={},this.cells=[],ak.clean()}}(function(t){const e=`${Cw.prefixCls}.clipboard.cells`;function n(t){if(window.localStorage){const n=t.map((t=>t.toJSON()));localStorage.setItem(e,JSON.stringify(n))}}function i(){if(window.localStorage){const t=localStorage.getItem(e),n=t?JSON.parse(t):[];if(n)return bA.fromJSON(n)}}function s(){window.localStorage&&localStorage.removeItem(e)}t.save=n,t.fetch=i,t.clean=s})(ak||(ak={}));class dk{constructor(t){this.halo=t}get options(){return this.halo.options}get graph(){return this.halo.graph}get model(){return this.halo.model}get view(){return this.halo.view}get cell(){return this.halo.cell}get node(){return this.cell}getPresets(){return{className:"type-node",handles:[{name:"remove",position:"nw",events:{mousedown:this.removeCell.bind(this)},icon:null},{name:"resize",position:"se",events:{mousedown:this.startResize.bind(this),mousemove:this.doResize.bind(this),mouseup:this.stopResize.bind(this)},icon:null},{name:"clone",position:"n",events:{mousedown:this.startClone.bind(this),mousemove:this.doClone.bind(this),mouseup:this.stopClone.bind(this)},icon:null},{name:"link",position:"e",events:{mousedown:this.startLink.bind(this),mousemove:this.doLink.bind(this),mouseup:this.stopLink.bind(this)},icon:null},{name:"fork",position:"ne",events:{mousedown:this.startFork.bind(this),mousemove:this.doFork.bind(this),mouseup:this.stopFork.bind(this)},icon:null},{name:"unlink",position:"w",events:{mousedown:this.unlink.bind(this)},icon:null},{name:"rotate",position:"sw",events:{mousedown:this.startRotate.bind(this),mousemove:this.doRotate.bind(this),mouseup:this.stopRotate.bind(this)},icon:null}],bbox(t){if(this.options.useCellGeometry){const e=t.cell;return e.getBBox()}return t.getBBox()},content(t){const e=ug("x: <%= x %>, y: <%= y %>, width: <%= width %>, height: <%= height %>, angle: <%= angle %>"),n=t.cell,i=n.getBBox();return e({x:Math.floor(i.x),y:Math.floor(i.y),width:Math.floor(i.width),height:Math.floor(i.height),angle:Math.floor(n.getAngle())})},magnet(t){return t.container},tinyThreshold:40,smallThreshold:80,loopEdgePreferredSide:"top",loopEdgeWidth:40,rotateGrid:15,rotateEmbeds:!1}}removeCell(){this.model.removeConnectedEdges(this.cell),this.cell.remove()}startLink({x:t,y:e}){this.halo.startBatch();const n=this.graph,i=this.createEdgeConnectedToSource();i.setTarget({x:t,y:e}),this.model.addEdge(i,{validation:!1,halo:this.halo.cid,async:!1}),n.view.undelegateEvents(),this.edgeView=n.renderer.findViewByCell(i),this.edgeView.prepareArrowheadDragging("target",{x:t,y:e,fallbackAction:"remove"})}createEdgeConnectedToSource(){const t=this.getMagnet(this.view,"source"),e=this.getEdgeTerminal(this.view,t),n=this.graph.hook.getDefaultEdge(this.view,t);return n.setSource(e),n}getMagnet(t,e){const n=this.options.magnet;if("function"===typeof n){const i=Em(n,this.halo,t,e);if(i instanceof SVGElement)return i}throw new Error("`magnet()` has to return an SVGElement")}getEdgeTerminal(t,e){const n={cell:t.cell.id};if(e!==t.container){const i=e.getAttribute("port");i?n.port=i:n.selector=t.getSelector(e)}return n}doLink({e:t,x:e,y:n}){this.edgeView&&this.edgeView.onMouseMove(t,e,n)}stopLink({e:t,x:e,y:n}){const i=this.edgeView;if(i){i.onMouseUp(t,e,n);const s=i.cell;s.hasLoop()&&this.makeLoopEdge(s),this.halo.stopBatch(),this.halo.trigger("action:edge:addde",{edge:s}),this.edgeView=null}this.graph.view.delegateEvents()}makeLoopEdge(t){let e=null,n=null;const i=this.options.loopEdgeWidth,s=this.graph.options,r=new Ly(0,0,s.width,s.height),o=this.graph.graphToLocal(this.view.getBBox()),a=[this.options.loopEdgePreferredSide,"top","bottom","left","right"].some((t=>{let s=null,a=0,l=0;switch(t){case"top":s=new jy(o.x+o.width/2,o.y-i),a=i/2;break;case"bottom":s=new jy(o.x+o.width/2,o.y+o.height+i),a=i/2;break;case"left":s=new jy(o.x-i,o.y+o.height/2),l=i/2;break;case"right":s=new jy(o.x+o.width+i,o.y+o.height/2),l=i/2;break;default:break}return!!s&&(e=s.translate(-a,-l),n=s.translate(a,l),r.containsPoint(e)&&r.containsPoint(n))}));a&&e&&n&&t.setVertices([e,n])}startResize({e:t}){this.halo.startBatch(),this.flip=[1,0,0,1,1,0,0,1][Math.floor(Ay.normalize(this.node.getAngle())/45)],this.view.addClass("node-resizing"),cM("node:resize",t,this.view)}doResize({e:t,dx:e,dy:n}){const i=this.node.getSize(),s=Math.max(i.width+(this.flip?e:n),1),r=Math.max(i.height+(this.flip?n:e),1);this.node.resize(s,r,{absolute:!0}),cM("node:resizing",t,this.view)}stopResize({e:t}){this.view.removeClass("node-resizing"),cM("node:resized",t,this.view),this.halo.stopBatch()}startClone({e:t,x:e,y:n}){this.halo.startBatch();const i=this.options,s=i.clone(this.cell,{clone:!0});if(!ZS.isCell(s))throw new Error("option 'clone()' has to return a cell");this.centerNodeAtCursor(s,e,n),this.model.addCell(s,{halo:this.halo.cid,async:!1});const r=this.graph.renderer.findViewByCell(s);r.onMouseDown(t,e,n),this.halo.setEventData(t,{cloneView:r})}centerNodeAtCursor(t,e,n){const i=t.getBBox().getCenter(),s=e-i.x,r=n-i.y;t.translate(s,r)}doClone({e:t,x:e,y:n}){const i=this.halo.getEventData(t).cloneView;i&&i.onMouseMove(t,e,n)}stopClone({e:t,x:e,y:n}){const i=this.halo.getEventData(t).cloneView;i&&i.onMouseUp(t,e,n),this.halo.stopBatch()}startFork({e:t,x:e,y:n}){this.halo.startBatch();const i=this.options.clone(this.cell,{fork:!0});if(!ZS.isCell(i))throw new Error("option 'clone()' has to return a cell");this.centerNodeAtCursor(i,e,n),this.model.addCell(i,{halo:this.halo.cid,async:!1});const s=this.createEdgeConnectedToSource(),r=this.graph.renderer.findViewByCell(i),o=this.getMagnet(r,"target"),a=this.getEdgeTerminal(r,o);s.setTarget(a),this.model.addEdge(s,{halo:this.halo.cid,async:!1}),r.onMouseDown(t,e,n),this.halo.setEventData(t,{cloneView:r})}doFork({e:t,x:e,y:n}){const i=this.halo.getEventData(t).cloneView;i&&i.onMouseMove(t,e,n)}stopFork({e:t,x:e,y:n}){const i=this.halo.getEventData(t).cloneView;i&&i.onMouseUp(t,e,n),this.halo.stopBatch()}startRotate({e:t,x:e,y:n}){this.halo.startBatch();const i=this.node.getBBox().getCenter(),s=[this.node];this.options.rotateEmbeds&&this.node.getDescendants({deep:!0}).reduce(((t,e)=>(e.isNode()&&t.push(e),t)),s),this.halo.setEventData(t,{center:i,nodes:s,rotateStartAngles:s.map((t=>t.getAngle())),clientStartAngle:new jy(e,n).theta(i)}),s.forEach((e=>{const n=this.graph.findViewByCell(e);n&&(n.addClass("node-rotating"),cM("node:rotate",t,n))}))}doRotate({e:t,x:e,y:n}){const i=this.halo.getEventData(t),s=i.clientStartAngle-new jy(e,n).theta(i.center);i.nodes.forEach(((e,n)=>{const r=i.rotateStartAngles[n],o=ww.snapToGrid(r+s,this.options.rotateGrid);e.rotate(o,{absolute:!0,center:i.center,halo:this.halo.cid}),cM("node:rotating",t,this.graph.findViewByCell(e))}))}stopRotate({e:t}){const e=this.halo.getEventData(t);e.nodes.forEach((e=>{const n=this.graph.findViewByCell(e);n.removeClass("node-rotating"),cM("node:rotated",t,n)})),this.halo.stopBatch()}unlink(){this.halo.startBatch(),this.model.removeConnectedEdges(this.cell),this.halo.stopBatch()}}class pk{constructor(t){this.halo=t}get options(){return this.halo.options}get graph(){return this.halo.graph}get model(){return this.halo.model}get view(){return this.halo.view}get cell(){return this.halo.cell}get edge(){return this.cell}getPresets(){return{className:"type-edge",handles:[{name:"remove",position:"nw",icon:null,events:{mousedown:this.removeEdge.bind(this)}},{name:"direction",position:"se",icon:null,events:{mousedown:this.directionSwap.bind(this)}}],content:!1,bbox(t){return t.graph.localToGraph(t.getPointAtRatio(.5))},tinyThreshold:-1,smallThreshold:-1}}removeEdge(){this.cell.remove()}directionSwap(){const t=this.edge.getSource(),e=this.edge.getTarget();this.edge.prop({source:e,target:t})}}class gk extends qA{get type(){return this.options.type||"surround"}get handleOptions(){return this.options}init(t){this.options=kc(gk.defaultOptions,this.cell.isNode()?new dk(this).getPresets():this.cell.isEdge()?new pk(this).getPresets():null,t),this.render(),this.initHandles(),this.update(),this.startListening()}startListening(){const t=this.model,e=this.graph,n=this.view.cell;n.on("removed",this.remove,this),t.on("reseted",this.remove,this),e.on("halo:destroy",this.remove,this),t.on("*",this.update,this),e.on("scale",this.update,this),e.on("translate",this.update,this),super.startListening()}stopListening(){const t=this.model,e=this.graph,n=this.view.cell;this.undelegateEvents(),n.off("removed",this.remove,this),t.off("reseted",this.remove,this),e.off("halo:destroy",this.remove,this),t.off("*",this.update,this),e.off("scale",this.update,this),e.off("translate",this.update,this),super.stopListening()}render(){const t=this.options,e=this.prefixClassName("widget-halo");return this.view.addClass(lk.NODE_CLS),this.container=document.createElement("div"),this.$container=this.$(this.container).addClass(e).attr("data-shape",this.view.cell.shape),t.className&&this.$container.addClass(t.className),this.$handleContainer=this.$("").addClass(`${e}-handles`).appendTo(this.container),this.$content=this.$("").addClass(`${e}-content`).appendTo(this.container),this.$container.appendTo(this.graph.container),this}remove(){return this.stopBatch(),this.view.removeClass(lk.NODE_CLS),super.remove()}update(){if(this.isRendered()){this.updateContent();const t=this.getBBox(),e=this.options.tinyThreshold||0,n=this.options.smallThreshold||0;this.$handleContainer.toggleClass(`${this.handleClassName}-tiny`,t.width0;this.$handleContainer.children(".unlink").toggleClass("hidden",!t)}startBatch(){this.model.startBatch("halo",{halo:this.cid})}stopBatch(){this.model.hasActiveBatch("halo")&&this.model.stopBatch("halo",{halo:this.cid})}}(function(t){t.defaultOptions={type:"surround",clearAll:!0,clearOnBlankMouseDown:!0,useCellGeometry:!1,clone:t=>t.clone().removeZIndex()}})(gk||(gk={})),Object.getOwnPropertyNames(VA.prototype).forEach((t=>{"constructor"!==t&&Object.defineProperty(gk.prototype,t,Object.getOwnPropertyDescriptor(VA.prototype,t))})),function(t){t.NODE_CLS="has-widget-halo"}(lk||(lk={}));var fk,mk,yk,bk=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class vk extends Ex{constructor(t){super(),this.options=Object.assign(Object.assign({},vk.defaults),t),this.container=document.createElement("div"),this.$container=this.$(this.container).addClass(this.prefixClassName("widget-dnd")),this.draggingGraph=new hk(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1})),this.$container.append(this.draggingGraph.container)}get targetScroller(){const t=this.options.target;return hk.isGraph(t)?t.scroller.widget:t}get targetGraph(){const t=this.options.target;return hk.isGraph(t)?t:t.graph}get targetModel(){return this.targetGraph.model}get snapline(){return this.targetGraph.snapline.widget}start(t,e){const n=e;n.preventDefault(),this.targetModel.startBatch("dnd"),this.$container.addClass("dragging").appendTo(this.options.containerParent||document.body),this.sourceNode=t,this.prepareDragging(t,n.clientX,n.clientY);const i=this.updateNodePosition(n.clientX,n.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:n,node:t,cell:t,view:this.draggingView,x:i.x,y:i.y}),this.draggingNode.on("change:position",this.snap,this)),this.delegateDocumentEvents(vk.documentEvents,n.data)}isSnaplineEnabled(){return this.snapline&&!this.snapline.disabled}prepareDragging(t,e,n){const i=this.draggingGraph,s=i.model,r=this.options.getDragNode(t,{sourceNode:t,draggingGraph:i,targetGraph:this.targetGraph});r.position(0,0);let o=5;if(this.isSnaplineEnabled()&&(o+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){const t=this.targetGraph.transform.getScale();i.scale(t.sx,t.sy),o*=Math.max(t.sx,t.sy)}else i.scale(1,1);this.clearDragging(),this.options.animation&&this.$container.stop(!0,!0),s.resetCells([r]);const a=i.findViewByCell(r);a.undelegateEvents(),a.cell.off("changed"),i.fitToContent({padding:o,allowNewOrigin:"any"});const l=a.getBBox();this.geometryBBox=a.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(l.getTopLeft()),this.draggingNode=r,this.draggingView=a,this.draggingBBox=r.getBBox(),this.padding=o,this.originOffset=this.updateGraphPosition(e,n)}updateGraphPosition(t,e){const n=document.body.scrollTop||document.documentElement.scrollTop,i=this.delta,s=this.geometryBBox,r=this.padding||5,o={left:t-i.x-s.width/2-r,top:e-i.y-s.height/2-r+n};return this.draggingGraph&&this.$container.offset(o),o}updateNodePosition(t,e){const n=this.targetGraph.clientToLocal(t,e),i=this.draggingBBox;return n.x-=i.width/2,n.y-=i.height/2,this.draggingNode.position(n.x,n.y),n}snap({cell:t,current:e,options:n}){const i=t;if(n.snapped){const t=this.draggingBBox;i.position(t.x+n.tx,t.y+n.ty,{silent:!0}),this.draggingView.translate(),i.position(e.x,e.y,{silent:!0}),this.snapOffset={x:n.tx,y:n.ty}}else this.snapOffset=null}onDragging(t){const e=this.draggingView;if(e){t.preventDefault();const n=this.normalizeEvent(t),i=n.clientX,s=n.clientY;this.updateGraphPosition(i,s);const r=this.updateNodePosition(i,s),o=this.targetGraph.options.embedding.enabled,a=(o||this.isSnaplineEnabled())&&this.isInsideValidArea({x:i,y:s});if(o){e.setEventData(n,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});const t=e.getEventData(n);a?e.processEmbedding(n,t):e.clearEmbedding(t),this.candidateEmbedView=t.candidateEmbedView}this.isSnaplineEnabled()&&(a?this.snapline.snapOnMoving({e:n,view:e,x:r.x,y:r.y}):this.snapline.hide())}}onDragEnd(t){const e=this.draggingNode;if(e){const n=this.normalizeEvent(t),i=this.draggingView,s=this.draggingBBox,r=this.snapOffset;let o=s.x,a=s.y;r&&(o+=r.x,a+=r.y),e.position(o,a,{silent:!0});const l=this.drop(e,{x:n.clientX,y:n.clientY}),c=t=>{t?(this.onDropped(e),this.targetGraph.options.embedding.enabled&&i&&(i.setEventData(n,{cell:t,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),i.finalizeEmbedding(n,i.getEventData(n)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};Am(l)?(this.undelegateDocumentEvents(),l.then(c)):c(l)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}onDropped(t){this.draggingNode===t&&(this.clearDragging(),this.$container.removeClass("dragging").remove())}onDropInvalid(){const t=this.draggingNode;if(t){const e=this.options.animation;if(e){const n="object"===typeof e&&e.duration||150,i="object"===typeof e&&e.easing||"swing";this.draggingView=null,this.$container.animate(this.originOffset,n,i,(()=>this.onDropped(t)))}else this.onDropped(t)}}isInsideValidArea(t){let e;const n=this.targetGraph,i=this.targetScroller;if(i)if(i.options.autoResize)e=this.getDropArea(i.container);else{const t=this.getDropArea(i.container);e=this.getDropArea(n.container).intersectsWithRect(t)}else e=this.getDropArea(n.container);return e&&e.containsPoint(t)}getDropArea(t){const e=this.$(t),n=e.offset(),i=document.body.scrollTop||document.documentElement.scrollTop,s=document.body.scrollLeft||document.documentElement.scrollLeft;return Ly.create({x:n.left+parseInt(e.css("border-left-width"),10)-s,y:n.top+parseInt(e.css("border-top-width"),10)-i,width:e.innerWidth(),height:e.innerHeight()})}drop(t,e){if(this.isInsideValidArea(e)){const n=this.targetGraph,i=n.model,s=n.clientToLocal(e),r=this.sourceNode,o=this.options.getDropNode(t,{sourceNode:r,draggingNode:t,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),a=o.getBBox();s.x+=a.x-a.width/2,s.y+=a.y-a.height/2;const l=this.snapOffset?1:n.getGridSize();o.position(ww.snapToGrid(s.x,l),ww.snapToGrid(s.y,l)),o.removeZIndex();const c=this.options.validateNode,h=!c||c(o,{sourceNode:r,draggingNode:t,droppingNode:o,targetGraph:n,draggingGraph:this.draggingGraph});return"boolean"===typeof h?h?(i.addCell(o,{stencil:this.cid}),o):null:km(h).then((t=>t?(i.addCell(o,{stencil:this.cid}),o):null))}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove()}}function Ck(t,e={}){const n=bA.isModel(t)?t:(new bA).resetCells(t,{sort:!1,dryrun:!0}),i=n.getNodes(),s=e.columns||1,r=Math.ceil(i.length/s),o=e.dx||0,a=e.dy||0,l=!1!==e.center,c=!0===e.resizeToFit,h=e.marginX||0,u=e.marginY||0,d=[];let p=e.columnWidth;if("compact"===p)for(let b=0;b{const i=n%s,r=Math.floor(n/s),h=d[i],u=f[r];let p=0,m=0,b=t.getSize();if(c){let n=h-2*o,i=u-2*a;const s=b.height*(b.width?n/b.width:1),r=b.width*(b.height?i/b.height:1);ut.clone(),getDropNode:t=>t.clone()},t.documentEvents={mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"}}(vk||(vk={})),function(t){function e(t,e){return t.reduce(((t,n)=>Math.max(n.getSize()[e],t)),0)}function n(t,e,n){const i=[];for(let s=n*e,r=s+n;s(t.push(t[n]+e),t)),[e||0])}t.getMaxDim=e,t.getNodesInRow=n,t.getNodesInColumn=i,t.accumulate=s}(fk||(fk={}));class wk extends Ex{constructor(t){if(super(),this.graphs={},this.$groups={},this.options=Object.assign(Object.assign({},wk.defaultOptions),t),this.dnd=new vk(this.options),this.onSearch=mm(this.onSearch,200),this.container=document.createElement("div"),this.$container=this.$(this.container).addClass(this.prefixClassName(mk.base)).attr("data-not-found-text",this.options.notFoundText||"No matches found"),this.options.collapsable=t.collapsable&&t.groups&&t.groups.some((t=>!1!==t.collapsable)),this.options.collapsable){this.$container.addClass("collapsable");const e=t.groups&&t.groups.every((t=>t.collapsed||!1===t.collapsable));e&&this.$container.addClass("collapsed")}this.$("").addClass(this.prefixClassName(mk.title)).html(this.options.title).appendTo(this.$container),t.search&&this.$container.addClass("searchable").append(this.renderSearch()),this.$content=this.$("").addClass(this.prefixClassName(mk.content)).appendTo(this.$container);const e=t.stencilGraphOptions||{};if(t.groups&&t.groups.length)t.groups.forEach((n=>{const i=this.$("").addClass(this.prefixClassName(mk.group)).attr("data-name",n.name);(null==n.collapsable&&t.collapsable||!1!==n.collapsable)&&i.addClass("collapsable"),i.toggleClass("collapsed",!0===n.collapsed);const s=this.$("").addClass(this.prefixClassName(mk.groupTitle)).html(n.title||n.name),r=this.$("").addClass(this.prefixClassName(mk.groupContent)),o=n.graphOptions,a=new hk(Object.assign(Object.assign(Object.assign({},e),o),{container:document.createElement("div"),model:e.model||new bA,width:n.graphWidth||t.stencilGraphWidth,height:n.graphHeight||t.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));r.append(a.container),i.append(s,r).appendTo(this.$content),this.$groups[n.name]=i,this.graphs[n.name]=a}));else{const n=new hk(Object.assign(Object.assign({},e),{container:document.createElement("div"),model:e.model||new bA,width:t.stencilGraphWidth,height:t.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));this.$content.append(n.container),this.graphs[yk.defaultGroupName]=n}return this.startListening(),this}get targetScroller(){const t=this.options.target;return hk.isGraph(t)?t.scroller.widget:t}get targetGraph(){const t=this.options.target;return hk.isGraph(t)?t:t.graph}get targetModel(){return this.targetGraph.model}renderSearch(){return this.$("").addClass(this.prefixClassName(mk.search)).append(this.$("").attr({type:"search",placeholder:this.options.placeholder||"Search"}).addClass(this.prefixClassName(mk.searchText)))}startListening(){const t=this.prefixClassName(mk.title),e=this.prefixClassName(mk.searchText),n=this.prefixClassName(mk.groupTitle);this.delegateEvents({[`click .${t}`]:"onTitleClick",[`touchstart .${t}`]:"onTitleClick",[`click .${n}`]:"onGroupTitleClick",[`touchstart .${n}`]:"onGroupTitleClick",[`input .${e}`]:"onSearch",[`focusin .${e}`]:"onSearchFocusIn",[`focusout .${e}`]:"onSearchFocusOut"}),Object.keys(this.graphs).forEach((t=>{const e=this.graphs[t];e.on("cell:mousedown",this.onDragStart,this)}))}stopListening(){this.undelegateEvents(),Object.keys(this.graphs).forEach((t=>{const e=this.graphs[t];e.off("cell:mousedown",this.onDragStart,this)}))}load(t,e){return Array.isArray(t)?this.loadGroup(t,e):this.options.groups&&Object.keys(this.options.groups).forEach((e=>{t[e]&&this.loadGroup(t[e],e)})),this}loadGroup(t,e){const n=this.getModel(e);if(n){const e=t.map((t=>tA.isNode(t)?t:tA.create(t)));n.resetCells(e)}const i=this.getGroup(e);let s=this.options.stencilGraphHeight;i&&null!=i.graphHeight&&(s=i.graphHeight);const r=i&&i.layout||this.options.layout;if(r&&n&&Em(r,this,n,i),!s){const t=this.getGraph(e);t.fitToContent({minWidth:t.options.width,gridHeight:1,padding:i&&i.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(t){const{e:e,node:n}=t;this.dnd.start(n,e)}filter(t,e){const n=Object.keys(this.graphs).reduce(((n,i)=>{const s=this.graphs[i],r=i===yk.defaultGroupName?null:i,o=s.model.getNodes().filter((n=>{let i=!1;i="function"===typeof e?Em(e,this,n,t,r,this):"boolean"===typeof e?e:this.isCellMatched(n,t,e,t.toLowerCase()!==t);const o=s.renderer.findViewByCell(n);return o&&o.$(o.container).toggleClass("unmatched",!i),i})),a=o.length>0,l=this.options,c=new bA;return c.resetCells(o),l.layout&&Em(l.layout,this,c,this.getGroup(i)),this.$groups[i]&&this.$groups[i].toggleClass("unmatched",!a),s.fitToContent({gridWidth:1,gridHeight:1,padding:l.stencilGraphPadding||10}),n||a}),!1);this.$container.toggleClass("not-found",!n)}isCellMatched(t,e,n,i){return!e||!n||Object.keys(n).some((s=>{if("*"===s||t.shape===s){const r=n[s];if("boolean"===typeof r)return r;const o=Array.isArray(r)?r:[r];return o.some((n=>{let s=t.getPropByPath(n);return null!=s&&(s=`${s}`,i||(s=s.toLowerCase()),s.indexOf(e)>=0)}))}return!1}))}onSearch(t){this.filter(t.target.value,this.options.search)}onSearchFocusIn(){this.$container.addClass("is-focused")}onSearchFocusOut(){this.$container.removeClass("is-focused")}onTitleClick(){this.options.collapsable&&(this.$container.toggleClass("collapsed"),this.$container.hasClass("collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(t){const e=this.$(t.target).closest(`.${this.prefixClassName(mk.group)}`);this.toggleGroup(e.attr("data-name")||"");const n=Object.keys(this.$groups).every((t=>{const e=this.getGroup(t),n=this.$groups[t];return e&&!1===e.collapsable||n.hasClass("collapsed")}));this.$container.toggleClass("collapsed",n)}getModel(t){const e=this.getGraph(t);return e?e.model:null}getGraph(t){return this.graphs[t||yk.defaultGroupName]}getGroup(t){const e=this.options.groups;return null!=t&&e&&e.length?e.find((e=>e.name===t)):null}toggleGroup(t){return this.isGroupCollapsed(t)?this.expandGroup(t):this.collapseGroup(t),this}collapseGroup(t){if(this.isGroupCollapsable(t)){const e=this.$groups[t];e&&!this.isGroupCollapsed(t)&&(this.trigger("group:collapse",{name:t}),e.addClass("collapsed"))}return this}expandGroup(t){if(this.isGroupCollapsable(t)){const e=this.$groups[t];e&&this.isGroupCollapsed(t)&&(this.trigger("group:expand",{name:t}),e.removeClass("collapsed"))}return this}isGroupCollapsable(t){const e=this.$groups[t];return e.hasClass("collapsable")}isGroupCollapsed(t){const e=this.$groups[t];return e&&e.hasClass("collapsed")}collapseGroups(){return Object.keys(this.$groups).forEach((t=>this.collapseGroup(t))),this}expandGroups(){return Object.keys(this.$groups).forEach((t=>this.expandGroup(t))),this}resizeGroup(t,e){const n=this.graphs[t];return n&&n.resize(e.width,e.height),this}onRemove(){Object.keys(this.graphs).forEach((t=>{const e=this.graphs[t];e.view.remove(),delete this.graphs[t]})),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}}(function(t){t.defaultOptions=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(t,e){const n={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};Ck(t,Object.assign(Object.assign(Object.assign({},n),this.options.layoutOptions),e?e.layoutOptions:{}))}},vk.defaults)})(wk||(wk={})),function(t){t.base="widget-stencil",t.title=`${t.base}-title`,t.search=`${t.base}-search`,t.searchText=`${t.search}-text`,t.content=`${t.base}-content`,t.group=`${t.base}-group`,t.groupTitle=`${t.group}-title`,t.groupContent=`${t.group}-content`}(mk||(mk={})),function(t){t.defaultGroupName="__default__"}(yk||(yk={}));const xk="1.31.3";function Ek(){if(Cw.trackable){const t="https://kcart.alipay.com/web/bi.do",e=new Image,n=Object.assign(Object.assign({},Cw.trackInfo),{version:xk,pg:document.URL,r:(new Date).getTime(),x6:!0,page_type:"syslog"}),i=encodeURIComponent(JSON.stringify([n]));e.src=`${t}?BIProfile=merge&d=${i}`}}Cw.trackable&&setTimeout(Ek,3e3)},262:function(t,e,n){"use strict";n.d(e,{Bj:function(){return r},Fl:function(){return _t},IU:function(){return kt},Jd:function(){return E},PG:function(){return Et},SU:function(){return Rt},Um:function(){return Ct},WL:function(){return zt},X$:function(){return k},X3:function(){return Mt},Xl:function(){return Ot},dq:function(){return jt},iH:function(){return Lt},j:function(){return A},lk:function(){return S},qj:function(){return vt},qq:function(){return v},yT:function(){return At}});var i=n(577);let s;class r{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&s&&(this.parent=s,this.index=(s.scopes||(s.scopes=[])).push(this)-1)}run(t){if(this.active){const e=s;try{return s=this,t()}finally{s=e}}else 0}on(){s=this}off(){s=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e{const e=new Set(t);return e.w=0,e.n=0,e},l=t=>(t.w&g)>0,c=t=>(t.n&g)>0,h=({deps:t})=>{if(t.length)for(let e=0;e{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i{("length"===e||e>=s)&&c.push(t)}));else switch(void 0!==n&&c.push(l.get(n)),e){case"add":(0,i.kJ)(t)?(0,i.S0)(n)&&c.push(l.get("length")):(c.push(l.get(y)),(0,i._N)(t)&&c.push(l.get(b)));break;case"delete":(0,i.kJ)(t)||(c.push(l.get(y)),(0,i._N)(t)&&c.push(l.get(b)));break;case"set":(0,i._N)(t)&&c.push(l.get(y));break}if(1===c.length)c[0]&&O(c[0]);else{const t=[];for(const e of c)e&&t.push(...e);O(a(t))}}function O(t,e){for(const n of(0,i.kJ)(t)?t:[...t])(n!==m||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const P=(0,i.fY)("__proto__,__v_isRef,__isVue"),T=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(i.yk)),D=B(),N=B(!1,!0),j=B(!0),L=F();function F(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=kt(this);for(let e=0,s=this.length;e{t[e]=function(...t){E();const n=kt(this)[e].apply(this,t);return S(),n}})),t}function B(t=!1,e=!1){return function(n,s,r){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&r===(t?e?mt:ft:e?gt:pt).get(n))return n;const o=(0,i.kJ)(n);if(!t&&o&&(0,i.RI)(L,s))return Reflect.get(L,s,r);const a=Reflect.get(n,s,r);if((0,i.yk)(s)?T.has(s):P(s))return a;if(t||A(n,"get",s),e)return a;if(jt(a)){const t=!o||!(0,i.S0)(s);return t?a.value:a}return(0,i.Kn)(a)?t?wt(a):vt(a):a}}const R=z(),$=z(!0);function z(t=!1){return function(e,n,s,r){let o=e[n];if(St(o)&&jt(o)&&!jt(s))return!1;if(!t&&!St(s)&&(At(s)||(s=kt(s),o=kt(o)),!(0,i.kJ)(e)&&jt(o)&&!jt(s)))return o.value=s,!0;const a=(0,i.kJ)(e)&&(0,i.S0)(n)?Number(n)t,W=t=>Reflect.getPrototypeOf(t);function X(t,e,n=!1,i=!1){t=t["__v_raw"];const s=kt(t),r=kt(e);e!==r&&!n&&A(s,"get",e),!n&&A(s,"get",r);const{has:o}=W(s),a=i?q:n?Tt:Pt;return o.call(s,e)?a(t.get(e)):o.call(s,r)?a(t.get(r)):void(t!==s&&t.get(e))}function Y(t,e=!1){const n=this["__v_raw"],i=kt(n),s=kt(t);return t!==s&&!e&&A(i,"has",t),!e&&A(i,"has",s),t===s?n.has(t):n.has(t)||n.has(s)}function J(t,e=!1){return t=t["__v_raw"],!e&&A(kt(t),"iterate",y),Reflect.get(t,"size",t)}function Z(t){t=kt(t);const e=kt(this),n=W(e),i=n.has.call(e,t);return i||(e.add(t),k(e,"add",t,t)),this}function K(t,e){e=kt(e);const n=kt(this),{has:s,get:r}=W(n);let o=s.call(n,t);o||(t=kt(t),o=s.call(n,t));const a=r.call(n,t);return n.set(t,e),o?(0,i.aU)(e,a)&&k(n,"set",t,e,a):k(n,"add",t,e),this}function Q(t){const e=kt(this),{has:n,get:i}=W(e);let s=n.call(e,t);s||(t=kt(t),s=n.call(e,t));const r=i?i.call(e,t):void 0,o=e.delete(t);return s&&k(e,"delete",t,void 0,r),o}function tt(){const t=kt(this),e=0!==t.size,n=void 0,i=t.clear();return e&&k(t,"clear",void 0,void 0,n),i}function et(t,e){return function(n,i){const s=this,r=s["__v_raw"],o=kt(r),a=e?q:t?Tt:Pt;return!t&&A(o,"iterate",y),r.forEach(((t,e)=>n.call(i,a(t),a(e),s)))}}function nt(t,e,n){return function(...s){const r=this["__v_raw"],o=kt(r),a=(0,i._N)(o),l="entries"===t||t===Symbol.iterator&&a,c="keys"===t&&a,h=r[t](...s),u=n?q:e?Tt:Pt;return!e&&A(o,"iterate",c?b:y),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:l?[u(t[0]),u(t[1])]:u(t),done:e}},[Symbol.iterator](){return this}}}}function it(t){return function(...e){return"delete"!==t&&this}}function st(){const t={get(t){return X(this,t)},get size(){return J(this)},has:Y,add:Z,set:K,delete:Q,clear:tt,forEach:et(!1,!1)},e={get(t){return X(this,t,!1,!0)},get size(){return J(this)},has:Y,add:Z,set:K,delete:Q,clear:tt,forEach:et(!1,!0)},n={get(t){return X(this,t,!0)},get size(){return J(this,!0)},has(t){return Y.call(this,t,!0)},add:it("add"),set:it("set"),delete:it("delete"),clear:it("clear"),forEach:et(!0,!1)},i={get(t){return X(this,t,!0,!0)},get size(){return J(this,!0)},has(t){return Y.call(this,t,!0)},add:it("add"),set:it("set"),delete:it("delete"),clear:it("clear"),forEach:et(!0,!0)},s=["keys","values","entries",Symbol.iterator];return s.forEach((s=>{t[s]=nt(s,!1,!1),n[s]=nt(s,!0,!1),e[s]=nt(s,!1,!0),i[s]=nt(s,!0,!0)})),[t,n,e,i]}const[rt,ot,at,lt]=st();function ct(t,e){const n=e?t?lt:at:t?ot:rt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get((0,i.RI)(n,s)&&s in e?n:e,s,r)}const ht={get:ct(!1,!1)},ut={get:ct(!1,!0)},dt={get:ct(!0,!1)};const pt=new WeakMap,gt=new WeakMap,ft=new WeakMap,mt=new WeakMap;function yt(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function bt(t){return t["__v_skip"]||!Object.isExtensible(t)?0:yt((0,i.W7)(t))}function vt(t){return St(t)?t:xt(t,!1,G,ht,pt)}function Ct(t){return xt(t,!1,U,ut,gt)}function wt(t){return xt(t,!0,H,dt,ft)}function xt(t,e,n,s,r){if(!(0,i.Kn)(t))return t;if(t["__v_raw"]&&(!e||!t["__v_isReactive"]))return t;const o=r.get(t);if(o)return o;const a=bt(t);if(0===a)return t;const l=new Proxy(t,2===a?s:n);return r.set(t,l),l}function Et(t){return St(t)?Et(t["__v_raw"]):!(!t||!t["__v_isReactive"])}function St(t){return!(!t||!t["__v_isReadonly"])}function At(t){return!(!t||!t["__v_isShallow"])}function Mt(t){return Et(t)||St(t)}function kt(t){const e=t&&t["__v_raw"];return e?kt(e):t}function Ot(t){return(0,i.Nj)(t,"__v_skip",!0),t}const Pt=t=>(0,i.Kn)(t)?vt(t):t,Tt=t=>(0,i.Kn)(t)?wt(t):t;function Dt(t){w&&m&&(t=kt(t),M(t.dep||(t.dep=a())))}function Nt(t,e){t=kt(t),t.dep&&O(t.dep)}function jt(t){return!(!t||!0!==t.__v_isRef)}function Lt(t){return Ft(t,!1)}function Ft(t,e){return jt(t)?t:new Bt(t,e)}class Bt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:kt(t),this._value=e?t:Pt(t)}get value(){return Dt(this),this._value}set value(t){t=this.__v_isShallow?t:kt(t),(0,i.aU)(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:Pt(t),Nt(this,t))}}function Rt(t){return jt(t)?t.value:t}const $t={get:(t,e,n)=>Rt(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const s=t[e];return jt(s)&&!jt(n)?(s.value=n,!0):Reflect.set(t,e,n,i)}};function zt(t){return Et(t)?t:new Proxy(t,$t)}class It{constructor(t,e,n,i){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new v(t,(()=>{this._dirty||(this._dirty=!0,Nt(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!i,this["__v_isReadonly"]=n}get value(){const t=kt(this);return Dt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function _t(t,e,n=!1){let s,r;const o=(0,i.mf)(t);o?(s=t,r=i.dG):(s=t.get,r=t.set);const a=new It(s,r,o||!r,n);return a}},252:function(t,e,n){"use strict";n.d(e,{$d:function(){return o},FN:function(){return vn},Fl:function(){return Fn},HY:function(){return De},Ko:function(){return ln},LL:function(){return Oe},P$:function(){return ot},Q6:function(){return dt},U2:function(){return lt},Uk:function(){return tn},Us:function(){return ve},WI:function(){return cn},Wm:function(){return Je},Y3:function(){return x},Y8:function(){return it},YP:function(){return K},_:function(){return Ye},aZ:function(){return pt},bv:function(){return Mt},dG:function(){return on},f3:function(){return J},h:function(){return Bn},iD:function(){return Ve},ic:function(){return Ot},j4:function(){return Ge},kq:function(){return en},mx:function(){return un},nK:function(){return ut},up:function(){return Me},w5:function(){return I},wg:function(){return Re},wy:function(){return ue}});var i=n(262),s=n(577);function r(t,e,n,i){let s;try{s=i?t(...i):t()}catch(r){a(r,e,n)}return s}function o(t,e,n,i){if((0,s.mf)(t)){const o=r(t,e,n,i);return o&&(0,s.tI)(o)&&o.catch((t=>{a(t,e,n)})),o}const l=[];for(let s=0;s>>1,s=N(u[i]);sd&&u.splice(e,1)}function k(t,e,n,i){(0,s.kJ)(t)?n.push(...t):e&&e.includes(t,t.allowRecurse?i+1:i)||n.push(t),A()}function O(t){k(t,g,p,f)}function P(t){k(t,y,m,b)}function T(t,e=null){if(p.length){for(w=e,g=[...new Set(p)],p.length=0,f=0;fN(t)-N(e))),b=0;bnull==t.id?1/0:t.id;function j(t){h=!1,c=!0,T(t),u.sort(((t,e)=>N(t)-N(e)));s.dG;try{for(d=0;dt.trim())):e&&(r=n.map(s.He))}let c;let h=i[c=(0,s.hR)(e)]||i[c=(0,s.hR)((0,s._A)(e))];!h&&a&&(h=i[c=(0,s.hR)((0,s.rs)(e))]),h&&o(h,t,6,r);const u=i[c+"Once"];if(u){if(t.emitted){if(t.emitted[c])return}else t.emitted={};t.emitted[c]=!0,o(u,t,6,r)}}function F(t,e,n=!1){const i=e.emitsCache,r=i.get(t);if(void 0!==r)return r;const o=t.emits;let a={},l=!1;if(!(0,s.mf)(t)){const i=t=>{const n=F(t,e,!0);n&&(l=!0,(0,s.l7)(a,n))};!n&&e.mixins.length&&e.mixins.forEach(i),t.extends&&i(t.extends),t.mixins&&t.mixins.forEach(i)}return o||l?((0,s.kJ)(o)?o.forEach((t=>a[t]=null)):(0,s.l7)(a,o),i.set(t,a),a):(i.set(t,null),null)}function B(t,e){return!(!t||!(0,s.F7)(e))&&(e=e.slice(2).replace(/Once$/,""),(0,s.RI)(t,e[0].toLowerCase()+e.slice(1))||(0,s.RI)(t,(0,s.rs)(e))||(0,s.RI)(t,e))}let R=null,$=null;function z(t){const e=R;return R=t,$=t&&t.type.__scopeId||null,e}function I(t,e=R,n){if(!e)return t;if(t._n)return t;const i=(...n)=>{i._d&&Ie(-1);const s=z(e),r=t(...n);return z(s),i._d&&Ie(1),r};return i._n=!0,i._c=!0,i._d=!0,i}function _(t){const{type:e,vnode:n,proxy:i,withProxy:r,props:o,propsOptions:[l],slots:c,attrs:h,emit:u,render:d,renderCache:p,data:g,setupState:f,ctx:m,inheritAttrs:y}=t;let b,v;const C=z(t);try{if(4&n.shapeFlag){const t=r||i;b=nn(d.call(t,t,p,o,f,g,m)),v=h}else{const t=e;0,b=nn(t.length>1?t(o,{attrs:h,slots:c,emit:u}):t(o,null)),v=e.props?h:V(h)}}catch(x){Fe.length=0,a(x,t,1),b=Je(je)}let w=b;if(v&&!1!==y){const t=Object.keys(v),{shapeFlag:e}=w;t.length&&7&e&&(l&&t.some(s.tR)&&(v=G(v,l)),w=Qe(w,v))}return n.dirs&&(w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),b=w,z(C),b}const V=t=>{let e;for(const n in t)("class"===n||"style"===n||(0,s.F7)(n))&&((e||(e={}))[n]=t[n]);return e},G=(t,e)=>{const n={};for(const i in t)(0,s.tR)(i)&&i.slice(9)in e||(n[i]=t[i]);return n};function H(t,e,n){const{props:i,children:s,component:r}=t,{props:o,children:a,patchFlag:l}=e,c=r.emitsOptions;if(e.dirs||e.transition)return!0;if(!(n&&l>=0))return!(!s&&!a||a&&a.$stable)||i!==o&&(i?!o||U(i,o,c):!!o);if(1024&l)return!0;if(16&l)return i?U(i,o,c):!!o;if(8&l){const t=e.dynamicProps;for(let e=0;et.__isSuspense;function X(t,e){e&&e.pendingBranch?(0,s.kJ)(t)?e.effects.push(...t):e.effects.push(t):P(t)}function Y(t,e){if(bn){let n=bn.provides;const i=bn.parent&&bn.parent.provides;i===n&&(n=bn.provides=Object.create(i)),n[t]=e}else 0}function J(t,e,n=!1){const i=bn||R;if(i){const r=null==i.parent?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(r&&t in r)return r[t];if(arguments.length>1)return n&&(0,s.mf)(e)?e.call(i.proxy):e}else 0}const Z={};function K(t,e,n){return Q(t,e,n)}function Q(t,e,{immediate:n,deep:a,flush:l,onTrack:c,onTrigger:h}=s.kT){const u=bn;let d,p,g=!1,f=!1;if((0,i.dq)(t)?(d=()=>t.value,g=(0,i.yT)(t)):(0,i.PG)(t)?(d=()=>t,a=!0):(0,s.kJ)(t)?(f=!0,g=t.some(i.PG),d=()=>t.map((t=>(0,i.dq)(t)?t.value:(0,i.PG)(t)?nt(t):(0,s.mf)(t)?r(t,u,2):void 0))):d=(0,s.mf)(t)?e?()=>r(t,u,2):()=>{if(!u||!u.isUnmounted)return p&&p(),o(t,u,3,[m])}:s.dG,e&&a){const t=d;d=()=>nt(t())}let m=t=>{p=C.onStop=()=>{r(t,u,4)}};if(An)return m=s.dG,e?n&&o(e,u,3,[d(),f?[]:void 0,m]):d(),s.dG;let y=f?[]:Z;const b=()=>{if(C.active)if(e){const t=C.run();(a||g||(f?t.some(((t,e)=>(0,s.aU)(t,y[e]))):(0,s.aU)(t,y)))&&(p&&p(),o(e,u,3,[t,y===Z?void 0:y,m]),y=t)}else C.run()};let v;b.allowRecurse=!!e,v="sync"===l?b:"post"===l?()=>be(b,u&&u.suspense):()=>{!u||u.isMounted?O(b):b()};const C=new i.qq(d,v);return e?n?b():y=C.run():"post"===l?be(C.run.bind(C),u&&u.suspense):C.run(),()=>{C.stop(),u&&u.scope&&(0,s.Od)(u.scope.effects,C)}}function tt(t,e,n){const i=this.proxy,r=(0,s.HD)(t)?t.includes(".")?et(i,t):()=>i[t]:t.bind(i,i);let o;(0,s.mf)(e)?o=e:(o=e.handler,n=e);const a=bn;Cn(this);const l=Q(r,o.bind(i),n);return a?Cn(a):wn(),l}function et(t,e){const n=e.split(".");return()=>{let e=t;for(let t=0;t{nt(t,e)}));else if((0,s.PO)(t))for(const n in t)nt(t[n],e);return t}function it(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Mt((()=>{t.isMounted=!0})),Pt((()=>{t.isUnmounting=!0})),t}const st=[Function,Array],rt={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:st,onEnter:st,onAfterEnter:st,onEnterCancelled:st,onBeforeLeave:st,onLeave:st,onAfterLeave:st,onLeaveCancelled:st,onBeforeAppear:st,onAppear:st,onAfterAppear:st,onAppearCancelled:st},setup(t,{slots:e}){const n=vn(),s=it();let r;return()=>{const o=e.default&&dt(e.default(),!0);if(!o||!o.length)return;let a=o[0];if(o.length>1){let t=!1;for(const e of o)if(e.type!==je){0,a=e,t=!0;break}}const l=(0,i.IU)(t),{mode:c}=l;if(s.isLeaving)return ct(a);const h=ht(a);if(!h)return ct(a);const u=lt(h,l,s,n);ut(h,u);const d=n.subTree,p=d&&ht(d);let g=!1;const{getTransitionKey:f}=h.type;if(f){const t=f();void 0===r?r=t:t!==r&&(r=t,g=!0)}if(p&&p.type!==je&&(!Ue(h,p)||g)){const t=lt(p,l,s,n);if(ut(p,t),"out-in"===c)return s.isLeaving=!0,t.afterLeave=()=>{s.isLeaving=!1,n.update()},ct(a);"in-out"===c&&h.type!==je&&(t.delayLeave=(t,e,n)=>{const i=at(s,p);i[String(p.key)]=p,t._leaveCb=()=>{e(),t._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=n})}return a}}},ot=rt;function at(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function lt(t,e,n,i){const{appear:s,mode:r,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:h,onEnterCancelled:u,onBeforeLeave:d,onLeave:p,onAfterLeave:g,onLeaveCancelled:f,onBeforeAppear:m,onAppear:y,onAfterAppear:b,onAppearCancelled:v}=e,C=String(t.key),w=at(n,t),x=(t,e)=>{t&&o(t,i,9,e)},E={mode:r,persisted:a,beforeEnter(e){let i=l;if(!n.isMounted){if(!s)return;i=m||l}e._leaveCb&&e._leaveCb(!0);const r=w[C];r&&Ue(t,r)&&r.el._leaveCb&&r.el._leaveCb(),x(i,[e])},enter(t){let e=c,i=h,r=u;if(!n.isMounted){if(!s)return;e=y||c,i=b||h,r=v||u}let o=!1;const a=t._enterCb=e=>{o||(o=!0,x(e?r:i,[t]),E.delayedLeave&&E.delayedLeave(),t._enterCb=void 0)};e?(e(t,a),e.length<=1&&a()):a()},leave(e,i){const s=String(t.key);if(e._enterCb&&e._enterCb(!0),n.isUnmounting)return i();x(d,[e]);let r=!1;const o=e._leaveCb=n=>{r||(r=!0,i(),x(n?f:g,[e]),e._leaveCb=void 0,w[s]===t&&delete w[s])};w[s]=t,p?(p(e,o),p.length<=1&&o()):o()},clone(t){return lt(t,e,n,i)}};return E}function ct(t){if(ft(t))return t=Qe(t),t.children=null,t}function ht(t){return ft(t)?t.children?t.children[0]:void 0:t}function ut(t,e){6&t.shapeFlag&&t.component?ut(t.component.subTree,e):128&t.shapeFlag?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function dt(t,e=!1,n){let i=[],s=0;for(let r=0;r1)for(let r=0;r!!t.type.__asyncLoader;const ft=t=>t.type.__isKeepAlive;RegExp,RegExp;function mt(t,e){return(0,s.kJ)(t)?t.some((t=>mt(t,e))):(0,s.HD)(t)?t.split(",").includes(e):!!t.test&&t.test(e)}function yt(t,e){vt(t,"a",e)}function bt(t,e){vt(t,"da",e)}function vt(t,e,n=bn){const i=t.__wdc||(t.__wdc=()=>{let e=n;while(e){if(e.isDeactivated)return;e=e.parent}return t()});if(Et(e,i,n),n){let t=n.parent;while(t&&t.parent)ft(t.parent.vnode)&&Ct(i,e,n,t),t=t.parent}}function Ct(t,e,n,i){const r=Et(e,t,i,!0);Tt((()=>{(0,s.Od)(i[e],r)}),n)}function wt(t){let e=t.shapeFlag;256&e&&(e-=256),512&e&&(e-=512),t.shapeFlag=e}function xt(t){return 128&t.shapeFlag?t.ssContent:t}function Et(t,e,n=bn,s=!1){if(n){const r=n[t]||(n[t]=[]),a=e.__weh||(e.__weh=(...s)=>{if(n.isUnmounted)return;(0,i.Jd)(),Cn(n);const r=o(e,n,t,s);return wn(),(0,i.lk)(),r});return s?r.unshift(a):r.push(a),a}}const St=t=>(e,n=bn)=>(!An||"sp"===t)&&Et(t,e,n),At=St("bm"),Mt=St("m"),kt=St("bu"),Ot=St("u"),Pt=St("bum"),Tt=St("um"),Dt=St("sp"),Nt=St("rtg"),jt=St("rtc");function Lt(t,e=bn){Et("ec",t,e)}let Ft=!0;function Bt(t){const e=It(t),n=t.proxy,r=t.ctx;Ft=!1,e.beforeCreate&&$t(e.beforeCreate,t,"bc");const{data:o,computed:a,methods:l,watch:c,provide:h,inject:u,created:d,beforeMount:p,mounted:g,beforeUpdate:f,updated:m,activated:y,deactivated:b,beforeDestroy:v,beforeUnmount:C,destroyed:w,unmounted:x,render:E,renderTracked:S,renderTriggered:A,errorCaptured:M,serverPrefetch:k,expose:O,inheritAttrs:P,components:T,directives:D,filters:N}=e,j=null;if(u&&Rt(u,r,j,t.appContext.config.unwrapInjectedRef),l)for(const i in l){const t=l[i];(0,s.mf)(t)&&(r[i]=t.bind(n))}if(o){0;const e=o.call(n,n);0,(0,s.Kn)(e)&&(t.data=(0,i.qj)(e))}if(Ft=!0,a)for(const i in a){const t=a[i],e=(0,s.mf)(t)?t.bind(n,n):(0,s.mf)(t.get)?t.get.bind(n,n):s.dG;0;const o=!(0,s.mf)(t)&&(0,s.mf)(t.set)?t.set.bind(n):s.dG,l=Fn({get:e,set:o});Object.defineProperty(r,i,{enumerable:!0,configurable:!0,get:()=>l.value,set:t=>l.value=t})}if(c)for(const i in c)zt(c[i],r,n,i);if(h){const t=(0,s.mf)(h)?h.call(n):h;Reflect.ownKeys(t).forEach((e=>{Y(e,t[e])}))}function L(t,e){(0,s.kJ)(e)?e.forEach((e=>t(e.bind(n)))):e&&t(e.bind(n))}if(d&&$t(d,t,"c"),L(At,p),L(Mt,g),L(kt,f),L(Ot,m),L(yt,y),L(bt,b),L(Lt,M),L(jt,S),L(Nt,A),L(Pt,C),L(Tt,x),L(Dt,k),(0,s.kJ)(O))if(O.length){const e=t.exposed||(t.exposed={});O.forEach((t=>{Object.defineProperty(e,t,{get:()=>n[t],set:e=>n[t]=e})}))}else t.exposed||(t.exposed={});E&&t.render===s.dG&&(t.render=E),null!=P&&(t.inheritAttrs=P),T&&(t.components=T),D&&(t.directives=D)}function Rt(t,e,n=s.dG,r=!1){(0,s.kJ)(t)&&(t=Ut(t));for(const o in t){const n=t[o];let a;a=(0,s.Kn)(n)?"default"in n?J(n.from||o,n.default,!0):J(n.from||o):J(n),(0,i.dq)(a)&&r?Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:t=>a.value=t}):e[o]=a}}function $t(t,e,n){o((0,s.kJ)(t)?t.map((t=>t.bind(e.proxy))):t.bind(e.proxy),e,n)}function zt(t,e,n,i){const r=i.includes(".")?et(n,i):()=>n[i];if((0,s.HD)(t)){const n=e[t];(0,s.mf)(n)&&K(r,n)}else if((0,s.mf)(t))K(r,t.bind(n));else if((0,s.Kn)(t))if((0,s.kJ)(t))t.forEach((t=>zt(t,e,n,i)));else{const i=(0,s.mf)(t.handler)?t.handler.bind(n):e[t.handler];(0,s.mf)(i)&&K(r,i,t)}else 0}function It(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=t.appContext,a=r.get(e);let l;return a?l=a:s.length||n||i?(l={},s.length&&s.forEach((t=>_t(l,t,o,!0))),_t(l,e,o)):l=e,r.set(e,l),l}function _t(t,e,n,i=!1){const{mixins:s,extends:r}=e;r&&_t(t,r,n,!0),s&&s.forEach((e=>_t(t,e,n,!0)));for(const o in e)if(i&&"expose"===o);else{const i=Vt[o]||n&&n[o];t[o]=i?i(t[o],e[o]):e[o]}return t}const Vt={data:Gt,props:Wt,emits:Wt,methods:Wt,computed:Wt,beforeCreate:qt,created:qt,beforeMount:qt,mounted:qt,beforeUpdate:qt,updated:qt,beforeDestroy:qt,beforeUnmount:qt,destroyed:qt,unmounted:qt,activated:qt,deactivated:qt,errorCaptured:qt,serverPrefetch:qt,components:Wt,directives:Wt,watch:Xt,provide:Gt,inject:Ht};function Gt(t,e){return e?t?function(){return(0,s.l7)((0,s.mf)(t)?t.call(this,this):t,(0,s.mf)(e)?e.call(this,this):e)}:e:t}function Ht(t,e){return Wt(Ut(t),Ut(e))}function Ut(t){if((0,s.kJ)(t)){const e={};for(let n=0;n0)||16&l){let i;Zt(t,e,o,a)&&(u=!0);for(const r in c)e&&((0,s.RI)(e,r)||(i=(0,s.rs)(r))!==r&&(0,s.RI)(e,i))||(h?!n||void 0===n[r]&&void 0===n[i]||(o[r]=Kt(h,c,r,void 0,t,!0)):delete o[r]);if(a!==c)for(const t in a)e&&(0,s.RI)(e,t)||(delete a[t],u=!0)}else if(8&l){const n=t.vnode.dynamicProps;for(let i=0;i{c=!0;const[n,i]=Qt(t,e,!0);(0,s.l7)(a,n),i&&l.push(...i)};!n&&e.mixins.length&&e.mixins.forEach(i),t.extends&&i(t.extends),t.mixins&&t.mixins.forEach(i)}if(!o&&!c)return i.set(t,s.Z6),s.Z6;if((0,s.kJ)(o))for(let u=0;u-1,i[1]=n<0||t-1||(0,s.RI)(i,"default"))&&l.push(e)}}}}const h=[a,l];return i.set(t,h),h}function te(t){return"$"!==t[0]}function ee(t){const e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:null===t?"null":""}function ne(t,e){return ee(t)===ee(e)}function ie(t,e){return(0,s.kJ)(e)?e.findIndex((e=>ne(e,t))):(0,s.mf)(e)&&ne(e,t)?0:-1}const se=t=>"_"===t[0]||"$stable"===t,re=t=>(0,s.kJ)(t)?t.map(nn):[nn(t)],oe=(t,e,n)=>{const i=I(((...t)=>re(e(...t))),n);return i._c=!1,i},ae=(t,e,n)=>{const i=t._ctx;for(const r in t){if(se(r))continue;const n=t[r];if((0,s.mf)(n))e[r]=oe(r,n,i);else if(null!=n){0;const t=re(n);e[r]=()=>t}}},le=(t,e)=>{const n=re(e);t.slots.default=()=>n},ce=(t,e)=>{if(32&t.vnode.shapeFlag){const n=e._;n?(t.slots=(0,i.IU)(e),(0,s.Nj)(e,"_",n)):ae(e,t.slots={})}else t.slots={},e&&le(t,e);(0,s.Nj)(t.slots,qe,1)},he=(t,e,n)=>{const{vnode:i,slots:r}=t;let o=!0,a=s.kT;if(32&i.shapeFlag){const t=e._;t?n&&1===t?o=!1:((0,s.l7)(r,e),n||1!==t||delete r._):(o=!e.$stable,ae(e,r)),a=e}else e&&(le(t,e),a={default:1});if(o)for(const s in r)se(s)||s in a||delete r[s]};function ue(t,e){const n=R;if(null===n)return t;const i=Nn(n)||n.proxy,r=t.dirs||(t.dirs=[]);for(let o=0;ome(t,e&&((0,s.kJ)(e)?e[i]:e),n,o,a)));if(gt(o)&&!a)return;const l=4&o.shapeFlag?Nn(o.component)||o.component.proxy:o.el,c=a?null:l,{i:h,r:u}=t;const d=e&&e.r,p=h.refs===s.kT?h.refs={}:h.refs,g=h.setupState;if(null!=d&&d!==u&&((0,s.HD)(d)?(p[d]=null,(0,s.RI)(g,d)&&(g[d]=null)):(0,i.dq)(d)&&(d.value=null)),(0,s.mf)(u))r(u,h,12,[c,p]);else{const e=(0,s.HD)(u),r=(0,i.dq)(u);if(e||r){const r=()=>{if(t.f){const n=e?p[u]:u.value;a?(0,s.kJ)(n)&&(0,s.Od)(n,l):(0,s.kJ)(n)?n.includes(l)||n.push(l):e?(p[u]=[l],(0,s.RI)(g,u)&&(g[u]=p[u])):(u.value=[l],t.k&&(p[t.k]=u.value))}else e?(p[u]=c,(0,s.RI)(g,u)&&(g[u]=c)):(0,i.dq)(u)&&(u.value=c,t.k&&(p[t.k]=c))};c?(r.id=-1,be(r,n)):r()}else 0}}function ye(){}const be=X;function ve(t){return Ce(t)}function Ce(t,e){ye();const n=(0,s.E9)();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:l,createText:c,createComment:h,setText:u,setElementText:d,parentNode:p,nextSibling:g,setScopeId:f=s.dG,cloneNode:m,insertStaticContent:y}=t,b=(t,e,n,i=null,s=null,r=null,o=!1,a=null,l=!!e.dynamicChildren)=>{if(t===e)return;t&&!Ue(t,e)&&(i=Q(t),X(t,s,r,!0),t=null),-2===e.patchFlag&&(l=!1,e.dynamicChildren=null);const{type:c,ref:h,shapeFlag:u}=e;switch(c){case Ne:v(t,e,n,i);break;case je:C(t,e,n,i);break;case Le:null==t&&w(e,n,i,o);break;case De:F(t,e,n,i,s,r,o,a,l);break;default:1&u?A(t,e,n,i,s,r,o,a,l):6&u?B(t,e,n,i,s,r,o,a,l):(64&u||128&u)&&c.process(t,e,n,i,s,r,o,a,l,et)}null!=h&&s&&me(h,t&&t.ref,r,e||t,!e)},v=(t,e,n,i)=>{if(null==t)r(e.el=c(e.children),n,i);else{const n=e.el=t.el;e.children!==t.children&&u(n,e.children)}},C=(t,e,n,i)=>{null==t?r(e.el=h(e.children||""),n,i):e.el=t.el},w=(t,e,n,i)=>{[t.el,t.anchor]=y(t.children,e,n,i,t.el,t.anchor)},x=({el:t,anchor:e},n,i)=>{let s;while(t&&t!==e)s=g(t),r(t,n,i),t=s;r(e,n,i)},E=({el:t,anchor:e})=>{let n;while(t&&t!==e)n=g(t),o(t),t=n;o(e)},A=(t,e,n,i,s,r,o,a,l)=>{o=o||"svg"===e.type,null==t?k(e,n,i,s,r,o,a,l):N(t,e,s,r,o,a,l)},k=(t,e,n,i,o,c,h,u)=>{let p,g;const{type:f,props:y,shapeFlag:b,transition:v,patchFlag:C,dirs:w}=t;if(t.el&&void 0!==m&&-1===C)p=t.el=m(t.el);else{if(p=t.el=l(t.type,c,y&&y.is,y),8&b?d(p,t.children):16&b&&P(t.children,p,null,i,o,c&&"foreignObject"!==f,h,u),w&&de(t,null,i,"created"),y){for(const e in y)"value"===e||(0,s.Gg)(e)||a(p,e,null,y[e],c,t.children,i,o,K);"value"in y&&a(p,"value",null,y.value),(g=y.onVnodeBeforeMount)&&an(g,i,t)}O(p,t,t.scopeId,h,i)}w&&de(t,null,i,"beforeMount");const x=(!o||o&&!o.pendingBranch)&&v&&!v.persisted;x&&v.beforeEnter(p),r(p,e,n),((g=y&&y.onVnodeMounted)||x||w)&&be((()=>{g&&an(g,i,t),x&&v.enter(p),w&&de(t,null,i,"mounted")}),o)},O=(t,e,n,i,s)=>{if(n&&f(t,n),i)for(let r=0;r{for(let c=l;c{const c=e.el=t.el;let{patchFlag:h,dynamicChildren:u,dirs:p}=e;h|=16&t.patchFlag;const g=t.props||s.kT,f=e.props||s.kT;let m;n&&we(n,!1),(m=f.onVnodeBeforeUpdate)&&an(m,n,e,t),p&&de(e,t,n,"beforeUpdate"),n&&we(n,!0);const y=r&&"foreignObject"!==e.type;if(u?j(t.dynamicChildren,u,c,n,i,y,o):l||V(t,e,c,null,n,i,y,o,!1),h>0){if(16&h)L(c,e,g,f,n,i,r);else if(2&h&&g.class!==f.class&&a(c,"class",null,f.class,r),4&h&&a(c,"style",g.style,f.style,r),8&h){const s=e.dynamicProps;for(let e=0;e{m&&an(m,n,e,t),p&&de(e,t,n,"updated")}),i)},j=(t,e,n,i,s,r,o)=>{for(let a=0;a{if(n!==i){for(const c in i){if((0,s.Gg)(c))continue;const h=i[c],u=n[c];h!==u&&"value"!==c&&a(t,c,u,h,l,e.children,r,o,K)}if(n!==s.kT)for(const c in n)(0,s.Gg)(c)||c in i||a(t,c,n[c],null,l,e.children,r,o,K);"value"in i&&a(t,"value",n.value,i.value)}},F=(t,e,n,i,s,o,a,l,h)=>{const u=e.el=t?t.el:c(""),d=e.anchor=t?t.anchor:c("");let{patchFlag:p,dynamicChildren:g,slotScopeIds:f}=e;f&&(l=l?l.concat(f):f),null==t?(r(u,n,i),r(d,n,i),P(e.children,n,d,s,o,a,l,h)):p>0&&64&p&&g&&t.dynamicChildren?(j(t.dynamicChildren,g,n,s,o,a,l),(null!=e.key||s&&e===s.subTree)&&xe(t,e,!0)):V(t,e,n,d,s,o,a,l,h)},B=(t,e,n,i,s,r,o,a,l)=>{e.slotScopeIds=a,null==t?512&e.shapeFlag?s.ctx.activate(e,n,i,o,l):R(e,n,i,s,r,o,l):$(t,e,l)},R=(t,e,n,i,s,r,o)=>{const a=t.component=yn(t,i,s);if(ft(t)&&(a.ctx.renderer=et),Mn(a),a.asyncDep){if(s&&s.registerDep(a,z),!t.el){const t=a.subTree=Je(je);C(null,t,e,n)}}else z(a,t,e,n,s,r,o)},$=(t,e,n)=>{const i=e.component=t.component;if(H(t,e,n)){if(i.asyncDep&&!i.asyncResolved)return void I(i,e,n);i.next=e,M(i.update),i.update()}else e.component=t.component,e.el=t.el,i.vnode=e},z=(t,e,n,r,o,a,l)=>{const c=()=>{if(t.isMounted){let e,{next:n,bu:i,u:r,parent:c,vnode:h}=t,u=n;0,we(t,!1),n?(n.el=h.el,I(t,n,l)):n=h,i&&(0,s.ir)(i),(e=n.props&&n.props.onVnodeBeforeUpdate)&&an(e,c,n,h),we(t,!0);const d=_(t);0;const g=t.subTree;t.subTree=d,b(g,d,p(g.el),Q(g),t,o,a),n.el=d.el,null===u&&q(t,d.el),r&&be(r,o),(e=n.props&&n.props.onVnodeUpdated)&&be((()=>an(e,c,n,h)),o)}else{let i;const{el:l,props:c}=e,{bm:h,m:u,parent:d}=t,p=gt(e);if(we(t,!1),h&&(0,s.ir)(h),!p&&(i=c&&c.onVnodeBeforeMount)&&an(i,d,e),we(t,!0),l&&it){const n=()=>{t.subTree=_(t),it(l,t.subTree,t,o,null)};p?e.type.__asyncLoader().then((()=>!t.isUnmounted&&n())):n()}else{0;const i=t.subTree=_(t);0,b(null,i,n,r,t,o,a),e.el=i.el}if(u&&be(u,o),!p&&(i=c&&c.onVnodeMounted)){const t=e;be((()=>an(i,d,t)),o)}256&e.shapeFlag&&t.a&&be(t.a,o),t.isMounted=!0,e=n=r=null}},h=t.effect=new i.qq(c,(()=>S(t.update)),t.scope),u=t.update=h.run.bind(h);u.id=t.uid,we(t,!0),u()},I=(t,e,n)=>{e.component=t;const s=t.vnode.props;t.vnode=e,t.next=null,Jt(t,e.props,s,n),he(t,e.children,n),(0,i.Jd)(),T(void 0,t.update),(0,i.lk)()},V=(t,e,n,i,s,r,o,a,l=!1)=>{const c=t&&t.children,h=t?t.shapeFlag:0,u=e.children,{patchFlag:p,shapeFlag:g}=e;if(p>0){if(128&p)return void U(c,u,n,i,s,r,o,a,l);if(256&p)return void G(c,u,n,i,s,r,o,a,l)}8&g?(16&h&&K(c,s,r),u!==c&&d(n,u)):16&h?16&g?U(c,u,n,i,s,r,o,a,l):K(c,s,r,!0):(8&h&&d(n,""),16&g&&P(u,n,i,s,r,o,a,l))},G=(t,e,n,i,r,o,a,l,c)=>{t=t||s.Z6,e=e||s.Z6;const h=t.length,u=e.length,d=Math.min(h,u);let p;for(p=0;p