"u")};n.isExist=function(r){return typeof r<"u"},n.isEmptyObject=function(r){return Object.keys(r).length===0},n.merge=function(r,l,c){if(l){const f=Object.keys(l),T=f.length;for(let p=0;p 0)this.root=t;else{var n=this.graph.findTreeRoots(t,!0,this.invert);if(n.length>0){for(var r=0;r m?new mxPoint(o,s):new mxPoint(o,s+a);if(u==m)return o>p?new mxPoint(r,u):new mxPoint(r+l,u);var d=o,x=u;return n&&(p>=r&&p<=r+l?d=p:m>=s&&m<=s+a&&(x=m)),p m,a=s.xFi.get(n.position),xi=(n,t)=>{t&&(n.fill.color=t.color??n.fill.color,n.fill.opacity=t.opacity??n.fill.opacity)},ki=(n,t)=>{t&&(n.stroke.color=t.color??n.stroke.color,n.stroke.width=t.width??n.stroke.width)},Bi=(n,t)=>{t&&(n.font.color=t.color??n.font.color,n.font.size=t.size??n.font.size)},Mi=n=>{const t={fill:{color:R.DEFAULT_OVERLAY_FILL_COLOR.valueOf(),opacity:R.DEFAULT_OVERLAY_FILL_OPACITY.valueOf()},stroke:{color:R.DEFAULT_OVERLAY_STROKE_COLOR.valueOf(),width:R.DEFAULT_OVERLAY_STROKE_WIDTH.valueOf()},font:{color:R.DEFAULT_OVERLAY_FONT_COLOR.valueOf(),size:R.DEFAULT_OVERLAY_FONT_SIZE.valueOf()}},e=n.style,s={...t};return e&&(xi(s,e.fill),ki(s,e.stroke),Bi(s,e.font)),s};class Vi{convert(t){const e=Pi(t),s=Mi(t);return{position:e,style:s}}}function Yi(n){return new Gi(n,new Vi)}class Gi{constructor(t,e){this.graph=t,this.overlayConverter=e}addOverlays(t,e){const s=this.graph.getModel().getCell(t);if(s)for(const i of P(e)){const o=new Kt(i.label,this.overlayConverter.convert(i));this.graph.addCellOverlay(s,o)}}removeAllOverlays(t){const e=this.graph.getModel().getCell(t);e&&this.graph.removeCellOverlays(e)}}function Di(n){return new Ui(Yi(n))}class Ui{constructor(t){this.overlaysUpdater=t}addOverlays(t,e){this.overlaysUpdater.addOverlays(t,e)}removeAllOverlays(t){this.overlaysUpdater.removeAllOverlays(t)}}class Wi{element(t){return`svg > g > g > g[data-bpmn-id="${t}"]`}elementsOfKind(t){return`svg > g > g > g.${t}:not(.bpmn-label)`}}function Hi(n){return new Ki(n,new zi(n.getModel()))}const Pt=n=>{const t=P(n);return t.push(...t.map(e=>et(e))),t};class Ki{constructor(t,e){this.graph=t,this.styleManager=e}clear(){this.styleManager.clear()}updateStyle(t,e){if(!e)return;const s=this.graph.getModel(),i=Pt(t).map(o=>s.getCell(o)).filter(Boolean);i.length!==0&&this.graph.batchUpdate(()=>{for(const o of i){this.styleManager.ensureStyleIsStored(o);let a=o.getStyle();a=K(a,u.STYLE_OPACITY,e.opacity,Le),a=_n(a,e.stroke),a=yn(a,e.font),Fn(e)&&(a=bn(a,e.fill)),s.setStyle(o,a)}})}resetStyle(t){this.graph.batchUpdate(()=>{if(t||t=="")for(const e of Pt(t))this.styleManager.resetStyleIfIsStored(e);else this.styleManager.resetAllStyles()})}}const xt=x.EXTRA_CSS_CLASSES;class zi{constructor(t){y(this,"stylesCache",new Map);this.model=t}clear(){this.stylesCache.clear()}resetAllStyles(){for(const t of this.stylesCache.keys())this.resetStyle(t,this.stylesCache.get(t))}resetStyleIfIsStored(t){const e=this.stylesCache.get(t);e&&this.resetStyle(t,e)}resetStyle(t,e){const s=this.model.getCell(t),i=wn(s.getStyle(),xt,""),o=K(e,xt,i);this.model.setStyle(s,o),this.stylesCache.delete(t)}ensureStyleIsStored(t){const e=t.getId();this.stylesCache.has(e)||this.stylesCache.set(e,t.getStyle())}}function Xi(n){return new qi(Hi(n))}class qi{constructor(t){this.styleUpdater=t}clearCache(){this.styleUpdater.clear()}updateStyle(t,e){this.styleUpdater.updateStyle(t,e)}resetStyle(t){this.styleUpdater.resetStyle(t)}}function $i(n,t){return new Zi(n,new ji(t.container,new Wi),wi(t),Di(t),Xi(t))}class Zi{constructor(t,e,s,i,o){this.bpmnModelRegistry=t,this.htmlElementRegistry=e,this.cssClassesRegistry=s,this.overlaysRegistry=i,this.styleRegistry=o,this.bpmnModelRegistry.registerOnLoadCallback(()=>{this.cssClassesRegistry.clearCache(),this.styleRegistry.clearCache()})}getModelElementsByIds(t){return De(t).map(e=>this.bpmnModelRegistry.getBpmnSemantic(e)).filter(Boolean)}getElementsByIds(t){return this.getModelElementsByIds(t).map(e=>({bpmnSemantic:e,htmlElement:this.htmlElementRegistry.getBpmnHtmlElement(e.id)}))}getModelElementsByKinds(t){return De(t).flatMap(e=>this.htmlElementRegistry.getBpmnHtmlElements(e)).map(e=>this.getRelatedBpmnSemantic(e))}getElementsByKinds(t){return De(t).flatMap(e=>this.htmlElementRegistry.getBpmnHtmlElements(e)).map(e=>({htmlElement:e,bpmnSemantic:this.getRelatedBpmnSemantic(e)}))}getRelatedBpmnSemantic(t){return this.bpmnModelRegistry.getBpmnSemantic(t.dataset.bpmnId)}addCssClasses(t,e){this.cssClassesRegistry.addCssClasses(t,e)}removeCssClasses(t,e){this.cssClassesRegistry.removeCssClasses(t,e)}removeAllCssClasses(t){this.cssClassesRegistry.removeAllCssClasses(t)}toggleCssClasses(t,e){this.cssClassesRegistry.toggleCssClasses(t,e)}addOverlays(t,e){this.overlaysRegistry.addOverlays(t,e)}removeAllOverlays(t){this.overlaysRegistry.removeAllOverlays(t)}updateStyle(t,e){this.styleRegistry.updateStyle(t,e)}resetStyle(t){this.styleRegistry.resetStyle(t)}}class ji{constructor(t,e){this.container=t,this.querySelectors=e}getBpmnHtmlElement(t){return this.container.querySelector(this.querySelectors.element(t))}getBpmnHtmlElements(t){const e=this.querySelectors.elementsOfKind(Xe(t));return[...this.container.querySelectorAll(e)]}}const De=n=>[...new Set(P(n))];class Ji{filter(t,e){const s=[],i=[];for(const S of P(e==null?void 0:e.pools).filter(O=>O&&Object.keys(O).length>0))S.id?s.push(S.id):S.name&&i.push(S.name);if(s.length===0&&i.length===0)return t;const{filteredPools:o,filteredPoolIds:a}=Qi(t,s,i),r=[...s,...a],{filteredLanes:l,filteredLaneIds:c,filteredFlowNodes:f,filteredFlowNodeIds:T}=Qt(t.lanes,t.flowNodes,r),p=to(t.edges,[...r,...c,...T]);if(o.length===0&&l.length===0&&f.length===0&&p.length===0){let S=s.length>0?` for ids [${s}]`:"";const O=S?" and":"";throw S+=i.length>0?`${O} for names [${i}]`:"",new Error("No matching pools"+S)}return{lanes:l,flowNodes:f,pools:o,edges:p}}}function Qi(n,t,e){const s=n.pools.filter(o=>t.includes(o.bpmnElement.id)||e.includes(o.bpmnElement.name)),i=s.map(o=>o.bpmnElement.id);return{filteredPools:s,filteredPoolIds:i}}function Qt(n,t,e){const{filteredLanes:s,filteredLaneIds:i}=en(n,e),{filteredLanes:o,filteredLaneIds:a,filteredFlowNodes:r,filteredFlowNodeIds:l}=eo(t,[...e,...i],n);return s.push(...o),i.push(...a),{filteredLanes:s,filteredLaneIds:i,filteredFlowNodes:r,filteredFlowNodeIds:l}}function en(n,t){const e=n.filter(i=>t.includes(i.bpmnElement.parentId)),s=e.map(i=>i.bpmnElement.id);if(e.length>0){const{filteredLanes:i,filteredLaneIds:o}=en(n,s);e.push(...i),s.push(...o)}return{filteredLanes:e,filteredLaneIds:s}}function eo(n,t,e){const s=n.filter(c=>t.includes(c.bpmnElement.parentId));if(s.length===0)return{filteredLanes:[],filteredLaneIds:[],filteredFlowNodes:[],filteredFlowNodeIds:[]};const i=s.map(c=>c.bpmnElement.id),{filteredLanes:o,filteredLaneIds:a,filteredFlowNodes:r,filteredFlowNodeIds:l}=Qt(e,n,i);return s.push(...r),i.push(...l),{filteredLanes:o,filteredLaneIds:a,filteredFlowNodes:s,filteredFlowNodeIds:i}}function to(n,t){return n.filter(e=>t.includes(e.bpmnElement.sourceReferenceId)&&t.includes(e.bpmnElement.targetReferenceId))}class no{constructor(){y(this,"searchableModel");y(this,"onLoadCallback")}load(t,e){var i;const s=new Ji().filter(t,e);return this.searchableModel=new io(s),(i=this.onLoadCallback)==null||i.call(this),so(s)}registerOnLoadCallback(t){this.onLoadCallback=t}getBpmnSemantic(t){var o;const e=(o=this.searchableModel)==null?void 0:o.elementById(t);if(!e)return;const s=e.bpmnElement,i=s instanceof J;return{id:t,isShape:i,kind:s.kind,name:s.name,...s instanceof Ne?{sourceRefId:s.sourceReferenceId,targetRefId:s.targetReferenceId}:{callActivityGlobalTaskKind:s instanceof oe?s.globalTaskKind:void 0,callActivityKind:s instanceof oe?s.callActivityKind:void 0,eventDefinitionKind:s instanceof se?s.eventDefinitionKind:void 0,linkEventSourceIds:s instanceof Ke&&s.eventDefinitionKind==H.LINK?s.sourceIds:void 0,linkEventTargetId:s instanceof ze?s.targetId:void 0,incomingIds:s.incomingIds,outgoingIds:s.outgoingIds,parentId:s.parentId,subProcessKind:s instanceof ge?s.subProcessKind:void 0}}}}function so(n){const t=new Set(n.flowNodes.filter(o=>{const a=o.bpmnElement;return F.isSubProcess(a.kind)&&a.markers.includes(W.EXPAND)}).map(o=>o.bpmnElement.id)),e=[],s=[],i=[];for(const o of n.flowNodes){const a=o.bpmnElement.kind;F.isSubProcess(a)?e.push(o):F.isBoundaryEvent(a)?s.push(o):t.has(o.bpmnElement.parentId)||i.push(o)}return{boundaryEvents:s,edges:n.edges,lanes:n.lanes,otherFlowNodes:i,pools:n.pools,subprocesses:e}}class io{constructor(t){y(this,"elements",new Map);for(const e of[...t.pools,...t.lanes,...t.flowNodes,...t.edges])this.elements.set(e.bpmnElement.id,e)}elementById(t){return this.elements.get(t)}}class oo{constructor(t){y(this,"graph");y(this,"navigation");y(this,"bpmnElementsRegistry");y(this,"bpmnModelRegistry");y(this,"parserOptions");y(this,"rendererOptions");this.rendererOptions=t==null?void 0:t.renderer;const e=new Ps(gn(t==null?void 0:t.container));this.graph=e.configure(t),this.navigation=new xs(this.graph),this.bpmnModelRegistry=new no,this.bpmnElementsRegistry=$i(this.bpmnModelRegistry,this.graph),this.parserOptions=t==null?void 0:t.parser}load(t,e){const s=vi(this.parserOptions).parse(t),i=this.bpmnModelRegistry.load(s,e==null?void 0:e.modelFilter);Dn(this.graph,this.rendererOptions).render(i,e==null?void 0:e.fit)}}function _o(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)}function V(n,...t){ot("[DEMO]",n,...t)}function ot(n,t,...e){console.info(`${n} ${t}`,...e)}function q(n,...t){ot("[DEMO STARTUP]",n,...t)}function tn(n,t){nn(n),window.alert(n)}function nn(n){console.error("[DEMO]",n)}function le(n,...t){ot("[DEMO DOWNLOAD]",n,...t)}async function ro(n){V(`Fetching BPMN content from url ${n}`);const t=await fetch(n);if(!t.ok)throw new Error(`HTTP status ${t.status}`);return await t.text()}function sn(n,t,e){const s=document.createElement("a");t.startsWith("data:image/svg+xml")&&(e=encodeURIComponent(e),t+=","),s.setAttribute("href",t+e),s.setAttribute("download",n),s.style.display="none",document.body.append(s),s.click(),s.remove()}function lo(n){le("Start SVG download"),sn("diagram.svg","data:image/svg+xml",n),le("Download completed")}function ao(n){le("Start PNG download");const t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t),s=document.createElement("img");s.setAttribute("style","position: absolute; top: -9999px"),s.crossOrigin="anonymous",document.body.append(s);const i=document.createElement("canvas"),o=i.getContext("2d");s.addEventListener("load",function(){const a=new Image;i.width=s.naturalWidth,i.height=s.naturalHeight,a.crossOrigin="Anonymous",a.addEventListener("load",function(){o.drawImage(a,0,0),URL.revokeObjectURL(e);const r=i.toDataURL("image/png");s.remove(),sn("diagram.png","",r),le("Download completed")}),a.src=s.src}),s.src=e}class co{constructor(t,e,s,i){y(this,"document");y(this,"head");this.window=t,this.outerContainerId=e,this.containerToFade=s,this.dropCallback=i,this.document=t.document,this.head=document.head,this.initializeDragAndDrop()}initializeDragAndDrop(){this.containerToFade.classList.add("faded-container"),this.addDomElements(this.containerToFade),this.addStyle();const t=document.querySelector(`#${this.outerContainerId}`);this.preventDefaultsOnEvents(["dragover","drop"],this.window),this.preventDefaultsOnEvents(["dragover","dragleave","drop"],t),this.addEventsOnDropContainer(t,this.containerToFade),this.addEventsOnDocument(this.outerContainerId,this.containerToFade)}preventDefaults(t){t.preventDefault(),t.stopPropagation()}preventDefaultsOnEvents(t,e){for(const s of t)e.addEventListener(s,this.preventDefaults.bind(this),!1)}addDomElements(t){const e=this.document.createElement("p");e.textContent="open BPMN diagram";const s=this.document.createElement("div");s.classList.add("drop-here-text"),s.append(e);const i=this.document.createElement("div");i.id=this.outerContainerId,i.append(s),t.parentNode.prepend(i)}addStyle(){const t=`
+var yt=Object.defineProperty;var wt=(n,t,e)=>t in n?yt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>wt(n,typeof t!="symbol"?t+"":t,e);import{g as Rt,r as bt}from"./mxgraph.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function e(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=e(o);fetch(o.href,i)}})();var Q=(n=>(n.None="None",n.HorizontalVertical="HorizontalVertical",n.Horizontal="Horizontal",n.Vertical="Vertical",n.Center="Center",n))(Q||{}),Ft=(n=>(n.In="in",n.Out="out",n))(Ft||{});function Pt(n){return n instanceof HTMLElement?n:document.querySelector(`#${n}`)}var d=(n=>(n.LANE="lane",n.POOL="pool",n.CALL_ACTIVITY="callActivity",n.SUB_PROCESS="subProcess",n.TASK="task",n.TASK_USER="userTask",n.TASK_SERVICE="serviceTask",n.TASK_RECEIVE="receiveTask",n.TASK_SEND="sendTask",n.TASK_MANUAL="manualTask",n.TASK_SCRIPT="scriptTask",n.TASK_BUSINESS_RULE="businessRuleTask",n.GLOBAL_TASK="globalTask",n.GLOBAL_TASK_USER="globalUserTask",n.GLOBAL_TASK_MANUAL="globalManualTask",n.GLOBAL_TASK_SCRIPT="globalScriptTask",n.GLOBAL_TASK_BUSINESS_RULE="globalBusinessRuleTask",n.GROUP="group",n.TEXT_ANNOTATION="textAnnotation",n.GATEWAY_PARALLEL="parallelGateway",n.GATEWAY_EXCLUSIVE="exclusiveGateway",n.GATEWAY_INCLUSIVE="inclusiveGateway",n.GATEWAY_EVENT_BASED="eventBasedGateway",n.GATEWAY_COMPLEX="complexGateway",n.EVENT_START="startEvent",n.EVENT_END="endEvent",n.EVENT_INTERMEDIATE_CATCH="intermediateCatchEvent",n.EVENT_INTERMEDIATE_THROW="intermediateThrowEvent",n.EVENT_BOUNDARY="boundaryEvent",n))(d||{}),J=(n=>(n.CALLING_PROCESS="process",n.CALLING_GLOBAL_TASK="global task",n))(J||{}),ee=(n=>(n.Exclusive="Exclusive",n.None="None",n.Parallel="Parallel",n))(ee||{}),y=(n=>(n.NONE="none",n.TERMINATE="terminate",n.CANCEL="cancel",n.COMPENSATION="compensate",n.CONDITIONAL="conditional",n.ERROR="error",n.ESCALATION="escalation",n.LINK="link",n.MESSAGE="message",n.SIGNAL="signal",n.TIMER="timer",n))(y||{}),_=(n=>(n.ADHOC="adhoc",n.COMPENSATION="compensation",n.EXPAND="expand",n.LOOP="loop",n.MULTI_INSTANCE_PARALLEL="multi-parallel",n.MULTI_INSTANCE_SEQUENTIAL="multi-sequential",n))(_||{}),Y=(n=>(n.AD_HOC="adhoc",n.EMBEDDED="embedded",n.EVENT="event",n.TRANSACTION="transaction",n))(Y||{});function kt(n,t){return n===""?t?{}:void 0:n}function S(n,t=!1){return n==null?[]:(Array.isArray(n)?n:[n]).map(e=>kt(e,t)).filter(Boolean)}function Bt(n,t,e){const s=[];e!=null&&e.startingWith?s.push(`^(${e.startingWith}).*`):e!=null&&e.notStartingWith&&s.push(`^(?!(${e.notStartingWith})).*`),s.push(`${t}$`);const o=s.join("");return n.filter(i=>e!=null&&e.ignoreCase?new RegExp(o,"i").test(i):new RegExp(o).test(i))}class E{static isEvent(t){return oe(xe,t)}static eventKinds(){return[...xe]}static isBoundaryEvent(t){return d.EVENT_BOUNDARY===t}static isStartEvent(t){return d.EVENT_START===t}static isCatchEvent(t){return d.EVENT_INTERMEDIATE_CATCH===t||d.EVENT_BOUNDARY===t||d.EVENT_START===t}static isIntermediateCatchEvent(t){return d.EVENT_INTERMEDIATE_CATCH===t}static isIntermediateThrowEvent(t){return d.EVENT_INTERMEDIATE_THROW===t}static isCallActivity(t){return d.CALL_ACTIVITY===t}static isSubProcess(t){return d.SUB_PROCESS===t}static canHaveNoneEvent(t){return d.EVENT_INTERMEDIATE_THROW===t||d.EVENT_END===t||d.EVENT_START===t}static isActivity(t){return oe(pe,t)}static activityKinds(){return[...pe]}static isWithDefaultSequenceFlow(t){return Mt.has(t)}static isTask(t){return oe(Te,t)}static taskKinds(){return[...Te]}static gatewayKinds(){return[...Ye]}static isGateway(t){return oe(Ye,t)}static flowNodeKinds(){return Object.values(d).filter(t=>!E.isPoolOrLane(t))}static isPoolOrLane(t){return t==d.POOL||t==d.LANE}}function Ne(n,t){return Bt(Object.values(d),n,t)}function oe(n,t){return Object.values(n).map(e=>e).includes(t)}const xe=Ne("Event"),Ye=Ne("Gateway"),Te=Ne("Task",{ignoreCase:!0,notStartingWith:"global"}),pe=[...Te,d.CALL_ACTIVITY,d.SUB_PROCESS],Mt=new Set([...pe,d.GATEWAY_EXCLUSIVE,d.GATEWAY_INCLUSIVE,d.GATEWAY_COMPLEX]),Je=Object.values(y).filter(n=>n!=y.NONE);var K=(n=>(n.NONE="None",n.ONE="One",n.BOTH="Both",n))(K||{}),k=(n=>(n.SEQUENCE_FLOW="sequenceFlow",n.MESSAGE_FLOW="messageFlow",n.ASSOCIATION_FLOW="association",n))(k||{}),te=(n=>(n.NONE="none",n.INITIATING="initiating",n.NON_INITIATING="non_initiating",n))(te||{}),x=(n=>(n.NORMAL="normal",n.DEFAULT="default",n.CONDITIONAL_FROM_ACTIVITY="conditional_from_activity",n.CONDITIONAL_FROM_GATEWAY="conditional_from_gateway",n))(x||{});class ue{constructor(t,e,s,o,i){this.id=t,this.name=e,this.kind=s,this.sourceReferenceId=o,this.targetReferenceId=i}}class et extends ue{constructor(t,e,s,o,i=x.NORMAL){super(t,e,k.SEQUENCE_FLOW,s,o),this.sequenceFlowKind=i}}class tt extends ue{constructor(t,e,s,o){super(t,e,k.MESSAGE_FLOW,s,o)}}class nt extends ue{constructor(t,e,s,o,i=K.NONE){super(t,e,k.ASSOCIATION_FLOW,s,o),this.associationDirectionKind=i}}var xt=bt();const Yt=Rt(xt),L=Dt(),Gt=L.mxCellRenderer,Vt=L.mxClient,c=L.mxConstants,G=L.mxEvent,Ge=L.mxPerimeter,P=L.mxPoint,Ee=L.mxRectangle,_e=L.mxRectangleShape,ye=L.mxSvgCanvas2D,v=L.mxUtils;function Dt(){return window.mxForceIncludes=!1,window.mxLoadResources=!1,window.mxLoadStylesheets=!1,window.mxResourceExtension=".txt",Yt({})}class Ut{constructor(t){this.graph=t}computeRelativeCoordinates(t,e){const s=this.getTranslateForRoot(t),o=e.x+s.x,i=e.y+s.y;return new P(o,i)}getTranslateForRoot(t){const e=this.graph.getModel(),s=new P(0,0);for(;t!=null;){const o=e.getGeometry(t);o!=null&&(s.x-=o.x,s.y-=o.y),t=e.getParent(t)}return s}computeEdgeCenter(t){const e=t.geometry.points,s=e[0],o=e.at(-1),i=o.x-s.x,r=o.y-s.y;return new P(s.x+i/2,s.y+r/2)}}class re{constructor(t,e,s,o,i){g(this,"extensions",{});this.id=t,this.bpmnElement=e,this.bounds=s,this.label=o,this.isHorizontal=i}}class M{constructor(t,e,s,o,i=!1){g(this,"incomingIds",[]);g(this,"outgoingIds",[]);this.id=t,this.name=e,this.kind=s,this.parentId=o,this.instantiate=i}}class de extends M{constructor(t,e,s,o,i,r=[]){super(t,e,s,o,i),this.markers=r}}class H extends de{constructor(t,e,s,o,i,r){super(t,e,d.CALL_ACTIVITY,o,void 0,i),this.callActivityKind=s,this.globalTaskKind=r}}class ne extends de{constructor(t,e,s,o,i){s==Y.AD_HOC&&!i.includes(_.ADHOC)&&i.push(_.ADHOC),super(t,e,d.SUB_PROCESS,o,void 0,i),this.subProcessKind=s}}class D extends M{constructor(t,e,s,o,i){super(t,e,s,i),this.eventDefinitionKind=o}}class Se extends D{constructor(e,s,o,i){super(e,s,d.EVENT_INTERMEDIATE_CATCH,o,i);g(this,"sourceIds",[])}}class Ie extends D{constructor(e,s,o,i){super(e,s,d.EVENT_INTERMEDIATE_THROW,o,i);g(this,"targetId")}}class st extends D{constructor(t,e,s,o,i){super(t,e,d.EVENT_START,s,o),this.isInterrupting=i}}class ot extends D{constructor(t,e,s,o,i=!0){super(t,e,d.EVENT_BOUNDARY,s,o),this.isInterrupting=i}}class it extends M{constructor(t,e,s,o,i=ee.None){super(t,e,d.GATEWAY_EVENT_BASED,s,o),this.gatewayKind=i}}function le(n,t,e,s){return Math.min(Math.max(n??s,t),e)}function Wt(n){return Math.max(n??0,0)}function Ht(n){const t=n??{};return t.debounceDelay=le(t.debounceDelay,0,100,50),t.throttleDelay=le(t.throttleDelay,0,100,50),t}function he(n){return n=="default"?void 0:le(n,0,100,100)}function Kt(n){return n=="default"?void 0:le(n,1,50,1)}const I={EDGE:"bpmn.edge",EDGE_START_FILL_COLOR:"bpmn.edge.startFillColor",EDGE_END_FILL_COLOR:"bpmn.edge.endFillColor",EVENT_BASED_GATEWAY_KIND:"bpmn.gatewayKind",EVENT_DEFINITION_KIND:"bpmn.eventDefinitionKind",GLOBAL_TASK_KIND:"bpmn.globalTaskKind",SUB_PROCESS_KIND:"bpmn.subProcessKind",IS_INITIATING:"bpmn.isInitiating",IS_INSTANTIATING:"bpmn.isInstantiating",IS_INTERRUPTING:"bpmn.isInterrupting",EXTRA_CSS_CLASSES:"bpmn.extra.css.classes",MARKERS:"bpmn.markers",MESSAGE_FLOW_ICON:"bpmn.messageFlowIcon"},rt={ARROW_DASH:"bpmn.dash"},T={STROKE_WIDTH_THIN:2,STROKE_WIDTH_THICK:5,SHAPE_ACTIVITY_BOTTOM_MARGIN:7,SHAPE_ACTIVITY_TOP_MARGIN:7,SHAPE_ACTIVITY_LEFT_MARGIN:7,SHAPE_ACTIVITY_MARKER_ICON_MARGIN:5,SHAPE_ACTIVITY_MARKER_ICON_SIZE:20,POOL_LABEL_SIZE:30,POOL_LABEL_FILL_COLOR:"none",LANE_LABEL_SIZE:30,LANE_LABEL_FILL_COLOR:"none",SUB_PROCESS_TRANSACTION_INNER_RECT_OFFSET:4,SUB_PROCESS_TRANSACTION_INNER_RECT_ARC_SIZE:6,TEXT_ANNOTATION_BORDER_LENGTH:10,TEXT_ANNOTATION_FILL_COLOR:"none",GROUP_FILL_COLOR:"none",DEFAULT_FILL_COLOR:"White",DEFAULT_STROKE_COLOR:"Black",DEFAULT_FONT_FAMILY:"Arial, Helvetica, sans-serif",DEFAULT_FONT_SIZE:11,DEFAULT_FONT_COLOR:"Black",DEFAULT_MARGIN:0,SHAPE_ARC_SIZE:20,DEFAULT_OVERLAY_FILL_COLOR:"White",DEFAULT_OVERLAY_FILL_OPACITY:100,DEFAULT_OVERLAY_STROKE_COLOR:"Black",DEFAULT_OVERLAY_STROKE_WIDTH:1,DEFAULT_OVERLAY_FONT_SIZE:11,DEFAULT_OVERLAY_FONT_COLOR:"Black",SEQUENCE_FLOW_CONDITIONAL_FROM_ACTIVITY_MARKER_FILL_COLOR:"White",MESSAGE_FLOW_MARKER_START_FILL_COLOR:"White",MESSAGE_FLOW_MARKER_END_FILL_COLOR:"White"},lt=n=>v.getValue(n,I.IS_INSTANTIATING,"false")=="true",ae=n=>n=="default"?void 0:n,zt=(n,t)=>(t&&(n=R(n,c.STYLE_STROKECOLOR,t.color,ae),n=R(n,c.STYLE_STROKE_OPACITY,t.opacity,he),n=R(n,c.STYLE_STROKEWIDTH,t.width,Kt)),n),R=(n,t,e,s=o=>o)=>e==null?n:v.setStyle(n,t,s(e)),ie=(n,t,e,s)=>s==null?n:v.setStyleFlag(n,t,e,s),Xt=(n,t)=>(t&&(n=R(n,c.STYLE_FONTCOLOR,t.color,ae),n=R(n,c.STYLE_FONTSIZE,t.size),n=R(n,c.STYLE_FONTFAMILY,t.family),n=ie(n,c.STYLE_FONTSTYLE,c.FONT_BOLD,t.isBold),n=ie(n,c.STYLE_FONTSTYLE,c.FONT_ITALIC,t.isItalic),n=ie(n,c.STYLE_FONTSTYLE,c.FONT_UNDERLINE,t.isUnderline),n=ie(n,c.STYLE_FONTSTYLE,c.FONT_STRIKETHROUGH,t.isStrikeThrough),n=R(n,c.STYLE_TEXT_OPACITY,t.opacity,he)),n),Zt=(n,t,e)=>(n==null?void 0:n.split(";").map(s=>s.split("=")).filter(([s])=>s===t).map(([,s])=>s)[0])??e,jt=n=>{switch(n){case"right-to-left":return c.DIRECTION_WEST;case"bottom-to-top":return c.DIRECTION_NORTH;case"top-to-bottom":return c.DIRECTION_SOUTH;default:return c.DIRECTION_EAST}},$t=(n,t)=>{const e=t.color;if(e){const s=Qt(e),o=s?e.startColor:e;n=R(n,c.STYLE_FILLCOLOR,o,ae),s?(n=v.setStyle(n,c.STYLE_GRADIENTCOLOR,e.endColor),n=v.setStyle(n,c.STYLE_GRADIENT_DIRECTION,jt(e.direction))):e==="default"&&(n=v.setStyle(n,c.STYLE_GRADIENTCOLOR,void 0),n=v.setStyle(n,c.STYLE_GRADIENT_DIRECTION,void 0)),(n.includes(d.POOL)||n.includes(d.LANE))&&(n=R(n,c.STYLE_SWIMLANE_FILLCOLOR,o,ae))}return n=R(n,c.STYLE_FILL_OPACITY,t.opacity,he),n},qt=n=>n&&typeof n=="object"&&"fill"in n,Qt=n=>n&&typeof n=="object";class Jt{constructor(t){g(this,"ignoreBpmnColors");this.ignoreBpmnColors=(t==null?void 0:t.ignoreBpmnColors)??!0}computeStyle(t,e){const s=[t.bpmnElement.kind];let o;t instanceof re?o=this.computeShapeStyleValues(t):(s.push(...nn(t)),o=this.computeEdgeStyleValues(t));const i=this.computeFontStyleValues(t),r=sn(t,e);return s.push(...Ve([...o,...i,...r])),s.join(";")}computeShapeStyleValues(t){const e=new Map,s=t.bpmnElement;if(s instanceof D?en(s,e):s instanceof de?tn(s,e):E.isPoolOrLane(s.kind)?e.set(c.STYLE_HORIZONTAL,t.isHorizontal?"0":"1"):s instanceof it&&(e.set(I.IS_INSTANTIATING,String(s.instantiate)),e.set(I.EVENT_BASED_GATEWAY_KIND,String(s.gatewayKind))),!this.ignoreBpmnColors){const o=t.extensions,i=o.fillColor;i&&(e.set(c.STYLE_FILLCOLOR,i),E.isPoolOrLane(s.kind)&&e.set(c.STYLE_SWIMLANE_FILLCOLOR,i)),o.strokeColor&&e.set(c.STYLE_STROKECOLOR,o.strokeColor)}return e}computeEdgeStyleValues(t){const e=new Map;if(!this.ignoreBpmnColors){const s=t.extensions;s.strokeColor&&e.set(c.STYLE_STROKECOLOR,s.strokeColor)}return e}computeFontStyleValues(t){var o,i;const e=new Map,s=(o=t.label)==null?void 0:o.font;if(s&&(e.set(c.STYLE_FONTFAMILY,s.name),e.set(c.STYLE_FONTSIZE,s.size),e.set(c.STYLE_FONTSTYLE,on(s))),!this.ignoreBpmnColors){const r=(i=t.label)==null?void 0:i.extensions;r!=null&&r.color&&e.set(c.STYLE_FONTCOLOR,r.color)}return e}computeMessageFlowIconStyle(t){const e=[];return e.push(["shape",I.MESSAGE_FLOW_ICON],[I.IS_INITIATING,String(t.messageVisibleKind===te.INITIATING)]),this.ignoreBpmnColors||t.extensions.strokeColor&&e.push([c.STYLE_STROKECOLOR,t.extensions.strokeColor]),Ve(e).join(";")}}function en(n,t){t.set(I.EVENT_DEFINITION_KIND,n.eventDefinitionKind),(n instanceof ot||n instanceof st&&n.isInterrupting!==void 0)&&t.set(I.IS_INTERRUPTING,String(n.isInterrupting))}function tn(n,t){n instanceof ne?t.set(I.SUB_PROCESS_KIND,n.subProcessKind):n.kind===d.TASK_RECEIVE?t.set(I.IS_INSTANTIATING,String(n.instantiate)):n instanceof H&&t.set(I.GLOBAL_TASK_KIND,n.globalTaskKind);const e=n.markers;e.length>0&&t.set(I.MARKERS,e.join(","))}function nn(n){const t=[],e=n.bpmnElement;return e instanceof et&&t.push(e.sequenceFlowKind),e instanceof nt&&t.push(e.associationDirectionKind),t}function sn(n,t){const e=new Map,s=n.bpmnElement;return t?(e.set(c.STYLE_VERTICAL_ALIGN,c.ALIGN_TOP),n.bpmnElement.kind!=d.TEXT_ANNOTATION&&e.set(c.STYLE_ALIGN,c.ALIGN_CENTER),n instanceof re&&(e.set(c.STYLE_LABEL_WIDTH,t.width+1),e.set(c.STYLE_LABEL_POSITION,"ignore"),e.set(c.STYLE_VERTICAL_LABEL_POSITION,c.ALIGN_MIDDLE))):n instanceof re&&(s instanceof ne||s instanceof H&&s.callActivityKind===J.CALLING_PROCESS)&&!s.markers.includes(_.EXPAND)&&e.set(c.STYLE_VERTICAL_ALIGN,c.ALIGN_TOP),e}function on(n){let t=0;return n.isBold&&(t+=c.FONT_BOLD),n.isItalic&&(t+=c.FONT_ITALIC),n.isStrikeThrough&&(t+=c.FONT_STRIKETHROUGH),n.isUnderline&&(t+=c.FONT_UNDERLINE),t}function Ve(n){return n.filter(([,t])=>t&&t!="undefined").map(([t,e])=>`${t}=${e}`)}class rn{constructor(t,e,s){this.graph=t,this.coordinatesTranslator=e,this.styleComputer=s}render(t,e){this.insertShapesAndEdges(t),this.graph.customFit(e)}insertShapesAndEdges({pools:t,lanes:e,subprocesses:s,otherFlowNodes:o,boundaryEvents:i,edges:r}){this.graph.batchUpdate(()=>{this.graph.getModel().clear(),this.insertShapes(t),this.insertShapes(e),this.insertShapes(s),this.insertShapes(o),this.insertShapes(i),this.insertEdges(r)})}insertShapes(t){for(const e of t)this.insertShape(e)}getParent(t){return this.getCell(t.parentId)??this.graph.getDefaultParent()}insertShape(t){var l;const e=t.bpmnElement,s=this.getParent(e),o=t.bounds;let i=(l=t.label)==null?void 0:l.bounds;i=E.isPoolOrLane(e.kind)?void 0:i;const r=this.styleComputer.computeStyle(t,i);this.insertVertex(s,e.id,e.name,o,i,r)}insertEdges(t){var e;for(const s of t){const o=s.bpmnElement,i=this.graph.getDefaultParent(),r=this.getCell(o.sourceReferenceId),l=this.getCell(o.targetReferenceId),a=(e=s.label)==null?void 0:e.bounds,h=this.styleComputer.computeStyle(s,a),u=this.graph.insertEdge(i,o.id,o.name,r,l,h);if(this.insertWaypoints(s.waypoints,u),a){u.geometry.width=a.width,u.geometry.height=a.height;const f=this.coordinatesTranslator.computeEdgeCenter(u);u.geometry.relative=!1;const p=this.coordinatesTranslator.computeRelativeCoordinates(u.parent,new P(a.x,a.y)),m=p.x+a.width/2-f.x,C=p.y-f.y;u.geometry.offset=new P(m,C)}this.insertMessageFlowIconIfNeeded(s,u)}}insertMessageFlowIconIfNeeded(t,e){if(t.bpmnElement instanceof tt&&t.messageVisibleKind!==te.NONE){const s=this.graph.insertVertex(e,we(e.id),void 0,0,0,20,14,this.styleComputer.computeMessageFlowIconStyle(t));s.geometry.relative=!0,s.geometry.offset=new P(-10,-7)}}insertWaypoints(t,e){t&&(e.geometry.points=t.map(s=>this.coordinatesTranslator.computeRelativeCoordinates(e.parent,new P(s.x,s.y))))}getCell(t){return this.graph.getModel().getCell(t)}insertVertex(t,e,s,o,i,r){const l=this.coordinatesTranslator.computeRelativeCoordinates(t,new P(o.x,o.y)),a=this.graph.insertVertex(t,e,s,l.x,l.y,o.width,o.height,r);if(i){const h=i.x-o.x,u=i.y-o.y;a.geometry.offset=new P(h,u)}return a}}function ln(n,t){return new rn(n,new Ut(n),new Jt(t))}function we(n){return`messageFlowIcon_of_${n}`}function at(n,t,{signal:e,edges:s}={}){let o,i=null;const r=s!=null&&s.includes("leading"),l=s==null||s.includes("trailing"),a=()=>{i!==null&&(n.apply(o,i),o=void 0,i=null)},h=()=>{l&&a(),m()};let u=null;const f=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,h()},t)},p=()=>{u!==null&&(clearTimeout(u),u=null)},m=()=>{p(),o=void 0,i=null},C=()=>{p(),a()},b=function(...j){if(e!=null&&e.aborted)return;o=this,i=j;const _t=u==null;f(),r&&_t&&a()};return b.schedule=f,b.cancel=m,b.flush=C,e==null||e.addEventListener("abort",m,{once:!0}),b}function an(n,t,{signal:e,edges:s=["leading","trailing"]}={}){let o=null;const i=at(n,t,{signal:e,edges:s}),r=function(...l){o==null?o=Date.now():Date.now()-o>=t&&(o=Date.now(),i.cancel(),i(...l)),i(...l)};return r.cancel=i.cancel,r.flush=i.flush,r}class ct extends L.mxCellOverlay{constructor(e,s){super(null,"",s.position.horizontalAlign,s.position.verticalAlign,null,"default");g(this,"style");this.label=e,this.style=s.style}getBounds(e){const s=e.view.graph.getModel().isEdge(e.cell),o=e.view.scale;let i;const r=0,l=0;return s?i=this.computeEdgeBounds(e):(i=new P,this.align==c.ALIGN_LEFT?i.x=e.x:this.align==c.ALIGN_CENTER?i.x=e.x+e.width/2:i.x=e.x+e.width,this.verticalAlign==c.ALIGN_TOP?i.y=e.y:this.verticalAlign==c.ALIGN_MIDDLE?i.y=e.y+e.height/2:i.y=e.y+e.height),new Ee(Math.round(i.x-(r*this.defaultOverlap-this.offset.x)*o),Math.round(i.y-(l*this.defaultOverlap-this.offset.y)*o),r*o,l*o)}computeEdgeBounds(e){const s=e.absolutePoints;if(this.align==c.ALIGN_LEFT)return s[0];if(this.align==c.ALIGN_CENTER){if(s.length%2==1)return s[Math.floor(s.length/2)];{const o=s.length/2,i=s[o-1],r=s[o];return new P(i.x+(r.x-i.x)/2,i.y+(r.y-i.y)/2)}}else return s.at(-1)}}class De extends L.mxText{constructor(t,e,s){super(t,e,void 0,void 0,s.font.color,void 0,s.font.size,void 0,void 0,void 0,void 0,void 0,void 0,void 0,s.fill.color,s.stroke.color),this.fillOpacity=s.fill.opacity,this.strokewidth=s.stroke.width}}function cn(n){return Object.values(k).map(t=>t).includes(n)}function un(n,t){return dn(n.style,t)}function dn(n,t){const e=[],s=n.split(";"),i=s[0].replace(/shape=bpmn./g,""),r=new Map;r.set("bpmn-type-activity",E.isActivity(i)),r.set("bpmn-type-container",E.isPoolOrLane(i)),r.set("bpmn-type-event",E.isEvent(i)),r.set("bpmn-type-flow",cn(i)),r.set("bpmn-type-gateway",E.isGateway(i)),r.set("bpmn-type-task",E.isTask(i));for(const[l]of[...r].filter(([,a])=>a))e.push(l);e.push(Ce(i));for(const[l,a]of s.map(h=>{const u=h.split("=");return[u[0],u[1]]}))switch(l){case I.EVENT_DEFINITION_KIND:{e.push(`bpmn-event-def-${a}`);break}case I.EVENT_BASED_GATEWAY_KIND:{e.push(`bpmn-gateway-kind-${a.toLowerCase()}`);break}case I.IS_INITIATING:{e.push(a=="true"?"bpmn-icon-initiating":"bpmn-icon-non-initiating");break}case I.SUB_PROCESS_KIND:{e.push(`bpmn-sub-process-${a.toLowerCase()}`);break}case I.GLOBAL_TASK_KIND:{e.push(Ce(a));break}}return t&&e.push("bpmn-label"),e}function Ce(n){return n?"bpmn-"+n.replace(/([A-Z])/g,t=>"-"+t[0].toLowerCase()):""}const Ue=function(n){const t=n.createSvgCanvas;n.createSvgCanvas=function(){var o;const e=t.bind(this)(),s=e.getTextCss;if(e.getTextCss=function(){const i=this.pointerEvents;this.pointerEvents=!1;const r=s.bind(this)();return this.pointerEvents=i,r},(o=this.state)!=null&&o.cell){const i=this.state.cell,r=un(i,this.dialect===c.DIALECT_STRICTHTML),l=this.state.style[I.EXTRA_CSS_CLASSES];typeof l=="string"&&r.push(...l.split(",")),this.node.setAttribute("class",r.join(" ")),this.node.dataset.bpmnId=this.state.cell.id}return e}};class hn extends L.mxCellRenderer{constructor(t){super(),this.iconPainter=t}createCellOverlays(t){const s=t.view.graph.getCellOverlays(t.cell);let o=null;if(s!=null){o=new L.mxDictionary;for(const i of s){const r=t.overlays==null?null:t.overlays.remove(i);if(r!=null){o.put(i,r);continue}let l;i instanceof ct?l=new De(i.label,new Ee(0,0,0,0),i.style):(l=new L.mxImageShape(new Ee(0,0,0,0),i.image.src),l.preserveImageAspect=!1),l.dialect=t.view.graph.dialect,l.overlay=i,this.initializeOverlay(t,l),this.installCellOverlayListeners(t,i,l),i.cursor!=null&&(l.node.style.cursor=i.cursor),l instanceof De&&(l.node.classList.add("overlay-badge"),l.node.dataset.bpmnId=t.cell.id),o.put(i,l)}}t.overlays!=null&&t.overlays.visit(function(i,r){r.destroy()}),t.overlays=o}createShape(t){const e=super.createShape(t);return"iconPainter"in e&&(e.iconPainter=this.iconPainter),Ue(e),e}createLabel(t,e){super.createLabel(t,e),Ue(t.text)}}function fn(n,t,e,s){let o,i;n.heightxo.get(n.position),Go=(n,t)=>{t&&(n.fill.color=t.color??n.fill.color,n.fill.opacity=t.opacity??n.fill.opacity)},Vo=(n,t)=>{t&&(n.stroke.color=t.color??n.stroke.color,n.stroke.width=t.width??n.stroke.width)},Do=(n,t)=>{t&&(n.font.color=t.color??n.font.color,n.font.size=t.size??n.font.size)},Uo=n=>{const t={fill:{color:T.DEFAULT_OVERLAY_FILL_COLOR.valueOf(),opacity:T.DEFAULT_OVERLAY_FILL_OPACITY.valueOf()},stroke:{color:T.DEFAULT_OVERLAY_STROKE_COLOR.valueOf(),width:T.DEFAULT_OVERLAY_STROKE_WIDTH.valueOf()},font:{color:T.DEFAULT_OVERLAY_FONT_COLOR.valueOf(),size:T.DEFAULT_OVERLAY_FONT_SIZE.valueOf()}},e=n.style,s={...t};return e&&(Go(s,e.fill),Vo(s,e.stroke),Do(s,e.font)),s};class Wo{convert(t){const e=Yo(t),s=Uo(t);return{position:e,style:s}}}function Ho(n){return new Ko(n,new Wo)}class Ko{constructor(t,e){this.graph=t,this.overlayConverter=e}addOverlays(t,e){const s=this.graph.getModel().getCell(t);if(s)for(const o of S(e)){const i=new ct(o.label,this.overlayConverter.convert(o));this.graph.addCellOverlay(s,i)}}removeAllOverlays(t){const e=this.graph.getModel().getCell(t);e&&this.graph.removeCellOverlays(e)}}function zo(n){return new Xo(Ho(n))}class Xo{constructor(t){this.overlaysUpdater=t}addOverlays(t,e){this.overlaysUpdater.addOverlays(t,e)}removeAllOverlays(t){this.overlaysUpdater.removeAllOverlays(t)}}class Zo{element(t){return`svg > g > g > g[data-bpmn-id="${t}"]`}elementsOfKind(t){return`svg > g > g > g.${t}:not(.bpmn-label)`}}function jo(n){return new $o(n,new qo(n.getModel()))}const qe=n=>{const t=S(n);return t.push(...t.map(e=>we(e))),t};class $o{constructor(t,e){this.graph=t,this.styleManager=e}clear(){this.styleManager.clear()}updateStyle(t,e){if(!e)return;const s=this.graph.getModel(),o=qe(t).map(i=>s.getCell(i)).filter(Boolean);o.length!==0&&this.graph.batchUpdate(()=>{for(const i of o){this.styleManager.ensureStyleIsStored(i);let r=i.getStyle();r=R(r,c.STYLE_OPACITY,e.opacity,he),r=zt(r,e.stroke),r=Xt(r,e.font),qt(e)&&(r=$t(r,e.fill)),s.setStyle(i,r)}})}resetStyle(t){this.graph.batchUpdate(()=>{if(t||t=="")for(const e of qe(t))this.styleManager.resetStyleIfIsStored(e);else this.styleManager.resetAllStyles()})}}const Qe=I.EXTRA_CSS_CLASSES;class qo{constructor(t){g(this,"stylesCache",new Map);this.model=t}clear(){this.stylesCache.clear()}resetAllStyles(){for(const t of this.stylesCache.keys())this.resetStyle(t,this.stylesCache.get(t))}resetStyleIfIsStored(t){const e=this.stylesCache.get(t);e&&this.resetStyle(t,e)}resetStyle(t,e){const s=this.model.getCell(t),o=Zt(s.getStyle(),Qe,""),i=R(e,Qe,o);this.model.setStyle(s,i),this.stylesCache.delete(t)}ensureStyleIsStored(t){const e=t.getId();this.stylesCache.has(e)||this.stylesCache.set(e,t.getStyle())}}function Qo(n){return new Jo(jo(n))}class Jo{constructor(t){this.styleUpdater=t}clearCache(){this.styleUpdater.clear()}updateStyle(t,e){this.styleUpdater.updateStyle(t,e)}resetStyle(t){this.styleUpdater.resetStyle(t)}}function ei(n,t){return new ti(n,new ni(t.container,new Zo),ko(t),zo(t),Qo(t))}class ti{constructor(t,e,s,o,i){this.bpmnModelRegistry=t,this.htmlElementRegistry=e,this.cssClassesRegistry=s,this.overlaysRegistry=o,this.styleRegistry=i,this.bpmnModelRegistry.registerOnLoadCallback(()=>{this.cssClassesRegistry.clearCache(),this.styleRegistry.clearCache()})}getModelElementsByIds(t){return ge(t).map(e=>this.bpmnModelRegistry.getBpmnSemantic(e)).filter(Boolean)}getElementsByIds(t){return this.getModelElementsByIds(t).map(e=>({bpmnSemantic:e,htmlElement:this.htmlElementRegistry.getBpmnHtmlElement(e.id)}))}getModelElementsByKinds(t){return ge(t).flatMap(e=>this.htmlElementRegistry.getBpmnHtmlElements(e)).map(e=>this.getRelatedBpmnSemantic(e))}getElementsByKinds(t){return ge(t).flatMap(e=>this.htmlElementRegistry.getBpmnHtmlElements(e)).map(e=>({htmlElement:e,bpmnSemantic:this.getRelatedBpmnSemantic(e)}))}getRelatedBpmnSemantic(t){return this.bpmnModelRegistry.getBpmnSemantic(t.dataset.bpmnId)}addCssClasses(t,e){this.cssClassesRegistry.addCssClasses(t,e)}removeCssClasses(t,e){this.cssClassesRegistry.removeCssClasses(t,e)}removeAllCssClasses(t){this.cssClassesRegistry.removeAllCssClasses(t)}toggleCssClasses(t,e){this.cssClassesRegistry.toggleCssClasses(t,e)}addOverlays(t,e){this.overlaysRegistry.addOverlays(t,e)}removeAllOverlays(t){this.overlaysRegistry.removeAllOverlays(t)}updateStyle(t,e){this.styleRegistry.updateStyle(t,e)}resetStyle(t){this.styleRegistry.resetStyle(t)}}class ni{constructor(t,e){this.container=t,this.querySelectors=e}getBpmnHtmlElement(t){return this.container.querySelector(this.querySelectors.element(t))}getBpmnHtmlElements(t){const e=this.querySelectors.elementsOfKind(Ce(t));return[...this.container.querySelectorAll(e)]}}const ge=n=>[...new Set(S(n))];class si{filter(t,e){const s=[],o=[];for(const m of S(e==null?void 0:e.pools).filter(C=>C&&Object.keys(C).length>0))m.id?s.push(m.id):m.name&&o.push(m.name);if(s.length===0&&o.length===0)return t;const{filteredPools:i,filteredPoolIds:r}=oi(t,s,o),l=[...s,...r],{filteredLanes:a,filteredLaneIds:h,filteredFlowNodes:u,filteredFlowNodeIds:f}=St(t.lanes,t.flowNodes,l),p=ri(t.edges,[...l,...h,...f]);if(i.length===0&&a.length===0&&u.length===0&&p.length===0){let m=s.length>0?` for ids [${s}]`:"";const C=m?" and":"";throw m+=o.length>0?`${C} for names [${o}]`:"",new Error("No matching pools"+m)}return{lanes:a,flowNodes:u,pools:i,edges:p}}}function oi(n,t,e){const s=n.pools.filter(i=>t.includes(i.bpmnElement.id)||e.includes(i.bpmnElement.name)),o=s.map(i=>i.bpmnElement.id);return{filteredPools:s,filteredPoolIds:o}}function St(n,t,e){const{filteredLanes:s,filteredLaneIds:o}=It(n,e),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:l,filteredFlowNodeIds:a}=ii(t,[...e,...o],n);return s.push(...i),o.push(...r),{filteredLanes:s,filteredLaneIds:o,filteredFlowNodes:l,filteredFlowNodeIds:a}}function It(n,t){const e=n.filter(o=>t.includes(o.bpmnElement.parentId)),s=e.map(o=>o.bpmnElement.id);if(e.length>0){const{filteredLanes:o,filteredLaneIds:i}=It(n,s);e.push(...o),s.push(...i)}return{filteredLanes:e,filteredLaneIds:s}}function ii(n,t,e){const s=n.filter(h=>t.includes(h.bpmnElement.parentId));if(s.length===0)return{filteredLanes:[],filteredLaneIds:[],filteredFlowNodes:[],filteredFlowNodeIds:[]};const o=s.map(h=>h.bpmnElement.id),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:l,filteredFlowNodeIds:a}=St(e,n,o);return s.push(...l),o.push(...a),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:s,filteredFlowNodeIds:o}}function ri(n,t){return n.filter(e=>t.includes(e.bpmnElement.sourceReferenceId)&&t.includes(e.bpmnElement.targetReferenceId))}class li{constructor(){g(this,"searchableModel");g(this,"onLoadCallback")}load(t,e){var o;const s=new si().filter(t,e);return this.searchableModel=new ci(s),(o=this.onLoadCallback)==null||o.call(this),ai(s)}registerOnLoadCallback(t){this.onLoadCallback=t}getBpmnSemantic(t){var i;const e=(i=this.searchableModel)==null?void 0:i.elementById(t);if(!e)return;const s=e.bpmnElement,o=s instanceof M;return{id:t,isShape:o,kind:s.kind,name:s.name,...s instanceof ue?{sourceRefId:s.sourceReferenceId,targetRefId:s.targetReferenceId}:{callActivityGlobalTaskKind:s instanceof H?s.globalTaskKind:void 0,callActivityKind:s instanceof H?s.callActivityKind:void 0,eventDefinitionKind:s instanceof D?s.eventDefinitionKind:void 0,linkEventSourceIds:s instanceof Se&&s.eventDefinitionKind==y.LINK?s.sourceIds:void 0,linkEventTargetId:s instanceof Ie?s.targetId:void 0,incomingIds:s.incomingIds,outgoingIds:s.outgoingIds,parentId:s.parentId,subProcessKind:s instanceof ne?s.subProcessKind:void 0}}}}function ai(n){const t=new Set(n.flowNodes.filter(i=>{const r=i.bpmnElement;return E.isSubProcess(r.kind)&&r.markers.includes(_.EXPAND)}).map(i=>i.bpmnElement.id)),e=[],s=[],o=[];for(const i of n.flowNodes){const r=i.bpmnElement.kind;E.isSubProcess(r)?e.push(i):E.isBoundaryEvent(r)?s.push(i):t.has(i.bpmnElement.parentId)||o.push(i)}return{boundaryEvents:s,edges:n.edges,lanes:n.lanes,otherFlowNodes:o,pools:n.pools,subprocesses:e}}class ci{constructor(t){g(this,"elements",new Map);for(const e of[...t.pools,...t.lanes,...t.flowNodes,...t.edges])this.elements.set(e.bpmnElement.id,e)}elementById(t){return this.elements.get(t)}}class ui{constructor(t){g(this,"graph");g(this,"navigation");g(this,"bpmnElementsRegistry");g(this,"bpmnModelRegistry");g(this,"parserOptions");g(this,"rendererOptions");this.rendererOptions=t==null?void 0:t.renderer;const e=new Jn(Pt(t==null?void 0:t.container));this.graph=e.configure(t),this.navigation=new es(this.graph),this.bpmnModelRegistry=new li,this.bpmnElementsRegistry=ei(this.bpmnModelRegistry,this.graph),this.parserOptions=t==null?void 0:t.parser}load(t,e){const s=bo(this.parserOptions).parse(t),o=this.bpmnModelRegistry.load(s,e==null?void 0:e.modelFilter);ln(this.graph,this.rendererOptions).render(o,e==null?void 0:e.fit)}}function bi(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)}function A(n,...t){ke("[DEMO]",n,...t)}function ke(n,t,...e){console.info(`${n} ${t}`,...e)}function F(n,...t){ke("[DEMO STARTUP]",n,...t)}function Ct(n,t){mt(n),window.alert(n)}function mt(n){console.error("[DEMO]",n)}function z(n,...t){ke("[DEMO DOWNLOAD]",n,...t)}async function di(n){A(`Fetching BPMN content from url ${n}`);const t=await fetch(n);if(!t.ok)throw new Error(`HTTP status ${t.status}`);return await t.text()}function At(n,t,e){const s=document.createElement("a");t.startsWith("data:image/svg+xml")&&(e=encodeURIComponent(e),t+=","),s.setAttribute("href",t+e),s.setAttribute("download",n),s.style.display="none",document.body.append(s),s.click(),s.remove()}function hi(n){z("Start SVG download"),At("diagram.svg","data:image/svg+xml",n),z("Download completed")}function fi(n){z("Start PNG download");const t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t),s=document.createElement("img");s.setAttribute("style","position: absolute; top: -9999px"),s.crossOrigin="anonymous",document.body.append(s);const o=document.createElement("canvas"),i=o.getContext("2d");s.addEventListener("load",function(){const r=new Image;o.width=s.naturalWidth,o.height=s.naturalHeight,r.crossOrigin="Anonymous",r.addEventListener("load",function(){i.drawImage(r,0,0),URL.revokeObjectURL(e);const l=o.toDataURL("image/png");s.remove(),At("diagram.png","",l),z("Download completed")}),r.src=s.src}),s.src=e}class gi{constructor(t,e,s,o){g(this,"document");g(this,"head");this.window=t,this.outerContainerId=e,this.containerToFade=s,this.dropCallback=o,this.document=t.document,this.head=document.head,this.initializeDragAndDrop()}initializeDragAndDrop(){this.containerToFade.classList.add("faded-container"),this.addDomElements(this.containerToFade),this.addStyle();const t=document.querySelector(`#${this.outerContainerId}`);this.preventDefaultsOnEvents(["dragover","drop"],this.window),this.preventDefaultsOnEvents(["dragover","dragleave","drop"],t),this.addEventsOnDropContainer(t,this.containerToFade),this.addEventsOnDocument(this.outerContainerId,this.containerToFade)}preventDefaults(t){t.preventDefault(),t.stopPropagation()}preventDefaultsOnEvents(t,e){for(const s of t)e.addEventListener(s,this.preventDefaults.bind(this),!1)}addDomElements(t){const e=this.document.createElement("p");e.textContent="open BPMN diagram";const s=this.document.createElement("div");s.classList.add("drop-here-text"),s.append(e);const o=this.document.createElement("div");o.id=this.outerContainerId,o.append(s),t.parentNode.prepend(o)}addStyle(){const t=`
.faded-container {
opacity: 1;
}
@@ -47,7 +44,7 @@ var cn=Object.defineProperty;var un=(n,t,e)=>t in n?cn(n,t,{enumerable:!0,config
align-items: center;
border: 2px dashed rgba(0,0,0,.2);
border-radius: 7px;
-}`,e=document.createElement("style");e.append(document.createTextNode(t)),this.head.append(e)}addEventsOnDropContainer(t,e){t.addEventListener("dragover",this.getAddClassCallback(e,!1),!1),t.addEventListener("mousedown",this.getRemoveClassCallback(e,!1),!1),t.addEventListener("drop",this.getDropCallbackForElement(e,!1,this.dropCallback),!1)}addEventsOnDocument(t,e){this.document.addEventListener("dragover",this.getAddClassCallback(e,!0,t),!1),this.document.addEventListener("dragleave",this.getRemoveClassCallback(e,!0,t),!1),this.document.addEventListener("drop",this.getDropCallbackForElement(e,!0,this.dropCallback,t),!1)}getAddClassCallback(t,e,s){return function(){e?this.querySelector("#"+s).classList.add("dragging"):this.classList.add("dragging"),t.classList.add("faded")}}getRemoveClassCallback(t,e,s){return function(){e?this.querySelector("#"+s).classList.remove("dragging"):this.classList.remove("dragging"),t.classList.remove("faded")}}getDropCallbackForElement(t,e,s,i){return function(o){try{const r=o.dataTransfer.files;s(r[0])}catch(a){const r=a instanceof Error?a.message:String(a);tn(r)}finally{e?this.querySelector("#"+i).classList.remove("dragging"):this.classList.remove("dragging"),t.classList.remove("faded")}}}}class on{constructor(t){this.graph=t}exportSvg(){return this.doSvgExport(!0)}exportSvgForPng(){const t=In.IS_FF;return this.doSvgExport(t)}doSvgExport(t){const e=this.computeSvg({scale:1,border:25,enableForeignObjectForLabel:t});return`
+}`,e=document.createElement("style");e.append(document.createTextNode(t)),this.head.append(e)}addEventsOnDropContainer(t,e){t.addEventListener("dragover",this.getAddClassCallback(e,!1),!1),t.addEventListener("mousedown",this.getRemoveClassCallback(e,!1),!1),t.addEventListener("drop",this.getDropCallbackForElement(e,!1,this.dropCallback),!1)}addEventsOnDocument(t,e){this.document.addEventListener("dragover",this.getAddClassCallback(e,!0,t),!1),this.document.addEventListener("dragleave",this.getRemoveClassCallback(e,!0,t),!1),this.document.addEventListener("drop",this.getDropCallbackForElement(e,!0,this.dropCallback,t),!1)}getAddClassCallback(t,e,s){return function(){e?this.querySelector("#"+s).classList.add("dragging"):this.classList.add("dragging"),t.classList.add("faded")}}getRemoveClassCallback(t,e,s){return function(){e?this.querySelector("#"+s).classList.remove("dragging"):this.classList.remove("dragging"),t.classList.remove("faded")}}getDropCallbackForElement(t,e,s,o){return function(i){try{const l=i.dataTransfer.files;s(l[0])}catch(r){const l=r instanceof Error?r.message:String(r);Ct(l)}finally{e?this.querySelector("#"+o).classList.remove("dragging"):this.classList.remove("dragging"),t.classList.remove("faded")}}}}class vt{constructor(t){this.graph=t}exportSvg(){return this.doSvgExport(!0)}exportSvgForPng(){const t=Vt.IS_FF;return this.doSvgExport(t)}doSvgExport(t){const e=this.computeSvg({scale:1,border:25,enableForeignObjectForLabel:t});return`
-${Y.getXml(e)}
-`}computeSvg(t){const e=t.scale??1,s=t.border??0,i=t.crisp??!0,o=t.enableForeignObjectForLabel??!0,a=this.graph.getGraphBounds(),r=this.graph.view.scale,l=Y.createXmlDocument(),c=l.createElementNS(u.NS_SVG,"svg"),f=e/r,T=Math.max(1,Math.ceil(a.width*f)+2*s),p=Math.max(1,Math.ceil(a.height*f)+2*s);c.setAttribute("version","1.1"),c.setAttribute("width",T+"px"),c.setAttribute("height",p+"px"),c.setAttribute("viewBox",(i?"-0.5 -0.5":"0 0")+" "+T+" "+p),l.append(c);const S=l.createElementNS(u.NS_SVG,"g");c.append(S);const O=this.createSvgCanvas(S);O.foEnabled=o,O.foOffset=i?-.5:0,O.textOffset=i?-.5:0,O.imageOffset=i?-.5:0,O.translate(Math.floor((s/e-a.x)/r),Math.floor((s/e-a.y)/r)),O.scale(f);const L=new D.mxImageExport;return L.includeOverlays=!0,L.drawState(this.graph.getView().getState(this.graph.model.root),O),l}createSvgCanvas(t){const e=new uo(t);return e.pointerEvents=!0,e}}class uo extends Qe{constructor(e){super(e);y(this,"htmlConverter",document.createElement("div"))}getAlternateText(e,s,i,o,a,r,l,c,f,T,p,S,O){return this.computeTruncatedText(r,o)}plainText(e,s,i,o,a,r,l,c,f,T,p,S){a=this.computeTruncatedText(a,i),super.plainText(e,s,i,o,a,r,l,c,f,T,p,S)}computeTruncatedText(e,s){if(e==null||this.state.fontSize<=0)return"";try{this.htmlConverter.innerHTML=e,e=Y.extractTextWithWhitespace(this.htmlConverter.childNodes);const i=Math.ceil(2*s/this.state.fontSize),o=[];let a=0,r=0;for(;(i==0||a0)break}else o.push(e.charAt(r)),l<255&&a++;r++}o.length
").replace(/ /g," "),i.appendChild(n);var r=document.body.clientWidth,s=Math.max(document.body.clientHeight||0,document.documentElement.clientHeight),l=new mxWindow("Popup Window",i,r/2-320,s/2-240,640,480,!1,!0);l.setClosable(!0),l.setVisible(!0)}else if(mxClient.IS_NS){var l=window.open();l.document.writeln(""+mxUtils.htmlEntities(t)+"
").replace(/ /g," "),l.document.body.appendChild(n)}},alert:function(t){alert(t)},prompt:function(t,e){return prompt(t,e??"")},confirm:function(t){return confirm(t)},error:function(t,e,i,n){var r=document.createElement("div");r.style.padding="20px";var s=document.createElement("img");s.setAttribute("src",n||mxUtils.errorImage),s.setAttribute("valign","bottom"),s.style.verticalAlign="middle",r.appendChild(s),r.appendChild(document.createTextNode("Â ")),r.appendChild(document.createTextNode("Â ")),r.appendChild(document.createTextNode("Â ")),mxUtils.write(r,t);var l=document.body.clientWidth,a=document.body.clientHeight||document.documentElement.clientHeight,o=new mxWindow(mxResources.get(mxUtils.errorResource)||mxUtils.errorResource,r,(l-e)/2,a/4,e,null,!1,!0);if(i){mxUtils.br(r);var u=document.createElement("p"),p=document.createElement("button");mxClient.IS_IE?p.style.cssText="float:right":p.setAttribute("style","float:right"),mxEvent.addListener(p,"click",function(m){o.destroy()}),mxUtils.write(p,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),u.appendChild(p),r.appendChild(u),mxUtils.br(r),o.setClosable(!0)}return o.setVisible(!0),o},makeDraggable:function(t,e,i,n,r,s,l,a,o,u){var p=new mxDragSource(t,i);return p.dragOffset=new mxPoint(r??0,s??mxConstants.TOOLTIP_VERTICAL_OFFSET),p.autoscroll=l,p.setGuidesEnabled(!1),o!=null&&(p.highlightDropTargets=o),u!=null&&(p.getDropTarget=u),p.getGraphForEvent=function(m){return typeof e=="function"?e(m):e},n!=null&&(p.createDragElement=function(){return n.cloneNode(!0)},a&&(p.createPreviewElement=function(m){var d=n.cloneNode(!0),x=parseInt(d.style.width),f=parseInt(d.style.height);return d.style.width=Math.round(x*m.view.scale)+"px",d.style.height=Math.round(f*m.view.scale)+"px",d})),p}};__mxOutput.mxUtils=typeof mxUtils<"u"?mxUtils:void 0;var mxConstants={DEFAULT_HOTSPOT:.3,MIN_HOTSPOT_SIZE:8,MAX_HOTSPOT_SIZE:0,RENDERING_HINT_EXACT:"exact",RENDERING_HINT_FASTER:"faster",RENDERING_HINT_FASTEST:"fastest",DIALECT_SVG:"svg",DIALECT_VML:"vml",DIALECT_MIXEDHTML:"mixedHtml",DIALECT_PREFERHTML:"preferHtml",DIALECT_STRICTHTML:"strictHtml",NS_SVG:"http://www.w3.org/2000/svg",NS_XHTML:"http://www.w3.org/1999/xhtml",NS_XLINK:"http://www.w3.org/1999/xlink",SHADOWCOLOR:"gray",VML_SHADOWCOLOR:"gray",SHADOW_OFFSET_X:2,SHADOW_OFFSET_Y:3,SHADOW_OPACITY:1,NODETYPE_ELEMENT:1,NODETYPE_ATTRIBUTE:2,NODETYPE_TEXT:3,NODETYPE_CDATA:4,NODETYPE_ENTITY_REFERENCE:5,NODETYPE_ENTITY:6,NODETYPE_PROCESSING_INSTRUCTION:7,NODETYPE_COMMENT:8,NODETYPE_DOCUMENT:9,NODETYPE_DOCUMENTTYPE:10,NODETYPE_DOCUMENT_FRAGMENT:11,NODETYPE_NOTATION:12,TOOLTIP_VERTICAL_OFFSET:16,DEFAULT_VALID_COLOR:"#00FF00",DEFAULT_INVALID_COLOR:"#FF0000",OUTLINE_HIGHLIGHT_COLOR:"#00FF00",OUTLINE_HIGHLIGHT_STROKEWIDTH:5,HIGHLIGHT_STROKEWIDTH:3,HIGHLIGHT_SIZE:2,HIGHLIGHT_OPACITY:100,CURSOR_MOVABLE_VERTEX:"move",CURSOR_MOVABLE_EDGE:"move",CURSOR_LABEL_HANDLE:"default",CURSOR_TERMINAL_HANDLE:"pointer",CURSOR_BEND_HANDLE:"crosshair",CURSOR_VIRTUAL_BEND_HANDLE:"crosshair",CURSOR_CONNECT:"pointer",HIGHLIGHT_COLOR:"#00FF00",CONNECT_TARGET_COLOR:"#0000FF",INVALID_CONNECT_TARGET_COLOR:"#FF0000",DROP_TARGET_COLOR:"#0000FF",VALID_COLOR:"#00FF00",INVALID_COLOR:"#FF0000",EDGE_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_STROKEWIDTH:1,EDGE_SELECTION_STROKEWIDTH:1,VERTEX_SELECTION_DASHED:!0,EDGE_SELECTION_DASHED:!0,GUIDE_COLOR:"#FF0000",GUIDE_STROKEWIDTH:1,OUTLINE_COLOR:"#0099FF",OUTLINE_STROKEWIDTH:mxClient.IS_IE?2:3,HANDLE_SIZE:6,LABEL_HANDLE_SIZE:4,HANDLE_FILLCOLOR:"#00FF00",HANDLE_STROKECOLOR:"black",LABEL_HANDLE_FILLCOLOR:"yellow",CONNECT_HANDLE_FILLCOLOR:"#0000FF",LOCKED_HANDLE_FILLCOLOR:"#FF0000",OUTLINE_HANDLE_FILLCOLOR:"#00FFFF",OUTLINE_HANDLE_STROKECOLOR:"#0033FF",DEFAULT_FONTFAMILY:"Arial,Helvetica",DEFAULT_FONTSIZE:11,DEFAULT_TEXT_DIRECTION:"",LINE_HEIGHT:1.2,WORD_WRAP:"normal",ABSOLUTE_LINE_HEIGHT:!1,DEFAULT_FONTSTYLE:0,DEFAULT_STARTSIZE:40,DEFAULT_MARKERSIZE:6,DEFAULT_IMAGESIZE:24,ENTITY_SEGMENT:30,RECTANGLE_ROUNDING_FACTOR:.15,LINE_ARCSIZE:20,ARROW_SPACING:0,ARROW_WIDTH:30,ARROW_SIZE:30,PAGE_FORMAT_A4_PORTRAIT:new mxRectangle(0,0,827,1169),PAGE_FORMAT_A4_LANDSCAPE:new mxRectangle(0,0,1169,827),PAGE_FORMAT_LETTER_PORTRAIT:new mxRectangle(0,0,850,1100),PAGE_FORMAT_LETTER_LANDSCAPE:new mxRectangle(0,0,1100,850),NONE:"none",STYLE_PERIMETER:"perimeter",STYLE_SOURCE_PORT:"sourcePort",STYLE_TARGET_PORT:"targetPort",STYLE_PORT_CONSTRAINT:"portConstraint",STYLE_PORT_CONSTRAINT_ROTATION:"portConstraintRotation",STYLE_SOURCE_PORT_CONSTRAINT:"sourcePortConstraint",STYLE_TARGET_PORT_CONSTRAINT:"targetPortConstraint",STYLE_OPACITY:"opacity",STYLE_FILL_OPACITY:"fillOpacity",STYLE_STROKE_OPACITY:"strokeOpacity",STYLE_TEXT_OPACITY:"textOpacity",STYLE_TEXT_DIRECTION:"textDirection",STYLE_OVERFLOW:"overflow",STYLE_ORTHOGONAL:"orthogonal",STYLE_EXIT_X:"exitX",STYLE_EXIT_Y:"exitY",STYLE_EXIT_DX:"exitDx",STYLE_EXIT_DY:"exitDy",STYLE_EXIT_PERIMETER:"exitPerimeter",STYLE_ENTRY_X:"entryX",STYLE_ENTRY_Y:"entryY",STYLE_ENTRY_DX:"entryDx",STYLE_ENTRY_DY:"entryDy",STYLE_ENTRY_PERIMETER:"entryPerimeter",STYLE_WHITE_SPACE:"whiteSpace",STYLE_ROTATION:"rotation",STYLE_FILLCOLOR:"fillColor",STYLE_POINTER_EVENTS:"pointerEvents",STYLE_SWIMLANE_FILLCOLOR:"swimlaneFillColor",STYLE_MARGIN:"margin",STYLE_GRADIENTCOLOR:"gradientColor",STYLE_GRADIENT_DIRECTION:"gradientDirection",STYLE_STROKECOLOR:"strokeColor",STYLE_SEPARATORCOLOR:"separatorColor",STYLE_STROKEWIDTH:"strokeWidth",STYLE_ALIGN:"align",STYLE_VERTICAL_ALIGN:"verticalAlign",STYLE_LABEL_WIDTH:"labelWidth",STYLE_LABEL_POSITION:"labelPosition",STYLE_VERTICAL_LABEL_POSITION:"verticalLabelPosition",STYLE_IMAGE_ASPECT:"imageAspect",STYLE_IMAGE_ALIGN:"imageAlign",STYLE_IMAGE_VERTICAL_ALIGN:"imageVerticalAlign",STYLE_GLASS:"glass",STYLE_IMAGE:"image",STYLE_IMAGE_WIDTH:"imageWidth",STYLE_IMAGE_HEIGHT:"imageHeight",STYLE_IMAGE_BACKGROUND:"imageBackground",STYLE_IMAGE_BORDER:"imageBorder",STYLE_FLIPH:"flipH",STYLE_FLIPV:"flipV",STYLE_NOLABEL:"noLabel",STYLE_NOEDGESTYLE:"noEdgeStyle",STYLE_LABEL_BACKGROUNDCOLOR:"labelBackgroundColor",STYLE_LABEL_BORDERCOLOR:"labelBorderColor",STYLE_LABEL_PADDING:"labelPadding",STYLE_INDICATOR_SHAPE:"indicatorShape",STYLE_INDICATOR_IMAGE:"indicatorImage",STYLE_INDICATOR_COLOR:"indicatorColor",STYLE_INDICATOR_STROKECOLOR:"indicatorStrokeColor",STYLE_INDICATOR_GRADIENTCOLOR:"indicatorGradientColor",STYLE_INDICATOR_SPACING:"indicatorSpacing",STYLE_INDICATOR_WIDTH:"indicatorWidth",STYLE_INDICATOR_HEIGHT:"indicatorHeight",STYLE_INDICATOR_DIRECTION:"indicatorDirection",STYLE_SHADOW:"shadow",STYLE_SEGMENT:"segment",STYLE_ENDARROW:"endArrow",STYLE_STARTARROW:"startArrow",STYLE_ENDSIZE:"endSize",STYLE_STARTSIZE:"startSize",STYLE_SWIMLANE_LINE:"swimlaneLine",STYLE_ENDFILL:"endFill",STYLE_STARTFILL:"startFill",STYLE_DASHED:"dashed",STYLE_DASH_PATTERN:"dashPattern",STYLE_FIX_DASH:"fixDash",STYLE_ROUNDED:"rounded",STYLE_CURVED:"curved",STYLE_ARCSIZE:"arcSize",STYLE_ABSOLUTE_ARCSIZE:"absoluteArcSize",STYLE_SOURCE_PERIMETER_SPACING:"sourcePerimeterSpacing",STYLE_TARGET_PERIMETER_SPACING:"targetPerimeterSpacing",STYLE_PERIMETER_SPACING:"perimeterSpacing",STYLE_SPACING:"spacing",STYLE_SPACING_TOP:"spacingTop",STYLE_SPACING_LEFT:"spacingLeft",STYLE_SPACING_BOTTOM:"spacingBottom",STYLE_SPACING_RIGHT:"spacingRight",STYLE_HORIZONTAL:"horizontal",STYLE_DIRECTION:"direction",STYLE_ANCHOR_POINT_DIRECTION:"anchorPointDirection",STYLE_ELBOW:"elbow",STYLE_FONTCOLOR:"fontColor",STYLE_FONTFAMILY:"fontFamily",STYLE_FONTSIZE:"fontSize",STYLE_FONTSTYLE:"fontStyle",STYLE_ASPECT:"aspect",STYLE_AUTOSIZE:"autosize",STYLE_FOLDABLE:"foldable",STYLE_EDITABLE:"editable",STYLE_BACKGROUND_OUTLINE:"backgroundOutline",STYLE_BENDABLE:"bendable",STYLE_MOVABLE:"movable",STYLE_RESIZABLE:"resizable",STYLE_RESIZE_WIDTH:"resizeWidth",STYLE_RESIZE_HEIGHT:"resizeHeight",STYLE_ROTATABLE:"rotatable",STYLE_CLONEABLE:"cloneable",STYLE_DELETABLE:"deletable",STYLE_SHAPE:"shape",STYLE_EDGE:"edgeStyle",STYLE_JETTY_SIZE:"jettySize",STYLE_SOURCE_JETTY_SIZE:"sourceJettySize",STYLE_TARGET_JETTY_SIZE:"targetJettySize",STYLE_LOOP:"loopStyle",STYLE_ORTHOGONAL_LOOP:"orthogonalLoop",STYLE_ROUTING_CENTER_X:"routingCenterX",STYLE_ROUTING_CENTER_Y:"routingCenterY",FONT_BOLD:1,FONT_ITALIC:2,FONT_UNDERLINE:4,FONT_STRIKETHROUGH:8,SHAPE_RECTANGLE:"rectangle",SHAPE_ELLIPSE:"ellipse",SHAPE_DOUBLE_ELLIPSE:"doubleEllipse",SHAPE_RHOMBUS:"rhombus",SHAPE_LINE:"line",SHAPE_IMAGE:"image",SHAPE_ARROW:"arrow",SHAPE_ARROW_CONNECTOR:"arrowConnector",SHAPE_LABEL:"label",SHAPE_CYLINDER:"cylinder",SHAPE_SWIMLANE:"swimlane",SHAPE_CONNECTOR:"connector",SHAPE_ACTOR:"actor",SHAPE_CLOUD:"cloud",SHAPE_TRIANGLE:"triangle",SHAPE_HEXAGON:"hexagon",ARROW_CLASSIC:"classic",ARROW_CLASSIC_THIN:"classicThin",ARROW_BLOCK:"block",ARROW_BLOCK_THIN:"blockThin",ARROW_OPEN:"open",ARROW_OPEN_THIN:"openThin",ARROW_OVAL:"oval",ARROW_DIAMOND:"diamond",ARROW_DIAMOND_THIN:"diamondThin",ALIGN_LEFT:"left",ALIGN_CENTER:"center",ALIGN_RIGHT:"right",ALIGN_TOP:"top",ALIGN_MIDDLE:"middle",ALIGN_BOTTOM:"bottom",DIRECTION_NORTH:"north",DIRECTION_SOUTH:"south",DIRECTION_EAST:"east",DIRECTION_WEST:"west",TEXT_DIRECTION_DEFAULT:"",TEXT_DIRECTION_AUTO:"auto",TEXT_DIRECTION_LTR:"ltr",TEXT_DIRECTION_RTL:"rtl",DIRECTION_MASK_NONE:0,DIRECTION_MASK_WEST:1,DIRECTION_MASK_NORTH:2,DIRECTION_MASK_SOUTH:4,DIRECTION_MASK_EAST:8,DIRECTION_MASK_ALL:15,ELBOW_VERTICAL:"vertical",ELBOW_HORIZONTAL:"horizontal",EDGESTYLE_ELBOW:"elbowEdgeStyle",EDGESTYLE_ENTITY_RELATION:"entityRelationEdgeStyle",EDGESTYLE_LOOP:"loopEdgeStyle",EDGESTYLE_SIDETOSIDE:"sideToSideEdgeStyle",EDGESTYLE_TOPTOBOTTOM:"topToBottomEdgeStyle",EDGESTYLE_ORTHOGONAL:"orthogonalEdgeStyle",EDGESTYLE_SEGMENT:"segmentEdgeStyle",PERIMETER_ELLIPSE:"ellipsePerimeter",PERIMETER_RECTANGLE:"rectanglePerimeter",PERIMETER_RHOMBUS:"rhombusPerimeter",PERIMETER_HEXAGON:"hexagonPerimeter",PERIMETER_TRIANGLE:"trianglePerimeter"};__mxOutput.mxConstants=typeof mxConstants<"u"?mxConstants:void 0;function mxEventObject(t){this.name=t,this.properties=[];for(var e=1;e
/g,"
").replace(/
/g,"
").replace(/(]+)>/gm,"$1 />")}return t},mxSvgCanvas2D.prototype.createDiv=function(t){var e=t;if(mxUtils.isNode(e)||(e="
"),document.body.appendChild(d);var r=d.offsetWidth,s=d.offsetHeight;d.parentNode.removeChild(d),l==mxConstants.ALIGN_CENTER?i-=r/2:l==mxConstants.ALIGN_RIGHT&&(i-=r),a==mxConstants.ALIGN_MIDDLE?n-=s/2:a==mxConstants.ALIGN_BOTTOM&&(n-=s),p=new mxRectangle((i+1)*u.scale,(n+2)*u.scale,r*u.scale,(s+1)*u.scale)}if(p!=null){var x=this.createElement("rect");x.setAttribute("fill",u.fontBackgroundColor||"none"),x.setAttribute("stroke",u.fontBorderColor||"none"),x.setAttribute("x",Math.floor(p.x-1)),x.setAttribute("y",Math.floor(p.y-1)),x.setAttribute("width",Math.ceil(p.width+2)),x.setAttribute("height",Math.ceil(p.height));var f=u.fontBorderColor!=null?Math.max(1,this.format(u.scale)):0;x.setAttribute("stroke-width",f),this.root.ownerDocument==document&&mxUtils.mod(f,2)==1&&x.setAttribute("transform","translate(0.5, 0.5)"),t.insertBefore(x,t.firstChild)}}},mxSvgCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxSvgCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxSvgCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)},__mxOutput.mxSvgCanvas2D=typeof mxSvgCanvas2D<"u"?mxSvgCanvas2D:void 0;var mxVmlCanvas2D=function(t){mxAbstractCanvas2D.call(this),this.root=t};mxUtils.extend(mxVmlCanvas2D,mxAbstractCanvas2D),mxVmlCanvas2D.prototype.node=null,mxVmlCanvas2D.prototype.textEnabled=!0,mxVmlCanvas2D.prototype.moveOp="m",mxVmlCanvas2D.prototype.lineOp="l",mxVmlCanvas2D.prototype.curveOp="c",mxVmlCanvas2D.prototype.closeOp="x",mxVmlCanvas2D.prototype.rotatedHtmlBackground="",mxVmlCanvas2D.prototype.vmlScale=1,mxVmlCanvas2D.prototype.createElement=function(t){return document.createElement(t)},mxVmlCanvas2D.prototype.createVmlElement=function(t){return this.createElement(mxClient.VML_PREFIX+":"+t)},mxVmlCanvas2D.prototype.addNode=function(t,e){var i=this.node,n=this.state;if(i!=null){if(i.nodeName=="shape")if(this.path!=null&&this.path.length>0)i.path=this.path.join(" ")+" e",i.style.width=this.root.style.width,i.style.height=this.root.style.height,i.coordsize=parseInt(i.style.width)+" "+parseInt(i.style.height);else return;i.strokeweight=this.format(Math.max(1,n.strokeWidth*n.scale/this.vmlScale))+"px",n.shadow&&this.root.appendChild(this.createShadow(i,t&&n.fillColor!=null,e&&n.strokeColor!=null)),e&&n.strokeColor!=null?(i.stroked="true",i.strokecolor=n.strokeColor):i.stroked="false",i.appendChild(this.createStroke()),t&&n.fillColor!=null?i.appendChild(this.createFill()):this.pointerEvents&&(i.nodeName!="shape"||this.path[this.path.length-1]==this.closeOp)?i.appendChild(this.createTransparentFill()):i.filled="false",this.root.appendChild(i)}},mxVmlCanvas2D.prototype.createTransparentFill=function(){var t=this.createVmlElement("fill");return t.src=mxClient.imageBasePath+"/transparent.gif",t.type="tile",t},mxVmlCanvas2D.prototype.createFill=function(){var t=this.state,e=this.createVmlElement("fill");if(e.color=t.fillColor,t.gradientColor!=null){e.type="gradient",e.method="none",e.color2=t.gradientColor;var i=180-t.rotation;t.gradientDirection==mxConstants.DIRECTION_WEST?i-=90+(this.root.style.flip=="x"?180:0):t.gradientDirection==mxConstants.DIRECTION_EAST?i+=90+(this.root.style.flip=="x"?180:0):t.gradientDirection==mxConstants.DIRECTION_NORTH?i-=180+(this.root.style.flip=="y"?-180:0):i+=this.root.style.flip=="y"?-180:0,(this.root.style.flip=="x"||this.root.style.flip=="y")&&(i*=-1),e.angle=mxUtils.mod(i,360),e.opacity=t.alpha*t.gradientFillAlpha*100+"%",e.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",t.alpha*t.gradientAlpha*100+"%")}else(t.alpha<1||t.fillAlpha<1)&&(e.opacity=t.alpha*t.fillAlpha*100+"%");return e},mxVmlCanvas2D.prototype.createStroke=function(){var t=this.state,e=this.createVmlElement("stroke");return e.endcap=t.lineCap||"flat",e.joinstyle=t.lineJoin||"miter",e.miterlimit=t.miterLimit||"10",(t.alpha<1||t.strokeAlpha<1)&&(e.opacity=t.alpha*t.strokeAlpha*100+"%"),t.dashed&&(e.dashstyle=this.getVmlDashStyle()),e},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var t="dash";if(typeof this.state.dashPattern=="string"){var e=this.state.dashPattern.split(" ");e.length>0&&e[0]==1&&(t="0 2")}return t},mxVmlCanvas2D.prototype.createShadow=function(t,e,i){var n=this.state,r=-n.rotation*(Math.PI/180),s=Math.cos(r),l=Math.sin(r),a=n.shadowDx*n.scale,o=n.shadowDy*n.scale;this.root.style.flip=="x"?a*=-1:this.root.style.flip=="y"&&(o*=-1);var u=t.cloneNode(!0);return u.style.marginLeft=Math.round(a*s-o*l)+"px",u.style.marginTop=Math.round(a*l+o*s)+"px",document.documentMode==8&&(u.strokeweight=t.strokeweight,t.nodeName=="shape"&&(u.path=this.path.join(" ")+" e",u.style.width=this.root.style.width,u.style.height=this.root.style.height,u.coordsize=parseInt(t.style.width)+" "+parseInt(t.style.height))),i?(u.strokecolor=n.shadowColor,u.appendChild(this.createShadowStroke())):u.stroked="false",e?u.appendChild(this.createShadowFill()):u.filled="false",u},mxVmlCanvas2D.prototype.createShadowFill=function(){var t=this.createVmlElement("fill");return t.color=this.state.shadowColor,t.opacity=this.state.alpha*this.state.shadowAlpha*100+"%",t},mxVmlCanvas2D.prototype.createShadowStroke=function(){var t=this.createStroke();return t.opacity=this.state.alpha*this.state.shadowAlpha*100+"%",t},mxVmlCanvas2D.prototype.rotate=function(t,e,i,n,r){e&&i?t+=180:e?this.root.style.flip="x":i&&(this.root.style.flip="y"),(e?!i:i)&&(t*=-1),this.root.style.rotation=t,this.state.rotation=this.state.rotation+t,this.state.rotationCx=n,this.state.rotationCy=r},mxVmlCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=this.createVmlElement("shape"),this.node.style.position="absolute"},mxVmlCanvas2D.prototype.quadTo=function(t,e,i,n){var r=this.state,s=(this.lastX+r.dx)*r.scale,l=(this.lastY+r.dy)*r.scale,a=(t+r.dx)*r.scale,o=(e+r.dy)*r.scale,u=(i+r.dx)*r.scale,p=(n+r.dy)*r.scale,m=s+2/3*(a-s),d=l+2/3*(o-l),x=u+2/3*(a-u),f=p+2/3*(o-p);this.path.push("c "+this.format(m)+" "+this.format(d)+" "+this.format(x)+" "+this.format(f)+" "+this.format(u)+" "+this.format(p)),this.lastX=u/r.scale-r.dx,this.lastY=p/r.scale-r.dy},mxVmlCanvas2D.prototype.createRect=function(t,e,i,n,r){var s=this.state,l=this.createVmlElement(t);return l.style.position="absolute",l.style.left=this.format((e+s.dx)*s.scale)+"px",l.style.top=this.format((i+s.dy)*s.scale)+"px",l.style.width=this.format(n*s.scale)+"px",l.style.height=this.format(r*s.scale)+"px",l},mxVmlCanvas2D.prototype.rect=function(t,e,i,n){this.node=this.createRect("rect",t,e,i,n)},mxVmlCanvas2D.prototype.roundrect=function(t,e,i,n,r,s){this.node=this.createRect("roundrect",t,e,i,n),this.node.setAttribute("arcsize",Math.max(r*100/i,s*100/n)+"%")},mxVmlCanvas2D.prototype.ellipse=function(t,e,i,n){this.node=this.createRect("oval",t,e,i,n)},mxVmlCanvas2D.prototype.image=function(t,e,i,n,r,s,l,a){var o=null;if(!s)o=this.createRect("image",t,e,i,n),o.src=r;else{o=this.createRect("rect",t,e,i,n),o.stroked="false";var u=this.createVmlElement("fill");u.aspect=s?"atmost":"ignore",u.rotate="true",u.type="frame",u.src=r,o.appendChild(u)}l&&a?o.style.rotation="180":l?o.style.flip="x":a&&(o.style.flip="y"),(this.state.alpha<1||this.state.fillAlpha<1)&&(o.style.filter+="alpha(opacity="+this.state.alpha*this.state.fillAlpha*100+")"),this.root.appendChild(o)},mxVmlCanvas2D.prototype.createDiv=function(t,e,i,n){var r=this.createElement("div"),s=this.state,l="";if(s.fontBackgroundColor!=null&&(l+="background-color:"+mxUtils.htmlEntities(s.fontBackgroundColor)+";"),s.fontBorderColor!=null&&(l+="border:1px solid "+mxUtils.htmlEntities(s.fontBorderColor)+";"),mxUtils.isNode(t))r.appendChild(t);else if(n!="fill"&&n!="width"){var a=this.createElement("div");a.style.cssText=l,a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.style.textDecoration="inherit",a.innerHTML=t,r.appendChild(a)}else r.style.cssText=l,r.innerHTML=t;var o=r.style;return o.fontSize=s.fontSize/this.vmlScale+"px",o.fontFamily=s.fontFamily,o.color=s.fontColor,o.verticalAlign="top",o.textAlign=e||"left",o.lineHeight=mxConstants.ABSOLUTE_LINE_HEIGHT?s.fontSize*mxConstants.LINE_HEIGHT/this.vmlScale+"px":mxConstants.LINE_HEIGHT,(s.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(o.fontWeight="bold"),(s.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(o.fontStyle="italic"),(s.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(o.textDecoration="underline"),r},mxVmlCanvas2D.prototype.text=function(t,e,i,n,r,s,l,a,o,u,p,m,d){if(this.textEnabled&&r!=null){var x=this.state;if(o=="html"){if(x.rotation!=null){var f=this.rotatePoint(t,e,x.rotation,x.rotationCx,x.rotationCy);t=f.x,e=f.y}document.documentMode==8&&!mxClient.IS_EM?(t+=x.dx,e+=x.dy,u!="fill"&&l==mxConstants.ALIGN_TOP&&(e-=1)):(t*=x.scale,e*=x.scale);var g=document.documentMode==8&&!mxClient.IS_EM?this.createVmlElement("group"):this.createElement("div");g.style.position="absolute",g.style.display="inline",g.style.left=this.format(t)+"px",g.style.top=this.format(e)+"px",g.style.zoom=x.scale;var c=this.createElement("div");c.style.position="relative",c.style.display="inline";var v=mxUtils.getAlignmentAsPoint(s,l),y=v.x,T=v.y,C=this.createDiv(r,s,l,u),S=this.createElement("div");if(d!=null&&C.setAttribute("dir",d),a&&i>0){if(p||(C.style.width=Math.round(i)+"px"),C.style.wordWrap=mxConstants.WORD_WRAP,C.style.whiteSpace="normal",C.style.wordWrap=="break-word"){var E=C;E.firstChild!=null&&E.firstChild.nodeName=="DIV"&&(E.firstChild.style.width="100%")}}else C.style.whiteSpace="nowrap";var L=x.rotation+(m||0);if(this.rotateHtml&&L!=0?(S.style.display="inline",S.style.zoom="1",S.appendChild(C),document.documentMode==8&&!mxClient.IS_EM&&this.root.nodeName!="DIV"?(c.appendChild(S),g.appendChild(c)):g.appendChild(S)):document.documentMode==8&&!mxClient.IS_EM?(c.appendChild(C),g.appendChild(c)):(C.style.display="inline",g.appendChild(C)),this.root.nodeName!="DIV"){var A=this.createVmlElement("rect");A.stroked="false",A.filled="false",A.appendChild(g),this.root.appendChild(A)}else this.root.appendChild(g);if(p?(C.style.overflow="hidden",C.style.width=Math.round(i)+"px",mxClient.IS_QUIRKS||(C.style.maxHeight=Math.round(n)+"px")):u=="fill"?(C.style.overflow="hidden",C.style.width=Math.max(0,i)+1+"px",C.style.height=Math.max(0,n)+1+"px"):u=="width"&&(C.style.overflow="hidden",C.style.width=Math.max(0,i)+1+"px",C.style.maxHeight=Math.max(0,n)+1+"px"),this.rotateHtml&&L!=0){var M=L*(Math.PI/180),I=parseFloat(parseFloat(Math.cos(M)).toFixed(8)),P=parseFloat(parseFloat(Math.sin(-M)).toFixed(8));M%=2*Math.PI,M<0&&(M+=2*Math.PI),M%=Math.PI,M>Math.PI/2&&(M=Math.PI-M);var R=Math.cos(M),O=Math.sin(M);document.documentMode==8&&!mxClient.IS_EM&&(C.style.display="inline-block",S.style.display="inline-block",c.style.display="inline-block"),C.style.visibility="hidden",C.style.position="absolute",document.body.appendChild(C);var _=C;_.firstChild!=null&&_.firstChild.nodeName=="DIV"&&(_=_.firstChild);var E=_.offsetWidth+3,b=_.offsetHeight;p?(i=Math.min(i,E),b=Math.min(b,n)):i=E,a&&(C.style.width=i+"px"),mxClient.IS_QUIRKS&&(p||u=="width")&&b>n&&(b=n,C.style.height=b+"px"),n=b;var k=(n-n*R+i*-O)/2-P*i*(y+.5)+I*n*(T+.5),G=(i-i*R+n*-O)/2+I*i*(y+.5)+P*n*(T+.5);if(g.nodeName=="group"&&this.root.nodeName=="DIV"){var B=this.createElement("div");B.style.display="inline-block",B.style.position="absolute",B.style.left=this.format(t+(G-i/2)*x.scale)+"px",B.style.top=this.format(e+(k-n/2)*x.scale)+"px",g.parentNode.appendChild(B),B.appendChild(g)}else{var j=document.documentMode==8&&!mxClient.IS_EM?1:x.scale;g.style.left=this.format(t+(G-i/2)*j)+"px",g.style.top=this.format(e+(k-n/2)*j)+"px"}S.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+I+", M12="+P+", M21="+-P+", M22="+I+", sizingMethod='auto expand')",S.style.backgroundColor=this.rotatedHtmlBackground,this.state.alpha<1&&(S.style.filter+="alpha(opacity="+this.state.alpha*100+")"),S.appendChild(C),C.style.position="",C.style.visibility=""}else if(document.documentMode!=8||mxClient.IS_EM){C.style.verticalAlign="top",this.state.alpha<1&&(g.style.filter="alpha(opacity="+this.state.alpha*100+")");var H=C.parentNode;C.style.visibility="hidden",document.body.appendChild(C),i=C.offsetWidth;var b=C.offsetHeight;mxClient.IS_QUIRKS&&p&&b>n&&(b=n,C.style.height=b+"px"),n=b,C.style.visibility="",H.appendChild(C),g.style.left=this.format(t+i*y*this.state.scale)+"px",g.style.top=this.format(e+n*T*this.state.scale)+"px"}else this.state.alpha<1&&(C.style.filter="alpha(opacity="+this.state.alpha*100+")"),c.style.left=y*100+"%",c.style.top=T*100+"%"}else this.plainText(t,e,i,n,mxUtils.htmlEntities(r,!1),s,l,a,o,u,p,m,d)}},mxVmlCanvas2D.prototype.plainText=function(t,e,i,n,r,s,l,a,o,u,p,m,d){var x=this.state;t=(t+x.dx)*x.scale,e=(e+x.dy)*x.scale;var f=this.createVmlElement("shape");f.style.width="1px",f.style.height="1px",f.stroked="false";var g=this.createVmlElement("fill");g.color=x.fontColor,g.opacity=x.alpha*100+"%",f.appendChild(g);var c=this.createVmlElement("path");c.textpathok="true",c.v="m "+this.format(0)+" "+this.format(0)+" l "+this.format(1)+" "+this.format(0),f.appendChild(c);var v=this.createVmlElement("textpath");v.style.cssText="v-text-align:"+s,v.style.align=s,v.style.fontFamily=x.fontFamily,v.string=r,v.on="true";var y=x.fontSize*x.scale/this.vmlScale;v.style.fontSize=y+"px",(x.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(v.style.fontWeight="bold"),(x.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(v.style.fontStyle="italic"),(x.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(v.style.textDecoration="underline");var T=r.split(`
-`),C=y+(T.length-1)*y*mxConstants.LINE_HEIGHT,S=0,E=0;if(l==mxConstants.ALIGN_BOTTOM?E=-C/2:l!=mxConstants.ALIGN_MIDDLE&&(E=C/2),m!=null){f.style.rotation=m;var L=m*(Math.PI/180);S=Math.sin(L)*E,E=Math.cos(L)*E}f.appendChild(v),f.style.left=this.format(t-S)+"px",f.style.top=this.format(e+E)+"px",this.root.appendChild(f)},mxVmlCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxVmlCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxVmlCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)},__mxOutput.mxVmlCanvas2D=typeof mxVmlCanvas2D<"u"?mxVmlCanvas2D:void 0;function mxGuide(t,e){this.graph=t,this.setStates(e)}mxGuide.prototype.graph=null,mxGuide.prototype.states=null,mxGuide.prototype.horizontal=!0,mxGuide.prototype.vertical=!0,mxGuide.prototype.guideX=null,mxGuide.prototype.guideY=null,mxGuide.prototype.rounded=!1,mxGuide.prototype.tolerance=2,mxGuide.prototype.setStates=function(t){this.states=t},mxGuide.prototype.isEnabledForEvent=function(t){return!0},mxGuide.prototype.getGuideTolerance=function(t){return t&&this.graph.gridEnabled?this.graph.gridSize/2:this.tolerance},mxGuide.prototype.createGuideShape=function(t){var e=new mxPolyline([],mxConstants.GUIDE_COLOR,mxConstants.GUIDE_STROKEWIDTH);return e.isDashed=!0,e},mxGuide.prototype.isStateIgnored=function(t){return!1},mxGuide.prototype.move=function(t,e,i,n){if(this.states!=null&&(this.horizontal||this.vertical)&&t!=null&&e!=null){let R=function(_,b,k){var G=!1;k&&Math.abs(_-v)
"):u;var p=this.textDirection;p==mxConstants.TEXT_DIRECTION_AUTO&&!a&&(p=this.getAutoDirection()),p!=mxConstants.TEXT_DIRECTION_LTR&&p!=mxConstants.TEXT_DIRECTION_RTL&&(p=null),t.text(n,r,s,l,u,this.align,this.valign,this.wrap,o,this.overflow,this.clipped,this.getTextRotation(),p)}},mxText.prototype.redraw=function(){if(this.visible&&this.checkBounds()&&this.cacheEnabled&&this.lastValue==this.value&&(mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML))if(this.node.nodeName=="DIV"&&(this.isHtmlAllowed()||!mxClient.IS_VML))mxClient.IS_SVG?this.redrawHtmlShapeWithCss3():(this.updateSize(this.node,this.state==null||this.state.view.textDiv==null),mxClient.IS_IE&&(document.documentMode==null||document.documentMode<=8)?this.updateHtmlFilter():this.updateHtmlTransform()),this.updateBoundingBox();else{var t=this.createCanvas();t!=null&&t.updateText!=null?(t.pointerEvents=this.pointerEvents,this.paint(t,!0),this.destroyCanvas(t),this.updateBoundingBox()):mxShape.prototype.redraw.apply(this,arguments)}else mxShape.prototype.redraw.apply(this,arguments),mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML?this.lastValue=this.value:this.lastValue=null},mxText.prototype.resetStyles=function(){mxShape.prototype.resetStyles.apply(this,arguments),this.color="black",this.align=mxConstants.ALIGN_CENTER,this.valign=mxConstants.ALIGN_MIDDLE,this.family=mxConstants.DEFAULT_FONTFAMILY,this.size=mxConstants.DEFAULT_FONTSIZE,this.fontStyle=mxConstants.DEFAULT_FONTSTYLE,this.spacing=2,this.spacingTop=2,this.spacingRight=2,this.spacingBottom=2,this.spacingLeft=2,this.horizontal=!0,delete this.background,delete this.border,this.textDirection=mxConstants.DEFAULT_TEXT_DIRECTION,delete this.margin},mxText.prototype.apply=function(t){var e=this.spacing;mxShape.prototype.apply.apply(this,arguments),this.style!=null&&(this.fontStyle=mxUtils.getValue(this.style,mxConstants.STYLE_FONTSTYLE,this.fontStyle),this.family=mxUtils.getValue(this.style,mxConstants.STYLE_FONTFAMILY,this.family),this.size=mxUtils.getValue(this.style,mxConstants.STYLE_FONTSIZE,this.size),this.color=mxUtils.getValue(this.style,mxConstants.STYLE_FONTCOLOR,this.color),this.align=mxUtils.getValue(this.style,mxConstants.STYLE_ALIGN,this.align),this.valign=mxUtils.getValue(this.style,mxConstants.STYLE_VERTICAL_ALIGN,this.valign),this.spacing=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING,this.spacing)),this.spacingTop=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_TOP,this.spacingTop-e))+this.spacing,this.spacingRight=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_RIGHT,this.spacingRight-e))+this.spacing,this.spacingBottom=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_BOTTOM,this.spacingBottom-e))+this.spacing,this.spacingLeft=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_LEFT,this.spacingLeft-e))+this.spacing,this.horizontal=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,this.horizontal),this.background=mxUtils.getValue(this.style,mxConstants.STYLE_LABEL_BACKGROUNDCOLOR,this.background),this.border=mxUtils.getValue(this.style,mxConstants.STYLE_LABEL_BORDERCOLOR,this.border),this.textDirection=mxUtils.getValue(this.style,mxConstants.STYLE_TEXT_DIRECTION,mxConstants.DEFAULT_TEXT_DIRECTION),this.opacity=mxUtils.getValue(this.style,mxConstants.STYLE_TEXT_OPACITY,100),this.updateMargin()),this.flipV=null,this.flipH=null},mxText.prototype.getAutoDirection=function(){var t=/[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(this.value);return t!=null&&t.length>0&&t[0]>"z"?mxConstants.TEXT_DIRECTION_RTL:mxConstants.TEXT_DIRECTION_LTR},mxText.prototype.getContentNode=function(){var t=this.node;return t!=null&&(t.ownerSVGElement==null?t=this.node.firstChild.firstChild:t=t.firstChild.firstChild.firstChild.firstChild.firstChild),t},mxText.prototype.updateBoundingBox=function(){var t=this.node;this.boundingBox=this.bounds.clone();var e=this.getTextRotation(),i=this.style!=null?mxUtils.getValue(this.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER):null,n=this.style!=null?mxUtils.getValue(this.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE):null;if(!this.ignoreStringSize&&t!=null&&this.overflow!="fill"&&(!this.clipped||!this.ignoreClippedStringSize||i!=mxConstants.ALIGN_CENTER||n!=mxConstants.ALIGN_MIDDLE)){var r=null,s=null;if(t.ownerSVGElement!=null)if(t.firstChild!=null&&t.firstChild.firstChild!=null&&t.firstChild.firstChild.nodeName=="foreignObject")t=t.firstChild.firstChild.firstChild.firstChild,s=t.offsetHeight*this.scale,this.overflow=="width"?r=this.boundingBox.width:r=t.offsetWidth*this.scale;else try{var l=t.getBBox();typeof this.value=="string"&&mxUtils.trim(this.value)==0?this.boundingBox=null:l.width==0&&l.height==0?this.boundingBox=null:this.boundingBox=new mxRectangle(l.x,l.y,l.width,l.height);return}catch{}else{var a=this.state!=null?this.state.view.textDiv:null;if(this.offsetWidth!=null&&this.offsetHeight!=null)r=this.offsetWidth*this.scale,s=this.offsetHeight*this.scale;else{a!=null&&(this.updateFont(a),this.updateSize(a,!1),this.updateInnerHtml(a),t=a);var o=t;if(document.documentMode==8&&!mxClient.IS_EM){var u=Math.round(this.bounds.width/this.scale);if(this.wrap&&u>0){if(t.style.wordWrap=mxConstants.WORD_WRAP,t.style.whiteSpace="normal",t.style.wordWrap!="break-word"){var p=o.getElementsByTagName("div");p.length>0&&(o=p[p.length-1]),r=o.offsetWidth+2,p=this.node.getElementsByTagName("div"),this.clipped&&(r=Math.min(u,r)),p.length>1&&(p[p.length-2].style.width=r+"px")}}else t.style.whiteSpace="nowrap"}else o.firstChild!=null&&o.firstChild.nodeName=="DIV"&&(o=o.firstChild);this.offsetWidth=o.offsetWidth+this.textWidthPadding,this.offsetHeight=o.offsetHeight,r=this.offsetWidth*this.scale,s=this.offsetHeight*this.scale}}r!=null&&s!=null&&(this.boundingBox=new mxRectangle(this.bounds.x,this.bounds.y,r,s))}if(this.boundingBox!=null)if(e!=0){var m=mxUtils.getBoundingBox(new mxRectangle(this.margin.x*this.boundingBox.width,this.margin.y*this.boundingBox.height,this.boundingBox.width,this.boundingBox.height),e,new mxPoint(0,0));this.unrotatedBoundingBox=mxRectangle.fromRectangle(this.boundingBox),this.unrotatedBoundingBox.x+=this.margin.x*this.unrotatedBoundingBox.width,this.unrotatedBoundingBox.y+=this.margin.y*this.unrotatedBoundingBox.height,this.boundingBox.x+=m.x,this.boundingBox.y+=m.y,this.boundingBox.width=m.width,this.boundingBox.height=m.height}else this.boundingBox.x+=this.margin.x*this.boundingBox.width,this.boundingBox.y+=this.margin.y*this.boundingBox.height,this.unrotatedBoundingBox=null},mxText.prototype.getShapeRotation=function(){return 0},mxText.prototype.getTextRotation=function(){return this.state!=null&&this.state.shape!=null?this.state.shape.getTextRotation():0},mxText.prototype.isPaintBoundsInverted=function(){return!this.horizontal&&this.state!=null&&this.state.view.graph.model.isVertex(this.state.cell)},mxText.prototype.configureCanvas=function(t,e,i,n,r){mxShape.prototype.configureCanvas.apply(this,arguments),t.setFontColor(this.color),t.setFontBackgroundColor(this.background),t.setFontBorderColor(this.border),t.setFontFamily(this.family),t.setFontSize(this.size),t.setFontStyle(this.fontStyle)},mxText.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width="1px",this.node.style.height="1px",this.node.style.overflow="visible"},mxText.prototype.getHtmlValue=function(){var t=this.value;return this.dialect!=mxConstants.DIALECT_STRICTHTML&&(t=mxUtils.htmlEntities(t,!1)),t=mxUtils.replaceTrailingNewlines(t,"
"):t,t},mxText.prototype.getTextCss=function(){var t=mxConstants.ABSOLUTE_LINE_HEIGHT?this.size*mxConstants.LINE_HEIGHT+"px":mxConstants.LINE_HEIGHT,e="display: inline-block; font-size: "+this.size+"px; font-family: "+this.family+"; color: "+this.color+"; line-height: "+t+"; pointer-events: "+(this.pointerEvents?"all":"none")+"; ";(this.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(e+="font-weight: bold; "),(this.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(e+="font-style: italic; ");var i=[];return(this.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&i.push("underline"),(this.fontStyle&mxConstants.FONT_STRIKETHROUGH)==mxConstants.FONT_STRIKETHROUGH&&i.push("line-through"),i.length>0&&(e+="text-decoration: "+i.join(" ")+"; "),e},mxText.prototype.redrawHtmlShape=function(){if(mxClient.IS_SVG)this.redrawHtmlShapeWithCss3();else{var t=this.node.style;t.whiteSpace="normal",t.overflow="",t.width="",t.height="",this.updateValue(),this.updateFont(this.node),this.updateSize(this.node,this.state==null||this.state.view.textDiv==null),this.offsetWidth=null,this.offsetHeight=null,mxClient.IS_IE&&(document.documentMode==null||document.documentMode<=8)?this.updateHtmlFilter():this.updateHtmlTransform()}},mxText.prototype.redrawHtmlShapeWithCss3=function(){var t=Math.max(0,Math.round(this.bounds.width/this.scale)),e=Math.max(0,Math.round(this.bounds.height/this.scale)),i="position: absolute; left: "+Math.round(this.bounds.x)+"px; top: "+Math.round(this.bounds.y)+"px; pointer-events: none; ",n=this.getTextCss();mxSvgCanvas2D.createCss(t+2,e,this.align,this.valign,this.wrap,this.overflow,this.clipped,this.background!=null?mxUtils.htmlEntities(this.background):null,this.border!=null?mxUtils.htmlEntities(this.border):null,i,n,this.scale,mxUtils.bind(this,function(r,s,l,a,o,u){var p=this.getTextRotation(),m=(this.scale!=1?"scale("+this.scale+") ":"")+(p!=0?"rotate("+p+"deg) ":"")+(this.margin.x!=0||this.margin.y!=0?"translate("+this.margin.x*100+"%,"+this.margin.y*100+"%)":"");m!=""&&(m="transform-origin: 0 0; transform: "+m+"; "),u==""?(l+=a,a="display:inline-block; min-width: 100%; "+m):(a+=m,mxClient.IS_SF&&(a+="-webkit-clip-path: content-box;")),this.opacity<100&&(o+="opacity: "+this.opacity/100+"; "),this.node.setAttribute("style",l);var d=mxUtils.isNode(this.value)?this.value.outerHTML:this.getHtmlValue();this.node.firstChild==null&&(this.node.innerHTML="
"):e,e='
"):t;var e=this.background!=null&&this.background!=mxConstants.NONE?this.background:null,i=this.border!=null&&this.border!=mxConstants.NONE?this.border:null;if(this.overflow=="fill"||this.overflow=="width")e!=null&&(this.node.style.backgroundColor=e),i!=null&&(this.node.style.border="1px solid "+i);else{var n="";e!=null&&(n+="background-color:"+mxUtils.htmlEntities(e)+";"),i!=null&&(n+="border:1px solid "+mxUtils.htmlEntities(i)+";");var r=mxConstants.ABSOLUTE_LINE_HEIGHT?this.size*mxConstants.LINE_HEIGHT+"px":mxConstants.LINE_HEIGHT;t='=0&&(r=this.traverse(m,e,o[p],n,r,s,l))}}else if(r[a]==null)for(var p=0;p0&&t!=null){for(var n=Object(),r=0;rr+l&&m>s+a)&&(n=!1),n){if(T){if(p==o){if(m<=s)return new mxPoint(o,s);if(m>=s+a)return new mxPoint(o,s+a)}else if(ps+3*a/4&&(C=new mxPoint(r-Math.floor(.5*l),s+Math.floor(.5*a)),S=new mxPoint(r+l,s+Math.floor(1.25*a))):p>o&&(m>s+a/4&&ms+3*a/4&&(C=new mxPoint(r+Math.floor(1.5*l),s+Math.floor(.5*a)),S=new mxPoint(r,s+Math.floor(1.25*a))))}else{if(m==u){if(p<=r)return new mxPoint(r,s+a/2);if(p>=r+l)return new mxPoint(r+l,s+a/2)}else if(ms+a){if(p==r+l/4)return new mxPoint(r+l/4,s+a);if(p==r+3*l/4)return new mxPoint(r+3*l/4,s+a)}else if(m==s){if(p
")},mxCellEditor.prototype.getCurrentValue=function(t){return mxUtils.extractTextWithWhitespace(this.textarea.childNodes)},mxCellEditor.prototype.isCancelEditingKeyEvent=function(t){return this.escapeCancelsEditing||mxEvent.isShiftDown(t)||mxEvent.isControlDown(t)||mxEvent.isMetaDown(t)},mxCellEditor.prototype.installListeners=function(t){mxEvent.addListener(t,"dragstart",mxUtils.bind(this,function(s){this.graph.stopEditing(!1),mxEvent.consume(s)})),mxEvent.addListener(t,"blur",mxUtils.bind(this,function(s){this.blurEnabled&&this.focusLost(s)})),mxEvent.addListener(t,"keydown",mxUtils.bind(this,function(s){mxEvent.isConsumed(s)||(this.isStopEditingEvent(s)?(this.graph.stopEditing(!1),mxEvent.consume(s)):s.keyCode==27&&(this.graph.stopEditing(this.isCancelEditingKeyEvent(s)),mxEvent.consume(s)))}));var e=mxUtils.bind(this,function(s){this.editingCell!=null&&this.clearOnChange&&t.innerHTML==this.getEmptyLabelText()&&(!mxClient.IS_FF||s.keyCode!=8&&s.keyCode!=46)&&(this.clearOnChange=!1,t.innerHTML="")});mxEvent.addListener(t,"keypress",e),mxEvent.addListener(t,"paste",e);var i=mxUtils.bind(this,function(s){this.editingCell!=null&&(this.textarea.innerHTML.length==0||this.textarea.innerHTML=="
"?(this.textarea.innerHTML=this.getEmptyLabelText(),this.clearOnChange=this.textarea.innerHTML.length>0):this.clearOnChange=!1)});mxEvent.addListener(t,!mxClient.IS_IE11&&!mxClient.IS_IE?"input":"keyup",i),mxEvent.addListener(t,"cut",i),mxEvent.addListener(t,"paste",i);var n=!mxClient.IS_IE11&&!mxClient.IS_IE?"input":"keydown",r=mxUtils.bind(this,function(s){this.editingCell!=null&&this.autoSize&&!mxEvent.isConsumed(s)&&(this.resizeThread!=null&&window.clearTimeout(this.resizeThread),this.resizeThread=window.setTimeout(mxUtils.bind(this,function(){this.resizeThread=null,this.resize()}),0))});mxEvent.addListener(t,n,r),mxEvent.addListener(window,"resize",r),document.documentMode>=9?(mxEvent.addListener(t,"DOMNodeRemoved",r),mxEvent.addListener(t,"DOMNodeInserted",r)):(mxEvent.addListener(t,"cut",r),mxEvent.addListener(t,"paste",r))},mxCellEditor.prototype.isStopEditingEvent=function(t){return t.keyCode==113||this.graph.isEnterStopsCellEditing()&&t.keyCode==13&&!mxEvent.isControlDown(t)&&!mxEvent.isShiftDown(t)},mxCellEditor.prototype.isEventSource=function(t){return mxEvent.getSource(t)==this.textarea},mxCellEditor.prototype.resize=function(){var t=this.graph.getView().getState(this.editingCell);if(t==null)this.stopEditing(!0);else if(this.textarea!=null){var e=this.graph.getModel().isEdge(t.cell),i=this.graph.getView().scale,n=null;if(!this.autoSize||t.style[mxConstants.STYLE_OVERFLOW]=="fill")this.bounds=this.getEditorBounds(t),this.textarea.style.width=Math.round(this.bounds.width/i)+"px",this.textarea.style.height=Math.round(this.bounds.height/i)+"px",document.documentMode==8||mxClient.IS_QUIRKS?(this.textarea.style.left=Math.round(this.bounds.x)+"px",this.textarea.style.top=Math.round(this.bounds.y)+"px"):(this.textarea.style.left=Math.max(0,Math.round(this.bounds.x+1))+"px",this.textarea.style.top=Math.max(0,Math.round(this.bounds.y+1))+"px"),this.graph.isWrapping(t.cell)&&(this.bounds.width>=2||this.bounds.height>=2)&&this.textarea.innerHTML!=this.getEmptyLabelText()?(this.textarea.style.wordWrap=mxConstants.WORD_WRAP,this.textarea.style.whiteSpace="normal",t.style[mxConstants.STYLE_OVERFLOW]!="fill"&&(this.textarea.style.width=Math.round(this.bounds.width/i)+this.wordWrapPadding+"px")):(this.textarea.style.whiteSpace="nowrap",t.style[mxConstants.STYLE_OVERFLOW]!="fill"&&(this.textarea.style.width=""));else{var r=mxUtils.getValue(t.style,mxConstants.STYLE_LABEL_WIDTH,null);if(n=t.text!=null&&this.align==null?t.text.margin:null,n==null&&(n=mxUtils.getAlignmentAsPoint(this.align||mxUtils.getValue(t.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER),mxUtils.getValue(t.style,mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE))),e){if(this.bounds=new mxRectangle(t.absoluteOffset.x,t.absoluteOffset.y,0,0),r!=null){var s=(parseFloat(r)+2)*i;this.bounds.width=s,this.bounds.x+=n.x*s}}else{var l=mxRectangle.fromRectangle(t),a=mxUtils.getValue(t.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER),o=mxUtils.getValue(t.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE);if(l=t.shape!=null&&a==mxConstants.ALIGN_CENTER&&o==mxConstants.ALIGN_MIDDLE?t.shape.getLabelBounds(l):l,r!=null&&(l.width=parseFloat(r)*i),!t.view.graph.cellRenderer.legacySpacing||t.style[mxConstants.STYLE_OVERFLOW]!="width"){var u=parseInt(t.style[mxConstants.STYLE_SPACING]||2)*i,p=(parseInt(t.style[mxConstants.STYLE_SPACING_TOP]||0)+mxText.prototype.baseSpacingTop)*i+u,m=(parseInt(t.style[mxConstants.STYLE_SPACING_RIGHT]||0)+mxText.prototype.baseSpacingRight)*i+u,d=(parseInt(t.style[mxConstants.STYLE_SPACING_BOTTOM]||0)+mxText.prototype.baseSpacingBottom)*i+u,x=(parseInt(t.style[mxConstants.STYLE_SPACING_LEFT]||0)+mxText.prototype.baseSpacingLeft)*i+u,a=mxUtils.getValue(t.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER),o=mxUtils.getValue(t.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE);l=new mxRectangle(l.x+x,l.y+p,l.width-(a==mxConstants.ALIGN_CENTER&&r==null?x+m:0),l.height-(o==mxConstants.ALIGN_MIDDLE?p+d:0))}this.bounds=new mxRectangle(l.x+t.absoluteOffset.x,l.y+t.absoluteOffset.y,l.width,l.height)}if(this.graph.isWrapping(t.cell)&&(this.bounds.width>=2||this.bounds.height>=2)&&this.textarea.innerHTML!=this.getEmptyLabelText()){this.textarea.style.wordWrap=mxConstants.WORD_WRAP,this.textarea.style.whiteSpace="normal";var s=Math.round(this.bounds.width/(document.documentMode==8,i))+this.wordWrapPadding;this.textarea.style.position!="relative"?(this.textarea.style.width=s+"px",this.textarea.scrollWidth>s&&(this.textarea.style.width=this.textarea.scrollWidth+"px")):this.textarea.style.maxWidth=s+"px"}else this.textarea.style.whiteSpace="nowrap",this.textarea.style.width="";document.documentMode==8&&(this.textarea.style.zoom="1",this.textarea.style.height="auto");var f=this.textarea.scrollWidth,g=this.textarea.scrollHeight;document.documentMode==8?(this.textarea.style.left=Math.max(0,Math.ceil((this.bounds.x-n.x*(this.bounds.width-(f+1)*i)+f*(i-1)*0+(n.x+.5)*2)/i))+"px",this.textarea.style.top=Math.max(0,Math.ceil((this.bounds.y-n.y*(this.bounds.height-(g+.5)*i)+g*(i-1)*0+Math.abs(n.y+.5)*1)/i))+"px",this.textarea.style.width=Math.round(f*i)+"px",this.textarea.style.height=Math.round(g*i)+"px"):mxClient.IS_QUIRKS?(this.textarea.style.left=Math.max(0,Math.ceil(this.bounds.x-n.x*(this.bounds.width-(f+1)*i)+f*(i-1)*0+(n.x+.5)*2))+"px",this.textarea.style.top=Math.max(0,Math.ceil(this.bounds.y-n.y*(this.bounds.height-(g+.5)*i)+g*(i-1)*0+Math.abs(n.y+.5)*1))+"px"):(this.textarea.style.left=Math.max(0,Math.round(this.bounds.x-n.x*(this.bounds.width-2))+1)+"px",this.textarea.style.top=Math.max(0,Math.round(this.bounds.y-n.y*(this.bounds.height-4)+(n.y==-1?3:0))+1)+"px")}mxClient.IS_VML?this.textarea.style.zoom=i:(mxUtils.setPrefixedStyle(this.textarea.style,"transformOrigin","0px 0px"),mxUtils.setPrefixedStyle(this.textarea.style,"transform","scale("+i+","+i+")"+(n==null?"":" translate("+n.x*100+"%,"+n.y*100+"%)")))}},mxCellEditor.prototype.focusLost=function(){this.stopEditing(!this.graph.isInvokesStopCellEditing())},mxCellEditor.prototype.getBackgroundColor=function(t){return null},mxCellEditor.prototype.isLegacyEditor=function(){if(mxClient.IS_VML)return!0;var t=!1;if(mxClient.IS_SVG){var e=this.graph.view.getDrawPane().ownerSVGElement;if(e!=null){var i=mxUtils.getCurrentStyle(e);i!=null&&(t=i.position=="absolute")}}return!t},mxCellEditor.prototype.startEditing=function(t,e){this.stopEditing(!0),this.align=null,this.textarea==null&&this.init(),this.graph.tooltipHandler!=null&&this.graph.tooltipHandler.hideTooltip();var i=this.graph.getView().getState(t);if(i!=null){this.graph.getView().scale;var n=mxUtils.getValue(i.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE),r=mxUtils.getValue(i.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY),s=mxUtils.getValue(i.style,mxConstants.STYLE_FONTCOLOR,"black"),l=mxUtils.getValue(i.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),a=(mxUtils.getValue(i.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,o=(mxUtils.getValue(i.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,u=[];(mxUtils.getValue(i.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&u.push("underline"),(mxUtils.getValue(i.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_STRIKETHROUGH)==mxConstants.FONT_STRIKETHROUGH&&u.push("line-through"),this.textarea.style.lineHeight=mxConstants.ABSOLUTE_LINE_HEIGHT?Math.round(n*mxConstants.LINE_HEIGHT)+"px":mxConstants.LINE_HEIGHT,this.textarea.style.backgroundColor=this.getBackgroundColor(i),this.textarea.style.textDecoration=u.join(" "),this.textarea.style.fontWeight=a?"bold":"normal",this.textarea.style.fontStyle=o?"italic":"",this.textarea.style.fontSize=Math.round(n)+"px",this.textarea.style.zIndex=this.zIndex,this.textarea.style.fontFamily=r,this.textarea.style.textAlign=l,this.textarea.style.outline="none",this.textarea.style.color=s;var p=this.textDirection=mxUtils.getValue(i.style,mxConstants.STYLE_TEXT_DIRECTION,mxConstants.DEFAULT_TEXT_DIRECTION);p==mxConstants.TEXT_DIRECTION_AUTO&&i!=null&&i.text!=null&&i.text.dialect!=mxConstants.DIALECT_STRICTHTML&&!mxUtils.isNode(i.text.value)&&(p=i.text.getAutoDirection()),p==mxConstants.TEXT_DIRECTION_LTR||p==mxConstants.TEXT_DIRECTION_RTL?this.textarea.setAttribute("dir",p):this.textarea.removeAttribute("dir"),this.textarea.innerHTML=this.getInitialValue(i,e)||"",this.initialValue=this.textarea.innerHTML,this.textarea.innerHTML.length==0||this.textarea.innerHTML=="
"?(this.textarea.innerHTML=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=this.textarea.innerHTML==this.getEmptyLabelText(),this.graph.container.appendChild(this.textarea),this.editingCell=t,this.trigger=e,this.textNode=null,i.text!=null&&this.isHideLabel(i)&&(this.textNode=i.text.node,this.textNode.style.visibility="hidden"),this.autoSize&&(this.graph.model.isEdge(i.cell)||i.style[mxConstants.STYLE_OVERFLOW]!="fill")&&window.setTimeout(mxUtils.bind(this,function(){this.resize()}),0),this.resize();try{this.textarea.focus(),this.isSelectText()&&this.textarea.innerHTML.length>0&&(this.textarea.innerHTML!=this.getEmptyLabelText()||!this.clearOnChange)&&document.execCommand("selectAll",!1,null)}catch{}}},mxCellEditor.prototype.isSelectText=function(){return this.selectText},mxCellEditor.prototype.clearSelection=function(){var t=null;window.getSelection?t=window.getSelection():document.selection&&(t=document.selection),t!=null&&(t.empty?t.empty():t.removeAllRanges&&t.removeAllRanges())},mxCellEditor.prototype.stopEditing=function(t){if(t=t||!1,this.editingCell!=null){this.textNode!=null&&(this.textNode.style.visibility="visible",this.textNode=null);var e=t?null:this.graph.view.getState(this.editingCell),i=this.initialValue;if(this.initialValue=null,this.editingCell=null,this.trigger=null,this.bounds=null,this.textarea.blur(),this.clearSelection(),this.textarea.parentNode!=null&&this.textarea.parentNode.removeChild(this.textarea),this.clearOnChange&&this.textarea.innerHTML==this.getEmptyLabelText()&&(this.textarea.innerHTML="",this.clearOnChange=!1),e!=null&&(this.textarea.innerHTML!=i||this.align!=null)){this.prepareTextarea();var n=this.getCurrentValue(e);this.graph.getModel().beginUpdate();try{n!=null&&this.applyValue(e,n),this.align!=null&&this.graph.setCellStyles(mxConstants.STYLE_ALIGN,this.align,[e.cell])}finally{this.graph.getModel().endUpdate()}}mxEvent.release(this.textarea),this.textarea=null,this.align=null}},mxCellEditor.prototype.prepareTextarea=function(){this.textarea.lastChild!=null&&this.textarea.lastChild.nodeName=="BR"&&this.textarea.removeChild(this.textarea.lastChild)},mxCellEditor.prototype.isHideLabel=function(t){return!0},mxCellEditor.prototype.getMinimumSize=function(t){var e=this.graph.getView().scale;return new mxRectangle(0,0,t.text==null?30:t.text.size*e+20,this.textarea.style.textAlign=="left"?120:40)},mxCellEditor.prototype.getEditorBounds=function(t){var e=this.graph.getModel().isEdge(t.cell),i=this.graph.getView().scale,n=this.getMinimumSize(t),r=n.width,s=n.height,l=null;if(!e&&t.view.graph.cellRenderer.legacySpacing&&t.style[mxConstants.STYLE_OVERFLOW]=="fill")l=t.shape.getLabelBounds(mxRectangle.fromRectangle(t));else{var a=parseInt(t.style[mxConstants.STYLE_SPACING]||0)*i,o=(parseInt(t.style[mxConstants.STYLE_SPACING_TOP]||0)+mxText.prototype.baseSpacingTop)*i+a,u=(parseInt(t.style[mxConstants.STYLE_SPACING_RIGHT]||0)+mxText.prototype.baseSpacingRight)*i+a,p=(parseInt(t.style[mxConstants.STYLE_SPACING_BOTTOM]||0)+mxText.prototype.baseSpacingBottom)*i+a,m=(parseInt(t.style[mxConstants.STYLE_SPACING_LEFT]||0)+mxText.prototype.baseSpacingLeft)*i+a;l=new mxRectangle(t.x,t.y,Math.max(r,t.width-m-u),Math.max(s,t.height-o-p));var d=mxUtils.getValue(t.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER),x=mxUtils.getValue(t.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE);if(l=t.shape!=null&&d==mxConstants.ALIGN_CENTER&&x==mxConstants.ALIGN_MIDDLE?t.shape.getLabelBounds(l):l,e?(l.x=t.absoluteOffset.x,l.y=t.absoluteOffset.y,t.text!=null&&t.text.boundingBox!=null&&(t.text.boundingBox.x>0&&(l.x=t.text.boundingBox.x),t.text.boundingBox.y>0&&(l.y=t.text.boundingBox.y))):t.text!=null&&t.text.boundingBox!=null&&(l.x=Math.min(l.x,t.text.boundingBox.x),l.y=Math.min(l.y,t.text.boundingBox.y)),l.x+=m,l.y+=o,t.text!=null&&t.text.boundingBox!=null&&(e?(l.width=Math.max(r,t.text.boundingBox.width),l.height=Math.max(s,t.text.boundingBox.height)):(l.width=Math.max(l.width,t.text.boundingBox.width),l.height=Math.max(l.height,t.text.boundingBox.height))),this.graph.getModel().isVertex(t.cell)){var f=mxUtils.getValue(t.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);f==mxConstants.ALIGN_LEFT?l.x-=t.width:f==mxConstants.ALIGN_RIGHT&&(l.x+=t.width);var g=mxUtils.getValue(t.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE);g==mxConstants.ALIGN_TOP?l.y-=t.height:g==mxConstants.ALIGN_BOTTOM&&(l.y+=t.height)}}return new mxRectangle(Math.round(l.x),Math.round(l.y),Math.round(l.width),Math.round(l.height))},mxCellEditor.prototype.getEmptyLabelText=function(t){return this.emptyLabelText},mxCellEditor.prototype.getEditingCell=function(){return this.editingCell},mxCellEditor.prototype.destroy=function(){this.textarea!=null&&(mxEvent.release(this.textarea),this.textarea.parentNode!=null&&this.textarea.parentNode.removeChild(this.textarea),this.textarea=null),this.changeHandler!=null&&(this.graph.getModel().removeListener(this.changeHandler),this.changeHandler=null),this.zoomHandler&&(this.graph.view.removeListener(this.zoomHandler),this.zoomHandler=null)},__mxOutput.mxCellEditor=typeof mxCellEditor<"u"?mxCellEditor:void 0;function mxCellRenderer(){}mxCellRenderer.defaultShapes=new Object,mxCellRenderer.prototype.defaultEdgeShape=mxConnector,mxCellRenderer.prototype.defaultVertexShape=mxRectangleShape,mxCellRenderer.prototype.defaultTextShape=mxText,mxCellRenderer.prototype.legacyControlPosition=!0,mxCellRenderer.prototype.legacySpacing=!0,mxCellRenderer.prototype.antiAlias=!0,mxCellRenderer.prototype.minSvgStrokeWidth=1,mxCellRenderer.prototype.forceControlClickHandler=!1,mxCellRenderer.registerShape=function(t,e){mxCellRenderer.defaultShapes[t]=e},mxCellRenderer.registerShape(mxConstants.SHAPE_RECTANGLE,mxRectangleShape),mxCellRenderer.registerShape(mxConstants.SHAPE_ELLIPSE,mxEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_RHOMBUS,mxRhombus),mxCellRenderer.registerShape(mxConstants.SHAPE_CYLINDER,mxCylinder),mxCellRenderer.registerShape(mxConstants.SHAPE_CONNECTOR,mxConnector),mxCellRenderer.registerShape(mxConstants.SHAPE_ACTOR,mxActor),mxCellRenderer.registerShape(mxConstants.SHAPE_TRIANGLE,mxTriangle),mxCellRenderer.registerShape(mxConstants.SHAPE_HEXAGON,mxHexagon),mxCellRenderer.registerShape(mxConstants.SHAPE_CLOUD,mxCloud),mxCellRenderer.registerShape(mxConstants.SHAPE_LINE,mxLine),mxCellRenderer.registerShape(mxConstants.SHAPE_ARROW,mxArrow),mxCellRenderer.registerShape(mxConstants.SHAPE_ARROW_CONNECTOR,mxArrowConnector),mxCellRenderer.registerShape(mxConstants.SHAPE_DOUBLE_ELLIPSE,mxDoubleEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_SWIMLANE,mxSwimlane),mxCellRenderer.registerShape(mxConstants.SHAPE_IMAGE,mxImageShape),mxCellRenderer.registerShape(mxConstants.SHAPE_LABEL,mxLabel),mxCellRenderer.prototype.initializeShape=function(t){t.shape.dialect=t.view.graph.dialect,this.configureShape(t),t.shape.init(t.view.getDrawPane())},mxCellRenderer.prototype.createShape=function(t){var e=null;if(t.style!=null){var i=mxStencilRegistry.getStencil(t.style[mxConstants.STYLE_SHAPE]);if(i!=null)e=new mxShape(i);else{var n=this.getShapeConstructor(t);e=new n}}return e},mxCellRenderer.prototype.createIndicatorShape=function(t){t.shape.indicatorShape=this.getShape(t.view.graph.getIndicatorShape(t))},mxCellRenderer.prototype.getShape=function(t){return t!=null?mxCellRenderer.defaultShapes[t]:null},mxCellRenderer.prototype.getShapeConstructor=function(t){var e=this.getShape(t.style[mxConstants.STYLE_SHAPE]);return e==null&&(e=t.view.graph.getModel().isEdge(t.cell)?this.defaultEdgeShape:this.defaultVertexShape),e},mxCellRenderer.prototype.configureShape=function(t){t.shape.apply(t),t.shape.image=t.view.graph.getImage(t),t.shape.indicatorColor=t.view.graph.getIndicatorColor(t),t.shape.indicatorStrokeColor=t.style[mxConstants.STYLE_INDICATOR_STROKECOLOR],t.shape.indicatorGradientColor=t.view.graph.getIndicatorGradientColor(t),t.shape.indicatorDirection=t.style[mxConstants.STYLE_INDICATOR_DIRECTION],t.shape.indicatorImage=t.view.graph.getIndicatorImage(t),this.postConfigureShape(t)},mxCellRenderer.prototype.postConfigureShape=function(t){t.shape!=null&&(this.resolveColor(t,"indicatorGradientColor",mxConstants.STYLE_GRADIENTCOLOR),this.resolveColor(t,"indicatorColor",mxConstants.STYLE_FILLCOLOR),this.resolveColor(t,"gradient",mxConstants.STYLE_GRADIENTCOLOR),this.resolveColor(t,"stroke",mxConstants.STYLE_STROKECOLOR),this.resolveColor(t,"fill",mxConstants.STYLE_FILLCOLOR))},mxCellRenderer.prototype.checkPlaceholderStyles=function(t){if(t.style!=null){for(var e=["inherit","swimlane","indicated"],i=[mxConstants.STYLE_FILLCOLOR,mxConstants.STYLE_STROKECOLOR,mxConstants.STYLE_GRADIENTCOLOR,mxConstants.STYLE_FONTCOLOR],n=0;nc&&(P=c);var R=Math.sqrt(mxUtils.ptSegDistSq(o.x,o.y,u.x,u.y,e,i)),O=mxUtils.relativeCcw(o.x,o.y,u.x,u.y,e,i);return O==-1&&(R=-R),new mxPoint((l/2-x-P)/l*-2,R/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(t){var e=t.absolutePoints;if(t.absoluteOffset.x=t.getCenterX(),t.absoluteOffset.y=t.getCenterY(),e!=null&&e.length>0&&t.segments!=null){var i=this.graph.getCellGeometry(t.cell);if(i.relative){var n=this.getPoint(t,i);n!=null&&(t.absoluteOffset=n)}else{var r=e[0],s=e[e.length-1];if(r!=null&&s!=null){var l=s.x-r.x,a=s.y-r.y,o=0,u=0,p=i.offset;p!=null&&(o=p.x,u=p.y);var m=r.x+l/2+o*this.scale,d=r.y+a/2+u*this.scale;t.absoluteOffset.x=m,t.absoluteOffset.y=d}}}},mxGraphView.prototype.getState=function(t,e){e=e||!1;var i=null;return t!=null&&(i=this.states.get(t),e&&(i==null||this.updateStyle)&&this.graph.isCellVisible(t)&&(i==null?(i=this.createState(t),this.states.put(t,i)):i.style=this.graph.getCellStyle(t))),i},mxGraphView.prototype.isRendering=function(){return this.rendering},mxGraphView.prototype.setRendering=function(t){this.rendering=t},mxGraphView.prototype.isAllowEval=function(){return this.allowEval},mxGraphView.prototype.setAllowEval=function(t){this.allowEval=t},mxGraphView.prototype.getStates=function(){return this.states},mxGraphView.prototype.setStates=function(t){this.states=t},mxGraphView.prototype.getCellStates=function(t){if(t==null)return this.states;for(var e=[],i=0;i
");var p=mxUtils.getSizeForString(u,s,r[mxConstants.STYLE_FONTFAMILY],e,r[mxConstants.STYLE_FONTSTYLE]),m=p.width+l,d=p.height+a;if(!mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0)){var x=d;d=m,m=x}this.gridEnabled&&(m=this.snap(m+this.gridSize/2),d=this.snap(d+this.gridSize/2)),i=new mxRectangle(0,0,m,d)}else{var f=4*this.gridSize;i=new mxRectangle(0,0,f,f)}}}return i},mxGraph.prototype.resizeCell=function(t,e,i){return this.resizeCells([t],[e],i)[0]},mxGraph.prototype.resizeCells=function(t,e,i){i=i??this.isRecursiveResize(),this.model.beginUpdate();try{var n=this.cellsResized(t,e,i);this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",t,"bounds",e,"previous",n))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsResized=function(t,e,i){i=i??!1;var n=[];if(t!=null&&e!=null&&t.length==e.length){this.model.beginUpdate();try{for(var r=0;r
"):u;var p=this.textDirection;p==mxConstants.TEXT_DIRECTION_AUTO&&!a&&(p=this.getAutoDirection()),p!=mxConstants.TEXT_DIRECTION_LTR&&p!=mxConstants.TEXT_DIRECTION_RTL&&(p=null),t.text(n,r,s,l,u,this.align,this.valign,this.wrap,o,this.overflow,this.clipped,this.getTextRotation(),p)}},mxText.prototype.redraw=function(){if(this.visible&&this.checkBounds()&&this.cacheEnabled&&this.lastValue==this.value&&(mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML))if(this.node.nodeName=="DIV"&&(this.isHtmlAllowed()||!mxClient.IS_VML))mxClient.IS_SVG?this.redrawHtmlShapeWithCss3():(this.updateSize(this.node,this.state==null||this.state.view.textDiv==null),mxClient.IS_IE&&(document.documentMode==null||document.documentMode<=8)?this.updateHtmlFilter():this.updateHtmlTransform()),this.updateBoundingBox();else{var t=this.createCanvas();t!=null&&t.updateText!=null?(t.pointerEvents=this.pointerEvents,this.paint(t,!0),this.destroyCanvas(t),this.updateBoundingBox()):mxShape.prototype.redraw.apply(this,arguments)}else mxShape.prototype.redraw.apply(this,arguments),mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML?this.lastValue=this.value:this.lastValue=null},mxText.prototype.resetStyles=function(){mxShape.prototype.resetStyles.apply(this,arguments),this.color="black",this.align=mxConstants.ALIGN_CENTER,this.valign=mxConstants.ALIGN_MIDDLE,this.family=mxConstants.DEFAULT_FONTFAMILY,this.size=mxConstants.DEFAULT_FONTSIZE,this.fontStyle=mxConstants.DEFAULT_FONTSTYLE,this.spacing=2,this.spacingTop=2,this.spacingRight=2,this.spacingBottom=2,this.spacingLeft=2,this.horizontal=!0,delete this.background,delete this.border,this.textDirection=mxConstants.DEFAULT_TEXT_DIRECTION,delete this.margin},mxText.prototype.apply=function(t){var e=this.spacing;mxShape.prototype.apply.apply(this,arguments),this.style!=null&&(this.fontStyle=mxUtils.getValue(this.style,mxConstants.STYLE_FONTSTYLE,this.fontStyle),this.family=mxUtils.getValue(this.style,mxConstants.STYLE_FONTFAMILY,this.family),this.size=mxUtils.getValue(this.style,mxConstants.STYLE_FONTSIZE,this.size),this.color=mxUtils.getValue(this.style,mxConstants.STYLE_FONTCOLOR,this.color),this.align=mxUtils.getValue(this.style,mxConstants.STYLE_ALIGN,this.align),this.valign=mxUtils.getValue(this.style,mxConstants.STYLE_VERTICAL_ALIGN,this.valign),this.spacing=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING,this.spacing)),this.spacingTop=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_TOP,this.spacingTop-e))+this.spacing,this.spacingRight=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_RIGHT,this.spacingRight-e))+this.spacing,this.spacingBottom=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_BOTTOM,this.spacingBottom-e))+this.spacing,this.spacingLeft=parseInt(mxUtils.getValue(this.style,mxConstants.STYLE_SPACING_LEFT,this.spacingLeft-e))+this.spacing,this.horizontal=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,this.horizontal),this.background=mxUtils.getValue(this.style,mxConstants.STYLE_LABEL_BACKGROUNDCOLOR,this.background),this.border=mxUtils.getValue(this.style,mxConstants.STYLE_LABEL_BORDERCOLOR,this.border),this.textDirection=mxUtils.getValue(this.style,mxConstants.STYLE_TEXT_DIRECTION,mxConstants.DEFAULT_TEXT_DIRECTION),this.opacity=mxUtils.getValue(this.style,mxConstants.STYLE_TEXT_OPACITY,100),this.updateMargin()),this.flipV=null,this.flipH=null},mxText.prototype.getAutoDirection=function(){var t=/[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(this.value);return t!=null&&t.length>0&&t[0]>"z"?mxConstants.TEXT_DIRECTION_RTL:mxConstants.TEXT_DIRECTION_LTR},mxText.prototype.getContentNode=function(){var t=this.node;return t!=null&&(t.ownerSVGElement==null?t=this.node.firstChild.firstChild:t=t.firstChild.firstChild.firstChild.firstChild.firstChild),t},mxText.prototype.updateBoundingBox=function(){var t=this.node;this.boundingBox=this.bounds.clone();var e=this.getTextRotation(),i=this.style!=null?mxUtils.getValue(this.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER):null,n=this.style!=null?mxUtils.getValue(this.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE):null;if(!this.ignoreStringSize&&t!=null&&this.overflow!="fill"&&(!this.clipped||!this.ignoreClippedStringSize||i!=mxConstants.ALIGN_CENTER||n!=mxConstants.ALIGN_MIDDLE)){var r=null,s=null;if(t.ownerSVGElement!=null)if(t.firstChild!=null&&t.firstChild.firstChild!=null&&t.firstChild.firstChild.nodeName=="foreignObject")t=t.firstChild.firstChild.firstChild.firstChild,s=t.offsetHeight*this.scale,this.overflow=="width"?r=this.boundingBox.width:r=t.offsetWidth*this.scale;else try{var l=t.getBBox();typeof this.value=="string"&&mxUtils.trim(this.value)==0?this.boundingBox=null:l.width==0&&l.height==0?this.boundingBox=null:this.boundingBox=new mxRectangle(l.x,l.y,l.width,l.height);return}catch{}else{var a=this.state!=null?this.state.view.textDiv:null;if(this.offsetWidth!=null&&this.offsetHeight!=null)r=this.offsetWidth*this.scale,s=this.offsetHeight*this.scale;else{a!=null&&(this.updateFont(a),this.updateSize(a,!1),this.updateInnerHtml(a),t=a);var o=t;if(document.documentMode==8&&!mxClient.IS_EM){var u=Math.round(this.bounds.width/this.scale);if(this.wrap&&u>0){if(t.style.wordWrap=mxConstants.WORD_WRAP,t.style.whiteSpace="normal",t.style.wordWrap!="break-word"){var p=o.getElementsByTagName("div");p.length>0&&(o=p[p.length-1]),r=o.offsetWidth+2,p=this.node.getElementsByTagName("div"),this.clipped&&(r=Math.min(u,r)),p.length>1&&(p[p.length-2].style.width=r+"px")}}else t.style.whiteSpace="nowrap"}else o.firstChild!=null&&o.firstChild.nodeName=="DIV"&&(o=o.firstChild);this.offsetWidth=o.offsetWidth+this.textWidthPadding,this.offsetHeight=o.offsetHeight,r=this.offsetWidth*this.scale,s=this.offsetHeight*this.scale}}r!=null&&s!=null&&(this.boundingBox=new mxRectangle(this.bounds.x,this.bounds.y,r,s))}if(this.boundingBox!=null)if(e!=0){var m=mxUtils.getBoundingBox(new mxRectangle(this.margin.x*this.boundingBox.width,this.margin.y*this.boundingBox.height,this.boundingBox.width,this.boundingBox.height),e,new mxPoint(0,0));this.unrotatedBoundingBox=mxRectangle.fromRectangle(this.boundingBox),this.unrotatedBoundingBox.x+=this.margin.x*this.unrotatedBoundingBox.width,this.unrotatedBoundingBox.y+=this.margin.y*this.unrotatedBoundingBox.height,this.boundingBox.x+=m.x,this.boundingBox.y+=m.y,this.boundingBox.width=m.width,this.boundingBox.height=m.height}else this.boundingBox.x+=this.margin.x*this.boundingBox.width,this.boundingBox.y+=this.margin.y*this.boundingBox.height,this.unrotatedBoundingBox=null},mxText.prototype.getShapeRotation=function(){return 0},mxText.prototype.getTextRotation=function(){return this.state!=null&&this.state.shape!=null?this.state.shape.getTextRotation():0},mxText.prototype.isPaintBoundsInverted=function(){return!this.horizontal&&this.state!=null&&this.state.view.graph.model.isVertex(this.state.cell)},mxText.prototype.configureCanvas=function(t,e,i,n,r){mxShape.prototype.configureCanvas.apply(this,arguments),t.setFontColor(this.color),t.setFontBackgroundColor(this.background),t.setFontBorderColor(this.border),t.setFontFamily(this.family),t.setFontSize(this.size),t.setFontStyle(this.fontStyle)},mxText.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width="1px",this.node.style.height="1px",this.node.style.overflow="visible"},mxText.prototype.getHtmlValue=function(){var t=this.value;return this.dialect!=mxConstants.DIALECT_STRICTHTML&&(t=mxUtils.htmlEntities(t,!1)),t=mxUtils.replaceTrailingNewlines(t,"
"):t,t},mxText.prototype.getTextCss=function(){var t=mxConstants.ABSOLUTE_LINE_HEIGHT?this.size*mxConstants.LINE_HEIGHT+"px":mxConstants.LINE_HEIGHT,e="display: inline-block; font-size: "+this.size+"px; font-family: "+this.family+"; color: "+this.color+"; line-height: "+t+"; pointer-events: "+(this.pointerEvents?"all":"none")+"; ";(this.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(e+="font-weight: bold; "),(this.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(e+="font-style: italic; ");var i=[];return(this.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&i.push("underline"),(this.fontStyle&mxConstants.FONT_STRIKETHROUGH)==mxConstants.FONT_STRIKETHROUGH&&i.push("line-through"),i.length>0&&(e+="text-decoration: "+i.join(" ")+"; "),e},mxText.prototype.redrawHtmlShape=function(){if(mxClient.IS_SVG)this.redrawHtmlShapeWithCss3();else{var t=this.node.style;t.whiteSpace="normal",t.overflow="",t.width="",t.height="",this.updateValue(),this.updateFont(this.node),this.updateSize(this.node,this.state==null||this.state.view.textDiv==null),this.offsetWidth=null,this.offsetHeight=null,mxClient.IS_IE&&(document.documentMode==null||document.documentMode<=8)?this.updateHtmlFilter():this.updateHtmlTransform()}},mxText.prototype.redrawHtmlShapeWithCss3=function(){var t=Math.max(0,Math.round(this.bounds.width/this.scale)),e=Math.max(0,Math.round(this.bounds.height/this.scale)),i="position: absolute; left: "+Math.round(this.bounds.x)+"px; top: "+Math.round(this.bounds.y)+"px; pointer-events: none; ",n=this.getTextCss();mxSvgCanvas2D.createCss(t+2,e,this.align,this.valign,this.wrap,this.overflow,this.clipped,this.background!=null?mxUtils.htmlEntities(this.background):null,this.border!=null?mxUtils.htmlEntities(this.border):null,i,n,this.scale,mxUtils.bind(this,function(r,s,l,a,o,u){var p=this.getTextRotation(),m=(this.scale!=1?"scale("+this.scale+") ":"")+(p!=0?"rotate("+p+"deg) ":"")+(this.margin.x!=0||this.margin.y!=0?"translate("+this.margin.x*100+"%,"+this.margin.y*100+"%)":"");m!=""&&(m="transform-origin: 0 0; transform: "+m+"; "),u==""?(l+=a,a="display:inline-block; min-width: 100%; "+m):(a+=m,mxClient.IS_SF&&(a+="-webkit-clip-path: content-box;")),this.opacity<100&&(o+="opacity: "+this.opacity/100+"; "),this.node.setAttribute("style",l);var d=mxUtils.isNode(this.value)?this.value.outerHTML:this.getHtmlValue();this.node.firstChild==null&&(this.node.innerHTML="
"):e,e='
"):t;var e=this.background!=null&&this.background!=mxConstants.NONE?this.background:null,i=this.border!=null&&this.border!=mxConstants.NONE?this.border:null;if(this.overflow=="fill"||this.overflow=="width")e!=null&&(this.node.style.backgroundColor=e),i!=null&&(this.node.style.border="1px solid "+i);else{var n="";e!=null&&(n+="background-color:"+mxUtils.htmlEntities(e)+";"),i!=null&&(n+="border:1px solid "+mxUtils.htmlEntities(i)+";");var r=mxConstants.ABSOLUTE_LINE_HEIGHT?this.size*mxConstants.LINE_HEIGHT+"px":mxConstants.LINE_HEIGHT;t='