@visuallyjs/browser-ui 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/visuallyjs.browser-ui.cjs.js +51 -51
- package/js/visuallyjs.browser-ui.esm.js +51 -51
- package/package.json +1 -1
- package/types/browser-ui/pan-zoom-options.d.ts +1 -2
- package/types/browser-ui/pan-zoom.d.ts +2 -1
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso-plugin.d.ts +8 -0
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso.d.ts +18 -0
- package/types/core/io.d.ts +6 -0
- package/types/core/layout/bowtie/bowtie-layout.d.ts +69 -0
- package/types/core/layout/bowtie/index.d.ts +1 -0
- package/types/core/layout/hierarchy/definitions.d.ts +2 -2
- package/types/core/layout/hierarchy/parent-relative-placement.d.ts +2 -2
- package/types/core/layout/index.d.ts +1 -0
- package/types/core/model/graph.d.ts +2 -0
- package/types/test-support/test-support.d.ts +2 -0
- package/types/version.d.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var Ac=Object.defineProperty,iN=Object.defineProperties,oO=Object.getOwnPropertyDescriptor,oN=Object.getOwnPropertyDescriptors,sN=Object.getOwnPropertyNames,iO=Object.getOwnPropertySymbols;var sO=Object.prototype.hasOwnProperty,aN=Object.prototype.propertyIsEnumerable;var bx=(i,r,e)=>r in i?Ac(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,xn=(i,r)=>{for(var e in r||(r={}))sO.call(r,e)&&bx(i,e,r[e]);if(iO)for(var e of iO(r))aN.call(r,e)&&bx(i,e,r[e]);return i},Hg=(i,r)=>iN(i,oN(r));var lN=(i,r)=>{for(var e in r)Ac(i,e,{get:r[e],enumerable:!0})},hN=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of sN(r))!sO.call(i,n)&&n!==e&&Ac(i,n,{get:()=>r[n],enumerable:!(t=oO(r,n))||t.enumerable});return i};var cN=i=>hN(Ac({},"__esModule",{value:!0}),i),He=(i,r,e,t)=>{for(var n=t>1?void 0:t?oO(r,e):r,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&Ac(r,e,n),n};var c=(i,r,e)=>(bx(i,typeof r!="symbol"?r+"":r,e),e);var GB={};lN(GB,{$__proxyEdge:()=>ET,$__unproxyEdge:()=>mT,$_createCircularSvgHandles:()=>KC,$_createRectangularSvgHandles:()=>JC,$_createSvg:()=>Ge,$_setSkeletonPosition:()=>_y,$addOverlay:()=>Hl,$appendAtIndex:()=>sa,$arcBridge:()=>oP,$attr:()=>ie,$autoCalculateChartScale:()=>oc,$calculateChartScaleWithStep:()=>sc,$calculateChartScaleWithSteps:()=>R_,$createConnection:()=>gT,$createGradient:()=>TT,$createMarker:()=>Ec,$defaultOrthogonalPathCompute:()=>yS,$defaultStraightPathCompute:()=>MR,$doImageExport:()=>ay,$dotBridge:()=>sP,$gapBridge:()=>aP,$getConnectorPathData:()=>lS,$getMarker:()=>Ug,$getOverlay:()=>kE,$getOverlays:()=>eL,$isCompoundAction:()=>UO,$isGroupSizeChangedAction:()=>Vb,$isMoveAction:()=>Mb,$isUpdateAction:()=>Ib,$makeAndAppendCircularHandle:()=>Hv,$makeAndAppendRectangularHandle:()=>kv,$makeCircularHandle:()=>Jf,$makeFieldKey:()=>as,$makeRectangularHandle:()=>m0,$prepareFontSpec:()=>Ai,$rewriteOrthogonalConnector:()=>vS,$spaceLabels:()=>w_,$svgNode:()=>M,$updateLabelOverlayFont:()=>FE,ABSOLUTE:()=>qe,ACTION_ADD:()=>ZS,ACTION_REMOVE:()=>JS,ADD_CLASS_ACTION:()=>oV,ALL_GROUPS_RELAYOUT:()=>hI,ANCHOR_PLACEHOLDER_SELECTOR:()=>Zf,ANIMATION_PHASE_CANCELLED:()=>wa,ANIMATION_PHASE_FINISHED:()=>Da,ANIMATION_PHASE_INITIALIZED:()=>cP,ANIMATION_PHASE_TRAVERSING_EDGE:()=>dP,ANIMATION_PHASE_TRAVERSING_END:()=>Ny,ANIMATION_PHASE_TRAVERSING_START:()=>Dy,ANIM_SURFACE_ELEMENT_FLASH:()=>tv,APPEND_TO_CURRENT:()=>ut,AStarGrid:()=>Ns,ATTRIBUTE_CHART_CATEGORY:()=>kn,ATTRIBUTE_CHART_FILTERED_SERIES:()=>CB,ATTRIBUTE_CHART_SERIES:()=>Et,ATTRIBUTE_CHART_STACK:()=>Ng,ATTRIBUTE_CHART_STACK_TOTAL:()=>Ig,ATTRIBUTE_CHART_VALUE:()=>Mg,ATTRIBUTE_CLASS:()=>_A,ATTRIBUTE_COLOR_PICKER_MAX_COLORS:()=>uw,ATTRIBUTE_CONTAINER:()=>mf,ATTRIBUTE_CONTEXT:()=>vA,ATTRIBUTE_CONTROLS_ORIENTATION:()=>F0,ATTRIBUTE_DATA_SHAPE_ID:()=>ag,ATTRIBUTE_DEFAULT:()=>CA,ATTRIBUTE_ELEMENTS_DRAGGABLE:()=>LS,ATTRIBUTE_FILL:()=>pT,ATTRIBUTE_GROUP:()=>wM,ATTRIBUTE_GROUP_COLLAPSED_CONTENT:()=>Hu,ATTRIBUTE_GROUP_CONTENT:()=>Ef,ATTRIBUTE_GROUP_EXPANDED_CONTENT:()=>ju,ATTRIBUTE_ICON_ID:()=>ZL,ATTRIBUTE_ICON_KEY:()=>Lv,ATTRIBUTE_ICON_SIZE:()=>Rv,ATTRIBUTE_IS_GROUP:()=>Jl,ATTRIBUTE_LOOKUP:()=>km,ATTRIBUTE_MANAGED:()=>gt,ATTRIBUTE_NOT_DRAGGABLE:()=>$l,ATTRIBUTE_ORIENTATION:()=>WL,ATTRIBUTE_ORIGIN:()=>cp,ATTRIBUTE_ORIGIN_X:()=>_v,ATTRIBUTE_ORIGIN_Y:()=>Ov,ATTRIBUTE_POPUP_POSITION:()=>CP,ATTRIBUTE_RESET_SELECTION:()=>mC,ATTRIBUTE_STROKE:()=>SV,ATTRIBUTE_STROKE_DASHARRAY:()=>qE,ATTRIBUTE_STROKE_DASHOFFSET:()=>bV,ATTRIBUTE_STROKE_LINECAP:()=>yV,ATTRIBUTE_STROKE_LINEJOIN:()=>fV,ATTRIBUTE_STROKE_MITERLIMIT:()=>xV,ATTRIBUTE_STROKE_OPACITY:()=>AV,ATTRIBUTE_STROKE_WIDTH:()=>TV,ATTRIBUTE_STYLE:()=>OA,ATTRIBUTE_SUPPRESS_VERTEX_EVENTS:()=>RS,ATTRIBUTE_TABINDEX:()=>wE,ATTRIBUTE_TEXT_ANCHOR:()=>vV,ATTRIBUTE_TRANSFORM:()=>ui,ATTRIBUTE_VALUE_NON_SCALING_STROKE:()=>wu,ATTRIBUTE_VECTOR_EFFECT:()=>Lu,ATTRIBUTE_VERSION:()=>mV,ATTRIBUTE_VJS_ALLOW_LOOPBACK:()=>DE,ATTRIBUTE_VJS_EDGE:()=>Qe,ATTRIBUTE_VJS_EDGE_TYPE:()=>du,ATTRIBUTE_VJS_ENABLED:()=>mr,ATTRIBUTE_VJS_MAGNET:()=>pu,ATTRIBUTE_VJS_MINIVIEW_TYPE:()=>nC,ATTRIBUTE_VJS_NODE_ID:()=>iy,ATTRIBUTE_VJS_OVERLAY_ID:()=>gu,ATTRIBUTE_VJS_PORT:()=>an,ATTRIBUTE_VJS_PORT_ID:()=>Bl,ATTRIBUTE_VJS_PORT_TYPE:()=>Hr,ATTRIBUTE_VJS_SCOPE:()=>Jo,ATTRIBUTE_VJS_SOURCE:()=>wS,ATTRIBUTE_VJS_SOURCE_PORT:()=>ea,ATTRIBUTE_VJS_SOURCE_PORT_ID:()=>NE,ATTRIBUTE_VJS_SOURCE_PORT_TYPE:()=>ji,ATTRIBUTE_VJS_TARGET:()=>Yo,ATTRIBUTE_VJS_TARGET_PORT:()=>zo,ATTRIBUTE_VJS_TARGET_PORT_ID:()=>uu,ATTRIBUTE_VJS_TARGET_PORT_TYPE:()=>Hi,ATTRIBUTE_VJS_VERTEX:()=>te,ATTRIBUTE_XMLNS:()=>EV,ATT_DATA_DIR:()=>La,ATT_VJS_RESIZABLE:()=>Cy,ATT_VJS_ROTATABLE:()=>Py,ATT_VJS_X_RESIZE:()=>Ty,ATT_VJS_Y_RESIZE:()=>vy,AXIS_POSITION_END:()=>Si,AXIS_POSITION_START:()=>ir,AbsoluteBackedLayout:()=>qn,AbsoluteLayout:()=>xo,AbstractEntry:()=>Fi,AbstractHierarchicalLayout:()=>Os,AbstractLayout:()=>Sn,AbstractLayoutAdapter:()=>Dc,AddGroupMemberAction:()=>gd,AnchorLocations:()=>wl,ArcSegmentHandler:()=>ou,AreaChart:()=>X_,AreaPlot:()=>fc,ArrayBasedSeries:()=>Fa,ArrowOverlay:()=>_r,AssignLayersStage:()=>Yc,AutoSaver:()=>yl,AvailableBackgrounds:()=>io,BASIC_SHAPES:()=>Nv,BLOCK:()=>Cr,BOTTOM:()=>ht,BackgroundPlugin:()=>os,BalloonLayout:()=>Fc,BarChart:()=>H_,BarPlot:()=>Lr,Base:()=>Oc,BaseBrowserUIPlugin:()=>Se,BaseChart:()=>co,BaseDomUiLayoutAdapter:()=>da,BaseSeriesBasedChartDataSource:()=>uc,BezierEditor:()=>xi,BezierSegmentHandler:()=>AR,BlankDataSource:()=>Ba,BlankScale:()=>mc,BrowserUI:()=>pa,BrowserUIClipboard:()=>mp,BrowserUIModel:()=>zy,BrowserUiRecado:()=>es,BubbleChart:()=>k_,BubbleChartSeries:()=>mx,CENTER:()=>It,CHART_AXIS_TITLE_ALIGN_END:()=>G_,CHART_AXIS_TITLE_ALIGN_MIDDLE:()=>$a,CHART_AXIS_TITLE_ALIGN_START:()=>V_,CHART_TITLE_ALIGN_LEFT:()=>SB,CHART_TITLE_ALIGN_MIDDLE:()=>AB,CHART_TITLE_ALIGN_RIGHT:()=>TB,CHART_TITLE_PLACEMENT_BOTTOM:()=>dc,CHART_TITLE_PLACEMENT_TOP:()=>OD,CLASS_ANCHOR_CANDIDATE:()=>eG,CLASS_ANCHOR_PLACEHOLDER:()=>xa,CLASS_AREA_CHART:()=>O_,CLASS_AREA_CHART_AREA:()=>Pg,CLASS_BACKGROUND:()=>S0,CLASS_BACKGROUND_BORDER:()=>T0,CLASS_BACKGROUND_GRID:()=>is,CLASS_BACKGROUND_GRID_DOT_MAJOR:()=>wp,CLASS_BACKGROUND_GRID_DOT_MINOR:()=>P0,CLASS_BACKGROUND_GRID_MAJOR:()=>C0,CLASS_BACKGROUND_GRID_MINOR:()=>v0,CLASS_BACKGROUND_TILE:()=>y0,CLASS_BAR_CHART:()=>E_,CLASS_BAR_CHART_BAR:()=>f_,CLASS_BEZIER_GUIDELINE:()=>UP,CLASS_BEZIER_HANDLE:()=>Zh,CLASS_BEZIER_HANDLE_CONTROL_POINT:()=>Yy,CLASS_BEZIER_HANDLE_CONTROL_POINT_1:()=>BP,CLASS_BEZIER_HANDLE_CONTROL_POINT_2:()=>FP,CLASS_BUBBLE_CHART:()=>y_,CLASS_BUBBLE_CHART_DATA_POINT:()=>x_,CLASS_CHART_AXIS:()=>Ga,CLASS_CHART_AXIS_LABELS:()=>Ky,CLASS_CHART_AXIS_LINE:()=>qy,CLASS_CHART_AXIS_TITLE:()=>Qy,CLASS_CHART_BACKGROUND:()=>a_,CLASS_CHART_BODY:()=>rc,CLASS_CHART_CROSSHAIR:()=>nc,CLASS_CHART_CROSSHAIR_LABEL:()=>ic,CLASS_CHART_EMPTY:()=>ex,CLASS_CHART_GRIDLINE:()=>rx,CLASS_CHART_GRIDLINES:()=>tx,CLASS_CHART_LEGEND:()=>h_,CLASS_CHART_LEGEND_DOT:()=>d_,CLASS_CHART_LEGEND_ITEM:()=>Sg,CLASS_CHART_LEGEND_LABEL:()=>c_,CLASS_CHART_PLOT_BACKGROUND:()=>Va,CLASS_CHART_POINT:()=>fn,CLASS_CHART_POINT_HIT_AREA:()=>Cg,CLASS_CHART_SCALE_LABEL:()=>P_,CLASS_CHART_SERIES:()=>l_,CLASS_CHART_SUBTITLE:()=>T_,CLASS_CHART_TITLE:()=>S_,CLASS_CHART_X_AXIS:()=>Tg,CLASS_CHART_X_AXIS_TITLE:()=>p_,CLASS_CHART_Y_AXIS:()=>vg,CLASS_CHART_Y_AXIS_TITLE:()=>u_,CLASS_COLOR_PICKER:()=>cw,CLASS_COLOR_PICKER_SWATCH:()=>vC,CLASS_COLOR_PICKER_SWATCHES:()=>TC,CLASS_COLUMN_CHART:()=>g_,CLASS_COLUMN_CHART_COLUMN:()=>m_,CLASS_CONNECTED:()=>Fl,CLASS_CONNECTION_EDIT:()=>Wf,CLASS_CONNECTOR:()=>ta,CLASS_CONNECTOR_OUTLINE:()=>DS,CLASS_CONNECTOR_PATH:()=>mu,CLASS_CONNECTOR_SOURCE_DRAG:()=>Qi,CLASS_CONNECTOR_TARGET_DRAG:()=>eo,CLASS_CONNECTOR_TRANSIENT:()=>NS,CLASS_CONNECTOR_TRANSIENT_DRAG:()=>gv,CLASS_CONTROLS:()=>Ip,CLASS_CONTROLS_CLEAR:()=>cC,CLASS_CONTROLS_PAN_MODE:()=>iC,CLASS_CONTROLS_REDO:()=>hC,CLASS_CONTROLS_RESET_SELECTION:()=>uC,CLASS_CONTROLS_SELECT_MODE:()=>oy,CLASS_CONTROLS_UNDO:()=>lC,CLASS_CONTROLS_ZOOM_IN:()=>sC,CLASS_CONTROLS_ZOOM_OUT:()=>aC,CLASS_CONTROLS_ZOOM_TO_FIT:()=>oC,CLASS_COPY_PASTE_CONTROLS:()=>hG,CLASS_CROSSHAIR_CATEGORY_AXIS:()=>C_,CLASS_CROSSHAIR_VALUE_AXIS:()=>v_,CLASS_DEFAULT_GROUP:()=>If,CLASS_DEFAULT_NODE:()=>Nf,CLASS_DIAGRAM_CELL_TOOL:()=>By,CLASS_DIAGRAM_CLONE_CELL:()=>AP,CLASS_DIAGRAM_DELETE_CELL:()=>SP,CLASS_DIAGRAM_GROUP:()=>$y,CLASS_DIAGRAM_LINK_CELL:()=>Pw,CLASS_DIAGRAM_NODE:()=>Gy,CLASS_DRAG_ACTIVE:()=>Er,CLASS_DRAG_HOVER:()=>fr,CLASS_DRAG_HOVER_CANNOT_DROP:()=>ph,CLASS_DRAG_ORIGINAL_GROUP:()=>Mf,CLASS_DUMMY_VERTEX:()=>VS,CLASS_EDGE_CLICK_ENTRY:()=>$f,CLASS_EDGE_DELETE_BUTTON:()=>na,CLASS_EDGE_DELETE_BUTTON_INTERNAL:()=>fu,CLASS_EDGE_GUIDELINE:()=>_p,CLASS_EDGE_RELOCATING:()=>wf,CLASS_EDGE_TYPE_PICKER:()=>gw,CLASS_EDGE_TYPE_PICKER_SELECTED:()=>kp,CLASS_EDGE_WILL_RELOCATE:()=>Qu,CLASS_ELASTIC_GROUP_RESIZE:()=>O0,CLASS_ELEMENT_DRAGGING:()=>lh,CLASS_EXPORT_CANCEL:()=>$p,CLASS_EXPORT_CONTROLS:()=>dC,CLASS_EXPORT_DIMENSIONS:()=>fC,CLASS_EXPORT_DOWNLOAD_TOOLS:()=>yC,CLASS_EXPORT_OVERLAY:()=>Gp,CLASS_EXPORT_UNDERLAY:()=>Vp,CLASS_GAUGE_CHART:()=>WD,CLASS_GAUGE_CHART_LABEL:()=>KD,CLASS_GAUGE_CHART_NEEDLE:()=>qD,CLASS_GAUGE_CHART_NEEDLE_PIVOT:()=>QD,CLASS_GAUGE_CHART_TICK:()=>JD,CLASS_GAUGE_CHART_TRACK:()=>ZD,CLASS_GAUGE_CHART_ZONE:()=>W_,CLASS_GROUP:()=>Xo,CLASS_GROUP_CHILD_ELEMENT_DRAGGING:()=>Lf,CLASS_GROUP_COLLAPSED:()=>IE,CLASS_GROUP_EXPANDED:()=>ME,CLASS_HOVER:()=>gh,CLASS_INSPECTOR:()=>hw,CLASS_INSPECTOR_ACTIVE:()=>AC,CLASS_INSPECTOR_CLOSE:()=>SC,CLASS_INSPECTOR_INACTIVE:()=>Xp,CLASS_LABEL_OVERLAY:()=>IS,CLASS_LASSO:()=>rv,CLASS_LASSO_MASK:()=>ch,CLASS_LASSO_MASK_BOTTOM:()=>sv,CLASS_LASSO_MASK_LEFT:()=>nv,CLASS_LASSO_MASK_RIGHT:()=>ov,CLASS_LASSO_MASK_TOP:()=>iv,CLASS_LINE_CHART:()=>__,CLASS_LINE_CROSSING_BRIDGE:()=>eP,CLASS_LINE_CROSSING_BRIDGE_ARCH:()=>iP,CLASS_LINE_CROSSING_BRIDGE_DOT:()=>nP,CLASS_LINE_CROSSING_BRIDGE_GAP:()=>IG,CLASS_LINE_CROSSING_BRIDGE_HORIZONTAL:()=>rP,CLASS_LINE_CROSSING_BRIDGE_VERTICAL:()=>tP,CLASS_MINIVIEW:()=>ep,CLASS_MINIVIEW_CANVAS:()=>av,CLASS_MINIVIEW_CLICK_TO_CENTER:()=>pv,CLASS_MINIVIEW_COLLAPSE:()=>uv,CLASS_MINIVIEW_COLLAPSED:()=>tp,CLASS_MINIVIEW_ELEMENT:()=>cv,CLASS_MINIVIEW_GROUP_ELEMENT:()=>dv,CLASS_MINIVIEW_LASSO:()=>hv,CLASS_MINIVIEW_PANNER:()=>lv,CLASS_MINIVIEW_PANNING:()=>Df,CLASS_MINIVIEW_SELECTED_ELEMENT:()=>dh,CLASS_MOST_RECENTLY_DRAGGED:()=>hh,CLASS_NODE:()=>ki,CLASS_ORTHOGONAL_HANDLE:()=>DP,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE:()=>ug,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL:()=>IP,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL:()=>NP,CLASS_OVERLAY:()=>ra,CLASS_OVERLAY_HIDE:()=>Ul,CLASS_PALETTE:()=>Iy,CLASS_PALETTE_CURRENT_SHAPE_TYPE:()=>rp,CLASS_PALETTE_DRAG_ACTIVE:()=>mv,CLASS_PALETTE_DRAG_HOVER:()=>Ev,CLASS_PALETTE_DRAG_HOVER_CANNOT_DROP:()=>fv,CLASS_PALETTE_ELEMENT_CURRENT:()=>yv,CLASS_PALETTE_SELECTED_ELEMENT:()=>pn,CLASS_PALETTE_SET:()=>sg,CLASS_PALETTE_SET_FILTER:()=>jh,CLASS_PALETTE_SET_SHAPES:()=>Vy,CLASS_PALETTE_SET_TITLE:()=>uP,CLASS_PALETTE_SHAPE:()=>Hh,CLASS_PALETTE_SHAPE_LABEL:()=>My,CLASS_PALETTE_TAP_MODE_ACTIVE:()=>uh,CLASS_PALETTE_VERTEX_DRAWING_LASSO:()=>pP,CLASS_PAN_ZOOM_CANVAS:()=>c0,CLASS_PAN_ZOOM_VIEWPORT:()=>h0,CLASS_PAPER:()=>$T,CLASS_PAPER_CANVAS:()=>FT,CLASS_PAPER_NODE:()=>h1,CLASS_PAPER_NO_SCALE:()=>BT,CLASS_PIE_CHART:()=>eN,CLASS_PIE_SLICE:()=>Yg,CLASS_PIE_SLICE_SELECTED:()=>K_,CLASS_PORT:()=>MS,CLASS_RESIZE_BORDER:()=>ds,CLASS_RESIZE_BORDER_BOTTOM:()=>HC,CLASS_RESIZE_BORDER_LEFT:()=>WC,CLASS_RESIZE_BORDER_RIGHT:()=>ZC,CLASS_RESIZE_BORDER_TOP:()=>kC,CLASS_RESIZE_FRAME:()=>jC,CLASS_RESIZE_HANDLE:()=>Tt,CLASS_RESIZE_HANDLE_ACTIVE:()=>gy,CLASS_RESIZE_HANDLE_B:()=>by,CLASS_RESIZE_HANDLE_BL:()=>Ey,CLASS_RESIZE_HANDLE_BR:()=>yy,CLASS_RESIZE_HANDLE_L:()=>Ay,CLASS_RESIZE_HANDLE_R:()=>Sy,CLASS_RESIZE_HANDLE_T:()=>xy,CLASS_RESIZE_HANDLE_TL:()=>my,CLASS_RESIZE_HANDLE_TR:()=>fy,CLASS_RESIZE_SKELETON:()=>YC,CLASS_RESIZE_SKELETON_BORDERS:()=>zC,CLASS_RESIZE_SKELETON_BORDERS_VISIBLE:()=>XC,CLASS_ROTATE_HANDLE:()=>Yh,CLASS_ROTATE_LEADER:()=>Qp,CLASS_SANKEY_CHART:()=>nN,CLASS_SANKEY_EDGE:()=>fx,CLASS_SANKEY_LABEL:()=>xx,CLASS_SANKEY_NODE:()=>yx,CLASS_SANKEY_SELECTED:()=>po,CLASS_SANKEY_UNSELECTED:()=>Qr,CLASS_SCATTER_CHART:()=>b_,CLASS_SCATTER_CHART_DATA_POINT:()=>A_,CLASS_SELECTED_MODE:()=>lG,CLASS_SELECT_DEFEAT:()=>mt,CLASS_SHAPE:()=>yh,CLASS_SHAPE_ICON:()=>dp,CLASS_SHAPE_LABEL:()=>ip,CLASS_SNAPLINE:()=>Kp,CLASS_SNAPLINE_ACTIVE:()=>DC,CLASS_SNAPLINE_ACTIVE_EXACT:()=>NC,CLASS_SNAPLINE_EXACT:()=>dy,CLASS_SNAPLINE_HORIZONTAL:()=>wC,CLASS_SNAPLINE_VERTICAL:()=>LC,CLASS_SOURCE_HOVER:()=>Vf,CLASS_STRAIGHT_CONNECTOR_EDIT:()=>Fy,CLASS_STRAIGHT_DELETE_HANDLE:()=>gg,CLASS_STRAIGHT_DRAG_HANDLE:()=>ms,CLASS_STRAIGHT_EDITOR_GUIDELINE:()=>VP,CLASS_STRAIGHT_HANDLE:()=>Wh,CLASS_STRAIGHT_SPLIT_HANDLE:()=>pg,CLASS_SURFACE:()=>Sf,CLASS_SURFACE_CANVAS:()=>vf,CLASS_SURFACE_DIRECT:()=>qT,CLASS_SURFACE_EDGE_DRAGGING:()=>Gn,CLASS_SURFACE_ELEMENT_DRAGGING:()=>Rf,CLASS_SURFACE_ELEMENT_FLASH:()=>_f,CLASS_SURFACE_NO_PAN:()=>Tf,CLASS_SURFACE_PAN:()=>Cf,CLASS_SURFACE_PANNING:()=>Of,CLASS_SURFACE_PAN_ACTIVE:()=>Pf,CLASS_SURFACE_PAN_BOTTOM:()=>A1,CLASS_SURFACE_PAN_LEFT:()=>y1,CLASS_SURFACE_PAN_RIGHT:()=>b1,CLASS_SURFACE_PAN_TOP:()=>x1,CLASS_SURFACE_POINTER_DEVICE:()=>ev,CLASS_SURFACE_POPUP:()=>HG,CLASS_SURFACE_TOUCH_DEVICE:()=>QT,CLASS_TARGET_HOVER:()=>Gf,CLASS_TOGGLE_GROUP_COLLAPSE:()=>Eu,CLASS_TRANSIENT_VERTEX:()=>xv,CLASS_UI_SELECTED_CONNECTION:()=>Yl,CLASS_UI_SELECTED_ELEMENT:()=>Wi,CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE:()=>py,CLASS_VERTEX_DRAWING_LASSO:()=>IC,CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE:()=>ig,CLASS_VJS_ANIMATE_EDGE_TRAVERSED:()=>wy,CLASS_VJS_ANIMATE_EDGE_TRAVERSING:()=>Xh,CLASS_VJS_ANIMATE_SOURCE:()=>Ry,CLASS_VJS_ANIMATE_TARGET:()=>Ly,CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE:()=>MG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSED:()=>VG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSING:()=>Xn,CLASS_VJS_TOOLTIP:()=>BD,CLEAR_PATH:()=>q0,CLEAR_VIEW_BOX:()=>K0,COLOR_PICKER_ELEMENT:()=>dw,COMMIT_CURRENT:()=>BO,COMPONENT_TYPE_CONNECTION:()=>ZE,CONNECTION:()=>WV,CONNECTOR_TYPE_CUBIC_BEZIER:()=>Mo,CONNECTOR_TYPE_ORTHOGONAL:()=>zi,CONNECTOR_TYPE_QUADRATIC_BEZIER:()=>tu,CONNECTOR_TYPE_SMOOTH:()=>hS,CONNECTOR_TYPE_STRAIGHT:()=>Xr,CONNECT_REASON_API:()=>ul,CONNECT_REASON_COPY_PASTE:()=>Wx,CONNECT_REASON_DATA_LOAD:()=>pl,CONNECT_REASON_TRANSIENT:()=>kx,CONNECT_REASON_UNDO_REDO:()=>Hx,CONNECT_REASON_USER_ACTIVITY:()=>yo,CONTAINMENT_NOT_NEGATIVE:()=>jw,CONTAINMENT_PARENT:()=>Hw,CONTAINMENT_PARENT_ENCLOSED:()=>kw,CONTENT_TYPES:()=>Pa,CSV:()=>EI,CandidateSorter:()=>Kc,CanvasLayoutAdapter:()=>up,CatchAllEventHandler:()=>sd,CategoryValueChart:()=>Wn,CategoryValueTooltip:()=>Ha,CategoryVsAxisPlot:()=>uo,ChartExporter:()=>Lg,ChartLegend:()=>Og,ChartSeries:()=>Sr,CircularLayout:()=>Nc,ClickSplitMode:()=>mg,Clipboard:()=>Hd,Cluster:()=>Tc,CollationSeries:()=>Ua,Collicat:()=>Eg,ColumnChart:()=>j_,ColumnLayout:()=>ml,CommentEntry:()=>ks,Components:()=>Ne,CompoundAction:()=>vo,Connections:()=>Qt,Connectors:()=>ze,ControlsComponent:()=>Mp,ControlsPlugin:()=>$h,CopyData:()=>jd,CopyPasteControlsComponent:()=>pC,CrossingStage:()=>Ls,CsvReader:()=>Hm,CustomOverlayImpl:()=>sf,CustomTag:()=>Vd,DEFAULT:()=>be,DEFAULT_ANCHOR_PLACEHOLDER_SIZE:()=>jv,DEFAULT_ARRAY_SERIES_ID_FIELD:()=>GD,DEFAULT_ARRAY_SERIES_LABEL_FIELD:()=>VD,DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD:()=>MD,DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD:()=>ID,DEFAULT_ARRAY_SERIES_RANGE_START_FIELD:()=>DD,DEFAULT_ARRAY_SERIES_STEP:()=>wD,DEFAULT_ARRAY_SERIES_VALUES_FIELD:()=>ND,DEFAULT_AXIS_LINE_SIZE:()=>Ti,DEFAULT_BACKGROUND_COLOR:()=>CD,DEFAULT_BAR_GAP:()=>kD,DEFAULT_BEZIER_CONTROL_POINT_SCALE:()=>ZA,DEFAULT_BEZIER_LOOPBACK_DISTANCE:()=>ER,DEFAULT_BORDER_HANDLE_SIZE:()=>GC,DEFAULT_CATEGORY_AXIS_FONT_SIZE:()=>B_,DEFAULT_CATEGORY_AXIS_FONT_STYLE:()=>F_,DEFAULT_CATEGORY_FILL_RATIO:()=>jD,DEFAULT_CHART_EMPTY_MESSAGE:()=>N_,DEFAULT_CHART_ERROR_MESSAGE:()=>I_,DEFAULT_COLOR:()=>Dv,DEFAULT_COLOR_PROPERTY:()=>Xf,DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE:()=>Xv,DEFAULT_CORNER_RADIUS:()=>Vg,DEFAULT_DIAGRAM_CELL_HEIGHT:()=>yP,DEFAULT_DIAGRAM_CELL_WIDTH:()=>fP,DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE:()=>Cw,DEFAULT_DOT_OVERLAY_RADIUS:()=>gL,DEFAULT_DOWNLOAD_BUTTON_LABEL:()=>Fp,DEFAULT_EDGE_NODE_SIZE:()=>Pm,DEFAULT_ELLIPSE_OVERLAY_RADIUS_X:()=>fL,DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y:()=>yL,DEFAULT_EXPORT_FILENAME:()=>Bp,DEFAULT_FILL_COLOR:()=>Th,DEFAULT_FILL_PROPERTY:()=>zf,DEFAULT_FLOWCHART_ARROW_LENGTH:()=>Zw,DEFAULT_FLOWCHART_ARROW_WIDTH:()=>Ww,DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE:()=>Kw,DEFAULT_FLOWCHART_PROPERTY_MARKERS:()=>Jw,DEFAULT_GRID:()=>b0,DEFAULT_GRID_LINE_COLOR:()=>M_,DEFAULT_HANDLE_OFFSET:()=>FC,DEFAULT_HEIGHT_ATTRIBUTE:()=>sb,DEFAULT_HIERARCHICAL_LAYOUT_ALIGN:()=>lb,DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT:()=>db,DEFAULT_HIERARCHICAL_LAYOUT_PADDING:()=>hb,DEFAULT_HIERARCHICAL_LAYOUT_SPACING:()=>cb,DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT:()=>Uc,DEFAULT_KEY_ALLOW_NESTED_GROUPS:()=>VE,DEFAULT_KEY_ANCHOR:()=>zl,DEFAULT_KEY_ANCHORS:()=>Xl,DEFAULT_KEY_ASTAR_VERTEX_BORDER:()=>GS,DEFAULT_KEY_ASTAR_VERTEX_BUFFER:()=>$S,DEFAULT_KEY_CONNECTOR:()=>yu,DEFAULT_KEY_CSS_CLASS:()=>BS,DEFAULT_KEY_EDGES_DETACHABLE:()=>DM,DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE:()=>FS,DEFAULT_KEY_GROUP_SIZE:()=>NM,DEFAULT_KEY_HOVER_CLASS:()=>US,DEFAULT_KEY_HOVER_PAINT_STYLE:()=>xu,DEFAULT_KEY_MAX_CONNECTIONS:()=>YS,DEFAULT_KEY_NODE_SIZE:()=>IM,DEFAULT_KEY_PAINT_STYLE:()=>jo,DEFAULT_KEY_REATTACH_EDGES:()=>MM,DEFAULT_KEY_SCOPE:()=>GE,DEFAULT_LABEL_COLOR:()=>PD,DEFAULT_LABEL_FILL_RATIO:()=>qL,DEFAULT_LABEL_LOCATION:()=>uL,DEFAULT_LABEL_LOCATION_ATTRIBUTE:()=>UE,DEFAULT_LABEL_PROPERTY:()=>to,DEFAULT_LEFT_ATTRIBUTE:()=>rb,DEFAULT_LEGEND_BACKGROUND_COLOR:()=>LD,DEFAULT_LEGEND_OUTLINE_WIDTH:()=>RD,DEFAULT_LEGEND_PADDING:()=>AD,DEFAULT_LINE_STROKE:()=>wh,DEFAULT_MARGIN:()=>_D,DEFAULT_MAXIMUM_BAR_WIDTH:()=>HD,DEFAULT_MINIMUM_HEIGHT:()=>BC,DEFAULT_MINIMUM_WIDTH:()=>$C,DEFAULT_ORTHOGONAL_STUB:()=>cS,DEFAULT_OUTLINE_COLOR:()=>ts,DEFAULT_OUTLINE_PROPERTY:()=>Ah,DEFAULT_OUTLINE_WIDTH:()=>vh,DEFAULT_OUTLINE_WIDTH_PROPERTY:()=>Sh,DEFAULT_PALETTE_SELECTOR:()=>xw,DEFAULT_PAPER_MARGIN:()=>UT,DEFAULT_RECTANGLE_OVERLAY_HEIGHT:()=>EL,DEFAULT_RECTANGLE_OVERLAY_WIDTH:()=>mL,DEFAULT_ROTATE_HANDLE_SIZE:()=>VC,DEFAULT_ROTATE_LEADER_LENGTH:()=>MC,DEFAULT_ROTATION_ATTRIBUTE:()=>ib,DEFAULT_SET_DESCRIPTION:()=>C1,DEFAULT_SET_NAME:()=>v1,DEFAULT_SHAPE_SETS:()=>xP,DEFAULT_SMOOTHING:()=>VR,DEFAULT_SVG_HANDLE_SIZE:()=>qp,DEFAULT_TICK_LINE_STROKE:()=>tC,DEFAULT_TICK_MARKS_PER_CELL:()=>A0,DEFAULT_TITLE_PADDING:()=>dx,DEFAULT_TOP_ATTRIBUTE:()=>nb,DEFAULT_VALUE_AXIS_FONT_SIZE:()=>Gg,DEFAULT_VALUE_AXIS_FONT_STYLE:()=>$g,DEFAULT_VALUE_AXIS_PADDING:()=>$_,DEFAULT_WIDTH_ATTRIBUTE:()=>ob,DEFAULT_ZOOM_RANGE:()=>zS,DIAGONAL_AXIS_LR:()=>Tn,DIAGONAL_AXIS_RL:()=>Qn,DRAG_GROUP_MEMBERSHIP_ADDED:()=>Ia,DRAG_GROUP_MEMBERSHIP_ASSIGNED:()=>RC,DataModel:()=>wc,DataSeriesBasedDataSource:()=>wg,DatasetIndex:()=>Hs,Decorator:()=>xp,Decorators:()=>bp,DefaultRouter:()=>kl,DefaultSearchTokenizer:()=>kO,Diagram:()=>hg,DiagramCell:()=>jn,DiagramExportComponent:()=>vP,DiagramLink:()=>yi,DiagramPalette:()=>kh,DiagramToolsPlugin:()=>gs,DialogConstants:()=>ue,DiamondOverlay:()=>Gu,DotOverlay:()=>$u,Drag:()=>Xy,DragGroupsPlugin:()=>ls,DualValueAxisTooltip:()=>Bg,DualValueChart:()=>Ka,DualValueChartSeries:()=>Ja,EDGE:()=>vr,EDGE_DRAG_HANDLE:()=>Un,EDGE_INPUT_METHOD_CLICK:()=>Rh,EDGE_INPUT_METHOD_DRAG:()=>$n,EDGE_INPUT_STATE_IDLE:()=>Lh,EDGE_INPUT_STATE_LOCKED:()=>kf,EDGE_ROUTING_PLUGIN_MODE_DIRECT:()=>rC,EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL:()=>aG,EDGE_SNAP_CENTER:()=>q1,EDGE_SNAP_DEFAULT:()=>$v,EDGE_SNAP_PERIMETER:()=>d0,EDGE_TYPE_PICKER_ELEMENT:()=>mw,EDGE_UPDATE_REASON_UPDATED:()=>EA,ELEMENT:()=>kV,ELEMENT_CIRCLE:()=>Be,ELEMENT_DEFS:()=>dT,ELEMENT_DIV:()=>Ke,ELEMENT_ELLIPSE:()=>uT,ELEMENT_G:()=>Q,ELEMENT_INCLUDE_ICON:()=>JL,ELEMENT_INCLUDE_ICONS:()=>KL,ELEMENT_PATH:()=>q,ELEMENT_RECT:()=>Z,ELEMENT_SVG:()=>Le,ELEMENT_TEXT:()=>et,ELEMENT_TSPAN:()=>KE,EMPTY_ASTAR_PATH:()=>Lm,EMPTY_BOUNDS:()=>Pi,EMPTY_ELEMENT:()=>UR,EPSILON:()=>Zn,EVENT_ADHOC_LAYOUT:()=>$b,EVENT_AFTER_LAYOUT_REFRESH:()=>Us,EVENT_BEFORE_START:()=>kP,EVENT_CANVAS_CLICK:()=>_n,EVENT_CANVAS_DBLCLICK:()=>sA,EVENT_CHANGE:()=>jp,EVENT_CHART_LOAD:()=>Rg,EVENT_CLICK:()=>Ye,EVENT_CONTEXTMENU:()=>At,EVENT_CONTEXT_UPDATE:()=>Tl,EVENT_DATA_APPEND_END:()=>Im,EVENT_DATA_APPEND_START:()=>Nm,EVENT_DATA_LOAD_END:()=>Ir,EVENT_DATA_LOAD_START:()=>So,EVENT_DATA_UPDATED:()=>Mm,EVENT_DBLCLICK:()=>Co,EVENT_DBLTAP:()=>Ur,EVENT_DESELECT:()=>qt,EVENT_DESTROY:()=>Ii,EVENT_DRAG:()=>WP,EVENT_DROP:()=>Yw,EVENT_EDGE_ADDED:()=>hr,EVENT_EDGE_CLICK:()=>eA,EVENT_EDGE_CONTEXTMENU:()=>iA,EVENT_EDGE_DBLCLICK:()=>tA,EVENT_EDGE_DBLTAP:()=>rA,EVENT_EDGE_DRAG:()=>Sb,EVENT_EDGE_DRAG_ABORT:()=>vb,EVENT_EDGE_DRAG_END:()=>Tb,EVENT_EDGE_DRAG_START:()=>Ab,EVENT_EDGE_GEOMETRY:()=>ti,EVENT_EDGE_MOUSEDOWN:()=>Cl,EVENT_EDGE_MOUSEOUT:()=>vd,EVENT_EDGE_MOUSEOVER:()=>Cd,EVENT_EDGE_MOUSEUP:()=>nA,EVENT_EDGE_PATH_EDITED:()=>ri,EVENT_EDGE_REDRAW:()=>Pd,EVENT_EDGE_REMOVED:()=>bt,EVENT_EDGE_SOURCE_CHANGED:()=>on,EVENT_EDGE_TAP:()=>oA,EVENT_EDGE_TARGET_CHANGED:()=>nn,EVENT_EDGE_TYPE_CHANGED:()=>qc,EVENT_EDGE_UPDATED:()=>xt,EVENT_ELASTIC_GROUP_FRAME_REMOVE:()=>ny,EVENT_ELASTIC_GROUP_FRAME_RESIZE:()=>ry,EVENT_END_NODE_TRAVERSAL:()=>hP,EVENT_END_OVERLAY_ANIMATION:()=>oo,EVENT_FOCUS:()=>Ub,EVENT_GRAPH_CHANGED:()=>bb,EVENT_GRAPH_CLEARED:()=>Zt,EVENT_GRAPH_CLEAR_START:()=>Cn,EVENT_GROUP_ADDED:()=>Wt,EVENT_GROUP_COLLAPSE:()=>xd,EVENT_GROUP_EXPAND:()=>bd,EVENT_GROUP_MEMBER_ADDED:()=>Ni,EVENT_GROUP_MEMBER_REMOVED:()=>Is,EVENT_GROUP_MOVE:()=>To,EVENT_GROUP_MOVE_END:()=>Vr,EVENT_GROUP_MOVE_START:()=>Cb,EVENT_GROUP_RELAYOUT:()=>vl,EVENT_GROUP_REMOVED:()=>Oe,EVENT_GROUP_RENDERED:()=>Br,EVENT_GROUP_TYPE_CHANGED:()=>td,EVENT_GROUP_UPDATED:()=>ve,EVENT_INTERNAL_CONNECTION:()=>Gb,EVENT_INTERNAL_EDGE_REDRAW:()=>Pb,EVENT_INTERNAL_ELEMENT_REPAINTED:()=>yd,EVENT_INTERNAL_GROUP_SIZE_CHANGED:()=>rd,EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO:()=>nd,EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO:()=>id,EVENT_INTERNAL_VERTEX_UPDATED:()=>Ys,EVENT_KEYUP:()=>Bn,EVENT_LASSO_END:()=>Rd,EVENT_LASSO_START:()=>_d,EVENT_LASSO_UPDATE:()=>Od,EVENT_MOUSEDOWN:()=>ge,EVENT_MOUSEENTER:()=>Ym,EVENT_MOUSEEXIT:()=>zm,EVENT_MOUSELEAVE:()=>Yb,EVENT_MOUSEMOVE:()=>ae,EVENT_MOUSEOUT:()=>ot,EVENT_MOUSEOVER:()=>st,EVENT_MOUSEUP:()=>le,EVENT_NODE_ADDED:()=>Jt,EVENT_NODE_MOVE:()=>Mt,EVENT_NODE_MOVE_ABORT:()=>od,EVENT_NODE_MOVE_END:()=>Vt,EVENT_NODE_MOVE_START:()=>Ms,EVENT_NODE_REMOVED:()=>Ce,EVENT_NODE_RENDERED:()=>Fr,EVENT_NODE_TYPE_CHANGED:()=>Qc,EVENT_NODE_UPDATED:()=>Re,EVENT_NODE_VISIBILITY:()=>Sd,EVENT_OBJECT_REPAINTED:()=>Fb,EVENT_OUT:()=>Xw,EVENT_OVER:()=>zw,EVENT_PAN:()=>Gi,EVENT_PLUGIN_ADDED:()=>Td,EVENT_PLUGIN_REMOVED:()=>Bb,EVENT_PORT_ADDED:()=>ei,EVENT_PORT_REMOVED:()=>Mr,EVENT_PORT_TYPE_CHANGED:()=>ed,EVENT_PORT_UPDATED:()=>lr,EVENT_REDO:()=>Rb,EVENT_RELAYOUT:()=>Pn,EVENT_RENDERER_ADDED:()=>_b,EVENT_RENDER_END:()=>$r,EVENT_RENDER_START:()=>Ad,EVENT_SELECT:()=>Kt,EVENT_SELECTION_CLEARED:()=>nr,EVENT_START:()=>HP,EVENT_START_NODE_TRAVERSAL:()=>Oy,EVENT_START_OVERLAY_ANIMATION:()=>zh,EVENT_STATE:()=>ng,EVENT_STOP:()=>ZP,EVENT_SURFACE_MODE_CHANGED:()=>On,EVENT_TAP:()=>W,EVENT_TOUCHEND:()=>Xb,EVENT_TOUCHMOVE:()=>jb,EVENT_TOUCHSTART:()=>zb,EVENT_UNDO:()=>Ob,EVENT_UNDOREDO_UPDATE:()=>Vs,EVENT_VERTEX_CLICK:()=>Hb,EVENT_VERTEX_CONTEXTMENU:()=>qb,EVENT_VERTEX_DBLCLICK:()=>kb,EVENT_VERTEX_DBLTAP:()=>Wb,EVENT_VERTEX_MOUSEDOWN:()=>lI,EVENT_VERTEX_MOUSEMOVE:()=>Kb,EVENT_VERTEX_MOUSEOUT:()=>Zb,EVENT_VERTEX_MOUSEOVER:()=>Jb,EVENT_VERTEX_MOUSEUP:()=>aI,EVENT_VERTEX_TAP:()=>Qb,EVENT_ZOOM:()=>Gr,EachEntry:()=>Md,Edge:()=>Ue,EdgeGeometryTransformer:()=>gp,EdgeHandlerBase:()=>ya,EdgeInputHandler:()=>Cp,EdgePathEditor:()=>ba,EdgeRelocateHandler:()=>Pp,EdgeRoutingPlugin:()=>Ih,EdgeRoutingStage:()=>zc,EdgeTypePicker:()=>Wp,EditorBase:()=>no,ElasticGroupManager:()=>va,ElementCluster:()=>vm,ElementDragHandler2:()=>cg,ElementDragger:()=>qP,ElementEntry:()=>Yr,ElementTypes:()=>Xi,Elements:()=>oi,EllipseOverlay:()=>Fu,EmptyLayout:()=>_s,EmptyRedrawResult:()=>Tu,EventGenerator:()=>um,EventManager:()=>ye,ExportControlsPlugin:()=>Jp,FACE_BOTTOM:()=>Rt,FACE_LEFT:()=>_t,FACE_RIGHT:()=>Ot,FACE_TOP:()=>Pt,FALSE:()=>ct,FILL:()=>hT,FIXED:()=>LE,FLOWCHART_EDGE_TYPE_BOTH_ARROWS:()=>eD,FLOWCHART_EDGE_TYPE_DASHED:()=>rD,FLOWCHART_EDGE_TYPE_PLAIN:()=>tD,FLOWCHART_EDGE_TYPE_SOURCE_ARROW:()=>qw,FLOWCHART_EDGE_TYPE_TARGET_ARROW:()=>Qw,FLOWCHART_SHAPES:()=>$1,FixedLayer:()=>yp,FlowchartBasicEdgeMappings:()=>w$,ForceDirectedLayout:()=>Vc,GRID_TYPE_DOTTED:()=>nG,GRID_TYPE_LINES:()=>iG,GROUP_RELAYOUT_ADHOC:()=>aA,GROUP_RELAYOUT_EXISTING_VERTEX_ADDED:()=>hA,GROUP_RELAYOUT_MEMBER_REMOVED:()=>cI,GROUP_RELAYOUT_NEW_VERTEX_ADDED:()=>lA,GaugeChart:()=>Z_,GeneratedGridBackground:()=>Sa,Graph:()=>cl,GraphSearchIndex:()=>TA,GridLayout:()=>bo,GridProfile:()=>Wl,GridTypes:()=>x0,Group:()=>se,GroupCollapseAction:()=>Ed,GroupExpandAction:()=>fd,GroupLayoutAdapter:()=>pp,GroupRemoveAction:()=>hd,GroupSizeChangedAction:()=>Al,H:()=>Kx,HEIGHT:()=>Ve,HIERARCHICAL_JSON_DATATYPE:()=>cm,HTMLElementOverlay:()=>oh,HeadlessRecado:()=>aE,HierarchicalLayout:()=>Bc,HierarchicalParentRelativePlacementStrategy:()=>$c,HierarchyLayout:()=>Ao,HierarchyLayoutModel:()=>Xc,HierarchyLayoutStage:()=>Rs,HilbertCurves:()=>Ws,ICONS_ORIENTATION_HORIZONTAL:()=>wv,ICONS_ORIENTATION_VERTICAL:()=>M1,ICON_CIRCLE:()=>vv,ICON_CLONE:()=>sp,ICON_CROSS:()=>Sv,ICON_GEAR:()=>Cv,ICON_LINK:()=>op,ICON_ORIGIN_CENTER:()=>Eh,ICON_ORIGIN_END:()=>fh,ICON_ORIGIN_START:()=>mh,ICON_PLUS:()=>Tv,ICON_TRASH:()=>ap,INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS:()=>Ew,INSPECTOR_CONTEXT_RECENT_COLORS:()=>Gh,IconElement:()=>Uf,IfEntry:()=>$d,ImageExportUI:()=>Vh,InBrowserTemplateResolver:()=>Ff,Inspector:()=>Hp,JSON_DATATYPE:()=>kt,LASSO_PATH:()=>X0,LASSO_VIEW_BOX:()=>z0,LAYOUT_TYPE_ABSOLUTE:()=>TO,LAYOUT_TYPE_COLUMN:()=>xm,LAYOUT_TYPE_GRID:()=>ym,LAYOUT_TYPE_HIERARCHICAL:()=>LO,LAYOUT_TYPE_HIERARCHY:()=>pb,LAYOUT_TYPE_ROW:()=>bm,LEFT:()=>We,LEGEND_ALIGN_CENTER:()=>lx,LEGEND_ALIGN_LEFT:()=>ax,LEGEND_ALIGN_RIGHT:()=>D_,LEGEND_ORIENTATION_HORIZONTAL:()=>sx,LEGEND_ORIENTATION_VERTICAL:()=>dB,LEGEND_VERTICAL_ALIGN_BOTTOM:()=>hx,LEGEND_VERTICAL_ALIGN_MIDDLE:()=>cc,LEGEND_VERTICAL_ALIGN_TOP:()=>hc,LINE_WIDTH:()=>gV,LOCATION_ATTRIBUTE:()=>QR,LabelOverlay:()=>gr,Lasso:()=>Aa,LassoPlugin:()=>Yn,Layouts:()=>nt,LineChart:()=>J_,LineCrossingsPlugin:()=>tg,LinePlot:()=>yc,ListManagerPlugin:()=>Fh,MagnetizeProfile:()=>Nu,Magnetizer:()=>Li,MiniviewPlugin:()=>zn,ModelSeriesBasedDataSource:()=>pc,MoveAction:()=>Bs,NEGATIVE:()=>eb,NOMINAL_SIZE:()=>jr,NONE:()=>pt,Node:()=>ce,NodeGroupAction:()=>ld,OBJECT_TYPE_ANCHOR:()=>pE,OPPOSITE_FACES:()=>jI,ORIENTATION_OPPOSITE:()=>TE,ORIENTATION_ORTHOGONAL:()=>SE,ORIENTATION_PERPENDICULAR:()=>AE,ORTHOGONAL_AXIS_HORIZONTAL:()=>ne,ORTHOGONAL_AXIS_VERTICAL:()=>pe,ORTHOGONAL_FACES:()=>XI,ORTHOGONAL_ROUTER_MODE_BUS:()=>UI,ORTHOGONAL_ROUTER_MODE_SEPARATE:()=>zd,OVERLAY_TYPE_CUSTOM:()=>of,OVERLAY_VISIBILITY_ALWAYS:()=>bu,OVERLAY_VISIBILITY_HOVER:()=>Zi,OptimisticEventGenerator:()=>Ft,OrthogonalEditor:()=>ao,Overlay:()=>li,OverlayFactory:()=>at,PALETTE_MODE_DRAG:()=>ly,PALETTE_MODE_DRAW:()=>hy,PALETTE_MODE_TAP:()=>OC,PAN_PATH:()=>W0,PAN_VIEW_BOX:()=>k0,PAPER_ALIGN_CENTER:()=>qo,PAPER_ALIGN_END:()=>ih,PAPER_ALIGN_START:()=>nh,PATH_CONSTRAIN_DIAGONAL:()=>Mc,PATH_CONSTRAIN_MANHATTAN:()=>qx,PATH_CONSTRAIN_METRO:()=>Qx,PATH_CONSTRAIN_NONE:()=>tn,PATH_CONSTRAIN_ORTHOGONAL:()=>rn,PLACEHOLDER_KEY:()=>Rl,PLACEHOLDER_VALUE:()=>_o,PLUGIN_TYPE_LINE_CROSSINGS:()=>eg,POSITION_RELATIVE:()=>OS,PROPERTY_POSITION:()=>ff,PX:()=>Dn,Palette:()=>Ra,PalettePlugin:()=>Bh,PanButtonsPlugin:()=>cs,PanZoom:()=>fa,Paper:()=>Kh,ParentRelativePlacementStrategy:()=>Hc,PathImpl:()=>gl,PathTransport:()=>rg,PathTransportState:()=>lP,PerimeterAnchorShapes:()=>gR,PieChart:()=>q_,PinchListener:()=>fp,PlacementStage:()=>kc,PlainArrowOverlay:()=>Vu,PopupHandler:()=>_P,Port:()=>de,PortAction:()=>dd,PortAddAction:()=>ud,PortRemoveAction:()=>pd,PriorityQueue:()=>Ts,PropertyMapper:()=>Uu,PropertyTracker:()=>Du,QuadraticBezierEditor:()=>ho,REMOVE_CLASS_ACTION:()=>sV,RESET_SELECTION_PATH:()=>J0,RESET_SELECTION_VIEW_BOX:()=>Z0,RESIZING_TOOLS_RESIZE_METHOD_BORDERS:()=>UC,RESIZING_TOOLS_RESIZE_METHOD_HANDLES:()=>Uh,RIGHT:()=>yt,ROLLBACK_CURRENT:()=>FO,ROOT_SHAPE_SET:()=>ro,ROTATION:()=>XN,ROW:()=>wi,RTREE_DEFAULT_MAX_CHILD_ENTRIES:()=>UA,RTree:()=>Do,RandomColorGenerator:()=>ws,Recado:()=>Ro,RecadoTemplateRenderer:()=>Ep,RecordBasedSeries:()=>tr,RectangleOverlay:()=>Bu,RemoveGroupMemberAction:()=>md,ResizingToolsPlugin:()=>ps,RowLayout:()=>El,SEGMENT_TYPE_ARC:()=>Ml,SEGMENT_TYPE_BEZIER:()=>No,SEGMENT_TYPE_STRAIGHT:()=>wn,SELECTION_MODE_EDGES_ONLY:()=>Nb,SELECTION_MODE_GROUPS_ONLY:()=>Db,SELECTION_MODE_ISOLATED:()=>ad,SELECTION_MODE_MIXED:()=>Lb,SELECTION_MODE_NODES_ONLY:()=>wb,SELECTOR_CONNECTOR:()=>Zr,SELECTOR_GROUP_CONTAINER:()=>vT,SELECTOR_MANAGED_ELEMENT:()=>Kl,SELECTOR_OVERLAY:()=>Mn,SELECTOR_TOGGLE_GROUP_COLLAPSE:()=>CT,SOURCE:()=>it,STATIC:()=>_S,STRAIGHT_CONNECTOR_AUTO_SPLIT:()=>g$,STRAIGHT_CONNECTOR_CLICK_SPLIT:()=>GP,STROKE:()=>JE,STROKE_WIDTH:()=>cT,SURFACE_MODE_DISABLED:()=>ns,SURFACE_MODE_PAN:()=>xr,SURFACE_MODE_SELECT:()=>Ei,SURFACE_MODE_VERTEX_DRAWING:()=>Fn,SVGElementOverlay:()=>Ju,SVG_NAMESPACE:()=>Gt,SankeyChart:()=>rO,ScatterChart:()=>nO,Segments:()=>dr,SelectedEdgeHighlightPlugin:()=>Ta,SeriesBasedChart:()=>za,ShapeLibraryDefaults:()=>np,ShapeLibraryImpl:()=>ca,ShapePalette:()=>lg,ShapeTypeInspector:()=>_C,SimpleBackground:()=>Rp,SimpleShapeOverlay:()=>Nn,SingleColorGenerator:()=>Zc,SnaplinesPlugin:()=>hs,SourceValueTargetCsvParser:()=>AA,StaticColorGenerator:()=>gb,Storage:()=>KP,StraightEditor:()=>lo,StraightSegmentHandler:()=>Go,SummingSeries:()=>Ya,Surface:()=>Jh,SurfaceAnimator:()=>og,SvgComponent:()=>qu,SvgExportComponent:()=>Oa,SvgExportUI:()=>Yp,SyntheticDecorator:()=>_h,TAG_SHAPE:()=>Av,TARGET:()=>vn,TILING_STRATEGY_ABSOLUTE:()=>Qv,TILING_STRATEGY_LOGARITHMIC:()=>qv,TOP:()=>Te,TRUE:()=>Ct,TWO_PI:()=>vi,TYPE_ATTRIBUTE:()=>RA,TYPE_EACH:()=>ii,TYPE_ELEMENT:()=>ni,TYPE_IF:()=>Ol,TYPE_ITEM_ANCHORS:()=>Pu,TYPE_ITEM_CONNECTOR:()=>HE,TYPE_ITEM_OVERLAY:()=>WS,TYPE_JPG:()=>ss,TYPE_PNG:()=>Mh,TYPE_ROOT:()=>PA,TYPE_SVG:()=>sy,TYPE_TEXT:()=>$i,TYPE_TMPL:()=>Po,TerminusAddAction:()=>bl,TerminusRemoveAction:()=>xl,TestHarness:()=>Ag,TextEntry:()=>Ui,TiledBackground:()=>Lp,TmplEntry:()=>Oo,Tooltip:()=>Xa,TooltipRenderer:()=>ja,UICore:()=>Mu,UIModel:()=>Su,UIPlugins:()=>ln,UIState:()=>Dp,UNDEFINED:()=>tb,UiStatesBrowserUIModel:()=>ey,UiStatesPlugin:()=>Nh,UndoRedoManager:()=>Ld,UpdateAction:()=>Vi,UrlSeriesBasedDataSource:()=>Dg,V:()=>Ic,VERTEX:()=>fl,VERTEX_DRAWING_PATH:()=>H0,VERTEX_DRAWING_VIEW_BOX:()=>j0,VERTEX_UPDATE_REASON_ADD_NEW_PORT:()=>zO,VERTEX_UPDATE_REASON_ADD_PORT:()=>YO,VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE:()=>_l,VERTEX_UPDATE_REASON_GROUP_RESIZED:()=>fA,VERTEX_UPDATE_REASON_LAYOUT:()=>gI,VERTEX_UPDATE_REASON_MAGNETIZER:()=>yA,VERTEX_UPDATE_REASON_MOVED:()=>js,VERTEX_UPDATE_REASON_REMOVE_PORT:()=>XO,VERTEX_UPDATE_REASON_RESIZED:()=>bA,VERTEX_UPDATE_REASON_ROTATION:()=>zs,VERTEX_UPDATE_REASON_SET_POSITION:()=>Nd,VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT:()=>mI,VERTEX_UPDATE_REASON_SNAP_TO_GRID:()=>xA,VERTEX_UPDATE_REASON_UPDATE_GROUP:()=>mA,VERTEX_UPDATE_REASON_UPDATE_NODE:()=>gA,VERTEX_UPDATE_REASON_UPDATE_PORT:()=>wd,VERTEX_UPDATE_REASON_UPDATE_VERTEX:()=>jm,VanillaInspector:()=>Zp,Vertex:()=>Rc,VertexDrawingPlugin:()=>fi,VertexSet:()=>Wc,Viewport:()=>vu,VisuallyJsModel:()=>Dd,VisuallyJsRendererVertexRemovedAction:()=>Sl,VisuallyJsSelection:()=>cr,VisuallyJsTestSupport:()=>bi,VjsContext:()=>cu,WIDTH:()=>_e,WILDCARD:()=>pr,WhitespaceReplacingTokenizer:()=>xI,X:()=>ee,XHTML_NAMESPACE:()=>PV,XLINK_NAMESPACE:()=>CV,XYChart:()=>ka,XYPlot:()=>ux,X_AXIS_FACES:()=>YI,Y:()=>fe,Y_AXIS_FACES:()=>zI,ZOOM_IN_OUT_VIEW_BOX:()=>EC,ZOOM_IN_PATH:()=>Q0,ZOOM_OUT_PATH:()=>ew,ZOOM_TO_FIT_PATH:()=>Y0,ZOOM_TO_FIT_VIEW_BOX:()=>U0,_addBinding:()=>Zm,_addConnectorSegment:()=>zr,_adjustForGap:()=>lT,_applyStyles:()=>gf,_areaIfGrownBy:()=>YA,_bindOneAtt:()=>LA,_calculateSteps:()=>nx,_clearConnectorSegments:()=>yE,_computeConnector:()=>uM,_computeSingleLocation:()=>Ru,_connectorBoundingBoxIntersection:()=>aS,_connectorBoxIntersection:()=>gM,_connectorGradientAtPoint:()=>dM,_connectorLineIntersection:()=>pM,_connectorPointAlongPathFrom:()=>$e,_connectorPointOnPath:()=>ur,_createAnchor:()=>jE,_createBaseSegment:()=>Js,_createConnectorBase:()=>kd,_createContinuousAnchor:()=>HS,_createCubicBezierConnector:()=>_R,_createQuadraticBezierConnector:()=>OR,_createSegment:()=>jA,_defaultGroupHtmlTemplate:()=>e0,_defaultGroupSvgTemplate:()=>r0,_defaultNodeHtmlTemplate:()=>ga,_defaultNodeSvgTemplate:()=>ma,_defaultPortHtmlTemplate:()=>QL,_defaultPortSvgTemplate:()=>t0,_defaultSegmentBoundingBoxIntersection:()=>WA,_defaultSegmentBoxIntersection:()=>Dl,_defaultSegmentFindClosestPointOnPath:()=>HA,_defaultSegmentLineIntersection:()=>kA,_emptyRTreeRegion:()=>Lo,_findAnchorOrientation:()=>vp,_findConnectorSegmentForLocation:()=>fE,_findConnectorSegmentForPoint:()=>sS,_findIdealSteps:()=>xD,_findNextHorizontalSegment:()=>dS,_findNextSegmentOfType:()=>ru,_findNextVerticalSegment:()=>pS,_findPreviousHorizontalSegment:()=>uS,_findPreviousVerticalSegment:()=>gS,_findTargetZones:()=>p0,_findZones:()=>g0,_getCurrentAnchorLocation:()=>iT,_getDefaultTemplate:()=>Iv,_getLabelOverlay:()=>QM,_getSegmentLength:()=>mE,_getVertexInfo:()=>Sp,_growToFit:()=>hE,_hasLeafNodes:()=>zA,_hideOverlays:()=>tL,_initialiseDecorators:()=>Gv,_internalLabelOverlayClass:()=>KS,_internalLabelOverlayId:()=>_u,_internalSourceMarkerOverlayId:()=>JM,_internalTargetMarkerOverlayId:()=>KM,_isContinuousAnchor:()=>Wo,_isFaceAvailable:()=>jl,_isLeaf:()=>Xd,_mapToSpline:()=>_E,_padPoint:()=>aV,_placeAnchorsOnLine:()=>nT,_populateSourceZones:()=>Fv,_populateTargetZones:()=>Oh,_populateZones:()=>Bv,_prepareCompute:()=>bE,_registerSegmentHandler:()=>Zs,_removeOverlay:()=>ko,_removeShortSegments:()=>GR,_removeTypeCssHelper:()=>eT,_resetConnectorBounds:()=>oS,_resetConnectorGeometry:()=>Yi,_setAnchorLocation:()=>EE,_setOrthogonalSegmentPosition:()=>CS,_showOverlays:()=>rL,_trimOrthogonalConnector:()=>PS,_trimOrthogonalSegments:()=>RE,_trimSegments:()=>OE,_updateConnectorBounds:()=>vR,_updateConnectorSegmentProportions:()=>xE,_updateHoverStyle:()=>Ou,_updateRTreeRegionBounds:()=>cE,_writeSegmentedConnectorSegments:()=>su,aSegmentDirections:()=>Vo,add:()=>Ci,addClass:()=>L,addConnectionClass:()=>Wr,addEntryToEachExecution:()=>tE,addNewExecutionToEachExecution:()=>VA,addSegment:()=>Il,addToDictionary:()=>Ix,addToList:()=>vN,addWheelListener:()=>th,addWithFunction:()=>TN,addXYPlotType:()=>Wa,ajax:()=>ha,anchorPlacementEquals:()=>vE,apply:()=>bC,applyConnectionType:()=>qS,applyDomainOverrides:()=>YD,applyRotations:()=>Bx,applyRotationsXY:()=>Fx,areVerticesConnected:()=>jx,arraysEqual:()=>yO,astarFromViewport:()=>aT,att:()=>Ae,attWithValue:()=>di,attachDiagramPalette:()=>XG,attemptCoerce:()=>zp,base64Encode:()=>tw,base64EncodeSvgElement:()=>rw,bezierLineIntersection:()=>Ln,bindDarkModeListener:()=>QV,boundingBoxIntersection:()=>iM,boxIntersection:()=>nM,buildDomainScales:()=>zD,calculateNestedDepth:()=>Lc,calculatePowerOf10:()=>bD,calculateSpacingAdjustment:()=>Ri,chebyshevDistance:()=>xN,clampAngle:()=>ol,clampToHalfPixel:()=>Io,classList:()=>e1,clear:()=>PG,clone:()=>lt,cloneIcon:()=>w1,cls:()=>z,colourDistance:()=>mb,computeBezierConnector:()=>Qd,computeBezierLength:()=>tS,computeDomainScales:()=>U_,computeGroupSize:()=>Iu,computeOrigin:()=>PP,computeRectangleIntersection:()=>kg,computeStraightConnector:()=>lu,computeTranslationForRotation:()=>YL,connectorSegmentLength:()=>bS,consume:()=>oe,containsPoint:()=>Ss,convertToFullOverlaySpec:()=>hi,convertToMultilineText:()=>Xu,createAbstractBezierConnector:()=>Wd,createAndAppendElementNS:()=>Kr,createChartElement:()=>k,createChartTextElement:()=>ys,createColorPickerTag:()=>CC,createComponent:()=>tT,createContrastLabel:()=>_g,createDiagram:()=>jG,createElement:()=>Jr,createElementNS:()=>aa,createFinderFromAnchorPositions:()=>ia,createGateMap:()=>Fd,createPaper:()=>x$,createSurface:()=>WG,createXYPlot:()=>z_,data:()=>De,debounce:()=>la,decodeDragGroupSpec:()=>Rw,defaultDataGenerator:()=>yw,defaultExportGeometry:()=>hM,defaultIcons:()=>xh,defaultIdFunction:()=>lm,defaultImportGeometry:()=>cM,destroySVGOverlay:()=>Af,diagonalAdjacentCellsFinder:()=>wm,directRouter:()=>FA,dist:()=>qA,distanceFromCurve:()=>bR,djikstra:()=>Sc,each:()=>sI,eachNotEmpty:()=>Gx,edgeSortFunctions:()=>rT,editors:()=>Rr,emptyBox:()=>lc,emptyPaintGeometry:()=>mR,encloses:()=>gN,encodedSvgToDataUrl:()=>nw,ensureSVGContentElements:()=>sh,ensureSVGLabelElements:()=>Qo,euclideanDistance:()=>yN,evaluateExpression:()=>Bi,evaluateSingleExpression:()=>Jm,expandRectangle:()=>Ox,exportConnectorGeometry:()=>sn,exportData:()=>dm,exportImage:()=>Up,exportSVG:()=>ox,exportSvg:()=>_a,extend:()=>Fs,extract:()=>vG,extractBounds:()=>CN,extractPoint:()=>ft,extractSize:()=>Jn,extractValueFromElement:()=>ow,faceOrientations:()=>gE,fastTrim:()=>vt,filterEmpty:()=>Vx,filterNull:()=>_N,findAdjacentSegment:()=>iu,findClosestPoint:()=>Pc,findParent:()=>Bt,findParents:()=>ZV,findSegment:()=>nu,fixPrecision:()=>Wg,flatten:()=>uR,floydWarshall:()=>Ax,formatValue:()=>ix,freeMovementAdjacencies:()=>GO,generateConstrainFunctionFromContainmentType:()=>JP,generateInspectorTemplate:()=>fw,getAbsolutePosition:()=>p1,getAllEdges:()=>xO,getAllSourceEdges:()=>LN,getAllTargetEdges:()=>wN,getAncestors:()=>An,getClass:()=>OT,getClosestMidpoint:()=>Mx,getConnectedVertices:()=>IN,getConnectorElement:()=>zL,getContrastColor:()=>Jc,getDescendantEdges:()=>hm,getDescendants:()=>Ps,getDownstreamVertices:()=>DN,getEdges:()=>hl,getElementSize:()=>Ze,getElementType:()=>ku,getEventSource:()=>Ko,getFromSetWithFunction:()=>qg,getOutlineColor:()=>nI,getPageLocation:()=>PL,getPosition:()=>un,getPositionOnElement:()=>Wu,getRectangleMidpoints:()=>mO,getSelector:()=>RT,getSourceEdges:()=>Ux,getSvgPositionRelativeToSvgRoot:()=>Ku,getSvgTranslatePosition:()=>ah,getTargetEdges:()=>Yx,getTouch:()=>pf,getUpstreamVertices:()=>NN,getsert:()=>vs,gradient:()=>Dr,gradientAtPoint:()=>Jd,gradientAtPointAlongPathFrom:()=>tM,gridBackgroundOptions:()=>bP,hasClass:()=>cn,inferAxis:()=>Ds,inferAxisAndDirectionFromOrientation:()=>Dm,inferAxisFromSourceAndTargetLocation:()=>yb,inferDirection:()=>fb,initializeBezierConnectorEditors:()=>YP,initializeOrthogonalConnectorEditors:()=>MP,initializeStraightConnectorEditors:()=>$P,insertRTreeChild:()=>wo,insertSorted:()=>Qg,intersectionOfProjectedLines:()=>Lx,isAncestor:()=>ke,isArrayLike:()=>JV,isArrayOrNodeList:()=>_T,isAssignableFrom:()=>Nx,isBarPlot:()=>RB,isBoolean:()=>mo,isCategoryAxis:()=>L_,isClass:()=>fO,isConnection:()=>oa,isConnector:()=>mM,isCustomOverlay:()=>hn,isDOMElement:()=>qi,isDate:()=>EO,isDescendantGroup:()=>Xx,isEdge:()=>rt,isEdgeConnectedTo:()=>ON,isEdgeNodeEntry:()=>dt,isEdgeSupported:()=>XE,isElement:()=>LT,isEmpty:()=>al,isFilterableDataset:()=>SA,isFullOverlaySpec:()=>XS,isFunction:()=>en,isGroup:()=>Y,isHTMLLabelOverlay:()=>YT,isLabelOverlay:()=>kr,isLoopPresent:()=>DA,isMouseDevice:()=>ci,isNamedFunction:()=>PN,isNestedGroup:()=>am,isNode:()=>J,isNodeInsideAGroup:()=>sm,isNodeList:()=>Vn,isNodeVertex:()=>zx,isNumber:()=>Cc,isObject:()=>ar,isPoint:()=>QA,isPort:()=>j,isSVGElement:()=>Lt,isStackedPlot:()=>Za,isString:()=>X,isTextNode:()=>KV,isTouchDevice:()=>In,isValueAxis:()=>yn,isVertex:()=>_i,lightweightPrintfFormatter:()=>GA,lineCalculators:()=>Gl,lineIntersection:()=>il,lineIntersectsOrIsEnclosedByRectangle:()=>_x,lineLength:()=>Pe,lineRectangleIntersection:()=>sr,linesIntersection:()=>uO,linesOverlap:()=>Zg,locationAlongCurveFrom:()=>nS,log:()=>U,logEnabled:()=>gO,makeLightweightAnchorFromArraySpec:()=>Cu,makeLightweightAnchorFromSpec:()=>St,manhattanDistance:()=>vc,manhattanLineLength:()=>pN,matchesSelector:()=>$t,merge:()=>bn,mergeDomainExtents:()=>UD,mergeWithParents:()=>Au,minBy:()=>XA,namedContinuousValues:()=>kS,nearestPointOnCurve:()=>eS,newInstance:()=>mn,newRecadoInstance:()=>yr,newTemplates2Renderer:()=>Ph,normal:()=>Px,objectsEqual:()=>ll,octileDistance:()=>bN,offsetRelativeToRoot:()=>Ki,orthogonalAdjacencies:()=>$O,orthogonalAdjacentCellsFinder:()=>Eb,orthogonalRouter:()=>BA,pageLocation:()=>me,paintSVGLabelOverlay:()=>jT,paintSimpleShapeOverlay:()=>XT,paintSvgConnector:()=>bv,parallelLineFromPoint:()=>fN,parallelLineTo:()=>vx,parallelLinesTo:()=>wx,parentAxis:()=>Nr,parentDirection:()=>xb,parse:()=>Jx,parseAttributes:()=>Wm,parseAtts:()=>NA,parseExpression:()=>iR,partition:()=>sl,peek:()=>wA,perpendicularBisectingLine:()=>mN,perpendicularLineTo:()=>Dt,perpendicularToPathAt:()=>rM,pointAlongCurveFrom:()=>rS,pointAlongPath:()=>Zd,pointOnCurve:()=>qs,pointOnLine:()=>jt,pointsEqual:()=>$x,populate:()=>fo,populateRegions:()=>Yd,prefersDarkMode:()=>qV,processExpression:()=>Ll,quadrant:()=>As,ready:()=>D$,recordGetsert:()=>Cs,rectanglesIntersect:()=>tt,registerDecorator:()=>kG,registerEdgeTypePickerTag:()=>PC,registerExporter:()=>$N,registerParser:()=>Zx,registerPlugin:()=>Xe,relocateContinuousAnchor:()=>Wv,relocateDynamicAnchor:()=>Zv,relocateWithPositionFinder:()=>Jv,remove:()=>Jg,removeClass:()=>F,removeConnectionClass:()=>Pr,removeRTreeChild:()=>uE,removeWheelListener:()=>rh,removeWithFunction:()=>Nt,renderIcon:()=>lp,renderNamedIcon:()=>hp,renderPaper:()=>$w,renderSurface:()=>Gw,replace:()=>tm,resolveIfExecution:()=>nE,resolveNode:()=>Kn,resolveNodeId:()=>dl,rotatePoint:()=>Me,rotatedRectanglesIntersect:()=>Dx,routerLineIntersects:()=>$A,routerLineSgn:()=>lE,segmentLineAngle:()=>xS,segmentedConnectorSegmentLength:()=>Qs,setAbsolutePosition:()=>er,setElementHeight:()=>JT,setElementRotation:()=>pi,setElementSize:()=>Or,setElementWidth:()=>ZT,setForceMouseEvents:()=>CL,setForceTouchEvents:()=>vL,setOverlayLocation:()=>$E,setPosition:()=>Ie,setRotatedSvgElementPosition:()=>KT,setSvgTranslatePosition:()=>dn,setTranslatedPosition:()=>zt,setTranslatedX:()=>hB,setTranslatedY:()=>ac,setXPosition:()=>kT,setYPosition:()=>WT,shortUuid:()=>Eo,snapToGrid:()=>he,snapToGridUpperBound:()=>EN,sortAndPlaceEdges:()=>Ud,sourceElementSelector:()=>Ap,sourceVertexAvoidance:()=>mS,splitIntoSiblings:()=>dE,stubCalculators:()=>Vl,stubRelocator:()=>TS,subtract:()=>Cx,suggest:()=>Kg,supportsPathEditing:()=>GT,svgElementToDataUrl:()=>xC,targetElementSelector:()=>u0,targetVertexAvoidance:()=>ES,testIntersectingDropTarget:()=>Tp,theta:()=>nl,toggleClass:()=>xf,touchCount:()=>ST,touches:()=>Zo,transformAnchorPlacement:()=>Ks,transformBezierGeometry:()=>eu,transformSegmentedGeometry:()=>hu,translateRect:()=>em,unionOfRectangles:()=>Rx,updateBezierConnector:()=>qd,updateClasses:()=>Ut,updateEditedOrthogonalConnector:()=>AS,updateStraightConnector:()=>au,uuid:()=>G,valueInRange:()=>Nl,vertexAvoidance:()=>fS,wrap:()=>cd,xml:()=>PT});module.exports=cN(GB);function Sc(i){let r=i.graph,e=i.source,t=i.target,n=i.nodeFilter,o=i.edgeFilter,s={},a={},l={},h={dist:s,previous:a,edges:l,path:[]},d=i.processAll,u={},p={},g=i.strict!==!1,m=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let R=p[C.getFullId()];return u[R.v.id]},x=(C,R)=>{let w,B;if(C.objectType===de.objectType){for(s[C.getFullId()]=R,w=y(C),B=0;B<w.length;B++)w[B].p!=C&&(s[w[B].p.getFullId()]=R+C.getParent().getInternalEdge(C,w[B].p).cost);g||(s[C.getParent().id]=R)}else for(s[C.id]=R,w=u[C.id],B=0;B<w.length;B++)s[w[B].p.getFullId()]=R},f=C=>n&&!n(C)?1/0:s[m(C)],b=(C,R,w)=>{if(C.objectType===de.objectType){let B=y(C);for(let N=0;N<B.length;N++)a[B[N].p.getFullId()]=w.node;g||(a[C.getParent().id]=w.node)}a[R]=w.node},A=(C,R,w)=>{if(C.objectType===de.objectType){let B=y(C);for(let N=0;N<B.length;N++)l[B[N].p.getFullId()]=w;g||(l[C.getParent().id]=w)}l[R]=w},T=(C,R,w,B,N)=>{let V=-1,D=null,$=1/0;for(let K=0;K<C.length;K++)if(!R[K]){let xe=N(C[K]);xe<$?($=xe,V=K,D=C[K]):xe===$&&C[K].objectType===de.objectType&&C[K].getParent()===D&&(V=K,D=C[K])}return{node:D,index:V}},S=(C,R)=>{let w=R.getFullId(),B=C[w];return B==null&&(w=R.getParent?R.getParent().id:R.id,B=C[w]),B==null?null:{p:B,id:w}},O=(C,R,w,B,N,V)=>{let D=[],$=B,K=S(R,$);for(;K!=null;)D.splice(0,0,{vertex:$,cost:C[K.id],edge:w[K.id]}),$=K.p,K=S(R,$);return D.splice(0,0,{vertex:$,cost:0,edge:null}),D},v=C=>{for(let R=0;R<C.length;R++){let w=C[R],B=w.getPorts();E.push(w);let N={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let V=0;V<B.length;V++)E.push(B[V]),p[B[V].getFullId()]=N,u[w.id].push({p:B[V],i:E.length-1}),x(B[V],1/0)}};if(v(r.nodes),v(r.groups),e==null&&(e=r.getVertex(i.sourceId)),t==null&&(t=r.getVertex(i.targetId)),e==null||t==null)return h;x(e,0);let _=new Array(r.nodes.length),P=0,I=(C,R,w,B)=>{for(let N=0;N<R.length;N++){let V=R[N];if(w(V)){let D=B(V),$=D.tp||D.tn,K=m($),xe=f(C.node)+V.getCost(),H=f($);xe<H&&(x($,xe),b($,K,C),A($,K,V))}}};for(;P<E.length;){let C=T(E,_,s,m,f),R=C.node?m(C.node):null;if(!C.node||f(C.node)==1/0||t&&(R==m(t)||!g&&C.node.objectType===de.objectType&&C.node.isChildOf(t))&&(h.path=O(s,a,l,t,m),h.pathDistance=h.path[h.path.length-1].cost,!d))break;_[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!g&&w.source.objectType===de.objectType&&w.source.isChildOf(C.node),w=>{var B=w.source.objectType===de.objectType?w.source.getParent():w.source,N=w.source.objectType===de.objectType?w.source:null,V=w.target.objectType===de.objectType?w.target.getParent():w.target,D=w.target.objectType===de.objectType?w.target:null;return w.source==C.node||!g&&w.source.objectType===de.objectType&&w.source.isChildOf(C.node)?{tn:V,tp:D}:{tn:B,tp:N}})}return h}function Ax(i){let r=i.graph,e=r.getVertexCount(),t={},n={},o,s,a;for(o=0;o<e;o++){let l=r.getVertexAt(o);for(t[l.id]||(t[l.id]={}),n[l.id]||(n[l.id]={}),t[l.id][l.id]=0,s=0;s<e;s++)if(o!=s){let d=r.getVertexAt(s);t[l.id][d.id]||(t[l.id][d.id]=1/0),n[l.id][d.id]||(n[l.id][d.id]=[])}let h=l.getEdges();for(a=0;a<h.length;a++)h[a].source==l?t[l.id][h[a].target.id]=h[a].getCost():(t[h[a].source.id]||(t[h[a].source.id]={},n[h[a].source.id]={}),t[l.id][h[a].source.id]=h[a].getCost())}for(a=0;a<e;a++)for(o=0;o<e;o++)for(s=0;s<e;s++)if(o!=s&&s!=a&&o!=a){let l=r.getVertexAt(o).id,h=r.getVertexAt(s).id,d=r.getVertexAt(a).id;t[l][d]+t[d][h]<=t[l][h]&&t[l][d]+t[d][h]!=1/0&&(t[l][h]=t[l][d]+t[d][h],n[l][h]||(n[l][h]=[]),n[l][h].unshift([r.getVertexAt(a),t[l][h]]))}return{paths:t,parents:n}}var Tc=class{constructor(r){c(this,"vertices");c(this,"ne");this.vertices=[r],this.ne=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.ne.add(e))}get edges(){return Array.from(this.ne)}};var dN=[null,[1,-1],[1,1],[-1,1],[-1,-1]],uN=[null,[-1,-1],[-1,1],[1,1],[1,-1]],vi=2*Math.PI;function Ci(i,r){return{x:i.x+r.x,y:i.y+r.y}}function Cx(i,r){return{x:i.x-r.x,y:i.y-r.y}}function Dr(i,r){return r.x===i.x?r.y>i.y?1/0:-1/0:r.y===i.y?r.x>i.x?0:-0:(r.y-i.y)/(r.x-i.x)}function Px(i,r){return-1/Dr(i,r)}function Pe(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function pN(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function As(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function nl(i,r){let e=Dr(i,r),t=Math.atan(e),n=As(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function tt(i,r){return!(i.x+i.width<r.x||i.x>r.x+r.width||i.y+i.height<r.y||i.y>r.y+r.height)}function kg(i,r){let e=Math.max(0,Math.min(i.x+i.width,r.x+r.width)-Math.max(i.x,r.x)),t=Math.max(0,Math.min(i.y+i.height,r.y+r.height)-Math.max(i.y,r.y));return e*t}function aO(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:r*i[0].x+e*i[0].y}}function Wg(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}var Zn=1e-6;function il(i,r){let e=aO(i),t=aO(r),n=e.A*t.B-t.A*e.B;if(Math.abs(n)<Zn)return null;{let o={x:(t.B*e.C-e.B*t.C)/n,y:(e.A*t.C-t.A*e.C)/n},s=Math.min(i[0].x,i[1].x),a=Math.max(i[0].x,i[1].x),l=Math.min(i[0].y,i[1].y),h=Math.max(i[0].y,i[1].y),d=Math.min(r[0].x,r[1].x),u=Math.max(r[0].x,r[1].x),p=Math.min(r[0].y,r[1].y),g=Math.max(r[0].y,r[1].y);return o.x>=s-Zn&&o.x<=a+Zn&&o.y>=l-Zn&&o.y<=h+Zn&&o.x>=d-Zn&&o.x<=u+Zn&&o.y>=p-Zn&&o.y<=g+Zn?o:null}}function sr(i,r){let e=[];return[[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y}],[{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height}],[{x:r.x,y:r.y},{x:r.x,y:r.y+r.height}],[{x:r.x,y:r.y+r.height},{x:r.x+r.width,y:r.y+r.height}]].forEach(n=>{let o=il(i,n);o!=null&&e.push(o)}),e}function _x(i,r){return Ss(r,i[0],!0)||Ss(r,i[1],!0)||sr(i,r).length>0}function gN(i,r,e){let t=i.x,n=i.x+i.width,o=i.y,s=i.y+i.height,a=r.x,l=r.x+r.width,h=r.y,d=r.y+r.height,u=(p,g,m,E)=>e?p<=g&&m>=E:p<g&&m>E;return u(t,a,n,l)&&u(o,h,s,d)}function Ss(i,r,e){return e?i.x<=r.x&&i.x+i.width>=r.x&&i.y<=r.y&&i.y+i.height>=r.y:i.x<r.x&&i.x+i.width>r.x&&i.y<r.y&&i.y+i.height>r.y}function jt(i,r,e){let t=Dr(i,r),n=As(i,r),o=e>0?dN[n]:uN[n],s=Math.atan(t),a=Math.abs(e*Math.sin(s))*o[1],l=Math.abs(e*Math.cos(s))*o[0];return{x:i.x+l,y:i.y+a}}function Dt(i,r,e){let t=Dr(i,r),n=Math.atan(-1/t),o=e/2*Math.sin(n),s=e/2*Math.cos(n);return[{x:r.x+s,y:r.y+o},{x:r.x-s,y:r.y-o}]}function mN(i,r,e){let t={x:(i.x+r.x)/2,y:(i.y+r.y)/2},n=Dr(i,r),o=Math.atan(-1/n),s=e/2*Math.sin(o),a=e/2*Math.cos(o);return[{x:t.x,y:t.y},{x:t.x-a,y:t.y-s}]}function he(i,r,e,t){e=e==null?r.thresholdX==null?r.width/2:r.thresholdX:e,t=t==null?r.thresholdY==null?r.height/2:r.thresholdY:t;let n=Math.floor(i.x/r.width),o=r.width*n,s=o+r.width,a=Math.abs(i.x-o)<=e?o:Math.abs(s-i.x)<=e?s:i.x,l=Math.floor(i.y/r.height),h=r.height*l,d=h+r.height,u=Math.abs(i.y-h)<=t?h:Math.abs(d-i.y)<=t?d:i.y;return{x:a,y:u}}function EN(i,r){let e=Math.floor(i.x/r.width),t=r.width*e,n=t+r.width,o=Math.floor(i.y/r.height),s=r.height*o,a=s+r.height;return{x:n,y:a}}function uO(i,r,e,t){let n=Math.max(i,r);i=Math.min(i,r),r=n;let o=Math.max(e,t);return e=Math.min(e,t),t=o,i<=e&&e<=r&&i<=t&&t<=r?{point1:e,point2:t}:i<=e&&e<=r&&t>=r?{point1:e,point2:r}:e<=i&&i<=t&&t<=r?{point1:i,point2:t}:i===e&&r===t||r===e&&i===t?{point1:i,point2:r}:e<=i&&i<=t&&e<=r&&r<=t?{point1:i,point2:r}:null}function Zg(i,r,e,t,n=0){let o=uO(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function Ox(i,r,e){let t=i.x-r,n=i.y-e,o=i.width+2*r,s=i.height+2*e,a=Object.assign({},i);return Object.assign(a,{x:t,y:n,width:o,height:s})}function Rx(i,r){let e=Math.min(i.x,r.x),t=Math.min(i.y,r.y),n=Math.max(i.x+i.width,r.x+r.width),o=Math.max(i.y+i.height,r.y+r.height),s=n-e,a=o-t;return{x:e,y:t,width:s,height:a}}function Lx(i,r){let e=i[0].x,t=i[1].x,n=i[0].y,o=i[1].y,s=r[0].x,a=r[1].x,l=r[0].y,h=r[1].y;if(e===t&&n===o||s===a&&l===h)return null;let d=(h-l)*(t-e)-(a-s)*(o-n);if(d===0)return null;let u=((a-s)*(n-l)-(h-l)*(e-s))/d,p=e+u*(t-e),g=n+u*(o-n);return{x:p,y:g}}function vx(i,r){if(i[0].x===i[1].x){let e=i[0].y<i[1].y?1:-1;return[{x:i[0].x+e*r,y:i[0].y},{x:i[0].x+e*r,y:i[1].y}]}else if(i[0].y===i[1].y){let e=i[0].x<i[1].x?1:-1;return[{y:i[0].y+e*r,x:i[0].x},{y:i[0].y+e*r,x:i[1].x}]}else{let e=Dr(i[0],i[1]),t=Math.atan(-1/e),n=length/2*Math.sin(t),o=length/2*Math.cos(t);return[{x:i[0].x+o,y:i[0].y+n},{x:i[1].x+o,y:i[1].y+n}]}}function wx(i,r){return[vx(i,r),vx(i,-r)]}function fN(i,r,e){if(i[0].x===i[1].x){let t=i[0].y<i[1].y?1:-1;return[r,{x:r.x,y:r.y+t*e}]}else if(i[0].y===i[1].y){let t=i[0].x<i[1].x?1:-1;return[r,{x:r.x+t*e,y:r.y}]}else{let t=Dr(i[0],i[1]),n=Math.atan(-1/t),o=e*Math.sin(n),s=e*Math.cos(n);return[r,{x:r.x+s,y:r.y+o}]}}var vc=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),yN=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),xN=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),bN=(i,r,e,t)=>{let n=Math.abs(e-i),o=Math.abs(t-r),s=Math.SQRT2-1;return n<o?s*n+o:s*o+n};function ol(i){let r=i%360;return r<0&&(r+=360),r}function lO(i,r){return i.x*r.x+i.y*r.y}function Sx(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function hO(i){let r=Sx(i);return r===0?{x:0,y:0}:{x:i.x/r,y:i.y/r}}function AN(i,r,e){e=e*Math.PI/180;let t=Math.cos(e),n=Math.sin(e),o=(i.x-r.x)*t-(i.y-r.y)*n+r.x,s=(i.x-r.x)*n+(i.y-r.y)*t+r.y;return{x:o,y:s}}function Tx(i){let r=i.x+i.width/2,e=i.y+i.height/2,t={x:r,y:e},n=i.r||0,o=i.width/2,s=i.height/2,a=[{x:r-o,y:e-s},{x:r+o,y:e-s},{x:r+o,y:e+s},{x:r-o,y:e+s}];return n===0?a:a.map(l=>AN(l,t,n))}function cO(i){let r=Tx(i),e=[],t={x:r[1].x-r[0].x,y:r[1].y-r[0].y};Sx(t)>0&&e.push(hO({x:-t.y,y:t.x}));let n={x:r[3].x-r[0].x,y:r[3].y-r[0].y};return Sx(n)>0&&e.push(hO({x:-n.y,y:n.x})),e.length===0&&(e.push({x:1,y:0}),e.push({x:0,y:1})),e}function dO(i,r){let e=lO(i,r[0]),t=e;for(let n=1;n<r.length;n++){let o=lO(i,r[n]);o<e?e=o:o>t&&(t=o)}return{min:e,max:t}}function SN(i,r,e,t){return i<=t&&e<=r}function Dx(i,r){if(i.r===0&&r.r===0)return tt(i,r);let e=Tx(i),t=Tx(r),n=[...cO(i),...cO(r)];for(let o of n){let s=dO(o,e),a=dO(o,t);if(!SN(s.min,s.max,a.min,a.max))return!1}return!0}var gO=!0;function U(...i){if(gO&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function Nx(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function Jg(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function TN(i,r,e){i.findIndex(e)===-1&&i.push(r)}function Ix(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function vN(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function Kg(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function qg(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function Nt(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function Me(i,r,e){let t={x:i.x-r.x,y:i.y-r.y},n=Math.cos(e/360*Math.PI*2),o=Math.sin(e/360*Math.PI*2);return{x:t.x*n-t.y*o+r.x,y:t.y*n+t.x*o+r.y,cr:n,sr:o}}function vt(i){if(i==null)return null;let r=i.replace(/^\s\s*/,""),e=/\s/,t=r.length;for(;e.test(r.charAt(--t)););return r.slice(0,t+1)}function Qg(i,r,e,t){if(r.length===0)r.push(i);else{let n=t?-1:1,o=0,s=r.length,a=Math.floor((o+s)/2);for(;s>o;)e(i,r[a])*n<0?s=a:o=a+1,a=Math.floor((o+s)/2);r.splice(a,0,i)}}function Pi(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function ft(i){return{x:i.x,y:i.y}}function Jn(i){return{width:i.width,height:i.height}}function CN(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function em(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Ht=[];for(let i=0;i<256;i++)Ht[i]=(i<16?"0":"")+i.toString(16);function G(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Ht[i&255]+Ht[i>>8&255]+Ht[i>>16&255]+Ht[i>>24&255]+"-"+Ht[r&255]+Ht[r>>8&255]+"-"+Ht[r>>16&15|64]+Ht[r>>24&255]+"-"+Ht[e&63|128]+Ht[e>>8&255]+"-"+Ht[e>>16&255]+Ht[e>>24&255]+Ht[t&255]+Ht[t>>8&255]+Ht[t>>16&255]+Ht[t>>24&255]}function Eo(i=6){return G().substring(0,i-1)}function mO(i){return[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}]}function Mx(i,r){let e=mO(r).map(t=>({p:t,d:Pe(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function De(i,r,e){if(i==null)return null;if(r==="$data"||r==null)return i;let t=r.match(/^\{(.*)\}$/);if(t){let a={},l=t[1].split(",");for(let h=0;h<l.length;h++){let d=l[h].split(":"),u=De(i,d[1]);a[vt(d[0])]=u||d[1].replace(/'/g,"")}return a}r=r.replace(/\['([^']*)'\]/g,".$1");let n=i,o=n,s=null;return r.replace(/([^\.])+/g,(a,l,h,d)=>{if(s!=null)return;let u=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),p=h+a.length>=d.length,g=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let m=g(),E=u[3];e==null?s=m[E]:m[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let m=g();o=m[u[3]]||function(){return m[u[3]]={},m[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function sl(i,r){let e={left:[],right:[]};for(let t=0;t<i.length;t++){let n=i[t];r(n)?e.left.push(n):e.right.push(n)}return e}function Vx(i){return i.filter(r=>r!=null&&vt(r).length>0)}function Gx(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function Pc(i,r,e){let t=e.map((n,o)=>{let[s,a]=[r.x+r.width*n.x,r.y+r.height*n.y],l=Math.sqrt(Math.pow(i.x-s,2)+Math.pow(i.y-a,2));return{p:n,idx:o,distance:l}});return t.sort((n,o)=>n.distance<o.distance?-1:1),t[0]}function vs(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function Cs(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function Cc(i){return Object.prototype.toString.call(i)==="[object Number]"}function X(i){return typeof i=="string"}function mo(i){return typeof i=="boolean"}function ar(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function EO(i){return Object.prototype.toString.call(i)==="[object Date]"}function en(i){return Object.prototype.toString.call(i)==="[object Function]"}function fO(i){return en(i)&&((i==null?void 0:i.toString())||"").startsWith("class")}function PN(i){return en(i)&&i.name!=null&&i.name.length>0}function al(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function ll(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null)return!1;for(let e in i){let t=i[e],n=r[e];if(!pO(t,n))return!1}return!0}function _N(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function lt(i){if(X(i))return""+i;if(mo(i))return!!i;if(EO(i))return new Date(i.getTime());if(en(i))return i;if(Array.isArray(i))return i.map(r=>lt(r));if(ar(i)){let r={};for(let e in i)r[e]=lt(i[e]);return r}else return i}function bn(i,r,e,t){let n={},o,s,a={};for(e=e||[],t=t||[],s=0;s<e.length;s++)n[e[s]]=!0;for(s=0;s<t.length;s++)a[t[s]]=!0;let l=lt(i);for(s in r)if(l[s]==null||a[s])l[s]=r[s];else if(n[s])o=[],o.push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(r[s]),l[s]=o;else if(X(r[s])||mo(r[s])||en(r[s])||Cc(r[s]))l[s]=r[s];else if(Array.isArray(r[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,r[s]),l[s]=o;else if(ar(r[s])){ar(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function pO(i,r){if(i!=null&&r==null)return!1;if((i==null||X(i)||mo(i)||Cc(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!yO(i,r))return!1}else return!1;else if(ar(i))if(ar(i)){if(!ll(i,r))return!1}else return!1;return!0}function yO(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null||i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(!pO(i[e],r[e]))return!1;return!0}function $x(i,r){return i.x===r.x&&i.y===r.y}function Bx(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=Me(t,n.c,n.r)}),t}function Fx(i,r){return r.forEach(e=>{i=Me(i,e.c,e.r)}),i}function tm(i,r,e){if(i==null)return;let t=i,n=t;return r.replace(/([^\.])+/g,(o,s,a,l)=>{let h=o.match(/([^\[0-9]+){1}(\[)([0-9+])/),d=a+o.length>=l.length,u=function(){return n[h[1]]||function(){return n[h[1]]=[],n[h[1]]}()};if(d)h?u()[h[3]]=e:n[o]=e;else if(h){let p=u();n=p[h[3]]||function(){return p[h[3]]={},p[h[3]]}()}else n=n[o]||function(){return n[o]={},n[o]}();return""}),i}function fo(i,r,e,t){let n=s=>{let a=s.match(/(\${.*?})/g);if(a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-1)]||"";h!=null&&(s=s.replace(a[l],h))}if(a=s.match(/({{.*?}})/g),a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-2)]||"";h!=null&&(s=s.replace(a[l],h))}return s},o=s=>{if(s!=null){if(fO(s))return s;if(X(s))return n(s);if(en(s)&&!t&&(e==null||(s.name||"").indexOf(e)===0))return s(r);if(Array.isArray(s)){let a=[];for(let l=0;l<s.length;l++)a.push(o(s[l]));return a}else if(ar(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var Ts=class{constructor(r,...e){this.sorter=r;c(this,"stack");this.stack=e.slice(),this.stack.sort(this.sorter)}get length(){return this.stack.length}add(r){Qg(r,this.stack,this.sorter,!0)}update(r){this.delete(r),this.add(r)}pop(){return this.stack.pop()}delete(r){let e=this.stack.indexOf(r);e>-1&&this.stack.splice(e,1)}head(){return this.stack.length===0?null:this.stack[0]}peek(){return this.stack.length===0?null:this.stack[this.stack.length-1]}isEmpty(){return this.stack.length===0}clear(){this.stack.length=0}};function dl(i){return j(i)?i.getParent().id:i.getFullId()}function Kn(i){return j(i)?i.getParent():i}function J(i){return i!=null&&i.objectType===ce.objectType}function sm(i){return J(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===se.objectType}function am(i){return Y(i)&&i.group!=null}function rt(i){return i!=null&&i.objectType===Ue.objectType}function j(i){return i!=null&&i.objectType===de.objectType}function zx(i){return i.objectType===ce.objectType||i.objectType===se.objectType}function _i(i){return J(i)||Y(i)||j(i)}function ON(i,...r){let e=dl(i.source),t=dl(i.target);return r.find(n=>e===n.id||t===n.id)!=null}function lm(i){return i.id}var RN=".";function hl(i,r){if(r==null)return i.edges;{let e=[];for(let t=0;t<i.edges.length;t++)r(i.edges[t])&&e.push(i.edges[t]);return e}}function xO(i,r){let e=hl(i,r).slice(0);if(J(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,hl(i.ports[t],r));return e}function Ux(i){return hl(i,r=>r.source==i)}function Yx(i){return hl(i,r=>r.target==i)}function LN(i){let r=Ux(i).slice(0);if(J(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Ux(i.ports[e]));return r}function wN(i){let r=Yx(i).slice(0);if(J(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Yx(i.ports[e]));return r}function hm(i,r,e,t){let n=new Set,o=(a,l)=>{let h=l.source===a||l.target===a;return h?t?t(l):h:!1},s=a=>{a.members.forEach(l=>{let h=o.bind(null,l);(e?xO(l,h):hl(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function Lc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function An(i){let r=Kn(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function ke(i,r){return i==null||r==null?!1:An(i).indexOf(r)!==-1}function Xx(i,r){let e=!1,t=n=>{for(let o=0;o<n.members.length;o++)if(Y(n.members[o]))if(n.members[o].id===i.id){e=!0;break}else t(n.members[o])};return t(r),e}function Ps(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function DN(i,r){let t=!(J(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function NN(i,r){let t=!(J(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function IN(i,r){let e=new Set,t=J(i)||Y(i),n=!t||r?i.getSourceEdges():i.getAllSourceEdges(),o=!t||r?i.getTargetEdges():i.getAllTargetEdges();return n.forEach(s=>e.add(s.target)),o.forEach(s=>e.add(s.source)),Array.from(e)}function jx(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var cl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"we",new Map);c(this,"Vr",new Map);c(this,"Ue",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"Kt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"Bo",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.Kt=r.defaultIdFunction||lm,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||RN}Ea(r){delete this.Bo[r.id]}fa(r){this.Bo[r.id]=r}iE(){this.Bo={}}getIdFunction(){return this.Kt}setIdFunction(r){this.Kt=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?G():typeof r=="string"?r:(e||this.getIdFunction())(r)||G()}getTopLevelElements(){return this.Bo}setEnableSubgraphs(r){this.enableSubgraphs=r}setPortSeparator(r){this.portSeparator=r}getPortSeparator(){return this.portSeparator}splitPortId(r){return r!=null?r.split(this.portSeparator):[]}getVertexByPortId(r){let e=this.splitPortId(r);if(e.length===2)return this.we.get(e[0])||this.Ue.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===de||r.constructor===ce||r.constructor===se)return r;let s=r;if(t=this.Kt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.we.has(s))return this.we.get(s);if(this.Ue.has(s))return this.Ue.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.we.get(l)||this.Ue.get(l);if(a.length===2&&h!=null){let d=h.getPort(a[1]);return d==null&&e&&(d=h.$addPort(a[1])),d}else return h};if(n.length==1)return o(n[0]);if(n.length>1&&n.length%2==0)throw"Subgraph path format error.";{let s=null,a=null;for(let l=0;l<n.length-1;l+=2)s=o(n[l]),a=s.getGraph(n[l+1]);return a.getVertex(n[n.length-1])}}clear(){this.nodes.length=0,this.groups.length=0,this.we.clear(),this.Vr.clear(),this.Ue.clear(),this.iE()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this.Vr.size}addEdge(r,e,t){let n=r.directed==null?this.defaultDirected===!0:r.directed!==!1,o=r.cost||this.defaultCost,s=this.getVertex(r.source,!0),a=this.getVertex(r.target,!0);if(e=e||this.getId(r.data,t),s==null||s.objectType==null)throw new TypeError("Unknown source node ["+r.source+"]");if(a==null||a.objectType==null)throw new TypeError("Unknown target node ["+r.target+"]");let l=new Ue({source:s,target:a,cost:o,directed:n,data:r.data||{},id:e,graph:this,transient:r.transient,anchors:r.anchors});return l.source.$addEdge(l),l.source!==l.target&&l.target.$addEdge(l),this.Vr.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new ce(this,r||{},e||this.Kt);return this.we.has(t.id)?null:(this.nodes.push(t),this.we.set(t.id,t),this.fa(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.Kt)}addGroup(r,e){let t=new se(this,r,e||this.Kt);return this.Ue.has(t.id)?this.Ue.get(t.id):(this.groups.push(t),this.Ue.set(t.id,t),this.fa(t),t)}getGroupCount(){return this.groups.length}getGroupAt(r){return this.groups[r]}getGroups(){return this.groups}$addMemberToGroup(r,e){let t=typeof e=="string"?this.Ue.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.Ea(n))}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.fa(e))}getGroup(r){return typeof r=="string"?this.Ue.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Ue.get(r):r,edges:[],nodes:[],nestedGroups:[],children:[]};if(t.group){t.parentGroup=t.group.group,t.children=t.group.members.slice();let n;if(e){let{left:l,right:h}=sl(t.group.getMembers(),d=>Y(d));l.forEach(d=>{t.nestedGroups.push(this.deleteGroup(d,!0))}),h.forEach(d=>{t.nodes.push(this.deleteNode(d))})}else t.group.getMembers().forEach(l=>delete l.group);t.group.members.length=0,t.edges=t.group.getAllDirectEdges().slice();let o=t.edges.length;for(n=0;n<o;n++)this.deleteEdge(t.edges[n]);let s=t.group.getPorts();for(let l=0;l<s.length;l++)this.deletePort(s[l]);this.Ue.delete(t.group.id);let a=-1;for(let l=0;l<this.groups.length;l++)if(this.groups[l].id===t.group.id){a=l;break}a>-1&&this.groups.splice(a,1),t.group.group!=null&&t.group.group.$removeMember(r),this.Ea(t.group)}return t}deletePort(r){let e=r.getEdges();for(let t=0;t<e.length;t++)this.deleteEdge(e[t]);return e}$_removeNodeFromCache(r){let e=-1;for(let t=0;t<this.nodes.length;t++)if(this.nodes[t].id===r.id){e=t;break}e>-1&&(this.nodes.splice(e,1),r.group!=null&&r.group.$removeMember(r)),this.we.delete(r.id)}deleteNode(r){let e=this.getVertex(r),t={node:null,edges:[],parentGroup:null};if(e){t.node=e,t.parentGroup=e.group;let n=e.getPorts();for(let s=0;s<n.length;s++)this.deletePort(n[s]);let o=e;this.$_removeNodeFromCache(o),t.edges=e.getEdges().slice();for(let s=0;s<t.edges.length;s++)this.deleteEdge(t.edges[s]);this.Ea(e)}return t}deleteEdge(r){if(r=this.getEdge(r),r==null)return;let e=this.getVertex(r.source,!1);e&&e.$deleteEdge(r);let t=this.getVertex(r.target,!1);t&&t.$deleteEdge(r),this.Vr.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Ue)return r;let e=r;if(r=this.Kt(r),typeof r!="string")return e}return this.Vr.get(r)}}getEdges(r){r=r||{};let e=r.source!=null,t=r.target!=null,n=r.node?this.getVertex(r.node):null,o=r.filter||function(){return!0},s=d=>(!e||(r.source===!0?d.source===n:d.source!==n))&&(!t||(r.target===!0?d.target===n:d.target!==n)),a=[],l=d=>{o(d)&&s(d)&&a.push(d)},h;if(r.node){let u=this.getVertex(r.node).getAllEdges();for(h=0;h<u.length;h++)l(u[h])}else this.Vr.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this.Vr.forEach((e,t)=>r.push(e)),r}renamePort(r,e){return r.getParent().$renamePort(r,e)?(r.id=e,!0):!1}findPath(r,e,t,n,o){let s=this.getVertex(r),a=this.getVertex(e);return Sc({graph:this,source:s,target:a,strict:t!==!1,nodeFilter:n,edgeFilter:o})}getDistance(r,e,t){return this.findPath(r,e,t).pathDistance}setTarget(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.target;return r.target.$deleteEdge(r),r.target=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}setSource(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.source;return r.source.$deleteEdge(r),r.source=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}printPath(r,e){let t=this.getVertex(r),n=this.getVertex(e),o=this.findPath(t,n).path,s="["+t.id+" - "+n.id+"] : ";for(let a=0;a<o.length;a++)s=s+"{ vertex:"+o[a].vertex.id+", cost:"+o[a].cost+", edge: "+(o[a].edge&&o[a].edge.getId())+" } ";return s}getDiameter(r){let e=0;for(let t=0;t<this.nodes.length;t++)for(let n=0;n<this.nodes.length;n++)if(n!=t){let o=Sc({graph:this,source:this.nodes[t],target:this.nodes[n]});if(o.path==null||o.path.length==0){if(!r)return 1/0}else e=Math.max(e,o.pathDistance)}return e}getCentrality(r){let e=this.getVertex(r);return(e.getIndegreeCentrality()+e.getOutdegreeCentrality())/(this.getVertexCount()-1)}getIndegreeCentrality(r){return this.getVertex(r).getIndegreeCentrality()/(this.getVertexCount()-1)}getOutdegreeCentrality(r){return this.getVertex(r).getOutdegreeCentrality()/(this.getVertexCount()-1)}getCloseness(r){return 1/this.getFarness(r)}getFarness(r){let e=this.getVertex(r),t=Sc({graph:this,source:e,target:e,processAll:!0}),n=0;for(let o in t.dist)n+=t.dist[o];return n/(this.getVertexCount()-1)}getBetweenness(r){let e=this.getVertexCount(),t=(e-1)*(e-2)/2,n=0,o=0,s=(h,d,u,p,g)=>{let m=u.parents[h][d];if(m.length==0){let E=p.slice();E.unshift(h),g.push(E)}else for(let E=0;E<m.length;E++)if(p.indexOf(m[E][0].id)==-1){let y=p.slice();y.unshift(m[E][0].id),s(h,m[E][0].id,u,y,g)}},a=this.getVertex(r),l=Ax({graph:this,focus:a});for(let h in l.paths)for(let d in l.paths[h])if(h!=d){let u=[],p=0;s(h,d,l,[d],u);for(let g=0;g<u.length;g++){let m=u[g].indexOf(a.id);m>0&&m<u[g].length-1&&p++}n+=p/u.length,o+=p}return n/t}inspect(){let r="";for(let e=0;e<this.nodes.length;e++)r+=this.nodes[e].inspect()+`
|
|
2
|
-
`;return r}serialize(){let r={nodes:[],edges:[],groups:[]},e,t,n;for(let o=0;o<this.nodes.length;o++)if(e=this.nodes[o],!e.transient){r.nodes.push(Object.assign({},e.data)),t=e.getAllEdges();for(let s=0;s<t.length;s++)if(t[s].source==e||t[s].source.objectType===de.objectType&&t[s].source.getParent()==e){let a={source:t[s].source.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}for(let o=0;o<this.groups.length;o++){n=this.groups[o],r.groups.push(Object.assign({},n.data)),t=n.getEdges();for(let s=0;s<t.length;s++)if(t[s].source===n){let a={source:n.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}return r}getClusters(){return this.
|
|
1
|
+
var Tc=Object.defineProperty,oN=Object.defineProperties,aO=Object.getOwnPropertyDescriptor,sN=Object.getOwnPropertyDescriptors,aN=Object.getOwnPropertyNames,sO=Object.getOwnPropertySymbols;var lO=Object.prototype.hasOwnProperty,lN=Object.prototype.propertyIsEnumerable;var Ax=(i,r,e)=>r in i?Tc(i,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[r]=e,vr=(i,r)=>{for(var e in r||(r={}))lO.call(r,e)&&Ax(i,e,r[e]);if(sO)for(var e of sO(r))lN.call(r,e)&&Ax(i,e,r[e]);return i},Wg=(i,r)=>oN(i,sN(r));var hN=(i,r)=>{for(var e in r)Tc(i,e,{get:r[e],enumerable:!0})},cN=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of aN(r))!lO.call(i,n)&&n!==e&&Tc(i,n,{get:()=>r[n],enumerable:!(t=aO(r,n))||t.enumerable});return i};var dN=i=>cN(Tc({},"__esModule",{value:!0}),i),He=(i,r,e,t)=>{for(var n=t>1?void 0:t?aO(r,e):r,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&Tc(r,e,n),n};var c=(i,r,e)=>(Ax(i,typeof r!="symbol"?r+"":r,e),e);var FB={};hN(FB,{$__proxyEdge:()=>yT,$__unproxyEdge:()=>fT,$_createCircularSvgHandles:()=>QC,$_createRectangularSvgHandles:()=>qC,$_createSvg:()=>Ge,$_setSkeletonPosition:()=>Ry,$addOverlay:()=>Wl,$appendAtIndex:()=>aa,$arcBridge:()=>aP,$attr:()=>ie,$autoCalculateChartScale:()=>ac,$calculateChartScaleWithStep:()=>lc,$calculateChartScaleWithSteps:()=>w_,$createConnection:()=>ET,$createGradient:()=>CT,$createMarker:()=>yc,$defaultOrthogonalPathCompute:()=>bS,$defaultStraightPathCompute:()=>GR,$doImageExport:()=>hy,$dotBridge:()=>lP,$gapBridge:()=>hP,$getConnectorPathData:()=>cS,$getMarker:()=>zg,$getOverlay:()=>ZE,$getOverlays:()=>rL,$isCompoundAction:()=>zO,$isGroupSizeChangedAction:()=>$b,$isMoveAction:()=>Gb,$isUpdateAction:()=>Vb,$makeAndAppendCircularHandle:()=>Wv,$makeAndAppendRectangularHandle:()=>Zv,$makeCircularHandle:()=>qf,$makeFieldKey:()=>as,$makeRectangularHandle:()=>f0,$prepareFontSpec:()=>Ai,$rewriteOrthogonalConnector:()=>PS,$spaceLabels:()=>N_,$svgNode:()=>M,$updateLabelOverlayFont:()=>YE,ABSOLUTE:()=>Qe,ACTION_ADD:()=>KS,ACTION_REMOVE:()=>qS,ADD_CLASS_ACTION:()=>sV,ALL_GROUPS_RELAYOUT:()=>cI,ANCHOR_PLACEHOLDER_SELECTOR:()=>Kf,ANIMATION_PHASE_CANCELLED:()=>Da,ANIMATION_PHASE_FINISHED:()=>Na,ANIMATION_PHASE_INITIALIZED:()=>uP,ANIMATION_PHASE_TRAVERSING_EDGE:()=>pP,ANIMATION_PHASE_TRAVERSING_END:()=>My,ANIMATION_PHASE_TRAVERSING_START:()=>Iy,ANIM_SURFACE_ELEMENT_FLASH:()=>nv,APPEND_TO_CURRENT:()=>ut,AStarGrid:()=>Is,ATTRIBUTE_CHART_CATEGORY:()=>kn,ATTRIBUTE_CHART_FILTERED_SERIES:()=>OB,ATTRIBUTE_CHART_SERIES:()=>Et,ATTRIBUTE_CHART_STACK:()=>Mg,ATTRIBUTE_CHART_STACK_TOTAL:()=>Vg,ATTRIBUTE_CHART_VALUE:()=>Gg,ATTRIBUTE_CLASS:()=>RA,ATTRIBUTE_COLOR_PICKER_MAX_COLORS:()=>gw,ATTRIBUTE_CONTAINER:()=>ff,ATTRIBUTE_CONTEXT:()=>PA,ATTRIBUTE_CONTROLS_ORIENTATION:()=>Y0,ATTRIBUTE_DATA_SHAPE_ID:()=>lg,ATTRIBUTE_DEFAULT:()=>_A,ATTRIBUTE_ELEMENTS_DRAGGABLE:()=>DS,ATTRIBUTE_FILL:()=>mT,ATTRIBUTE_GROUP:()=>DM,ATTRIBUTE_GROUP_COLLAPSED_CONTENT:()=>ku,ATTRIBUTE_GROUP_CONTENT:()=>yf,ATTRIBUTE_GROUP_EXPANDED_CONTENT:()=>Hu,ATTRIBUTE_ICON_ID:()=>KL,ATTRIBUTE_ICON_KEY:()=>Dv,ATTRIBUTE_ICON_SIZE:()=>wv,ATTRIBUTE_IS_GROUP:()=>ql,ATTRIBUTE_LOOKUP:()=>Zm,ATTRIBUTE_MANAGED:()=>gt,ATTRIBUTE_NOT_DRAGGABLE:()=>Fl,ATTRIBUTE_ORIENTATION:()=>JL,ATTRIBUTE_ORIGIN:()=>dp,ATTRIBUTE_ORIGIN_X:()=>Rv,ATTRIBUTE_ORIGIN_Y:()=>Lv,ATTRIBUTE_POPUP_POSITION:()=>_P,ATTRIBUTE_RESET_SELECTION:()=>fC,ATTRIBUTE_STROKE:()=>TV,ATTRIBUTE_STROKE_DASHARRAY:()=>ef,ATTRIBUTE_STROKE_DASHOFFSET:()=>AV,ATTRIBUTE_STROKE_LINECAP:()=>xV,ATTRIBUTE_STROKE_LINEJOIN:()=>yV,ATTRIBUTE_STROKE_MITERLIMIT:()=>bV,ATTRIBUTE_STROKE_OPACITY:()=>SV,ATTRIBUTE_STROKE_WIDTH:()=>vV,ATTRIBUTE_STYLE:()=>LA,ATTRIBUTE_SUPPRESS_VERTEX_EVENTS:()=>wS,ATTRIBUTE_TABINDEX:()=>NE,ATTRIBUTE_TEXT_ANCHOR:()=>CV,ATTRIBUTE_TRANSFORM:()=>ui,ATTRIBUTE_VALUE_NON_SCALING_STROKE:()=>Du,ATTRIBUTE_VECTOR_EFFECT:()=>wu,ATTRIBUTE_VERSION:()=>EV,ATTRIBUTE_VJS_ALLOW_LOOPBACK:()=>IE,ATTRIBUTE_VJS_EDGE:()=>et,ATTRIBUTE_VJS_EDGE_TYPE:()=>uu,ATTRIBUTE_VJS_ENABLED:()=>Er,ATTRIBUTE_VJS_MAGNET:()=>gu,ATTRIBUTE_VJS_MINIVIEW_TYPE:()=>oC,ATTRIBUTE_VJS_NODE_ID:()=>sy,ATTRIBUTE_VJS_OVERLAY_ID:()=>mu,ATTRIBUTE_VJS_PORT:()=>hn,ATTRIBUTE_VJS_PORT_ID:()=>Ul,ATTRIBUTE_VJS_PORT_TYPE:()=>Wr,ATTRIBUTE_VJS_SCOPE:()=>Jo,ATTRIBUTE_VJS_SOURCE:()=>NS,ATTRIBUTE_VJS_SOURCE_PORT:()=>ta,ATTRIBUTE_VJS_SOURCE_PORT_ID:()=>ME,ATTRIBUTE_VJS_SOURCE_PORT_TYPE:()=>ji,ATTRIBUTE_VJS_TARGET:()=>Yo,ATTRIBUTE_VJS_TARGET_PORT:()=>zo,ATTRIBUTE_VJS_TARGET_PORT_ID:()=>pu,ATTRIBUTE_VJS_TARGET_PORT_TYPE:()=>Hi,ATTRIBUTE_VJS_VERTEX:()=>te,ATTRIBUTE_XMLNS:()=>fV,ATT_DATA_DIR:()=>wa,ATT_VJS_RESIZABLE:()=>_y,ATT_VJS_ROTATABLE:()=>Oy,ATT_VJS_X_RESIZE:()=>Cy,ATT_VJS_Y_RESIZE:()=>Py,AXIS_POSITION_END:()=>Si,AXIS_POSITION_START:()=>or,AbsoluteBackedLayout:()=>qn,AbsoluteLayout:()=>xo,AbstractEntry:()=>Fi,AbstractHierarchicalLayout:()=>Os,AbstractLayout:()=>Ir,AbstractLayoutAdapter:()=>Ic,AddGroupMemberAction:()=>md,AnchorLocations:()=>Nl,ArcSegmentHandler:()=>su,AreaChart:()=>H_,AreaPlot:()=>xc,ArrayBasedSeries:()=>Ua,ArrowOverlay:()=>Or,AssignLayersStage:()=>Xc,AutoSaver:()=>bl,AvailableBackgrounds:()=>io,BASIC_SHAPES:()=>Mv,BLOCK:()=>Pr,BOTTOM:()=>ht,BackgroundPlugin:()=>os,BalloonLayout:()=>Yc,BarChart:()=>W_,BarPlot:()=>wr,Base:()=>Lc,BaseBrowserUIPlugin:()=>Se,BaseChart:()=>co,BaseDomUiLayoutAdapter:()=>ua,BaseSeriesBasedChartDataSource:()=>gc,BezierEditor:()=>xi,BezierSegmentHandler:()=>TR,BlankDataSource:()=>Fa,BlankScale:()=>fc,BowtieLayout:()=>xl,BrowserUI:()=>ga,BrowserUIClipboard:()=>Ep,BrowserUIModel:()=>jy,BrowserUiRecado:()=>es,BubbleChart:()=>Z_,BubbleChartSeries:()=>Ex,CENTER:()=>It,CHART_AXIS_TITLE_ALIGN_END:()=>B_,CHART_AXIS_TITLE_ALIGN_MIDDLE:()=>Ba,CHART_AXIS_TITLE_ALIGN_START:()=>$_,CHART_TITLE_ALIGN_LEFT:()=>CB,CHART_TITLE_ALIGN_MIDDLE:()=>vB,CHART_TITLE_ALIGN_RIGHT:()=>PB,CHART_TITLE_PLACEMENT_BOTTOM:()=>pc,CHART_TITLE_PLACEMENT_TOP:()=>RD,CLASS_ANCHOR_CANDIDATE:()=>tG,CLASS_ANCHOR_PLACEHOLDER:()=>ba,CLASS_AREA_CHART:()=>L_,CLASS_AREA_CHART_AREA:()=>Og,CLASS_BACKGROUND:()=>v0,CLASS_BACKGROUND_BORDER:()=>C0,CLASS_BACKGROUND_GRID:()=>is,CLASS_BACKGROUND_GRID_DOT_MAJOR:()=>Dp,CLASS_BACKGROUND_GRID_DOT_MINOR:()=>O0,CLASS_BACKGROUND_GRID_MAJOR:()=>_0,CLASS_BACKGROUND_GRID_MINOR:()=>P0,CLASS_BACKGROUND_TILE:()=>b0,CLASS_BAR_CHART:()=>y_,CLASS_BAR_CHART_BAR:()=>x_,CLASS_BEZIER_GUIDELINE:()=>zP,CLASS_BEZIER_HANDLE:()=>Kh,CLASS_BEZIER_HANDLE_CONTROL_POINT:()=>Xy,CLASS_BEZIER_HANDLE_CONTROL_POINT_1:()=>UP,CLASS_BEZIER_HANDLE_CONTROL_POINT_2:()=>YP,CLASS_BUBBLE_CHART:()=>b_,CLASS_BUBBLE_CHART_DATA_POINT:()=>A_,CLASS_CHART_AXIS:()=>$a,CLASS_CHART_AXIS_LABELS:()=>qy,CLASS_CHART_AXIS_LINE:()=>Qy,CLASS_CHART_AXIS_TITLE:()=>ex,CLASS_CHART_BACKGROUND:()=>h_,CLASS_CHART_BODY:()=>ic,CLASS_CHART_CROSSHAIR:()=>oc,CLASS_CHART_CROSSHAIR_LABEL:()=>sc,CLASS_CHART_EMPTY:()=>tx,CLASS_CHART_GRIDLINE:()=>nx,CLASS_CHART_GRIDLINES:()=>rx,CLASS_CHART_LEGEND:()=>d_,CLASS_CHART_LEGEND_DOT:()=>p_,CLASS_CHART_LEGEND_ITEM:()=>vg,CLASS_CHART_LEGEND_LABEL:()=>u_,CLASS_CHART_PLOT_BACKGROUND:()=>Ga,CLASS_CHART_POINT:()=>xn,CLASS_CHART_POINT_HIT_AREA:()=>_g,CLASS_CHART_SCALE_LABEL:()=>O_,CLASS_CHART_SERIES:()=>c_,CLASS_CHART_SUBTITLE:()=>C_,CLASS_CHART_TITLE:()=>v_,CLASS_CHART_X_AXIS:()=>Cg,CLASS_CHART_X_AXIS_TITLE:()=>m_,CLASS_CHART_Y_AXIS:()=>Pg,CLASS_CHART_Y_AXIS_TITLE:()=>g_,CLASS_COLOR_PICKER:()=>uw,CLASS_COLOR_PICKER_SWATCH:()=>PC,CLASS_COLOR_PICKER_SWATCHES:()=>CC,CLASS_COLUMN_CHART:()=>E_,CLASS_COLUMN_CHART_COLUMN:()=>f_,CLASS_CONNECTED:()=>Yl,CLASS_CONNECTION_EDIT:()=>Jf,CLASS_CONNECTOR:()=>ra,CLASS_CONNECTOR_OUTLINE:()=>IS,CLASS_CONNECTOR_PATH:()=>Eu,CLASS_CONNECTOR_SOURCE_DRAG:()=>Qi,CLASS_CONNECTOR_TARGET_DRAG:()=>eo,CLASS_CONNECTOR_TRANSIENT:()=>MS,CLASS_CONNECTOR_TRANSIENT_DRAG:()=>Ev,CLASS_CONTROLS:()=>Mp,CLASS_CONTROLS_CLEAR:()=>uC,CLASS_CONTROLS_PAN_MODE:()=>sC,CLASS_CONTROLS_REDO:()=>dC,CLASS_CONTROLS_RESET_SELECTION:()=>gC,CLASS_CONTROLS_SELECT_MODE:()=>ay,CLASS_CONTROLS_UNDO:()=>cC,CLASS_CONTROLS_ZOOM_IN:()=>lC,CLASS_CONTROLS_ZOOM_OUT:()=>hC,CLASS_CONTROLS_ZOOM_TO_FIT:()=>aC,CLASS_COPY_PASTE_CONTROLS:()=>cG,CLASS_CROSSHAIR_CATEGORY_AXIS:()=>__,CLASS_CROSSHAIR_VALUE_AXIS:()=>P_,CLASS_DEFAULT_GROUP:()=>Vf,CLASS_DEFAULT_NODE:()=>Mf,CLASS_DIAGRAM_CELL_TOOL:()=>Uy,CLASS_DIAGRAM_CLONE_CELL:()=>TP,CLASS_DIAGRAM_DELETE_CELL:()=>vP,CLASS_DIAGRAM_GROUP:()=>Fy,CLASS_DIAGRAM_LINK_CELL:()=>Ow,CLASS_DIAGRAM_NODE:()=>By,CLASS_DRAG_ACTIVE:()=>fr,CLASS_DRAG_HOVER:()=>yr,CLASS_DRAG_HOVER_CANNOT_DROP:()=>mh,CLASS_DRAG_ORIGINAL_GROUP:()=>Gf,CLASS_DUMMY_VERTEX:()=>$S,CLASS_EDGE_CLICK_ENTRY:()=>Ff,CLASS_EDGE_DELETE_BUTTON:()=>ia,CLASS_EDGE_DELETE_BUTTON_INTERNAL:()=>yu,CLASS_EDGE_GUIDELINE:()=>Op,CLASS_EDGE_RELOCATING:()=>Nf,CLASS_EDGE_TYPE_PICKER:()=>Ew,CLASS_EDGE_TYPE_PICKER_SELECTED:()=>Wp,CLASS_EDGE_WILL_RELOCATE:()=>ep,CLASS_ELASTIC_GROUP_RESIZE:()=>L0,CLASS_ELEMENT_DRAGGING:()=>ch,CLASS_EXPORT_CANCEL:()=>Bp,CLASS_EXPORT_CONTROLS:()=>pC,CLASS_EXPORT_DIMENSIONS:()=>xC,CLASS_EXPORT_DOWNLOAD_TOOLS:()=>bC,CLASS_EXPORT_OVERLAY:()=>$p,CLASS_EXPORT_UNDERLAY:()=>Gp,CLASS_GAUGE_CHART:()=>ZD,CLASS_GAUGE_CHART_LABEL:()=>qD,CLASS_GAUGE_CHART_NEEDLE:()=>QD,CLASS_GAUGE_CHART_NEEDLE_PIVOT:()=>eN,CLASS_GAUGE_CHART_TICK:()=>KD,CLASS_GAUGE_CHART_TRACK:()=>JD,CLASS_GAUGE_CHART_ZONE:()=>J_,CLASS_GROUP:()=>Xo,CLASS_GROUP_CHILD_ELEMENT_DRAGGING:()=>Df,CLASS_GROUP_COLLAPSED:()=>VE,CLASS_GROUP_EXPANDED:()=>GE,CLASS_HOVER:()=>Eh,CLASS_INSPECTOR:()=>dw,CLASS_INSPECTOR_ACTIVE:()=>TC,CLASS_INSPECTOR_CLOSE:()=>vC,CLASS_INSPECTOR_INACTIVE:()=>jp,CLASS_LABEL_OVERLAY:()=>VS,CLASS_LASSO:()=>iv,CLASS_LASSO_MASK:()=>uh,CLASS_LASSO_MASK_BOTTOM:()=>lv,CLASS_LASSO_MASK_LEFT:()=>ov,CLASS_LASSO_MASK_RIGHT:()=>av,CLASS_LASSO_MASK_TOP:()=>sv,CLASS_LINE_CHART:()=>R_,CLASS_LINE_CROSSING_BRIDGE:()=>rP,CLASS_LINE_CROSSING_BRIDGE_ARCH:()=>sP,CLASS_LINE_CROSSING_BRIDGE_DOT:()=>oP,CLASS_LINE_CROSSING_BRIDGE_GAP:()=>MG,CLASS_LINE_CROSSING_BRIDGE_HORIZONTAL:()=>iP,CLASS_LINE_CROSSING_BRIDGE_VERTICAL:()=>nP,CLASS_MINIVIEW:()=>tp,CLASS_MINIVIEW_CANVAS:()=>hv,CLASS_MINIVIEW_CLICK_TO_CENTER:()=>mv,CLASS_MINIVIEW_COLLAPSE:()=>gv,CLASS_MINIVIEW_COLLAPSED:()=>rp,CLASS_MINIVIEW_ELEMENT:()=>uv,CLASS_MINIVIEW_GROUP_ELEMENT:()=>pv,CLASS_MINIVIEW_LASSO:()=>dv,CLASS_MINIVIEW_PANNER:()=>cv,CLASS_MINIVIEW_PANNING:()=>If,CLASS_MINIVIEW_SELECTED_ELEMENT:()=>ph,CLASS_MOST_RECENTLY_DRAGGED:()=>dh,CLASS_NODE:()=>ki,CLASS_ORTHOGONAL_HANDLE:()=>IP,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE:()=>pg,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_HORIZONTAL:()=>VP,CLASS_ORTHOGONAL_SEGMENT_DRAG_HANDLE_VERTICAL:()=>MP,CLASS_OVERLAY:()=>na,CLASS_OVERLAY_HIDE:()=>zl,CLASS_PALETTE:()=>Vy,CLASS_PALETTE_CURRENT_SHAPE_TYPE:()=>np,CLASS_PALETTE_DRAG_ACTIVE:()=>fv,CLASS_PALETTE_DRAG_HOVER:()=>yv,CLASS_PALETTE_DRAG_HOVER_CANNOT_DROP:()=>xv,CLASS_PALETTE_ELEMENT_CURRENT:()=>bv,CLASS_PALETTE_SELECTED_ELEMENT:()=>mn,CLASS_PALETTE_SET:()=>ag,CLASS_PALETTE_SET_FILTER:()=>kh,CLASS_PALETTE_SET_SHAPES:()=>$y,CLASS_PALETTE_SET_TITLE:()=>gP,CLASS_PALETTE_SHAPE:()=>Wh,CLASS_PALETTE_SHAPE_LABEL:()=>Gy,CLASS_PALETTE_TAP_MODE_ACTIVE:()=>gh,CLASS_PALETTE_VERTEX_DRAWING_LASSO:()=>mP,CLASS_PAN_ZOOM_CANVAS:()=>u0,CLASS_PAN_ZOOM_VIEWPORT:()=>d0,CLASS_PAPER:()=>FT,CLASS_PAPER_CANVAS:()=>YT,CLASS_PAPER_NODE:()=>c1,CLASS_PAPER_NO_SCALE:()=>UT,CLASS_PIE_CHART:()=>tN,CLASS_PIE_SLICE:()=>Xg,CLASS_PIE_SLICE_SELECTED:()=>Q_,CLASS_PORT:()=>GS,CLASS_RESIZE_BORDER:()=>ds,CLASS_RESIZE_BORDER_BOTTOM:()=>WC,CLASS_RESIZE_BORDER_LEFT:()=>JC,CLASS_RESIZE_BORDER_RIGHT:()=>KC,CLASS_RESIZE_BORDER_TOP:()=>ZC,CLASS_RESIZE_FRAME:()=>kC,CLASS_RESIZE_HANDLE:()=>Tt,CLASS_RESIZE_HANDLE_ACTIVE:()=>Ey,CLASS_RESIZE_HANDLE_B:()=>Sy,CLASS_RESIZE_HANDLE_BL:()=>yy,CLASS_RESIZE_HANDLE_BR:()=>by,CLASS_RESIZE_HANDLE_L:()=>Ty,CLASS_RESIZE_HANDLE_R:()=>vy,CLASS_RESIZE_HANDLE_T:()=>Ay,CLASS_RESIZE_HANDLE_TL:()=>fy,CLASS_RESIZE_HANDLE_TR:()=>xy,CLASS_RESIZE_SKELETON:()=>XC,CLASS_RESIZE_SKELETON_BORDERS:()=>jC,CLASS_RESIZE_SKELETON_BORDERS_VISIBLE:()=>HC,CLASS_ROTATE_HANDLE:()=>Xh,CLASS_ROTATE_LEADER:()=>eg,CLASS_SANKEY_CHART:()=>iN,CLASS_SANKEY_EDGE:()=>yx,CLASS_SANKEY_LABEL:()=>bx,CLASS_SANKEY_NODE:()=>xx,CLASS_SANKEY_SELECTED:()=>po,CLASS_SANKEY_UNSELECTED:()=>tn,CLASS_SCATTER_CHART:()=>S_,CLASS_SCATTER_CHART_DATA_POINT:()=>T_,CLASS_SELECTED_MODE:()=>hG,CLASS_SELECT_DEFEAT:()=>mt,CLASS_SHAPE:()=>bh,CLASS_SHAPE_ICON:()=>up,CLASS_SHAPE_LABEL:()=>op,CLASS_SNAPLINE:()=>qp,CLASS_SNAPLINE_ACTIVE:()=>IC,CLASS_SNAPLINE_ACTIVE_EXACT:()=>MC,CLASS_SNAPLINE_EXACT:()=>py,CLASS_SNAPLINE_HORIZONTAL:()=>NC,CLASS_SNAPLINE_VERTICAL:()=>DC,CLASS_SOURCE_HOVER:()=>$f,CLASS_STRAIGHT_CONNECTOR_EDIT:()=>Yy,CLASS_STRAIGHT_DELETE_HANDLE:()=>mg,CLASS_STRAIGHT_DRAG_HANDLE:()=>ms,CLASS_STRAIGHT_EDITOR_GUIDELINE:()=>$P,CLASS_STRAIGHT_HANDLE:()=>Jh,CLASS_STRAIGHT_SPLIT_HANDLE:()=>gg,CLASS_SURFACE:()=>vf,CLASS_SURFACE_CANVAS:()=>Pf,CLASS_SURFACE_DIRECT:()=>ev,CLASS_SURFACE_EDGE_DRAGGING:()=>Gn,CLASS_SURFACE_ELEMENT_DRAGGING:()=>wf,CLASS_SURFACE_ELEMENT_FLASH:()=>Rf,CLASS_SURFACE_NO_PAN:()=>Cf,CLASS_SURFACE_PAN:()=>_f,CLASS_SURFACE_PANNING:()=>Lf,CLASS_SURFACE_PAN_ACTIVE:()=>Of,CLASS_SURFACE_PAN_BOTTOM:()=>S1,CLASS_SURFACE_PAN_LEFT:()=>x1,CLASS_SURFACE_PAN_RIGHT:()=>A1,CLASS_SURFACE_PAN_TOP:()=>b1,CLASS_SURFACE_POINTER_DEVICE:()=>rv,CLASS_SURFACE_POPUP:()=>kG,CLASS_SURFACE_TOUCH_DEVICE:()=>tv,CLASS_TARGET_HOVER:()=>Bf,CLASS_TOGGLE_GROUP_COLLAPSE:()=>fu,CLASS_TRANSIENT_VERTEX:()=>Av,CLASS_UI_SELECTED_CONNECTION:()=>Xl,CLASS_UI_SELECTED_ELEMENT:()=>Wi,CLASS_VERTEX_DRAWING_GROUP_CHILD_CANDIDATE:()=>my,CLASS_VERTEX_DRAWING_LASSO:()=>VC,CLASS_VJS_ANIMATE_EDGE_TRAVERSABLE:()=>og,CLASS_VJS_ANIMATE_EDGE_TRAVERSED:()=>Ny,CLASS_VJS_ANIMATE_EDGE_TRAVERSING:()=>Hh,CLASS_VJS_ANIMATE_SOURCE:()=>wy,CLASS_VJS_ANIMATE_TARGET:()=>Dy,CLASS_VJS_ANIMATE_VERTEX_TRAVERSABLE:()=>VG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSED:()=>GG,CLASS_VJS_ANIMATE_VERTEX_TRAVERSING:()=>Xn,CLASS_VJS_TOOLTIP:()=>FD,CLEAR_PATH:()=>ew,CLEAR_VIEW_BOX:()=>Q0,COLOR_PICKER_ELEMENT:()=>pw,COMMIT_CURRENT:()=>UO,COMPONENT_TYPE_CONNECTION:()=>KE,CONNECTION:()=>ZV,CONNECTOR_TYPE_CUBIC_BEZIER:()=>Mo,CONNECTOR_TYPE_ORTHOGONAL:()=>zi,CONNECTOR_TYPE_QUADRATIC_BEZIER:()=>ru,CONNECTOR_TYPE_SMOOTH:()=>dS,CONNECTOR_TYPE_STRAIGHT:()=>Hr,CONNECT_REASON_API:()=>pl,CONNECT_REASON_COPY_PASTE:()=>Zx,CONNECT_REASON_DATA_LOAD:()=>gl,CONNECT_REASON_TRANSIENT:()=>Wx,CONNECT_REASON_UNDO_REDO:()=>kx,CONNECT_REASON_USER_ACTIVITY:()=>yo,CONTAINMENT_NOT_NEGATIVE:()=>Hw,CONTAINMENT_PARENT:()=>kw,CONTAINMENT_PARENT_ENCLOSED:()=>Ww,CONTENT_TYPES:()=>_a,CSV:()=>fI,CandidateSorter:()=>qc,CanvasLayoutAdapter:()=>pp,CatchAllEventHandler:()=>ad,CategoryValueChart:()=>Wn,CategoryValueTooltip:()=>ka,CategoryVsAxisPlot:()=>uo,ChartExporter:()=>Dg,ChartLegend:()=>Lg,ChartSeries:()=>Sr,CircularLayout:()=>Mc,ClickSplitMode:()=>Eg,Clipboard:()=>kd,Cluster:()=>Cc,CollationSeries:()=>Ya,Collicat:()=>fg,ColumnChart:()=>k_,ColumnLayout:()=>El,CommentEntry:()=>Ws,Components:()=>Ne,CompoundAction:()=>vo,Connections:()=>Qt,Connectors:()=>ze,ControlsComponent:()=>Vp,ControlsPlugin:()=>Fh,CopyData:()=>Hd,CopyPasteControlsComponent:()=>mC,CrossingStage:()=>Ls,CsvReader:()=>Wm,CustomOverlayImpl:()=>lf,CustomTag:()=>Gd,DEFAULT:()=>be,DEFAULT_ANCHOR_PLACEHOLDER_SIZE:()=>kv,DEFAULT_ARRAY_SERIES_ID_FIELD:()=>$D,DEFAULT_ARRAY_SERIES_LABEL_FIELD:()=>GD,DEFAULT_ARRAY_SERIES_MAX_VALUES_FIELD:()=>VD,DEFAULT_ARRAY_SERIES_MIN_VALUES_FIELD:()=>MD,DEFAULT_ARRAY_SERIES_RANGE_START_FIELD:()=>ND,DEFAULT_ARRAY_SERIES_STEP:()=>DD,DEFAULT_ARRAY_SERIES_VALUES_FIELD:()=>ID,DEFAULT_AXIS_LINE_SIZE:()=>Ti,DEFAULT_BACKGROUND_COLOR:()=>PD,DEFAULT_BAR_GAP:()=>WD,DEFAULT_BEZIER_CONTROL_POINT_SCALE:()=>KA,DEFAULT_BEZIER_LOOPBACK_DISTANCE:()=>yR,DEFAULT_BORDER_HANDLE_SIZE:()=>BC,DEFAULT_CATEGORY_AXIS_FONT_SIZE:()=>U_,DEFAULT_CATEGORY_AXIS_FONT_STYLE:()=>Y_,DEFAULT_CATEGORY_FILL_RATIO:()=>HD,DEFAULT_CHART_EMPTY_MESSAGE:()=>M_,DEFAULT_CHART_ERROR_MESSAGE:()=>V_,DEFAULT_COLOR:()=>Iv,DEFAULT_COLOR_PROPERTY:()=>Hf,DEFAULT_CONNECTOR_EDITOR_BUTTON_SIZE:()=>Hv,DEFAULT_CORNER_RADIUS:()=>$g,DEFAULT_DIAGRAM_CELL_HEIGHT:()=>bP,DEFAULT_DIAGRAM_CELL_WIDTH:()=>xP,DEFAULT_DIAGRAM_TOOLS_BUTTON_SIZE:()=>_w,DEFAULT_DOT_OVERLAY_RADIUS:()=>EL,DEFAULT_DOWNLOAD_BUTTON_LABEL:()=>Up,DEFAULT_EDGE_NODE_SIZE:()=>Om,DEFAULT_ELLIPSE_OVERLAY_RADIUS_X:()=>xL,DEFAULT_ELLIPSE_OVERLAY_RADIUS_Y:()=>bL,DEFAULT_EXPORT_FILENAME:()=>Fp,DEFAULT_FILL_COLOR:()=>Ch,DEFAULT_FILL_PROPERTY:()=>jf,DEFAULT_FLOWCHART_ARROW_LENGTH:()=>Jw,DEFAULT_FLOWCHART_ARROW_WIDTH:()=>Zw,DEFAULT_FLOWCHART_PROPERTY_LINE_STYLE:()=>qw,DEFAULT_FLOWCHART_PROPERTY_MARKERS:()=>Kw,DEFAULT_GRID:()=>S0,DEFAULT_GRID_LINE_COLOR:()=>G_,DEFAULT_HANDLE_OFFSET:()=>YC,DEFAULT_HEIGHT_ATTRIBUTE:()=>ab,DEFAULT_HIERARCHICAL_LAYOUT_ALIGN:()=>hb,DEFAULT_HIERARCHICAL_LAYOUT_ALIGNMENT:()=>ub,DEFAULT_HIERARCHICAL_LAYOUT_PADDING:()=>cb,DEFAULT_HIERARCHICAL_LAYOUT_SPACING:()=>db,DEFAULT_HIERARCHY_LAYOUT_ALIGNMENT:()=>zc,DEFAULT_KEY_ALLOW_NESTED_GROUPS:()=>$E,DEFAULT_KEY_ANCHOR:()=>jl,DEFAULT_KEY_ANCHORS:()=>Hl,DEFAULT_KEY_ASTAR_VERTEX_BORDER:()=>BS,DEFAULT_KEY_ASTAR_VERTEX_BUFFER:()=>FS,DEFAULT_KEY_CONNECTOR:()=>xu,DEFAULT_KEY_CSS_CLASS:()=>US,DEFAULT_KEY_EDGES_DETACHABLE:()=>NM,DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE:()=>YS,DEFAULT_KEY_GROUP_SIZE:()=>IM,DEFAULT_KEY_HOVER_CLASS:()=>zS,DEFAULT_KEY_HOVER_PAINT_STYLE:()=>bu,DEFAULT_KEY_MAX_CONNECTIONS:()=>XS,DEFAULT_KEY_NODE_SIZE:()=>MM,DEFAULT_KEY_PAINT_STYLE:()=>jo,DEFAULT_KEY_REATTACH_EDGES:()=>VM,DEFAULT_KEY_SCOPE:()=>BE,DEFAULT_LABEL_COLOR:()=>_D,DEFAULT_LABEL_FILL_RATIO:()=>e0,DEFAULT_LABEL_LOCATION:()=>gL,DEFAULT_LABEL_LOCATION_ATTRIBUTE:()=>zE,DEFAULT_LABEL_PROPERTY:()=>to,DEFAULT_LEFT_ATTRIBUTE:()=>nb,DEFAULT_LEGEND_BACKGROUND_COLOR:()=>wD,DEFAULT_LEGEND_OUTLINE_WIDTH:()=>LD,DEFAULT_LEGEND_PADDING:()=>SD,DEFAULT_LINE_STROKE:()=>Nh,DEFAULT_MARGIN:()=>OD,DEFAULT_MAXIMUM_BAR_WIDTH:()=>kD,DEFAULT_MINIMUM_HEIGHT:()=>UC,DEFAULT_MINIMUM_WIDTH:()=>FC,DEFAULT_ORTHOGONAL_STUB:()=>uS,DEFAULT_OUTLINE_COLOR:()=>ts,DEFAULT_OUTLINE_PROPERTY:()=>Th,DEFAULT_OUTLINE_WIDTH:()=>Ph,DEFAULT_OUTLINE_WIDTH_PROPERTY:()=>vh,DEFAULT_PALETTE_SELECTOR:()=>Aw,DEFAULT_PAPER_MARGIN:()=>zT,DEFAULT_RECTANGLE_OVERLAY_HEIGHT:()=>yL,DEFAULT_RECTANGLE_OVERLAY_WIDTH:()=>fL,DEFAULT_ROTATE_HANDLE_SIZE:()=>$C,DEFAULT_ROTATE_LEADER_LENGTH:()=>GC,DEFAULT_ROTATION_ATTRIBUTE:()=>ob,DEFAULT_SET_DESCRIPTION:()=>P1,DEFAULT_SET_NAME:()=>C1,DEFAULT_SHAPE_SETS:()=>AP,DEFAULT_SMOOTHING:()=>$R,DEFAULT_SVG_HANDLE_SIZE:()=>Qp,DEFAULT_TICK_LINE_STROKE:()=>nC,DEFAULT_TICK_MARKS_PER_CELL:()=>T0,DEFAULT_TITLE_PADDING:()=>ux,DEFAULT_TOP_ATTRIBUTE:()=>ib,DEFAULT_VALUE_AXIS_FONT_SIZE:()=>Bg,DEFAULT_VALUE_AXIS_FONT_STYLE:()=>Fg,DEFAULT_VALUE_AXIS_PADDING:()=>F_,DEFAULT_WIDTH_ATTRIBUTE:()=>sb,DEFAULT_ZOOM_RANGE:()=>jS,DIAGONAL_AXIS_LR:()=>Tn,DIAGONAL_AXIS_RL:()=>Qn,DRAG_GROUP_MEMBERSHIP_ADDED:()=>Ma,DRAG_GROUP_MEMBERSHIP_ASSIGNED:()=>wC,DataModel:()=>Nc,DataSeriesBasedDataSource:()=>Ng,DatasetIndex:()=>ks,Decorator:()=>bp,Decorators:()=>Ap,DefaultRouter:()=>Zl,DefaultSearchTokenizer:()=>ZO,Diagram:()=>cg,DiagramCell:()=>jn,DiagramExportComponent:()=>PP,DiagramLink:()=>yi,DiagramPalette:()=>Zh,DiagramToolsPlugin:()=>gs,DialogConstants:()=>ue,DiamondOverlay:()=>$u,DotOverlay:()=>Bu,Drag:()=>Hy,DragGroupsPlugin:()=>ls,DualValueAxisTooltip:()=>Ug,DualValueChart:()=>qa,DualValueChartSeries:()=>Ka,EDGE:()=>Cr,EDGE_DRAG_HANDLE:()=>Un,EDGE_INPUT_METHOD_CLICK:()=>wh,EDGE_INPUT_METHOD_DRAG:()=>$n,EDGE_INPUT_STATE_IDLE:()=>Dh,EDGE_INPUT_STATE_LOCKED:()=>Zf,EDGE_ROUTING_PLUGIN_MODE_DIRECT:()=>iC,EDGE_ROUTING_PLUGIN_MODE_ORTHOGONAL:()=>lG,EDGE_SNAP_CENTER:()=>Q1,EDGE_SNAP_DEFAULT:()=>Fv,EDGE_SNAP_PERIMETER:()=>p0,EDGE_TYPE_PICKER_ELEMENT:()=>fw,EDGE_UPDATE_REASON_UPDATED:()=>yA,ELEMENT:()=>WV,ELEMENT_CIRCLE:()=>Be,ELEMENT_DEFS:()=>pT,ELEMENT_DIV:()=>qe,ELEMENT_ELLIPSE:()=>gT,ELEMENT_G:()=>Q,ELEMENT_INCLUDE_ICON:()=>qL,ELEMENT_INCLUDE_ICONS:()=>QL,ELEMENT_PATH:()=>q,ELEMENT_RECT:()=>Z,ELEMENT_SVG:()=>Le,ELEMENT_TEXT:()=>tt,ELEMENT_TSPAN:()=>QE,EMPTY_ASTAR_PATH:()=>Dm,EMPTY_BOUNDS:()=>Pi,EMPTY_ELEMENT:()=>zR,EPSILON:()=>Zn,EVENT_ADHOC_LAYOUT:()=>Fb,EVENT_AFTER_LAYOUT_REFRESH:()=>Ys,EVENT_BEFORE_START:()=>ZP,EVENT_CANVAS_CLICK:()=>_n,EVENT_CANVAS_DBLCLICK:()=>lA,EVENT_CHANGE:()=>Hp,EVENT_CHART_LOAD:()=>wg,EVENT_CLICK:()=>Ye,EVENT_CONTEXTMENU:()=>At,EVENT_CONTEXT_UPDATE:()=>Cl,EVENT_DATA_APPEND_END:()=>Vm,EVENT_DATA_APPEND_START:()=>Mm,EVENT_DATA_LOAD_END:()=>Vr,EVENT_DATA_LOAD_START:()=>So,EVENT_DATA_UPDATED:()=>Gm,EVENT_DBLCLICK:()=>Co,EVENT_DBLTAP:()=>zr,EVENT_DESELECT:()=>qt,EVENT_DESTROY:()=>Ii,EVENT_DRAG:()=>JP,EVENT_DROP:()=>zw,EVENT_EDGE_ADDED:()=>cr,EVENT_EDGE_CLICK:()=>rA,EVENT_EDGE_CONTEXTMENU:()=>sA,EVENT_EDGE_DBLCLICK:()=>nA,EVENT_EDGE_DBLTAP:()=>iA,EVENT_EDGE_DRAG:()=>vb,EVENT_EDGE_DRAG_ABORT:()=>Pb,EVENT_EDGE_DRAG_END:()=>Cb,EVENT_EDGE_DRAG_START:()=>Tb,EVENT_EDGE_GEOMETRY:()=>ti,EVENT_EDGE_MOUSEDOWN:()=>_l,EVENT_EDGE_MOUSEOUT:()=>Cd,EVENT_EDGE_MOUSEOVER:()=>Pd,EVENT_EDGE_MOUSEUP:()=>oA,EVENT_EDGE_PATH_EDITED:()=>ri,EVENT_EDGE_REDRAW:()=>_d,EVENT_EDGE_REMOVED:()=>bt,EVENT_EDGE_SOURCE_CHANGED:()=>an,EVENT_EDGE_TAP:()=>aA,EVENT_EDGE_TARGET_CHANGED:()=>sn,EVENT_EDGE_TYPE_CHANGED:()=>Qc,EVENT_EDGE_UPDATED:()=>xt,EVENT_ELASTIC_GROUP_FRAME_REMOVE:()=>oy,EVENT_ELASTIC_GROUP_FRAME_RESIZE:()=>iy,EVENT_END_NODE_TRAVERSAL:()=>dP,EVENT_END_OVERLAY_ANIMATION:()=>oo,EVENT_FOCUS:()=>zb,EVENT_GRAPH_CHANGED:()=>Sb,EVENT_GRAPH_CLEARED:()=>Zt,EVENT_GRAPH_CLEAR_START:()=>Cn,EVENT_GROUP_ADDED:()=>Wt,EVENT_GROUP_COLLAPSE:()=>bd,EVENT_GROUP_EXPAND:()=>Ad,EVENT_GROUP_MEMBER_ADDED:()=>Ni,EVENT_GROUP_MEMBER_REMOVED:()=>Ms,EVENT_GROUP_MOVE:()=>To,EVENT_GROUP_MOVE_END:()=>$r,EVENT_GROUP_MOVE_START:()=>_b,EVENT_GROUP_RELAYOUT:()=>Pl,EVENT_GROUP_REMOVED:()=>Oe,EVENT_GROUP_RENDERED:()=>Ur,EVENT_GROUP_TYPE_CHANGED:()=>rd,EVENT_GROUP_UPDATED:()=>ve,EVENT_INTERNAL_CONNECTION:()=>Bb,EVENT_INTERNAL_EDGE_REDRAW:()=>Ob,EVENT_INTERNAL_ELEMENT_REPAINTED:()=>xd,EVENT_INTERNAL_GROUP_SIZE_CHANGED:()=>nd,EVENT_INTERNAL_GROUP_SIZE_CHANGED_REDO:()=>id,EVENT_INTERNAL_GROUP_SIZE_CHANGED_UNDO:()=>od,EVENT_INTERNAL_VERTEX_UPDATED:()=>zs,EVENT_KEYUP:()=>Bn,EVENT_LASSO_END:()=>Ld,EVENT_LASSO_START:()=>Od,EVENT_LASSO_UPDATE:()=>Rd,EVENT_MOUSEDOWN:()=>ge,EVENT_MOUSEENTER:()=>Xm,EVENT_MOUSEEXIT:()=>jm,EVENT_MOUSELEAVE:()=>Xb,EVENT_MOUSEMOVE:()=>ae,EVENT_MOUSEOUT:()=>ot,EVENT_MOUSEOVER:()=>st,EVENT_MOUSEUP:()=>le,EVENT_NODE_ADDED:()=>Jt,EVENT_NODE_MOVE:()=>Mt,EVENT_NODE_MOVE_ABORT:()=>sd,EVENT_NODE_MOVE_END:()=>Vt,EVENT_NODE_MOVE_START:()=>Vs,EVENT_NODE_REMOVED:()=>Ce,EVENT_NODE_RENDERED:()=>Yr,EVENT_NODE_TYPE_CHANGED:()=>ed,EVENT_NODE_UPDATED:()=>Re,EVENT_NODE_VISIBILITY:()=>Td,EVENT_OBJECT_REPAINTED:()=>Yb,EVENT_OUT:()=>jw,EVENT_OVER:()=>Xw,EVENT_PAN:()=>Gi,EVENT_PLUGIN_ADDED:()=>vd,EVENT_PLUGIN_REMOVED:()=>Ub,EVENT_PORT_ADDED:()=>ei,EVENT_PORT_REMOVED:()=>Gr,EVENT_PORT_TYPE_CHANGED:()=>td,EVENT_PORT_UPDATED:()=>hr,EVENT_REDO:()=>wb,EVENT_RELAYOUT:()=>Pn,EVENT_RENDERER_ADDED:()=>Rb,EVENT_RENDER_END:()=>Fr,EVENT_RENDER_START:()=>Sd,EVENT_SELECT:()=>Kt,EVENT_SELECTION_CLEARED:()=>nr,EVENT_START:()=>WP,EVENT_START_NODE_TRAVERSAL:()=>Ly,EVENT_START_OVERLAY_ANIMATION:()=>jh,EVENT_STATE:()=>ig,EVENT_STOP:()=>KP,EVENT_SURFACE_MODE_CHANGED:()=>On,EVENT_TAP:()=>W,EVENT_TOUCHEND:()=>Hb,EVENT_TOUCHMOVE:()=>kb,EVENT_TOUCHSTART:()=>jb,EVENT_UNDO:()=>Lb,EVENT_UNDOREDO_UPDATE:()=>Gs,EVENT_VERTEX_CLICK:()=>Wb,EVENT_VERTEX_CONTEXTMENU:()=>eA,EVENT_VERTEX_DBLCLICK:()=>Zb,EVENT_VERTEX_DBLTAP:()=>Jb,EVENT_VERTEX_MOUSEDOWN:()=>hI,EVENT_VERTEX_MOUSEMOVE:()=>Qb,EVENT_VERTEX_MOUSEOUT:()=>Kb,EVENT_VERTEX_MOUSEOVER:()=>qb,EVENT_VERTEX_MOUSEUP:()=>lI,EVENT_VERTEX_TAP:()=>tA,EVENT_ZOOM:()=>Br,EachEntry:()=>Vd,Edge:()=>Ue,EdgeGeometryTransformer:()=>mp,EdgeHandlerBase:()=>xa,EdgeInputHandler:()=>Pp,EdgePathEditor:()=>Aa,EdgeRelocateHandler:()=>_p,EdgeRoutingPlugin:()=>Vh,EdgeRoutingStage:()=>jc,EdgeTypePicker:()=>Zp,EditorBase:()=>no,ElasticGroupManager:()=>Ca,ElementCluster:()=>Pm,ElementDragHandler2:()=>dg,ElementDragger:()=>e_,ElementEntry:()=>Xr,ElementTypes:()=>Xi,Elements:()=>oi,EllipseOverlay:()=>Uu,EmptyLayout:()=>_s,EmptyRedrawResult:()=>vu,EventGenerator:()=>gm,EventManager:()=>ye,ExportControlsPlugin:()=>Kp,FACE_BOTTOM:()=>Rt,FACE_LEFT:()=>_t,FACE_RIGHT:()=>Ot,FACE_TOP:()=>Pt,FALSE:()=>ct,FILL:()=>dT,FIXED:()=>DE,FLOWCHART_EDGE_TYPE_BOTH_ARROWS:()=>tD,FLOWCHART_EDGE_TYPE_DASHED:()=>nD,FLOWCHART_EDGE_TYPE_PLAIN:()=>rD,FLOWCHART_EDGE_TYPE_SOURCE_ARROW:()=>Qw,FLOWCHART_EDGE_TYPE_TARGET_ARROW:()=>eD,FLOWCHART_SHAPES:()=>B1,FixedLayer:()=>xp,FlowchartBasicEdgeMappings:()=>I$,ForceDirectedLayout:()=>$c,GRID_TYPE_DOTTED:()=>iG,GRID_TYPE_LINES:()=>oG,GROUP_RELAYOUT_ADHOC:()=>hA,GROUP_RELAYOUT_EXISTING_VERTEX_ADDED:()=>dA,GROUP_RELAYOUT_MEMBER_REMOVED:()=>dI,GROUP_RELAYOUT_NEW_VERTEX_ADDED:()=>cA,GaugeChart:()=>K_,GeneratedGridBackground:()=>Ta,Graph:()=>dl,GraphSearchIndex:()=>CA,GridLayout:()=>bo,GridProfile:()=>Jl,GridTypes:()=>A0,Group:()=>se,GroupCollapseAction:()=>fd,GroupExpandAction:()=>yd,GroupLayoutAdapter:()=>gp,GroupRemoveAction:()=>cd,GroupSizeChangedAction:()=>Tl,H:()=>qx,HEIGHT:()=>Ve,HIERARCHICAL_JSON_DATATYPE:()=>um,HTMLElementOverlay:()=>ah,HeadlessRecado:()=>hE,HierarchicalLayout:()=>Uc,HierarchicalParentRelativePlacementStrategy:()=>Fc,HierarchyLayout:()=>Ao,HierarchyLayoutModel:()=>Hc,HierarchyLayoutStage:()=>Rs,HilbertCurves:()=>Zs,ICONS_ORIENTATION_HORIZONTAL:()=>Nv,ICONS_ORIENTATION_VERTICAL:()=>V1,ICON_CIRCLE:()=>Pv,ICON_CLONE:()=>ap,ICON_CROSS:()=>vv,ICON_GEAR:()=>_v,ICON_LINK:()=>sp,ICON_ORIGIN_CENTER:()=>yh,ICON_ORIGIN_END:()=>xh,ICON_ORIGIN_START:()=>fh,ICON_PLUS:()=>Cv,ICON_TRASH:()=>lp,INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS:()=>yw,INSPECTOR_CONTEXT_RECENT_COLORS:()=>Bh,IconElement:()=>zf,IfEntry:()=>Bd,ImageExportUI:()=>$h,InBrowserTemplateResolver:()=>Yf,Inspector:()=>kp,JSON_DATATYPE:()=>kt,LASSO_PATH:()=>H0,LASSO_VIEW_BOX:()=>j0,LAYOUT_TYPE_ABSOLUTE:()=>CO,LAYOUT_TYPE_BOWTIE:()=>mb,LAYOUT_TYPE_COLUMN:()=>Am,LAYOUT_TYPE_GRID:()=>bm,LAYOUT_TYPE_HIERARCHICAL:()=>DO,LAYOUT_TYPE_HIERARCHY:()=>gb,LAYOUT_TYPE_ROW:()=>Sm,LEFT:()=>We,LEGEND_ALIGN_CENTER:()=>hx,LEGEND_ALIGN_LEFT:()=>lx,LEGEND_ALIGN_RIGHT:()=>I_,LEGEND_ORIENTATION_HORIZONTAL:()=>ax,LEGEND_ORIENTATION_VERTICAL:()=>gB,LEGEND_VERTICAL_ALIGN_BOTTOM:()=>cx,LEGEND_VERTICAL_ALIGN_MIDDLE:()=>uc,LEGEND_VERTICAL_ALIGN_TOP:()=>dc,LINE_WIDTH:()=>mV,LOCATION_ATTRIBUTE:()=>tL,LabelOverlay:()=>mr,Lasso:()=>Sa,LassoPlugin:()=>Yn,Layouts:()=>Ke,LineChart:()=>q_,LineCrossingsPlugin:()=>rg,LinePlot:()=>bc,ListManagerPlugin:()=>Yh,MagnetizeProfile:()=>Iu,Magnetizer:()=>Li,MiniviewPlugin:()=>zn,ModelSeriesBasedDataSource:()=>mc,MoveAction:()=>Fs,NEGATIVE:()=>tb,NOMINAL_SIZE:()=>kr,NONE:()=>pt,Node:()=>ce,NodeGroupAction:()=>hd,OBJECT_TYPE_ANCHOR:()=>mE,OPPOSITE_FACES:()=>HI,ORIENTATION_OPPOSITE:()=>CE,ORIENTATION_ORTHOGONAL:()=>vE,ORIENTATION_PERPENDICULAR:()=>TE,ORTHOGONAL_AXIS_HORIZONTAL:()=>ne,ORTHOGONAL_AXIS_VERTICAL:()=>pe,ORTHOGONAL_FACES:()=>jI,ORTHOGONAL_ROUTER_MODE_BUS:()=>YI,ORTHOGONAL_ROUTER_MODE_SEPARATE:()=>Xd,OVERLAY_TYPE_CUSTOM:()=>af,OVERLAY_VISIBILITY_ALWAYS:()=>Au,OVERLAY_VISIBILITY_HOVER:()=>Zi,OptimisticEventGenerator:()=>Ft,OrthogonalEditor:()=>ao,Overlay:()=>li,OverlayFactory:()=>at,PALETTE_MODE_DRAG:()=>cy,PALETTE_MODE_DRAW:()=>dy,PALETTE_MODE_TAP:()=>LC,PAN_PATH:()=>J0,PAN_VIEW_BOX:()=>Z0,PAPER_ALIGN_CENTER:()=>qo,PAPER_ALIGN_END:()=>sh,PAPER_ALIGN_START:()=>oh,PATH_CONSTRAIN_DIAGONAL:()=>Gc,PATH_CONSTRAIN_MANHATTAN:()=>Qx,PATH_CONSTRAIN_METRO:()=>eb,PATH_CONSTRAIN_NONE:()=>nn,PATH_CONSTRAIN_ORTHOGONAL:()=>on,PLACEHOLDER_KEY:()=>wl,PLACEHOLDER_VALUE:()=>_o,PLUGIN_TYPE_LINE_CROSSINGS:()=>tg,POSITION_RELATIVE:()=>LS,PROPERTY_POSITION:()=>xf,PX:()=>Dn,Palette:()=>La,PalettePlugin:()=>Uh,PanButtonsPlugin:()=>cs,PanZoom:()=>ya,Paper:()=>Qh,ParentRelativePlacementStrategy:()=>ws,PathImpl:()=>ml,PathTransport:()=>ng,PathTransportState:()=>cP,PerimeterAnchorShapes:()=>ER,PieChart:()=>eO,PinchListener:()=>yp,PlacementStage:()=>Wc,PlainArrowOverlay:()=>Gu,PopupHandler:()=>RP,Port:()=>de,PortAction:()=>ud,PortAddAction:()=>pd,PortRemoveAction:()=>gd,PriorityQueue:()=>Ts,PropertyMapper:()=>Yu,PropertyTracker:()=>Nu,QuadraticBezierEditor:()=>ho,REMOVE_CLASS_ACTION:()=>aV,RESET_SELECTION_PATH:()=>q0,RESET_SELECTION_VIEW_BOX:()=>K0,RESIZING_TOOLS_RESIZE_METHOD_BORDERS:()=>zC,RESIZING_TOOLS_RESIZE_METHOD_HANDLES:()=>zh,RIGHT:()=>yt,ROLLBACK_CURRENT:()=>YO,ROOT_SHAPE_SET:()=>ro,ROTATION:()=>jN,ROW:()=>wi,RTREE_DEFAULT_MAX_CHILD_ENTRIES:()=>zA,RTree:()=>Do,RandomColorGenerator:()=>Ds,Recado:()=>Ro,RecadoTemplateRenderer:()=>fp,RecordBasedSeries:()=>tr,RectangleOverlay:()=>Fu,RemoveGroupMemberAction:()=>Ed,ResizingToolsPlugin:()=>ps,RowLayout:()=>fl,SEGMENT_TYPE_ARC:()=>Gl,SEGMENT_TYPE_BEZIER:()=>No,SEGMENT_TYPE_STRAIGHT:()=>wn,SELECTION_MODE_EDGES_ONLY:()=>Mb,SELECTION_MODE_GROUPS_ONLY:()=>Ib,SELECTION_MODE_ISOLATED:()=>ld,SELECTION_MODE_MIXED:()=>Db,SELECTION_MODE_NODES_ONLY:()=>Nb,SELECTOR_CONNECTOR:()=>Kr,SELECTOR_GROUP_CONTAINER:()=>PT,SELECTOR_MANAGED_ELEMENT:()=>Ql,SELECTOR_OVERLAY:()=>Mn,SELECTOR_TOGGLE_GROUP_COLLAPSE:()=>_T,SOURCE:()=>it,STATIC:()=>RS,STRAIGHT_CONNECTOR_AUTO_SPLIT:()=>f$,STRAIGHT_CONNECTOR_CLICK_SPLIT:()=>BP,STROKE:()=>qE,STROKE_WIDTH:()=>uT,SURFACE_MODE_DISABLED:()=>ns,SURFACE_MODE_PAN:()=>br,SURFACE_MODE_SELECT:()=>Ei,SURFACE_MODE_VERTEX_DRAWING:()=>Fn,SVGElementOverlay:()=>Ku,SVG_NAMESPACE:()=>Gt,SankeyChart:()=>iO,ScatterChart:()=>oO,Segments:()=>ur,SelectedEdgeHighlightPlugin:()=>va,SeriesBasedChart:()=>Xa,ShapeLibraryDefaults:()=>ip,ShapeLibraryImpl:()=>da,ShapePalette:()=>hg,ShapeTypeInspector:()=>RC,SimpleBackground:()=>Lp,SimpleShapeOverlay:()=>Nn,SingleColorGenerator:()=>Jc,SnaplinesPlugin:()=>hs,SourceValueTargetCsvParser:()=>TA,StaticColorGenerator:()=>Eb,Storage:()=>QP,StraightEditor:()=>lo,StraightSegmentHandler:()=>Go,SummingSeries:()=>za,Surface:()=>qh,SurfaceAnimator:()=>sg,SvgComponent:()=>Qu,SvgExportComponent:()=>Ra,SvgExportUI:()=>zp,SyntheticDecorator:()=>Rh,TAG_SHAPE:()=>Tv,TARGET:()=>vn,TILING_STRATEGY_ABSOLUTE:()=>tC,TILING_STRATEGY_LOGARITHMIC:()=>eC,TOP:()=>Te,TRUE:()=>Ct,TWO_PI:()=>vi,TYPE_ATTRIBUTE:()=>wA,TYPE_EACH:()=>ii,TYPE_ELEMENT:()=>ni,TYPE_IF:()=>Ll,TYPE_ITEM_ANCHORS:()=>_u,TYPE_ITEM_CONNECTOR:()=>WE,TYPE_ITEM_OVERLAY:()=>JS,TYPE_JPG:()=>ss,TYPE_PNG:()=>Gh,TYPE_ROOT:()=>OA,TYPE_SVG:()=>ly,TYPE_TEXT:()=>$i,TYPE_TMPL:()=>Po,TerminusAddAction:()=>Sl,TerminusRemoveAction:()=>Al,TestHarness:()=>Tg,TextEntry:()=>Ui,TiledBackground:()=>wp,TmplEntry:()=>Oo,Tooltip:()=>ja,TooltipRenderer:()=>Ha,UICore:()=>Vu,UIModel:()=>Tu,UIPlugins:()=>cn,UIState:()=>Np,UNDEFINED:()=>rb,UiStatesBrowserUIModel:()=>ry,UiStatesPlugin:()=>Mh,UndoRedoManager:()=>wd,UpdateAction:()=>Vi,UrlSeriesBasedDataSource:()=>Ig,V:()=>Vc,VERTEX:()=>yl,VERTEX_DRAWING_PATH:()=>W0,VERTEX_DRAWING_VIEW_BOX:()=>k0,VERTEX_UPDATE_REASON_ADD_NEW_PORT:()=>jO,VERTEX_UPDATE_REASON_ADD_PORT:()=>XO,VERTEX_UPDATE_REASON_DRAWING_TOOLS_RESIZE:()=>Rl,VERTEX_UPDATE_REASON_GROUP_RESIZED:()=>xA,VERTEX_UPDATE_REASON_LAYOUT:()=>mI,VERTEX_UPDATE_REASON_MAGNETIZER:()=>bA,VERTEX_UPDATE_REASON_MOVED:()=>Hs,VERTEX_UPDATE_REASON_REMOVE_PORT:()=>HO,VERTEX_UPDATE_REASON_RESIZED:()=>SA,VERTEX_UPDATE_REASON_ROTATION:()=>Xs,VERTEX_UPDATE_REASON_SET_POSITION:()=>Id,VERTEX_UPDATE_REASON_SIZE_GROUP_TO_FIT:()=>EI,VERTEX_UPDATE_REASON_SNAP_TO_GRID:()=>AA,VERTEX_UPDATE_REASON_UPDATE_GROUP:()=>fA,VERTEX_UPDATE_REASON_UPDATE_NODE:()=>EA,VERTEX_UPDATE_REASON_UPDATE_PORT:()=>Dd,VERTEX_UPDATE_REASON_UPDATE_VERTEX:()=>km,VanillaInspector:()=>Jp,Vertex:()=>wc,VertexDrawingPlugin:()=>fi,VertexSet:()=>Zc,Viewport:()=>Cu,VisuallyJsModel:()=>Nd,VisuallyJsRendererVertexRemovedAction:()=>vl,VisuallyJsSelection:()=>dr,VisuallyJsTestSupport:()=>bi,VjsContext:()=>du,WIDTH:()=>_e,WILDCARD:()=>gr,WhitespaceReplacingTokenizer:()=>bI,X:()=>ee,XHTML_NAMESPACE:()=>_V,XLINK_NAMESPACE:()=>PV,XYChart:()=>Wa,XYPlot:()=>px,X_AXIS_FACES:()=>zI,Y:()=>fe,Y_AXIS_FACES:()=>XI,ZOOM_IN_OUT_VIEW_BOX:()=>yC,ZOOM_IN_PATH:()=>tw,ZOOM_OUT_PATH:()=>rw,ZOOM_TO_FIT_PATH:()=>X0,ZOOM_TO_FIT_VIEW_BOX:()=>z0,_addBinding:()=>Km,_addConnectorSegment:()=>jr,_adjustForGap:()=>cT,_applyStyles:()=>Ef,_areaIfGrownBy:()=>XA,_bindOneAtt:()=>DA,_calculateSteps:()=>ix,_clearConnectorSegments:()=>bE,_computeConnector:()=>pM,_computeSingleLocation:()=>Lu,_connectorBoundingBoxIntersection:()=>hS,_connectorBoxIntersection:()=>mM,_connectorGradientAtPoint:()=>uM,_connectorLineIntersection:()=>gM,_connectorPointAlongPathFrom:()=>$e,_connectorPointOnPath:()=>pr,_createAnchor:()=>kE,_createBaseSegment:()=>Ks,_createConnectorBase:()=>Wd,_createContinuousAnchor:()=>WS,_createCubicBezierConnector:()=>RR,_createQuadraticBezierConnector:()=>LR,_createSegment:()=>kA,_defaultGroupHtmlTemplate:()=>r0,_defaultGroupSvgTemplate:()=>i0,_defaultNodeHtmlTemplate:()=>ma,_defaultNodeSvgTemplate:()=>Ea,_defaultPortHtmlTemplate:()=>t0,_defaultPortSvgTemplate:()=>n0,_defaultSegmentBoundingBoxIntersection:()=>JA,_defaultSegmentBoxIntersection:()=>Il,_defaultSegmentFindClosestPointOnPath:()=>WA,_defaultSegmentLineIntersection:()=>ZA,_emptyRTreeRegion:()=>Lo,_findAnchorOrientation:()=>Cp,_findConnectorSegmentForLocation:()=>xE,_findConnectorSegmentForPoint:()=>lS,_findIdealSteps:()=>bD,_findNextHorizontalSegment:()=>pS,_findNextSegmentOfType:()=>nu,_findNextVerticalSegment:()=>mS,_findPreviousHorizontalSegment:()=>gS,_findPreviousVerticalSegment:()=>ES,_findTargetZones:()=>m0,_findZones:()=>E0,_getCurrentAnchorLocation:()=>sT,_getDefaultTemplate:()=>Vv,_getLabelOverlay:()=>eV,_getSegmentLength:()=>fE,_getVertexInfo:()=>Tp,_growToFit:()=>dE,_hasLeafNodes:()=>jA,_hideOverlays:()=>nL,_initialiseDecorators:()=>Bv,_internalLabelOverlayClass:()=>QS,_internalLabelOverlayId:()=>Ou,_internalSourceMarkerOverlayId:()=>KM,_internalTargetMarkerOverlayId:()=>qM,_isContinuousAnchor:()=>Wo,_isFaceAvailable:()=>kl,_isLeaf:()=>jd,_mapToSpline:()=>RE,_padPoint:()=>lV,_placeAnchorsOnLine:()=>oT,_populateSourceZones:()=>Yv,_populateTargetZones:()=>Lh,_populateZones:()=>Uv,_prepareCompute:()=>SE,_registerSegmentHandler:()=>Js,_removeOverlay:()=>ko,_removeShortSegments:()=>BR,_removeTypeCssHelper:()=>rT,_resetConnectorBounds:()=>aS,_resetConnectorGeometry:()=>Yi,_setAnchorLocation:()=>yE,_setOrthogonalSegmentPosition:()=>_S,_showOverlays:()=>iL,_trimOrthogonalConnector:()=>OS,_trimOrthogonalSegments:()=>wE,_trimSegments:()=>LE,_updateConnectorBounds:()=>PR,_updateConnectorSegmentProportions:()=>AE,_updateHoverStyle:()=>Ru,_updateRTreeRegionBounds:()=>uE,_writeSegmentedConnectorSegments:()=>au,aSegmentDirections:()=>Vo,add:()=>Ci,addClass:()=>L,addConnectionClass:()=>Jr,addEntryToEachExecution:()=>nE,addNewExecutionToEachExecution:()=>$A,addSegment:()=>Vl,addToDictionary:()=>Mx,addToList:()=>CN,addWheelListener:()=>nh,addWithFunction:()=>vN,addXYPlotType:()=>Za,ajax:()=>ca,anchorPlacementEquals:()=>PE,apply:()=>SC,applyConnectionType:()=>eT,applyDomainOverrides:()=>zD,applyRotations:()=>Fx,applyRotationsXY:()=>Ux,areVerticesConnected:()=>Hx,arraysEqual:()=>bO,astarFromViewport:()=>hT,att:()=>Ae,attWithValue:()=>di,attachDiagramPalette:()=>jG,attemptCoerce:()=>Xp,base64Encode:()=>nw,base64EncodeSvgElement:()=>iw,bezierLineIntersection:()=>Ln,bindDarkModeListener:()=>e1,boundingBoxIntersection:()=>oM,boxIntersection:()=>iM,buildDomainScales:()=>XD,calculateNestedDepth:()=>Dc,calculatePowerOf10:()=>AD,calculateSpacingAdjustment:()=>Ri,chebyshevDistance:()=>bN,clampAngle:()=>sl,clampToHalfPixel:()=>Io,classList:()=>t1,clear:()=>_G,clone:()=>lt,cloneIcon:()=>D1,cls:()=>z,colourDistance:()=>fb,computeBezierConnector:()=>eu,computeBezierLength:()=>nS,computeDomainScales:()=>z_,computeGroupSize:()=>Mu,computeOrigin:()=>OP,computeRectangleIntersection:()=>Zg,computeStraightConnector:()=>hu,computeTranslationForRotation:()=>XL,connectorSegmentLength:()=>SS,consume:()=>oe,containsPoint:()=>Ss,convertToFullOverlaySpec:()=>hi,convertToMultilineText:()=>ju,createAbstractBezierConnector:()=>Zd,createAndAppendElementNS:()=>Qr,createChartElement:()=>k,createChartTextElement:()=>ys,createColorPickerTag:()=>_C,createComponent:()=>nT,createContrastLabel:()=>Rg,createDiagram:()=>HG,createElement:()=>qr,createElementNS:()=>la,createFinderFromAnchorPositions:()=>oa,createGateMap:()=>Ud,createPaper:()=>S$,createSurface:()=>ZG,createXYPlot:()=>j_,data:()=>De,debounce:()=>ha,decodeDragGroupSpec:()=>ww,defaultDataGenerator:()=>bw,defaultExportGeometry:()=>cM,defaultIcons:()=>Ah,defaultIdFunction:()=>cm,defaultImportGeometry:()=>dM,destroySVGOverlay:()=>Tf,diagonalAdjacentCellsFinder:()=>Nm,directRouter:()=>YA,dist:()=>eS,distanceFromCurve:()=>SR,djikstra:()=>vc,each:()=>aI,eachNotEmpty:()=>$x,edgeSortFunctions:()=>iT,editors:()=>Lr,emptyBox:()=>cc,emptyPaintGeometry:()=>fR,encloses:()=>mN,encodedSvgToDataUrl:()=>ow,ensureSVGContentElements:()=>lh,ensureSVGLabelElements:()=>Qo,euclideanDistance:()=>xN,evaluateExpression:()=>Bi,evaluateSingleExpression:()=>qm,expandRectangle:()=>Rx,exportConnectorGeometry:()=>ln,exportData:()=>pm,exportImage:()=>Yp,exportSVG:()=>sx,exportSvg:()=>Oa,extend:()=>Us,extract:()=>CG,extractBounds:()=>PN,extractPoint:()=>ft,extractSize:()=>Jn,extractValueFromElement:()=>aw,faceOrientations:()=>EE,fastTrim:()=>vt,filterEmpty:()=>Gx,filterNull:()=>ON,findAdjacentSegment:()=>ou,findClosestPoint:()=>Oc,findParent:()=>Bt,findParents:()=>JV,findSegment:()=>iu,fixPrecision:()=>Jg,flatten:()=>gR,floydWarshall:()=>Sx,formatValue:()=>ox,freeMovementAdjacencies:()=>BO,generateConstrainFunctionFromContainmentType:()=>qP,generateInspectorTemplate:()=>xw,getAbsolutePosition:()=>g1,getAllEdges:()=>AO,getAllSourceEdges:()=>wN,getAllTargetEdges:()=>DN,getAncestors:()=>Sn,getClass:()=>LT,getClosestMidpoint:()=>Vx,getConnectedVertices:()=>MN,getConnectorElement:()=>jL,getContrastColor:()=>Kc,getDescendantEdges:()=>dm,getDescendants:()=>Ps,getDownstreamVertices:()=>NN,getEdges:()=>cl,getElementSize:()=>Ze,getElementType:()=>Wu,getEventSource:()=>Ko,getFromSetWithFunction:()=>em,getOutlineColor:()=>iI,getPageLocation:()=>OL,getPosition:()=>gn,getPositionOnElement:()=>Zu,getRectangleMidpoints:()=>fO,getSelector:()=>wT,getSourceEdges:()=>Yx,getSvgPositionRelativeToSvgRoot:()=>qu,getSvgTranslatePosition:()=>hh,getTargetEdges:()=>zx,getTouch:()=>mf,getUpstreamVertices:()=>IN,getsert:()=>vs,gradient:()=>Nr,gradientAtPoint:()=>Kd,gradientAtPointAlongPathFrom:()=>rM,gridBackgroundOptions:()=>SP,hasClass:()=>un,inferAxis:()=>Ns,inferAxisAndDirectionFromOrientation:()=>Im,inferAxisFromSourceAndTargetLocation:()=>bb,inferDirection:()=>xb,initializeBezierConnectorEditors:()=>XP,initializeOrthogonalConnectorEditors:()=>GP,initializeStraightConnectorEditors:()=>FP,insertRTreeChild:()=>wo,insertSorted:()=>tm,intersectionOfProjectedLines:()=>wx,isAncestor:()=>ke,isArrayLike:()=>KV,isArrayOrNodeList:()=>RT,isAssignableFrom:()=>Ix,isBarPlot:()=>DB,isBoolean:()=>mo,isCategoryAxis:()=>D_,isClass:()=>xO,isConnection:()=>sa,isConnector:()=>EM,isCustomOverlay:()=>dn,isDOMElement:()=>qi,isDate:()=>yO,isDescendantGroup:()=>jx,isEdge:()=>nt,isEdgeConnectedTo:()=>RN,isEdgeNodeEntry:()=>dt,isEdgeSupported:()=>HE,isElement:()=>DT,isEmpty:()=>ll,isFilterableDataset:()=>vA,isFullOverlaySpec:()=>HS,isFunction:()=>rn,isGroup:()=>Y,isHTMLLabelOverlay:()=>XT,isLabelOverlay:()=>Zr,isLoopPresent:()=>IA,isMouseDevice:()=>ci,isNamedFunction:()=>_N,isNestedGroup:()=>hm,isNode:()=>J,isNodeInsideAGroup:()=>lm,isNodeList:()=>Vn,isNodeVertex:()=>Xx,isNumber:()=>_c,isObject:()=>lr,isPoint:()=>tS,isPort:()=>j,isSVGElement:()=>Lt,isStackedPlot:()=>Ja,isString:()=>X,isTextNode:()=>qV,isTouchDevice:()=>In,isValueAxis:()=>bn,isVertex:()=>_i,lightweightPrintfFormatter:()=>BA,lineCalculators:()=>Bl,lineIntersection:()=>ol,lineIntersectsOrIsEnclosedByRectangle:()=>Ox,lineLength:()=>Pe,lineRectangleIntersection:()=>ar,linesIntersection:()=>gO,linesOverlap:()=>Kg,locationAlongCurveFrom:()=>oS,log:()=>U,logEnabled:()=>EO,makeLightweightAnchorFromArraySpec:()=>Pu,makeLightweightAnchorFromSpec:()=>St,manhattanDistance:()=>Pc,manhattanLineLength:()=>gN,matchesSelector:()=>$t,merge:()=>An,mergeDomainExtents:()=>YD,mergeWithParents:()=>Su,minBy:()=>HA,namedContinuousValues:()=>ZS,nearestPointOnCurve:()=>rS,newInstance:()=>fn,newRecadoInstance:()=>xr,newTemplates2Renderer:()=>Oh,normal:()=>_x,objectsEqual:()=>hl,octileDistance:()=>AN,offsetRelativeToRoot:()=>Ki,orthogonalAdjacencies:()=>FO,orthogonalAdjacentCellsFinder:()=>yb,orthogonalRouter:()=>UA,pageLocation:()=>me,paintSVGLabelOverlay:()=>kT,paintSimpleShapeOverlay:()=>HT,paintSvgConnector:()=>Sv,parallelLineFromPoint:()=>yN,parallelLineTo:()=>Cx,parallelLinesTo:()=>Dx,parentAxis:()=>Mr,parentDirection:()=>Ab,parse:()=>Kx,parseAttributes:()=>Jm,parseAtts:()=>MA,parseExpression:()=>sR,partition:()=>al,peek:()=>NA,perpendicularBisectingLine:()=>EN,perpendicularLineTo:()=>Dt,perpendicularToPathAt:()=>nM,pointAlongCurveFrom:()=>iS,pointAlongPath:()=>Jd,pointOnCurve:()=>Qs,pointOnLine:()=>jt,pointsEqual:()=>Bx,populate:()=>fo,populateRegions:()=>zd,prefersDarkMode:()=>QV,processExpression:()=>Dl,quadrant:()=>As,ready:()=>M$,recordGetsert:()=>Cs,rectanglesIntersect:()=>rt,registerDecorator:()=>WG,registerEdgeTypePickerTag:()=>OC,registerExporter:()=>BN,registerParser:()=>Jx,registerPlugin:()=>Xe,relocateContinuousAnchor:()=>Jv,relocateDynamicAnchor:()=>Kv,relocateWithPositionFinder:()=>qv,remove:()=>qg,removeClass:()=>F,removeConnectionClass:()=>_r,removeRTreeChild:()=>gE,removeWheelListener:()=>ih,removeWithFunction:()=>Nt,renderIcon:()=>hp,renderNamedIcon:()=>cp,renderPaper:()=>Bw,renderSurface:()=>$w,replace:()=>nm,resolveIfExecution:()=>oE,resolveNode:()=>Kn,resolveNodeId:()=>ul,rotatePoint:()=>Me,rotatedRectanglesIntersect:()=>Nx,routerLineIntersects:()=>FA,routerLineSgn:()=>cE,segmentLineAngle:()=>AS,segmentedConnectorSegmentLength:()=>ea,setAbsolutePosition:()=>er,setElementHeight:()=>qT,setElementRotation:()=>pi,setElementSize:()=>Rr,setElementWidth:()=>KT,setForceMouseEvents:()=>_L,setForceTouchEvents:()=>PL,setOverlayLocation:()=>FE,setPosition:()=>Ie,setRotatedSvgElementPosition:()=>QT,setSvgTranslatePosition:()=>pn,setTranslatedPosition:()=>zt,setTranslatedX:()=>uB,setTranslatedY:()=>hc,setXPosition:()=>ZT,setYPosition:()=>JT,shortUuid:()=>Eo,snapToGrid:()=>he,snapToGridUpperBound:()=>fN,sortAndPlaceEdges:()=>Yd,sourceElementSelector:()=>Sp,sourceVertexAvoidance:()=>fS,splitIntoSiblings:()=>pE,stubCalculators:()=>$l,stubRelocator:()=>CS,subtract:()=>Px,suggest:()=>Qg,supportsPathEditing:()=>BT,svgElementToDataUrl:()=>AC,targetElementSelector:()=>g0,targetVertexAvoidance:()=>yS,testIntersectingDropTarget:()=>vp,theta:()=>il,toggleClass:()=>Af,touchCount:()=>vT,touches:()=>Zo,transformAnchorPlacement:()=>qs,transformBezierGeometry:()=>tu,transformSegmentedGeometry:()=>cu,translateRect:()=>rm,unionOfRectangles:()=>Lx,updateBezierConnector:()=>Qd,updateClasses:()=>Ut,updateEditedOrthogonalConnector:()=>TS,updateStraightConnector:()=>lu,uuid:()=>G,valueInRange:()=>Ml,vertexAvoidance:()=>xS,wrap:()=>dd,xml:()=>OT});module.exports=dN(FB);function vc(i){let r=i.graph,e=i.source,t=i.target,n=i.nodeFilter,o=i.edgeFilter,s={},a={},l={},h={dist:s,previous:a,edges:l,path:[]},d=i.processAll,u={},p={},g=i.strict!==!1,m=C=>C.getFullId?C.getFullId():C.id,E=[],y=C=>{let R=p[C.getFullId()];return u[R.v.id]},x=(C,R)=>{let w,B;if(C.objectType===de.objectType){for(s[C.getFullId()]=R,w=y(C),B=0;B<w.length;B++)w[B].p!=C&&(s[w[B].p.getFullId()]=R+C.getParent().getInternalEdge(C,w[B].p).cost);g||(s[C.getParent().id]=R)}else for(s[C.id]=R,w=u[C.id],B=0;B<w.length;B++)s[w[B].p.getFullId()]=R},f=C=>n&&!n(C)?1/0:s[m(C)],b=(C,R,w)=>{if(C.objectType===de.objectType){let B=y(C);for(let N=0;N<B.length;N++)a[B[N].p.getFullId()]=w.node;g||(a[C.getParent().id]=w.node)}a[R]=w.node},A=(C,R,w)=>{if(C.objectType===de.objectType){let B=y(C);for(let N=0;N<B.length;N++)l[B[N].p.getFullId()]=w;g||(l[C.getParent().id]=w)}l[R]=w},T=(C,R,w,B,N)=>{let V=-1,D=null,$=1/0;for(let K=0;K<C.length;K++)if(!R[K]){let xe=N(C[K]);xe<$?($=xe,V=K,D=C[K]):xe===$&&C[K].objectType===de.objectType&&C[K].getParent()===D&&(V=K,D=C[K])}return{node:D,index:V}},S=(C,R)=>{let w=R.getFullId(),B=C[w];return B==null&&(w=R.getParent?R.getParent().id:R.id,B=C[w]),B==null?null:{p:B,id:w}},O=(C,R,w,B,N,V)=>{let D=[],$=B,K=S(R,$);for(;K!=null;)D.splice(0,0,{vertex:$,cost:C[K.id],edge:w[K.id]}),$=K.p,K=S(R,$);return D.splice(0,0,{vertex:$,cost:0,edge:null}),D},v=C=>{for(let R=0;R<C.length;R++){let w=C[R],B=w.getPorts();E.push(w);let N={v:w,i:E.length-1};u[w.id]=[],x(w,1/0);for(let V=0;V<B.length;V++)E.push(B[V]),p[B[V].getFullId()]=N,u[w.id].push({p:B[V],i:E.length-1}),x(B[V],1/0)}};if(v(r.nodes),v(r.groups),e==null&&(e=r.getVertex(i.sourceId)),t==null&&(t=r.getVertex(i.targetId)),e==null||t==null)return h;x(e,0);let _=new Array(r.nodes.length),P=0,I=(C,R,w,B)=>{for(let N=0;N<R.length;N++){let V=R[N];if(w(V)){let D=B(V),$=D.tp||D.tn,K=m($),xe=f(C.node)+V.getCost(),H=f($);xe<H&&(x($,xe),b($,K,C),A($,K,V))}}};for(;P<E.length;){let C=T(E,_,s,m,f),R=C.node?m(C.node):null;if(!C.node||f(C.node)==1/0||t&&(R==m(t)||!g&&C.node.objectType===de.objectType&&C.node.isChildOf(t))&&(h.path=O(s,a,l,t,m),h.pathDistance=h.path[h.path.length-1].cost,!d))break;_[C.index]=!0,P=P+1,I(C,C.node.getAllEdges(),w=>o&&!o(w)?!1:!w.isDirected()||C.node==w.source||!g&&w.source.objectType===de.objectType&&w.source.isChildOf(C.node),w=>{var B=w.source.objectType===de.objectType?w.source.getParent():w.source,N=w.source.objectType===de.objectType?w.source:null,V=w.target.objectType===de.objectType?w.target.getParent():w.target,D=w.target.objectType===de.objectType?w.target:null;return w.source==C.node||!g&&w.source.objectType===de.objectType&&w.source.isChildOf(C.node)?{tn:V,tp:D}:{tn:B,tp:N}})}return h}function Sx(i){let r=i.graph,e=r.getVertexCount(),t={},n={},o,s,a;for(o=0;o<e;o++){let l=r.getVertexAt(o);for(t[l.id]||(t[l.id]={}),n[l.id]||(n[l.id]={}),t[l.id][l.id]=0,s=0;s<e;s++)if(o!=s){let d=r.getVertexAt(s);t[l.id][d.id]||(t[l.id][d.id]=1/0),n[l.id][d.id]||(n[l.id][d.id]=[])}let h=l.getEdges();for(a=0;a<h.length;a++)h[a].source==l?t[l.id][h[a].target.id]=h[a].getCost():(t[h[a].source.id]||(t[h[a].source.id]={},n[h[a].source.id]={}),t[l.id][h[a].source.id]=h[a].getCost())}for(a=0;a<e;a++)for(o=0;o<e;o++)for(s=0;s<e;s++)if(o!=s&&s!=a&&o!=a){let l=r.getVertexAt(o).id,h=r.getVertexAt(s).id,d=r.getVertexAt(a).id;t[l][d]+t[d][h]<=t[l][h]&&t[l][d]+t[d][h]!=1/0&&(t[l][h]=t[l][d]+t[d][h],n[l][h]||(n[l][h]=[]),n[l][h].unshift([r.getVertexAt(a),t[l][h]]))}return{paths:t,parents:n}}var Cc=class{constructor(r){c(this,"vertices");c(this,"ne");this.vertices=[r],this.ne=new Set}addVertex(r){this.vertices.push(r),r.getAllEdges().forEach(e=>this.ne.add(e))}get edges(){return Array.from(this.ne)}};var uN=[null,[1,-1],[1,1],[-1,1],[-1,-1]],pN=[null,[-1,-1],[-1,1],[1,1],[1,-1]],vi=2*Math.PI;function Ci(i,r){return{x:i.x+r.x,y:i.y+r.y}}function Px(i,r){return{x:i.x-r.x,y:i.y-r.y}}function Nr(i,r){return r.x===i.x?r.y>i.y?1/0:-1/0:r.y===i.y?r.x>i.x?0:-0:(r.y-i.y)/(r.x-i.x)}function _x(i,r){return-1/Nr(i,r)}function Pe(i,r){return Math.sqrt(Math.pow(r.y-i.y,2)+Math.pow(r.x-i.x,2))}function gN(i,r){return Math.abs(r.y-i.y)+Math.abs(r.x-i.x)}function As(i,r){return r.x>i.x||r.x==i.x?r.y>i.y?2:1:r.y>i.y?3:4}function il(i,r){let e=Nr(i,r),t=Math.atan(e),n=As(i,r);return(n==4||n==3)&&(t+=Math.PI),t<0&&(t+=2*Math.PI),t}function rt(i,r){return!(i.x+i.width<r.x||i.x>r.x+r.width||i.y+i.height<r.y||i.y>r.y+r.height)}function Zg(i,r){let e=Math.max(0,Math.min(i.x+i.width,r.x+r.width)-Math.max(i.x,r.x)),t=Math.max(0,Math.min(i.y+i.height,r.y+r.height)-Math.max(i.y,r.y));return e*t}function hO(i){let r=i[1].y-i[0].y,e=i[0].x-i[1].x;return{A:r,B:e,C:r*i[0].x+e*i[0].y}}function Jg(i,r){return r=r==null?3:r,Math.floor(i*Math.pow(10,r))/Math.pow(10,r)}var Zn=1e-6;function ol(i,r){let e=hO(i),t=hO(r),n=e.A*t.B-t.A*e.B;if(Math.abs(n)<Zn)return null;{let o={x:(t.B*e.C-e.B*t.C)/n,y:(e.A*t.C-t.A*e.C)/n},s=Math.min(i[0].x,i[1].x),a=Math.max(i[0].x,i[1].x),l=Math.min(i[0].y,i[1].y),h=Math.max(i[0].y,i[1].y),d=Math.min(r[0].x,r[1].x),u=Math.max(r[0].x,r[1].x),p=Math.min(r[0].y,r[1].y),g=Math.max(r[0].y,r[1].y);return o.x>=s-Zn&&o.x<=a+Zn&&o.y>=l-Zn&&o.y<=h+Zn&&o.x>=d-Zn&&o.x<=u+Zn&&o.y>=p-Zn&&o.y<=g+Zn?o:null}}function ar(i,r){let e=[];return[[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y}],[{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height}],[{x:r.x,y:r.y},{x:r.x,y:r.y+r.height}],[{x:r.x,y:r.y+r.height},{x:r.x+r.width,y:r.y+r.height}]].forEach(n=>{let o=ol(i,n);o!=null&&e.push(o)}),e}function Ox(i,r){return Ss(r,i[0],!0)||Ss(r,i[1],!0)||ar(i,r).length>0}function mN(i,r,e){let t=i.x,n=i.x+i.width,o=i.y,s=i.y+i.height,a=r.x,l=r.x+r.width,h=r.y,d=r.y+r.height,u=(p,g,m,E)=>e?p<=g&&m>=E:p<g&&m>E;return u(t,a,n,l)&&u(o,h,s,d)}function Ss(i,r,e){return e?i.x<=r.x&&i.x+i.width>=r.x&&i.y<=r.y&&i.y+i.height>=r.y:i.x<r.x&&i.x+i.width>r.x&&i.y<r.y&&i.y+i.height>r.y}function jt(i,r,e){let t=Nr(i,r),n=As(i,r),o=e>0?uN[n]:pN[n],s=Math.atan(t),a=Math.abs(e*Math.sin(s))*o[1],l=Math.abs(e*Math.cos(s))*o[0];return{x:i.x+l,y:i.y+a}}function Dt(i,r,e){let t=Nr(i,r),n=Math.atan(-1/t),o=e/2*Math.sin(n),s=e/2*Math.cos(n);return[{x:r.x+s,y:r.y+o},{x:r.x-s,y:r.y-o}]}function EN(i,r,e){let t={x:(i.x+r.x)/2,y:(i.y+r.y)/2},n=Nr(i,r),o=Math.atan(-1/n),s=e/2*Math.sin(o),a=e/2*Math.cos(o);return[{x:t.x,y:t.y},{x:t.x-a,y:t.y-s}]}function he(i,r,e,t){e=e==null?r.thresholdX==null?r.width/2:r.thresholdX:e,t=t==null?r.thresholdY==null?r.height/2:r.thresholdY:t;let n=Math.floor(i.x/r.width),o=r.width*n,s=o+r.width,a=Math.abs(i.x-o)<=e?o:Math.abs(s-i.x)<=e?s:i.x,l=Math.floor(i.y/r.height),h=r.height*l,d=h+r.height,u=Math.abs(i.y-h)<=t?h:Math.abs(d-i.y)<=t?d:i.y;return{x:a,y:u}}function fN(i,r){let e=Math.floor(i.x/r.width),t=r.width*e,n=t+r.width,o=Math.floor(i.y/r.height),s=r.height*o,a=s+r.height;return{x:n,y:a}}function gO(i,r,e,t){let n=Math.max(i,r);i=Math.min(i,r),r=n;let o=Math.max(e,t);return e=Math.min(e,t),t=o,i<=e&&e<=r&&i<=t&&t<=r?{point1:e,point2:t}:i<=e&&e<=r&&t>=r?{point1:e,point2:r}:e<=i&&i<=t&&t<=r?{point1:i,point2:t}:i===e&&r===t||r===e&&i===t?{point1:i,point2:r}:e<=i&&i<=t&&e<=r&&r<=t?{point1:i,point2:r}:null}function Kg(i,r,e,t,n=0){let o=gO(i,r,e,t);return o==null?!1:Math.abs(o.point2-o.point1)>n}function Rx(i,r,e){let t=i.x-r,n=i.y-e,o=i.width+2*r,s=i.height+2*e,a=Object.assign({},i);return Object.assign(a,{x:t,y:n,width:o,height:s})}function Lx(i,r){let e=Math.min(i.x,r.x),t=Math.min(i.y,r.y),n=Math.max(i.x+i.width,r.x+r.width),o=Math.max(i.y+i.height,r.y+r.height),s=n-e,a=o-t;return{x:e,y:t,width:s,height:a}}function wx(i,r){let e=i[0].x,t=i[1].x,n=i[0].y,o=i[1].y,s=r[0].x,a=r[1].x,l=r[0].y,h=r[1].y;if(e===t&&n===o||s===a&&l===h)return null;let d=(h-l)*(t-e)-(a-s)*(o-n);if(d===0)return null;let u=((a-s)*(n-l)-(h-l)*(e-s))/d,p=e+u*(t-e),g=n+u*(o-n);return{x:p,y:g}}function Cx(i,r){if(i[0].x===i[1].x){let e=i[0].y<i[1].y?1:-1;return[{x:i[0].x+e*r,y:i[0].y},{x:i[0].x+e*r,y:i[1].y}]}else if(i[0].y===i[1].y){let e=i[0].x<i[1].x?1:-1;return[{y:i[0].y+e*r,x:i[0].x},{y:i[0].y+e*r,x:i[1].x}]}else{let e=Nr(i[0],i[1]),t=Math.atan(-1/e),n=length/2*Math.sin(t),o=length/2*Math.cos(t);return[{x:i[0].x+o,y:i[0].y+n},{x:i[1].x+o,y:i[1].y+n}]}}function Dx(i,r){return[Cx(i,r),Cx(i,-r)]}function yN(i,r,e){if(i[0].x===i[1].x){let t=i[0].y<i[1].y?1:-1;return[r,{x:r.x,y:r.y+t*e}]}else if(i[0].y===i[1].y){let t=i[0].x<i[1].x?1:-1;return[r,{x:r.x+t*e,y:r.y}]}else{let t=Nr(i[0],i[1]),n=Math.atan(-1/t),o=e*Math.sin(n),s=e*Math.cos(n);return[r,{x:r.x+s,y:r.y+o}]}}var Pc=(i,r,e,t)=>Math.abs(e-i)+Math.abs(t-r),xN=(i,r,e,t)=>Math.pow(Math.pow(e-i,2)+Math.pow(t-r,2),.5),bN=(i,r,e,t)=>Math.max(Math.abs(e-i),Math.abs(t-r)),AN=(i,r,e,t)=>{let n=Math.abs(e-i),o=Math.abs(t-r),s=Math.SQRT2-1;return n<o?s*n+o:s*o+n};function sl(i){let r=i%360;return r<0&&(r+=360),r}function cO(i,r){return i.x*r.x+i.y*r.y}function Tx(i){return Math.sqrt(i.x*i.x+i.y*i.y)}function dO(i){let r=Tx(i);return r===0?{x:0,y:0}:{x:i.x/r,y:i.y/r}}function SN(i,r,e){e=e*Math.PI/180;let t=Math.cos(e),n=Math.sin(e),o=(i.x-r.x)*t-(i.y-r.y)*n+r.x,s=(i.x-r.x)*n+(i.y-r.y)*t+r.y;return{x:o,y:s}}function vx(i){let r=i.x+i.width/2,e=i.y+i.height/2,t={x:r,y:e},n=i.r||0,o=i.width/2,s=i.height/2,a=[{x:r-o,y:e-s},{x:r+o,y:e-s},{x:r+o,y:e+s},{x:r-o,y:e+s}];return n===0?a:a.map(l=>SN(l,t,n))}function uO(i){let r=vx(i),e=[],t={x:r[1].x-r[0].x,y:r[1].y-r[0].y};Tx(t)>0&&e.push(dO({x:-t.y,y:t.x}));let n={x:r[3].x-r[0].x,y:r[3].y-r[0].y};return Tx(n)>0&&e.push(dO({x:-n.y,y:n.x})),e.length===0&&(e.push({x:1,y:0}),e.push({x:0,y:1})),e}function pO(i,r){let e=cO(i,r[0]),t=e;for(let n=1;n<r.length;n++){let o=cO(i,r[n]);o<e?e=o:o>t&&(t=o)}return{min:e,max:t}}function TN(i,r,e,t){return i<=t&&e<=r}function Nx(i,r){if(i.r===0&&r.r===0)return rt(i,r);let e=vx(i),t=vx(r),n=[...uO(i),...uO(r)];for(let o of n){let s=pO(o,e),a=pO(o,t);if(!TN(s.min,s.max,a.min,a.max))return!1}return!0}var EO=!0;function U(...i){if(EO&&typeof console!="undefined")try{let r=arguments[arguments.length-1];console.log(r)}catch(r){}}function Ix(i,r){let e=i.prototype;for(;e!=null;){if(e instanceof r)return!0;e=e.prototype}return!1}function qg(i,r){let e=i.indexOf(r);return e>-1&&i.splice(e,1),e!==-1}function vN(i,r,e){i.findIndex(e)===-1&&i.push(r)}function Mx(i,r,e,t){let n=i[r];return n==null&&(n=[],i[r]=n),n[t?"unshift":"push"](e),n}function CN(i,r,e,t){let n=i.get(r);return n==null&&(n=[],i.set(r,n)),n[t?"unshift":"push"](e),n}function Qg(i,r,e){return i.indexOf(r)===-1?(e?i.unshift(r):i.push(r),!0):!1}function em(i,r){let e=null;return i.forEach(t=>{r(t)&&(e=t)}),e}function Nt(i,r){let e=i.findIndex(r);return e>-1&&i.splice(e,1),e!==-1}function Me(i,r,e){let t={x:i.x-r.x,y:i.y-r.y},n=Math.cos(e/360*Math.PI*2),o=Math.sin(e/360*Math.PI*2);return{x:t.x*n-t.y*o+r.x,y:t.y*n+t.x*o+r.y,cr:n,sr:o}}function vt(i){if(i==null)return null;let r=i.replace(/^\s\s*/,""),e=/\s/,t=r.length;for(;e.test(r.charAt(--t)););return r.slice(0,t+1)}function tm(i,r,e,t){if(r.length===0)r.push(i);else{let n=t?-1:1,o=0,s=r.length,a=Math.floor((o+s)/2);for(;s>o;)e(i,r[a])*n<0?s=a:o=a+1,a=Math.floor((o+s)/2);r.splice(a,0,i)}}function Pi(){return{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}function ft(i){return{x:i.x,y:i.y}}function Jn(i){return{width:i.width,height:i.height}}function PN(i){return{x:i.x,y:i.y,width:i.width,height:i.height}}function rm(i,r,e){return{x:i.x+e*r.x,y:i.y+e*r.y,width:i.width,height:i.height}}var Ht=[];for(let i=0;i<256;i++)Ht[i]=(i<16?"0":"")+i.toString(16);function G(){let i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return Ht[i&255]+Ht[i>>8&255]+Ht[i>>16&255]+Ht[i>>24&255]+"-"+Ht[r&255]+Ht[r>>8&255]+"-"+Ht[r>>16&15|64]+Ht[r>>24&255]+"-"+Ht[e&63|128]+Ht[e>>8&255]+"-"+Ht[e>>16&255]+Ht[e>>24&255]+Ht[t&255]+Ht[t>>8&255]+Ht[t>>16&255]+Ht[t>>24&255]}function Eo(i=6){return G().substring(0,i-1)}function fO(i){return[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}]}function Vx(i,r){let e=fO(r).map(t=>({p:t,d:Pe(t,i)}));return e.sort((t,n)=>Math.sign(t.d-n.d)),e[0].p}function De(i,r,e){if(i==null)return null;if(r==="$data"||r==null)return i;let t=r.match(/^\{(.*)\}$/);if(t){let a={},l=t[1].split(",");for(let h=0;h<l.length;h++){let d=l[h].split(":"),u=De(i,d[1]);a[vt(d[0])]=u||d[1].replace(/'/g,"")}return a}r=r.replace(/\['([^']*)'\]/g,".$1");let n=i,o=n,s=null;return r.replace(/([^\.])+/g,(a,l,h,d)=>{if(s!=null)return;let u=a.match(/([^\[0-9]+){1}(\[)([0-9+])/),p=h+a.length>=d.length,g=function(){return o[u[1]]||function(){return o[u[1]]=[],o[u[1]]}()};if(p)if(u){let m=g(),E=u[3];e==null?s=m[E]:m[E]=e}else e==null?s=o[a]:o[a]=e;else if(u){let m=g();o=m[u[3]]||function(){return m[u[3]]={},m[u[3]]}()}else o=o[a]||function(){return o[a]={},o[a]}()}),s}function al(i,r){let e={left:[],right:[]};for(let t=0;t<i.length;t++){let n=i[t];r(n)?e.left.push(n):e.right.push(n)}return e}function Gx(i){return i.filter(r=>r!=null&&vt(r).length>0)}function $x(i,r){for(let e=0;e<i.length;e++){let t=i[e];t==null||t.length===0||r(e,t)}}function Oc(i,r,e){let t=e.map((n,o)=>{let[s,a]=[r.x+r.width*n.x,r.y+r.height*n.y],l=Math.sqrt(Math.pow(i.x-s,2)+Math.pow(i.y-a,2));return{p:n,idx:o,distance:l}});return t.sort((n,o)=>n.distance<o.distance?-1:1),t[0]}function vs(i,r,e){return i.has(r)||i.set(r,e()),i.get(r)}function Cs(i,r,e){return i[r]==null&&(i[r]=e()),i[r]}function _c(i){return Object.prototype.toString.call(i)==="[object Number]"}function X(i){return typeof i=="string"}function mo(i){return typeof i=="boolean"}function lr(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Object]"}function yO(i){return Object.prototype.toString.call(i)==="[object Date]"}function rn(i){return Object.prototype.toString.call(i)==="[object Function]"}function xO(i){return rn(i)&&((i==null?void 0:i.toString())||"").startsWith("class")}function _N(i){return rn(i)&&i.name!=null&&i.name.length>0}function ll(i){for(let r in i)if(i.hasOwnProperty(r))return!1;return!0}function hl(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null)return!1;for(let e in i){let t=i[e],n=r[e];if(!mO(t,n))return!1}return!0}function ON(i){let r={};for(let e in i)i[e]!=null&&(r[e]=i[e]);return r}function lt(i){if(X(i))return""+i;if(mo(i))return!!i;if(yO(i))return new Date(i.getTime());if(rn(i))return i;if(Array.isArray(i))return i.map(r=>lt(r));if(lr(i)){let r={};for(let e in i)r[e]=lt(i[e]);return r}else return i}function An(i,r,e,t){let n={},o,s,a={};for(e=e||[],t=t||[],s=0;s<e.length;s++)n[e[s]]=!0;for(s=0;s<t.length;s++)a[t[s]]=!0;let l=lt(i);for(s in r)if(l[s]==null||a[s])l[s]=r[s];else if(n[s])o=[],o.push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(r[s]),l[s]=o;else if(X(r[s])||mo(r[s])||rn(r[s])||_c(r[s]))l[s]=r[s];else if(Array.isArray(r[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,r[s]),l[s]=o;else if(lr(r[s])){lr(l[s])||(l[s]={});for(let h in r[s])l[s][h]=r[s][h]}return l}function mO(i,r){if(i!=null&&r==null)return!1;if((i==null||X(i)||mo(i)||_c(i))&&i!==r)return!1;if(Array.isArray(i))if(Array.isArray(r)){if(!bO(i,r))return!1}else return!1;else if(lr(i))if(lr(i)){if(!hl(i,r))return!1}else return!1;return!0}function bO(i,r){if(i==null&&r==null)return!0;if(i==null&&r!=null)return!1;if(i!=null&&r==null||i.length!==r.length)return!1;for(let e=0;e<i.length;e++)if(!mO(i[e],r[e]))return!1;return!0}function Bx(i,r){return i.x===r.x&&i.y===r.y}function Fx(i,r){let e=i.slice(),t={x:e[0],y:e[1],cr:0,sr:0};return r.forEach(n=>{t=Me(t,n.c,n.r)}),t}function Ux(i,r){return r.forEach(e=>{i=Me(i,e.c,e.r)}),i}function nm(i,r,e){if(i==null)return;let t=i,n=t;return r.replace(/([^\.])+/g,(o,s,a,l)=>{let h=o.match(/([^\[0-9]+){1}(\[)([0-9+])/),d=a+o.length>=l.length,u=function(){return n[h[1]]||function(){return n[h[1]]=[],n[h[1]]}()};if(d)h?u()[h[3]]=e:n[o]=e;else if(h){let p=u();n=p[h[3]]||function(){return p[h[3]]={},p[h[3]]}()}else n=n[o]||function(){return n[o]={},n[o]}();return""}),i}function fo(i,r,e,t){let n=s=>{let a=s.match(/(\${.*?})/g);if(a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-1)]||"";h!=null&&(s=s.replace(a[l],h))}if(a=s.match(/({{.*?}})/g),a!=null)for(let l=0;l<a.length;l++){let h=r[a[l].substring(2,a[l].length-2)]||"";h!=null&&(s=s.replace(a[l],h))}return s},o=s=>{if(s!=null){if(xO(s))return s;if(X(s))return n(s);if(rn(s)&&!t&&(e==null||(s.name||"").indexOf(e)===0))return s(r);if(Array.isArray(s)){let a=[];for(let l=0;l<s.length;l++)a.push(o(s[l]));return a}else if(lr(s)){let a={};for(let l in s)a[l]=o(s[l]);return a}else return s}};return o(i)}var Ts=class{constructor(r,...e){this.sorter=r;c(this,"stack");this.stack=e.slice(),this.stack.sort(this.sorter)}get length(){return this.stack.length}add(r){tm(r,this.stack,this.sorter,!0)}update(r){this.delete(r),this.add(r)}pop(){return this.stack.pop()}delete(r){let e=this.stack.indexOf(r);e>-1&&this.stack.splice(e,1)}head(){return this.stack.length===0?null:this.stack[0]}peek(){return this.stack.length===0?null:this.stack[this.stack.length-1]}isEmpty(){return this.stack.length===0}clear(){this.stack.length=0}};function ul(i){return j(i)?i.getParent().id:i.getFullId()}function Kn(i){return j(i)?i.getParent():i}function J(i){return i!=null&&i.objectType===ce.objectType}function lm(i){return J(i)&&i.group!=null}function Y(i){return i!=null&&i.objectType===se.objectType}function hm(i){return Y(i)&&i.group!=null}function nt(i){return i!=null&&i.objectType===Ue.objectType}function j(i){return i!=null&&i.objectType===de.objectType}function Xx(i){return i.objectType===ce.objectType||i.objectType===se.objectType}function _i(i){return J(i)||Y(i)||j(i)}function RN(i,...r){let e=ul(i.source),t=ul(i.target);return r.find(n=>e===n.id||t===n.id)!=null}function cm(i){return i.id}var LN=".";function cl(i,r){if(r==null)return i.edges;{let e=[];for(let t=0;t<i.edges.length;t++)r(i.edges[t])&&e.push(i.edges[t]);return e}}function AO(i,r){let e=cl(i,r).slice(0);if(J(i)||Y(i))for(let t=0;t<i.ports.length;t++)e.push.apply(e,cl(i.ports[t],r));return e}function Yx(i){let r=this.getFullId();return cl(i,e=>e.source.getFullId()===r)}function zx(i){let r=this.getFullId();return cl(i,e=>e.target.getFullId()===r)}function wN(i){let r=Yx(i).slice(0);if(J(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,Yx(i.ports[e]));return r}function DN(i){let r=zx(i).slice(0);if(J(i)||Y(i))for(let e=0;e<i.ports.length;e++)r.push.apply(r,zx(i.ports[e]));return r}function dm(i,r,e,t){let n=new Set,o=(a,l)=>{let h=l.source===a||l.target===a;return h?t?t(l):h:!1},s=a=>{a.members.forEach(l=>{let h=o.bind(null,l);(e?AO(l,h):cl(l,h)).forEach(u=>n.add(u)),!r&&Y(l)&&s(l)})};return s(i),Array.from(n)}function Dc(i){let r=0,e=i.group;for(;e!=null;)r++,e=e.group;return r}function Sn(i){let r=Kn(i),e=[],t=r.group;for(;t!=null;)e.push(t),t=t.group;return e}function ke(i,r){return i==null||r==null?!1:Sn(i).indexOf(r)!==-1}function jx(i,r){let e=!1,t=n=>{for(let o=0;o<n.members.length;o++)if(Y(n.members[o]))if(n.members[o].id===i.id){e=!0;break}else t(n.members[o])};return t(r),e}function Ps(i){let r=[],e=t=>{t.members.forEach(n=>{r.push(n),Y(n)&&e(n)})};return e(i),r}function NN(i,r){let t=!(J(i)||Y(i))||r?i.getSourceEdges():i.getAllSourceEdges();return Array.from(new Set(t.map(n=>n.target)))}function IN(i,r){let t=!(J(i)||Y(i))||r?i.getTargetEdges():i.getAllTargetEdges();return Array.from(new Set(t.map(n=>n.source)))}function MN(i,r){let e=new Set,t=J(i)||Y(i),n=!t||r?i.getSourceEdges():i.getAllSourceEdges(),o=!t||r?i.getTargetEdges():i.getAllTargetEdges();return n.forEach(s=>e.add(s.target)),o.forEach(s=>e.add(s.source)),Array.from(e)}function Hx(i,r){return i.getSourceEdges().find(e=>e.target===r)!=null||i.getTargetEdges().find(e=>e.source==r)!=null}var dl=class{constructor(r){c(this,"nodes",[]);c(this,"id");c(this,"edges",[]);c(this,"groups",[]);c(this,"we",new Map);c(this,"Gr",new Map);c(this,"Ue",new Map);c(this,"defaultDirected");c(this,"defaultCost");c(this,"qt");c(this,"typeFunction");c(this,"enableSubgraphs");c(this,"portSeparator");c(this,"zo",{});r=r||{},this.nodes=[],this.edges=[],this.groups=[],this.id=r.id,this.defaultDirected=r.defaultDirected!==!1,this.defaultCost=r.defaultCost||1,this.qt=r.defaultIdFunction||cm,this.typeFunction=r.typeFunction||function(e){return e.type||"default"},this.enableSubgraphs=r.enableSubgraphs===!0,this.portSeparator=r.portSeparator||LN}xa(r){delete this.zo[r.id]}ba(r){this.zo[r.id]=r}uE(){this.zo={}}getIdFunction(){return this.qt}setIdFunction(r){this.qt=r}getType(r){return this.typeFunction(r)}getId(r,e){return r==null?G():typeof r=="string"?r:(e||this.getIdFunction())(r)||G()}getTopLevelElements(){return this.zo}setEnableSubgraphs(r){this.enableSubgraphs=r}setPortSeparator(r){this.portSeparator=r}getPortSeparator(){return this.portSeparator}splitPortId(r){return r!=null?r.split(this.portSeparator):[]}getVertexByPortId(r){let e=this.splitPortId(r);if(e.length===2)return this.we.get(e[0])||this.Ue.get(e[0])}getVertex(r,e){if(r==null)return null;let t;if(typeof r!="string"){if(r.constructor===de||r.constructor===ce||r.constructor===se)return r;let s=r;if(t=this.qt(r),typeof t!="string")return s}t=r;let n=this.enableSubgraphs?t.split("/"):[t],o=s=>{if(this.we.has(s))return this.we.get(s);if(this.Ue.has(s))return this.Ue.get(s);let a=s.split(this.portSeparator),l=a[0],h=this.we.get(l)||this.Ue.get(l);if(a.length===2&&h!=null){let d=h.getPort(a[1]);return d==null&&e&&(d=h.$addPort(a[1])),d}else return h};if(n.length==1)return o(n[0]);if(n.length>1&&n.length%2==0)throw"Subgraph path format error.";{let s=null,a=null;for(let l=0;l<n.length-1;l+=2)s=o(n[l]),a=s.getGraph(n[l+1]);return a.getVertex(n[n.length-1])}}clear(){this.nodes.length=0,this.groups.length=0,this.we.clear(),this.Gr.clear(),this.Ue.clear(),this.uE()}getVertices(){return this.nodes}getVertexCount(){return this.nodes.length}getVertexAt(r){return this.nodes[r]}getEdgeCount(){return this.Gr.size}addEdge(r,e,t){let n=r.directed==null?this.defaultDirected===!0:r.directed!==!1,o=r.cost||this.defaultCost,s=this.getVertex(r.source,!0),a=this.getVertex(r.target,!0);if(e=e||this.getId(r.data,t),s==null||s.objectType==null)throw new TypeError("Unknown source node ["+r.source+"]");if(a==null||a.objectType==null)throw new TypeError("Unknown target node ["+r.target+"]");let l=new Ue({source:s,target:a,cost:o,directed:n,data:r.data||{},id:e,graph:this,transient:r.transient,anchors:r.anchors});return l.source.$addEdge(l),l.source!==l.target&&l.target.$addEdge(l),this.Gr.set(e,l),r.geometry!=null&&(l.geometry=r.geometry),l}addNode(r,e){let t=new ce(this,r||{},e||this.qt);return this.we.has(t.id)?null:(this.nodes.push(t),this.we.set(t.id,t),this.ba(t),t)}addNodes(r,e){for(let t=0;t<r.length;t++)this.addNode(r[t],e||this.qt)}addGroup(r,e){let t=new se(this,r,e||this.qt);return this.Ue.has(t.id)?this.Ue.get(t.id):(this.groups.push(t),this.Ue.set(t.id,t),this.ba(t),t)}getGroupCount(){return this.groups.length}getGroupAt(r){return this.groups[r]}getGroups(){return this.groups}$addMemberToGroup(r,e){let t=typeof e=="string"?this.Ue.get(e):e,n=this.getVertex(r);n&&t&&(t.$addMember(n),this.xa(n))}$removeMemberFromGroup(r){let e=this.getVertex(r);e&&e.group&&(e.group.$removeMember(e),this.ba(e))}getGroup(r){return typeof r=="string"?this.Ue.get(r):r}deleteGroup(r,e){let t={group:typeof r=="string"?this.Ue.get(r):r,edges:[],nodes:[],nestedGroups:[],children:[]};if(t.group){t.parentGroup=t.group.group,t.children=t.group.members.slice();let n;if(e){let{left:l,right:h}=al(t.group.getMembers(),d=>Y(d));l.forEach(d=>{t.nestedGroups.push(this.deleteGroup(d,!0))}),h.forEach(d=>{t.nodes.push(this.deleteNode(d))})}else t.group.getMembers().forEach(l=>delete l.group);t.group.members.length=0,t.edges=t.group.getAllDirectEdges().slice();let o=t.edges.length;for(n=0;n<o;n++)this.deleteEdge(t.edges[n]);let s=t.group.getPorts();for(let l=0;l<s.length;l++)this.deletePort(s[l]);this.Ue.delete(t.group.id);let a=-1;for(let l=0;l<this.groups.length;l++)if(this.groups[l].id===t.group.id){a=l;break}a>-1&&this.groups.splice(a,1),t.group.group!=null&&t.group.group.$removeMember(r),this.xa(t.group)}return t}deletePort(r){let e=r.getEdges();for(let t=0;t<e.length;t++)this.deleteEdge(e[t]);return e}$_removeNodeFromCache(r){let e=-1;for(let t=0;t<this.nodes.length;t++)if(this.nodes[t].id===r.id){e=t;break}e>-1&&(this.nodes.splice(e,1),r.group!=null&&r.group.$removeMember(r)),this.we.delete(r.id)}deleteNode(r){let e=this.getVertex(r),t={node:null,edges:[],parentGroup:null};if(e){t.node=e,t.parentGroup=e.group;let n=e.getPorts();for(let s=0;s<n.length;s++)this.deletePort(n[s]);let o=e;this.$_removeNodeFromCache(o),t.edges=e.getEdges().slice();for(let s=0;s<t.edges.length;s++)this.deleteEdge(t.edges[s]);this.xa(e)}return t}deleteEdge(r){if(r=this.getEdge(r),r==null)return;let e=this.getVertex(r.source,!1);e&&e.$deleteEdge(r);let t=this.getVertex(r.target,!1);t&&t.$deleteEdge(r),this.Gr.delete(r.getId())}getEdge(r){if(r!=null){if(typeof r!="string"){if(r.constructor===Ue)return r;let e=r;if(r=this.qt(r),typeof r!="string")return e}return this.Gr.get(r)}}getEdges(r){r=r||{};let e=r.source!=null,t=r.target!=null,n=r.node?this.getVertex(r.node):null,o=r.filter||function(){return!0},s=d=>(!e||(r.source===!0?d.source===n:d.source!==n))&&(!t||(r.target===!0?d.target===n:d.target!==n)),a=[],l=d=>{o(d)&&s(d)&&a.push(d)},h;if(r.node){let u=this.getVertex(r.node).getAllEdges();for(h=0;h<u.length;h++)l(u[h])}else this.Gr.forEach((d,u)=>l(d));return a}getAllEdges(){let r=[];return this.Gr.forEach((e,t)=>r.push(e)),r}renamePort(r,e){return r.getParent().$renamePort(r,e)?(r.id=e,!0):!1}findPath(r,e,t,n,o){let s=this.getVertex(r),a=this.getVertex(e);return vc({graph:this,source:s,target:a,strict:t!==!1,nodeFilter:n,edgeFilter:o})}getDistance(r,e,t){return this.findPath(r,e,t).pathDistance}setTarget(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.target;return r.target.$deleteEdge(r),r.target=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}setSource(r,e){let t=this.getVertex(e);if(t==null)return{success:!1};let n=r.source;return r.source.$deleteEdge(r),r.source=t,t.$addEdge(r),{old:n,edge:r,new:t,success:!0}}printPath(r,e){let t=this.getVertex(r),n=this.getVertex(e),o=this.findPath(t,n).path,s="["+t.id+" - "+n.id+"] : ";for(let a=0;a<o.length;a++)s=s+"{ vertex:"+o[a].vertex.id+", cost:"+o[a].cost+", edge: "+(o[a].edge&&o[a].edge.getId())+" } ";return s}getDiameter(r){let e=0;for(let t=0;t<this.nodes.length;t++)for(let n=0;n<this.nodes.length;n++)if(n!=t){let o=vc({graph:this,source:this.nodes[t],target:this.nodes[n]});if(o.path==null||o.path.length==0){if(!r)return 1/0}else e=Math.max(e,o.pathDistance)}return e}getCentrality(r){let e=this.getVertex(r);return(e.getIndegreeCentrality()+e.getOutdegreeCentrality())/(this.getVertexCount()-1)}getIndegreeCentrality(r){return this.getVertex(r).getIndegreeCentrality()/(this.getVertexCount()-1)}getOutdegreeCentrality(r){return this.getVertex(r).getOutdegreeCentrality()/(this.getVertexCount()-1)}getCloseness(r){return 1/this.getFarness(r)}getFarness(r){let e=this.getVertex(r),t=vc({graph:this,source:e,target:e,processAll:!0}),n=0;for(let o in t.dist)n+=t.dist[o];return n/(this.getVertexCount()-1)}getBetweenness(r){let e=this.getVertexCount(),t=(e-1)*(e-2)/2,n=0,o=0,s=(h,d,u,p,g)=>{let m=u.parents[h][d];if(m.length==0){let E=p.slice();E.unshift(h),g.push(E)}else for(let E=0;E<m.length;E++)if(p.indexOf(m[E][0].id)==-1){let y=p.slice();y.unshift(m[E][0].id),s(h,m[E][0].id,u,y,g)}},a=this.getVertex(r),l=Sx({graph:this,focus:a});for(let h in l.paths)for(let d in l.paths[h])if(h!=d){let u=[],p=0;s(h,d,l,[d],u);for(let g=0;g<u.length;g++){let m=u[g].indexOf(a.id);m>0&&m<u[g].length-1&&p++}n+=p/u.length,o+=p}return n/t}inspect(){let r="";for(let e=0;e<this.nodes.length;e++)r+=this.nodes[e].inspect()+`
|
|
2
|
+
`;return r}serialize(){let r={nodes:[],edges:[],groups:[]},e,t,n;for(let o=0;o<this.nodes.length;o++)if(e=this.nodes[o],!e.transient){r.nodes.push(Object.assign({},e.data)),t=e.getAllEdges();for(let s=0;s<t.length;s++)if(t[s].source==e||t[s].source.objectType===de.objectType&&t[s].source.getParent()==e){let a={source:t[s].source.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}for(let o=0;o<this.groups.length;o++){n=this.groups[o],r.groups.push(Object.assign({},n.data)),t=n.getEdges();for(let s=0;s<t.length;s++)if(t[s].source===n){let a={source:n.getFullId(),target:t[s].target.getFullId()};t[s].data&&(a.data=Object.assign({},t[s].data)),t[s].geometry&&(a.geometry=Object.assign({},t[s].geometry)),r.edges.push(a)}}return r}getClusters(){return this.Uc(this.nodes,this.groups)}getCluster(r){let e=J(r)?[r]:[],t=Y(r)?[r]:[];return this.Uc(e,t)[0]}Uc(r,e){let t=[],n={},o,s=(a,l)=>{if(a==null||n[a.id])return;l==null?(l=new Cc(a),t.push(l)):l.addVertex(a),n[a.id]=!0;let h=a.getAllEdges();for(let d=0;d<h.length;d++){let u=h[d].source===a?h[d].target:h[d].source;s(u,l)}};for(o=0;o<r.length;o++)s(this.nodes[o]);for(o=0;o<e.length;o++)s(this.groups[o]);return t}},Lc=class{constructor(r,e={}){this.graph=r;this.data=e;c(this,"atts",new Map);c(this,"type");this.data=this.data||{},this.type=r.getType(this.data)}setAttribute(r,e){this.atts.set(r,e)}getAttribute(r){return this.atts.get(r)}getType(){return this.type}setType(r){this.type=r}};function Rc(i){return i instanceof de?i.id:i}var wc=class extends Lc{constructor(e,t,n){super(e,t);this.graph=e;c(this,"id");c(this,"transient");c(this,"transientRenderer");c(this,"dummy");c(this,"edges",[]);c(this,"indegreeCentrality",0);c(this,"outdegreeCentrality",0);c(this,"graphs",[]);this.id=e.getId(t,n),this.data=typeof t=="string"?{id:t}:t}getIndegreeCentrality(){return this.indegreeCentrality}getOutdegreeCentrality(){return this.outdegreeCentrality}addGraph(e){return e=typeof e=="string"?new dl({id:e}):e,this.graphs.push(e),e.id||(e.id=""+this.graphs.length),e}getGraph(e){for(let t=0;t<this.graphs.length;t++)if(this.graphs[t].id===e)return this.graphs[t]}getFullId(){return this.id}getEdges(e){if(e==null||e.filter==null)return this.edges;{let t=[];for(let n=0;n<this.edges.length;n++)e.filter(this.edges[n])&&t.push(this.edges[n]);return t}}getSourceEdges(){return this.getEdges({filter:e=>e.source==this})}getTargetEdges(){return this.getEdges({filter:e=>e.target==this})}getAllSourceEdges(){return this.getSourceEdges()}getAllTargetEdges(){return this.getTargetEdges()}$addEdge(e){this.edges.push(e),(e.source===this||!e.isDirected())&&this.outdegreeCentrality++,(e.target===this||!e.isDirected())&&this.indegreeCentrality++}$deleteEdge(e){let t=-1;for(let n=0;n<this.edges.length;n++)if(this.edges[n].getId()===e.getId()){t=n;break}return t>-1?(this.edges.splice(t,1),(e.source===this||!e.isDirected())&&this.outdegreeCentrality--,(e.target===this||!e.isDirected())&&this.indegreeCentrality--,!0):!1}inspect(){let e="{ id:"+this.id+`, edges:[
|
|
3
3
|
`;for(let t=0;t<this.edges.length;t++)e+=this.edges[t].inspect()+`
|
|
4
|
-
`;return e+="]}",e}isChildOf(e){return!1}},rm=class rm extends Rc{constructor(e,t,n){super(e,t,n);c(this,"objectType",rm.objectType);c(this,"ports",[]);c(this,"group");c(this,"portMap",{});c(this,"defaultInternalCost",0);c(this,"internalEdges",{})}getAllEdges(e){let t=e==null?null:{filter:e},n=this.getEdges(t).slice(0);for(let o=0;o<this.ports.length;o++)n.push.apply(n,this.ports[o].getEdges(t));return n}getAllSourceEdges(){let e=this.getSourceEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getAllTargetEdges(){let e=this.getTargetEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getDirectEdges(e){return this.getEdges(e==null?null:{filter:e})}getDirectSourceEdges(){return this.getSourceEdges()}getDirectTargetEdges(){return this.getTargetEdges()}getPortEdges(e){let t=[];for(let n=0;n<this.ports.length;n++)t.push.apply(t,this.ports[n].getEdges(e==null?null:{filter:e}));return t}getPortSourceEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getPortTargetEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getIndegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getIndegreeCentrality();return this.indegreeCentrality+e}getOutdegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getOutdegreeCentrality();return this.outdegreeCentrality+e}getPorts(){return this.ports}$addPort(e,t){let n=this.graph.getId(e,t),o=this.getPort(n);return o==null&&(o=new de(this,e,t),this.ports.push(o),this.portMap[o.id]=o),o}$setPort(e,t){let n=this.getPort(e);return n||(n=this.$addPort({id:e})),n.data=t,n.setType(this.graph.getType(t)),n}getPort(e){return this.portMap[e]}$renamePort(e,t){return this.portMap[e.id]?(this.portMap[t]=this.portMap[e.id],delete this.portMap[e.id],!0):!1}$removePort(e){let t=!1;if(e){let n=_c(e),o=-1;for(let s=0;s<this.ports.length;s++)if(this.ports[s].id===n){o=s;break}if(o!=-1){let s=this.ports[o];this.graph.deletePort(s),this.ports.splice(o,1),t=!0}delete this.portMap[n]}return t}$setDefaultInternalCost(e){this.defaultInternalCost=e}getInternalEdge(e,t){let n=_c(e),o=_c(t),s={source:this.portMap[n],target:this.portMap[o],cost:1/0};if(s.source&&s.target){let a=this.internalEdges[n+"-"+o]||{cost:this.defaultInternalCost,directed:!1};Object.assign(s,a)}return s}$setInternalEdge(e,t,n,o){let s=_c(e),a=_c(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(rm,"objectType","Node");var ce=rm,nm=class nm extends Rc{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",nm.objectType)}getParent(){return this.parent}getFullId(){return this.parent.id+this.graph.getPortSeparator()+this.id}isChildOf(e){return this.parent===e}getAllEdges(e){return this.getEdges(e==null?null:{filter:e})}};c(nm,"objectType","Port");var de=nm,im=class im extends ce{constructor(e,t,n){super(e,t,n);c(this,"objectType",im.objectType);c(this,"members",[]);c(this,"Fo",{})}$addMember(e){return this.Fo[e.id]!=null?!1:(this.members.push(e),this.Fo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Fo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Fo[t.id]),t.group&&t.group.id===this.id&&delete t.group,!0}else return!1}getAllDirectEdges(e){let t=[],n,o=e==null?null:{filter:e};t.push.apply(t,this.getEdges(o).slice(0));let s=this.getPorts();for(n=0;n<s.length;n++)t.push.apply(t,s[n].getEdges(o));return t}getInternalEdges(e){let t=[],n={};for(let o=0;o<this.members.length;o++)Array.prototype.push.apply(t,this.members[o].getAllEdges(e).filter(function(s){let a=s.getId(),l=n[a]==null;return n[a]=!0,l}));return t}};c(im,"objectType","Group");var se=im,om=class om extends Oc{constructor(e){super(e.graph,e.data);c(this,"objectType",om.objectType);c(this,"source");c(this,"target");c(this,"cost");c(this,"directed");c(this,"id");c(this,"geometry");c(this,"transient");c(this,"anchors");this.transient=e.transient===!0,this.source=e.source,this.target=e.target,this.cost=e.cost||1,this.directed=e.directed!==!1,this.id=e.id,e.anchors&&(this.anchors=e.anchors)}getCost(){return this.cost}setCost(e){this.cost=e}getId(){return this.id==null?this.source.id+"_"+this.target.id:this.id}getFullId(){return this.getId()}setId(e){this.id=e}isDirected(){return this.directed}setDirected(e){this.directed=e}inspect(){if(this.id!=null)return"{ id:"+this.id+", cost:"+this.cost+", directed:"+this.directed+", source:"+this.source.id+", target:"+this.target.id+"}"}};c(om,"objectType","Edge");var Ue=om;var Hx="undoRedo",yo="userActivity",ul="api",pl="dataLoad",kx="transient",Wx="copyPaste";var MN=(i,r,e)=>{let t=i.nodes||[],n=i.edges||[],o=i.groups||[],s=new Map,a=new Map,l=new Map,h=r.getGroups().map(p=>p.id),d=p=>{let g=l.get(p);g!=null&&g.forEach(m=>{h.push(r.addGroup(m).id)}),l.delete(p),g!=null&&g.forEach(m=>{d(m.id)})};for(let p=0;p<o.length;p++){let g=o[p];if(e.groupDecorator&&e.groupDecorator(g),g[r.groupProperty]!=null&&h.indexOf(g[r.groupProperty])===-1)vs(l,g[r.groupProperty],()=>[]).push(g);else{let m=r.addGroup(g);a.set(m.id,g),h.push(m.id),d(m.id)}}l.forEach((p,g)=>{if(h.indexOf(g)===-1)throw new Error("Parent group ["+g+"] not found");p.forEach(m=>h.push(r.addGroup(m).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let g=r.addNode(t[p]);s.set(g.id,t[p])}function u(p){return X(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let g=n[p].data||{},m={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:g};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(g,E,y)}n[p].anchors&&(m.anchors=n[p].anchors),n[p].geometry&&(m.geometry=n[p].geometry),r.$_addEdge(m,pl,null)}},VN=(i,r)=>{let e=i.getGraph(),t={nodes:[],edges:[],groups:[]},n,o,s;for(let a=0;a<e.nodes.length;a++){n=e.nodes[a];let l=n.transient;if(!l){let h=Object.assign({},n.data);n.group==null&&delete h[i.groupProperty],t.nodes.push(h)}o=n.getAllEdges();for(let h=0;h<o.length;h++){let d=o[h],u={},p=!1;(d.source===n||d.source.objectType===de.objectType&&d.source.getParent()==n)&&(d.source.dummy?(p=!0,u.source={x:d.source.data[i.modelLeftAttribute],y:d.source.data[i.modelTopAttribute]}):u.source=d.source.getFullId(),d.target.dummy?(p=!0,u.target={x:d.target.data[i.modelLeftAttribute],y:d.target.data[i.modelTopAttribute]}):u.target=d.target.getFullId(),(!l||p)&&(d.data&&(u.data=Object.assign({},d.data)),d.geometry&&(u.geometry=Object.assign({},d.geometry)),t.edges.push(u)))}}for(let a=0;a<e.groups.length;a++){s=e.groups[a];let l=Object.assign({},s.data);s.group==null&&delete l[i.groupProperty],t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===de.objectType&&o[h].source.getParent()==s){let d={source:s.getFullId()};o[h].target.dummy?d.target={x:o[h].target.data[i.modelLeftAttribute],y:o[h].target.data[i.modelTopAttribute]}:d.target=o[h].target.getFullId(),o[h].data&&(d.data=Object.assign({},o[h].data)),o[h].geometry&&(d.geometry=Object.assign({},o[h].geometry)),t.edges.push(d)}}return t},GN=(i,r,e)=>{let t=n=>{let o=r.addNode(n);if(n.children)for(let s=0;s<n.children.length;s++){let a=r.addNode(n.children[s]);r.$_addEdge({source:o,target:a},pl,null),t(n.children[s])}};t(i)},kt="json",cm="hierarchical-json",bO={[kt]:VN},AO={[kt]:MN,[cm]:GN};function Zx(i,r){AO[i]=r}function $N(i,r){bO[i]=r}function Jx(i,r,e,t){let n=AO[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function dm(i,r,e){let t=bO[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var um=class{constructor(){c(this,"ze",{});c(this,"ya",!1);c(this,"xa",!1);c(this,"oE",{ready:!0});c(this,"Gc",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.xa)this.Gc.unshift(arguments);else{if(this.xa=!0,!this.ya&&this.ze[r]){let o=this.ze[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.oE[r])this.ze[r][s](e,t);else try{n=this.ze[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.ze==null||this.ze[r]==null)&&(a=!0)}}this.xa=!1,this.sE()}return n}sE(){let r=this.Gc.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.ze={};else if(arguments.length===1){if(typeof r=="string")delete this.ze[r];else if(r.si){let t;for(let n in r.si)t=r.si[n],Jg(this.ze[t]||[],r)}}else arguments.length===2&&Jg(this.ze[r]||[],e);return this}getListener(r){return this.ze[r]||[]}isSuspendEvents(){return this.ya}setSuspendEvents(r){this.ya=r}bind(r,e,t){return this.bindUnchecked(r,e,t)}bindAll(r,e,t){return r.forEach(n=>this.bind(n,e,t)),this}bindUnchecked(r,e,t){return(o=>{Ix(this.ze,o,e,t),e.si=e.si||{},e.si[G()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},Ft=class extends um{shouldFireEvent(r,e,t){return!0}};var gl=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"$c",[]);c(this,"dn",{});this.result=r.getGraph().findPath(e.source,e.target,e.strict,e.nodeFilter,e.edgeFilter);for(let t=0;t<this.result.path.length;t++)this.$c.push(this.result.path[t].vertex),this.dn[this.result.path[t].vertex.getFullId()]=[this.result.path[t].vertex,t]}deleteEdges(){for(let r=0;r<this.result.path.length;r++)this.result.path[r].edge&&this.instance.removeEdge(this.result.path[r].edge);return this}deleteVertices(){for(let r=0;r<this.result.path.length;r++)this.instance.removeNode(this.result.path[r].vertex);return this}contains(r,e){let t=this.instance.findGraphObject(r),n=!1;if(t){for(let o=0;o<this.result.path.length;o++)if(this.result.path[o].vertex==t||this.result.path[o].edge==t||!e&&this.result.path[o].vertex.objectType==de.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.$c}getVertex(r){return this.dn[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.dn[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}Ye(r,e){for(let t=e||0;t<this.result.path.length;t++)try{r(t,this.result.path[t])}catch(n){U("Path iterator function failed",n)}}each(r){this.Ye((e,t)=>{r(e,t)})}eachVertex(r){this.Ye((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.Ye((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.Ye((e,t)=>{J(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.Ye((e,t)=>{Y(t.vertex)&&r(e,t.vertex)})}getVertexCount(){return this.result.path.length}getNodeAt(r){return this.result.path[r].vertex}getEdgeCount(){return this.result.path.length==0?0:this.result.path.length-1}getEdgeAt(r){return r<0&&(r=this.result.path.length-1+r),this.result.path.length>r+1?this.result.path[r+1].edge:null}deleteAll(){this.deleteVertices()}isEmpty(){return this.result.path.length==0}getCost(){return this.result.pathDistance}exists(){return this.result.pathDistance!=null}};var wc=class{constructor(r,e){c(this,"Bc",new Map);c(this,"Fc",new Map);c(this,"Uc",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Bc.set(s,t[s]);let n=e.groups||{};for(let s in n)this.Fc.set(s,n[s]);let o=e.ports||{};for(let s in o)this.Uc.set(s,o[s])}}getNodeDefinition(r){return this.Bc.get(r)||{}}getGroupDefinition(r){return this.Fc.get(r)||{}}getPortDefinition(r){return this.Uc.get(r)||{}}};var Sn=class i{constructor(r){c(this,"instance");c(this,"adapter");c(this,"$vertices",[]);c(this,"parameters");c(this,"done");c(this,"width");c(this,"height");c(this,"container");c(this,"containerSize");c(this,"padding");c(this,"xShift");c(this,"yShift");c(this,"ai");this.ai=r.options.locationFunction,this.adapter=r.adapter,this.instance=r.instance,this.container=r.container,this.containerSize=this.adapter.getSize(this.container),this.width=r.options.width||this.containerSize.width,this.height=r.options.height||this.containerSize.height,this.padding=r.options.padding,this.done=!1,this.parameters=r.options||{}}un(){this.done=!1,this.$vertices.length=0,this.reset()}static aE(){return{padding:{x:0,y:0}}}lE(){let r=Object.assign(i.aE(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return Cs(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}hE(r,e,t,n,o){t=t||10,n=n||10;let s=Math.floor(Math.random()*t),a=Math.floor(Math.random()*n);return{x:s,y:a}}zc(r){if(this.instance==null)return;this.containerSize=this.adapter.getSize(this.container),this.width=this.containerSize.width,this.height=this.containerSize.height;let e=this.lE();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,g,m)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,g),s=Math.min(s,m),a=Math.max(a,g+E.width),l=Math.max(l,m+E.height),t[p]={x:g,y:m}},d=p=>t[p];this.$vertices.forEach(p=>this.getSize(p.id,n)),this.begin(this.instance,d,h,n,e);let u=()=>{let p={};this.$vertices.forEach(g=>p[g.id]=t[g.id]),this.end(this.instance,d,h,n,e),r&&r({positions:p,bounds:{xmin:o,ymin:s,xmax:a,ymax:l},sizes:n,layout:this})};for(;!this.done;)this.step(this.instance,d,h,n,e);u()}relayout(r,e){this.un(),r!=null&&(this.parameters=r),this.zc(e)}layout(r){this.done=!1,this.zc(r)}};var Dc=class{};var SO={},nt={get:(i,r)=>{let e=SO[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{SO[i]=r}};var pm=class pm extends Sn{constructor(e){super(e);c(this,"type",pm.type)}getDefaultParameters(){return{}}reset(){}begin(e,t,n,o,s){this.$vertices.forEach(a=>n(a.id,0,0))}end(e,t,n,o,s){}step(e,t,n,o,s){this.done=!0}};c(pm,"type","Empty");var _s=pm;nt.register(_s.type,_s);function BN(i){return{x:i.data.left,y:i.data.top}}var qn=class extends Sn{constructor(e){super(e);c(this,"Yc");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.Yc=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.Yc||BN)(e)}begin(e,t,n,o,s){let a=this.adapter.getElements(),l=a.length;for(let h=0;h<l;h++){let d=a[h],u=d.getFullId(),p=t(u);p==null&&(p=this.$_findLocation(d,s),isNaN(p.x)&&(p.x=0),isNaN(p.y)&&(p.y=0)),n(u,p.x,p.y)}}step(e,t,n,o,s){this.done=!0}end(e,t,n,o,s){}reset(){}getAbsolutePosition(e,t){return e==null?{x:null,y:null}:this.$_findLocation(e,t)}},TO="Absolute",gm=class gm extends qn{constructor(e){super(e);c(this,"type",gm.type)}getDefaultParameters(){return{}}};c(gm,"type",TO);var xo=gm;nt.register(xo.type,xo);function FN(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var mm=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],Em=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],vO=[null,[mm[0],Em[1]],[mm[0],Em[0]],[mm[1],Em[0]],[mm[1],Em[1]]],UN=(i,r,e,t,n)=>{isNaN(e)&&(e=0);let o=r.y+r.height,s=e==1/0||e==-1/0?r.x+r.width/2:(o-t)/e,a=Math.atan(e),l,h,d;return FN(r,"x","width",s)?(l=vO[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=vO[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Ri(i,r){let e=i.center||{x:i.x+i.width/2,y:i.y+i.height/2},t=r.center||{x:r.x+r.width/2,y:r.y+r.height/2},n=Dr(e,t),o=As(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return UN(i,r,n,s,o)}function Oi(i,r,e){let t=r.width+2*e.x,n=r.height+2*e.y;return{x:i.x-t/2,y:i.y-n/2,width:t,height:n}}function CO(i){let r=[];if(i==null)return null;if(Array.isArray(i)){let e=[];return e.push.apply(e,i),e}else for(let e in i)r.push(i[e]);return r}var YN={x:20,y:20},zN=1/0;function PO(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=he(i,r);i.x=t.x,i.y=t.y,i.center!=null&&(i.center.x=i.x+i.width/2,i.center.y=i.y+i.height/2)}return{moved:e.x!==i.x||e.y!==i.y,pos:i}}var Li=class{constructor(r){c(this,"De");c(this,"k");c(this,"ba");c(this,"mt");c(this,"Xc");c(this,"Mr",null);c(this,"pn");c(this,"W");c(this,"mn");c(this,"jc");c(this,"Z",[]);c(this,"de",new Map);c(this,"Uo",new Map);c(this,"gn",new Map);c(this,"En",new Set);c(this,"zo",!1);c(this,"kc");c(this,"_t",new Map);this.mn=r.positionGetter,this.jc=r.positionSetter,this.W=r.getId,this.pn=r.getSize,this.k=CO(r.elements||[]),this.mt=r.filter||(e=>!0),this.Xc=r.exclude||(e=>!1),this.ba=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.k.length>0?(this.li((e==null?void 0:e.getSize)||this.pn,(e==null?void 0:e.getPosition)||this.mn,e==null?void 0:e.knownLocations),this.Aa(r),this.Mr=null,this.Sa(e)):{original:{},current:{}}}executeAtCenter(r){if(this.k.length>0){let e=this.li((r==null?void 0:r.getSize)||this.pn,(r==null?void 0:r.getPosition)||this.mn,r==null?void 0:r.knownLocations);return this.Aa({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.Mr=null,this.Sa(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.k.length>0?(this.li((e==null?void 0:e.getSize)||this.pn,(e==null?void 0:e.getPosition)||this.mn,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.Mr={id:r,bounds:this.de.get(r),element:this.k.find(t=>t.id===r)},this.Aa(this.Mr.bounds.center),this.Sa(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.li(this.pn,this.mn);for(let t=0;t<this.Z.length;t++){let n=this.de.get(this.Z[t].id),{moved:o,pos:s}=PO(this.Z[t].bounds,r);o&&(e.original[this.Z[t].id]=n,e.current[this.Z[t].id]=s)}return this.Hc(e),e}setElements(r){return this.k=CO(r),this}startTracking(r,e,t){return this.setElements(r),this.li(this.pn,this.mn),this.kc=t||zN,this.gn.clear(),this.En.clear(),this.Uo.entries().forEach(n=>{this.gn.set(n[0],Object.assign({},n[1]))}),this.zo=e,this}stopTracking(){this.gn.clear(),this.En.clear(),this.zo=!1}addElement(r,e){return r!=null&&(e||this.k.indexOf(r)===-1)&&this.k.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.k,r);else for(let t=0;t<r.length;t++)this.addElement(r[t]);return this}removeElement(r){let e=-1;for(let t=0;t<this.k.length;t++)if(this.k[t]===r){e=t;break}return e!==-1&&this.k.splice(e,1),this}reset(){this.k.length=0}Aa(r){r!=null&&(this.De=r)}li(r,e,t,n){return this.Z.length=0,this.de.clear(),this.Uo.clear(),this._t.clear(),this.cE(this.k,r,e,t,n)}cE(r,e,t,n,o){let s,a,l,h;s=a=1/0,l=h=-1/0,n=n||{},o=o||{};for(let d=0;d<r.length;d++){let u=n[r[d].id]||t(r[d]),p=o[r[d].id]||e(r[d]),g=this.W(r[d]),m={x:u.x,y:u.y,width:p.width,height:p.height,center:{x:u.x+p.width/2,y:u.y+p.height/2}};this.de.set(g,m),this.Uo.set(g,Object.assign({},m)),this.Z.push({bounds:m,id:g,element:r[d]}),this._t.set(g,p),s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x+p.width),h=Math.max(h,u.y+p.height)}return{minx:s,maxx:l,miny:a,maxy:h}}dE(r,e,t,n){if(this.gn.has(r)){let o=this.gn.get(r),s=this.de.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Pe(o.center,a),h=l/Math.ceil(l/10),d=Math.round(l/h)+1,u=Math.atan2(o.center.y-a.y,o.center.x-a.x);if(l>this.kc)return null;let p=null,g=0;for(let m=1;m<d;m++){let E={x:a.x+m*h*Math.cos(u),y:a.y+m*h*Math.sin(u)},y=Oi(E,o,{x:0,y:0});PO(y,n);let x=!0;for(let f=0;f<this.Z.length;f++){let b=this.Z[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=Oi(A.center,A,e);if(tt(y,T)){x=!1;break}}}if(x)g=m,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:g===d-1,positionReached:p}:null}else return null}uE(r={},e,t,n,o){if((this.zo&&!o||!this.zo&&o)&&this.En.size>0){let a=!1;for(;!a;){let l=!0;this.En.forEach(h=>{let d=this.dE(h,e,t,n);if(d!=null&&d.moved){let u=this.gn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let g=this.de.get(h);g.x=p.x,g.y=p.y,g.center.x=p.x+u.width/2,g.center.y=p.y+u.height/2,d.reverted&&this.En.delete(h),l=!1}}),a=l}}}Sa(r){let e={};if(this.k.length>1){r=r||{};let n=r.filter||this.mt,o=r.padding||YN,s=r.iterations,a=r.exclude||this.Xc;r.gather&&Object.assign(e,this.pE(o,this.ba,n,a)),Object.assign(e,this.mE(o,this.ba,n,s,a,r.grid)),this.uE(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.Uo.get(n),t.current[n]=e[n],this.En.add(n);return this.Hc(t),t}pE(r,e,t,n){let o={},s=Oi(this.De,{width:0,height:0},r);this.Wc();let a={},l=h=>{let d=[this.De,h],u=[];Array.prototype.push.apply(u,sr(d,s).map(p=>[s,p,null]));for(let p in a){let g=this.de.get(p);Array.prototype.push.apply(u,sr(d,g).map(m=>[g,m,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.Z.length;h++){if(n(this.Z[h].id,this.Z[h].element))continue;let d=this.Z[h].bounds,u=this.Z[h].bounds,p=Oi(d.center,u,r);if(t(this.Z[h].id,this.Z[h].element)){let g=l(d.center);if(g.length>0){g.sort((y,x)=>{let f=Pe(y[1],d),b=Pe(x[1],d);return f<b?-1:1});let m=g[0][0],E=Ri(m,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.Z[h].id]=d,a[this.Z[h].id]=!0}}}return o}mE(r,e,t,n,o,s){n=n||2;let a,l;this.Mr!=null?(a=Oi(this.De,this.Mr.bounds,{x:0,y:0}),l=this.Mr.id):a=Oi(this.De,{width:0,height:0},r),this.Wc();let h=1,d=!0,u,p,g={},m=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,g[x]=f},E=(x,f)=>{if(s==null)return f;{let b=Ci(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),O=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*O};return Cx(v,x)}},y=()=>{let x,f;for(let b=0;b<this.Z.length;b++){if(x=this.Z[b],o(x.id,x.element))continue;let A=x.bounds,T=Oi(A.center,A,r);x.id!==l&&t(x.id,x.element)&&tt(a,T)&&(u=Ri(a,T),u=E(A,u),p=e(x.id,A,u),m(x.id,A,p.x,p.y),T=Oi(A.center,A,r));for(let S=0;S<this.Z.length;S++)if(b!==S){if(f=this.Z[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let O=f.bounds,v=Oi(O.center,O,r);tt(T,v)&&(d=!0,u=Ri(T,v),u=E(O,u),p=e(f.id,O,u),m(f.id,O,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),g}Hc(r){for(let e=0;e<this.k.length;e++){let t=this.W(this.k[e]);r.current[t]&&this.jc(this.k[e],r.current[t])}}Wc(){let r={};this.Z.sort((e,t)=>{let n=r[e.id]||Math.min(Pe(e.bounds,this.De),Pe(Ci(e.bounds,{x:e.bounds.width,y:0}),this.De),Pe(Ci(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.De),Pe(Ci(e.bounds,{x:0,y:e.bounds.height}),this.De)),o=r[t.id]||Math.min(Pe(t.bounds,this.De),Pe(Ci(t.bounds,{x:t.bounds.width,y:0}),this.De),Pe(Ci(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.De),Pe(Ci(t.bounds,{x:0,y:t.bounds.height}),this.De));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var _O={x:30,y:30},fm=class fm extends Sn{constructor(e){super(e);c(this,"Zc");c(this,"Jc");c(this,"type",fm.type);c(this,"padding",_O);this.Zc=e.options.centerRoot===!0,this.padding=e.options.padding||_O,this.Jc=e.options.centerContent===!0}getDefaultParameters(){return{padding:this.padding,locationFunction:this.ai}}begin(e,t,n,o,s){}end(e,t,n,o,s){}reset(){}step(e,t,n,o,s){let a=this.$vertices.slice(),l=0,h=0,d,u,p=10;if(this.Zc&&a.length>0){let y=this.getSize(a[0].id,o);p=Math.max(y.width,y.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let g=2*Math.PI/a.length,m=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(m)*p,h+Math.cos(m)*p),m+=g,d>0){let y=a[d-1],x=this.getSize(y.id,o),f=t(y.id),b={x:f.x-s.padding.x,y:f.y-s.padding.y,width:x.width+2*s.padding.x,height:x.height+2*s.padding.y},A=a[d],T=this.getSize(A.id,o),S=t(A.id),O={x:S.x-s.padding.x,y:S.y-s.padding.y,width:T.width+2*s.padding.x,height:T.height+2*s.padding.y},v=Ri(b,O),_=[f.x+x.width/2,f.y+x.height/2],P=[S.x+v.x+T.width/2,S.y+v.y+ +(T.height/2)],I=Math.sqrt(Math.pow(_[0]-P[0],2)+Math.pow(_[1]-P[1],2));p=Math.max(p,I/2/Math.sin(g/2))}let E=this.Jc?{x:this.width/2,y:this.height/2}:{x:0,y:0};for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(m)*p+E.x,h+Math.cos(m)*p+E.y),m+=g;this.done=!0}};c(fm,"type","Circular");var Nc=fm;nt.register(Nc.type,Nc);var ym="Grid",xm="Column",bm="Row";var _e="width",Ve="height",XN="rotation",Ic="v",Kx="h",Te="top",We="left",yt="right",ht="bottom",It="center",ee="x",fe="y",Tn="dlr",Qn="drl",tn="none",rn="orthogonal",qx="manhattan",Mc="diagonal",Qx="metro",eb=-1,pe="v",ne="h",tb="undefined",be="default",Ct="true",ct="false",rb="left",nb="top",ib="rotation",ob="width",sb="height",it="source",vn="target";var jN={x:30,y:30},wi="row",ab="column",bo=class extends Sn{constructor(e){super(e);c(this,"yn",[]);c(this,"Ta");c(this,"va");c(this,"H");c(this,"xn");c(this,"bn");c(this,"Gr");c(this,"$r");c(this,"Ca");c(this,"type");this.type=ym,this.H=e.options.orientation||wi,this.padding=e.options.padding||jN,this.Ta=e.options.verticalAlignment||It,this.va=e.options.horizontalAlignment||It,this.xn=e.options.rows||-1,this.bn=e.options.columns||-1,this.Ca=e.options.sort}getDefaultParameters(){return{orientation:wi,rows:-1,columns:-1}}begin(e,t,n,o,s){this.yn.length=0;let a,l;if(this.Ca!=null){let p=this.$vertices.slice();p.sort(this.Ca),this.$vertices=p}if(this.xn===-1&&this.bn===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.H===wi?1:0),l=p+(this.H===ab?1:0)}else this.xn!==-1?(a=this.xn,l=Math.ceil(this.$vertices.length/a)):this.bn!==-1&&(l=this.bn,a=Math.ceil(this.$vertices.length/l));this.Gr=-1/0,this.$r=-1/0;let h=0,[d,u]=this.H===wi?[a,l]:[l,a];for(let p=0;p<d;p++){this.yn[p]=[];for(let g=0;g<u;g++)if(h=p*u+g,h<this.$vertices.length){let m=this.$vertices[h],E=this.getSize(m.id,o);this.Gr=Math.max(this.Gr,E.width),this.$r=Math.max(this.$r,E.height),this.yn[p][g]={vertex:m,size:E}}}}end(e,t,n,o,s){}reset(){}gE(e){let t=this.H===wi&&this.xn===1||this.va===We?0:this.va===It?(this.Gr-e.width)/2:this.Gr-e.width,n=this.H===ab&&this.bn===1||this.Ta===Te?0:this.Ta===It?(this.$r-e.height)/2:this.$r-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.yn.length;h++){for(let d=0;d<this.yn[h].length;d++){let u=this.yn[h][d],{padX:p,padY:g}=this.gE(u.size);n(u.vertex.id,a+p,l+g),this.H===wi?a+=this.padding.x*2+(this.xn===1?u.size.width:this.Gr):l+=this.padding.y*2+(this.bn===1?u.size.height:this.$r)}this.H===wi?(l+=this.padding.y*2+this.$r,a=0):(a+=this.padding.x*2+this.Gr,l=0)}this.done=!0}};c(bo,"type",ym),nt.register(bo.type,bo);var ml=class extends bo{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:ab,columns:1})})),this.type=xm}};c(ml,"type",xm),nt.register(ml.type,ml);var El=class extends bo{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:wi,rows:1})})),this.type=bm}};c(El,"type",bm),nt.register(El.type,El);var OO=1e-11,Am=class Am extends qn{constructor(e){super(e);c(this,"Yo");c(this,"type",Am.type);c(this,"k",new Map);c(this,"hi",new Map);c(this,"ci");c(this,"Rt");c(this,"Xo",1/0);c(this,"jo",-1/0);c(this,"ko",1/0);c(this,"Ho",-1/0);c(this,"Lt",[]);c(this,"Pa",new Map);c(this,"wt");c(this,"Oa");this.wt=bn(this.getDefaultParameters(),e.options),this.Rt=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.ai}}An(e,t,n){return t=Wg(t),n=Wg(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{EE:t,fE:n}}Sn(e){return this.hi.get(e.id)===!0}yE(e){this.hi.set(e.id,!0)}reset(){super.reset(),this.k.clear(),this.hi.clear(),this.Yo=0,this.Xo=this.ko=1/0,this.jo=this.Ho=-1/0,this.Pa.clear()}begin(e,t,n,o,s){this.Lt.length=0,this.k.clear(),this.Yo=0,this.Xo=1/0,this.jo=-1/0,this.ko=1/0,this.Ho=-1/0,this.Oa=this.wt.r,this.Rt&&this.$vertices.forEach(a=>{let l=this.$_findLocation(a,s);l!=null&&l.x!=null&&l.y!=null&&n(a.id,l.x,l.y)})}gt(e,t,n){let o=j(e)?e.getParent():e,s=this.k.get(o.id);if(!s){let a=t(o.id)||this.hE(o.id,n,this.width,this.height,!0),l=this.getSize(o.id,n);l.width===0&&(l.width=1),l.height===0&&(l.height=1),s={id:o.id,n:o,x:a.x,y:a.y,f:[0,0],width:l.width,height:l.height,center:{x:a.x+l.width/2,y:a.y+l.height/2}},this.k.set(o.id,s),this.Pa.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}_a(e,t,n){return this.Lt[e]?this.Lt[e]:(this.Lt[e]=this.gt(this.$vertices[e],t,n),this.Lt[e])}step(e,t,n,o,s){let a;for(this.ci=0,a=0;a<this.$vertices.length;a++){let l=this._a(a,t,o);if(this.Rt&&!this.Sn(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this.Kc(l,d.x,d.y),n(l.id,d.x,d.y),this.yE(l),l.x=d.x,l.y=d.y,l.f[0]=0,l.f[1]=0;continue}}for(let d=a+1;d<this.$vertices.length;d++){let u=this._a(d,t,o);this.xE(l,u)}let h=this.Pa.get(l.id);for(let d=0;d<h.length;d++)this.bE(l,h[d],t,o)}if(this.ci!==0){let l=s.spacing*.62;for(a=0;a<this.$vertices.length;a++){let h=this._a(a,t,o);if(!this.Sn(h)){let d=h.f[0],u=h.f[1],p=Math.sqrt(d*d+u*u);p>l&&(d=d/p*l,u=u/p*l),this.Kc(h,h.x+d,h.y+u)}h.f[0]=0,h.f[1]=0}}this.Yo++,(this.ci===0||this.Yo>=this.wt.iterations)&&(this.AE(n,o),this.done=!0)}end(e,t,n,o,s){this.hi.clear(),this.k.forEach((a,l)=>{this.hi.set(l,!0)})}Kc(e,t,n){let{EE:o,fE:s}=this.An(e,t,n);this.Xo=Math.min(this.Xo,o),this.ko=Math.min(this.ko,s),this.jo=Math.max(this.jo,o),this.Ho=Math.max(this.Ho,s)}AE(e,t){this.k.forEach((n,o)=>{let s=this.k.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}xE(e,t){let n=this.Sn(e),o=this.Sn(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(tt(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=sr(d,e)[0],p=sr(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h<OO&&(h=1,s=1,a=1)}if(h<this.wt.spacing){this.ci++;let d=this.Oa*(this.wt.spacing-h),u=1,p=1,g=u*d*s/h,m=p*d*a/h,E=o?0:(n?2:1)*g,y=o?0:(n?2:1)*m,x=n?0:(o?2:1)*g,f=n?0:(o?2:1)*m;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}bE(e,t,n,o){let s=this.gt(t.target,n,o),a=this.Sn(e),l=this.Sn(s);if(a&&l)return;this.ci++;let h,d,u,p,g;if(tt(e,s))p=-2*this.wt.spacing,h=-2*this.wt.spacing,d=-2*this.wt.spacing;else{let y=[e.center,s.center],x=sr(y,e)[0],f=sr(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p<OO&&(p=1,h=1,d=1)}g=this.Oa*(p-this.wt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),g*=Math.log(t.cost)*.5+1;let m=g*h/p,E=g*d/p;s.f[0]-=l?0:(a?2:1)*m,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*m,e.f[1]+=a?0:(l?2:1)*E}};c(Am,"type","ForceDirected");var Vc=Am;nt.register(Vc.type,Vc);function HN(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var Os=class extends qn{constructor(e){super(e);c(this,"qc");c(this,"Tn");c(this,"Qc");this.qc=!!e.options.ignoreLoops,this.Qc=e.options.ignorePorts===!0,this.Tn=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(zx(n)){let o=n.getTargetEdges();return(o.length===0||HN(o,n))&&this.adapter.filter(n)}else return!1}).getAll():this.$vertices.length>0?[this.$vertices[0]]:null)}begin(e,t,n,o,s){super.begin(e,t,n,o,s),s.ignoreLoops=this.qc,s.getRootNode=this.Tn,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=j(u.target)?u.target.getParent():u.target;(u.source===a||this.Qc!==!0&&j(u.source)&&u.source.getParent()===a)&&this.adapter.filter(p)&&d.push(p)}),d}),s.rootNode=s.getRootNode(e),s.rootNode||(this.done=!0)}};var lb=It,hb={x:60,y:60},cb="auto",db=It;function Gc(i){return i.parents.length>0?i.parents[0].loc:null}function Sm(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function kN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function RO(i){return i.parents.length>0?i.parents[0].childGroup:null}function WN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var $c=class{constructor(r,e){this.dataSource=r;c(this,"Br");c(this,"qt");c(this,"Pe");c(this,"L",[]);c(this,"Fr",[]);c(this,"di",{});c(this,"ie");c(this,"ee");c(this,"Dt");c(this,"ge");c(this,"pi");c(this,"Se");c(this,"Rt");c(this,"I");c(this,"vn",-1/0);c(this,"Cn",1/0);c(this,"mi");c(this,"Nt");c(this,"gi");c(this,"Ne",[]);c(this,"positions",new Map);c(this,"Ra",{[It]:r=>Gc(r)+Sm(r,this.ee)/2-(r.size-this.ee)/2,start:r=>Gc(r),end:r=>Gc(r)+Sm(r,0)-(r.size-this.ee)});c(this,"W");c(this,"It");c(this,"Qt");c(this,"Ei");c(this,"Va",{center:(r,e,t)=>(e+t)/2-Sm(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Br=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.qt=e.compress===!0,this.Rt=e.absoluteBacked===!0,this.W=e.idFunction,this.It=e.sizeFunction,this.Qt=e.childVerticesFunction,this.Ei=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.pi=this.ge===0?1:0,this.mi=this.Se?"y":"x",this.Nt=this.Se?_e:Ve,this.gi=this.Se?Ve:_e,this.Pe=e.invert===!0,this.I=e.alignment||db,this.ie=e.padding,this.ee=this.Se?this.ie.x:this.ie.y,this.Dt=this.Se?this.ie.y:this.ie.x}execute(){let r,e,t;for(let n=0;n<this.Br.length;n++){r=this.Br[n];let o=this.It(r.id),s=this.et(r,o,0,null,null),a=0;s.root=!0,a=this.fi(s,0);let l=0,h,d,u=(g,m)=>this.qt&&g.parents&&g.parents.length>0?this.positions.get(this.W(g.parents[0].node)).position[this.mi]+this.La(g,this.pi)+this.Dt:m,p=!1;if(a===0&&this.Rt===!0){let g=this.Ei(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.yi(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.yi(this.W(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Dt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Dt,l+=this.L[e].otherAxisSize)}}return this.positions}yi(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.It(r),o=this.ge===0?e.x+n.width:e.y+n.height;this.vn=Math.max(this.vn,o),this.Cn=Math.min(this.Cn,o)}gt(r){let e=this.L[r];return e||(e={entries:[],pointer:0},this.L[r]=e),e}et(r,e,t,n,o){let s=this.gt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Nt],children:[]},l=e[this.gi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Nt]+this.ee,s.entries.push(a),n&&n.children.push(a),a}wa(r,e){let t=this.Fr[e];t||(t=[],this.Fr[e]=t),r.index=t.length,t.push(r)}Da(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.gt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.ee)}}La(r,e){let t=r.parents.map(n=>n.dimensions[e===0?_e:Ve]);return Math.max.apply(null,t)}Na(r){if(r.size>0){let e=this.Ra[this.I](r),t=this.Fr[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.ee}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.ee;o!==0&&this.Ia(r),this.wa(r,r.depth)}}Ma(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Va[this.I](r,e,t),o=n-Gc(r);if(this.Da(r,n),!kN(r)){let s=RO(r),a=WN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ia(r){let e=r;for(;e!=null;)this.Ma(e),e=RO(e)}fi(r,e){if(this.di[r.node.id])return;this.di[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.gt(e+1),l=this.Qt(r.node,e,this.dataSource);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.It(this.W(h)),u=a.entries.find(p=>this.W(p.node)===this.W(h));if(u!=null){u.parents.push(r);let p=Gc(u),g=Sm(u,this.ee),m=p+g/2-u.size/2,E=m-u.loc,y=x=>{for(let f=x.childGroupIndex;f<x.childGroup.nodes.length;f++)x.childGroup.nodes[f].loc+=E,x.children.forEach(y),x.childGroup.size+=E};y(u)}else{let p=this.et(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let g=d[this.Nt];t.size+=g+this.ee,n.push(p)}s[h.id]=!0}}for(this.Na(t),o=0;o<n.length;o++)this.fi(n[o],e+1);return l.length}};var LO="Hierarchical",Tm=class Tm extends Os{constructor(e){super(e);c(this,"type",Tm.type);c(this,"H");c(this,"Se");c(this,"ge");c(this,"qt");c(this,"Pe");c(this,"I");c(this,"ed");c(this,"L",[]);c(this,"Qt");this.Pe=e.options.invert,this.ed=e.options.spacing||cb,this.qt=this.ed==="compress",this.I=e.options.align||lb,this.H=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:hb,orientation:this.H,locationFunction:this.ai,align:this.I}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.H=s.orientation,this.Se=this.H==="horizontal",this.ge=this.Se?0:1,this.padding=s.padding,this.L.length=0,this.Qt=s.getChildVertices}step(e,t,n,o,s){new $c(e,{rootNode:s.rootNode,compress:this.qt,padding:this.padding,axisIndex:this.ge,invert:this.Pe,alignment:this.I,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.Qt(h,d,u),absoluteBacked:this.absoluteBacked,absolutePositionFunction:h=>this.getAbsolutePosition(h,s)}).execute().forEach((h,d)=>{n(d,h.position.x,h.position.y)}),this.done=!0}getHierarchy(){return this.L}getOrientation(){return this.H}};c(Tm,"type",LO);var Bc=Tm;nt.register(Bc.type,Bc);var vm=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"de",new Map);c(this,"td",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=G(),this.group=[r]}setPosition(r,e,t){this.de.set(r,{x:e,y:t})}getPosition(r){return this.de.get(r)}getIncidentAngle(r){return this.td.get(r)}setIncidentAngle(r,e){this.td.set(r,e)}getPositions(){return this.de}},ZN=100,JN={x:50,y:50},Cm=class Cm extends Os{constructor(e){super(e);c(this,"type",Cm.type);c(this,"rd");c(this,"tt",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||ZN,this.padding=e.options.padding||JN,this.clusterMagnetizer=new Li({positionGetter:t=>({x:t.extents[0],y:t.extents[2]}),positionSetter:(t,n)=>{for(let o=0;o<t.group.length;o++){let s=t.offsets[t.group[o].id];t.setPosition(t.group[o].id,n.x+s.x,n.y+s.y)}},getSize:t=>({width:t.extents[1]-t.extents[0],height:t.extents[3]-t.extents[2]}),getId:t=>t.focus.id,filter:t=>this.tt[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.ai,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=j(o.source)?o.source.getParent():o.source,a=j(o.target)?o.target.getParent():o.target;return s===e&&s!==a&&this.adapter.filter(a)})}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.tt.length=0,this.rd=s.getChildEdges}nd(e,t,n,o,s,a,l){let h=(T,S,O,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:O+2*a.padding.x,height:v+2*a.padding.y}),d,u=new vm(e),p=s?s.position:{x:0,y:0},g=p.x,m=p.y,E={},y=T=>E[T]||(E[T]=this.getSize(T,o),E[T]),x,f,b;u.setPosition(e.id,p.x,p.y);let A=this.rd(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,O=j(S)?S.getParent():S;u.children.add(O)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(g-x.width/2,m-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.tt.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,O=S,v=null;u.children.forEach(N=>{f=y(N.id);let V=h(g+Math.sin(S)*f.width,m+Math.cos(S)*f.height,f.width,f.height),D=Ri(b,V),$=Math.sqrt(Math.pow(V.x+D.x-g,2)+Math.pow(V.y+D.y-m,2));if(d=Math.max(d,$),u.setPosition(N.id,V.x+D.x,V.y+D.y),S+=T,v!=null){let K=y(v.id),xe=u.getPosition(v.id),H=h(xe.x,xe.y,K.width,K.height),Ee=y(N.id),Fe=u.getPosition(N.id),Je=h(Fe.x,Fe.y,Ee.width,Ee.height),Xt=Ri(H,Je),or={x:xe.x+K.width/2,y:xe.y+K.height/2},rr={x:Fe.x+Xt.x+Ee.width/2,y:Fe.y+Xt.y+ +(Ee.height/2)},wr=Math.sqrt(Math.pow(or.x-rr.x,2)+Math.pow(or.y-rr.y,2));d=Math.max(d,wr/2/Math.sin(T/2))}v=N}),S=O,u.children.forEach(N=>{u.setIncidentAngle(N.id,S),u.setPosition(N.id,g+Math.sin(S)*d,m+Math.cos(S)*d),S+=T});let _=u.getPosition(e.id),P=_.x,I=y(e.id),C=P+I.width,R=_.y,w=R+I.height,B;u.children.forEach(N=>{if(!this.nd(N,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(N.id),position:u.getPosition(N.id)},a,l+1)){B=y(N.id),u.group.push(N);let D=u.getPosition(N.id);P=Math.min(P,D.x),C=Math.max(C,D.x+B.width),R=Math.min(R,D.y),w=Math.max(w,D.y+B.height)}}),u.extents=[P,C,R,w],u.offsets={};for(let N=0;N<u.group.length;N++){let V=u.group[N],D=u.getPosition(V.id);u.offsets[V.id]={x:D.x-u.extents[0],y:D.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.nd(s.rootNode[0],t,n,o,null,s,0),this.tt.length>0){let a=(this.tt[0].extents[0]+this.tt[0].extents[1])/2,l=(this.tt[0].extents[2]+this.tt[0].extents[3])/2;this.clusterMagnetizer.setElements(this.tt),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.tt.length;a++)this.tt[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(Cm,"type","Balloon");var Fc=Cm;nt.register(Fc.type,Fc);var Rs=class{constructor(r){this.model=r}};var vr="edge",fl="vertex",Uc="center",Pm=30;function dt(i){return i.type===vr}var Yc=class extends Rs{constructor(e,t){super(e);this.vertexSet=t;c(this,"er",new Map);c(this,"Wo",!1);c(this,"rr");c(this,"Ur",[]);c(this,"od",new Set);c(this,"xi");this.xi=e.layout.xi}SE(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.er.has(n.id)==!1).filter(n=>t.target.findIndex(o=>o.id===n.id)!==-1?t.source.findIndex(o=>o.id===n.id)===-1:!1).length}sd(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.od.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.er.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.SE(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.er.has(p.id));if(u.length>0){let p=Math.max(...u.map(g=>this.vertexSet.findLayerIndex(g.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let g={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:vr,entries:[]};this.vertexSet.edgeNodes.push(g),this.vertexSet.edgeNodeMap.set(p.id,g)})}else o[a].edges.forEach(d=>{let u={edge:d,id:d.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1/0,type:vr,entries:[]};this.vertexSet.edgeNodes.push(u),this.vertexSet.edgeNodeMap.set(d.id,u),this.Ur.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.er.set(s[a].id,!0),this.sd(s[a],t+1)}TE(){let e,t=(o,s)=>o.span>s.span?-1:o.span<s.span?1:o.rootLayer<s.rootLayer?-1:o.rootLayer>s.rootLayer?1:0,n=[];this.vertexSet.edgeNodes.forEach(o=>{o.rootLayer=this.model.getLayer(o.sourceNode),o.targetLayer=this.model.getLayer(o.targetNode),o.rootLayer!=null&&o.targetLayer!=null&&(o.span=o.targetLayer-o.rootLayer,o.span>1&&(n.length===0?n.push(o):t(o,n[0])<=0?n.unshift(o):n.push(o)))});for(let o=0;o<n.length;o++){let s=n[o];if(s.span>1){let l=this.vertexSet.layers[s.rootLayer].entries.filter(u=>!dt(u)),h=l.findIndex(u=>u.obj.id===s.sourceNode.id),d=l.length===1?!1:h<l.length/2;e=this.vertexSet.insertEdgeNodeInLayer(s.rootLayer+1,s,d),this.vertexSet.edgeEntryMap.set(e.id,e);for(let u=s.rootLayer+2;u<s.targetLayer;u++){let p=this.vertexSet.addToLayer(u,s,d);this.vertexSet.edgeEntryMap.set(p.id,p),p.previous=e,e.next=p,e=p}}}}execute(e){for(this.er.clear(),this.Wo=!1,this.rr=0,this.Ur.length=0,this.er.set(e.id,!0);!this.Wo;)if(this.sd(e,this.rr),this.Ur.length>0)if(this.Ur=this.Ur.filter(t=>!this.er.has(t[0].id)),this.Ur.length>0){let t=this.Ur.splice(0,1)[0];e=t[0],this.rr=t[1],this.er.set(e.id,!0),this.vertexSet.addToLayer(this.rr,e)}else this.Wo=!0;else this.Wo=!0;this.xi&&this.vE(),this.TE()}vE(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!dt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.od)}};var ub=i=>{let r=0;for(let e=0;e<i.length;e++){let t=i[e];t.length>0&&t[0].leaf&&r++,t.length>1&&t[t.length-1].leaf&&r++}return r};function KN(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var Ls=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"bi");c(this,"Ai");t=t||{},this.bi=t.maxIterations||24,this.Ai=t.maxIterationsWithoutImprovement||5}CE(){let r=[];for(let e=0;e<this.vertexSet.layers.length;e++)r.push(this.vertexSet.layers[e].entries.slice());return r}execute(){let r=this.CE(),e=r,t=0,n=this.ad(r),o=ub(e);for(let s=0;s<this.bi;s++){let a=this.PE(s,e),l=this.ad(a);if(l.total<n.total)n=l,t=0,o=ub(a);else if(l.total===n.total){let h=ub(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.Ai)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}ad(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.OE(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}OE(r,e,t){let n=[],o=e[r],s=e[t],a=new Array(s.length);for(let u=0;u<a.length;u++)a[u]=[];let l=[],h,d=[];for(h=0;h<o.length;h++){let u=o[h],p=h,g=this.getAdjacentEntries(e,t,u),m=[];for(let E=0;E<g.length;E++){let y=g[E][1];m.push(y)}m.sort(function(E,y){return E-y}),l[p]=m}for(h=0;h<l.length;h++)d=d.concat(l[h].map(u=>[h,u]));for(h=0;h<d.length;h++){let u=d[h],p={sourceLayer:r,targetLayer:t,sourceVertex:u[0],targetVertex:u[1]};a[u[1]].push(p);for(let g=u[1]+1;g<a.length;g++)n.push(...a[g])}return n}PE(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.ld(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.ld(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}ld(r,e,t){let n=e[r],o=n.length,s=[],a=t?r+1:r-1,l={},h;if(o===1)return n;for(h=0;h<o;h++){let d=n[h],u=this.getAdjacentEntries(e,a,d),p=u.filter(m=>!dt(m[0])),g=u.filter(m=>dt(m[0]));g.length>0&&(g.sort((m,E)=>m[0].obj.span>E[0].obj.span?-1:E[0].obj.span>m[0].obj.span?1:0),p.push(g[0])),u.length>0?s.push([d,KN(p)]):(l[d.obj.id]=!0,s.push([d,-1]))}return s.sort((d,u)=>l[d[0].id]||l[u[0].id]?0:d[1]<u[1]?-1:u[1]<d[1]?1:d[0].type===fl&&u[0].type===fl?0:d[0].type===vr&&u[0].leaf?-1:u[0].type===vr&&d[0].leaf?1:0),s.map(d=>d[0])}};var wO="xmax",DO="ymax",NO="xmin",IO="ymin",_m="_min",Om="_max",zc=class{constructor(r,e,t,n,o){this.D=r;this.ue=e;this.axis=t;this.Pe=n;this._E=o;c(this,"Si",{})}execute(){this.Si={};let r=this._E(),e={},t=this.axis===0?{[_m]:NO,[Om]:wO}:{[_m]:IO,[Om]:DO},n=this.axis===1?{[_m]:NO,[Om]:wO}:{[_m]:IO,[Om]:DO},o=null;for(let a=0;a<this.ue.layers.length-1;a++){let l=this.ue.layers[a],h=this.ue.layers[a+1],d=Math.min(l[t.Te],h[t.Te]),p=Math.max(l[t.Vt],h[t.Vt])-d,g=this.Pe?n.Te:n.Vt,m=this.Pe?n.Vt:n.Te,E=l[g],x=h[m]-E,f={id:`r${a}`,type:"channel",axis:this.axis,left:this.axis===0?d:E,top:this.axis===1?d:E,width:this.axis===0?p:x,height:this.axis===1?p:x,lines:[]};this.ue.regions.push(f);for(let b=0;b<l.entries.length;b++){let A=l.entries[b],T=r.getVertexPosition(A.id)||A.loc,S={left:T.x,top:T.y,width:A.size.width,height:A.size.height,type:A.type,id:A.id,lines:[],paddingRegion:null,paddingRegionGate:null,gateDown:null,gateUp:null};this.ue.regions.push(S),this.Si[A.id]=S;let O=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,_=this.axis===0?f.top:f.left;if(v<_){let P={left:this.axis===0?T.x:T.x+A.size.width,top:this.axis===0?T.y+A.size.height:T.y,width:this.axis===0?A.size.width:_-v,height:this.axis===0?_-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.ue.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.Zo(A,T,S,P,!0),O=P}}S.gateDown=this.Zo(A,T,O,f,!0),o!=null&&(S.gateUp=this.Zo(A,T,o,S,!1))}o=f}let s=this.ue.layers[this.ue.layers.length-1];for(let a=0;a<s.entries.length;a++){let l=s.entries[a],h=r.getVertexPosition(l.id),d={left:h.x,top:h.y,width:l.size.width,height:l.size.height,type:l.type,id:l.id,lines:[],gateUp:null};this.ue.regions.push(d),this.Si[l.id]=d,o!=null&&(d.gateUp=this.Zo(l,h,o,d,!1))}return this.ue.edgeNodes.forEach(a=>{let l=a.edge,h=j(l.source)?l.source.getParent():l.source,d=j(l.target)?l.target.getParent():l.target,u=this.D.entryMap[h.id],p=this.D.entryMap[d.id],g=this.Si[u.id],m=this.Si[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown);for(let f=0;f<a.entries.length;f++){let b=a.entries[f],A=`r${b.layer-1}:${b.id}`;E.push(this.ue.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.ue.gateMap[T])}E.push(m.gateUp)}else{E.push(g.gateUp);for(let f=a.entries.length-1;f>-1;f--){let b=a.entries[f],A=`${b.id}:r${b.layer}`;E.push(this.ue.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.ue.gateMap[T])}m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.ue.edgeRoutingMap[l.id]=x,this.ue.edgeRouting.push(x),e[l.id]=E}),e}Zo(r,e,t,n,o){let s=this.axis===0?e.x:e.y,a=this.axis===0?r.size.width:r.size.height,l=this.axis===0?e.y:e.x,h=this.axis===0?r.size.height:r.size.width,d=this.Pe?l+(o?0:h):l+(o?h:0);return this.RE(t,n,this.axis,{point1:s,point2:s+a},a,d,{x:this.axis===0?s+a/2:d,y:this.axis===0?d:s+a/2})}RE(r,e,t,n,o,s,a){let l={id:`${r.id}:${e.id}`,a:{type:r.type,id:r.id},b:{type:e.type,id:e.id},axis:t,otherAxisLocation:s,segment:n,length:o,midpoint:a,edges:[]};return this.ue.gates.push(l),this.ue.gateMap[l.id]=l,l}};function qN(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,g)=>{let m=Kn(p.source),y={edge:p,isSource:m===g,sourceVertex:m,targetVertex:Kn(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(g=>{(ke(g.source,i)&&!ke(g.target,i)||ke(g.target,i)&&!ke(g.source,i))&&u(g,p)})}),r!=null?l.forEach(p=>{r(p)?u(p,i):d.add(p)}):l.forEach(p=>u(p,i));for(let p=0;p<h.length;p++){let g=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[g]||(o[g]={id:g,edges:new Set},e.push(o[g])),o[g].edges.add(h[p].edge),h[p].isSource?(s[g]||(s[g]={id:g,edges:new Set},t.push(s[g])),s[g].edges.add(h[p].edge)):(a[g]||(a[g]={id:g,edges:new Set},n.push(a[g])),a[g].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function QN(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Xc=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"ie");c(this,"dn",{});c(this,"_t",{});c(this,"Jo",null);c(this,"hd",[]);c(this,"cd",new Map);c(this,"Ga");c(this,"Ie");c(this,"Ti");c(this,"vi",[]);c(this,"unattachedRootPadding");c(this,"vertexEntryMap",new Map);c(this,"entryMap",{});c(this,"assignedVertices",new Map);c(this,"axis");c(this,"invert");c(this,"sets",[]);c(this,"excludedNodes",{});c(this,"dd");c(this,"adjacentVertices",{});this.ie=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.dd=e.setPosition,this.Ga=e.getSize,this.Jo=e.rootNode,this.Ie=e.edgeNodeSize,this.Ti=e.edgeFilter}nextRoot(){let r=this.vi.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.dn[r]}setRootNode(r){this.Jo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this._t[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}ud(){let r={width:50,height:50};return this.axis===0?r.width=this.Ie:r.height=this.Ie,r}getSizeInMainAxis(r){return this.axis===0?r.width:r.height}getSizeInOtherAxis(r){return this.axis===0?r.height:r.width}getPaddingInMainAxis(){return this.axis===0?this.ie.x:this.ie.y}getPaddingInOtherAxis(){return this.axis===0?this.ie.x:this.ie.y}initialize(){this.vi.length=0,this.hd.length=0,this.cd.clear(),this.assignedVertices.clear();let r=this.layout.$vertices.length;if(r>0){let e;for(let t=0;t<r;t++){e=this.layout.$vertices[t],this._t[e.id]=this.Ga(e.id),this.dn[e.id]=e;let n=qN(e,this.Ti);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:QN(n),size:this.Ga(e.id),type:fl,layer:-1,vertexSet:null};this.vi.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.hd.push(o),this.cd.set(e.id,o))}this.vi.sort((t,n)=>{let o=this.Jo?this.Jo.id:"";return t.obj.id===o?-1:n.obj.id===o||t.adjacent.length===0?1:n.adjacent.length===0||t.targetEdges.length<n.targetEdges.length?-1:n.targetEdges.length<t.targetEdges.length?1:t.sourceEdges.length>n.sourceEdges.length?-1:n.sourceEdges.length>t.sourceEdges.length?1:0})}}isEmpty(){return this.vi.length===0}getAdjacentEntries(r,e,t){let n=[];for(let o=0;o<r[e].length;o++)this.areConnected(r[e][o],t)&&n.push([r[e][o],o]);return n}getAdjacentEntriesInLayer(r,e){let t=[];for(let n=0;n<r.length;n++)this.areConnected(r[n],e)&&t.push({entry:r[n],index:n});return t}areConnected(r,e){return dt(r)&&r.obj.edge.source===e.obj||dt(e)&&e.obj.edge.source===r.obj||dt(r)&&r.obj.edge.target===e.obj||dt(e)&&e.obj.edge.target===r.obj||dt(r)&&dt(e)&&(r.next===e||r.previous===e||e.next===r||e.previous===r)?!0:this.areAdjacent(r.obj.id,e.obj.id)}areAdjacent(r,e){let t=this.getAdjacentVertices(r),n=this.getAdjacentVertices(e);return t!=null&&t.vertices.findIndex(o=>o.id===e)!==-1||n!=null&&n.vertices.findIndex(o=>o.id===r)!==-1}getAdjacentVertices(r){return this.adjacentVertices[r]||{vertices:[],source:[],target:[],filteredEdges:new Set}}isLeaf(r){let e=this.vertexEntryMap.get(r);return e!=null?e.leaf:!1}};function jc(i){return i.parents.length>0?i.parents[0].loc:null}function Rm(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function eI(i){return i.parents.length>0?i.parents[0].root===!0:!1}function MO(i){return i.parents.length>0?i.parents[0].childGroup:null}function tI(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Hc=class{constructor(r,e){this.model=r;c(this,"vn",-1/0);c(this,"Cn",1/0);c(this,"Br");c(this,"qt");c(this,"Pe");c(this,"L",[]);c(this,"Fr",[]);c(this,"di",{});c(this,"ie");c(this,"ee");c(this,"Dt");c(this,"ge");c(this,"pi");c(this,"Se");c(this,"Rt");c(this,"I");c(this,"mi");c(this,"Nt");c(this,"gi");c(this,"Ne",[]);c(this,"de",new Map);c(this,"Ra",{center:r=>jc(r)+Rm(r,this.ee)/2-(r.size-this.ee)/2,start:r=>jc(r),end:r=>jc(r)+Rm(r,0)-(r.size-this.ee)});c(this,"W");c(this,"It");c(this,"Qt");c(this,"Ei");c(this,"Va",{center:(r,e,t)=>(e+t)/2-Rm(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Br=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.qt=e.compress===!0,this.Rt=e.absoluteBacked===!0,this.W=e.idFunction,this.It=e.sizeFunction,this.Qt=e.childVerticesFunction,this.Ei=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.pi=this.ge===0?1:0,this.mi=this.Se?fe:ee,this.Nt=this.Se?_e:Ve,this.gi=this.Se?Ve:_e,this.Pe=e.invert===!0,this.I=e.alignment||Uc,this.ie=e.padding,this.ee=this.Se?this.ie.x:this.ie.y,this.Dt=this.Se?this.ie.y:this.ie.x}execute(){let r,e,t;for(let n=0;n<this.Br.length;n++){r=this.Br[n];let o=this.It(r.id),s=this.et(r,o,0,null,null),a=0;s.root=!0,a=this.fi(s,0);let l=0,h,d,u=(g,m)=>this.qt&&g.parents&&g.parents.length>0?this.de.get(this.W(g.parents[0].node)).position[this.mi]+this.La(g,this.pi)+this.Dt:m,p=!1;if(a===0&&this.Rt===!0){let g=this.Ei(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.yi(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.yi(this.W(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Dt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Dt,l+=this.L[e].otherAxisSize)}}return this.de}yi(r,e,t){this.de.set(r,{position:e,layer:t});let n=this.It(r),o=this.ge===0?e.x+n.width:e.y+n.height,s=this.ge===0?e.x:e.y;this.vn=Math.max(this.vn,o),this.Cn=Math.min(this.Cn,s)}gt(r){let e=this.L[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.L[r]=e),e}et(r,e,t,n,o){let s=this.gt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,childGroupIndex:o==null?void 0:o.nodes.length,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.Nt],children:[]},l=e[this.gi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.Nt]+(r.type===vr?0:this.ee),s.entries.push(a),n&&n.children.push(a),a}wa(r,e){let t=this.Fr[e];t||(t=[],this.Fr[e]=t),r.index=t.length,t.push(r)}Da(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.gt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.ee)}}La(r,e){let t=r.parents.map(n=>n.dimensions[e===0?_e:Ve]);return Math.max.apply(null,t)}Na(r){if(r.size>0){let e=this.Ra[this.I](r),t=this.Fr[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.ee}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.ee;o!==0&&this.Ia(r),this.wa(r,r.depth)}}Ma(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.Va[this.I](r,e,t),o=n-jc(r);if(this.Da(r,n),!eI(r)){let s=MO(r),a=tI(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ia(r){let e=r;for(;e!=null;)this.Ma(e),e=MO(e)}fi(r,e){if(this.di[r.node.id])return;this.di[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:G()},n=[],o,s={},a=this.gt(e+1),l=this.Qt(r.node,e,this.model);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.It(this.W(h)),u=a.entries.find(p=>this.W(p.node)===this.W(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,g=jc(u),m=Rm(u,this.ee),E=g+m/2,y=E-p;y>0&&this.LE(u,y,r)}else{let p=this.et(h,d,e+1,r,t);t.nodes.push(p);let g=d[this.Nt];t.size+=g+this.ee,n.push(p)}s[h.id]=!0}}for(this.Na(t),o=0;o<n.length;o++)this.fi(n[o],e+1);return l.length}LE(r,e,t){let n={},o=s=>{let a=s.childGroup;if(n[a.id]!==!0){n[a.id]=!0;let l=s.childGroupIndex;for(let h=l;h<a.nodes.length;h++)a.nodes[h].loc+=e;l===0?a.loc+=e:a.size+=e}s.children.forEach(o)};o(r)}};var kc=class extends Rs{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"nr");c(this,"rr");c(this,"ie");c(this,"Pn");c(this,"On");c(this,"I");c(this,"Ie");c(this,"Ci");n=n||{},this.ie=n.padding||{x:50,y:50},this.Pn=n.unattachedRootPadding||150,this.nr=n.lastPlacements,this.On=n.strategy||"parent",this.Ie=n.edgeNodeSize,this.Ci=n.gatherUnattachedRoots,this.I=n.alignment||"center"}wE(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>dt(o)?n+this.Ie:n+this.model.getSizeInMainAxis(o.size),0),otherAxis:e.reduce((n,o)=>Math.max(n,this.model.getSizeInOtherAxis(o.size)),0)}}execute(e){let t=0,n,o=this.model.getPaddingInMainAxis(),s=this.model.getPaddingInOtherAxis(),a=this.model.axis,l=this.nr?this.nr.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(m=>this.wE(m.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(m=>m.mainAxis))},g=this.model.getNodeSizeInMainAxis(e);return n=this.On==="center"?(p.biggestLayer-g)/2:this.On==="start"?0:p.biggestLayer-g,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this.On==="parent"?this.DE(p,l):this.NE(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}NE(e,t,n,o,s,a,l,h,d){let u=s,p;for(let g=0;g<e.length;g++){this.rr=e[g],t=this.On==="center"?(o.biggestLayer-l[g].mainAxis)/2:this.On==="start"?0:o.biggestLayer-l[g].mainAxis,u=s;for(let m=0;m<this.rr.entries.length;m++){p=this.rr.entries[m];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(dt(p)){let b=n===0?this.Ie:y,A=n===0?y:this.Ie;p.loc={x,y:f,w:b,h:A},u+=this.Ie+h}else this.vertexSet.setPosition(p.obj,x,f,g),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),g<e.length-1&&(this.model.invert?a-=l[g+1].otherAxis+2*d:a+=l[g].otherAxis+2*d)}}DE(e,t){let n=new Hc(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.ie,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.I,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let g=[];if(u<this.vertexSet.layers.length-1){let m=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);g.push(...m)}return g},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.vn,a=n.Cn,l=0,h=0;if(this.Ci&&o.size===1&&this.nr!=null){let d=this.nr.rootPosition+this.nr.rootSize+this.Pn;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.nr){let d=this.nr.maximumPointer-a;this.model.axis===0?l=d:h=d}o.forEach((d,u)=>{this.vertexSet.setPositionById(u,d.position.x+l,d.position.y+h,d.layer),u===e.rootId&&(e.rootPosition=this.model.axis===0?d.position.x+l:d.position.y+h)}),e.maximumPointer=t+(s-a)}};var Wc=class{constructor(r,e){this.D=r;this.index=e;c(this,"layers",[]);c(this,"regions",[]);c(this,"gateMap",{});c(this,"edgeNodes",[]);c(this,"edgeNodeMap",new Map);c(this,"gates",[]);c(this,"edgeRoutingMap",{});c(this,"edgeRouting",[]);c(this,"pd",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.md(r),o=dt(e),s;return o?(s={id:G(),obj:e,previous:null,size:this.D.ud(),next:null,leaf:!1,type:vr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.D.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.D.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.D.assignedVertices.set(e.id,r),this.pd.push(s),s}findLayerIndex(r){var e;return(e=this.pd.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.md(r),o=this.D.ud();this.D.assignedVertices.set(e.id,r);let s={id:G(),obj:e,size:o,leaf:!1,type:vr,layer:r,vertexSet:this};e.entries.push(s),this.D.entryMap[s.id]=s;let a=t?1:-1,l=t?0:n.entries.length-1,h=null;for(;h==null&&l>=0&&l<n.entries.length;)dt(n.entries[l])?n.entries[l].obj.span<e.span&&(h=l):h=l,l+=a;let d=h!=null?t?h:h+1:t?0:n.entries.length;return n.entries.splice(d,0,s),s}removeFromLayer(r,e){let t=this.layers[r];t.entries.splice(t.entries.indexOf(e),1),this.D.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.D.layout.absoluteBacked)this._n(r,e,t,n);else{let o=this.D.layout.model.getVertex(r),s=this.D.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this._n(r,s.x,s.y,n):this._n(r,e,t,n)}}setPosition(r,e,t,n){if(!this.D.layout.absoluteBacked)this._n(r.id,e,t,n);else{let o=this.D.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this._n(r.id,o.x,o.y,n):this._n(r.id,e,t,n)}}md(r){return this.layers[r]==null&&(this.layers[r]={layer:r,entries:[],xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0}),this.layers[r]}_n(r,e,t,n){this.D.dd(r,e,t,n);let o=this.layers[n],s=this.D.vertexEntryMap.get(r)||this.edgeEntryMap.get(r);if(s){let a=e+s.size.width,l=t+s.size.height;o.xmin=Math.min(o.xmin,e),o.ymin=Math.min(o.ymin,t),o.xmax=Math.max(o.xmax,a),o.ymax=Math.max(o.ymax,l)}}};var pb="Hierarchy",Ao=class extends qn{constructor(e){super(e);c(this,"type",pb);c(this,"axis");c(this,"model");c(this,"Pn");c(this,"Ai");c(this,"bi");c(this,"Pe");c(this,"Ci");c(this,"gd");c(this,"Tn");c(this,"Ed");c(this,"I");c(this,"fd");c(this,"xi");c(this,"Ie");c(this,"Ti");c(this,"$a");c(this,"routingInformation");c(this,"resultSets",[]);this.Pn=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.Ai=e.options.maxIterationsWithoutImprovement||5,this.bi=e.options.maxIterations||24,this.Ed=e.options.rootNode,this.Tn=e.options.getRootNode,this.fd=e.options.placementStrategy,this.Ie=e.options.edgeNodeSize||Pm,this.Pe=e.options.invert===!0,this.Ci=e.options.gatherUnattachedRoots===!0,this.I=e.options.alignment||Uc,this.gd=e.options.generateRouting===!0,this.Ti=e.options.edgeFilter,this.$a=e.options.filteredEdgeProcessor,this.xi=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.Tn?this.Tn():this.Ed;this.model=new Xc(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.Pn,edgeNodeSize:this.Ie,edgeFilter:this.Ti},this),this.model.initialize()}end(e,t,n,o,s){}reset(){}getDefaultParameters(){return{padding:{x:50,y:50},unattachedRootPadding:150,axis:"horizontal",maxIterations:24,maxIterationsWithoutImprovement:2,placementStrategy:"parent",alignment:"center",edgeNodeSize:Pm}}step(e,t,n,o,s){let a=0;if(!this.model.isEmpty()){let l=this.model.nextRoot(),h=null;for(;l!=null;){let d=new Wc(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new Yc(this.model,d);u.execute(l),new Ls(d,(m,E,y)=>this.model.getAdjacentEntries(m,E,y),{maxIterations:this.bi,maxIterationsWithoutImprovement:this.Ai}).execute(),h=new kc(this.model,d,{padding:this.padding,strategy:this.fd,edgeNodeSize:this.Ie,lastPlacements:h,gatherUnattachedRoots:this.Ci,unattachedRootPadding:this.Pn,alignment:this.I}).execute(l);let p=[];if(d.layers.flatMap(m=>m.entries.map(E=>{if(dt(E)){p.push(E);let y=this.axis===0?m.ymax-m.ymin:m.xmax-m.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.$a){let m=u.getFilteredEdges().map(E=>{let y=this.model.entryMap[E.source.id],x=this.model.entryMap[E.target.id],f=d.layers[y.layer].entries.findIndex(A=>A.id===y.id),b=d.layers[x.layer].entries.findIndex(A=>A.id===x.id);return{sourceEntry:y,sourceEntryIndex:f,targetEntry:x,targetEntryIndex:b,edge:E}});this.$a(m,this)}let g={};this.gd&&(this.routingInformation=this.model.sets.map(m=>{let E={gates:m.gates,edges:m.edgeRouting,edgeMap:m.edgeRoutingMap,regions:m.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new zc(this.model,d,this.axis,this.Pe,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:g}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(Ao,"type",pb),nt.register(Ao.type,Ao);var Zc=class{constructor(r){this.color=r}generate(r){return this.color}},Di=class i{constructor(r,e,t){this.r=r;this.g=e;this.b=t}toString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}static fromString(r){if(r.startsWith("#")){let e=r.substring(1);e.length===3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]].join(""));let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16);return new i(t,n,o)}else if(r.startsWith("rgb")){let e=r.match(/\d+/g);if(e&&e.length>=3)return new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}else{let e=rI(r);return i.fromString(e)}}};function rI(i){let r=document.createElement("div");r.style.color=i,document.body.appendChild(r);let e=getComputedStyle(r).color;return document.body.removeChild(r),e}function VO(){return new Di(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var ws=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=VO(),s=this.assignedColors.find(a=>mb(a,o)<20);for(;s!=null&&n<10;)o=VO(),s=this.assignedColors.find(a=>mb(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},gb=class{constructor(...r){c(this,"colors");c(this,"counter",0);this.colors=r}generate(r){let e=this.colors[this.counter];return this.counter++,this.counter>=this.colors.length&&(this.counter=0),e}};function mb(i,r){let e=(i.r+r.r)/2,t=i.r-r.r,n=i.g-r.g,o=i.b-r.b;return Math.sqrt(((512+e)*t*t>>8)+4*n*n+((767-e)*o*o>>8))}function Jc(i){let r=X(i)?Di.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Di(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new Di(Math.min(255,Math.floor(r.r+(255-r.r)*.7)),Math.min(255,Math.floor(r.g+(255-r.g)*.7)),Math.min(255,Math.floor(r.b+(255-r.b)*.7)))}function nI(i){let r=X(i)?Di.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Di(0,0,0):new Di(255,255,255)}var Lm="empty",GO=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1},{dx:-1,dy:-1,axis:Tn,directionFromParent:-1},{dx:1,dy:-1,axis:Qn,directionFromParent:-1},{dx:1,dy:1,axis:Tn,directionFromParent:1},{dx:-1,dy:1,axis:Qn,directionFromParent:1}],$O=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1}],Eb=(i,r,e,t)=>$O.filter(n=>n.axis!==e||n.directionFromParent===t),wm=(i,r,e,t)=>{let n=[];switch(e){case Qn:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case Tn:n.push({x:t,y:0}),n.push({x:t,y:t}),n.push({x:0,y:t});break;case ne:n.push({x:t,y:-1}),n.push({x:t,y:0}),n.push({x:t,y:1});break;case pe:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return GO.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Ns=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"Et",{});c(this,"Pi");c(this,"yd");c(this,"sourceId");c(this,"targetId");c(this,"sourceObstacles",[]);c(this,"targetObstacles",[]);c(this,"sourceBuffers",[]);c(this,"targetBuffers",[]);c(this,"sourceAxis");c(this,"sourceDirection");c(this,"targetAxis");c(this,"targetDirection");this.Pi={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.yd=t*(n+o)}Ko(r,e){return{x:Math.floor((r-this.Pi.x)/this.gridCellSize),y:Math.floor((e-this.Pi.y)/this.gridCellSize)}}IE(r){let e=this.Ko(r.x,r.y),t=this.Ko(r.x+r.width,r.y+r.height);return{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}VE(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.Pi.x+t,s=this.Pi.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}ME(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}GE(r,e,t,n){let o=this.makeKey(r,e);if(this.Et[o]==null){let s=this.VE(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.yd),d=[],u=[],p=!1,g=!1;h.forEach(m=>{if(!p&&(this.sourceId===m.id||this.sourceObstacles.indexOf(m.id)!==-1)&&(p=!0),!g&&(this.targetId===m.id||this.targetObstacles.indexOf(m.id)!==-1)&&(g=!0),!this.ME(m.id)){let E=Ox(this.IE(m),this.vertexBorder,this.vertexBorder);u.push(m.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(m.id)}}),this.Et[o]={key:o,f:0,g:1/0,h:null,opened:!1,closed:!1,x:r,y:e,cx:a,cy:l,ax:t,ay:n,parent:null,fixedAxis:null,directionFromParent:null,obstacles:d,buffers:u,hasSourceObstacles:p,hasTargetObstacles:g}}else t&&(this.Et[o].ax=t),n&&(this.Et[o].ay=n);return this.Et[o]}setSourceCell(r,e,t,n,o,s,a){this.sourceId=r;let l=this.getCell(e,t,n,o);return this.sourceObstacles=l.obstacles.slice(),this.sourceBuffers=l.buffers.slice(),this.sourceAxis=s,this.sourceDirection=a,l.opened=!0,l.g=0,l.f=0,l.fixedAxis=s,l.directionFromParent=a,l}setTargetCell(r,e,t,n,o,s,a){this.targetId=r;let l=this.getCell(e,t,n,o);return this.targetObstacles=l.obstacles.slice(),this.targetBuffers=l.buffers.slice(),this.targetAxis=s,this.targetDirection=a,l.fixedAxis=s,l.directionFromParent=this.targetDirection,l}get sourceAndTargetObstacles(){let r=this.sourceObstacles.slice(),e=this.targetObstacles.slice();return r.push(...e),r}getCell(r,e,t,n){return this.GE(r,e,t,n)}reinitialize(){Object.entries(this.Et).forEach(r=>{r[1].f=0,r[1].g=1/0,r[1].h=null,r[1].closed=!1,r[1].opened=!1,r[1].parent=null,r[1].directionFromParent=null,r[1].ax=null,r[1].ay=null,r[1].fixedAxis=null}),this.sourceObstacles.length=0,this.sourceBuffers.length=0,this.targetObstacles.length=0,this.targetBuffers.length=0}};function Ds(i,r){return i===0&&r===0?void 0:i===0&&r!==0?pe:i!==0&&r===0?ne:Math.sign(r)===Math.sign(i)?Tn:Qn}function fb(i,r,e){return e==null?0:e===ne?i>0?1:-1:e===pe?r>0?1:-1:e===Tn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function Dm(i){let r=Ds(i.ox,i.oy);return{axis:r,direction:fb(i.ox,i.oy,r)}}function yb(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?ne:pe}function Nr(i){if(i.parent==null)return i.fixedAxis;{let r=Math.sign(i.parent.x-i.x),e=Math.sign(i.parent.y-i.y);return Ds(r,e)}}function xb(i){if(i.parent==null)return i.directionFromParent;{let r=Math.sign(i.x-i.parent.x),e=Math.sign(i.y-i.parent.y),t=Ds(r,e);return fb(r,e,t)}}function iI(i,r,e){if(r.f<e.f)return-1;if(e.f<r.f)return 1;if(r.h<e.h)return-1;if(e.h<r.h)return 1;{let t=Nr(i);return Nr(r)===t?-1:Nr(e)===t?1:0}}var Kc=class{constructor(){c(this,"node")}sort(r,e){return iI(this.node,r,e)}};var Wt="group:added",Ni="group:member:added",Is="group:member:removed",Oe="group:removed",So="dataLoadStart",Nm="dataAppendStart",Ir="dataLoadEnd",Im="dataAppendEnd",Mm="dataUpdated",Cn="graphClearStart",Zt="graphCleared",bb="graphChanged",ve="group:updated",Re="node:updated",lr="port:updated",xt="edge:updated",hr="edge:added",Jt="node:added",bt="edge:removed",Ce="node:removed",ei="port:added",Mr="port:removed",nn="edge:target",on="edge:source",Kt="select",qt="deselect",nr="selection:cleared",ti="edge:geometry",ri="edge:pathEdited",Ab="edge:dragStart",Sb="edge:drag",Tb="edge:dragEnd",vb="edge:dragAbort",qc="edge:typeChanged",Qc="node:typeChanged",ed="port:typeChanged",td="group:typeChanged",Cb="group:move:start",To="group:move",Vr="group:move:end",rd="internal:group:sizeChanged",nd="internal:group:sizeChangedRedo",id="internal:group:sizeChangedUndo",Pb="internal:edge:redraw",_b="renderer:added",Ms="node:move:start",Mt="node:move",Vt="node:move:end",od="node:move:abort",Vs="undoredo:update",Ob="undo",Rb="redo",Ii="destroy";var oI=[Jt,ei,hr,Wt,Ce,Mr,bt,Oe,Re,lr,xt,ve,Vt,Vr,on,nn,Ni,Is],Gs=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},yl=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"qo",null);if(e.saveUrl==null&&e.autoSaveHandler==null)throw new Error("VisuallyJs autosave: neither saveUrl nor autoSaveHandler was specified");function t(a){return function(){a&&a.apply(a,arguments),e.onAfterAutoSave&&e.onAfterAutoSave()}}let n=!1,o=function(){if(!n){try{e.onBeforeAutoSave&&e.onBeforeAutoSave()}catch(a){}e.autoSaveHandler!=null?e.autoSaveHandler(r):r.save({type:e.type||kt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.qo==null?this.qo=setTimeout(o,e.debounceTimeout):(clearTimeout(this.qo),this.qo=setTimeout(o,e.debounceTimeout))};Gs(this,So,()=>{n=!0}),Gs(this,Ir,()=>{n=!1}),Gs(this,Cn,()=>{n=!0}),Gs(this,Zt,()=>{n=!1}),Gs(this,Mm,s),Gs(this,ri,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},sd=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(Mm)};oI.forEach(t=>Gs(this,t,e))}};var Lb="mixed",ad="isolated",wb="nodesOnly",Db="groupsOnly",Nb="edgesOnly",$s=class $s extends Ft{constructor(e,t){super();this.instance=e;c(this,"ir",1/0);c(this,"xd",1/0);c(this,"bd",1/0);c(this,"pe",[]);c(this,"te",[]);c(this,"ne",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ve",{});c(this,"zr");c(this,"Qo",!1);c(this,"edgeFactory");t=t||{},this.edgeFactory=e.edgeFactory,this.generator=t.generator,this.onReload=t.onReload,this.onBeforeReload=t.onBeforeReload,this.autoFill=t.autoFill===!0,this.onClear=t.onClear||function(){},this.zr=t.mode||Lb,this.instance.bind(Ce,n=>{this.Mt(n.node)}),this.instance.bind(Oe,n=>{this.Mt(n.group)}),this.instance.bind(Mr,n=>{this.Mt(n.port)}),this.instance.bind(bt,n=>{this.Mt(n.edge)}),this.instance.bind(nn,n=>{this.Ve[n.edge.getFullId()]&&this.fire(nn,n)}),this.instance.bind(on,n=>{this.Ve[n.edge.getFullId()]&&this.fire(on,n)}),this.instance.bind(Jt,n=>{this.generator&&this.autoFill&&!this.Qo&&this.reload()}),this.instance.bind(Wt,n=>{this.generator&&this.autoFill&&!this.Qo&&this.reload()}),this.instance.bind(Re,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(Re,n)}),this.instance.bind(ve,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(ve,n)}),this.instance.bind(xt,n=>{this.Ve[n.edge.getFullId()]&&this.fire(xt,n)}),this.instance.bind(lr,n=>{n.port!=null&&this.Ve[n.port.getFullId()]&&this.fire(lr,n)}),this.instance.bind(Zt,()=>{this.clear()}),this.instance.bind(Ir,()=>{this.reload()}),this.setCapacityPolicy($s.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.pe.length===0&&this.te.length===0&&this.ne.length===0}Ad(e){return e.objectType===Ue.objectType?this.ne:e.objectType===ce.objectType?this.pe:this.te}setMode(e){this.zr=e,e===ad?this.$E():e===Nb?this.Sd():e===wb?(this.Ba(),this.Td()):e===Db&&(this.Ba(),this.vd())}BE(e){let t=[],n=this.Ad(e),o=e.objectType===Ue.objectType?this.xd:e.objectType===ce.objectType?this.ir:this.bd;if(n.length>=o){if(this.capacityPolicy===$s.DISCARD_NEW)return!1;t=n.splice(0,1),this.Fa(t[0],":removed"),delete this.Ve[t[0].getFullId()]}return n.push(e),this.Fa(e,":added"),t}Fa(e,t){let n=e.objectType.toLowerCase()+t,o={Group:s=>({data:s.data,group:s}),Node:s=>({data:s.data,node:s}),Port:s=>({data:s.data,node:s.getParent(),port:s}),Edge:s=>({data:s.data,edge:s})};this.fire(n,o[e.objectType](e))}Cd(e,t){if(this.FE(e)&&!this.Ve[e.getFullId()]){let n=this.BE(e);return n===!1?[[],[]]:(this.Ve[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}FE(e){return this.zr===Lb||this.zr===wb&&e.objectType===ce.objectType||this.zr===Db&&e.objectType===se.objectType||this.zr===Nb&&e.objectType===Ue.objectType?!0:this.zr===ad?e.objectType===Ue.objectType?this.pe.length===0&&this.te.length===0:this.ne.length===0:!1}Mt(e,t){let n=e.getFullId();return Nt(this.Ad(e),s=>s.getFullId()==n)?(delete this.Ve[e.getFullId()],t&&t(e,!1),this.Fa(e,":removed"),[[],[e]]):[[],[]]}UE(e,t){return this.Ve[e.getFullId()]?this.Mt(e,t):this.Cd(e,t)}Ua(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(X(h))d=this.instance.getNode(h)||this.instance.getEdge(h)||this.instance.getGroup(h),d!=null&&(a=t(d,n),o.push.apply(o,a[0]),s.push.apply(s,a[1]));else if(h.eachVertex&&h.eachEdge)h.eachVertex((u,p)=>{l(p)}),h.eachEdge((u,p)=>{l(p)});else if(h.Ye)h.each((u,p)=>{l(p.vertex||p)});else if(h.length!=null)for(let u=0;u<h.length;u++)l(h[u]);else a=t(h,n),o.push.apply(o,a[0]),s.push.apply(s,a[1])};return l(e),[o,s]}remove(e,t){return this.Ua(e,this.Mt.bind(this),t)}append(e,t){return this.Ua(e,this.Cd.bind(this),t)}toggle(e,t){return this.Ua(e,this.UE.bind(this),t)}setMaxNodes(e){this.ir=e}setMaxGroups(e){this.bd=e}setMaxEdges(e){this.xd=e}setCapacityPolicy(e){this.capacityPolicy=e}Ba(){for(let e=this.ne.length,t=0;t<e;t++)this.Mt(this.ne[0])}vd(){for(let e=this.pe.length,t=0;t<e;t++)this.Mt(this.pe[0])}Td(){for(let e=this.te.length,t=0;t<e;t++)this.Mt(this.te[0])}Sd(){this.vd(),this.Td()}$E(){this.Sd(),this.Ba()}clear(e){this.pe.length=0,this.ne.length=0,this.te.length=0,this.Ve={},this.fire(Cn),e||this.onClear(this)}zE(e){let t=[];for(let n=0;n<e.length;n++)this.Ve[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.Qo=!0,this.fire(So,{}),this.generator(this,this.instance),this.fire(Ir,{}),this.onReload&&this.onReload(),this.Qo=!1)}Ye(e,t){let n=t===Ue.objectType?this.ne:t===se.objectType?this.te:this.pe;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.Ye(e,ce.objectType)}eachGroup(e){this.Ye(e,se.objectType)}eachVertex(e){this.Ye(e,ce.objectType),this.Ye(e,se.objectType)}eachEdge(e){this.Ye(e,Ue.objectType)}getNodeCount(){return this.pe.length}getNodeAt(e){return this.pe[e]}getNodes(){return this.pe}getNode(e){return this.pe.find(t=>t.id===e)}getGroupAt(e){return this.te[e]}getGroups(){return this.te}getGroup(e){return this.te.find(t=>t.id===e)}getGroupCount(){return this.te.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.pe),Array.prototype.push.apply(e,this.ne),Array.prototype.push.apply(e,this.te),e}getAllEdgesFor(e,t){return this.zE(e.getAllEdges(t))}getEdgeCount(){return this.ne.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.ne[e]}getEdges(){return this.ne}getGroupType(e){return this.instance.getGroupType(e)}getNodeType(e){return this.instance.getNodeType(e)}getModel(){return this.instance.getModel()}getGraph(){return this.instance.getGraph()}getNodeId(e){return this.instance.getNodeId(e)}getGroupId(e){return this.instance.getGroupId(e)}getPortType(e){return this.instance.getPortType(e)}addPort(e,t){return this.instance.addPort(e,t)}getPortId(e){return this.instance.getPortId(e)}getEdge(e){return this.instance.getEdge(e)}getEdgeType(e){return this.instance.getEdgeType(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}containsVertex(e){return this.getVertex(e)!=null}getObjectInfo(e){return this.instance.getObjectInfo(e)}beforeConnect(e,t,n,o){return this.instance.beforeConnect(e,t,n,o)}beforeMoveConnection(e,t,n){return this.instance.beforeMoveConnection(e,t,n)}beforeStartConnect(e,t){return this.instance.beforeStartConnect(e,t)}beforeDetach(e,t,n){return this.instance.beforeDetach(e,t,n)}beforeStartDetach(e,t){return this.instance.beforeStartDetach(e,t)}get debugEnabled(){return this.instance.debugEnabled}YE(e){return new $s(this.instance,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1;for(let h in e){let d=e[h]===a[h];if(!d&&!t)return!1;l=l||d}return l},o=this.YE();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getAncestors(e){return this.instance.getAncestors(e).filter(t=>this.containsVertex(t.id))}getDescendants(e){return this.instance.getDescendants(e)}getType(e){return this.instance.getType(e)}isAncestor(e,t){return this.instance.isAncestor(e,t)}isDescendantGroup(e,t){return this.instance.isDescendantGroup(e,t)}resolveFullId(e){return this.instance.resolveFullId(e)}};c($s,"DISCARD_EXISTING","discardExisting"),c($s,"DISCARD_NEW","discardNew");var cr=$s;var Mi=class{constructor(r,e,t){this.obj=r;this.instance=e;this.manager=t;c(this,"edgeId");c(this,"source");c(this,"target");c(this,"za");c(this,"Ya");c(this,"Oi");c(this,"Pd");c(this,"Od");c(this,"_d");c(this,"Rd");this.source=r.source.getFullId(),this.target=r.target.getFullId(),j(r.source)&&(this.za=r.source.id,this.source=r.source.getParent().getFullId()),j(r.target)&&(this.Ya=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Oi=r.geometry,r.source.dummy&&(this.Pd=!0,this._d={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.Od=!0,this.Rd={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.Pd?this._d:this.za==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.za}generateTargetIdentifier(){return this.Od?this.Rd:this.Ya==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.Ya}et(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Oi},e=this.instance.$_addEdge(r,Hx,null);this.manager.edgeChange(this.edgeId,e)}rt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},Gm=class extends Mi{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.rt()}redo(){this.et()}hasDeltas(){return this.obj!=null}},$m=class extends Mi{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.et()}redo(){this.rt()}hasDeltas(){return this.obj!=null}},Vm=class extends Mi{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return _i(this.newVertex)&&_i(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!_i(this.newVertex)&&!_i(this.oldVertex)&&$x(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},Bm=class extends Vm{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},Fm=class extends Vm{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var vo=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=G()}$mergeInto(r){this.actions.reverse().forEach(e=>r.addAction(e,!0))}addAction(r,e){e?this.actions.unshift(r):this.actions.push(r)}undo(){this.actions.slice().reverse().forEach(r=>r.undo())}redo(){this.actions.forEach(r=>r.redo())}edgeChange(r,e){this.actions.forEach(t=>{t instanceof Mi&&t.edgeId===r&&t.edgeChange(e)})}hasDeltas(){for(let r=0;r<this.actions.length;r++)if(this.actions[r].hasDeltas())return!0;return!1}compress(){let r=new i,e={},t={},n={};for(let o=0;o<this.actions.length;o++){let s=this.actions[o];Ib(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):Mb(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):Vb(s)?n[s.group.id]!=null?Object.assign(n[s.group.id].newGroupSize,s.newGroupSize):(n[s.group.id]=s,r.addAction(s)):r.addAction(s)}return r}};var Bs=class{constructor(r,e,t,n){this.obj=r;this.originalPosition=e;this.pos=t;this.renderer=n;c(this,"type","moveAction")}redo(){this.renderer.setPosition(this.obj,this.pos.x,this.pos.y)}undo(){this.renderer.setPosition(this.obj,this.originalPosition.x,this.originalPosition.y)}hasDeltas(){return this.pos.x!==this.originalPosition.x||this.pos.y!==this.originalPosition.y}};var ld=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===ce.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===se.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}Ld(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},bl=class extends ld{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.Ld()}redo(){this.$add()}},xl=class extends ld{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.Ld()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},hd=class extends xl{constructor(e,t){super(e.group,t);c(this,"type","groupRemove");c(this,"childrenRemoved");c(this,"orphanedChildren");this.childrenRemoved=e.removeChildren,this.orphanedChildren=e.children.slice()}$add(){super.$add(),this.childrenRemoved||this.orphanedChildren.forEach(e=>this.instance.$addToGroup(e,this.obj,null,null,null,null))}},Al=class{constructor(r,e,t,n,o){this.group=r;this.originalGroupSize=e;this.newGroupSize=t;this.instance=n;this.source=o;c(this,"type","groupSizeChanged")}hasDeltas(){return Math.round(this.originalGroupSize.width)!==Math.round(this.newGroupSize.width)||Math.round(this.originalGroupSize.height)!==Math.round(this.newGroupSize.height)}redo(){this.Yr(nd,this.newGroupSize,this.originalGroupSize)}undo(){this.Yr(id,this.originalGroupSize,this.newGroupSize)}Yr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function Fs(i,r,e){let t;i=i||{},r=r||{};let n=i,o=r;if(e)for(t=0;t<e.length;t++)n[e[t]]=o[e[t]];else for(t in o)n[t]=o[t];return i}function sI(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function cd(i,r,e){return function(){let t=null;try{r!=null&&(t=r.apply(this,arguments))}catch(n){U("VisuallyJs: function failed : "+n)}if(i!=null&&(e==null||t!==e))try{t=i.apply(this,arguments)}catch(n){U("VisuallyJs: wrapped function failed : "+n)}return t}}var Vi=class{constructor(r,e,t,n,o,s,a){this.obj=r;this.instance=t;this.typeChanged=o;this.newType=s;this.previousType=a;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=Fs({},r.data),this.$od=Fs({},e),this.reason=n}wd(r){this.obj.objectType===ce.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===se.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===de.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Ue.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.wd(this.$od),this.typeChanged&&this.instance.setType(this.obj,this.previousType)}redo(){this.wd(this.$nd),this.typeChanged&&this.instance.setType(this.obj,this.newType)}hasDeltas(){return!ll(this.$nd,this.$od)||this.typeChanged&&this.newType!==this.previousType}};var dd=class{constructor(r,e,t){this.obj=r;this.Rn=e;this.instance=t}et(){this.instance.addPort(this.Rn,this.obj.data)}rt(){this.instance.removePort(this.Rn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},ud=class extends dd{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.rt()}redo(){this.et()}hasDeltas(){return this.obj!=null}},pd=class extends dd{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.et()}redo(){this.rt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var Um=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},gd=class extends Um{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.ja=o;this.Xa=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Xa!=null&&this.renderer.setPosition(this.node.id,this.Xa.x,this.Xa.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.ja!=null&&this.renderer.setPosition(this.node.id,this.ja.x,this.ja.y)}},md=class extends Um{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ha=o;this.ka=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this.ka!=null&&this.renderer.setPosition(this.node.id,this.ka.x,this.ka.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ha!=null&&this.renderer.setPosition(this.node.id,this.Ha.x,this.Ha.y)}},Ed=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupCollapse")}redo(){this.renderer.collapseGroup(this.group)}undo(){this.renderer.expandGroup(this.group)}hasDeltas(){return this.group!=null}},fd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupExpand")}redo(){this.renderer.expandGroup(this.group)}undo(){this.renderer.collapseGroup(this.group)}hasDeltas(){return this.group!=null}};var Sl=class{constructor(r,e,t){this.Wa=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.Wa.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var Gb="internal.connection",yd="internal.element:repainted",Tl="context:update",xd="group:collapse",bd="group:expand",Gr="zoom",Ad="render:start",$r="render:end",$b="adhocLayout",Us="afterLayoutRefresh",vl="group:relayout",Br="group:render",Ys="internal.vertex:updated",Fr="node:render",Sd="node:visibility",Td="plugin:added",Bb="plugin:removed",Pn="relayout",Fb="objectRepainted",Ye="click",At="contextmenu",Co="dblclick",Ur="dbltap",Ub="focus",ge="mousedown",Ym="mouseenter",zm="mouseexit",ae="mousemove",Yb="mouseleave",le="mouseup",ot="mouseout",st="mouseover",W="tap",zb="touchstart",Xb="touchend",jb="touchmove",Hb="vertex:click",kb="vertex:dblclick",Wb="vertex:dbltap",Zb="vertex:mouseout",Jb="vertex:mouseover",Kb="vertex:mousemove",aI="vertex:mouseup",lI="vertex:mousedown",qb="vertex:contextmenu",Qb="vertex:tap",eA="edge:click",tA="edge:dblclick",rA="edge:dbltap",vd="edge:mouseout",Cd="edge:mouseover",nA="edge:mouseup",Cl="edge:mousedown",iA="edge:contextmenu",oA="edge:tap",_n="canvasClick",sA="canvasDblClick",Pd="edge:redraw",_d="start",Od="lasso:update",Rd="lasso:end",Gi="pan",On="modeChanged",hI="allGroupsRelayout",aA="groupRelayoutAdhoc",cI="groupMemberRemoved",lA="newVertexAddedToGroup",hA="existingVertexAddedToGroup";var Pl=class extends Vi{constructor(e,t,n,o,s,a,l){super(e,t,n,o,s,a,l);this.obj=e;this.instance=n;this.typeChanged=s;this.newType=a;this.previousType=l;c(this,"type","vertexUpdate");o===zs&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var Xs=class{constructor(r,e,t,n){this.obj=r;this.previousType=e;this.newType=t;this.instance=n;c(this,"type","setTypeAction")}hasDeltas(){return this.previousType!==this.newType}redo(){this.instance.setType(this.obj,this.newType)}undo(){this.instance.setType(this.obj,this.previousType)}};var cA=class{constructor(r,e,t,n,o){this.T=r;this.XE=e;this.Nd=t;this.Oi=n;this.Wa=o;c(this,"type","edgePath")}Dd(r){this.T.setEdgeGeometry(this.XE,r,null,this.Wa)}undo(){this.Dd(this.Nd)}redo(){this.Dd(this.Oi)}hasDeltas(){return!ll(this.Nd,this.Oi)}},dI=50,dA="Cannot start a new transaction while one is active. Either commit/rollback the current transaction before creating a new one, or pass a cleanup flag in to this method",uI="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",Ld=class{constructor(r){c(this,"T");c(this,"es");c(this,"Gt");c(this,"Za");c(this,"undoStack");c(this,"redoStack");c(this,"Ja",[]);c(this,"me");c(this,"ft",0);this.T=r.instance,this.Gt=!1,this.undoStack=[],this.redoStack=[],this.es=r.maximumSize||dI,this.Za=r.onChange,this.jE()}Id(r){this.Gt=r}dataLoadStart(){this.clear(),this.Id(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.Id(!1)}dataAppendEnd(){this.dataLoadEnd()}jE(){this.T.bind(Zt,()=>{this.clear()}),this.T.bind(Jt,r=>{this.command(new bl(r.node,this.T))}),this.T.bind(Ce,r=>{this.command(new xl(r.node,this.T))}),this.T.bind(Re,r=>{al(r.updates)||this.command(new Pl(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(Wt,r=>{this.command(new bl(r.group,this.T))}),this.T.bind(Oe,r=>{this.command(new hd(r,this.T))}),this.T.bind(ve,r=>{al(r.updates)||this.command(new Pl(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(rd,r=>{let e=new Al(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(hr,r=>{this.command(new Gm(r.edge,this.T,this))}),this.T.bind(bt,r=>{this.command(new $m(r.edge,this.T,this))}),this.T.bind(xt,r=>{al(r.updates)||this.command(new Vi(r.edge,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(on,r=>{this.command(new Bm(this.T,this,r.edge,r.old,r.new))}),this.T.bind(nn,r=>{this.command(new Fm(this.T,this,r.edge,r.old,r.new))}),this.T.bind(ri,r=>{this.command(new cA(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(ei,r=>{this.command(new ud(r.port,r.vertex,this.T))}),this.T.bind(Mr,r=>{this.command(new pd(r.port,r.vertex,this.T))}),this.T.bind(lr,r=>{al(r.updates)||this.command(new Vi(r.port,r.originalData,this.T,null,!1,null,null))}),this.T.bind(Ni,r=>{r.vertexIsNew!==!0&&this.command(new gd(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(Is,r=>{this.command(new md(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(Qc,r=>{r.isPartOfUpdate||this.command(new Xs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(ed,r=>{r.isPartOfUpdate||this.command(new Xs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(td,r=>{r.isPartOfUpdate||this.command(new Xs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(qc,r=>{r.isPartOfUpdate||this.command(new Xs(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Vt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Bs(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(Vr,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Bs(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(xd,e=>{this.command(new Ed(e.group,r.renderer))}),r.renderer.bind(bd,e=>{this.command(new fd(e.group,r.renderer))}),r.renderer.bind(Ce,e=>{this.command(new Sl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Oe,e=>{this.command(new Sl(r.renderer,e.vertex,e.pos))})})}_i(){this.Za&&this.Za(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.Gt){if(!r.hasDeltas())return;UO(r)&&(r=r.compress()),this.me!=null?this.me.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.es&&this.undoStack.splice(this.undoStack.length-this.es-1,this.undoStack.length-this.es),this.redoStack.length=0,this._i())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof Mi&&o.edgeId===r?o.edgeChange(e):o instanceof vo&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.Gt=!0,this.redoStack.push(r),r.undo(),this.Gt=!1,this._i())}redo(){let r=this.redoStack.pop();r&&(this.Gt=!0,this.undoStack.push(r),r.redo(),this.Gt=!1,this._i())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.me=null,this.ft=0,this.Gt=!1,this._i()}transaction(r,e,t){if(this.me!=null&&e==null)return U(dA),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.me;return this.ft===0?(this.me=null,this.command(a)):this.ft--,a.id}else return this.rollbackTransaction(),!1}catch(s){return U("Exception thrown in transaction "+s.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}mergeTransaction(r){if(this.me!=null)return this.transaction(r,ut);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.kE(t,n),this.undoStack.push(t)}return e}else return this.rollbackTransaction(),!1}catch(e){return U("Exception thrown in transaction "+e.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}kE(r,e){e instanceof vo?e.$mergeInto(r):r.addAction(e,!0)}HE(){return this.me=new vo,this.ft=0,this.me.id}openTransaction(r){if(!this.Gt){let e=!0;if(this.me!=null)if(r!=null)if(r===BO)this.commitTransaction();else if(r===FO)this.rollbackTransaction();else if(r===ut)e=!1,this.ft++;else throw new Error(dA);else throw new Error(dA);return e&&this.HE(),this.me.id}return null}rollbackTransaction(){this.me!=null&&(this.ft>0?(this.ft--,U(uI)):(this.me.undo(),this.me=null,this._i(),this.Ja.length=0))}commitTransaction(r){if(this.me!=null)if(r!==!0&&this.ft>0)this.ft--;else{let e=this.me;this.me=null,this.command(e),this.ft=0,this.WE()}}WE(){this.me==null&&(this.Ja.forEach(r=>{try{r()}catch(e){}}),this.Ja.length=0)}},BO="commitCurrent",FO="rollbackCurrent",ut="appendToCurrent";function UO(i){return i instanceof vo}function Ib(i){return i instanceof Vi||i instanceof Pl}function Mb(i){return i instanceof Bs}function Vb(i){return i instanceof Al}var Xm="1.2.3";var uA="type",pA="default",pI="group",fA="groupResized",YO="addPort",zO="addNewPort",XO="removePort",wd="updatePort",js="moved",gI="layout",jm="updateVertex",gA="updateNode",mA="updateGroup",yA="magnetizer",Nd="setPosition",xA="snapToGrid",mI="sizeGroupToFit",_l="drawingToolsResize",zs="rotation",bA="resized",EA="updated",Dd=class extends Ft{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");c(this,"groupProperty");c(this,"typeFunction");c(this,"edgeIdFunction");c(this,"edgeTypeFunction");c(this,"portIdFunction");c(this,"portTypeFunction");c(this,"portExtractor");c(this,"portUpdater");c(this,"portDataProperty");c(this,"portOrderProperty");c(this,"modelTopAttribute");c(this,"modelLeftAttribute");c(this,"modelWidthAttribute");c(this,"modelHeightAttribute");c(this,"modelRotationAttribute");c(this,"model");c(this,"Ka");c(this,"Vd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"undoRedo");c(this,"Md");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"Ee");c(this,"Xr",new Map);c(this,"Ri",{});c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new Ld({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Vs,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||lm,this.typeProperty=e.typeProperty||uA,this.edgeTypeProperty=e.edgeTypeProperty||uA,this.portTypeProperty=e.portTypeProperty||uA,this.groupProperty=e.groupProperty||pI,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||pA),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||pA),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||pA),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new wc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!ar(a)?{}:a,a=lt(a),a.id=a.id||G(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||rb,this.modelTopAttribute=e.modelTopAttribute||nb,this.modelWidthAttribute=e.modelWidthAttribute||ob,this.modelHeightAttribute=e.modelHeightAttribute||sb,this.modelRotationAttribute=e.modelRotationAttribute||ib,this.Ri=Object.assign({},e.groupTemplates||{}),this.nodeFactory=e.nodeFactory||this.defaultObjectFactory,this.edgeFactory=e.edgeFactory||this.defaultObjectFactory,this.portFactory=e.portFactory||this.defaultObjectFactory,this.groupFactory=e.groupFactory||this.defaultObjectFactory,this.Vd=e.autoSave&&e.autoSave.enabled!==!1,this.Md={portSeparator:e.portSeparator,defaultCost:e.defaultCost,defaultDirected:e.defaultDirected,enableSubgraphs:e.enableSubgraphs},this.portDataProperty!=null&&this.portExtractor==null&&(this.portExtractor=o=>{let s=o[this.portDataProperty]||[];return this.portOrderProperty!=null&&s.sort((a,l)=>{let h=a[this.portOrderProperty],d=l[this.portOrderProperty],u=h==null?1/0:h,p=d==null?1/0:d;return u-p}),s}),this.portDataProperty!=null&&this.portUpdater==null&&(this.portUpdater=(o,s,a)=>{let l={};return this.portOrderProperty!=null&&a.sort((h,d)=>{let u=h.data[this.portOrderProperty],p=d.data[this.portOrderProperty],g=u==null?1/0:u,m=p==null?1/0:p;return g-m}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new cl(this.Md),this.Vd&&(this.autoSaver=new yl(this,e.autoSave)),new sd(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=j(o)?o.getParent():o,d=j(s)?s.getParent():s,u=j(o)?this.model.getPortDefinition(a):J(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=j(s)?this.model.getPortDefinition(l):J(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),g=J(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),m=J(d)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l);return u.maxConnections!=null&&o.getEdges().length>=u.maxConnections||p.maxConnections!=null&&s.getEdges().length>=p.maxConnections?!1:o===s?!(g.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||m.allowLoopback===!1):h===d?!(g.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||m.allowVertexLoopback===!1):!0};if(this.beforeConnect=e.beforeConnect||n,this.beforeMoveConnection=e.beforeMoveConnection||n,this.beforeStartConnect=e.beforeStartConnect||((o,s)=>({})),this.beforeDetach=e.beforeDetach||((o,s,a)=>!0),this.beforeStartDetach=e.beforeStartDetach||((o,s)=>!0),this.Ee=this.ts(o=>{this.N(s=>s.$selectionCleared(o)),this.fire(nr,{selection:o})}),e.selectionMode&&this.Ee.setMode(e.selectionMode),e.maxSelectedNodes&&this.Ee.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.Ee.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.Ee.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.Ee.setCapacityPolicy(e.selectionCapacityPolicy),e.events)for(let o in e.events)this.bind(o,e.events[o]);e.data!=null&&this.load({data:e.data})}get portSeparator(){return this.graph.portSeparator}ZE(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}rs(e,t,n,o){if(X(e))return[this.graph.getVertex(e,!0),!1];if(J(e)||Y(e)||j(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.Gd(this.ZE(t,{x:a,y:l},n),o),!0]}}ts(e){return new cr(this,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1,h=e;for(let d in h){let u=h[d]===a[d];if(!u&&!t)return!1;l=l||u}return l},o=this.ts();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getModel(){return this.model}setAutoSave(e){this.autoSaver!=null&&this.autoSaver.discard(),this.autoSaver=new yl(this,e)}connect(e){let t,n=this.graph.getVertex(e.source),o=this.graph.getVertex(e.target),s=e.cost,a=e.directed;if(!n)if(!e.doNotCreateMissingNodes)n=this.graph.addNode(e.source),this.qa(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.qa(o);else return;let l=e.data||{},h=this.beforeStartConnect(n,this.edgeTypeFunction(l));return h&&(typeof h=="object"&&(l=Object.assign(h,l)),this.beforeConnect(n,o,l,!1)!==!1&&(t=this.$_addEdge({source:n,target:o,cost:s,directed:a,data:l,geometry:e.geometry},ul,null))),t}clear(){return this.N(e=>e.$graphClearStart()),this.fire(Cn),this.graph.clear(),this.$transientVerticesByRenderer={},this.N(e=>e.$graphClearEnd()),this.fire(Zt,this),this}destroy(){this.clear(),delete this.Xr,delete this.$transientVerticesByRenderer}getGraph(){return this.graph}getNodeCount(){return this.graph.getVertexCount()}getNodeAt(e){return this.graph.getVertexAt(e)}getNodes(){return this.graph.getVertices()}eachNode(e){let t;for(let n=0,o=this.graph.getVertexCount();n<o;n++)t=this.graph.getVertexAt(n),e(n,t)}eachGroup(e){let t;for(let n=0,o=this.graph.getGroupCount();n<o;n++)t=this.graph.getGroupAt(n),e(n,t)}eachVertex(e){this.eachNode(e),this.eachGroup(e)}eachEdge(e){let t=this.graph.getEdges();for(let n=0,o=t.length;n<o;n++)e(n,t[n])}getEdgeCount(){return this.graph.getEdgeCount()}getGroupCount(){return this.graph.getGroupCount()}getGroupAt(e){return this.graph.getGroupAt(e)}getGroups(){return this.graph.getGroups()}addGroupTemplate(e,t){this.Ri[e]=t}getDescendants(e){return Ps(e)}getAncestors(e){return An(e)}isAncestor(e,t){return ke(e,t)}isDescendantGroup(e,t){return Xx(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=X(e)?this.getVertex(e):e;return this.graph.getCluster(t)}getNodeId(e){return typeof e=="string"?e:this.idFunction(e)}getNodeType(e){return this.typeFunction(e)||"default"}getGroupId(e){return typeof e=="string"?e:this.idFunction(e)}getGroupType(e){return this.typeFunction(e)||"default"}getEdgeType(e){return this.edgeTypeFunction(e)||"default"}getPortId(e){return this.portIdFunction(e)}getPortType(e){return this.portTypeFunction(e)||"default"}getType(e){return(J(e)?this.typeFunction:j(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===ce.objectType?this.typeProperty:e.objectType===de.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t,!1)}$dispatchTypeChange(e,t,n,o){let s,a;J(e)?(s=Qc,a=()=>this.N(l=>l.$nodeTypeChanged(e,t,n))):j(e)?(s=ed,a=()=>this.N(l=>l.$portTypeChanged(e,t,n))):rt(e)?(s=qc,a=()=>this.N(l=>l.$edgeTypeChanged(e,t,n))):Y(e)&&(s=td,a=()=>this.N(l=>l.$groupTypeChanged(e,t,n))),s!=null&&(this.fire(s,{obj:e,previousType:t,newType:n,isPartOfUpdate:o}),a())}resolveFullId(e){if(rt(e))return e.id;if(J(e))return e.id;if(Y(e))return e.id;if(j(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return j(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=G());let s=this.graph.addNode(e,this.idFunction);if(s!=null){if(this.portExtractor!=null){let a=this.portExtractor(s.data,s);if(a!=null)for(let l=0;l<a.length;l++)s.$addPort(a[l],this.portIdFunction)}if(typeof e!="string"&&e[this.groupProperty]!=null)if(o=this.getGroup(e[this.groupProperty]),o!=null)this.graph.$addMemberToGroup(s,o);else throw new Error("parent group ["+e[this.groupProperty]+"] not found");return this.qa(s,o),o!=null&&this.fire(Ni,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}qa(e,t){let n={node:e,parentGroup:t};this.N(o=>o.$nodeAdded(n)),this.fire(Jt,n)}JE(e,t){let n={group:e,parentGroup:t};this.N(o=>o.$groupAdded(n)),this.fire(Wt,n)}addFactoryNode(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t={}),t.type=t.type||e;try{this.nodeFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addNode(a);try{n&&n(l)}catch(h){U("WARN: Factory node callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: Factory node threw an error",a),s!==!1&&this.rollbackTransaction()}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t]);return this}$d(e){return Cs(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.$d(t);o[n.id]=n,n.transientRenderer=t.id}return n}Gd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.N(o=>{o.$renderDummyVertex(n)}),n}is(e){this.graph.deleteNode(e),this.N(t=>{t.$nodeRemoved({vertex:e,node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.Gd({id:`${e.id}_${n===it?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===it?this.setSource(e,o):this.setTarget(e,o)}$cleanupTransientVertex(e,t){let n=e.getAllEdges()||[];this.graph.deleteNode(e);for(let o=0;o<n.length;o++)this.graph.deleteEdge(n[o]),t.$edgeRemoved({edge:n[o],source:t});if(t.$nodeRemoved({vertex:e,node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.$d(t);o&&delete o[e.id]}}$addTransientEdge(e,t,n,o,s,a){let l={source:t,target:n,data:o||{},geometry:s,transient:!0},h=this.graph.addEdge(l);return e.$edgeAdded({edge:h,source:e,geometry:h.geometry,transient:!0,reason:kx},a),h}addFactoryGroup(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t==null&&n==null&&(t={})),t.type=t.type||e;try{this.groupFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addGroup(a);try{n&&n(l)}catch(h){U("WARN: Factory group callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: group factory threw an error",a),s!==!1&&this.rollbackTransaction()}}addFactoryGroupWithTemplate(e,t,n,o,s,a){o==null&&(n!=null?(n=typeof n=="object"?n:{},o=typeof n=="function"?n:null):n==null&&o==null&&(n={})),n.type=n.type||e;try{this.groupFactory(this,e,n,l=>{a!==!1&&this.openTransaction(ut);let h=this.Ri[t]!=null?this.addGroupWithTemplate(l,t):this.addGroup(l);try{o&&o(h)}catch(d){U("WARN: Factory group callback threw an error",d)}a!==!1&&this.commitTransaction()},()=>{s&&s(),a!==!1&&this.rollbackTransaction()})}catch(l){U("WARN: group factory threw an error",l),a!==!1&&this.rollbackTransaction()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=G()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e[this.groupProperty]!=null){if(n=this.getGroup(e[this.groupProperty]),n==null)throw new Error("Cannot find parent group ["+e[this.groupProperty]+"]");this.graph.$addMemberToGroup(o,n)}this.JE(o,n),n!=null&&this.fire(Ni,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}addGroupWithTemplate(e,t){let n;return this.transaction(()=>{let o;if(typeof t=="string"){let l=this.Ri[t];if(l==null)return U("No group template found with name ["+t+"]"),null;try{o=l}catch(h){return U("Error parsing group template ["+t+"]: "+h.message),null}}else o=t;n=this.addGroup(e);let s=new Map,a=(l,h)=>{(l.nodes||[]).forEach(d=>{let u=d.id,p=Object.assign({},d,{id:G(),group:h.id}),g=this.addNode(p);s.set(u,g.id)}),(l.groups||[]).forEach(d=>{let u=d.id,p=d.groupTemplate,g=Object.assign({},d,{id:G(),group:h.id});p&&typeof p!="string"&&delete g.groupTemplate;let m=this.addGroup(g);if(s.set(u,m.id),p)if(typeof p=="string"){let E=this.Ri[p];if(E)try{a(E,m)}catch(y){U("Error parsing nested group template ["+p+"]: "+y.message)}else U("No group template found for nested group with name ["+p+"]")}else a(p,m)}),(l.edges||[]).forEach(d=>{let u=d.source.split(this.portSeparator),p=d.target.split(this.portSeparator),g=s.get(u[0])||u[0],m=s.get(p[0])||p[0],E=u[1]==null?g:[g,u[1]].join(this.portSeparator),y=p[1]==null?m:[m,p[1]].join(this.portSeparator);this.addEdge({source:E,target:y,data:d.data||{}})})};return a(o,n),n},ut),n}$addToGroup(e,t,n,o,s,a){let l=!1,h=this.getObjectInfo(t),d=this.getObjectInfo(e);if(n=n||d.obj.group,d.obj&&h.obj&&(l=h.obj.$addMember(d.obj),l)){n&&n.$removeMember(d.obj),d.obj.data[this.groupProperty]=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.N(p=>{p.$groupMemberAdded(u)}),this.fire(Ni,u)}return l}removeFromGroup(e){return this.$removeFromGroup(e,null,null,null,null)}$removeFromGroup(e,t,n,o,s){let a=this.getObjectInfo(e),l;if(a.obj&&a.obj.group&&(l=a.obj.group,l.$removeMember(a.obj))){let h={vertex:a.obj,group:l,newPosition:o,originalPosition:n,source:s};t&&(h.targetGroup=t),this.N(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data[this.groupProperty],this.fire(Is,h)}return l}Bd(e,t,n,o){e.nestedGroups.forEach(a=>this.Bd(a,t,!0,o)),e.nodes.forEach(a=>this.Fd(a,!0,o));for(let a=0;a<e.edges.length;a++)this.Qa(e.edges[a]);let s={vertex:e.group,edges:e.edges,group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.N(a=>a.$groupRemoved(s)),o||this.fire(Oe,s)}Fd(e,t,n){for(let s=0;s<e.edges.length;s++)this.Qa(e.edges[s]);let o={vertex:e.node,node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.N(s=>s.$nodeRemoved(o)),n||this.fire(Ce,o)}removeGroup(e,t,n){let o=this.graph.getVertex(X(e)?e:e.id);if(o){this.openTransaction(ut);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data[this.groupProperty]),this.Bd(s,t===!0,!1,n)),this.commitTransaction(),!0}return!1}getNode(e){return this.graph.getVertex(e)}getEdge(e){return this.graph.getEdge(e)}getGroup(e){return this.graph.getGroup(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}getPort(e){let t=this.graph.getVertexByPortId(e);if(t)return t.getPort(this.graph.splitPortId(e)[1])}exists(...e){for(let t=0;t<e.length;t++)if(this.graph.getVertex(e[t])==null)return!1;return!0}removeNode(e){if(!X(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(X(e)?e:e.id);if(t!=null){this.openTransaction(ut);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.Fd(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,ul,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.rs(e.source,s,0,n),[h,d]=this.rs(e.target,s,1,n);if(a==null||a.objectType==null)throw new TypeError("Unknown source node ["+e.source+"]");if(h==null||h.objectType==null)throw new TypeError("Unknown target node ["+e.target+"]");if(!l&&a.dummy)return U(`Cannot add edge to dummy vertex ${a.id}`),null;if(!d&&h.dummy)return U(`Cannot add edge to dummy vertex ${h.id}`),null;let u=Object.assign(e,{source:a,target:h});if(this.beforeConnect(a,h,e.data,e.addedByMouse===!0)!==!1){let p=this.graph.addEdge(u,s,this.edgeIdFunction),g={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.N(m=>m.$edgeAdded(g,e.context)),o||this.fire(hr,g,null),p}else return this.debugEnabled&&U("Could not add edge"),null}Qa(e,t){let n={edge:e,source:t};this.N((o,s)=>o.$edgeRemoved(n)),this.fire(bt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&J(n.source)&&this.is(n.source),n.target.dummy&&J(n.target)&&this.is(n.target),this.Qa(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.rs(t,e.id,1);if(n==null||this.beforeConnect(e.source,n,e.data)===!1)return{success:!1};let o=this.graph.setTarget(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.is(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeTargetChanged(l)}),this.fire(nn,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.rs(t,e.id,0);if(n==null||this.beforeConnect(n,e.target,e.data)===!1)return{success:!1};let o=this.graph.setSource(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.is(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeSourceChanged(l)}),this.fire(on,l)}return o}addNewPort(e,t,n){let o=this.graph.getVertex(e);this.portFactory(this,t,n,s=>{let a=this.portIdFunction(s),l=o.$addPort(a);l.data=s,this.os(o,zO);let h={vertex:o,data:s,port:l};this.N(d=>d.$portAdded(h)),this.fire(ei,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.os(n,YO);let s={vertex:n,data:t,port:o};return this.N(a=>a.$portAdded(s)),this.fire(ei,s,null),o}removePort(e,t){let n;if(typeof e=="string"){let o=this.graph.splitPortId(e);o.length===2?(n=this.graph.getVertex(o[0]),t=o[1]):n=this.graph.getVertex(e)}else j(e)?(t=e.id,n=e.getParent()):n=this.graph.getVertex(e);if(n!=null&&t!=null){let o=n.getPort(t);if(o){this.openTransaction(ut);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.os(n,XO);let a={vertex:n,port:o,edges:s};return this.N(l=>l.$portRemoved(a)),this.fire(Mr,a,null),this.commitTransaction(),!0}}return!1}remove(e,t){if(e==null)return;let n=this.getObjectInfo(e);this.setSuspendRendering(!0);try{if(n.obj&&J(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&rt(n.obj))this.removeEdge(n.obj);else if(n.obj&&j(n.obj))this.removePort(n.obj);else{if(e.getNodeCount!=null)for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));if(e.getEdgeCount!=null)for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));if(e.getGroupCount!=null)for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.Xr)this.Xr.get(n).setSuspendRendering(e,t)}batch(e){this.setSuspendRendering(!0);try{e()}catch(t){U("Error in transaction "+t)}finally{this.setSuspendRendering(!1,!0)}}updateGroup(e,t){this.$_updateVertex(e,t,mA,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,gA,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,jm,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(j(a.obj)?a.obj.getParent():a.obj).objectType===ce.objectType?Re:ve;this.Ud(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||jm,source:s}))}}updateVertices(e,t){this.KE(e,jm,!1,t)}KE(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||ut)}updatePort(e,t){this.$_updatePort(e,t,wd,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.Ud(s.obj,t,o,lr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||wd}))}updateEdge(e,t){this.$_updateEdge(e,t,EA,!1)}$_updateEdge(e,t,n,o){let s=typeof e=="string"?this.graph.getEdge(e):e;if(s!=null){let a=Object.assign({},s.data);if(t)if(o)s.data=Object.assign({},t);else for(let u in t)s.data[u]==null?s.data[u]=t[u]:tm(s.data,u,t[u]);let{changed:l,newType:h,previousType:d}=this.zd(a,s,!0);this.fire(xt,{edge:s,updates:t||{},originalData:a,reason:n,typeChanged:l,newType:h,previousType:d},null)}}update(e,t){this.An(e,t,null,!1)}An(e,t,n,o){if(J(e)){let s=n==null?gA:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?mA:n;this.$_updateVertex(e,t,s,o)}else if(rt(e)){let s=n==null?EA:n;this.$_updateEdge(e,t,s,o)}else if(j(e)){let s=n==null?wd:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=lt(n||e.geometry),e.geometry=lt(t),this.fire(ri,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.N(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new gl(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===ce||e.constructor===de||e.constructor===se||e.constructor===Ue?e:X(e)||ar(e)?this.graph.getVertex(e):null}ss(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.N(l=>{l.$select(a)}),this.fire(Kt,a))})}qE(e,t,n){e=e||{};let o=[],s={},a=h=>{s[h.getId()]||(o.push(h),s[h.getId()]=!0)},l=(h,d,u,p)=>{if(h!=null){let g;rt(h)?g=[h]:g=t(h),e.filter&&(g=g.filter(e.filter));for(let m=0;m<g.length;m++){let E=d&&h===this.graph||g[m].source===h||n&&j(g[m].source)&&g[m].source.getParent()===h,y=u&&h===this.graph||g[m].target===h||n&&j(g[m].target)&&g[m].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(g[m])}}};return l(this.findGraphObject(e.source),!0,!1,!1),l(this.findGraphObject(e.target),!1,!0,!1),l(this.findGraphObject(e.element),!1,!1,!0),o}zd(e,t,n){let o=t.objectType===Ue.objectType?this.edgeTypeProperty:t.objectType===de.objectType?this.portTypeProperty:this.typeProperty;if(t.data[o]!=null&&t.data[o]!==e[o]){let s=t.data[o],a=e[o];return t.type=s,this.$dispatchTypeChange(t,a,s,n),{changed:!0,newType:s,previousType:a}}return{changed:!1,newType:null,previousType:null}}Ud(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===de.objectType?e.getFullId():e.id,h=e.objectType===de.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let E in t)tm(e.data,E,t[E]);e.objectType===de.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.os(e.getParent(),wd))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.N(E=>E.$vertexUpdated(u));let{changed:p,newType:g,previousType:m}=this.zd(a,e,!0);p&&(u.typeChanged=!0,u.newType=g,u.previousType=m),this.fire(o,u,null)}}os(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.Ka)){let o=Y(e)?ve:Re,s={vertex:e,updates:{},originalData:e.data,reason:t};this.N(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.qE(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(rt)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.Li(e);this.ss(t,!1,this.Ee,!0)}select(e,t){let n=this.ts(),o=this.Li(e),s=this.ss(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(J(l||Y(l)||j(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Yd(e,t,n,o){let s=e.getAllEdges();for(let a=0,l=s.length;a<l;a++)if(s[a].source===e){let h=s[a].target,d=h.getFullId();o[d]||(t.append(h),n&&t.append(s[a]),o[d]=!0,this.Yd(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.ts();if(o.obj&&o.obj.objectType===ce.objectType){t&&this.ss(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Yd(o.obj,s,n,a)}return s}Li(e){return e instanceof gl||e instanceof cr?e:X(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>X(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.Li(e);if(t){let n=this.ss(t,!0,this.Ee,!1);n[1]!=null&&n[1].length>0&&this.wi(!1,n[1]),n[0]!=null&&n[0].length>0&&this.wi(!0,n[0])}}wi(e,t){let n=e?Kt:qt;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.Ee};this.N(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.Li(e);if(t){let n=[],o=this.Ee.toggle(t,(s,a)=>{a||n.push(s)});this.wi(!1,o[1]),this.wi(!1,n),this.wi(!0,o[0])}}removeFromSelection(e){let t=this.Li(e);t&&this.Ee.remove(t,n=>{let o={obj:n,selection:this.Ee};this.N(s=>{s.$deselect(o)}),this.fire(qt,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.Ee.clear()}getSelection(){return this.Ee}setMaxSelectedNodes(e){this.Ee.setMaxNodes(e)}setMaxSelectedEdges(e){this.Ee.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.Ee.setCapacityPolicy(e)}QE(e){this.fire(e),this.Ka=!1}Xd(e,t,n){e=e||{};let o=e.type||"json",s=e.data,a=e.url,l=e.jsonp,h=e.onload,d=e.parameters||{},u=e.error||function(g){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=g=>{e.incremental===!1&&this.clear(),this.Ka=!0,t===So?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.N(m=>m.$dataLoadStart())):t===Nm&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.N(m=>m.$dataAppendStart())),this.fire(t),Jx(o,g,this,d),this.QE(n),h&&h(this,g),this.fire(bb),n===Ir?(this.N(m=>m.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===Im&&(this.N(m=>m.$dataAppendEnd()),this.undoRedo&&this.undoRedo.dataAppendEnd())};if(s)p(s);else if(a){if(l){let E=a.indexOf("?")===-1?"?":"&";a=a+E+"callback=?"}let g=o===kt||o===cm?kt:e.dataType,m=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:g,error:u,headers:m})}return this}load(e){return this.Xd(e,So,Ir)}append(e){return this.Xd(e,Nm,Im)}save(e){if(e==null){U("VisuallyJs: save method requires at least URL parameter - no params given.");return}if(e.url==null){U("VisuallyJs: save method requires at least URL parameter");return}let t=e.data||this.exportData(e),n={"Content-Type":"application/json"};Object.assign(n,e.headers||{}),this.fetchUrl({url:e.url,type:"POST",data:t,success:e.success||function(o){},error:e.error||function(o){},headers:n})}exportData(e){return e=e||{},dm(e.type||kt,this,e.parameters)}toJSON(){return dm(kt,this,{})}getRenderer(e){return this.Xr.get(e)}N(e,t){this.Xr.forEach((n,o)=>{if(t==null||t!==n)try{e(n,o)}catch(s){U("WARN: could not invoke renderer "+o+" ["+s+"]")}})}$addRenderer(e,t){t=t||G(),this.Xr.set(t,e),e.id=t,e.onDestroy(n=>{this.Xr.delete(n.id)}),this.fire(_b,{renderer:e,id:t})}getObjectInfo(e){let t={obj:null,type:null,id:null};if(e!=null){if(typeof e=="string")e=this.getNode(e)||this.getGroup(e)||this.getPort(e)||this.getEdge(e);else if(typeof e=="object"&&typeof e.objectType=="undefined"){let n=this.idFunction(e),o=this.edgeIdFunction(e);e=this.getNode(n)||this.getGroup(n)||this.getEdge(o)}if(e!=null)t.obj=e;else return t;t.obj!=null&&(t.id=t.obj.id,t.type=t.obj.objectType)}return t}undo(){this.undoRedo&&(this.undoRedo.undo(),this.fire(Ob,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(Rb,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}transaction(e,t){return this.undoRedo?this.undoRedo.transaction(e,t):null}$transaction(e,t,n){return this.undoRedo?this.undoRedo.transaction(e,t,n):null}mergeTransaction(e){return this.undoRedo?this.undoRedo.mergeTransaction(e):null}openTransaction(e){return this.undoRedo?this.undoRedo.openTransaction(e):null}rollbackTransaction(){this.undoRedo&&this.undoRedo.rollbackTransaction()}commitTransaction(e){this.undoRedo&&this.undoRedo.commitTransaction(e)}flushUndoRedo(){this.undoRedo&&this.undoRedo.clear()}get version(){return Xm}$_deriveEdgeId(e){return e==null?G():typeof e=="string"?e:this.edgeIdFunction(e)||G()}};var EI="csv";function jO(i){let r=[],e="",t=!1;for(let n=0;n<i.length;n++){let o=i[n],s=i[n+1];t?o==='"'&&s==='"'?(e+='"',n++):o==='"'?t=!1:e+=o:o==='"'?t=!0:o===","?(r.push(e),e=""):e+=o}return r.push(e),r}var Hm=class{constructor(r,e){c(this,"csv");c(this,"lines");c(this,"startLine");c(this,"headers");this.csv=r,this.lines=r.split(/\r?\n/).map(t=>t.trim()),e=e||{},this.startLine=e.skipLines!=null?e.skipLines:e.readHeaders?1:0,e.readHeaders?this.lines[0]&&this.lines[0].length>0&&(this.headers=jO(this.lines[0])):this.headers=e.headers}jd(r){for(let e=this.startLine;e<this.lines.length;e++){let t=this.lines[e].trim();if(t.length===0)continue;let n=jO(t);r(n)}}readLines(r){this.jd(e=>r(e))}readRecords(r){this.jd(e=>{let t={};for(let n=0;n<e.length;n++){let o=this.headers?this.headers[n]||`Field ${n+1}`:`Field ${n+1}`;t[o]=e[n]}r(t)})}},AA=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new Hm(i,{readHeaders:e.readHeaders!==!1,headers:e.readHeaders===!1?["source","target","value"]:null}).readRecords(l=>{o.has(l.source)||o.set(l.source,t({id:l.source},!0)),o.has(l.target)||o.set(l.target,t({id:l.target},!1)),s.push({source:l.source,target:l.target,data:n({value:parseFloat(l.value)},o.get(l.source),o.get(l.target))})}),s.sort((l,h)=>h.data.value-l.data.value),Array.from(o.values()).forEach(l=>r.addNode(l)),s.forEach(l=>r.addEdge(l))};function SA(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function HO(i,r){return r?i:i.toLowerCase()}function fI(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=vt(r[o].replace(/[^\w]*/,""));s.length>0&&(e.push({token:s,context:""}),t.unshift(s),t.splice(n-1),t.length>1&&(t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse()))}for(t.pop();t.length>1;)t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse(),t.pop();return e}var yI=fI;function xI(i){return i=vt(i),[{token:i.replace(/\s/g,"_"),context:i}]}function kO(i){return[{token:vt(i),context:i}]}function bI(i,r){return i.score>r.score?-1:1}var AI=i=>i.id;function SI(i,r,e){if(i.length===0){i.push(r);return}let t=(n,o)=>{let s=n+Math.floor((o-n)/2),a=i[s],l=e(a,r),h;if(l===0){i.splice(s,0,r);return}else if(l===-1){if(s===i.length-1){i.push(r);return}else if(h=e(i[s+1],r),h!==l){i.splice(s+1,0,r);return}t(s+1,o)}else{if(s===0){i.unshift(r);return}else if(h=e(i[s-1],r),h!==l){i.splice(s,0,r);return}t(n,n+Math.floor((o-n)/2))}};t(0,i.length-1)}var TI=10,Hs=class{constructor(r){c(this,"fields");c(this,"root");c(this,"tokenizer");c(this,"searchTokenizer");c(this,"limit");c(this,"exclusions");c(this,"caseSensitive");c(this,"idFunction");c(this,"sorter");c(this,"kd",0);c(this,"Di",new Map);c(this,"jr",[]);c(this,"as",0);c(this,"we",{});r=r||{},this.fields=r.fields,this.root=this.nl(),this.tokenizer=r.tokenizer||yI,this.searchTokenizer=r.searchTokenizer||kO,this.limit=r.limit||TI,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||AI,this.sorter=r.sorter||bI}nl(r){return{index:this.kd++,children:{},documentIds:{},key:r}}ef(r,e,t){let n=this.we[r];n||(n={},this.we[r]=n),n[e.index]=e}tf(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.nl(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.ef(l,d,t),n(d,s+1,a,l)}};n(this.root,0,r,e)}removeExclusions(r){let e={};for(let t in r)this.exclusions.indexOf(t)===-1&&(e[t]=r[t]);return e}add(r){let e=t=>{let n=this.removeExclusions(t);SI(this.jr,{document:n,score:1},this.sorter);var o=this.idFunction(t),s={fields:a=>{for(let l=0;l<this.fields.length;l++){let h=t[this.fields[l]];typeof h=="string"&&a(h)}},document:a=>{for(let l in t)if(l!=="id"){let h=t[l];typeof h=="string"&&a(h)}}};this.Di.set(o,n),s[this.fields?"fields":"document"](a=>{if(a){let l=this.tokenizer(a);for(let h=0;h<l.length;h++)this.tf(HO(l[h].token,this.caseSensitive),o,l[h].context)}}),this.as++};if(r.constructor===Array)for(let t=0;t<r.length;t++)e(r[t]);else e(r)}addAll(...r){for(let e=0;e<r.length;e++)this.add(r[e])}reindex(r){this.remove(r),this.add(r)}remove(r){let e=this.idFunction(r),t=this.we[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.jr.length;n++)if(this.idFunction(this.jr[n].document)===e){o=n;break}o!==-1&&(this.jr.splice(o,1),this.as=this.jr.length),this.Di.delete(e)}clear(){this.Di.clear(),this.we={},this.kd=0,this.jr.length=0,this.as=0,this.root=this.nl()}getDocumentCount(){return this.as}getDocumentList(){return this.jr}getDocument(r){return this.Di.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let g=n[d];g||(g={},n[d]=g,s[d]=0,a[d]=[]),a[d].push(p),g[u]||(g[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let m in d.documentIds)if(d.documentIds.hasOwnProperty(m)){let E=d.documentIds[m];for(let y=0;y<E.length;y++)l(m,p,E[y])}return}let g=p[u];d.children[g]&&h(d.children[g],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,HO(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.Di.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},TA=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new Hs(e),this.groupIndex=new Hs(e),this.edgeIndex=new Hs(e),this.portIndex=new Hs(e),r.bind(Jt,t=>{this.Hd(t.node)}),r.bind(Ce,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Re,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(Wt,t=>{this.Wd(t.group)}),r.bind(Oe,t=>{this.groupIndex.remove(t.group.data)}),r.bind(ve,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(hr,t=>{this.Zd(t.edge)}),r.bind(bt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(xt,t=>{let n=Object.assign(t.originalData||{},{id:t.edge.getId()});this.edgeIndex.remove(n);let o=Object.assign(t.edge.data||{},{id:t.edge.getId()});this.edgeIndex.add(o)}),r.bind(ei,t=>{this.portIndex.add(t.port.data)}),r.bind(Mr,t=>{this.portIndex.remove(t.port.data)}),r.bind(lr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(Zt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.Hd(n)}),this.instance.eachGroup((t,n)=>{this.Wd(n)}),this.instance.eachEdge((t,n)=>{this.Zd(n)})}Hd(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}Wd(r){this.groupIndex.add(r.data)}Zd(r){let e=Object.assign(r.data||{},{id:r.getId()});this.edgeIndex.add(e)}search(r){let e=this.nodeIndex.search(r).map(s=>this.instance.getNode(s.document.id)),t=this.portIndex.search(r).map(s=>this.instance.getPort(s.document.id)),n=this.groupIndex.search(r).map(s=>this.instance.getGroup(s.document.id)),o=this.edgeIndex.search(r).map(s=>this.instance.getEdge(s.document.id));return{nodes:e,groups:n,edges:o,ports:t}}};var vA="context",km="lookup",CA="default",ni="element",$i="text",Po="tmpl",ii="each",Ol="if",PA="root",_A="class",OA="style",_o="$value",Rl="$key",RA="attribute";function Wm(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return Vx(e)}}function wA(i){return i.length>0?i[i.length-1]:null}function DA(i){if(i==null||i.length===0)return!1;for(let r=i.length-1;r>-1;r--)if(i[r].type==="each")return!0;return!1}function Zm(i,r,e,t,n){let o=G(),s={w:r,expressions:[],id:o};return e.bindings[i]=s,r.replace(/\{\{([^\}]*)\}\}/g,(a,l,h,d)=>{let u=!1;return l.startsWith(":")&&(u=!0,l=l.substring(1)),s.expressions.push([a,l,u]),""}),o}function LA(i,r,e,t,n){e.atts[i]=r,Zm(i,r,e,t,n)}function NA(i,r){let e=Wm(i,r.attributesRe),t={el:vt(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?LA(o,"",t,s,r):LA(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=vt(e[o]);s!=null&&s.length>0&&n(s)}return t}var vI=["*","-","+","/","%"],WO=["==",">","<",">=","<=","===","!=","!==","||"],CI=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Id="bool",ZO="num",JO="group",KO="var",PI="op",IA="comp",qO="exp",QO="string",eR="array",tR="key",rR="value";function _I(i){return i[i.length-1]}function nR(i){return i.t===JO}function OI(i){return i.t===KO}function RI(i){return i.t===qO}function LI(i){return i.t===ZO}function wI(i){return i.t===Id}function DI(i){return i.t===QO}function NI(i){return i.t===eR}function II(i){return i.t===tR}function MI(i){return i.t===rR}function iR(i){let r=i.match(CI),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=_I(t);if(e==="("){let s={t:JO,c:[],v:null};o.c.push(s),t.push(s)}else if(e===")")t.pop();else if(e.match(/\$value\[[0-9]+\]/)){let s=parseInt(e.substring(7,e.length-1),10);o.c.push({t:eR,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:tR,v:null});else if(e.match(/\$value/))o.c.push({t:rR,v:null});else if(e.match(/^#/))o.c.push({t:qO,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:QO,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Id,v:!0});else if(e.match(/false/))o.c.push({t:Id,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:ZO,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:KO,v:e}):vI.indexOf(e)!==-1?o.c.push({t:PI,v:e}):WO.indexOf(e)!==-1?o.c.push({t:IA,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Id,v:!1}),o.c.push({t:IA,v:"=="})):(o.c.push({t:Id,v:!1}),o.c.push({t:IA,v:"!=="})))}return t[0]}function VI(i){let r=null,e={t:"root",c:[],v:""},t={t:"root",c:[],v:""},n=e.c;for(let a=0;a<i.c.length;a++)if(WO.indexOf(i.c[a].v)!==-1){if(r!=null)throw new Error("Cannot parse expression; more than one comparator.");r=i.c[a].v,n=t.c}else n.push(i.c[a]);let o=a=>(nR(a)&&(a.c=s(a)),a),s=a=>{let l=a.c;if(l.length===0)return[];let h=[],d=o(l[0]);if(l.length===1)return[d];if(l.length===3)return[d,l[1],o(l[2])];{let u=d,p=null,g;for(let m=1;m<l.length;m+=2)g=l[m],(g.v==="+"||g.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,g],v:null},h.push(p)):p.c.push(u,g):(p!=null?p.c.push(u):h.push(u),p=null,h.push(g)),u=o(l[m+1]);return p!=null?p.c.push(u):h.push(u),h}};return e.c=s(e),t.c=s(t),{left:e,right:t,comparator:r}}function Ll(i){let r=iR(i);return VI(r)}function Bi(i,r,e,t,n){let o=Jm(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=Jm(i.right.c,r,e,t,n);if(i.comparator==="==")return o==s;if(i.comparator==="===")return o===s;if(i.comparator===">")return o>s;if(i.comparator===">=")return o>=s;if(i.comparator==="<")return o<s;if(i.comparator==="<=")return o<=s;if(i.comparator==="!=")return o!=s;if(i.comparator==="!==")return o!==s;if(i.comparator==="||")return o||s}}function Jm(i,r,e,t,n){let o=i.map(l=>nR(l)?Jm(l.c,r,e,t,n):OI(l)?r(l.v):RI(l)?e(l.v):NI(l)?r(_o)[l.index]:II(l)?r(Rl):MI(l)?r(_o):LI(l)||DI(l)||wI(l)?l.v:l),s=o[0],a;for(let l=1;l<o.length;l+=2){a=o[l].v;let h=o[l+1];a==="+"?s+=h:a==="-"?s-=h:a==="*"?s*=h:a==="/"&&(s/=h)}return typeof s=="undefined"?"":n!=null?n(s,t):s}var Fi=class{constructor(r){this.instance=r;c(this,"tag");c(this,"remove");c(this,"uuid");c(this,"children",[]);c(this,"elements",[]);c(this,"bindings");c(this,"context");c(this,"compiledBindings");this.uuid=G(),r.entries[this.uuid]=this,this.compiledBindings={}}Jd(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:G(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Ll(a),once:s,format:l}})})}}};var Km=class Km extends Fi{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:G(),w:e.value,expressions:[]};e.value.replace(/\{\{([^\}]*)\}\}/g,function(o,s,a,l){let h=!1;return s.startsWith(":")&&(h=!0,s=s.substring(1)),n.expressions.push([o,s,h]),""}),this.Jd({[Km.TEXT_BINDING_NAME]:n})}};c(Km,"TEXT_BINDING_NAME","__element");var Ui=Km;var qm=class qm extends Fi{constructor(e,t){super(t);c(this,"type",qm.type);c(this,"comment");this.comment=e}};c(qm,"type","comment");var ks=qm;var Qm=class Qm extends Fi{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",Qm.type);c(this,"namespace");c(this,"atts");c(this,"custom");let a=e.el.split(":");this.tag=e.el,a.length===2&&(this.namespace=a[0]),this.atts=e.atts,this.Jd(e.bindings),this.remove=!1}};c(Qm,"type",ni);var Yr=Qm;var MA={},oi={construct:(i,r,e,t,n,o)=>{let s=MA[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{MA[i]=r},exists:i=>MA[i]!=null};var eE=class eE extends Yr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",ii);this.context=e.atts.in,this.key=e.atts.key,this.tag=eE.tag}};c(eE,"tag","r-each");var Md=eE;oi.register(Md.tag,Md);function tE(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function VA(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];tE(i,e,o)}Array.from(r.fragment.childNodes).forEach(n=>t.added.push({el:n})),i.placeholder.before(r.fragment)}var Vd=class{constructor(r,e,t){this.instance=r;this.tagName=e;this.options=t;c(this,"id");c(this,"template");c(this,"rendered");c(this,"updated");c(this,"fragments",{});c(this,"mounted");c(this,"defaultableFragmentKeys");c(this,"fragmentKeys");c(this,"parsedTemplates",{});c(this,"defaultNamespace");c(this,"decorator");this.id=`custom-${e}`;let n=t.fragments||{};this.defaultableFragmentKeys=t.defaultableFragmentKeys||[],this.template=t.template,this.defaultNamespace=t.defaultNamespace,this.decorator=t.decorator||((s,a)=>null);let o=new Set;for(let s in n){this.fragments[s]=this.fragments[s]||{},o.add(s);for(let a in n[s]){let l=`custom-${e}-${s}-${a}`,h=n[s][a];r.addTemplate(l,h),this.fragments[s][a]=r.parseAndCache(l,d=>{if(d===l)return h})}}this.fragmentKeys=Array.from(o),this.fragmentKeys.sort(),this.parsedTemplates[be]=this.Kd(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}Kd(r){return this.instance.parseAndCache(r,e=>{if(e===r)return this.template})}extractTemplateData(r,e){let t=r.split(":"),n=[];for(let o=0;o<t.length;o++){let s=e[t[o]];if(s==null)if(this.defaultableFragmentKeys.indexOf(t[o])!==-1)n.push(be);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[be];{let e=[],t={};if(this.fragmentKeys.forEach(n=>{let o=this.extractTemplateData(n,r);o!=null&&(t[n]=this.fragments[n][o]||[],e.push(`${n}:${o}`))}),e.length>0){let n=e.join(" ");if(this.parsedTemplates[n]!=null)return this.parsedTemplates[n];{let o=this.Kd(n);return this.qd(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[be]}}qd(r,e){let t=[];for(let n=0;n<r.children.length;n++)if(r.children[n].tag==="r-fragment"){let o=e[r.children[n].atts.key]||[];t.push(...o)}else t.push(r.children[n]),this.qd(r.children[n],e);r.children=t}};function oR(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function GI(i,r){i.el.nodeValue=r}function $I(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...Gd(i,r.children[t]));return e}function Gd(i,r){let e=$I(i,r);return r.type===ni?(i.removeElement(r.el),e.unshift(r.el)):r.type===$i?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===ii&&(r.entryMap={}),e}function sR(i,r,e,t){for(let n in i.bindings)if(n!==_A){let o=i.bindings[n],s=o.binding,a=o.originalValue,l=!1;for(let h=0;h<s.expressions.length;h++)if(!s.expressions[h].once){let d=Bi(s.expressions[h].expression,r,u=>e(u),s.expressions[h].format,t);a=a.replace(s.expressions[h].source,d),d!==o.results[h].result&&(l=!0,o.results[h].result=d)}l&&(i.type===ni?n!==OA?oR(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);oR(i,u,h.substring(d+1),!0)}):i.type===$i&&GI(i,a))}}function aR(){return{added:[],removed:[],elements:[]}}var rE=class rE extends Yr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",rE.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Ll(this.test)}};c(rE,"tag","r-if");var $d=rE;oi.register($d.tag,$d);function nE(i,r,e,t,n){return i.resolution=Bi(i.entry.expression,o=>De(r,o),o=>e(o),t,n),i.resolution}var Oo=class extends Yr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"templateId");c(this,"lookup");c(this,"default");if(this.context=e.atts[vA],this.type=Po,this.remove=!0,e.atts[km])this.lookup=e.atts[km],this.default=e.atts[CA]||"";else{this.templateId=e.atts.id;let a=DA(o);if(s.indexOf(this.templateId)!==-1){if(!a)throw new TypeError("recursive template call ["+this.templateId+"]")}else{let l=n(this.templateId);s.push(this.templateId);let h=this.instance.parse(l,n,null,s);for(let d=0;d<h.length;d++)h[d].context=this.context;this.children=h,s.pop()}}}};c(Oo,"tag","r-tmpl"),oi.register(Oo.tag,Oo);function lR(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(ar(i)){let e=i;for(let t in e)r(e[t],t)}}var Ro=class{constructor(r){c(this,"templateResolver");c(this,"defaultTemplate");c(this,"defaultNamespace");c(this,"macros");c(this,"entries");c(this,"customTags",{});c(this,"formatter");c(this,"Lt",new Map);c(this,"ls",new Map);c(this,"openRe",new RegExp("<([^/>]*?)>$|<([^/].*[^/])>$"));c(this,"closeRe",new RegExp("^</([^>]+)>"));c(this,"openCloseRe",new RegExp("<(.*)(/>$)"));c(this,"tokenizerRe",/(<[^\^>]+\/>)|(<!--[\s\S]*?-->)|(<[\/a-zA-Z0-9\-:]+(?:\s*[\(a-zA-Z\-\):]+=\"[^\"]*\"|\s*[a-zA-Z\-:]+='[^']+'|\s*[\(a-zA-Z\-\):]|\s*\{\{.*\}\}|\s*\{#.*\})*>)/);c(this,"commentRe",/<!--[\s\S]*?-->/);c(this,"attributesRe",/([\(a-zA-Z0-9\-_:\)]+="[^"]*")|\s+([\(a-zA-Z0-9\-_:\)]+(?=\s.|$))/);c(this,"hs");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.hs=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.Qd(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.hs[r]!=null?this.hs[r]:this.templateResolver(r)}setAttribute(r,e,t){let n=e.split(":");n.length===1?r.setAttribute(n[0],t):this.namespaces[n[0]]==null?r.setAttribute(e,t):r.setAttributeNS(this.namespaces[n[0]],n[1],t)}clearCache(){this.Lt.clear(),this.ls.clear()}parseAttributes(r){return Wm(r,this.attributesRe)}eu(r,e){return t=>{let n=e?null:this.Lt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.Lt.set(t,n),n}}addTemplate(r,e){this.hs[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.ls.get(r);if(s!=null)return this.render(s,e,t,o).fragment;{let a=this.parseAndCache(r,t,n);return a!=null?this.render(a,e,t,o).fragment:this.cf()}}mounted(r){r.$recado.mountings.forEach(e=>{e.mount(e.el,e.data,this,e.parent,e.context)})}parseAndCache(r,e,t){let n=this.ls.get(r);if(n==null||t===!0){e=this.eu(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=hR(this,o,e,null,[r]);return this.ls.set(r,s),s}}else return n}data(r,e,t){return De(r,e,t)}each(r,e,t,n,o){let s;if(Array.isArray(r))for(s=0;s<r.length;s++)e(r[s],t,s,n,o);else for(s in r)r.hasOwnProperty(s)&&e({$key:s,$value:r[s]},t,s,n,o)}lookupValueInDataOrContext(r,e,t){return t.indexOf("$context.")===0?De(e,t.substring(9)):De(r,t)}update(r,e,t){let n=r.$recado,o=aR();return t=t||{},n!=null&&this.Ln(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}Ln(r,e,t,n,o){if(r.type===PA)for(let s=0;s<r.children.length;s++)this.Ln(r.children[s],e,t,n,o);else if(r.type===ni||r.type===$i){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),sR(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Ni(l,s,n),this.formatter),a!=null&&a.updated&&a.updated(r.el,s,this);for(let l=0;l<r.children.length;l++)this.Ln(r.children[l],s,t,n,o)}else if(r.type===Ol){let s=r,a=s.resolution,l=nE(s,e,h=>this.Ni(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)Gd(this,r.children[h]).map(d=>t.removed.push({el:d}));r.children.length=0}if(l)if(a)for(let h=0;h<r.children.length;h++)this.Ln(r.children[h],e,t,n,s.defaultNamespace||o);else{let h=this.render(r.entry.children,e,this.templateResolver,n,s.defaultNamespace||o);r.children=h.children;for(let d=0;d<r.children.length;d++){let u=r.children[d];s.placeholder.before(u.el),t.added.push({el:u.el})}}}else if(r.type===Po){let s=r.entry.context==null||r.entry.context.length===0?e:this.lookupValueInDataOrContext(e,n,r.entry.context);for(let a=0;a<r.children.length;a++)this.Ln(r.children[a],s,t,n)}else if(r.type===ii){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)Gd(this,r).map(l=>t.removed.push({el:l}));else if(s.entry.key==null||s.entry.key.length===0)U("WARN: Cannot update r-each entry when no `key` parameter was set.");else{let l={},h=[],d=[];lR(a,(u,p)=>{let g=De(u,s.entry.key);if(l[g]=u,s.entryMap[g]!=null){let m=s.entryMap[g];for(let E=0;E<m.length;E++)h.push({data:u,key:g,execution:m[E]})}else h.push({data:u,key:g})});for(let u in s.entryMap)if(l[u]==null)for(let p=0;p<s.entryMap[u].length;p++)d.push({e:s.entryMap[u][p],key:u});for(let u=0;u<d.length;u++)delete s.entryMap[d[u].key],Gd(this,d[u].e).map(p=>t.removed.push({el:p}));for(let u=0;u<h.length;u++){let p=h[u];if(p.execution)this.Ln(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(g=>{g.el!=null&&s.placeholder.before(g.el)});else{let g=this.render(r.entry.children,p.data,null,n);VA(s,g,p.key,t)}}}}if(r.updaters)for(let s=0;s<r.updaters.length;s++)r.updaters[s](r.el);return t}remove(r,e){e&&r.parentNode&&r.parentNode.removeChild(r)}registerTag(r,e){this.customTags[r]=new Vd(this,r,e)}parse(r,e,t,n){return hR(this,r,e,t,n)}Ni(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:G(),fragment:this.cf(),children:[],type:"root",bindings:{},entry:null,mountings:[]},a=s.fragment,l=null,h=s;a.$recado=s,n=n||{};let d=(f,b,A)=>{let T={id:b,entry:f,placeholder:this.cc(`${ii}:${b}`),entryMap:{},type:ii,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${Po}:${b}`),entry:f,id:b,children:[],type:Po};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:G(),entry:b,bindings:A,children:[],el:f,type:ni};return h.children.push(S),f.$recado=S,S},g=(f,b,A,T)=>{y(f,T);let S={id:G(),el:f,entry:b,bindings:A,children:[],type:$i};return h.children.push(S),f.$recado=S,S},m=(f,b,A)=>{let T=G(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${Ol}:${T}`),type:Ol,children:[],defaultNamespace:A};return E(S.placeholder,b),h.children.push(S),S},E=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},y=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},x=(f,b,A,T)=>{b=b||{};let S=!1,O=null;if(f.type===Ol){let v=h,_=m(f,A,o);if(h=_,S=nE(_,b,P=>this.Ni(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,_.placeholder,T);h=v,O=_}else if(f.type===ii){let v=f,_=l,P=f.context===_o?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=G(),R=d(v,C,A);h=R,P!=null&&lR(P,(w,B)=>{let N=v.key&&ar(w)?De(w,v.key):B||null;for(let V=0;V<f.children.length;V++){let D=x(f.children[V],w,R.placeholder,B);N!=null&&tE(R,N,D)}}),l=_,h=I,O=R}else if(f.type===Po){let v=f,_=l,P=h,I=G(),C=u(v,I,A);h=C;let R=f.context==null||f.context.length===0?b:De(b,f.context),w=v.lookup!=null?De(b,v.lookup.replace(/[\{\{\}\}]/g,"")):v.templateId,B=this.parseAndCache(w,t);B==null&&v.default!=null&&(B=this.parseAndCache(v.default,t));for(let N=0;N<B.length;N++)x(B[N],R,C.placeholder,T);l=_,h=P,O=C}else if(f.type===ni){let v,_=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let N=Object.assign({},b);Object.assign(N,P.decorator(b,n)||{});let V=this.render(P.getAST(N),N,t,n,P.defaultNamespace);v=V.fragment.childNodes[0];let D=V.children[0].bindings;for(let $ in D)I[$]=D[$];C.push(...V.children[0].children)}else if(_.namespace!=null&&this.namespaceHandlers[_.namespace])v=this.namespaceHandlers[_.namespace](f.tag);else{let N=o||this.defaultNamespace;N!=null&&this.namespaceHandlers[N]?v=this.namespaceHandlers[N](`${N}:${f.tag}`):v=this.ce(f.tag)}for(let N in _.atts)if(_.atts.hasOwnProperty(N)){let V=_.atts[N];if(f.compiledBindings[N]!=null){let D=f.compiledBindings[N];I[N]={id:D.id,binding:D,results:[],originalValue:V,type:RA};for(let $=0;$<D.expressions.length;$++){let K=D.expressions[$],xe=Bi(K.expression,H=>H===Rl?T:H===_o?b:this.lookupValueInDataOrContext(b,n,H),H=>this.Ni(H,b,n),K.format,this.formatter);V=V.replace(K.source,xe),I[N].results.push({source:K.source,result:xe})}}this.setAttribute(v,N,V)}P&&(P.rendered&&P.rendered(v,b,this,l,n),P.mounted&&s.mountings.push({mount:P.mounted,el:v,data:b,parent:l,context:n}));let R=l,w=h,B=p(v,_,I,A);B.children.push(...C),h=B,l=v;for(let N=0;N<f.children.length;N++)x(f.children[N],b,null,T);h=w,l=R,O=B}else if(f.type===$i){let v=f.value||"",_={},P=f.compiledBindings[Ui.TEXT_BINDING_NAME];if(P!=null){_[Ui.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:$i};for(let R=0;R<P.expressions.length;R++){let w=P.expressions[R],B=Bi(w.expression,N=>N===Rl?T:N===_o?b:this.lookupValueInDataOrContext(b,n,N),N=>this.Ni(N,b,n),w.format,this.formatter);v=v.replace(w.source,B),_[Ui.TEXT_BINDING_NAME].results.push({source:w.source,result:B})}}let I=this.ctn(v);O=g(I,f,_,A)}return O};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function BI(i){return oi.exists(i)}function FI(i,r,e,t,n,o){return oi.construct(r,e,i,t,n,o)}function hR(i,r,e,t,n){n=n||[],e=i.eu(e||(E=>i.resolveTemplate(E)),null);let o=[],s=[],a=(E,y)=>{let x=E.match(y);return x==null?null:x},l=()=>o.length>0?o[o.length-1]:null,h=E=>{let y=l();return y!=null&&y.tag===E},d=(E,y)=>{o.length>0&&l().children.push(E),y?o.length===0&&s.push(E):o.push(E)},u=E=>{d(E,!0)},p=()=>{let E=o.pop();if(o.length===0&&!E.remove)s.push(E);else if(E.remove){let y=l();y&&y.children.pop()}return E},g=(E,y,x,f)=>{let b=NA(E,i);return BI(b.el)?FI(i,b.el,b,x,o,n):new Yr(b,i,x,o,n)},m=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new ks(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==Oo.tag)if(h(y[1]))p();else throw new TypeError("Unbalanced closing tag '"+y[1]+"'; opening tag was '"+p().tag+"'")}},{re:i.openCloseRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Ui({value:E},f);u(A),E.match(/^[\s]*$/)!=null||Zm(Ui.TEXT_BINDING_NAME,E,A,null,f)}}];if(Gx(vt(r).split(i.tokenizerRe),(E,y)=>{let x=vt(y);for(let f=0;f<m.length;f++){let b=a(x,m[f].re);if(b){m[f].handler(y,b,e,i,n);break}}}),s.length>0&&t)for(let E in t)s[0][E]=t[E];return s}function GA(i,r){let e=typeof i=="string"?parseFloat(i):i;if(isNaN(e))return i;let t=/^(['|,])?(\.(\d+))?([df])$/,n=r.match(t);if(!n)return e.toString();let o=n[1],s=n[3]?parseInt(n[3],10):null,a=n[4],l;a==="d"?l=Math.floor(e).toString():l=s!==null?e.toFixed(s):e.toString();let h=l.split("."),d="";return o===","?d=",":o==="'"?d=" ":d=1e3.toLocaleString().substring(1,2),h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),h.join(".")}var Bd=class{constructor(){c(this,"childNodes");this.childNodes=[]}removeChild(r){this.childNodes=this.childNodes.filter(e=>e!==r)}appendChild(r){this.childNodes.push(r)}insertAfter(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t,0,e)}insertBefore(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t-1,0,e)}toString(){let r="";for(let e=0;e<this.childNodes.length;e++)r+=this.childNodes[e].toString();return r}},iE=class extends Bd{constructor(e){super();c(this,"nodeType",1);c(this,"parentElement");c(this,"tag");c(this,"atts");c(this,"style",{});this.tag=e,this.atts={}}getAttribute(e){return this.atts[e]}setAttributeNS(e,t,n){this.atts[e+":"+t]=n}setAttribute(e,t){this.atts[e]=t}toString(){let e="<"+this.tag,t="";for(let n in this.atts)t+=" "+n+'="'+this.atts[n]+'"';e=e+t+">";for(let n=0;n<this.childNodes.length;n++)e+=this.childNodes[n].toString();return e+"</"+this.tag+">"}after(e){this.parentElement.insertAfter(this,e)}before(e){this.parentElement.insertBefore(this,e)}},oE=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},sE=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var aE=class extends Ro{Qd(){return null}ce(r){return new iE(r)}cf(){return new Bd}ctn(r){return new oE(r)}cc(r){return new sE(r)}removeElement(r){}removeTextNode(r){}};function Fd(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function lE(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function $A(i,r,e){let t=e===0?"x":"y";return i.source[t]>r.source[t]&&i.source[t]<r.target[t]||r.source[t]>i.source[t]&&r.source[t]<i.target[t]||i.target[t]>r.target[t]&&i.target[t]<r.source[t]||r.target[t]>i.target[t]&&r.target[t]<i.source[t]}function Ud(i,r,e,t,n){let o=i,s=r;for(let a=0;a<o.length;a++){let l=o[a];l.sourcePosition=t(l.sourceId),l.sourceSize=n(l.sourceId),l.targetPosition=t(l.targetId),l.targetSize=n(l.targetId),l.sourceCenter={x:l.sourcePosition.x+l.sourceSize.width/2,y:l.sourcePosition.y+l.sourceSize.height/2},l.targetCenter={x:l.targetPosition.x+l.targetSize.width/2,y:l.targetPosition.y+l.targetSize.height/2};for(let h=0;h<l.path.length;h++){let d=e[l.path[h]],u=h<l.path.length-1?e[l.path[h+1]]:null;d.edges=d.edges||[],d.edges.push({edge:l,next:u})}}for(let a=0;a<s.length;a++)if(s[a].edges){let l=s[a];l.edges.sort((u,p)=>{let g=u.edge.pathDirection,m=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=g===1?E+1:E-1,f=m===1?y+1:y-1,b=x>=0&&x<u.edge.path.length?e[u.edge.path[x]]:null,A=f>=0&&f<p.edge.path.length?e[p.edge.path[f]]:null,T=g===1?E-1:E+1,S=m===1?y-1:y+1,O=T>=0&&T<u.edge.path.length?e[u.edge.path[T]]:null,v=S>=0&&S<p.edge.path.length?e[p.edge.path[S]]:null,_=l.axis===0?ee:fe,P=b?b.midpoint[_]:O?O.midpoint[_]:p.edge.sourceCenter[_]!==u.edge.sourceCenter[_]?u.edge.sourceCenter[_]:u.edge.targetCenter[_],I=b?A.midpoint[_]:v?v.midpoint[_]:u.edge.sourceCenter[_]!==p.edge.sourceCenter[_]?p.edge.sourceCenter[_]:p.edge.targetCenter[_];return P-I});let h=s[a].length/(s[a].edges.length+1),d=h;for(let u=0;u<s[a].edges.length;u++)s[a].edges[u].location=d,d+=h}}function Yd(i,r,e){for(let t=0;t<i.length;t++){let n=i[t];n.regionPath=n.regionPath||[];for(let o=0;o<n.path.length;o++){let s=e[n.path[o]],a=s.edges.find(d=>d.edge.id===n.id),l=a.edge.pathDirection;if(!(a.edge.pathDirection===1&&s.b.type==="vertex"||a.edge.pathDirection===-1&&s.a.type==="vertex")){let d=a.next.edges.find(A=>A.edge.id===n.id),u=r.find(A=>A.id===(l===1?s.b.id:s.a.id)),p=s.axis===0?l===1?0:u.height:l===1?0:u.width,g=s.axis===0?l===1?u.height:0:l===1?u.width:0,m=s.segment.point1-(s.axis===0?u.left:u.top),E=a.next.segment.point1-(s.axis===0?u.left:u.top),y=s.axis===0?"x":"y",x=s.axis===0?"y":"x",f={[y]:a.location+m,[x]:p},b={[y]:d.location+E,[x]:g};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var zd="separate",UI="bus";function BA(i){let r=i.axis,e=i.gates,t=i.gateMap||Fd(e),n=i.mode||zd,o=i.regions,s=i.edges,a=i.pad||10,l={};Ud(s,e,t,i.getVertexPosition,i.getVertexSize),Yd(s,o,t);for(let h=0;h<o.length;h++){o[h].edgeMap={};let d=[],u=o[h].lines;for(let x=0;x<u.length;x++){let f=[];for(let b=0;b<d.length;b++)e:for(let A=0;A<d[b].length;A++)if($A(u[x],d[b][A],r)){f.push(b);break e}if(f.length===0)d.push([u[x]]);else{let b=[u[x]],A=[];for(let T=0;T<d.length;T++)f.indexOf(T)!==-1?b=b.concat(d[T]):A.push(d[T]);A.push(b),d=A}}for(let x=0;x<d.length;x++)d[x].sort((f,b)=>{let A=lE(f,r),T=lE(b,r),S=r==0?"x":"y";return A===T?A<0?f.source[S]-b.source[S]:b.source[S]-f.source[S]:f.source[S]-b.source[S]});o[h].lineSets=d;let p=r===0?o[h].height:o[h].width,g=r===0?o[h].left:o[h].top,m=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===zd)for(let x=0;x<d.length;x++){let f=(p-a)/(d[x].length+1),b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];l[T.id]=l[T.id]||[],o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}],b+=f}}else for(let x=0;x<d.length;x++){let f=(p-a)/2,b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let g=p.edgeMap[d.id];l[d.id].push(...g)})}return l}function FA(i){let r=i.gates,e=Fd(r),t=i.regions,n=i.edges,o={};Ud(n,r,e,i.getVertexPosition,i.getVertexSize),Yd(n,t,e);for(let s=0;s<t.length;s++){t[s].edgeMap={};let a=t[s].lines;for(let l=0;l<a.length;l++){let h=a[l];t[s].edgeMap[h.id]=[{x:h.source.x+t[s].left,y:h.source.y+t[s].top},{x:h.target.x+t[s].left,y:h.target.y+t[s].top}]}}for(let s=0;s<n.length;s++){let a=n[s];o[a.id]=[],a.regionPath.forEach(h=>{let d=h.edgeMap[a.id];o[a.id].push(...d)})}return o}var UA=4;function cR(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var Ws={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=cR(s),t=Math.max(t,r.x,r.y),e=Math.min(e,r.x,r.y)});let n=t-e;return i.sort(s=>(r=cR(s),Ws.toHilbertCoordinates(n,r.x-e,r.y-e)))},toHilbertCoordinates:(i,r,e)=>{let t=i,n=(1<<t)-1,o=0,s=r^e,a=~r&n,l=~e&n,h=a^e,d=0,u=0;for(let p=1;p<t;p++)u=(u&s|(d^l)&h)>>1,d=(d&(u^a)|~d&(u^l))>>1;return o=~d&(u^r)|d&(u^l),Ws.hilbertInterleaveBits(o,s)},hilbertInterleaveBits:(i,r)=>{let e=0,t=Math.max(i,r),n=0;for(;t>0;)n++,t>>=1;for(let o=0;o<n;o++){let s=1<<o,a=(r&s)>0?1<<2*o:0,l=(i&s)>0?1<<2*o+1:0;e+=a+l}return e}};function dR(i){return i.height*i.width}function hE(i,r){i.x===1/0?(i.height=r.height,i.width=r.width,i.x=r.x,i.y=r.y):(i.height=Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y),i.width=Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x),i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y))}function cE(i){i.x=Math.min(...i.children.map(r=>r.x)),i.y=Math.min(...i.children.map(r=>r.y)),i.width=Math.max(...i.children.map(r=>r.x+r.width))-i.x,i.height=Math.max(...i.children.map(r=>r.y+r.height))-i.y,i.parent!=null&&cE(i.parent)}function YA(i,r){return i.x===1/0?dR(r):(Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y))*(Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x))-dR(i)}function dE(i){let r=Math.floor(i.children.length/2),e=Lo(),t=Lo();return Ws.sortRect(i.children).forEach((n,o)=>{o<=r?wo(e,n):wo(t,n)}),i.children.length=0,[e,t]}function Lo(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function Xd(i){return i.children==null||i.children.length===0}function zA(i){return Xd(i)||Xd(i.children[0])}function wo(i,r){r.parent=i,i.children.push(r),hE(i,r)}function uE(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function uR(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(uR(e)):r.concat(e)},[])}function XA(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function pR(i){i.parent&&(uE(i.parent,i),cE(i.parent))}var Do=class{constructor(r){c(this,"ir");c(this,"oe");c(this,"kr",{});this.ir=r||UA,this.oe=Lo()}search(r,e){let t=[];return this.tu(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.tu(r,(n,o)=>t.push({node:n,overlap:kg(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}tu(r,e,t){if(this.oe.children.length===0)return;t=t||{};let n=Object.assign({},r);t.margin&&(n.x-=t.margin,n.y-=t.margin,n.width+=2*t.margin,n.height+=2*t.margin);let o=s=>{if(tt(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(tt(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&kg(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.oe)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{_x(r,o)&&(Xd(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.oe),t}insert(r){let e=n=>{let o=this.oe;if(o){let s={x:n.x,y:n.y,width:n.width,height:n.height,data:n.data,children:[],id:n.id};for(n.id&&(this.kr[n.id]=s);!zA(o);)hE(o,s),o=XA(o.children,a=>YA(a,s));wo(o,s),this.rf(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}rf(r){let e=r;for(;e.parent&&e.parent.children.length>this.ir;)e=e.parent,e!=this.oe?(uE(e.parent,e),dE(e).forEach(t=>{wo(e.parent,t)})):e==this.oe&&dE(e).forEach(t=>{wo(e,t)})}ru(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.ir),n=[],o=0,s;for(let a=0;a<t;a++){s=Lo(),o=Math.min(this.ir,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.kr[h.id]=h),wo(s,h)}n.push(s)}return t>1?this.ru(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=Ws.sortRect(r);this.oe=this.ru(e)[0]||Lo()}}getBounds(){return{x:this.oe.x,y:this.oe.y,width:this.oe.width,height:this.oe.height}}getExtents(){return{xmin:this.oe.x,ymin:this.oe.y,xmax:this.oe.x+this.oe.width,ymax:this.oe.y+this.oe.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.nu(e),e}nu(r,e){let t=[],n=r.parent;for(pR(r),r.id!=null&&delete this.kr[r.id];n!=null&&n!==this.oe;)n.children.length<=this.ir/2&&(pR(n),t.push(...this.nf(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.kr[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.nu(a,[{x:e,y:t,width:n,height:o,data:s||a.data,children:[],id:r}]):this.insert({id:r,x:e,y:t,width:n,height:o,data:s,children:[]})}clear(){this.oe=Lo(),this.kr={}}getLeafNodes(){return Object.values(this.kr)}has(r){return this.kr.hasOwnProperty(r)}nf(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var jd=class i{constructor(r){this.instance=r;c(this,"pe",[]);c(this,"te",[]);c(this,"ne",[])}static from(r){let e=new i(r.instance);return e.pe=r.pe.slice(),e.te=r.te.slice(),e.ne=r.ne.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.of(r,t,n,o);return this.instance.transaction(()=>{s.groups.forEach(a=>this.instance.addGroup(a)),s.nodes.forEach(a=>this.instance.addNode(a)),s.edges.forEach(a=>this.instance.$_addEdge(a,Wx,null))}),s}of(r,e,t,n){let o={nodes:[],groups:[],edges:[],vertexMap:new Map,edgeMap:new Map,origin:{x:0,y:0},transform:{x:0,y:0}},s=[],a=this.instance.modelLeftAttribute,l=this.instance.modelTopAttribute,h=1/0,d=1/0,u=new Map;function p(m){let E=r.getCoordinates(m,!0);u.set(m.id,E),m.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.te.forEach(p),this.pe.forEach(p),o.origin.x=h,o.origin.y=d,o.transform.x=e!=null?e.x-o.origin.x:0,o.transform.y=e!=null?e.y-o.origin.y:0;let g=(m,E,y)=>{y=y||0;let x=Object.assign({},m.data),f=G();if(o.vertexMap.set(m.getFullId(),f),x.id=f,E==null){let b=u.get(m.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x[this.instance.groupProperty]!=null&&delete x[this.instance.groupProperty]}else x[this.instance.groupProperty]=E.id;return!n&&Y(m)&&m.getMembers().forEach(b=>{let A=g(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.pe.forEach(m=>o.nodes.push(g(m,null,0)[0])),this.te.forEach(m=>s.push(g(m,null,0))),s.sort((m,E)=>m[1]<E[1]?-1:1),o.groups=s.map(m=>m[0]),this.ne.forEach(m=>{let E,y,x=m.source,f=j(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=m.target,T=j(A)?A.getParent():A,S=o.vertexMap.get(T.id);if(b==null){if(t)return;E=f.id}else E=b;if(S==null){if(t)return;y=T.id}else y=S;let O={source:E,target:y,data:Object.assign({},m.data||{})};if(O.data.id!=null){let v=G();o.edgeMap.set(O.data.id,v),O.data.id=v}m.geometry!=null&&S!=null&&b!=null&&(O.geometry=r.transformGeometry(m,o.transform.x,o.transform.y)),o.edges.push(O)}),o}};var Hd=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(jd.from(e))}paste(r){let t=r&&r.clear===!0?this.stack.pop():this.stack[this.stack.length-1];return t!=null?t.paste(this.$getCopyDataTransformer(),r):null}clear(){this.stack.length=0}copyCurrentSelection(){this.copy(this.instance.getSelection())}pasteCurrentSelection(r){return this.copyCurrentSelection(),this.paste(r)}};var pE="Anchor",Pt="top",_t="left",Ot="right",Rt="bottom",gE={[Pt]:{x:0,y:-1},[Rt]:{x:0,y:1},[Ot]:{x:1,y:0},[_t]:{x:-1,y:0}},YI=[_t,Ot],zI=[Pt,Rt],XI={[Pt]:[_t,Ot],[Rt]:[_t,Ot],[_t]:[Rt,Pt],[Ot]:[Rt,Pt]},jI={[Pt]:Rt,[Rt]:Pt,[_t]:Ot,[Ot]:_t},gR=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(gR||{}),wl=(f=>(f.Assign="Assign",f.AutoDefault="AutoDefault",f.Bottom="Bottom",f.BottomLeft="BottomLeft",f.BottomRight="BottomRight",f.Center="Center",f.Continuous="Continuous",f.ContinuousBottom="ContinuousBottom",f.ContinuousLeft="ContinuousLeft",f.ContinuousRight="ContinuousRight",f.ContinuousTop="ContinuousTop",f.ContinuousLeftRight="ContinuousLeftRight",f.ContinuousTopBottom="ContinuousTopBottom",f.Left="Left",f.Right="Right",f.Top="Top",f.TopLeft="TopLeft",f.TopRight="TopRight",f))(wl||{});var Rn={};function Zs(i,r){Rn[i]=r}var dr={lineIntersection(i,r,e,t,n){return Rn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return Rn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return Rn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return Rn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return Rn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return Rn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return Rn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return Rn[i.type].getPath(i,r)}};function mE(i){return Rn[i.type].getLength(i)}function jA(i,r){return Rn[i].create(r)}function HI(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function HA(i,r,e){return HI()}function kA(i,r,e,t,n){return[]}function Dl(i,r,e,t,n){let o=[];return o.push.apply(o,dr.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,dr.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,dr.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,dr.lineIntersection(i,r,e+n,r,e)),o}function WA(i,r){return Dl(i,r.x,r.y,r.width,r.height)}function Js(i){return Object.assign({extents:Pi()},i)}function mR(){return{sx:0,sy:0,tx:0,ty:0,so:{x:0,y:0},to:{x:0,y:0},x:0,y:0,w:0,h:0,quadrant:1,startStubX:0,startStubY:0,endStubX:0,endStubY:0,isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1,opposite:!1,perpendicular:!1,orthogonal:!1,sourceAxis:ee,stubs:[0,0]}}function Ks(i,r,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+r,curY:i.curY+e}}function kd(i,r,e,t){let n=e.gap||0,o=e.stub||t,s=Array.isArray(o)?o[0]:o,a=Array.isArray(o)?o[1]:o;return{type:i,internalSegments:[],segmentProportionalLengths:[],segmentProportions:[],totalLength:0,cssClass:e.cssClass||"",hoverClass:e.hoverClass||"",gap:n,stub:o,sourceStub:s,targetStub:a,sourceGap:Array.isArray(n)?n[0]:n,targetGap:Array.isArray(n)?n[1]:n,typeDescriptor:"connector",geometry:null,idPrefix:"_vjs_connector",bounds:Pi(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:mR()}}function EE(i,r,e){let t=e===0?r.anchors.source:r.anchors.target;t.isFixed=!0,t.fixedLocation=Object.assign({},i,{offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY})}var ZA=.45,ER=62;function Wd(i,r,e){let t=kd(i,r,e,[0,0]);return Object.assign(t,{curviness:e.curviness||10,gap:e.gap||5,proximityLimit:e.proximityLimit||80,clockwise:e.orientation&&e.orientation==="clockwise",loopbackDistance:e.loopbackDistance||ER,isLoopbackCurrently:!1,constrain:tn,smooth:!0})}var si={subtract:(i,r)=>({x:i.x-r.x,y:i.y-r.y}),dotProduct:(i,r)=>i.x*r.x+i.y*r.y,square:i=>Math.sqrt(i.x*i.x+i.y*i.y),scale:(i,r)=>({x:i.x*r,y:i.y*r})},fR=64,kI=Math.pow(2,-fR-1);function bR(i,r){let e=[],t=WI(i,r),n=r.length-1,o=2*n-1,s=JA(t,o,e,0),a=si.subtract(i,r[0]),l=si.square(a),h=0,d;for(let u=0;u<s;u++)a=si.subtract(i,KA(r,n,e[u],null,null)),d=si.square(a),d<l&&(l=d,h=e[u]);return a=si.subtract(i,r[n]),d=si.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function eS(i,r){let e=bR(i,r);return{point:KA(r,r.length-1,e.location,null,null),location:e.location}}function WI(i,r){let e=r.length-1,t=2*e-1,n=[],o=[],s=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]];for(let u=0;u<=e;u++)n[u]=si.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=si.subtract(r[u+1],r[u]),o[u]=si.scale(o[u],3);for(let u=0;u<=e-1;u++)for(let p=0;p<=e;p++)s[u]||(s[u]=[]),s[u][p]=si.dotProduct(o[u],n[p]);for(let u=0;u<=t;u++)a[u]||(a[u]=[]),a[u].y=0,a[u].x=parseFloat(""+u)/t;let h=e,d=e-1;for(let u=0;u<=h+d;u++){let p=Math.max(0,u-d),g=Math.min(u,h);for(let m=p;m<=g;m++){let E=u-m;a[m+E].y+=s[E][m]*l[E][m]}}return a}function JA(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(ZI(i,r)){case 0:return 0;case 1:{if(t>=fR)return e[0]=(i[0].x+i[r].x)/2,1;if(JI(i,r))return e[0]=KI(i,r),1;break}}KA(i,r,.5,n,o),s=JA(n,r,l,t+1),a=JA(o,r,h,t+1);for(let d=0;d<s;d++)e[d]=l[d];for(let d=0;d<a;d++)e[d+s]=h[d];return s+a}function ZI(i,r){let e=0,t,n;t=n=Math.sign(i[0].y);for(let o=1;o<=r;o++)t=Math.sign(i[o].y),t!=n&&e++,n=t;return e}function JI(i,r){let e,t,n,o,s,a,l,h,d,u,p,g,m,E,y,x;a=i[0].y-i[r].y,l=i[r].x-i[0].x,h=i[0].x*i[r].y-i[r].x*i[0].y;let f,b;f=b=0;for(let A=1;A<r;A++){let T=a*i[A].x+l*i[A].y+h;T>f?f=T:T<b&&(b=T)}return p=0,g=1,m=0,E=a,y=l,x=h-f,d=p*y-E*g,u=1/d,t=(g*x-y*m)*u,E=a,y=l,x=h-b,d=p*y-E*g,u=1/d,n=(g*x-y*m)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<kI?1:0}function KI(i,r){let e=1,t=0,n=i[r].x-i[0].x,o=i[r].y-i[0].y,s=i[0].x-0,a=i[0].y-0,l=n*t-o*e,h=1/l,d=(n*a-o*s)*h;return 0+e*d}function KA(i,r,e,t,n){let o=[[]];for(let s=0;s<=r;s++)o[0][s]=i[s];for(let s=1;s<=r;s++)for(let a=0;a<=r-s;a++)o[s]||(o[s]=[]),o[s][a]||(o[s][a]={}),o[s][a].x=(1-e)*o[s-1][a].x+e*o[s-1][a+1].x,o[s][a].y=(1-e)*o[s-1][a].y+e*o[s-1][a+1].y;if(t!=null)for(let s=0;s<=r;s++)t[s]=o[s][0];if(n!=null)for(let s=0;s<=r;s++)n[s]=o[r-s][s];return o[r][0]}function qI(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(QI(t/i,r));return e}function QI(i,r){let e={x:0,y:0};if(i===0)return r[0];let t=r.length-1;if(i===1)return r[t];let n=r,o=1-i;if(t===0)return r[0];if(t===1)return{x:o*n[0].x+i*n[1].x,y:o*n[0].y+i*n[1].y};if(4>t){let s=o*o,a=i*i,l=0,h,d,u;return t===2?(n=[n[0],n[1],n[2],e],h=s,d=2*(o*i),u=a):t===3&&(h=s*o,d=3*(s*i),u=3*(o*a),l=i*a),{x:h*n[0].x+d*n[1].x+u*n[2].x+l*n[3].x,y:h*n[0].y+d*n[1].y+u*n[2].y+l*n[3].y}}else return e}function tS(i){let r=0;if(!QA(i)){let t=qI(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=qA(o,s)}}return r}var yR=new Map;function eM(i){let r=yR.get(i);if(!r){r=[];let e=()=>l=>Math.pow(l,i),t=()=>l=>Math.pow(1-l,i),n=l=>h=>l,o=()=>l=>l,s=()=>l=>1-l,a=l=>h=>{let d=1;for(let u=0;u<l.length;u++)d=d*l[u](h);return d};r.push(e());for(let l=1;l<i;l++){let h=[n(i)];for(let d=0;d<i-l;d++)h.push(o());for(let d=0;d<l;d++)h.push(s());r.push(a(h))}r.push(t()),yR.set(i,r)}return r}function qs(i,r){let e=eM(i.length-1),t=0,n=0;for(let o=0;o<i.length;o++)t=t+i[o].x*e[o](1-r),n=n+i[o].y*e[o](1-r);return{x:t,y:n}}function qA(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function QA(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function Zd(i,r,e){if(QA(i))return{point:i[0],location:r};let t=qs(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=qs(i,o),n+=qA(a,t),t=a;return{point:a,location:o}}function rS(i,r,e){return Zd(i,r,e).point}function nS(i,r,e){return Zd(i,r,e).location}function Jd(i,r){let e=qs(i,r),t=qs(i.slice(0,i.length-1),r),n=t.y-e.y,o=t.x-e.x;return n===0?1/0:Math.atan(n/o)}function tM(i,r,e){let t=Zd(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Jd(i,t.location)}function rM(i,r,e,t){t=t==null?0:t;let n=Zd(i,r,t),o=Jd(i,n.location),s=Math.atan(-1/o),a=e/2*Math.sin(s),l=e/2*Math.cos(s);return[{x:n.point.x+l,y:n.point.y+a},{x:n.point.x-l,y:n.point.y-a}]}function Ln(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=oM(n),h=[o*l[0][0]+s*l[1][0],o*l[0][1]+s*l[1][1],o*l[0][2]+s*l[1][2],o*l[0][3]+s*l[1][3]+a],d=sM.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let g=d[p],m=Math.pow(g,2),E=Math.pow(g,3),y={x:l[0][0]*E+l[0][1]*m+l[0][2]*g+l[0][3],y:l[1][0]*E+l[1][1]*m+l[1][2]*g+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),g>=0&&g<=1&&x>=0&&x<=1&&u.push(y)}return u}function nM(i,r,e,t,n){let o=[];return o.push.apply(o,Ln(i,r,i+e,r,n)),o.push.apply(o,Ln(i+e,r,i+e,r+t,n)),o.push.apply(o,Ln(i+e,r+t,i,r+t,n)),o.push.apply(o,Ln(i,r+t,i,r,n)),o}function iM(i,r){let e=[];return e.push.apply(e,Ln(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Ln(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Ln(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Ln(i.x,i.y+i.height,i.x,i.y,r)),e}function xR(i,r){return[-i[0][r]+3*i[1][r]+-3*i[2][r]+i[3][r],3*i[0][r]-6*i[1][r]+3*i[2][r],-3*i[0][r]+3*i[1][r],i[0][r]]}function oM(i){return[xR(i,"x"),xR(i,"y")]}function sM(i,r,e,t){let n=r/i,o=e/i,s=t/i,a=(3*o-Math.pow(n,2))/9,l=(9*n*o-27*s-2*Math.pow(n,3))/54,h=Math.pow(a,3)+Math.pow(l,2),d,u,p=[0,0,0];if(h>=0)d=Math.sign(l+Math.sqrt(h))*Math.pow(Math.abs(l+Math.sqrt(h)),1/3),u=Math.sign(l-Math.sqrt(h))*Math.pow(Math.abs(l-Math.sqrt(h)),1/3),p[0]=-n/3+(d+u),p[1]=-n/3-(d+u)/2,p[2]=-n/3-(d+u)/2,Math.abs(Math.sqrt(3)*(d-u)/2)!==0&&(p[1]=-1,p[2]=-1);else{let g=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(g/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((g+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((g+4*Math.PI)/3)-n/3}for(let g=0;g<3;g++)(p[g]<0||p[g]>1)&&(p[g]=-1);return p}var No="Bezier";function iS(i,r,e){return e&&(r=nS(i,r>0?0:1,r)),r}var AR={create(i){let r=Js(i),e=i.cp1,t=i.cp2,n=[{x:r.x1,y:r.y1},{x:e.x,y:e.y},{x:t.x,y:t.y},{x:r.x2,y:r.y2}],o={xmin:Math.min(r.x1,r.x2,e.x,t.x),ymin:Math.min(r.y1,r.y2,e.y,t.y),xmax:Math.max(r.x1,r.x2,e.x,t.x),ymax:Math.max(r.y1,r.y2,e.y,t.y)};return Object.assign(r,{cp1:e,cp2:t,curve:n,extents:o,length:0,type:No})},boundingBoxIntersection(i,r){return WA(i,r)},boxIntersection(i,r,e,t,n){return Dl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=eS({x:r,y:e},i.curve);return{d:Math.sqrt(Math.pow(t.point.x-r,2)+Math.pow(t.point.y-e,2)),x:t.point.x,y:t.point.y,l:1-t.location,s:i,x1:null,y1:null,x2:null,y2:null}},getLength(i){return(i.length==null||i.length===0)&&(i.length=tS(i.curve)),i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"C "+i.cp1.x+" "+i.cp1.y+" "+i.cp2.x+" "+i.cp2.y+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return r=iS(i.curve,r,e),Jd(i.curve,r)},lineIntersection(i,r,e,t,n){return Ln(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=iS(i.curve,r,t),rS(i.curve,r,e)},pointOnPath(i,r,e){return r=iS(i.curve,r,e),qs(i.curve,r)}};Zs(No,AR);var Kd={};function aM(i){return i.x1!=null&&!isNaN(i.x1)&&i.y1!=null&&!isNaN(i.y1)&&i.x2!=null&&!isNaN(i.x2)&&i.y2!=null&&!isNaN(i.y2)}function SR(i){return i.curX!=null&&!isNaN(i.curX)&&i.curY!=null&&!isNaN(i.curY)&&i.x!=null&&!isNaN(i.x)&&i.y!=null&&!isNaN(i.y)&&i.ox!=null&&!isNaN(i.ox)&&i.oy!=null&&!isNaN(i.oy)}function lM(i){return!i.source||!i.target||!SR(i.source)||!SR(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!aM(r))==null}var sn=i=>lt(i.geometry),ze={get:(i,r,e)=>{let t=Kd[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{Kd[i]=r},compute:(i,r,e)=>{let t=Kd[i.connector.type];if(t)return t.compute(i,r,e);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},update:(i,r,e,t,n)=>{let o=Kd[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},importGeometry(i,r){if(lM(r)){let e=i.connector;e.geometry=lt(r),e.edited=!0,ze.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){EE(r.source,i,0),EE(r.target,i,1)},transformGeometry(i,r,e,t){let n=Kd[i.type];if(n)return n.transformGeometry(r,e,t);throw"VisuallyJs: unknown connector type '"+i.type+"'"},setGeometry(i,r,e){if(r!=null){let t=i.connector;t.geometry=lt(r),e||(t.edited=!0,i.edge.geometry=sn(t))}}};function hM(i){return i.geometry}function cM(i,r){return i.geometry=r,!0}function vR(i,r){let e=r.extents;i.bounds.xmin=Math.min(i.bounds.xmin,e.xmin),i.bounds.xmax=Math.max(i.bounds.xmax,e.xmax),i.bounds.ymin=Math.min(i.bounds.ymin,e.ymin),i.bounds.ymax=Math.max(i.bounds.ymax,e.ymax)}function yE(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function Io(i){return Math.round(i*2)/2}function zr(i,r,e){if(e.x1=Io(e.x1),e.y1=Io(e.y1),e.x2=Io(e.x2),e.y2=Io(e.y2),e.x1===e.x2&&e.y1===e.y2)return;let t=jA(r,e);i.internalSegments.push(t),i.totalLength+=mE(t),vR(i,t)}function fE(i,r,e){let t,n,o;if(e&&(r=r>0?r/i.totalLength:(i.totalLength+r)/i.totalLength),r===1)t=i.internalSegments.length-1,o=1;else if(r===0)o=0,t=0;else if(r>=.5){for(t=0,o=0,n=i.segmentProportions.length-1;n>-1;n--)if(i.segmentProportions[n][1]>=r&&i.segmentProportions[n][0]<=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}}else for(t=i.segmentProportions.length-1,o=1,n=0;n<i.segmentProportions.length;n++)if(i.segmentProportions[n][1]>=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}return{segment:i.internalSegments[t],proportion:o,index:t}}function ur(i,r,e){let t=fE(i,r,e);return t.segment&&dr.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function dM(i,r,e){let t=fE(i,r,e);return t.segment&&dr.gradientAtPoint(t.segment,t.proportion,!1)||0}function $e(i,r,e,t){let n=fE(i,r,t);return n.segment&&dr.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function xE(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=mE(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function TR(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function bE(i,r){i.strokeWidth=r.strokeWidth;let e=r.sourcePos.curX,t=r.targetPos.curX,n=r.sourcePos.curY,o=r.targetPos.curY,s=t<e,a=o<n,l={x:r.sourcePos.ox,y:r.sourcePos.oy},h={x:r.targetPos.ox,y:r.targetPos.oy},d=s?t:e,u=a?o:n,p=Math.abs(t-e),g=Math.abs(o-n),m=!TR(r.sourcePos),E=!TR(r.targetPos);if(m||E){let S=p>g,O=S?e:n,v=S?t:o,_=O>v?-1:1,P=O>v?1:-1;m&&(l.x=S?_:0,l.y=S?0:_),E&&(h.x=S?P:0,h.y=S?0:P)}let y=e+i.sourceGap*l.x,x=n+i.sourceGap*l.y,f=t+i.targetGap*h.x,b=o+i.targetGap*h.y,A=l.x*h.x+l.y*h.y,T={sx:y,sy:x,tx:f,ty:b,so:l,to:h,x:d,y:u,w:p,h:g,quadrant:As({x:e,y:n},{x:t,y:o}),startStubX:y+l.x*i.sourceStub,startStubY:x+l.y*i.sourceStub,endStubX:f+h.x*i.targetStub,endStubY:b+h.y*i.targetStub,isXGreaterThanStubTimes2:Math.abs(y-f)>i.sourceStub+i.targetStub,isYGreaterThanStubTimes2:Math.abs(x-b)>i.sourceStub+i.targetStub,opposite:A===-1,perpendicular:A===0,orthogonal:A===1,sourceAxis:l.x===0?fe:ee,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function uM(i,r){let e=i.connector;e.paintInfo=bE(e,r),yE(e),ze.compute(i,e.paintInfo,r),e.x=e.paintInfo.x,e.y=e.paintInfo.y,e.width=e.paintInfo.w,e.height=e.paintInfo.h,e.quadrant=e.paintInfo.quadrant,xE(e)}function Yi(i){i.connector.geometry=null,i.connector.edited=!1,[i.anchors.source,i.anchors.target].forEach(r=>{r.locations.length>0&&(delete r.fixedLocation,r.isFixed=!1)})}function oS(i){i.bounds=Pi()}function sS(i,r,e){let t={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null};for(let n=0;n<i.internalSegments.length;n++){let o=dr.findClosestPointOnPath(i.internalSegments[n],r,e);o.d<t.d&&(t.d=o.d,t.l=o.l,t.x=o.x,t.y=o.y,t.s=i.internalSegments[n],t.x1=o.x1,t.x2=o.x2,t.y1=o.y1,t.y2=o.y2,t.index=n,t.connectorLocation=i.segmentProportions[n][0]+o.l*(i.segmentProportions[n][1]-i.segmentProportions[n][0]))}return t}function pM(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,dr.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function gM(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,dr.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function aS(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,dr.boundingBoxIntersection(i.internalSegments[t],r));return e}function mM(i){return i.typeDescriptor==="connector"}function lS(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=dr.getPath(i.internalSegments[e],e===0),r+=" ";return r}function EM(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,g,m;if(r.perpendicular){let E=h+a.ox*i.loopbackDistance,y=d+a.oy*i.loopbackDistance,x=u+l.ox*i.loopbackDistance,f=p+l.oy*i.loopbackDistance;g={x:E,y},m={x,y:f}}else{let E=Math.sign(r.tx-r.sx),y=Math.sign(r.ty-r.sy),x=a.ox===0?.25*i.loopbackDistance*-E:a.ox*i.loopbackDistance,f=a.oy===0?.25*i.loopbackDistance*-y:a.oy*i.loopbackDistance,b=l.ox===0?.25*i.loopbackDistance*E:l.ox*i.loopbackDistance,A=l.oy===0?.25*i.loopbackDistance*y:l.oy*i.loopbackDistance;g={x:r.sx+x,y:r.sy+f},m={x:r.tx+b,y:r.ty+A}}return[g,m]}function fM(i,r,e,t,n,o,s){let a=t,l=n,h,d,[u,p]=[i.scale*r.w,i.scale*r.h];return e.sourceInfo.id===e.targetInfo.id?[h,d]=EM(i,r,e,t,n,o,s):(h={x:r.sx+a.ox*u,y:r.sy+a.oy*p},d={x:r.tx+l.ox*u,y:r.ty+l.oy*p}),[h,d]}function CR(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function yM(i,r,e,t,n,o,s){let a=r.sx,l=r.sy,h=r.tx,d=r.ty,u,p=(a+h)/2,g=(l+d)/2,m=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=xM(p,g,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,m,i.proximityLimit),[u,u]}function xM(i,r,e,t,n,o,s,a,l){if(a<=l)return{x:i,y:r};if(e===1)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===2)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s};if(e===3)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===4)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s}}function PR(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function qd(i,r,e,t,n){let o=i.connector,s,a;o.type===Mo?[s,a]=PR(o):[s,a]=CR(o);let l={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}],source:e.sourcePos,target:e.targetPos};return zr(o,No,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function Qd(i,r,e){let t=i.connector,n=e.sourcePos,o=e.targetPos,s=Math.abs(n.curX-o.curX),a=Math.abs(n.curY-o.curY),l,h;t.type===Mo?t.edited?[l,h]=PR(t):[l,h]=fM(t,r,e,n,o,s,a):t.edited?[l,h]=CR(t):[l,h]=yM(t,r,e,n,o,s,a);let d={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}],source:e.sourcePos,target:e.targetPos};return zr(t,No,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function eu(i,r,e){return{source:Ks(i.source,r,e),target:Ks(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e,cp1:{x:t.cp1.x+r,y:t.cp1.y+e},cp2:{x:t.cp2.x+r,y:t.cp2.y+e}}))}}var Mo="Bezier";function _R(i,r){let e=Wd(Mo,i,r);return Object.assign(e,{scale:r.scale||ZA})}ze.register(Mo,{compute:Qd,update:qd,create:_R,transformGeometry:eu});var tu="QuadraticBezier";function OR(i,r){let e=Wd(tu,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",WA:{x:0,y:0}})}ze.register(tu,{compute:Qd,update:qd,create:OR,transformGeometry:eu});var AE="perpendicular",SE="orthogonal",TE="opposite",zi="Orthogonal",hS="Smooth",cS=30;function Nl(i,r,e,t){let n=Math.max(r,e),o=Math.min(r,e);return t?o<=i&&n>=i:o<i&&n>i}function dS(i,r,e){return ru(r,"h",e,1)}function uS(i,r,e){return ru(r,"h",e,-1)}function pS(i,r,e){return ru(r,"v",e,1)}function gS(i,r,e){return ru(r,"v",e,-1)}function ru(i,r,e,t){let n=r==="h"?"v":"h",o=[],s=i,a=t===-1?-1:e.length;for(;s!==a;){let l=e[s];if(l.o===n)o.push(l),s+=t;else return{segment:l,others:o,index:s}}return null}function nu(i,r,e,t){let n=null,o;if(t!=null){if(o=i.indexOf(t),o===-1)return null;o+=r}else o=r===-1?i.length-2:1;for(let s=o;s>0&&s<i.length-1;s+=r)if(i[s].o===e){n=[i[s],s];break}return n}function iu(i,r,e,t){let n=i.indexOf(t),o=nu(i,r,e,t);return o&&o[1]==n+r?o:null}function Vo(i){return{[ne]:Math.sign(i.x2-i.x1),[pe]:Math.sign(i.y2-i.y1)}}function vE(i,r){return i.curX===r.curX&&i.curY===r.curY}function Il(i,r,e,t,n,o){if(i.lastx===r&&i.lasty===e)return;let s=i.lastx==null?t.sx:i.lastx,a=i.lasty==null?t.sy:i.lasty,l=s===r?pe:ne;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function mS(i,r,e){let t=i[1],n=!1,o=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];if(t.o===ne){if(Nl(t.x2,i[0].x1,i[0].x2)||sr(o,r).length>0){let a=pS(t,1,i);if(a!=null){let l=(a.segment.y1+a.segment.y2)/2;if(n=!0,l<t.y1){let h=Math.round((r.y-e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}else{let h=Math.round((r.y2+e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}}}}else if(t.o===pe&&(Nl(t.y2,i[0].y1,i[0].y2)||sr(o,r).length>0)){let a=dS(t,1,i);if(a!=null){let l=(a.segment.x1+a.segment.x2)/2;if(n=!0,l<t.x1){let h=Math.round((r.x-e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}else{let h=Math.round((r.x2+e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}}}return n}function ES(i,r,e){let t=i.length-2,n=i[t],o=!1,s=[{x:n.x1,y:n.y1},{x:n.x2,y:n.y2}],a=i[i.length-1];if(n.o===ne){if(Nl(n.x1,a.x1,a.x2)||sr(s,r).length>0){let h=gS(n,t,i);if(h!=null){let d=(h.segment.y1+h.segment.y2)/2;if(o=!0,d<n.y1){let u=Math.round((r.y-e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}}}}else if(n.o===pe&&(Nl(n.y1,a.y1,a.y2)||sr(s,r).length>0)){let h=uS(n,t,i);if(h!=null){let d=(h.segment.x1+h.segment.x2)/2;if(o=!0,d<n.x1){let u=Math.round((r.x-e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}else{let u=Math.round((r.x2+e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}}}return o}function fS(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=ES(r,t,i.targetStub),s=mS(r,e,i.sourceStub)):(s=mS(r,e,i.sourceStub),o=ES(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var wn="Straight";function ai(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function CE(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function PE(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var Go={create(i){let r=Js(i),e=Math.sqrt(Math.pow(r.x2-r.x1,2)+Math.pow(r.y2-r.y1,2)),t=Dr({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}),n=-1/t,o={xmin:Math.min(r.x1,r.x2),ymin:Math.min(r.y1,r.y2),xmax:Math.max(r.x1,r.x2),ymax:Math.max(r.y1,r.y2)};return Object.assign(r,{length:e,m:t,m2:n,extents:o,type:wn})},boundingBoxIntersection(i,r){return Go.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,Go.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,Go.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,Go.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,Go.lineIntersection(i,r,e+n,r,e)),o},findClosestPointOnPath(i,r,e){let t={d:1/0,x:null,y:null,l:null,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2};if(i.m===0)t.y=i.y1,t.x=CE(i.x1,i.x2,r)?r:PE(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=CE(i.y1,i.y2,e)?e:PE(i.y1,i.y2,e);else{let o=i.y1-i.m*i.x1,s=e-i.m2*r,a=(s-o)/(i.m-i.m2),l=i.m*a+o;t.x=CE(i.x1,i.x2,a)?a:PE(i.x1,i.x2,a),t.y=CE(i.y1,i.y2,l)?l:PE(i.y1,i.y2,l)}let n=Pe({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Pe({x:r,y:e},t),t.l=n/i.length,t},getLength(i){return i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"L "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return i.m},lineIntersection(i,r,e,t,n){let o=Math.abs(Dr({x:r,y:e},{x:t,y:n})),s=Math.abs(i.m),a=s===1/0?i.x1:i.y1-s*i.x1,l=[],h=o===1/0?r:e-o*r;if(o!==s)if(o===1/0&&s===0)ai(r,i.x1,i.x2)&&ai(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)ai(e,i.y1,i.y2)&&ai(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,ai(d,i.x1,i.x2)&&(u=s*r+a,ai(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,ai(u,i.y1,i.y2)&&(d=(e-a)/s,ai(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,ai(d,i.x1,i.x2)&&ai(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=Go.pointOnPath(i,r,t),o=e<=0?{x:i.x1,y:i.y1}:{x:i.x2,y:i.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),jt(n,o,e)},pointOnPath(i,r,e){if(r===0&&!e)return{x:i.x1,y:i.y1};if(r===1&&!e)return{x:i.x2,y:i.y2};{let t=e?r>0?r:i.length+r:r*i.length;return jt({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};Zs(wn,Go);var RR=1e-10;function LR(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<RR?r:e-i<RR?e:i}var Ml="Arc";function wR(i,r,e,t){return nl({x:i,y:r},{x:e,y:t})}function bM(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+vi:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+vi:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var ou={create(i){let r=Js(i),e=i.cx,t=i.cy,n=i.r,o=i.ac,s,a;i.startAngle&&i.endAngle?(s=i.startAngle,a=i.endAngle,r.x1=e+n*Math.cos(s),r.y1=t+n*Math.sin(s),r.x2=e+n*Math.cos(a),r.y2=t+n*Math.sin(a)):(s=wR(e,t,r.x1,r.y1),a=wR(e,t,r.x2,r.y2)),a<0&&(a+=vi),s<0&&(s+=vi);let l=a<s?a+vi:a,h=Math.abs(l-s);o&&(h=vi-h);let d=2*Math.PI*n,u=h/vi,p=d*u,g={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:g,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:Ml})},boundingBoxIntersection(i,r){return ou.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return Dl(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return HA(i,r,e)},getLength(i){return i.length},getPath(i,r){let e=i.sweep>Math.PI?1:0,t=i.anticlockwise?0:1;return(r?"M"+i.x1+" "+i.y1+" ":"")+"A "+i.radius+" "+i.radius+" 0 "+e+","+t+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){let t=ou.pointOnPath(i,r,e),n=Px({x:i.cx,y:i.cy},t);return!i.anticlockwise&&(n===1/0||n===-1/0)&&(n*=-1),n},lineIntersection(i,r,e,t,n){return kA(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=ou.pointOnPath(i,r,t),o=e/i.circumference*2*Math.PI,s=i.anticlockwise?-1:1,a=n.theta+s*o,l=i.cx+i.radius*Math.cos(a),h=i.cy+i.radius*Math.sin(a);return{x:l,y:h}},pointOnPath(i,r,e){if(r===0)return{x:i.x1,y:i.y1,theta:i.startAngle};if(r===1)return{x:i.x2,y:i.y2,theta:i.endAngle};e&&(r=r/length);let t=bM(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:LR(n),y:LR(o),theta:t}}};Zs(Ml,ou);var DR={x:[ee,fe],y:[fe,ee]};function NR(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var Vl=new Map;Vl.set(AE,NR),Vl.set(SE,NR),Vl.set(TE,(i,r)=>{let e=i,t=e.sourceAxis,n={[ee]:function(){return e.so[t]===1&&(e.startStubX>e.endStubX&&e.tx>e.startStubX||e.sx>e.endStubX&&e.tx>e.sx)||e.so[t]===-1&&(e.startStubX<e.endStubX&&e.tx<e.startStubX||e.sx<e.endStubX&&e.tx<e.sx)},[fe]:function(){return e.so[t]===1&&(e.startStubY>e.endStubY&&e.ty>e.startStubY||e.sy>e.endStubY&&e.ty>e.sy)||e.so[t]===-1&&(e.startStubY<e.endStubY&&e.ty<e.startStubY||e.sy<e.endStubY&&e.ty<e.sy)}};return!r&&n[e.sourceAxis]()?{[ee]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[fe]:[i.startStubX,(i.sy+i.ty)/2,i.endStubX,(i.sy+i.ty)/2]}[e.sourceAxis]:[i.startStubX,i.startStubY,i.endStubX,i.endStubY]});var Gl=new Map;Gl.set(AE,(i,r,e,t,n,o,s,a,l,h)=>{let d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},u={x:[[i.startStubX,i.endStubX],null,[i.endStubX,i.startStubX]],y:[[i.startStubY,i.endStubY],null,[i.endStubY,i.startStubY]]},p={x:[{x:a,y:i.startStubY},{x:a,y:i.endStubY}],y:[{x:i.startStubX,y:l},{x:i.endStubX,y:l}]},g={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},m={x:[{x:i.startStubX,y:i.endStubY},{x:i.endStubX,y:i.endStubY}],y:[{x:i.endStubX,y:i.startStubY},{x:i.endStubX,y:i.endStubY}]},E={x:[{x:i.startStubX,y:l},{x:i.endStubX,y:l},{x:i.endStubX,y:i.endStubY}],y:[{x:a,y:i.startStubY},{x:a,y:i.endStubY},{x:i.endStubX,y:i.endStubY}]},y={x:[i.startStubY,i.endStubY],y:[i.startStubX,i.endStubX]},x=DR[e][0],f=DR[e][1],b=i.so[x]+1,A=i.to[f]+1,T=i.to[f]===-1&&y[e][1]<y[e][0]||i.to[f]===1&&y[e][1]>y[e][0],S=u[e][b][0],O=u[e][b][1],v=d[e][b][A];if(i.quadrant===v[3]||i.quadrant===v[2]&&T)return p[e];if(i.quadrant===v[2]&&O<S)return g[e];if(i.quadrant===v[2]&&O>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return m[e]}),Gl.set(SE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[ee]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[fe]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[ee]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[fe]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),Gl.set(TE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[ee]:fe,[fe]:ee}[e],u=e===ee?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[ee]:Ve,[fe]:_e}[e],g=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[ee]:[{x:t,y:g},{x:o,y:g}],[fe]:[{x:g,y:t},{x:g,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[ee]:[{x:t,y:l},{x:o,y:l}],[fe]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[ee]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[fe]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function yS(i,r,e){let t={lastx:null,lasty:null,orthogonalSegments:[]},n=e.targetPos.curX>=e.sourcePos.curX?e.sourcePos.curX:e.targetPos.curX,o=e.targetPos.curY>=e.sourcePos.curY?e.sourcePos.curY:e.targetPos.curY,s=Vl.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===ee?0:1,l=r.sourceAxis===ee?1:0,h=s[a],d=s[l],u=s[a+2],p=s[l+2];Il(t,s[0],s[1],r,n,o);let g=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,m=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=Gl.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,g,m,Math.max(i.sourceStub,i.targetStub));if(y)for(let x=0;x<y.length;x++)Il(t,y[x].x,y[x].y,r,n,o);return Il(t,s[2],s[3],r,n,o),Il(t,r.tx,r.ty,r,n,o),t.orthogonalSegments}function su(i,r){let e=r;return i.smooth===!0&&e.length>=2?TM(i,e).map(n=>zr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?AM(i,e):e.map(t=>zr(i,wn,t)),i.$pathSegments=e,e}function xS(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function bS(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function AM(i,r){let e=null,t,n,o;for(let s=0;s<r.length-1;s++){if(e=e||Object.assign({},r[s]),t=Object.assign({},r[s+1]),n=xS(e),o=xS(t),i.cornerRadius>0&&n!==o){let a=Math.min(bS(e),bS(t)),l=Math.min(i.cornerRadius,.99*a/2),h={x:e.x2+l*Math.cos(n),y:e.y2+l*Math.sin(n)},d={x:t.x1-l*Math.cos(o),y:t.y1-l*Math.sin(o)},u=Math.atan((n-o)/(1+n*o)),p=Dt({x:e.x1,y:e.y1},h,1e4),g=Dt({x:t.x1,y:t.y1},d,1e4),m=il(p,g),E=m!=null?Pe(m,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,zr(i,wn,Object.assign({},e)),i.slightlyWonky?zr(i,Ml,Object.assign({r:l,cx:m.x,cy:m.y,ac:u>0},e)):zr(i,Ml,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:m.x,cy:m.y,ac:u>0})):zr(i,wn,Object.assign({},e))}else zr(i,wn,Object.assign({},e));e=t}t!=null&&zr(i,wn,Object.assign({},e))}var SM=(i,r)=>{let e=r.x-i.x,t=r.y-i.y;return{length:Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),angle:Math.atan2(t,e)}},IR=(i,r,e,t,n)=>{let a=SM(r||i,e||i),l=a.angle+(n?Math.PI:0),h=a.length*t,d=i.x+Math.cos(l)*h,u=i.y+Math.sin(l)*h;return{x:d,y:u}};function _E(i,r){let e=[];for(let t=1;t<i.length;t++){let n=IR(i[t-1],i[t-2],i[t],r),o=IR(i[t],i[t-1],i[t+1],r,!0);e.push({type:No,segment:{x1:i[t-1].x,y1:i[t-1].y,cp1:n,cp2:o,x2:i[t].x,y2:i[t].y}})}return e}function TM(i,r){let e=[{x:r[0].x1,y:r[0].y1}];for(let t=1;t<r.length;t++)e.push({x:r[t].x1,y:r[t].y1});return e.push({x:r[r.length-1].x2,y:r[r.length-1].y2}),_E(e,i.smoothing)}function MR(i,r,e){return OE([{x1:r.sx,y1:r.sy,x2:r.startStubX,y2:r.startStubY},{x1:r.startStubX,y1:r.startStubY,x2:r.endStubX,y2:r.endStubY},{x1:r.endStubX,y1:r.endStubY,x2:r.tx,y2:r.ty}])}function au(i,r,e,t,n){let o=i.connector;o.lastx=null,o.lasty=null,o.lastOrientation=null;let s=e.sourcePos,a=e.targetPos;return o.$pathSegments=o.geometry.segments,o.constrain===rn?AS(s,a,o,r,e,t,n):vM(s,a,o,r.quadrant,t,n),su(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function lu(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===rn?t.$pathSegments=yS(t,r,e):t.$pathSegments=MR(t,r,e),su(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function vM(i,r,e,t,n,o){if(o){let s=e.geometry.segments[e.geometry.segments.length-1];s.x2=r.curX,s.y2=r.curY,e.geometry.target.curX=r.curX,e.geometry.target.curY=r.curY}else if(n){let s=e.geometry.segments[0];s.x1=i.curX,s.y1=i.curY,e.geometry.source.curX=i.curX,e.geometry.source.curY=i.curY}e.geometry.quadrant=t,e.$pathSegments=e.geometry.segments}function hu(i,r,e){return{source:Ks(i.source,r,e),target:Ks(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e}))}}function OE(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var VR=.15,Xr="Straight";function Qs(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}ze.register(Xr,{compute:lu,update:au,create:SS,transformGeometry:hu});function CM(i,r){let e=Object.assign(r,{constrain:rn});return SS(i,e)}ze.register(zi,{compute:lu,update:au,create:CM,transformGeometry:hu});function PM(i,r){let e=Object.assign(r,{constrain:tn,smooth:!0});return SS(i,e)}ze.register(hS,{compute:lu,update:au,create:PM,transformGeometry:hu});function _M(i){return i==null?null:i===qx?rn:i===Qx?Mc:i}function SS(i,r){let e=_M(r.constrain);r.stub=r.stub==null?e===rn?cS:null:r.stub;let t=kd(Xr,i,r,[0,0]),n=r.midpoint==null||isNaN(r.midpoint)?.5:r.midpoint,o=r.alwaysRespectStubs!==!1,s=r.loopbackRadius||25;return Object.assign(t,{cornerRadius:r.cornerRadius!=null?r.cornerRadius:null,smooth:r.smooth===!0,smoothing:r.smoothing==null?VR:r.smoothing,geometry:{segments:[]},constrain:e==null?tn:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function vS(i,r,e){TS(1,i,r,e),TS(0,i,r,e)}var $o="x2",Bo="x1",Fo="y1",Uo="y2";function OM(i,r,e){let t=e===i.x1?{value:i.x2,coord:$o,prev:!0}:{value:i.x1,coord:Bo,prev:!0},n=e===r.x1?{value:r.x2,coord:$o,prev:!1}:{value:r.x1,coord:Bo,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function RM(i,r,e){let t=e===i.y1?{value:i.y2,coord:Uo,prev:!0}:{value:i.y1,coord:Fo,prev:!0},n=e===r.y1?{value:r.y2,coord:Uo,prev:!1}:{value:r.y1,coord:Fo,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function GR(i,r){if(r.length<5)return r;function e(d,u,p){let g=p===d.x1?d.x2:d.x1,m=p===u.x1?u.x2:u.x1;if(g>u.x1&&u.x2>g||g>u.x2&&u.x1>g)return g;if(m>d.x1&&d.x2>m||m>d.x2&&d.x1>m)return m}function t(d,u,p){let g=p===d.y1?d.y2:d.y1,m=p===u.y1?u.y2:u.y1;if(g>u.y1&&u.y2>g||g>u.y2&&u.y1>g)return g;if(m>d.y1&&d.y2>m||m>d.y2&&d.y1>m)return m}let n=r[1],o,s,a=Math.max(i.sourceStub,i.targetStub),l=[];for(let d=2;d<r.length-2;d++)if(o=r[d],s=Vo(n)[n.o],o.o!==n.o)if(Qs(o)<a){let p=r[d+1];if(Vo(p)[p.o]!==s){let m=Object.assign({},o);if(o.o===pe){let E=OM(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(m.x1=y,m.x2=y,E.prev){let x=Object.assign({},n);n.x2===o.x1?x.x2=y:x.x1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}else if(o.o===ne){let E=RM(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(m.y1=y,m.y2=y,E.prev){let x=Object.assign({},n);n.y2===o.y1?x.y2=y:x.y1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}}else n=o}else n=o;else n=o;let h=r.slice();for(let d=0;d<l.length;d++)h.splice(l[d].start-d,3,...l[d].segments);return l.length>0?RE(h):h}function TS(i,r,e,t){let n=r.$pathSegments.slice();i===1&&n.reverse();let o=n[0],s=n[n.length-1],a=i===1?r.targetStub:r.sourceStub,l=i===1?t.targetPos.curX:t.sourcePos.curX,h=i===1?t.targetPos.curY:t.sourcePos.curY,d=i===1?e.to:e.so,u=i===1?$o:Bo,p=i===1?Uo:Fo,g=i===1?Bo:$o,m=i===1?Fo:Uo,E=1,y=n.length-2,x=1,f=n[1];o[g]=l+a*d.x,o[m]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=Vo(o),A=o.o,T=o.o===ne?pe:ne,S=o.o===ne?[$o,Bo]:[Uo,Fo],O=o.o===ne?[Bo,$o]:[Fo,Uo],v=o.o===ne?[Uo,Fo]:[$o,Bo],_=o.o===ne?[Fo,Uo]:[Bo,$o],P=S[i],I=O[i],C=v[i],R=_[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[R]=o[C];let B=Vo(f)[A],N=iu(n,x,T,f);if(B!==b[A]){if(N!=null){let V=iu(n,x,A,N[0]);if(V!=null)n.splice(E,1),V[0][I]=o[P],N[0][P]=o[P],N[0][I]=o[P],N[0][R]=o[C];else{let D=(N[0][C]+N[0][R])/2;N[0][R]=D,f[C]=f[R]=D;let $={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[R]:o[C],[I]:o[P]};n.splice(E,0,$)}}}else if(f[C]=f[R]=o[C],N!=null)N[0][R]=o[C];else if(f[C]!==s[R]){let V={o:f.o==="h"?"v":"h",[P]:f[P],[I]:f[P],[C]:s[C],[R]:f[R]},D=n.length-1;n.splice(D,0,V)}}else{f[R]=o[C],f[P]=f[I]=o[P];let B=iu(n,x,A,f);if(B!=null){let N=Vo(B[0])[A];B[0][I]=o[P];let V=Vo(B[0])[A];if(N!==V&&B[1]===y){n.splice(B[1],1);let D=(f[C]+f[R])/2;f[R]=D,f[P]=f[I]=s[I];let $={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[R]:D,[I]:o[P]};n.splice(E,0,$);let K={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[R]:o[C],[I]:o[P]};n.splice(E,0,K)}}else{let N=(f[C]+f[R])/2;f[R]=N,f[P]=f[I]=s[I];let V={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[R]:N,[I]:o[P]};n.splice(E,0,V);let D={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[R]:o[C],[I]:o[P]};n.splice(E,0,D)}}let w=GR(r,n);i===1&&w.reverse(),r.$pathSegments=w}function AS(i,r,e,t,n,o,s){let a=e.geometry;if(o||s){let l=i.curX-a.source.curX,h=i.curY-a.source.curY,d=r.curX-a.target.curX,u=r.curY-a.target.curY;if(l===d&&h===u){let p=[];e.$pathSegments.forEach(g=>{let m=Object.assign({},g);m.x1+=l,m.x2+=l,m.y1+=h,m.y2+=h,p.push(m)}),e.$pathSegments=p;return}vS(e,t,n)}}function LM(i,r,e){let t=i.findIndex(n=>n.x1===r.x1&&n.y1===r.y1&&n.x2===r.x2&&n.y2===r.y2);if(t>-1){let n=i[t].o,o=i[t];return{segment:o,index:t,axis:n,prev:t>1?i[t-1]:null,next:t<i.length-2?i[t+1]:null,left:e?nu(i,-1,n,o):null,right:e?nu(i,1,n,o):null}}else return null}function CS(i,r,e,t,n){let o=LM(r.$pathSegments,e);if(o!=null){o.axis===pe?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===pe,a=o.index,l=o.index,h=a>1?r.$pathSegments[a-1]:null,d=o.segment;for(;h!=null;)h.o===d.o?s?(h.x1=d.x1,h.x2=d.x2):(h.y1=d.y1,h.y2=d.y2):(h.x2=d.x1,h.y2=d.y1),d=h,a--,h=a>1?r.$pathSegments[a-1]:null;if(d.x1!==r.$pathSegments[0].x2){let g={o:ne,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}else if(d.y1!==r.$pathSegments[0].y2){let g={o:pe,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}d=o.segment,a=l;let u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;for(;u!=null;)u.o===d.o?s?(u.x1=d.x1,u.x2=d.x2):(u.y1=d.y1,u.y2=d.y2):(u.x1=d.x2,u.y1=d.y2),d=u,a++,u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;let p=r.$pathSegments[r.$pathSegments.length-1];if(d.x2!==p.x1){let g={o:ne,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}else if(d.y2!==p.y1){let g={o:pe,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}if(n!==!0){let g=i.instance.getElement(i.sourceId),m=i.instance.getElement(i.targetId);fS(r,r.$pathSegments,g,m,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function RE(i){let r=[lt(i[0])],e=lt(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>Qs(s)>0).map(lt);if(t.length===0)return i;let n=null,o=null;for(let s=0;s<t.length;s++)n==null||o==null?(n=t[s],o=t[s].o):t[s].o===o?(n.y2=t[s].y2,n.x2=t[s].x2):(r.push(n),n=t[s],o=t[s].o);if(r.push(n),r.push(e),r.length===3){let s=r[1],a=s.o,l=Object.assign({},s),h=Object.assign({},s),d=Object.assign({},s);h.o=a===ne?pe:ne,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===ne?pe:ne,d.x1=l.x2,d.y1=l.y2,d.x2=l.x2,d.y2=l.y2,r=[r[0],h,l,d,r[2]]}return r}function PS(i){let r=RE(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}var cu=class extends Ft{constructor(e){super();c(this,"$context");this.$context=e||{}}getFromContext(e){return this.$context[e]}ensureContext(e,t){let n=this.$context[e];return n==null&&(n=t(),this.$context[e]=n,this.fire(Tl,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(Tl,{key:e,value:t})}};var Xi=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Xi||{});var Dn="px",jr="50px",Cr="block",pt="none",qe="absolute",LE="fixed",_S="static",OS="relative",wM="data-vjs-group",gt="data-vjs-managed",$l="data-vjs-not-draggable",RS="data-vjs-no-events",LS="data-vjs-elements-draggable",wE="tabindex",te="data-vjs-vertex",an="data-vjs-port",Bl="data-vjs-port-id",Hr="data-vjs-port-type",du="data-vjs-edge-type",wS="data-vjs-source",Yo="data-vjs-target",DE="data-vjs-allow-loopback",NE="data-vjs-source-port-id",uu="data-vjs-target-port-id",ea="data-vjs-source-port",zo="data-vjs-target-port",ji="data-vjs-source-port-type",Hi="data-vjs-target-port-type",pu="data-vjs-magnet",Qe="data-vjs-edge",gu="data-vjs-overlay-id",pr="*";var ta="vjs-connector",mu="vjs-connector-path",DS="vjs-connector-outline",NS="vjs-connector-transient",Fl="vjs-connected",IE="vjs-group-collapsed",ME="vjs-group-expanded",Eu="vjs-toggle-group-collapse",ra="vjs-overlay",Ul="vjs-overlay-hide",IS="vjs-label-overlay",ki="vjs-node",MS="vjs-port",Xo="vjs-group",VS="vjs-dummy-vertex",Yl="vjs-selected-connection",Wi="vjs-selected-element",na="vjs-edge-delete",fu="vjs-edge-delete-i";var VE="allowNestedGroups",zl="anchor",Xl="anchors",GS="astarVertexBorder",$S="astarVertexBuffer",DM="edgesDetachable",yu="connector",BS="cssClass",FS="edgeRelocateHandleSize",NM="groupSize",US="hoverClass",xu="hoverPaintStyle",YS="maxConnections",IM="nodeSize",jo="paintStyle",MM="reattachEdges",GE="scope",zS=[.05,3];function XS(i){return i.type!=null&&i.options!=null}function hi(i){let r=null;return X(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||G(),r}var bu="always",Zi="hover";function $E(i,r){let e=i.location==null?.5:i.location;if(r!=null)try{let t=typeof r=="string"?parseFloat(r):r;isNaN(t)||(e=t)}catch(t){}i.location=e}var li=class{constructor(r,e){this.connection=r;c(this,"id");c(this,"cssClass");c(this,"cs");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||G(),this.cssClass=e.cssClass||"",$E(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.cs=r.instance.$isTouchDevice()?bu:e.visibility||bu,this.cs===Zi&&(this.visible=!1)}},Nn=class extends li{constructor(e,t,n){super(t,n);this.component=t;c(this,"paintStyle");c(this,"$hollow");c(this,"isSimpleShape",!0);n=n||{},this.paintStyle=n.paintStyle||{strokeWidth:1},this.$hollow=n.hollow===!0}$getStyle(e){let t=this.paintStyle.stroke||e.stroke,n=this.$hollow?"none":this.paintStyle.fill||e.stroke,o=this.paintStyle.strokeWidth||e.strokeWidth;return{stroke:t,fill:n,lineWidth:o}}updateFrom(e,t){}};var $R={},at={get:(i,r,e,t)=>{let n=$R[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{$R[i]=r}};var BE=class BE extends li{constructor(e,t,n){super(t,n);this.instance=e;this.connection=t;c(this,"label");c(this,"type",BE.type);c(this,"useHTMLElement");c(this,"rotatable");c(this,"font");c(this,"isSimpleShape",!1);n=n||{label:""},this.useHTMLElement=e.containerType!=="SVG"&&n.useHTMLElement===!0,this.font=n.font,this.setLabel(n.label),this.rotatable=n.rotatable}getLabel(){return en(this.label)?this.label(this):this.label}setLabel(e){this.label=e,this.instance.updateLabel(this)}updateFrom(e,t){e.font!=null&&(this.font=e.font),e.label!=null&&this.setLabel(e.label),e.location!=null&&$E(this,e.location),FE(this,t)}};c(BE,"type","Label");var gr=BE;function kr(i){return i.type===gr.type}at.register(gr.type,gr);function FE(i,r){if(r){let e=r.fontSize;e!=null&&(i.font=i.font||{},i.font.size=e);let t=r.fontStyle;t!=null&&(i.font=i.font||{},i.font.style=t);let n=r.fontFamily;n!=null&&(i.font=i.font||{},i.font.family=n)}}var UE="labelLocation",VM=[zl,Xl,"cssClass",yu,jo,xu],GM="parent";function Au(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[GM],p;if(Array.isArray(u)?p=u:p=[u],p.find(m=>d.indexOf(m)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(m=>e(m)).filter(m=>m!=null)}},n=(h,d,u)=>{let p=VM.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let g=bn(h,d,[],p);return o(t(h,u),g,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let g=0;g<h.length;g++)p=n(h[g],p,u);return p}},s=h=>{if(h==null)return{};if(typeof h=="string")return e(h);if(h.length){let d=!1,u=0,p;for(;!d&&u<h.length;)p=s(h[u]),p?d=!0:u++;return p}},a=s(i),l=[];return a?o(t(a,l),a,l):{}}function ia(i){return(r,e,t)=>{let n=Pc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function jS(i){i.anchorPositions!=null&&(i.anchorPositionFinder=ia(i.anchorPositions))}var Su=class{constructor(r,e,t,n){this.model=r;this.viewOptions=t;c(this,"defMap",{nodes:new Map,edges:new Map,groups:new Map,ports:new Map});c(this,"nodes");c(this,"edges");c(this,"groups");c(this,"ports");this.viewOptions=this.viewOptions||{},this.nodes=this.viewOptions.nodes||{},this.edges=this.viewOptions.edges||{},this.ports=this.viewOptions.ports||{},this.groups=this.viewOptions.groups||{};let o,s;function a(l,h){return d=>{l.call(h,{overlay:d.overlay,e:d.e,connection:d.overlay.connection,edge:d.overlay.connection.edge,model:d.overlay.connection.instance.model})}}for(let l in this.viewOptions.edges){if(o=this.getEdgeDefinition(l),o.overlays)for(s=0;s<o.overlays.length;s++){let h=o.overlays[s];if(XS(h)){let d=h.options;if(d.events!=null)for(let u in d.events){let p=d.events[u];d.events[u]=a(p,h)}}}n.$registerConnectionType(l,o)}}getEdgeDefinition(r){if(r==null)return null;if(this.defMap.edges.has(r))return this.defMap.edges.get(r);{let e=Au([r,be],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:gr.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label,rotatable:e.labelsRotatable}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||UE;e.labelLocation?t.options.location=e.labelLocation:t.options.location=`{{${n}}}`,e.labelLocationAttribute&&(t.options.labelLocationAttribute=e.labelLocationAttribute),e.labelFont&&(t.options.font=Object.assign({},e.labelFont)),e.overlays.push(t),delete e.label}if(e.deleteButton!=null){e.overlays=e.overlays||[];let t=(e.deleteButtonClass||na)+" "+fu,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:gr.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===Zi?Zi:bu}})})}return delete e.parent,this.defMap.edges.set(r,e),e}}getNodeDefinition(r){if(r==null)return null;if(this.defMap.nodes.has(r))return this.defMap.nodes.get(r);{let e=Au([r,be],this.nodes);return delete e.parent,jS(e),this.defMap.nodes.set(r,e),e}}getPortDefinition(r){if(r==null)return null;if(this.defMap.ports.has(r))return this.defMap.ports.get(r);{let e=Au([r,be],this.ports);return delete e.parent,jS(e),this.defMap.ports.set(r,e),e}}getGroupDefinition(r){if(r==null)return null;if(this.defMap.groups.has(r))return this.defMap.groups.get(r);{let e=Au([r,be],this.groups);return delete e.parent,jS(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(J(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(j(r))return this.getPortDefinition(e)}};function Tu(){return new Set}var BR=class{constructor(){c(this,"affectedElements",new Set)}};function UR(i){return{id:i,el:null,dirty:!0,x:NaN,y:NaN,width:NaN,height:NaN,modelObject:null,r:0,c:{x:0,y:0},ro:{x:0,y:0},x2:0,y2:0,t:{id:i,c:{x:0,y:0},x:NaN,y:NaN,width:NaN,height:NaN,r:0,x2:0,y2:0,cr:0,sr:0,ro:{x:0,y:0}}}}function $M(i,r,e,t,n,o){let s=o/360*Math.PI*2,a={x:r+t/2,y:e+n/2},l=Math.cos(s),h=Math.sin(s),d=(A,T)=>Me({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),g=d(r+t,e+n),m=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,g.x,m.x),x=Math.max(u.x,p.x,g.x,m.x),f=Math.min(u.y,p.y,g.y,m.y),b=Math.max(u.y,p.y,g.y,m.y);return{x:y,y:f,width:x-y,height:b-f,c:E,r:o,x2:x,y2:b,cr:l,sr:h,id:i,ro:{x:y,y:f}}}var YE=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},FR=(i,r)=>YE(i,r)*-1;function zE(i,r,e,t,n){Qg({id:i,value:r,otherBound:e},t,YE,n)}function Ho(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var vu=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"iu",null);c(this,"rtree");c(this,"edgertree");c(this,"Xe",!1);c(this,"il",!0);c(this,"P",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"V",{});c(this,"ol",{});c(this,"je",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Do(4),this.edgertree=new Do(4)}setSuspended(r){this.Xe=r,this.Xe||(this.recomputeBounds(),this.sf())}getExtents(){return Object.assign({},this.je)}af(r,e,t){e!=null&&(Ho(r,this.P.xmin),Ho(r,this.P.xmax),Ho(r,this.P.ymin),Ho(r,this.P.ymax),zE(r,e.t.x,e.t.x2,this.P.xmin,!1),zE(r,e.t.x2,e.t.x,this.P.xmax,!0),zE(r,e.t.y,e.t.y2,this.P.ymin,!1),zE(r,e.t.y2,e.t.y,this.P.ymax,!0),t!==!0&&this.ds())}ds(){this.je.xmin=this.P.xmin.length>0?this.P.xmin[0].value:0,this.je.xmax=this.P.xmax.length>0?this.P.xmax[0].value:0,this.je.ymin=this.P.ymin.length>0?this.P.ymin[0].value:0,this.je.ymax=this.P.ymax.length>0?this.P.ymax[0].value:0}recomputeBounds(){if(this.il){this.il=!1,this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0;for(let r in this.V){let e=this.V[r];this.P.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.P.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.P.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.P.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.P.xmin.sort(YE),this.P.ymin.sort(YE),this.P.xmax.sort(FR),this.P.ymax.sort(FR),this.ds()}}findVerticesAtPoint(r,e,t,n,o){t=t==null?0:t;let s=[];if(o=o||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.V[l.id];if(h.y-t<e&&h.y2+t>e&&(s.push(h),n))return s}}else{let a=this.rtree.search({x:r-t,y:e-t,width:t===0?1:t*2,height:t===0?1:t*2});for(let l=0;l<a.length;l++){let h=a[l].id;if(o.indexOf(h)===-1&&(s.push(this.V[h]),n))return s}}return s}findVerticesIntersectingWithRect(r,e,t,n,o){e=e==null?0:e;let s=[];if(n=n||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(n.indexOf(l.id)===-1&&Zg(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.V[l.id];if(Zg(d.y-e,d.y2+e,r.y,r.y+r.height,1)&&(s.push(d),t))return s}}else{let a=o?1:0,l=this.rtree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(this.V[d]),t))return s}}return s}findConnectorBoundsIntersectingWithRect(r,e,t,n,o){let s=[],a=o?1:0,l=this.edgertree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(l[h]),t))return s}return s}findVerticesEnclosedByRect(r,e,t,n,o){let s=r.x+r.width,a=r.y+r.height;return this.findVerticesIntersectingWithRect(r,e,t,n,o).filter(l=>o?r.x<l.x&&r.y<l.y&&s>l.x2&&a>l.y2:r.x<=l.x&&r.y<=l.y&&s>=l.x2&&a>=l.y2)}hasVerticesIntersectingWithRect(r,e,t,n){return this.findVerticesIntersectingWithRect(r,e,!0,t,n).length>0}hasLineOfSight(r,e,t){let n=wx(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}lf(r,e,t){e.t=$M(r,e.x,e.y,e.width,e.height,e.r),this.ol[r]=e.t,this.il=!0,t!==!0&&(this.Xe||this.af(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Xe||this.rtree.update(r,e.t.x,e.t.y,e.t.width,e.t.height,{id:r}))}updateElement(r,e,t,n,o,s,a,l){let h=Cs(this.V,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=!1,a!=null&&(h.modelObject=a),e!=null&&(h.x=e),t!=null&&(h.y=t),n!=null&&(h.width=n),o!=null&&(h.height=o),h.c.x=h.x+h.width/2,h.c.y=h.y+h.height/2,h.x2=h.x+h.width,h.y2=h.y+h.height,s!=null&&(h.r=s||0),h.r==null||h.r===0?h.ro={x:h.x,y:h.y}:h.ro=Me({x:h.x,y:h.y},h.c,h.r),this.iu==null?this.lf(r,h,l):this.iu.affectedElements.add(r)),h}$updateEdge(r){this.edgertree.update(r.id,r.x,r.y,r.width,r.height)}$removeEdge(r){this.edgertree.removeById(r)}$forEachElement(r){for(let e in this.V)r(this.V[e])}$refreshEveryElement(){for(let r in this.V)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.V[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes&&s.modelObject.objectType!==de.objectType?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t&&!isNaN(t.x)&&!isNaN(t.y)?t:null;return l==null&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s,a)),this.updateElement(r,l==null?void 0:l.x,l==null?void 0:l.y,a.width,a.height,o,null,e)}else return null}hf(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.je.xmax-this.je.xmin}getBoundsHeight(){return this.je.ymax-this.je.ymin}getX(){return this.je.xmin}getY(){return this.je.ymin}setSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.V[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0,this.V={},this.ol={},this.rtree.clear(),this.edgertree.clear(),this.ds()}remove(r){Ho(r,this.P.xmin),Ho(r,this.P.xmax),Ho(r,this.P.ymin),Ho(r,this.P.ymax),delete this.V[r],delete this.ol[r],this.rtree!=null&&this.rtree.removeById(r),this.ds()}$computeGroupContentExtents(r,e,t,n,o){let s=r.members.map(l=>l.id),a=t!=null?t[r.id]:null;if(a==null){let l=this.instance.viewport.getGroupElement(r.id);o=o||this.instance.$_getGroupContentAreaInfo(r.id),a={x:l.x+o.internalOffset.x,y:l.y+o.internalOffset.y}}return this.$computeExtentsForElementIds(s,e?null:a.x,e?null:a.y,t,n)}$computeExtentsForElementIds(r,e=0,t=0,n,o){let s=1/0,a=-1/0,l=1/0,h=-1/0;return n=n||{},o=o||{},r.forEach(d=>{var p,g,m,E,y,x,f,b;let u=this.getElement(d);if(u!=null){let A=((p=n[u.id])==null?void 0:p.x)||((g=u.t)==null?void 0:g.x)||u.x,T=((m=n[u.id])==null?void 0:m.y)||((E=u.t)==null?void 0:E.y)||u.y,S=((y=o[u.id])==null?void 0:y.width)||((x=u.t)==null?void 0:x.width)||u.width,O=((f=o[u.id])==null?void 0:f.height)||((b=u.t)==null?void 0:b.height)||u.height;s=Math.min(s,A-e),l=Math.min(l,T-t),a=Math.max(a,A-e+S),h=Math.max(h,T-t+O)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}sf(){this.rtree.clear();let r=Object.values(this.V).map(e=>({id:e.id,x:e.t.x,y:e.t.y,width:e.t.width,height:e.t.height,children:[]}));this.rtree.load(r)}getPosition(r){return this.V[r]}getElements(){return this.V}isEmpty(){return Object.keys(this.V).length===0}getElement(r){return this.V[r]}getElementPosition(r){return this.V[r]!=null?ft(this.V[r]):null}getElementSize(r){return this.V[r]!=null?Jn(this.V[r]):null}getElementBounds(r){return this.V[r]!=null?Object.assign(ft(this.V[r]),Jn(this.V[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=UR(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.V[r]=l,Y(t)){let g=a;g.collapsed=!1,g.enabled=!0,g.contentArea=this.instance.$getGroupContentAreaElement(e),g.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(g.contentArea)}let h=n==null?{x:0,y:0}:n,d=o==null?{width:0,height:0}:o,u=s==null?0:s,p=this.updateElement(r,h.x,h.y,d.width,d.height,u,t,!0);return p.el=e,l}getTopLevelExtents(){let r=this.instance.model.graph.getTopLevelElements(),e=Object.keys(r);return e.length===0?{xmin:0,xmax:0,ymin:0,ymax:0}:this.$computeExtentsForElementIds(e,0,0,{},{})}};var BM="currentFace",YR={[Pt]:Rt,[Ot]:_t,[_t]:Ot,[Rt]:Pt},zR={[Pt]:Ot,[Ot]:Rt,[_t]:Pt,[Rt]:_t},XR={[Pt]:_t,[Ot]:Pt,[_t]:Rt,[Rt]:Ot};function jl(i,r){return i.faces.indexOf(r)!==-1}function FM(i,r){return(i.clockwise?zR:XR)[r]}function UM(i,r){return(i.clockwise?XR:zR)[r]}function XE(i,r,e){let t=()=>jl(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function YM(i,r){if(jl(i,r))return r;if(jl(i,YR[r]))return YR[r];{let e=FM(i,r);if(jl(i,e))return e;{let t=UM(i,r);if(jl(i,t))return t}}return r}function HS(i,r,e){let t={type:i,locations:[{x:0,y:0,offx:0,offy:0,ox:0,oy:0}],currentLocation:0,locked:!1,id:G(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,ou:null};return Object.defineProperty(t,BM,{get(){return this.ou},set(n){this.ou=YM(this,n)}}),t}var kS={Continuous:{faces:[Pt,_t,Rt,Ot]},ContinuousTop:{faces:[Pt]},ContinuousRight:{faces:[Ot]},ContinuousBottom:{faces:[Rt]},ContinuousLeft:{faces:[_t]},ContinuousLeftRight:{faces:[_t,Ot]},ContinuousTopBottom:{faces:[Pt,Rt]}};function zM(i,r){let e=1/0,t=-1;for(let n=0;n<i.locations.length;n++){let o=Math.sqrt(Math.pow(r.x-i.locations[n].x,2)+Math.pow(r.y-i.locations[n].y,2));o<e&&(e=o,t=n,i.currentLocation=n)}return t}var jR={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},HR={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},kR={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},WR={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},XM={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},jM={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},HM={x:0,y:1,ox:0,oy:1,offx:0,offy:0},kM={x:1,y:1,ox:0,oy:1,offx:0,offy:0},WM={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},ZR={Top:[jR],Bottom:[HR],Left:[kR],Right:[WR],TopLeft:[XM],TopRight:[jM],BottomLeft:[HM],BottomRight:[kM],Center:[WM],AutoDefault:[jR,kR,HR,WR]};function JR(i,r){r=r||{};let e=ZR[i];if(e!=null)return jE(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=kS[i];if(t!=null)return HS(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function jE(i,r,e,t){return{objectType:pE,type:i,locations:r,currentLocation:0,id:G(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function KR(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function Cu(i,r,e){let t=St(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&zM(t,e),t}function ZM(i){return i.objectType===pE}function St(i,r){if(ZM(i))return i;if(r!=null&&(isNaN(r.offsetX)&&(r.offsetX=0),isNaN(r.offsetY)&&(r.offsetY=0),isNaN(r.ox)&&(r.ox=0),isNaN(r.oy)&&(r.oy=0)),X(i)){let e=JR(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(KR(i))return jE(null,[{x:i.x,y:i.y,ox:i.ox,oy:i.oy,offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY}],{},r);if(Array.isArray(i)){let e=i.map(t=>{if(X(t)){let n=ZR[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(KR(t))return Object.assign({iox:t.ox,ioy:t.oy,offx:t.offsetX==null?0:t.offsetX,offy:t.offsetY==null?0:t.offsetY,cls:null},t)}).filter(t=>t!=null);return jE("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return JR(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var JM="___sourceMarker",KM="___targetMarker",_u="__label",KS="vjs-default-label",WS="overlay",QR="labelLocation";function qM(i,r){let e=null;if(X(r))e=at.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=at.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||G(),Ne.cacheTypeItem(i,WS,e,e.id),i.overlays[e.id]=e,e}function Hl(i,r){let e=qM(i,r);if(e.type===gr.type&&!X(r)){let t=e,o=r.options.labelLocationAttribute||QR,s=i.edge.data[o];s&&(t.location=s),FE(t,i.edge.data)}return e}function kE(i,r){return i.overlays[r]}function eL(i){return i.overlays}function tL(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!1)}function rL(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!0)}function ko(i,r,e){let t=i.overlays[r];t&&(i.instance.setOverlayVisible(t,!1),e||i.instance.destroyOverlay(t),delete i.overlays[r],i.overlayPositions&&delete i.overlayPositions[r],i.overlayPlacements&&delete i.overlayPlacements[r])}function QM(i){return kE(i,_u)}var ZS="add",JS="remove",Pu="anchors",HE="connector";function qR(i,r,e){for(let t in i.overlays)r===ZS?i.instance.$addOverlayClass(i.overlays[t],e):r===JS&&i.instance.$removeOverlayClass(i.overlays[t],e)}function qS(i,r,e){let t=null;r.connector!=null&&(t=Ne.getCachedTypeItem(i,HE,e.connector),t==null&&(t=Qt.su(i,r.connector,e.connector),Ne.cacheTypeItem(i,HE,t,e.connector)),Qt.setPreparedConnector(i,t)),Ne.applyType(i,r,e);let n={};function o(h,d){let u=h.options;if(d)return d.updateFrom(u,i.edge.data),n[u.id]=!0,i.instance.$reattachOverlay(d,i),d;{let p=Ne.getCachedTypeItem(i,WS,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.cs!==Zi&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=Hl(i,h),n[p.id]=!0,p}}if(r.overlays)for(let h in r.overlays)o(r.overlays[h],i.overlays[r.overlays[h].options.id]);if(r.sourceMarker){let h=i.sourceMarker==null?null:i.sourceMarker.id===r.sourceMarker.options.id?i.sourceMarker:null;i.sourceMarker=o(r.sourceMarker,h)}else i.sourceMarker=null;if(r.targetMarker){let h=i.targetMarker==null?null:i.targetMarker.id===r.targetMarker.options.id?i.targetMarker:null;i.targetMarker=o(r.targetMarker,h)}else i.targetMarker=null;for(let h in i.overlays)i.overlays[h].ignoreTypes!==!0&&n[i.overlays[h].id]==null&&ko(i,i.overlays[h].id,!0);r.detachable!=null&&(i.detachable=r.detachable===!0),r.reattach!=null&&(i.reattach=r.reattach===!0),r.scope&&(i.scope=r.scope);let s=null;r.anchor?(s=Ne.getCachedTypeItem(i,Pu,e.anchor),s==null&&(s=[St(r.anchor),St(r.anchor)],Ne.cacheTypeItem(i,Pu,s,e.anchor))):r.anchors&&(s=Ne.getCachedTypeItem(i,Pu,e.anchors),s==null&&(s=[St(r.anchors[0]),St(r.anchors[1])],Ne.cacheTypeItem(i,Pu,s,e.anchors))),s!=null&&(i.anchors.source=s[0],i.anchors.target=s[1]);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Wr(i,r){Ne.addClass(i,r),qR(i,ZS,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function Pr(i,r){Ne.removeClass(i,r),qR(i,JS,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var Qt={getAbsoluteOverlayPosition(i,r){return i.overlayPositions?i.overlayPositions[r.id]:null},setPreparedConnector(i,r,e,t,n){if(i.connector!==r){let o,s="";if(i.connector!=null&&(o=i.connector,s=i.instance.$getConnectorClass(i.connector),i.instance.$destroyConnector(i)),i.connector=r,n&&Ne.cacheTypeItem(i,HE,r,n),Wr(i,s),o!=null){let a=eL(i);for(let l in a)i.instance.$reattachOverlay(a[l],i)}e||i.instance.$paintConnection(i)}},destroy(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions={},i.sourceElement=null,i.targetElement=null,i.instance.$destroyConnector(i),i.connector=null,Ne.destroy(i)},setVisible(i,r){Ne.setVisible(i,r),r?rL(i):tL(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},su(i,r,e){let t={},n;if(X(r))n=ze.get(i,r,t);else{let o=r;n=ze.get(i,o.type,bn(o.options||{},t))}return e!=null&&(n.typeId=e),n},au(i,r,e,t,n){let o=Qt.su(i,r,n);Qt.setPreparedConnector(i,o,e,t,n)}};function QS(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function nL(i,r,e){for(let t in r)i[t]=e}var eV="connector",tV="override",rV="cssClass",iL="__default",nV="anchor",iV="anchors";function WE(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return nL(e,t,iL),i.$types.forEach(o=>{if(o!==iL){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([eV,nV,iV]);if(s.mergeStrategy===tV)for(let l in s)a.add(l);n=bn(n,s,[rV],Array.from(a)),nL(e,s,o)}}}),r&&(n=fo(n,r,"_")),oa(i)&&qS(i,n,e),e}function oa(i){return i.objectType===ZE}var ZE="connection";function eT(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&oa(i)&&Pr(i,e.cssClass)}function Ou(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var oV="add",sV="remove";function tT(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||G(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var Ne={create(i,r,e){e=e||{};let t=e.cssClass||"",n=e.hoverClass||i.defaults.hoverClass,o=new Set,s={},a=e.id||r+new Date().getTime(),l={scope:e.scope||i.defaultScope,overlays:{}};return{cssClass:t,instance:i,hoverClass:n,$types:o,$typeCache:s,$defaultType:l,id:a}},addClass(i,r){let e=(i.cssClass||"").split(" ");e.push(r),i.cssClass=e.join(" ")},removeClass(i,r,e){let t=(i.cssClass||"").split(" ");i.cssClass=t.filter(n=>n!==r).join(" ")},cacheTypeItem(i,r,e,t){i.$typeCache[t]=i.$typeCache[t]||{},i.$typeCache[t][r]=e},hasType(i,r){return i.$types.has(r)},removeType(i,r,e){let t=QS(r),n=!1,o=s=>i.$types.has(s)?(eT(i,s),i.$types.delete(s),!0):!1;if(t!=null){for(let s=0,a=t.length;s<a;s++)n=o(t[s])||n;n&&WE(i,e)}},addType(i,r,e){let t=QS(r),n=!1;if(t!=null){for(let o=0,s=t.length;o<s;o++)i.$types.has(t[o])||(i.$types.add(t[o]),n=!0);n&&WE(i,e)}},getCachedTypeItem(i,r,e){return i.$typeCache[e]?i.$typeCache[e][r]:null},setPaintStyle(i,r){i.paintStyle=r,i.paintStyleInUse=i.paintStyle,Ou(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,Ou(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{eT(i,e)}),i.$types.clear(),WE(i,r)},setType(i,r,e){return Ne.clearTypes(i),(QS(r)||[]).forEach(i.$types.add,i.$types),WE(i,e)},applyType(i,r,e){Ne.setPaintStyle(i,r.paintStyle),Ne.setHoverPaintStyle(i,r.hoverPaintStyle),i.paintStyleInUse=i.paintStyle},appendToDefaultType(i,r){Object.assign(i.$defaultType,r)},destroy(i){i.deleted=!0,delete i.instance},setVisible(i,r){i.visible=r}};function oL(i,r){return r.theta-i.theta}function sL(i,r){let e=i.theta<0?-Math.PI-i.theta:Math.PI-i.theta,t=r.theta<0?-Math.PI-r.theta:Math.PI-r.theta;return e-t}var rT={[Pt]:sL,[Ot]:oL,[Rt]:oL,[_t]:sL};function nT(i,r,e,t,n){let o=e?i.width:i.height,s=e?i.height:i.width,a=[],l=o/(r.length+1);for(let h=0;h<r.length;h++){let d=(h+1)*l,u=t*s;n&&(d=o-d);let p=e?d:u,g=i.x+p,m=i.width===0?0:p/i.width,E=e?u:d,y=i.y+E,x=i.height===0?0:E/i.height;if(i.r!==0&&i.r!=null){let f=Me({x:g,y},i.c,i.r);g=f.x,y=f.y}a.push({x:g,y,xLoc:m,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Wo(i){return!i.isFixed&&i.isContinuous===!0}function iT(i){return[i.currentLocation,i.locations[i.currentLocation]]}function aV(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=Dt(i,o,n),a=Dt(o,i,n),l=Math.min(s[0].x,s[1].x,a[0].x,a[1].x),h=Math.max(s[0].x,s[1].x,a[0].x,a[1].x),d=Math.min(s[0].y,s[1].y,a[0].y,a[1].y),u=Math.max(s[0].y,s[1].y,a[0].y,a[1].y);return{x:l,y:d,width:h-l,height:u-d}}function Ru(i,r,e,t){let n,o=t.rotation,s={curX:r.x+i.x*e.width+(isNaN(i.offsetX)?0:i.offsetX),curY:r.y+i.y*e.height+(isNaN(i.offsetY)?0:i.offsetY),x:i.x,y:i.y,ox:i.ox,oy:i.oy};if(o!=null&&o.length>0&&!(o.length===0&&o[0].r===0)){let a=[i.ox,i.oy],l={x:s.curX,y:s.curY,cr:0,sr:0};o.forEach(h=>{l=Me(l,h.c,h.r),a=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)].slice()}),n={curX:l.x,curY:l.y,x:i.x,y:i.y,ox:a[0],oy:a[1]}}else n=Object.assign({},s);return n}function aL(i,r,e,t,n,o,s,a){let l=Nr(r),h=xb(r),d=s(e,t,l,h);d.sort((p,g)=>{let m=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=g.axis===l&&g.directionFromParent===r.directionFromParent,x=g.axis===l&&g.directionFromParent!==r.directionFromParent;return m||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let g=d[p],m=e+g.dx,E=t+g.dy,y=g.axis,x=g.directionFromParent,f=r.ax+g.dx*n,b=r.ay+g.dy*n,A=i.getCell(m,E,null,null),T=A===a,S={cx:m,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(m-r.x===0||E-r.y===0?1:Math.SQRT2),obstacles:A.obstacles,buffers:A.buffers,isTarget:T};if(A===a)return[S];u.push(S)}return u}function oT(i){let r=[],e=Nr(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Nr(t)!==e&&(n=!0),t=t.parent;return r.length===0?null:{source:i,target:r[r.length-1],isFirstSegment:r[r.length-1].parent==null,axis:Nr(i),length:o}}function lV(i){return i.axis===Tn||i.axis===Qn}function hV(i){return i.axis===pe&&i.source.ax===i.target.ax||i.axis===ne&&i.source.ay===i.target.ay}function lL(i,r,e){r.push({ax2:i.source.ax,ay2:i.source.ay,ax1:i.target.ax,ay1:i.target.ay,axis:i.axis,pathId:e})}function cV(i,r,e){if(lV(i)||hV(i))lL(i,r,e);else{let t=i.axis===ne?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===pe?(i.source.ay+i.target.ay)/2:i.source.ay,o=i.axis===ne?(i.source.ax+i.target.ax)/2:i.target.ax,s=i.axis===pe?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===pe?ne:pe,l={ax2:i.source.ax,ay2:i.source.ay,ax1:t,ay1:n,axis:i.axis,pathId:e};r.push(l);let h={ax2:t,ay2:n,ax1:o,ay1:s,axis:a,pathId:e};r.push(h);let d={ax2:o,ay2:s,ax1:i.target.ax,ay1:i.target.ay,axis:a,pathId:e};r.push(d)}}function hL(i,r,e){if(e===ne)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===pe)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===Tn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===Qn)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function sT(i,r,e,t,n,o){let s=i,a=[];n=n||G();let l=oT(s);if(l.isFirstSegment)t===tn?lL(l,a,n):cV(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,g=oT(l.target);for(;!p&&g!=null;){let m=hL(d,u,l.axis),E;E=hL(g.isFirstSegment?g.target.ax:g.target.cx,g.isFirstSegment?g.target.ay:g.target.cy,g.axis);let y=Lx(m,E);y!=null&&(a.push({ax1:y.x,ay1:y.y,ax2:d,ay2:u,axis:l.axis,pathId:n}),d=y.x,u=y.y,l=g),g.isFirstSegment?p=!0:g=oT(g.target)}g!=null&&a.push({ax1:g.target.ax,ay1:g.target.ay,ax2:d,ay2:u,pathId:n,axis:g.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function cL(i,r,e,t,n,o){let s=sT(i,r,e,t,o,!1);if(s.segments.length<2)return s;let a=[],l=0,h=!1;function d(u){let p={x:s.segments[u].ax1,y:s.segments[u].ay1},g=u+1,m=!1;for(;!m;){let E=s.segments[g];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:g-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[g-1].ax2,ay2:s.segments[g-1].ay2},finished:E==null};g++}}for(;!h;){let u=d(l);a.push(u.segment),u.finished?h=!0:l=u.endIdx+1}return{targetCell:s.targetCell,sourceCell:s.sourceCell,isEmpty:s.isEmpty,segments:a,id:s.id}}function dL(i,r,e,t,n,o,s,a,l,h,d,u,p,g,m,E,y){E==null?E=new Ns(i,r,s,h,d,u):E.reinitialize();let x=E.Ko(i.x,i.y),f=E.Ko(r.x,r.y),b=Dm(n);b.axis==null&&(b.axis=yb(i,r));let A=Dm(o),T=E.setSourceCell(e,x.x,x.y,i.x,i.y,b.axis,b.direction),S=E.setTargetCell(t,f.x,f.y,r.x,r.y,A.axis,A.direction);if(S.x===T.x&&S.y===T.y)return{targetCell:S,sourceCell:T,segments:[],id:Lm,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let O=T,v=S,_=()=>a===tn?cL(v,O,E,a,m,y):sT(v,O,E,a,y,!0),P=new Kc,I=new Ts(P.sort.bind(P),T),C,R,w=vc(T.x,T.y,S.x,S.y)*100,B=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,R=Nr(C),B++,B>w)throw`too many iterations ${B} `;if(C===S)return _();P.node=C;let N=aL(E,C,C.x,C.y,s,u,g,S);for(let V=0,D=N.length;V<D;V++){let $=N[V];if($.isTarget)return $.obj.parent=C,_();if($.obj.closed||$.obj===T||$.obj===S||$.obstacles.length>0||$.buffers.length>0)continue;let K=0;$.axis!==R&&(K=.5),(!$.obj.opened||$.g<$.obj.g)&&($.obj.g=$.g,$.obj.h=l($.cx,$.cy,S.x,S.y)+K,$.obj.f=$.obj.g+$.obj.h,$.obj.parent=C,$.obj.ax=$.ax,$.obj.ay=$.ay,$.obj.opened?I.update($.obj):(I.add($.obj),$.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:Lm,isEmpty:!0}}function aT(i,r,e,t,n,o,s,a,l,h,d,u,p,g){return dL(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(m,E,y,x)=>{if(l===tn||l==null)return wm(m,E,y,x);if(l===Mc)return wm(m,E,y,x);if(l===rn)return Eb(m,E,y,x)},(m,E)=>{let y=a*d;return s.hasLineOfSight(E,y,m.sourceAndTargetObstacles)},p,g)}var dV=10;function uV(i,r,e,t,n,o,s){let a=t.x+i.x*n.width,l=t.y+i.y*n.height;if(o!=null&&o.length>0){let h=Bx([a,l,0,0],o);a=h.x,l=h.y}return Math.sqrt(Math.pow(r-a,2)+Math.pow(e-l,2))}var kl=class{constructor(r,e){this.instance=r;c(this,"lu");c(this,"$anchorLists",new Map);c(this,"hu");c(this,"Ii");c(this,"Vi");c(this,"Mi");c(this,"us",new Map);c(this,"cu",null);c(this,"Et");e=e||{},this.Ii=e.gridCellSize||dV,this.hu=e.avoidVertices===!0,this.Vi=e.vertexBuffer||2,this.Mi=e.vertexBorder||2}$computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=ft(t),a=Jn(t),l=ft(n),h=Jn(n),d=this.instance.$getRotations(r.sourceId),u=this.instance.$getRotations(r.targetId);if(j(t.modelObject)){let x=this.instance.getElement(t.modelObject.parent.id);if(x.r!==0){let f={x:s.x+a.width/2,y:s.y+a.height/2},b=Me(f,x.c,x.r);s.x=b.x-a.width/2,s.y=b.y-a.height/2,d.pop(),d.push({r:x.r,c:b})}}if(j(n.modelObject)){let x=this.instance.getElement(n.modelObject.parent.id);if(x.r!==0){let f={x:l.x+h.width/2,y:l.y+h.height/2},b=Me(f,x.c,x.r);l.x=b.x-h.width/2,l.y=b.y-h.height/2,u.pop(),u.push({r:x.r,c:b})}}let p=this.du(r.anchors.source,{xy:s,wh:a,elementId:t.id,timestamp:e,rotation:d,txy:l,twh:h}),g=this.du(r.anchors.target,{xy:l,wh:h,elementId:n.id,timestamp:e,rotation:u,txy:s,twh:a});oS(r.connector);let m={sourcePos:p,targetPos:g,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=bE(o,m),yE(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let E=o.geometry==null||o.geometry.source==null?!1:!vE(p,o.geometry.source),y=o.geometry==null||o.geometry.target==null?!1:!vE(g,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(E||y)&&Yi(r),o.edited){let x=this.df(r,o,m,e,E,y);ze.setGeometry(r,x,!1)}else{let x=this.uf(r,o,m,e);ze.setGeometry(r,x,!0)}xE(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}$connectionDetachedFromElement(r,e){this.pf(r,e)}$connectionRemoved(r){Wo(r.connection.anchors.source)&&this.uu(r.connection.sourceId,r.connection.anchors.source),Wo(r.connection.anchors.target)&&this.uu(r.connection.targetId,r.connection.anchors.target)}$elementRemoved(r){r!=null&&this.$anchorLists.delete(r.id)}$redrawConnections(r,e){let t=new Set,n=new Set;if(!this.instance.yt){e=e||G();let o={};for(let s=0;s<r.length;s++){let a=r[s];if(a.visible===!1)continue;t.add(a);let l=a.sourceId,h=a.targetId,d=Wo(a.anchors.source),u=Wo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),g=(a.anchors.target.faces||[]).join("-"),m=[l,p,h,g].join("-"),E=o[m];d&&!this.$anchorLists.has(l)&&this.$anchorLists.set(l,{top:[],right:[],bottom:[],left:[]}),u&&!this.$anchorLists.has(h)&&this.$anchorLists.set(h,{top:[],right:[],bottom:[],left:[]});let y=this.instance.viewport.getPosition(h),x=this.instance.viewport.getPosition(l);if(h===l&&(d||u))this.ps(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Te,t),this.ps(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Te,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.mf(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,m),o[m]=E),d&&this.ps(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.ps(h,a.anchors.target,E.theta2,-1,a,l,1,!0,E.a[1],t)}d&&n.add(l),u&&n.add(h)}}n.forEach(s=>{this.gf(s,this.$anchorLists.get(s))})}return t}$reset(){this.$anchorLists.clear(),this.us.clear()}pf(r,e){let t=this.$anchorLists.get(e.id),n=0;t!=null&&function(o){if(o){let s=a=>a.c.id===r.id;Nt(o.top,s),Nt(o.left,s),Nt(o.bottom,s),Nt(o.right,s),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t),n===0&&this.$anchorLists.delete(e.id)}Ef(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=Ru(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=iT(r);if(r.locations.length===1||s==null||a==null)t=Ru(h,n,o,e);else{let[d,u]=this.ff(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&(r.currentLocation=d),t=Ru(u,n,o,e)}}return t.curX=Io(t.curX),t.curY=Io(t.curY),r.computedPosition=t,t}gf(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(rT[o]),p=o===yt||o===Te,g=nT(t,u,l,h,p);for(let m=0;m<g.length;m++)g[m].a.locations[0]={x:g[m].xLoc,y:g[m].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},g[m].a.currentLocation=0}};n(ht,t,e.bottom,!0,1,{x:0,y:1}),n(Te,t,e.top,!0,0,{x:0,y:-1}),n(We,t,e.left,!1,0,{x:-1,y:0}),n(yt,t,e.right,!1,1,{x:1,y:0})}ps(r,e,t,n,o,s,a,l,h,d){this.$anchorLists.has(r)||this.$anchorLists.set(r,{top:[],right:[],bottom:[],left:[]});let u=this.$anchorLists.get(r),p=-1,g=-1,m={theta:t,order:n,c:o,elId:s,anchor:e},E=u[h],y=e.currentFace?u[e.currentFace]:null,x;if(y){let f=y.findIndex(b=>b.anchor.id===e.id);if(f!==-1){y.splice(f,1);for(let b=0;b<y.length;b++)x=y[b].c,x.placeholder!==!0&&d.add(x)}}for(let f=0;f<E.length;f++)x=E[f].c,x.placeholder!==!0&&d.add(x);if(p!==-1)E[p]=m;else{let f=l?g!==-1?g:0:E.length;E.splice(f,0,m)}e.currentFace=h}uu(r,e){let t=this.$anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;Nt(o.top,a),Nt(o.left,a),Nt(o.bottom,a),Nt(o.right,a),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t,e.id),n===0&&this.$anchorLists.delete(r)}du(r,e){let t=this.Ef(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}uf(r,e,t,n){return this.hu||r.avoidVertices?this.yf(r,e,t,n):this.ms(r,e,t)}df(r,e,t,n,o,s){return ze.update(r,e.paintInfo,t,o,s)}ms(r,e,t){return ze.compute(r,e.paintInfo,t)}yf(r,e,t,n){if(e.edited)this.ms(r,e,t);else{let o=e,s=lT(t.sourcePos,e.sourceGap),a=lT(t.targetPos,e.targetGap),l={x:s.curX+e.sourceStub*s.ox,y:s.curY+e.sourceStub*s.oy},h={x:a.curX+e.targetStub*a.ox,y:a.curY+e.targetStub*a.oy},d=Math.min(l.x,h.x),u=Math.max(l.x,h.x),p=Math.min(l.y,h.y),g=Math.max(l.y,h.y),m={x:d,y:p,width:Math.max(u-d,10),height:Math.max(g-p,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(m,0,[],!1))return this.ms(r,e,t);(this.Et==null||n!==this.lu)&&(this.Et=new Ns(l,h,this.Ii,this.Mi,this.Vi,(E,y,x)=>this.instance.viewport.findVerticesAtPoint(E,y,x))),this.lu=n;try{let E=r.edge?r.edge.id:r.id,y=aT(l,h,r.sourceId,r.targetId,s,a,this.instance.viewport,this.Ii,o.constrain,vc,this.Mi,this.Vi,this.Et,E);if(y.isEmpty)ze.compute(r,e.paintInfo,t);else{y.segments.unshift({ax1:s.curX,ay1:s.curY,ax2:l.x,ay2:l.y,axis:Ds(s.ox,s.oy),pathId:E}),y.segments.push({ax1:h.x,ay1:h.y,ax2:a.curX,ay2:a.curY,axis:Ds(a.ox,a.oy),pathId:E});let x=OE(y.segments.map(b=>Object.assign({x1:b.ax1,y1:b.ay1,x2:b.ax2,y2:b.ay2,o:b.axis||pV(b)},b)));return su(r.connector,x),{segments:o.$pathSegments,source:t.sourcePos,target:t.targetPos,quadrant:e.paintInfo.quadrant}}}catch(E){return this.ms(r,e,t)}}}mf(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.cu){let v=this.us.get(p);if(v!=null)return v}else this.us.clear();this.cu=u;let g={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:g.IDENTITY,a:[Te,Te]};let m=Math.atan2(n.c.y-t.c.y,n.c.x-t.c.x),E=Math.atan2(t.c.y-n.c.y,t.c.x-n.c.x),y=[],x={};((v,_)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[We]:{x:_[P][0].x,y:_[P][0].c.y},[yt]:{x:_[P][0].x+_[P][0].width,y:_[P][0].c.y},[Te]:{x:_[P][0].c.x,y:_[P][0].y},[ht]:{x:_[P][0].c.x,y:_[P][0].y+_[P][0].height}},_[P][1]!=null&&_[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=Fx(x[v[P]][I],_[P][1])})([it,vn],[[t,a],[n,l]]);let f=[Te,We,yt,ht];for(let v=0;v<f.length;v++)for(let _=0;_<f.length;_++)y.push({source:f[v],target:f[_],dist:Math.round(Pe(x.source[f[v]],x.target[f[_]]))});y.sort(function(v,_){if(v.dist<_.dist)return-1;if(_.dist<v.dist)return 1;{let P={[We]:0,[Te]:1,[yt]:2,[ht]:3},I=P[v.source],C=P[_.source],R=P[v.target],w=P[_.target];return I<C?-1:C<I?1:R<w?-1:w<R?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let _=y[v];if(!Wo(o)||XE(o,_.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=gE[P],R=this.Ii*(this.Mi+this.Vi),w={x:x.source[P].x+I*C.x,y:x.source[P].y+I*C.y,width:Math.max(1,Math.abs(R*C.x)),height:Math.max(1,Math.abs(R*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Wo(s)||XE(s,_.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=gE[P],R=this.Ii*(this.Mi+this.Vi),w={x:x.target[P].x+I*C.x,y:x.target[P].y+I*C.y,width:Math.max(1,Math.abs(R*C.x)),height:Math.max(1,Math.abs(R*C.y))};S[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[e],!1)}return S[P]})?A=y[v].target:A=null,b!=null&&A!=null)break}b==null&&(b=y[0].source),A==null&&(A=y[0].target);let O={a:[b,A],theta:m,theta2:E};return this.us.set(p,O),O}ff(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,g)=>{let m=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:m,y:E,idx:g}}),d=l.locations.map((p,g)=>{let m=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:g,x:m,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let g=0;g<d.length;g++){let m=Math.round(Pe(h[p],d[g]));u.push({d:m,idx:p,idx2:g})}return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}else{let h=t.x+n.width/2,d=t.y+n.height/2,u=a.map((p,g)=>({d:uV(p,h,d,r,e,o,s),idx:g}));return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}}};c(kl,"type",be);function pV(i){return i.axis!=null?i.axis:i.ax1===i.ax2?pe:i.ay1===i.ay2?ne:null}function lT(i,r){return{curX:i.curX+i.ox*r,curY:i.curY+i.oy*r,ox:i.ox,oy:i.oy,x:i.x,y:i.y}}var hT="fill",JE="stroke",cT="stroke-width",gV="strokeWidth",Le="svg",dT="defs",q="path",Be="circle",uT="ellipse",et="text",KE="tspan",Z="rect",Q="g",mV="version",EV="xmlns",pT="fill",qE="stroke-dasharray",fV="stroke-linejoin",yV="stroke-linecap",xV="stroke-miterlimit",bV="stroke-dashoffset",AV="stroke-opacity",SV="stroke",TV="stroke-width",Lu="vector-effect",wu="non-scaling-stroke",vV="text-anchor",Gt="http://www.w3.org/2000/svg",CV="http://www.w3.org/1999/xlink",PV="http://www.w3.org/1999/xhtml";var Du=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Re,ve],t=>{this.$properties.forEach(n=>{t.updates[n]!=null&&(this.$values[n]=t.updates[n])})})}getValue(r,e){return this.$values[r]||e}getValues(){return Object.assign({},this.$values)}};var uL=.5;function gT(i,r){var b,A;let e=tT(i,ZE,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=hi(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[_u]={type:gr.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||uL,id:_u,cssClass:KS,rotatable:r.labelsRotatable}}),r.sourceMarker){let T=hi(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=hi(r.targetMarker);T.options.location=1,T.options.direction=1,T.targetMarker=!0,e.$defaultType.targetMarker=T}let s=r.source,a=r.target,l=(r.anchors?r.anchors[0]:r.anchor)||i.$defaultAnchors[0]||i.$defaultAnchor,h=(r.anchors?r.anchors[1]:r.anchor)||i.$defaultAnchors[1]||i.$defaultAnchor,d=(b=r.edge.anchors)==null?void 0:b.source,u=(A=r.edge.anchors)==null?void 0:A.target,p=St(l,d),g=St(h,u),m=i.$_edgesDetachable;r.detachable===!1&&(m=!1);let E=i.$_reattachEdges===!0,y=Fs({},r.paintStyle||i.defaults.paintStyle);Ne.appendToDefaultType(e,{detachable:m,reattach:E,paintStyle:y,hoverPaintStyle:Fs({},r.hoverPaintStyle||i.defaults.hoverPaintStyle)}),r.outlineWidth&&(y.outlineWidth=r.outlineWidth),r.outlineColor&&(y.outlineStroke=r.outlineColor),r.lineWidth&&(y.strokeWidth=r.lineWidth),r.color&&(y.stroke=r.color),r.gradient&&(y.gradient=r.gradient),r.dashArray&&(y.dashArray=r.dashArray);let x=Object.assign(e,{anchorDefs:{source:l,target:h},anchors:{source:p,target:g},sourceId:r.edge.source.getFullId(),sourceElement:s,targetId:r.edge.target.getFullId(),targetElement:a,scope:r.scope,lastPaintedAt:null,visible:!0,paintStyle:r.paintStyle,hoverPaintStyle:r.hoverPaintStyle,detachable:m,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[it]:[],[vn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});Qt.au(x,r.connector||i.$defaultConnector,!0);let f=[be,r.type].join(" ");return/[^\s]/.test(f)&&Ne.addType(x,f,r.data),x}var Wl=class{constructor(r){c(this,"grid");c(this,"snap",!1);c(this,"fitGroupsToGrid",!1);r!=null&&(this.snap=r.snap===!0,this.grid=r.size,this.fitGroupsToGrid=r.fitGroupsToGrid!==!1)}};var Nu=class{constructor(r){c(this,"afterGroupCollapse");c(this,"afterGroupExpand");c(this,"afterGroupResize");c(this,"afterGroupShrink");c(this,"afterGroupGrow");c(this,"afterLayout");c(this,"afterDrag");c(this,"constant");c(this,"trackback");c(this,"trackbackThreshold");c(this,"constrainToViewport");c(this,"repositionDraggedElement");c(this,"grid");r=r||{},this.afterDrag=r.afterDrag===!0,this.constant=r.constant===!0,this.trackback=r.trackback!==!1,this.trackbackThreshold=r.trackbackThreshold,this.constrainToViewport=r.constrainToViewport===!0,this.repositionDraggedElement=r.repositionDraggedElement===!0,this.afterLayout=r.afterLayout===!0,this.afterGroupResize=r.afterGroupResize===!0,this.afterGroupShrink=r.afterGroupShrink===!0||this.afterGroupResize&&r.afterGroupShrink!==!1,this.afterGroupGrow=r.afterGroupGrow===!0||this.afterGroupResize&&r.afterGroupGrow!==!1,this.afterGroupCollapse=r.afterGroupCollapse===!0,this.afterGroupExpand=r.afterGroupExpand===!0,this.constant&&this.afterDrag&&(this.constant=!1),this.constant&&(this.repositionDraggedElement=!1)}};var pL={},ln={get:i=>{let r=pL[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{pL[i]=r}};function Xe(i){return function(r){ln.register(i,r)}}function Iu(i,r,e,t,n,o,s){s=s||r.minSize;let a=r.maxSize,l=r.padding||0,h=(s==null?void 0:s.width)||0,d=(s==null?void 0:s.height)||0,u=0,p=0;isFinite(i.xmin)&&i.xmin<l&&n&&(u=l-i.xmin),isFinite(i.ymin)&&i.ymin<l&&n&&(p=l-i.ymin);let g=(isFinite(i.xmax)?i.xmax:0)+u+l,m=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||g,g),y=Math.min((a==null?void 0:a.height)||m,m);if(E=Math.max(h,E),y=Math.max(d,y),e){if(isFinite(i.xmin)&&i.xmin>l&&t){let x=i.xmin-l,f=E-x;E=Math.max((s==null?void 0:s.width)||f,f),E>f&&(x-=E-f),u=-x}if(isFinite(i.ymin)&&i.ymin>l&&t){let x=i.ymin-l,f=y-x;y=Math.max((s==null?void 0:s.height)||f,f),y>f&&(x-=y-f),p=-x}}if(o.grid&&o.fitGroupsToGrid!==!1){let x=E/o.grid.width;E=o.grid.width*Math.ceil(x);let f=y/o.grid.height;y=o.grid.height*Math.ceil(f);let b=u/o.grid.width;u=o.grid.width*Math.ceil(b);let A=p/o.grid.height;p=o.grid.height*Math.ceil(A)}return{width:E,height:y,layoutShiftX:u,layoutShiftY:p}}function mT(i,r,e,t){let n=i.$_connMap[r.id];if(n){if(n.proxies==null||n.proxies[e]==null||n.proxies[e].length===0)return;let o=n.proxies[e].pop(),s=o.originalElement,a=o.element,l=o.originalAnchor;return t!=null&&(l=St(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===it?n.anchors.source=l:n.anchors.target=l,Qt.setVisible(n,o.originallyVisible),s}return null}function ET(i,r,e,t,n){let o=i.$_connMap[r.id];if(o){let s=e==="source"?0:1;if(n==null)if(Y(t.modelObject)){let d=i.view.getGroupDefinition(i.model.getNodeType(t.modelObject.data));n=St(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=St(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=wA(o.proxies[e]),l=a!=null?a.originalElement.id:e===it?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===it?o.anchors.source:o.anchors.target;e===it?o.anchors.source=n:o.anchors.target=n,i.$sourceOrTargetChanged(l,t.id,o,t.el,e),o.proxies[e].push({originalAnchor:h,element:t,originalElement:i.$getManagedElement(l),originallyVisible:o.visible}),Qt.setVisible(o,!0),i.$revalidateElementById(t.id)}}var _V=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function QE(i,r,e){r!=null&&(Kg(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,Fl)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(Kg(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,Fl))}function ef(i,r,e){if(r!=null){let t=r.connections.length;Nt(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,Fl)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&Nt(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,Fl)}}var OV=2,RV=2,Mu=class extends Ft{constructor(e,t,n,o,s){var l,h,d,u,p,g,m,E,y,x,f,b,A,T;super();c(this,"sl",[]);c(this,"al",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Gi",{});c(this,"hoverSuspended",!1);c(this,"yt",!1);c(this,"pu",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"ll",[]);c(this,"connectorClass",ta);c(this,"connectorOutlineClass",DS);c(this,"connectorPathClass",mu);c(this,"overlayClass",ra);c(this,"labelOverlayClass",IS);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"gs");c(this,"viewport",new vu(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"hl",new Map);c(this,"fe");c(this,"cl",new Set);c(this,"mu");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"gu");c(this,"Eu");c(this,"$isInMotion");c(this,"magnetizerProfile");c(this,"magnetizer");c(this,"$unrenderedVertices",new Map);c(this,"$unprocessedGroupMemberships",new Map);c(this,"$_useModelForSizes");c(this,"$_writeSizeToElements");c(this,"$_useModelForPositions");c(this,"$_allowUnattachedEdges");c(this,"$_edgesDetachable");c(this,"$_reattachEdges");c(this,"$paintConnectorOutline");c(this,"$connectorOutlineColor");c(this,"$connectorOutlineWidth");c(this,"K",1);c(this,"$collapsedGroupSizeCalculator");c(this,"fu");c(this,"dl");c(this,"ul");c(this,"view");c(this,"gridProfile");c(this,"$connectionEstablished");c(this,"vertexList",[]);c(this,"logicalPorts");c(this,"objectFilter");c(this,"layoutMap",new Map);c(this,"$_layout");c(this,"model");c(this,"dataSource");c(this,"$relayoutOnEdgeConnect");c(this,"$relayoutOnResize");c(this,"$relayoutOnVertexRemove");c(this,"Es");c(this,"rootElement");c(this,"$t",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||G(),this.gridProfile=new Wl(o.grid),this.$connectionEstablished=o.connectionEstablished||(S=>{}),this.logicalPorts=o.logicalPorts===!0,this.objectFilter=o.objectFilter||function(S){return!0},this.$defaultConnector=((l=o.edges)==null?void 0:l.connector)||Xr,this.gu=(h=o.edges)==null?void 0:h.sourceMarker,this.Eu=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>hi(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((g=o.edges)==null?void 0:g.anchors)||[null,null],this.$relayoutOnEdgeConnect=o.relayoutOnEdgeConnect,this.$relayoutOnResize=o.relayoutOnResize,this.$relayoutOnVertexRemove=o.relayoutOnVertexRemove,this.defaults={[xu]:null,[YS]:1,[jo]:{strokeWidth:2,stroke:"#000000"},[GE]:"vjs_defaultscope",[VE]:!0,[FS]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Gi,this.defaults),this.Gi[jo]!=null&&(this.Gi[jo].strokeWidth=this.Gi[jo].strokeWidth||2),this.mu=this.defaults[GE],this.allowNestedGroups=this.Gi[VE]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[$S]:OV,this.$_vertexBorder=o.edges?o.edges[GS]:RV,this.gs=((m=o.edges)==null?void 0:m.avoidVertices)===!0,this.$_allowUnattachedEdges=((E=o.edges)==null?void 0:E.allowUnattached)===!0,this.$_edgesDetachable=((y=o.edges)==null?void 0:y.detachable)!==!1,this.$_reattachEdges=((x=o.edges)==null?void 0:x.reattach)===!0,this.$paintConnectorOutline=((f=o.edges)==null?void 0:f.paintOutline)!==!1,this.$connectorOutlineWidth=((b=o.edges)==null?void 0:b.outlineWidth)||20,this.$connectorOutlineColor=((A=o.edges)==null?void 0:A.outlineColor)||"transparent",this.zoomToFitOnLoad=o.zoomToFit===!0,this.router=o.router?o.router(this):new kl(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.gs}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Nu(o.magnetizer||{}),this.magnetizer=new Li({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,O)=>{}}),this.Es=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.Es=!1),this.setContainer(n),this.$setView(o.view),this.pl(xt,S=>{let O=this.$_connMap[S.edge.getId()];if(O){let v=this.dataSource.getEdgeType(S.edge.data),_=[...new Set([be,v])];if(this.$_setConnectionType(O,_.join(" "),S.edge.data),this.Es===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(O,P,!0)}this.se(P=>{P.$edgeUpdated(S.edge,O)})}}),this.pl(id,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var O=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(O),this.se(v=>{v.$groupResized({element:O,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.pl(nd,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var O=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(O),this.se(v=>{v.$groupResized({element:O,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=nt.get(_s.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:xo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.fu=o.defaultCollapsedGroupSize||{width:200,height:150},this.dl=o.canCollapseGroup,this.ul=o.canExpandGroup}get defaultScope(){return this.mu}get $modelTopAttribute(){return this.model.modelTopAttribute}get $modelLeftAttribute(){return this.model.modelLeftAttribute}get $modelWidthAttribute(){return this.model.modelWidthAttribute}get $modelHeightAttribute(){return this.model.modelHeightAttribute}get $modelRotationAttribute(){return this.model.modelRotationAttribute}get currentZoom(){return this.K}getLayout(){return this.$_layout}$edgeTargetChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.target.getFullId(),s=this.$getManagedElement(o);s==null&&j(t.target)&&(s=this.yu(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this.xf(n,s,!_i(e.old))):(delete this.$_connMap[t.getId()],this.ml(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Target for Edge "+t.getId()+" changed to Node "+s.id+"; we have no valid connection.")}}$select(e){if(J(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,Wi)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,Yl)}else if(j(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,Wi)}}setSuspendRendering(e,t){}$deselect(e){if(J(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,Wi)}else if(rt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,Yl)}else if(j(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,Wi)}}$selectionCleared(e){this.$getSelector(this.fe,z(Yl)).forEach(t=>this.$removeClassFromElement(t,Yl)),this.$getSelector(this.fe,z(Wi)).forEach(t=>this.$removeClassFromElement(t,Wi))}yu(e){let t=this.getRenderedPort(e);if(t!=null)return this.$manage(t,e,null,null,null,!1)}$edgeSourceChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.source.getFullId(),s=this.$getManagedElement(o);s==null&&j(t.source)&&(s=this.yu(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.bf(n,s,!_i(e.old)):(delete this.$_connMap[t.getId()],this.ml(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Source for Edge "+t.getId()+" changed to Node "+t.source.getFullId()+"; we have no valid connection.")}}onDestroy(e){this.bind(Ii,e)}pl(e,t){this.sl.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(Ad)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=G();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire($r)}}zoomToFit(e){this.$zoomToFit(e)}zoomToFitIfNecessary(e){this.$zoomToFitIfNecessary(e)}zoomToElements(e){this.$zoomToElements(e)}cloneVertex(e,t){var o,s;let n=this.getObjectInfo(e,!1);if(n.obj){let a=t==null?void 0:t.newPosition,l=lt(n.obj.data);if(delete l.id,a!=null)l[this.$modelLeftAttribute]=a.x,l[this.$modelTopAttribute]=a.y;else{let d=((o=t==null?void 0:t.offsetPosition)==null?void 0:o.x)||50,u=((s=t==null?void 0:t.offsetPosition)==null?void 0:s.y)||50;l[this.$modelLeftAttribute]+=d,l[this.$modelTopAttribute]+=u}let h;return this.model.transaction(()=>{h=Y(n.obj)?this.model.addGroup(l):this.model.addNode(l),a==null&&(this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)!==!1||!this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)===!0)&&this.fs(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},ut),h}}xu(){let e,t,n,o,s,a=!1,l=G();for(e=0,n=this.dataSource.getGroupCount();e<n;e++)o=this.dataSource.getGroupAt(e),this.objectFilter(o)&&(this.$doRenderGroup(o),a=!0);for(e=0,n=this.dataSource.getNodeCount();e<n;e++)t=this.dataSource.getNodeAt(e),this.objectFilter(t)&&(this.$doRenderNode(t),a=!0);let h=this.dataSource.getAllEdges();for(e=0,n=h.length;e<n;e++)s=h[e],this.objectFilter(s)&&(this.bu(h[e],pl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.$t.length!==0}Af(e,t,n,o){let s=j(o.source)?o.source.getParent():o.source,a=j(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(j(o.source)?null:this.$getAttribute(e,ji)||this.$getAttribute(e,Hr)),h=n.targetPortType||(j(o.target)?null:this.$getAttribute(e,Hi)||this.$getAttribute(t,Hr));return{sourceDef:l!=null?this.view.getPortDefinition(l):this.view.getTypeDefinition(o.source),targetDef:h!=null?this.view.getPortDefinition(h):this.view.getTypeDefinition(o.target),sourceParentDef:this.view.getTypeDefinition(s),targetParentDef:this.view.getTypeDefinition(a)}}$_extractSimpleEdgeStyles(e,t){let n=!1;return _V.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}Sf(e,t,n,o){var O,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=j(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=j(s.target)?s.target.getParent():s.target,g=this.getElement(p.id),{sourceDef:m,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.Af(u.el,g.el,a,s),f={type:l,data:s.data,cost:s.getCost(),directed:s.isDirected(),geometry:s.geometry,id:s.id,edge:s,anchor:null,anchors:[null,null],source:t,target:n,sourceMarker:h.sourceMarker||this.gu,targetMarker:h.targetMarker||this.Eu};[yu,BS,US].forEach(_=>{h.hasOwnProperty(_)&&(f[_]=h[_])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(_,P,I,C,R)=>{if(C&&C[I]){let w=_[P]||[C[I],C[I]];w[R]=C[I],_[P]=w}};m!=null&&A(f,Xl,zl,m,0),E!=null&&A(f,Xl,zl,E,1);let T=f;if(T.avoidVertices=this.gs||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,fo(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(O=s.anchors)!=null&&O.source)f.anchors[0]=St(s.anchors.source);else{let _=a.positionOnSource||{x:0,y:0},P=m.anchorPositions||y.anchorPositions,I=m.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=Cu(P.slice(),null,_);else if(I!=null){let C=I(u.el,_,s.source,E);f.anchors[0]=C}}if(this.$manage(T.target,s.target,null,null,null,!1),(v=s.anchors)!=null&&v.target)f.anchors[1]=St(s.anchors.target);else{let _=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=Cu([a.targetAnchor]);else if(P!=null)f.anchors[1]=Cu(P.slice(),null,_);else if(I!=null){let C=I(g.el,_,s.target,E);f.anchors[1]=C}}this.Es===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=gT(this,f);if(S!=null){QE(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(ze.importGeometry(S,T.geometry),this.$repaintUIElementById(S.sourceId),this.$repaintUIElementById(S.targetId)),S.edge=s,this.$_connMap[s.getId()]=S,s.source.dummy&&(S.anchors.source.isFixed=!0,S.anchors.source.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),s.target.dummy&&(S.anchors.target.isFixed=!0,S.anchors.target.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.$relayoutOnEdgeConnect&&this.refresh(),(g.visible===!1||u.visible===!1)&&this.ys(s,!1),T.geometry||this.$repaintUIElementById(S.sourceId);let _={connection:S,edge:s,reason:e.reason};this.se(P=>P.$edgeRendered(_)),this.fire(Gb,_)}else U("VisuallyJs - WARN : An edge could not be rendered "+s+" and is being removed from the dataset."),this.model.removeEdge(s,this);return S}$graphClearStart(){this.$_layout&&this.$_layout.un(),this.layoutMap.clear(),this.reset()}$graphClearEnd(){}$groupRemoved(e){let t=this.viewport.getGroupElement(e.group.id);return t&&(this.vertexList=this.vertexList.filter(o=>o.id!==e.group.id),e.removeChildren===!1&&e.children.forEach(o=>{let s=this.$getManagedElement(o.id);o.data[this.$modelLeftAttribute]=s.x,o.data[this.$modelTopAttribute]=s.y,this.$appendElementToVertexLayer(s.el),this.$setViewportElementPosition(s,s)}),e.group.getPorts().map(o=>this.$getManagedElement(o.getFullId())).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.$__unmanage(t.el,e.removeChildren===!0,!0),this.se(o=>{o.$groupRemoved(t)})),t}bu(e,t,n,o,s,a){this.$t.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.$t.length,n=[];if(t>0){let o=[];for(let s=0;s<this.$t.length;s++)this.Tf(this.$t[s],e)==null?o.push(this.$t[s]):n.push(this.$t[s].edge);this.$t=o}return n}Tf(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.Sf(e,o,n,t)}$edgeAdded(e,t){if(e.source!==this||e.transient===!0&&e.source===this){let n=e.edge;if(this.objectFilter(n.source)&&this.objectFilter(n.target)){let o=this.view.getEdgeDefinition(this.dataSource.getEdgeType(n.data||{}));if(o&&o.ignore===!0)return;this.bu(n,e.reason,t,o,null,!this.$_dataLoading)}}}$edgeRemoved(e){if(e.edge.transient||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()];n&&(this.viewport.$removeEdge(t.id),this.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.ml(n,{fireEvent:!1,force:!0}),this.se(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?ze.importGeometry(o,t):Yi(o),this.$repaintUIElementById(e.source.getFullId()),this.fire(ti,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:sn(t.connector)}$nodeAdded(e){let t=e.node;this.objectFilter(t)&&this.$doRenderNode(t,e.eventInfo)}$groupAdded(e){let t=e.group;this.objectFilter(t)&&this.$doRenderGroup(t,e.eventInfo)}$portAdded(e){this.objectFilter(e.port.getParent())&&setTimeout(()=>this.$flushUnrenderedEdges(G()))}$vertexUpdated(e){if(e.vertex!=null){let t=this.getElement(e.vertex.getFullId());if(t){let n=null,o=e.vertex.data[this.$modelLeftAttribute],s=null,a=e.vertex.data[this.$modelTopAttribute];if(e.updates!=null){if((e.updates[this.$modelWidthAttribute]!=null||e.updates[this.$modelHeightAttribute]!=null)&&(n=e.vertex.data[this.$modelWidthAttribute],s=e.vertex.data[this.$modelHeightAttribute],this.$_useModelForSizes)){let d=this.$resolveVertexSizeFromModel(e.vertex,this.view.getTypeDefinition(e.vertex));this.$setElementSizeInUI(t.el,d.width,d.height),n=d.width,s=d.height,this.se(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this.Au(e.vertex,e.updates[this.$modelRotationAttribute],!1,!0)}let l=o,h=a;if(e.vertex.group!=null){let d=this.$_getGroupContentAreaInfo(e.vertex.group.id).pageOrigin;l+=d.x,h+=d.y}if(this.viewport.updateElement(t.id,l,h,n,s,null,e.vertex,!1),(e.updates[this.$modelLeftAttribute]!=null||e.updates[this.$modelTopAttribute]!=null)&&this.$setViewportElementPosition(t,{x:o,y:a}),this.$doVertexUpdated(t),this.$repaintUIElement(this.getElement(t.id)),e.reason===js&&this.gs){let d=this.model.getAllEdges().filter(u=>Kn(u.source).id!==e.vertex.id&&Kn(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===Nd?this.vf(this.getElement(t.id),e.originalData):this.fire(Ys,this.getElement(t.id)),this.se(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}vf(e,t){let n={x:t[this.$modelLeftAttribute],y:t[this.$modelTopAttribute]},o={dragGroup:[{element:e,vertex:e.modelObject,pos:{x:e.x,y:e.y},originalPos:n}],positions:{[e.id]:{x:e.x,y:e.y}},ui:this},s=Y(e.modelObject)?Vr:Vt;this.fire(s,o)}Cf(e){this.fire(Ce,e)}getLayoutFor(e){return sm(e)||am(e)?this.layoutMap.get(e.group.id):this.$_layout}$groupMemberAdded(e){this.$_processGroupAddition(e,!1)||(this.$unprocessedGroupMemberships.has(e.group.id)||this.$unprocessedGroupMemberships.set(e.group.id,[]),this.$unprocessedGroupMemberships.get(e.group.id).push(e))}$_processGroupAddition(e,t){let n=this.$getManagedElement(e.vertex.id),o=this.viewport.getGroupElement(e.group.id);if(o!=null&&n!=null){this.$appendElement(n.el,o.contentArea);let s=this.$_getGroupContentAreaInfo(e.group.id),a=e.positionInGroup?e.positionInGroup.x:n.x-o.x,l=e.positionInGroup?e.positionInGroup.y:n.y-o.y;return this.$_updateVertexPositions({positions:{[n.id]:{x:a,y:l}},sizes:null,offset:{x:o.x+s.internalOffset.x,y:o.y+s.internalOffset.y},storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),e.source!=this&&this.relayoutGroup(e.group.id,hA),this.se(h=>{h.$groupMemberAdded(n)}),t||setTimeout(()=>this.$revalidateElement(n.el)),!0}else return!1}$groupMemberRemoved(e){let t=this.$getManagedElement(e.vertex.id),n=this.viewport.getGroupElement(e.group.id),o=this.$_getGroupContentAreaInfo(e.group.id);this.$appendElementToVertexLayer(t.el),this.$_updateVertexPositions({positions:{[t.id]:{x:t.x-n.x-o.internalOffset.x,y:t.y-n.y-o.internalOffset.y}},sizes:null,offset:null,storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.se(s=>{s.$groupMemberRemoved(t)})}$nodeRemoved(e){let t=this.$getManagedElement(e.node.id);return t&&(e.node.getPorts().map(o=>this.$getManagedElement(o.getFullId())).filter(o=>o!=null).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.vertexList=this.vertexList.filter(o=>o.id!==e.node.id),this.$__unmanage(t.el,!1,!0),this.se(o=>{o.$nodeRemoved(t)}),this.Cf(t)),t}$portRemoved(e){let t=this.$getManagedElement(e.port.getFullId());if(t){let n=this.$getManagedElement(e.port.getParent().id);n.el!==t.el?this.$__unmanage(t.el,!1,!1):(this.$removeAttribute(n.el,Bl),this.$removeAttribute(n.el,Hr))}}$edgeTypeChanged(e,t,n){let o=this.$_connMap[e.getId()];if(o){let s=this.view.getEdgeDefinition(n);if(s&&s.ignore===!0)return;s.connector&&Qt.au(o,s.connector),Ne.setType(o,n,e.data)}}$groupTypeChanged(e,t,n){}$nodeTypeChanged(e,t,n){this.$reRenderNode(e)}$portTypeChanged(e,t,n){}$vertexRendered(e,t,n,o){if(!t)throw new Error("Cannot render vertex");let s=J(e),a=Y(e);this.$setAttribute(t,te,e.getFullId());let l=s?ki:a?Xo:j(e)?MS:"";this.$addClassToElement(t,l),t.jtk=t.jtk||{},t.jtk[e.objectType.toLowerCase()]=e,t.jtk.vertex=e;let h=this.getElement(e.id),d=h!=null;if(d&&(this.$setAttribute(t,gt,this.$getAttribute(h.el,gt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,Wi)),J(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let m=this.Su(e.group);this.$appendElement(t,m)}let u=null,p=e.data[this.$modelRotationAttribute];this.$_useModelForSizes?(u=this.$resolveVertexSizeFromModel(e,n),this.$_writeSizeToElements!==!1&&this.$setElementSizeInUI(t,u.width,u.height),e.data[this.$modelWidthAttribute]=u.width,e.data[this.$modelHeightAttribute]=u.height):u=this.$getSize(t);let g=this.$manage(t,e,null,u,null,!1);if(p!=null&&this.Au(e,p,!this.$_dataLoading,!1),J(e)){if(!d){let m={el:t,id:e.id,vertex:e,size:u};this.fire(Fr,m)}}else if(Y(e)){let m={el:t,vertex:e,id:e.id,size:u},E=g,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:xo.type};this.layoutMap.set(e.id,this.Tu(x,e)),this.fire(Br,m),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender()?this.$dataLoadEnd(!1):this.$_dataLoading||(d&&this.se(m=>{m.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})}),this.$flushUnrenderedEdges(null),this.$unrenderedVertices.size===0&&this.refresh())}$redrawEveryConnection(){let e=G();this.vu(Object.values(this.$_connMap),e)}$redrawConnectionsForViewportElement(e,t,n){let o=e.connections||[];return this.vu(o,t,n),o}vu(e,t,n){this.router.$redrawConnections(e,t),e.forEach(o=>{this.$paintConnection(o,{timestamp:t,fireEvent:n})})}ys(e,t,n){let o=this.$_connMap[e.id];o&&Qt.setVisible(o,t)}isVisible(e){return this.Cu(e,t=>{switch(t.type){case Ue.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case ce.objectType:case se.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Ue.objectType:this.ys(s.obj,t,n);break;case ce.objectType:case se.objectType:this.Pf(s,t,n);break;case de.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.Cu(e,o)}Pf(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.ZA=t,e.managedElement.visible=t,this.fire(Sd,{node:e.obj,el:e.el,state:t}),!n)){let o=this.dataSource.getAllEdgesFor(e.obj);for(let s=0;s<o.length;s++)if(!t)this.ys(o[s],t,n);else{let a=Kn(o[s].source),l=Kn(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.ys(o[s],t,n)}}}Cu(e,t){let n;if(SA(e))n={nodes:[],edges:[]},e.eachVertex((o,s)=>{n.nodes.push(t(this.getObjectInfo(s,!1)))}),e.eachEdge((o,s)=>{n.edges.push(t(this.getObjectInfo(s,!1)))});else if(this.$isArrayLike(e)){n=[];for(let o=0;o<e.length;o++)n.push(t(this.getObjectInfo(e[o],!1)))}else n=t(this.getObjectInfo(e,!1));return n}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);return n!=null?n:this.$_getDefaultSizeForVertex(e,t)}$_getDefaultSizeForVertex(e,t){let n=J(e)?this.defaults.nodeSize||{width:100,height:80}:this.defaults.groupSize||{width:300,height:300};return t.defaultSize&&(n.width=t.defaultSize.width,n.height=t.defaultSize.height),n}$_getModelSizeForVertex(e){let t=e.data[this.$modelWidthAttribute],n=e.data[this.$modelHeightAttribute];if(t!=null&&n!=null)return{width:e.data[this.$modelWidthAttribute],height:e.data[this.$modelHeightAttribute]}}getContainer(){return this.fe}setZoom(e,t){return this.K=e,e}W(e){if(e==null)return null;let t=this.$getAttribute(e,gt);return(!t||t==="undefined")&&(t=`vjs-${G()}`,this.$setAttribute(e,gt,t)),t}setContainer(e){this.fe=e}Pu(e,t,n,o){let s=n===0?e.sourceId:e.targetId;if(o){let l=n===0?e.anchors.source:e.anchors.target;l.isFixed=!1,delete l.fixedLocation}let a={index:n,originalSourceId:n===0?s:e.sourceId,newSourceId:e.sourceId,originalTargetId:n===1?s:e.targetId,newTargetId:e.targetId,connection:e};return n===0?(a.newSourceId=t.id,e.sourceId=t.id,e.sourceElement=t.el):(a.newTargetId=t.id,e.targetId=t.id,e.targetElement=t.el),a}bf(e,t,n){ef(e,this.getElement(e.sourceId)),this.$repaintUIElement(this.getElement(e.sourceId));let o=this.Pu(e,t,0,n);QE(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(o.newSourceId))}xf(e,t,n){ef(e,this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(e.targetId));let o=this.Pu(e,t,1,n);QE(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$repaintUIElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=Ne.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.yt;return this.yt=e,e?this.pu=""+new Date().getTime():this.pu=null,this.yt||(this.autoSizeGroups(Array.from(this.cl.keys()).map(o=>o.modelObject)),this.cl.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.yt===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}Of(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}ml(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.Of(e)===!0)?(ef(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:ul,edge:e.edge}),delete this.$_connMap[e.id],Qt.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,gt)==null&&this.$setAttribute(e,gt,l);let h=this.getElement(l);if(h==null)h=this.viewport.addElement(l,e,t,n,o,s),this.yt||this.viewport.$refreshElement(l,!1,n,o);else if(a)return this.viewport.$refreshElement(l);return h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.W(s),l=this.getElement(a);this.router.$elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,gt),s&&n&&this.$removeElement(s)};t&&this.$getAssociatedElements(e).map(o),o(e)}rotate(e,t){this.getObjectInfo(e,!1).obj&&this.model.$_updateVertex(e,{[this.$modelRotationAttribute]:t},zs,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},bA,!1)},ut)}Au(e,t,n,o){let s=X(e)?e:e.id;if(this.getElement(s)){this.viewport.hf(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.se(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$repaintUIElementById(s)}}$getRotation(e){let t=this.getElement(e);return t!=null&&t.r||0}$getRotations(e){let t=[],n=this.getElement(e),o=s=>{if((J(s.modelObject)||Y(s.modelObject))&&s.modelObject.group){let a=this.getElement(s.modelObject.group.id);a!=null&&(t.push({r:a.r,c:a.c}),o(a))}};return n!=null&&(j(n.modelObject)?n=this.getElement(n.modelObject.parent.id):t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.W(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.viewport.$refreshElement(e.id),this.$repaintUIElement(e)):Tu()}repaintEverything(e){let t=G();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}$repaintUIElementById(e,t,n,o){this.$repaintUIElement(this.getElement(e),t,n,o)}$repaintUIElement(e,t,n,o){let s=Tu(),a=l=>{l.forEach(h=>s.add(h))};if(!this.yt){if(e!=null){let l=this.$getAssociatedElements(e.el).map(h=>this.getElement(this.W(h))).filter(h=>h!=null&&h.id!==e.id);t==null&&(t=G());for(let h=0;h<l.length;h++)(j(l[h].modelObject)||!n)&&this.viewport.$refreshElement(l[h].id);if(a(this.$redrawConnectionsForViewportElement(e,t,o)),l.length>0)for(let h=0;h<l.length;h++)a(this.$redrawConnectionsForViewportElement(l[h],t,o))}o&&this.fire(yd,e)}return s}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.$reset(),this.$t.length=0,this.$unrenderedVertices.clear(),this.cl.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(J)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.al.length;e++)this.off(this.fe,this.al[e][0],this.al[e][1]);this.reset(),this.unbind(),this.hl.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.hl.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=hi(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=hi(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=hi(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.hl.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===it?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===vn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),ef(n,h,d),QE(n,a,l))}gl(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=An(e);a.unshift(e),a.forEach(l=>{let h=this.viewport.getGroupElement(l.id),d=o[l.id]||this.viewport.$computeGroupContentExtents(l,!1,t,n,null),u=this.El(l,t,n,d,!1);if(u!=null&&(s[l.id]=u,n[l.id]=u.size,t[l.id]=u.position,(u.originalSize.width!==u.size.width||u.originalSize.height!==u.size.height)&&(this.$trackGroupSizeChanges({[l.id]:{element:h,originalGroupSize:u.originalSize,newGroupSize:u.size}}),l.group==null))){let p=u.size.width-u.originalSize.width,g=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||g<0)){let m=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let m=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.ul?this.ul(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.Ou(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[ME],[IE]);let l=new Set,h=new Set,d=new Set;this._u(n,l,h,d,!0),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!0)),l.forEach(p=>this.$_unproxyEdge(p.edge,p.index));let u={};if(this.$_useModelForSizes&&n.lastExpandedSize!=null&&(u[t.id]=n.lastExpandedSize,this.model.updateGroup(t,n.lastExpandedSize)),o!=null){let p=o;for(let g in p)this.model.updateVertex(g,p[g])}this.gl(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.se(p=>{p.$groupExpanded(n)}),this.fire(bd,{group:t})}}},ut,!0)}$_proxyEdge(e,t,n,o){ET(this,e,t,n,o)}$_unproxyEdge(e,t,n){return mT(this,e,t,n)}_u(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=hm(e.modelObject,!0,!0);this.viewport.$refreshElement(e.id),a.forEach(d=>{this.viewport.$refreshElement(d)});let h=sl(l,d=>!(a.indexOf(d.source.id)!==-1&&a.indexOf(d.target.id)!==-1));h.left.forEach(d=>{t.add({edge:d,index:a.indexOf(d.source.id)===-1?vn:it})}),h.right.forEach(d=>{o.add(d)}),this.Ru(e).forEach(d=>{this._u(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(X(e)?e:e.id);t!=null&&(t.collapsed?this.expandGroup(e):this.collapseGroup(e))}Ou(e){let t=null;if(e.modelObject.group==null)return null;{let n=e.modelObject.group;for(;n!=null;){let o=this.$getManagedElement(n.id);o.collapsed&&(t=o),n=o.modelObject.group}return t}}collapseGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o={width:n.width,height:n.height},s=this.dl==null?null:this.dl(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.Ou(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[IE],[ME]);let h=new Set,d=new Set;this.Lu(n,h,d),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!1)),h.forEach(p=>this.$_proxyEdge(p.edge,p.index,n));let u={};if(this.$_useModelForSizes){let p=this.$getCollapsedGroupSize(t,{width:n.width,height:n.height});u[t.id]=p,this.model.updateGroup(t,p)}if(s!=null){let p=s;for(let g in p)this.model.updateVertex(g,p[g])}this.gl(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.se(p=>{p.$groupCollapsed(n)}),this.fire(xd,{group:t})}}},ut,!0)}$computeCollapsedGroupSize(e,t){return this.$collapsedGroupSizeCalculator!=null?this.$collapsedGroupSizeCalculator(e,t):null}$getCollapsedGroupSize(e,t){try{let o=this.$computeCollapsedGroupSize(e,t);if(o!=null)return o}catch(o){U("ERROR: user function getGroupCollapsedSize threw error",o)}let n=this.getGroupDefinition(e);return n&&n.collapsedSize?n.collapsedSize:this.fu}Ru(e){return e.modelObject.members.filter(t=>t.objectType===se.objectType).map(t=>this.viewport.getGroupElement(t.id))}Lu(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=hm(e.modelObject,!0,!0);if(e.proxied!==!1){let a=sl(s,l=>!(o.indexOf(l.source.id)!==-1&&o.indexOf(l.target.id)!==-1));a.left.forEach(l=>{t.add({edge:l,index:o.indexOf(l.source.id)===-1?vn:it})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.Ru(e).forEach(a=>{this.Lu(a,t,n)})}_f(){return this.wu(this.dataSource.getGroups().filter(this.objectFilter))}wu(e){let t=[];return e.forEach(n=>{let o=An(n);t.push({group:n,depth:o.length})}),t.sort((n,o)=>n.depth===o.depth?0:n.depth>o.depth?-1:1),t}relayoutGroup(e,t){let n=Y(e)?e:this.dataSource.getGroup(e),o=this.layoutMap.get(n.id);if(o==null)return;let s=this.getElement(n.id),a=s;o.relayout(null,h=>{this.$_updateVertexPositions({positions:h.positions,sizes:h.sizes,resizedGroups:null,offset:{x:a.x,y:a.y},storePositionsInModel:!0,repaintConnections:!1,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.fire(vl,{element:s,positions:h.positions,sizes:h.sizes,extents:h.bounds})});let l=!0;this.$_dataLoading&&this.$_useModelForSizes&&(l=!1),t===lA&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=Tu();for(let s in e.positions){let a=e.positions[s],l=e.sizes!=null?e.sizes[s].width:null,h=e.sizes!=null?e.sizes[s].height:null,d=this.viewport.updateElement(s,a.x+t.x,a.y+t.y,l,h,null,null,!1);e.writeSizesToElements&&l!=null&&h!=null&&this.$setElementSizeInUI(this.getElement(s).el,l,h),n.add(this.getElement(s)),this.$setViewportElementPosition(d,a),e.storePositionsInModel&&this.$storePositionInModel({id:s,pos:a})}if(e.resizedGroups!=null)for(let s in e.resizedGroups){let a=e.resizedGroups[s].newGroupSize;this.viewport.updateElement(s,null,null,a.width,a.height,null,e.resizedGroups[s].group,!1),n.add(this.getElement(s)),this.$_useModelForSizes&&this.Rf(s,a)}if(e.rotations!=null)for(let s in e.rotations){let a=this.getElement(s);this.viewport.updateElement(s,null,null,null,null,e.rotations[s],null,!1),n.add(a),e.writeRotationsToElements&&this.$setElementRotation(a.el,e.rotations[s])}return e.repaintConnections&&n.forEach(s=>{this.$repaintUIElement(s).forEach(l=>o.add(l))}),o}relayout(e,t){this.Du(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},Pn,t)}refresh(e){this.Du(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Us,e)}Du(e,t,n,o){if(!this.yt){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let m in l)p.push(this.dataSource.getVertex(m));this.magnetizer.setElements(p);let g=this.magnetizer.executeAtCenter({getPosition:m=>l[m.id],getSize:m=>a.sizes[m.id]});for(let m in g.current)l[m]=g.current[m]}let h=this.Lf(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(m,E)=>h.info[m].positions[E]||this.getElementPosition(E),g=(m,E)=>a.sizes[E]||h.info[m].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(m=>{let E=Pi();m.group.members.forEach(x=>{let f=p(m.group.id,x.id),b=g(m.group.id,x.id);E.xmin=Math.min(E.xmin,f.x),E.ymin=Math.min(E.ymin,f.y),E.xmax=Math.max(E.xmax,f.x+b.width),E.ymax=Math.max(E.ymax,f.y+b.height)});let y=this.El(m.group,l,a.sizes,E,!1);if(y!=null&&(s[m.group.id]={group:m.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[m.group.id]!=null&&(l[m.group.id]=y.position),u[m.group.id]=this.$_getGroupContentAreaInfo(m.group.id),a.sizes[m.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[m.group.id].positions;for(let f in x)x[f].x+=y.layoutShiftX,x[f].y+=y.layoutShiftY}})}this.$_updateVertexPositions({positions:l,sizes:a.sizes,resizedGroups:s,offset:null,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),h.orderedGroups.reverse().forEach(p=>{let g=p.group.id,m=h.info[g],E=l[g]||ft(m.element),y=u[g]||this.$_getGroupContentAreaInfo(g);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:m.positions,sizes:m.sizes,resizedGroups:s,offset:E,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}),o!==!0&&this.repaintEverything(!0),t({bounds:a.bounds,positions:a.positions,sizes:a.sizes,layout:a.layout}),this.fire(n,{positions:a.positions,sizes:a.sizes,layout:a.layout});for(let p in h.info)this.fire(vl,h.info[p])})}}repaintEdge(e){let t=this.getRenderedConnection(e.id);this.$paintConnection(t)}repaintEdges(e){let t=G();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.yt&&e.visible!==!1){t=t||{};let n=t.timestamp;if(n!=null&&n===e.lastPaintedAt)return;if(n==null||n!==e.lastPaintedAt){this.router.$computePath(e,n);let o=e.sourceMarker;if(o!=null&&o.visible){let a=this.$drawOverlay(o,e.connector,e.paintStyleInUse);e.overlayPlacements[o.id]=a,e.connector.internalSegments.length>0&&(e.connector.internalSegments[0].x1=a.tail.x,e.connector.internalSegments[0].y1=a.tail.y)}let s=e.targetMarker;if(s!=null&&s.visible){let a=this.$drawOverlay(s,e.connector,e.paintStyleInUse);e.overlayPlacements[s.id]=a;let l=e.connector.internalSegments.length-1;e.connector.internalSegments.length>0&&(e.connector.internalSegments[l].x2=a.tail.x,e.connector.internalSegments[l].y2=a.tail.y)}for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l!==o&&l!==s&&l.visible&&(e.overlayPlacements[a]=this.$drawOverlay(l,e.connector,e.paintStyleInUse,Qt.getAbsoluteOverlayPosition(e,l)))}this.$paintConnector(e,e.paintStyleInUse);for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l.visible&&this.$paintOverlay(l,e.overlayPlacements[a],e.connector)}this.viewport.$updateEdge({id:e.edge.id,x:e.connector.x,y:e.connector.y,width:e.connector.width,height:e.connector.height})}e.lastPaintedAt=n,t.fireEvent&&this.fire(Pb,e),this.ll.length>0&&this.ll.forEach(o=>o.$edgeRedraw(e))}}$addOverlay(e,t,n){let o=Hl(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$repaintUIElementById(e.sourceId)),o}$removeOverlay(e,t){ko(e,t),this.$repaintUIElementById(e.sourceId)}$_setLineStyle(e,t,n){t.hasOwnProperty("lineWidth")&&(e.paintStyle.strokeWidth=t.lineWidth,e.hoverPaintStyle.strokeWidth=t.lineWidth),t.hasOwnProperty("outlineWidth")&&(e.paintStyle.outlineWidth=t.outlineWidth,e.hoverPaintStyle.outlineWidth=t.outlineWidth),t.hasOwnProperty("color")&&(e.paintStyle.stroke=t.color),t.hasOwnProperty("outlineColor")&&(e.paintStyle.outlineStroke=t.outlineColor),t.hasOwnProperty("dashArray")&&(e.paintStyle.dashArray=t.dashArray),Ou(e),n&&this.$paintConnection(e)}$setView(e){this.view=new Su(this.dataSource,this.dataSource.getModel(),e,this)}findIntersectingVertices(e){if(e.dontIncludeNodes===!0&&e.dontIncludeGroups===!0&&e.dontIncludeNodesInsideGroups===!0)return[];let t={x:e.origin.x,y:e.origin.y,width:e.dimensions.width,height:e.dimensions.height},o=(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(a=>{let l=J(a.modelObject),h=l&&sm(a.modelObject),d=Y(a.modelObject),u=d&&am(a.modelObject),p=e.dontIncludeNodes===!0&&l,g=e.dontIncludeGroups===!0&&d,m=e.dontIncludeNodesInsideGroups&&h,E=e.dontIncludeNestedGroups&&u;return!(p||g||m||E)}),s=e.filter||(()=>!0);return o.filter(a=>s(a.modelObject)).map(a=>({enclosed:e.enclosed,id:a.id,r:a,v:a.modelObject,el:a.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}Su(e){let t=this.viewport.getGroupElement(e.id);return t==null?null:this.$getGroupContentAreaElement(t.el)}$_getGroupContentAreaInfo(e){let t=this.viewport.getGroupElement(e);if(t==null)return{pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0},contentArea:null,isGroupElement:!0};{let n=this.$getGroupContentAreaElement(t.el);if(n!==t.el){let o=this.$getElementPositionInUIRelativeToParent(n);return{pageOrigin:{x:t.x+o.x,y:t.y+o.y},internalOffset:{x:o.x,y:o.y},contentArea:n,isGroupElement:!1}}else return{pageOrigin:{x:t.x,y:t.y},internalOffset:{x:0,y:0},contentArea:t.el,isGroupElement:!0}}}getElementPosition(e){return this.viewport.getElementPosition(e)}getElementSize(e){return this.viewport.getElementSize(e)}getElement(e){return this.viewport.getElement(e)}getGroupElement(e){return this.viewport.getGroupElement(e)}getObjectInfo(e,t){if(e==null)return{id:null,obj:null,el:null,type:null,managedElement:null};if(oa(e)){let n=e.edge;return{obj:n,id:n.id,type:Ue.objectType,el:e.connector.canvas,managedElement:null}}else if(this.$isElement(e)){let n=this.getModelObjectFromElement(e,!0,t);if(n!=null){let o=this.dataSource.resolveFullId(n.obj);return{el:n.el,obj:n.obj,type:n.obj.objectType,id:o,managedElement:this.getElement(o)}}else{let o=this.W(e);return{id:o,obj:null,el:e,type:null,uiOnly:!0,managedElement:this.getElement(o)}}}else{let n=this.dataSource.getObjectInfo(e);return n.obj!=null?n.type===Ue.objectType?Object.assign({el:this.getRenderedConnection(n.id).connector.canvas,managedElement:null},n):Object.assign({el:this.getRenderedElement(n.obj),managedElement:this.getElement(n.obj.getFullId())},n):Object.assign({el:null,managedElement:null},n)}}fl(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}wf(e,t,n,o,s,a,l,h,d,u){let p={invertTrackbackPreference:u};if(t&&(p.origin=t),n&&(p.gather=n),!h&&!d&&this.magnetizer.setElements(a),e){let m=this.getObjectInfo(e,!1);if(m.obj)if(!l)p.focus=m.obj.id;else{let E=this.getElement(m.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===m.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let g=this.getGrid();return g&&(p.grid=g),p}xs(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.fl());let p=this.wf(e,t,n,o,s,a,l,h,d,u);return p.focus!=null?this.magnetizer.executeWithFocus(p.focus,p):t!=null?this.magnetizer.executeAtPoint(t,p):this.magnetizer.executeAtCenter(p)}fs(e,t,n,o,s,a,l,h,d){let u=this.xs(e,t,n,o,s,null,a,l,h,d);this.bs(u,yA)}magnetize(e,t){this.fs(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.xs(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.xs(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.fs(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.fs(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.fl(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}Nu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}Df(e,t){let n=this.Nu(t);this.model.updateVertex(e,n)}bs(e,t,n){this.model.openTransaction(ut);try{for(let o in e.current){let s=this.Nu(e.current[o]);this.model.$_updateVertex(o,s,t,!1)}n&&n()}catch(o){U("Exception thrown when setting position",o)}finally{this.model.commitTransaction()}}$storePositionInModel(e){let t=typeof e=="string"?e:e.id,n=typeof e=="string"?null:e.pos,o=this.getModelPositionAttributes(),s=typeof e=="string"?o.x:e.leftAttribute||o.x,a=typeof e=="string"?o.y:e.topAttribute||o.y,l=e.obj||this.dataSource.getVertex(t);return l&&(n==null&&(n=this.getElementPosition(l.id)),De(l.data,s,n.x),De(l.data,a,n.y)),n}Rf(e,t){let n=X(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),De(n.data,this.$modelWidthAttribute,t.width),De(n.data,this.$modelHeightAttribute,t.height))}setMagnetizedPosition(e,t,n){this.setPosition(e,t,n,!0)}setPosition(e,t,n,o,s){let a=this.getObjectInfo(e,!1);if(a.obj)if(a.obj.group==null){let l=this.Nf(a.obj,t,n,o,s===!1,!1,!1,!1);this.bs(l,Nd)}else{let l=a.obj.group,h=this.viewport.getGroupElement(l.id);if(h!=null){let d={[a.id]:{x:t+h.x,y:n+h.y}},u={[a.id]:{x:t,y:n}},p=this.viewport.$computeGroupContentExtents(l,!1,d,null,null);this.bs({original:{},current:u},Nd,()=>{this.gl(l,u,null,{[l.id]:p})})}}}adHocGroupLayout(e,t){if(t){let n=this.dataSource.getObjectInfo(e);if(n.obj){let o=this.layoutMap.get(n.id);this.layoutMap.set(n.id,this.Tu(t,n.obj)),this.relayoutGroup(n.obj,aA),this.layoutMap.set(n.id,o)}}}getGroupDefinition(e){return this.view.getGroupDefinition(this.model.getNodeType(e.data))}getPortDefinition(e){return this.view.getPortDefinition(this.model.getPortType(e.data))}getNodeDefinition(e){return this.view.getNodeDefinition(this.model.getNodeType(e.data))}Nf(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.xs(e,{x:t,y:n},!1,{[e.id]:{x:t,y:n}},null,null,s,a,l,h);return u.original[e.id]={x:t,y:n},u.current[e.id]={x:t,y:n},u}else return this.If()&&(d=he(d,this.getGrid())),{original:{[e.id]:d},current:{[e.id]:d}}}getModelPositionAttributes(){return{x:this.$modelLeftAttribute,y:this.$modelTopAttribute}}storePositionsInModel(e){e=e||{};let t=this.getModelPositionAttributes(),n=e.leftAttribute||t.x,o=e.topAttribute||t.y,s=(a,l)=>{let h=this.getElement(l.id);De(l.data,n,h.x),De(l.data,o,h.y)};this.dataSource.eachNode((a,l)=>s(a,l)),this.dataSource.eachGroup((a,l)=>s(a,l))}setGrid(e){this.gridProfile==null?this.gridProfile=new Wl({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}If(){return this.gridProfile!=null&&this.gridProfile.snap}JA(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=he({x:t.width,y:t.height},this.gridProfile.grid);return this.$setElementSizeInUI(e,n.x,n.y),{width:n.x,height:n.y}}return null}snapToGrid(e,t){t=t||this.getGrid();let n;if(t){e!=null&&(n=this.getObjectInfo(e,!1).obj),n!=null?this.magnetizer.setElements([n]):this.magnetizer.setElements(this.fl());let o=this.magnetizer.snapToGrid(t);return this.bs(o,xA),o}}autoSizeGroup(e,t){let n=new Set;return n.add(e),this.$_sizeGroupsToFit(n,null,null,t)[e.id]}$_sizeGroupsToFit(e,t,n,o){let s=this.wu(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.Vf(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}Vf(e,t,n,o){let s={};n=n||{},o=o||{};let a=l=>{let h=this.viewport.getGroupElement(l.id),d=this.viewport.$computeGroupContentExtents(l,!1,null,o,null),u=this.El(l,n,o,d,t);u!=null&&(o[l.id]=u.size,s[l.id]={element:h,newGroupSize:u.size,originalGroupSize:u.originalSize},l.group&&a(l.group))};return e&&a(e),s}Lf(){let e={orderedGroups:this._f(),info:{}};return e.orderedGroups.forEach(t=>{let n=this.layoutMap.get(t.group.id);if(n!=null){let o=this.viewport.getGroupElement(t.group.id);n.relayout(null,s=>{e.info[t.group.id]={positions:s.positions,sizes:s.sizes,extents:s.bounds,element:o}})}}),e}getGroupContentExtents(e,t){return this.viewport.$computeGroupContentExtents(e,t,null,null,null)}$trackGroupSizeChanges(e){for(let t in e){let n=e[t];if(n.originalGroupSize.width!==n.newGroupSize.width||n.originalGroupSize.height!==n.newGroupSize.height){let o=n.element.modelObject,s={[this.$modelWidthAttribute]:n.newGroupSize.width,[this.$modelHeightAttribute]:n.newGroupSize.height};o.data[this.$modelWidthAttribute]=n.newGroupSize.width,o.data[this.$modelHeightAttribute]=n.newGroupSize.height;let a=this.viewport.updateElement(o.id,null,null,n.newGroupSize.width,n.newGroupSize.height,null,null,!1);this.$doVertexUpdated(a),this.$repaintUIElement(a,null,!0),this.model.fire(rd,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.se(l=>{l.$groupResized(n)}),this.model.fire(ve,{vertex:o,updates:s,originalData:o.data,reason:fA},null)}}}El(e,t,n,o,s){t=t||{},n=n||{};let a=this.getGroupDefinition(e),l=s||a.autoShrink||a.autoGrow||a.autoSize||a.elastic,h=a.autoShrink===!0||a.elastic===!0||a.autoSize===!0&&a.autoShrink!==!1,d=a.autoGrow===!0||a.elastic===!0||a.autoSize===!0&&a.autoGrow!==!1;if(!l)return null;let u=P=>t[P]||this.getElementPosition(P),p=P=>n[P]||this.getElementSize(P),g=this.$_getGroupContentAreaInfo(e.id),m=g.contentArea,E=0,y=0,x,f,b=p(e.id),A=g.isGroupElement?p(e.id):this.$getSize(m),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),O=Object.assign({},u(e.id)),v,_=null;if(_!=null)E=_.layoutShiftX,y=_.layoutShiftY,x=_.width,f=_.height,v={x:O.x-E,y:O.y-y};else{let P=Iu(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:O.x-E,y:O.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(m,x,f),!g.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,R=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),R<0&&(this.$setElementHeight(m,S-g.internalOffset.y),R=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),R>0&&(this.$setElementHeight(m,S-g.internalOffset.y),R=0,w=!0),w&&(I=this.$getSize(P.el))}x=I.width,f=I.height}return{position:v,size:{width:x,height:f},originalSize:{width:T,height:S},layoutShiftX:E,layoutShiftY:y}}autoSizeGroups(e,t){return e=e||this.getGroups(),this.$_sizeGroupsToFit(new Set(e),null,null,t)}Iu(e){let t={container:this.fe,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:De(n.data,this.$modelLeftAttribute),y:De(n.data,this.$modelTopAttribute)})),nt.get(e.type,t)}Tu(e,t){let n=this.Su(t);n==null&&(n=this.$getManagedElement(t.id).el);let o={container:n,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createGroupLayoutAdapter(t)};return o.options.locationFunction||(o.options.locationFunction=s=>{let a={x:De(s.data,this.$modelLeftAttribute),y:De(s.data,this.$modelTopAttribute)};return X(a.x)&&(a.x=parseInt(a.x,10)),X(a.y)&&(a.y=parseInt(a.y,10)),a}),nt.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.Iu(e),t||this.refresh())}adHocLayout(e){e&&this.model.transaction(()=>{for(let n in this.$_connMap){let o=this.$_connMap[n].edge;this.model.clearEdgeGeometry(o)}this.Iu(e).layout(n=>{for(let o in n.positions)this.Df(o,n.positions[o])})})}$_doRenderTransientVertex(e,t,n,o,s,a,l){let h=this.$renderTransientVertex(t,n,o,s,a,l);return this.$appendVertexElement(h),this.$manage(h,e,t,n,null,!1)}$addTransientVertex(e,t,n,o,s,a){let l=this.model.$addTransientVertex(n,this),h=this.$_doRenderTransientVertex(l,e,t,n,o,s,a);return{vertex:l,el:h}}$renderDummyVertex(e){let t={x:e.data[this.$modelLeftAttribute]||0,y:e.data[this.$modelTopAttribute]||0};this.$_doRenderTransientVertex(e,t,{width:1,height:1},e.data,{},[ki,VS].join(" "),{[te]:e.id})}$removeTransientVertex(e){this.model.$cleanupTransientVertex(e.modelObject,this)}$addTransientEdge(e,t,n,o){return this.model.$addTransientEdge(this,e,t,n,null,o)}$isUnattachedEdgeAllowed(e){let t=this.model.getEdgeType(e.data),n=this.view.getEdgeDefinition(t);return n.allowUnattached!=null?n.allowUnattached:this.$_allowUnattachedEdges===!0}Vu(e){(e.plugins||[]).forEach(n=>{this.Mu(n,!0)})}addPlugin(e){return this.Mu(e,!0)}Mu(e,t){let n=X(e)?e:e.type,o=X(e)?{}:e.options||{},s=ln.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),s.tracksEdgeRedraws&&this.ll.push(s),t&&this.fire(Td,s),s}getPlugin(e){return this.pluginMap.get(e)}se(e){this.plugins.forEach(t=>{try{e(t)}catch(n){U(`WARN: could not dispatch event to plugin ${t.id} [${n}]`)}})}registerDataHook(e){this.$_dataHooks.push(e)}save(e){let t={data:this.model.exportData(e),zoom:this.K};return this.$_dataHooks.forEach(n=>{n.save(t)}),t}saveToUrl(e){this.model.save(Object.assign(e,{data:this.save(e)}))}load(e,t){this.model.load({data:e.data,onload:()=>{e.zoom&&this.setZoom(e.zoom),this.$_dataHooks.forEach(n=>{n.load(e)}),t&&t()}})}$isArrayLike(e){return!X(e)&&Array.isArray(e)}};var LV=20,wV=20,tf=class tf extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"length");c(this,"foldback");c(this,"direction");c(this,"type",tf.type);c(this,"contentTags",[q]);n=n||{},this.width=n.width||LV,this.length=n.length||wV,this.direction=(n.direction||1)<0?-1:1,this.foldback=n.foldback||.623}draw(e,t,n){let o,s,a,l,h;if(this.location>1||this.location<0){let m=this.location<0?1:0;o=$e(e,m,this.location,!1),s=$e(e,m,this.location-this.direction*this.length/2,!1),a=jt(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=$e(e,this.location,-this.length),a=jt(o,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=$e(e,this.location,this.length),o=jt(a,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else o=$e(e,this.location,this.direction*this.length/2),s=ur(e,this.location),a=jt(o,s,this.length);l=Dt(o,a,this.width),h=jt(o,a,this.foldback*this.length);let{stroke:d,fill:u,lineWidth:p}=this.$getStyle(t);return{atts:[{d:isNaN(h.x)||isNaN(h.y)?"M 0 0":"M"+o.x+","+o.y+" L"+l[0].x+","+l[0].y+" L"+h.x+","+h.y+" L"+l[1].x+","+l[1].y+" Z","stroke-width":p,stroke:d,fill:u}],xmin:Math.min(o.x,l[0].x,l[1].x),xmax:Math.max(o.x,l[0].x,l[1].x),ymin:Math.min(o.y,l[0].y,l[1].y),ymax:Math.max(o.y,l[0].y,l[1].y),tail:h}}};c(tf,"type","Arrow");var _r=tf;at.register(_r.type,_r);var rf=class rf extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",rf.type);this.foldback=1}};c(rf,"type","PlainArrow");var Vu=rf;at.register(Vu.type,Vu);var nf=class nf extends _r{constructor(e,t,n){super(e,t,n);c(this,"type",nf.type);this.length=this.length/2,this.foldback=2}};c(nf,"type","Diamond");var Gu=nf;at.register(Gu.type,Gu);var of="Custom",sf=class extends li{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"rotatable");c(this,"type",of);this.create=n.create,this.rotatable=n.rotatable}updateFrom(e,t){}};function hn(i){return i.type===of}at.register(of,sf);var gL=5,af=class af extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Oe");c(this,"Hr");c(this,"type",af.type);c(this,"contentTags",[Be]);n=n||{},this.Oe=n.radius||gL,this.Hr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h;if(this.location===0)if(this.Hr==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=$e(e,this.location,this.Oe);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=$e(e,this.location,this.Oe);l=jt(d,u,this.Oe),h=$e(e,this.location,2*this.Oe)}else if(this.location===1)if(this.Hr==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=$e(e,this.location,-this.Oe);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=$e(e,this.location,-this.Oe);l=jt(d,u,this.Oe),h=$e(e,this.location,-2*this.Oe)}else l=ur(e,this.location),h=$e(e,this.location,this.Oe);return{atts:[{cx:l.x,cy:l.y,r:this.Oe,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Oe,xmax:l.x+this.Oe,ymin:l.y-this.Oe,ymax:l.y+this.Oe,tail:h}}};c(af,"type","Dot");var $u=af;at.register($u.type,$u);var mL=10,EL=10,lf=class lf extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"Gu");c(this,"Hr");c(this,"type",lf.type);c(this,"contentTags",[q]);n=n||{},this.width=n.width||mL,this.height=n.height||EL,this.Gu=n.rotate===!0,this.Hr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,O;if(this.Gu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},_,P;this.Hr==="center"?(P=$e(e,this.location,this.width/2),_=jt(P,v,this.width)):(_=v,P=$e(e,this.location,this.width)),S=Dt(P,_,this.height),O=Dt(_,P,this.height),g=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},_,P;this.Hr==="center"?(P=$e(e,this.location,-this.width/2),_=jt(P,v,this.width)):(_=v,P=$e(e,this.location,-this.width)),S=Dt(_,P,this.height),O=Dt(P,_,this.height),g=P}else{let v=$e(e,this.location,this.width/2),_=ur(e,this.location),P=jt(v,_,this.width);S=Dt(v,P,this.height),O=Dt(P,v,this.height),g=P}m=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=O[1].x,b=O[1].y,A=O[0].x,T=O[0].y}else{let v;this.location===0?v={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?v={x:e.paintInfo.tx,y:e.paintInfo.ty}:v=ur(e,this.location),g=v,m=v.x-this.width/2,E=v.y-this.height/2,y=m+this.width,x=E,f=y,b=E+this.height,A=m,T=E+this.height}return h=Math.min(m,y,f,A),d=Math.max(m,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${m} ${E} L ${y} ${x} L ${f} ${b} L ${A} ${T} Z`,{atts:[{"stroke-width":a,stroke:o,fill:s,d:l}],xmin:h,xmax:d,ymin:u,ymax:p,tail:g}}};c(lf,"type","Rectangle");var Bu=lf;at.register(Bu.type,Bu);var fL=8,yL=5,hf=class hf extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",hf.type);c(this,"contentTags",[uT]);n=n||{},this.rx=n.rx||fL,this.ry=n.ry||yL}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l;return this.location===0?l={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?l={x:e.paintInfo.tx,y:e.paintInfo.ty}:l=ur(e,this.location),{atts:[{cx:l.x,cy:l.y,rx:this.rx,ry:this.ry,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.rx,xmax:l.x+this.rx,ymin:l.y-this.ry,ymax:l.y+this.ry,tail:$e(e,this.location,(this.ry+this.rx)/2)}}};c(hf,"type","Ellipse");var Fu=hf;at.register(Fu.type,Fu);var Uu=class{constructor(r,e){this.surface=r;c(this,"or");c(this,"$u");e=e||{edgeMappings:[]},this.or=e.edgeMappings||[],this.$u=this.surface.model.edgeTypeFunction,this.Mf()}computeTypes(r){let e=[this.$u(r)];for(let t=0;t<this.or.length;t++){let n=this.or[t].property,o=this.or[t].mappings;if(X(n)){if(r[n]!=null){let s=X(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[pr]!=null&&r[n]!=null&&e.push(`${n}_${pr}`)}else{let s=n.map(a=>r[a]);if(s.every(a=>a!=null)){let a=s.join(" ");o[a]!=null&&e.push(`${n.join("_")}_${a.replace(/ /g,"_")}`)}}}return e.join(" ")}Mf(){for(let r=0;r<this.or.length;r++){let e=this.or[r].property,t=this.or[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=X(e)?`${e}_${n}`:`${e.join("_")}_${n.replace(/ /g,"_")}`;this.surface.$registerConnectionType(o,t[n])}}this.surface.model.edgeTypeFunction=r=>this.computeTypes(r)}getPropertyMappings(){return this.or}};function DV(i,r,e,t,n,o,s){return new Touch({target:i,identifier:G(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function NV(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function IV(i,r,e,t,n,o,s){return NV(DV(i,r,e,t,n,o,s))}function Zl(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function Yu(i){return i.srcElement||i.target}function fT(i,r,e,t){if(t){let n=i.composedPath?i.composedPath():i.path;if(typeof n!="undefined"&&n.indexOf)return{path:n,end:n.indexOf(e)};{let o={path:[],end:-1},s=a=>{o.path.push(a),a===e?o.end=o.path.length-1:a.parentNode!=null&&s(a.parentNode)};return s(r),o}}else return{path:[r],end:1}}function MV(i,r){let e=0,t;for(e=0,t=i.length;e<t&&i[e][0]!==r;e++);e<i.length&&i.splice(e,1)}var VV=1,xL=!1,bL=!1;function In(){return xL||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function ci(){return bL||"onmousedown"in document.documentElement}function vL(i){xL=i}function CL(i){bL=i}var Ji={[ge]:zb,[le]:Xb,[ae]:jb};function yT(i,r){if(i==null)return{x:0,y:0};let e=Zo(i),t=pf(e,0);return r(t)}function me(i){return yT(i,r=>({x:r.pageX,y:r.pageY}))}function GV(i){return yT(i,r=>({x:r.screenX,y:r.screenY}))}function $V(i){return yT(i,r=>({x:r.clientX,y:r.clientY}))}function pf(i,r){return i.item?i.item(r):i[r]}function Zo(i){return i.touches!=null&&i.touches.length>0?i.touches:i.changedTouches&&i.changedTouches.length>0?i.changedTouches:i.targetTouches&&i.targetTouches.length>0?i.targetTouches:[i]}function ST(i){return Zo(i).length}function PL(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=Zo(i),e=pf(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function cf(i,r,e,t,n){SL(i,r,e),t.ar=e.ar,i.addEventListener&&i.addEventListener(r,e,!1,n)}function zu(i,r,e){e!=null&&AL(i,t=>{BV(t,r,e),e.ar!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),In()&&Ji[r]&&t.removeEventListener(Ji[r],e,!1)),e.Bu&&zu(i,e.Bu[1],e.Bu[0])})}function AL(i,r){if(i==null)return;let e=typeof i=="string"?document.querySelectorAll(i):Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++)r(e[t])}function SL(i,r,e){let t=VV++;return i.Wr=i.Wr||{},i.Wr[r]=i.Wr[r]||{},i.Wr[r][t]=e,e.ar=t,t}function BV(i,r,e){if(i.Wr&&i.Wr[r]&&delete i.Wr[r][e.ar],e.Zr){for(let t=0;t<e.Zr.length;t++)zu(i,e.Zr[t][0],e.Zr[t][1]);e.Zr.length=0}e.yl&&e.yl()}var FV=/:not\(([^)]+)\)/;function df(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(FV);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(pr);let a=l=>{a.ar=e.ar;let h=Yu(l),d=!1,u=h,p=fT(l,h,r,i!=null);if(p.end!=-1)for(let g=0;!d&&g<p.end;g++){u=p.path[g];for(let m=0;m<s.length;m++)if(Zl(u,s[m],r))return;for(let m=0;!d&&m<o.length;m++)if(Zl(u,o[m],r)){e.apply(u,[l,u]),d=!0;break}}};return UV(e,t,a),a}}function UV(i,r,e){i.Zr=i.Zr||[],i.Zr.push([r,e])}var uf=(i,r,e,t,n)=>{if(In()&&Ji[r]){let o=df(t,i,e,Ji[r]);cf(i,Ji[r],o,e,n)}r===Ub&&i.getAttribute(wE)==null&&i.setAttribute(wE,"1"),cf(i,r,df(t,i,e,r),e,n)},xT={[W]:{touches:1,taps:1},[Ur]:{touches:1,taps:2},[At]:{touches:2,taps:1}};function TL(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var bT=class{static generate(r,e){return(t,n,o,s)=>{if(n==At&&ci())uf(t,n,o,s);else{if(t.ke==null){let a=t.ke={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let g=Yu(p),m=fT(p,g,t,s!=null),E=!1;for(let y=0;y<m.end;y++){if(E)return;g=m.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||Zl(g,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let g=Yu(p),m,E;a.taps++;let y=ST(p);for(let x in xT)if(xT.hasOwnProperty(x)){let f=xT[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=fT(p,g,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(m=E.path[A],a[x][b][1]==null||Zl(m,a[x][b][1],t)){a[x][b][0].apply(m,[p,m]);break}}}}};t.ke.downHandler=d,t.ke.upHandler=u,uf(t,ge,d),uf(t,le,u)}t.ke.downSelectors.push(s),t.ke[n].push([o,s]),o.yl=function(){t.ke!=null&&(Nt(t.ke.downSelectors,a=>a===s),MV(t.ke[n],o),t.ke.downSelectors.length===0&&(zu(t,ge,t.ke.downHandler),zu(t,le,t.ke.upHandler),delete t.ke))}}}}},AT=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=Yu(l);(o==null&&h==e&&!e.Me.over||Zl(h,o,e)&&(h.Me==null||!h.Me.over))&&(TL(Ym,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=Yu(l);for(let d=0;d<r.length;d++)h==r[d]&&!Zl(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),TL(zm,l,e,h))};cf(e,st,df(o,e,s,st),s),cf(e,ot,df(o,e,a,ot),a)}n.yl=function(){delete e.Me[t][n.ar]},SL(e,t,n),e.Me[t][n.ar]=n}}},ye=class{constructor(r){c(this,"clickThreshold");c(this,"dblClickThreshold");c(this,"tapHandler");c(this,"mouseEnterExitHandler");r=r||{},this.clickThreshold=r.clickThreshold||250,this.dblClickThreshold=r.dblClickThreshold||450,this.mouseEnterExitHandler=AT.generate(),this.tapHandler=bT.generate(this.clickThreshold,this.dblClickThreshold)}Gf(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===Ur||e===At?this.tapHandler(s,e,t,n,o):e===Ym||e==zm?this.mouseEnterExitHandler(s,e,t,n,o):uf(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.Gf(r,e,a,s,o),this}off(r,e,t){return zu(r,e,t),this}trigger(r,e,t,n,o){let s=ci()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=In()&&!ci()&&Ji[e]?Ji[e]:e,l=!(In()&&!ci()&&Ji[e]),h=me(t),d=GV(t),u=$V(t);return AL(r,p=>{let g;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let m=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=IV(p,h.x,h.y,d.x,d.y,u.x,u.y);(f.initTouchEvent||f.initEvent)(a,!0,!0,window,null,d.x,d.y,u.x,u.y,!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:f=>{f.initMouseEvent(a,!0,!0,window,o==null?1:o,d.x,d.y,u.x,u.y,t.ctrlKey===!0,t.altKey===!0,t.shiftKey===!0,t.metaKey===!0,1,p)}},y=!l&&!s&&In()&&Ji[e],x=y?"TouchEvent":"MouseEvents";g=document.createEvent(x),E[x](g),m(g),p.dispatchEvent(g)}),this}};var YV=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function ie(i,r){for(let e in r){let t=r[e];if(e==="style"&&typeof t=="object"){let n=Object.entries(t);for(let o=0;o<n.length;o++){let s=n[o];i.style[s[0]]=s[1]}}else i.setAttribute(e,""+r[e])}}function M(i,r,e,t){return r=r||{},aa(Gt,i,e,t,r)}function _L(i,r){let e=r.map(t=>M("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function zV(i,r){i.gradient==null&&(i.gradient=M("linearGradient",{id:Eo(),gradientUnits:"userSpaceOnUse"}),i.canvas.insertBefore(i.gradient,i.canvas.childNodes[0])),i.gradient.setAttribute("x1",`${i.x}`),i.gradient.setAttribute("x2",`${i.x+i.width}`),_L(i.gradient,r)}function TT(i,r,e){let t=Eo(),n=M("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return _L(n,e),{id:t,g:n}}function gf(i,r,e,t){r.setAttribute(hT,e.fill?e.fill:pt),!t&&e.gradient?(zV(i,e.gradient),r.setAttribute(JE,`url(#${i.gradient.id})`)):r.setAttribute(JE,e.stroke?e.stroke:pt),e.strokeWidth&&r.setAttribute(cT,e.strokeWidth),e.dashArray?r.setAttribute(qE,e.dashArray):r.removeAttribute(qE),YV.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function sa(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function XV(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...jV(o,r,e))}),t}function jV(i,r,e){let t=(i||"").split(/\s/),n=[];if(t.length===0)return[];if(t.length===1)return[i];let o=[t[0]],s=1,a=0,l=!1,h=M(KE);for(e.appendChild(h);!l;){let d=t.slice(a,s+1),u=d.join(" ");h.innerHTML=u,h.getBBox().width<r||o.length===0?(o=d.slice(),s+=1,s>=t.length&&(l=!0)):(n.push(o),a=s,o=[t[a]],s=a+1,s>=t.length&&(l=!0))}return e.removeChild(h),n.push(o),n.map(d=>d.join(" "))}function HV(i,r,e){return XV(i,r,e).map(t=>{let n=M(KE);return n.innerHTML=t,n})}function Xu(i,r,e){let n=i.getAttribute(ee)||"50%",o=HV(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(ee,n),a.setAttribute("dy",s==0?"0":`${s+3}`),s=a.getBBox().height}),o.length>0&&o[0].setAttribute("dy",`${-i.getBBox().height/2}`),i}var mf="data-vjs-container",Ef="data-vjs-group-content",ju="data-vjs-expanded-content",Hu="data-vjs-collapsed-content",mr="data-vjs-enabled",Jo="data-vjs-scope",Jl="data-vjs-is-group",kV="element",WV="connection",Ke="div",ff="position",Zr=z(ta),vT=Ae(Ef),Mn=z(ra),CT=z(Eu);function $t(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function oe(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Bt(i,r,e,t){if(i.contains(e))return null;if(t&&$t(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if($t(i,r))return i;i=i.parentNode}}function ZV(i,r,e){e=e||document.body;let t=[],n=Bt(i,r,e,!1);for(;n!=null;)t.push(n),n=Bt(n,r,e,!1);return t}function Ko(i){return i.srcElement||i.target}function OL(i,r){r=vt(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function yf(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function RL(i,r,e){let t=r==null?[]:Array.isArray(r)?r:r.split(/\s+/),n=e==null?[]:Array.isArray(e)?e:e.split(/\s+/),o=yf(i),s=o.split(/\s+/),a=(l,h)=>{for(let d=0;d<h.length;d++)if(l)s.indexOf(h[d])===-1&&s.push(h[d]);else{let u=s.indexOf(h[d]);u!==-1&&s.splice(u,1)}};a(!0,t),a(!1,n),OL(i,s.join(" "))}function Vn(i){return!X(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function JV(i){return!X(i)&&(Array.isArray(i)||Vn(i))}function _T(i){return!X(i)&&(Array.isArray(i)||Vn(i))}function OT(i){return yf(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?vt(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):RL(t,n))};Vn(i)?i.forEach(t=>e(t,r)):e(i,r)}function cn(i,r){return i.classList?i.classList.contains(r):yf(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?vt(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):RL(t,null,n))};Vn(i)?i.forEach(t=>e(t,r)):e(i,r)}function xf(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):cn(t,n)?F(t,n):L(t,n))};Vn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Ut(i,r=[],e=[]){let n=yf(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),OL(i,n.join(" "))}function RT(i,r){let e=null;if(arguments.length===1){if(!X(i)){let t=document.createDocumentFragment();return t.appendChild(i),Array.from(t.childNodes)}e=Array.from(document.querySelectorAll(i))}else e=Array.from(i.querySelectorAll(r));return e}function Jr(i,r,e,t){return aa(null,i,r,e,t)}function aa(i,r,e,t,n){let o=i==null?document.createElement(r):document.createElementNS(i,r);return e=e||{},Object.assign(o.style,e),t&&L(o,t),ie(o,n||{}),o}function Kr(i,r,e,t,n,o,s){let a=aa(i,r||Ke,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function Ki(i,r){let e=i.getBoundingClientRect(),t=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,a=n.clientTop||t.clientTop||0,l=n.clientLeft||t.clientLeft||0,h=e.top+o-a,d=e.left+s-l;return{x:r?d:Math.round(d),y:r?h:Math.round(h)}}function ku(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function Lt(i){return ku(i)==="SVG"}function qi(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var PT=class i{static setNodeText(r,e){r.text=e;try{r.textContent=e}catch(t){}}static getNodeText(r){return r!=null?r.text||r.textContent:""}static getChild(r,e){let t=null;for(let n=0;n<r.childNodes.length;n++)if(r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e){t=r.childNodes[n];break}return t}static getChildren(r,e){let t=[];for(let n=0;n<r.childNodes.length;n++)r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e&&t.push(r.childNodes[n]);return t}static xmlToString(r){try{return new XMLSerializer().serializeToString(r).replace(/\s*xmlns=\"http\:\/\/www.w3.org\/1999\/xhtml\"/g,"")}catch(e){try{return r.xml}catch(t){throw new Error("Cannot serialize XML "+t)}}}static createElement(r,e,t){let n;if(n=document.createElement(r),t&&i.setNodeText(n,t),e)for(let o in e)n.setAttribute(o,e[o]);return n}};function la(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function ha(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===kt?o=>JSON.parse(o):o=>o;r.open(e,i.url,!0);let n=i.headers||{};for(let o in n)r.setRequestHeader(o,n[o]);r.onreadystatechange=()=>{r.readyState===4&&((""+r.status)[0]==="2"?i.success(t(r.responseText)):i.error&&i.error(r.responseText,r.status))},r.send(i.data?JSON.stringify(i.data):null)}else i.error&&i.error("ajax not supported")}function Wu(i,r,e){let t=r.getBoundingClientRect(),n=me(i);return{x:t.width===0?0:(n.x-t.x)/t.width,y:t.height===0?0:(n.y-t.y)/t.height}}function LT(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function KV(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function di(i,r){return"["+i+"='"+r+"']"}function qV(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function QV(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function z(...i){return i.map(r=>"."+r).join(",")}function e1(...i){return i.join(" ")}function Ae(...i){return i.map(r=>"["+r+"]").join(",")}var Kl=Ae(gt);function ql(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var LL="deltaY",wL="deltaX",t1="wheelDeltaY",r1="wheelDeltaX",bf="webkit",Ql="mac",Zu="win",wT="ie",DT="safari",NT="firefox",IT="default";function DL(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function NL(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var MT={[bf]:{[Ql]:ql(LL,120),[Zu]:ql(LL,100)},[DT]:ql(t1,120,!0),[NT]:{[Ql]:DL,[Zu]:DL},[wT]:function(i){return i.wheelDelta/120},[IT]:function(i){return i.deltaY||i.wheelDelta}},VT={[bf]:{[Ql]:ql(wL,120),[Zu]:ql(wL,100)},[DT]:ql(r1,120,!0),[NT]:{[Ql]:NL,[Zu]:NL},[wT]:function(i){return i.wheelDelta/120},[IT]:function(i){return i.deltaX||i.wheelDelta}},IL=typeof navigator!="undefined",ML=IL?/Mac/.test(navigator.userAgent)?Ql:Zu:Ql,eh=IL?navigator.userAgent.indexOf("Firefox")!==-1?NT:/Chrome/.test(navigator.userAgent)?bf:/Safari/.test(navigator.userAgent)?DT:/WebKit/.test(navigator.userAgent)?bf:/Trident/.test(navigator.userAgent)?wT:"default":IT,n1=typeof MT[eh]=="function"?MT[eh]:MT[eh][ML],i1=typeof VT[eh]=="function"?VT[eh]:VT[eh][ML],o1=function(i){return n1(i||event)},s1=function(i){return i1(i||event)},a1=function(i,r,e){let t=n=>{let o=o1(n),s=s1(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.$f=t,t},l1=typeof document!="undefined",VL=l1?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function th(i,r,e,t){let n=a1(r,e,t);return i.addEventListener?i.addEventListener(VL,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function rh(i,r){let e=r.$f;e!=null&&(i.removeEventListener?i.removeEventListener(VL,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function GT(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var $T="vjs-paper",BT="vjs-paper-no-scale",FT="vjs-paper-canvas",UT=20,h1="vjs-paper-node",nh="start",qo="center",ih="end";function YT(i){return kr(i)&&i.useHTMLElement===!0}var oh=class{constructor(r,e){this.instance=r;this.overlay=e;c(this,"htmlElementOverlay");this.htmlElementOverlay=e}static getElement(r,e,t,n){if(e.contentElement==null){if(n&&t){e.contentElement=n(t);let s=r.overlayClass+" "+(e.cssClass?e.cssClass:"");L(e.contentElement,s)}else e.contentElement=Jr(Ke,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(Qe,t.edge.id),e.contentElement.setAttribute(gu,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=qe,r.$appendOverlayElement(e.contentElement);let o="translate(-50%, -50%)";e.contentElement.style.webkitTransform=o,e.contentElement.style.mozTransform=o,e.contentElement.style.msTransform=o,e.contentElement.style.oTransform=o,e.contentElement.style.transform=o,e.visible||L(e.contentElement,Ul),e.contentElement.jtk={overlay:e}}return e.contentElement}static destroy(r){r.contentElement&&r.contentElement.parentNode&&r.contentElement.parentNode.removeChild(r.contentElement),delete r.contentElement}};function zT(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[gu]:r.id},r.attributes);e.forEach(n=>{let o=M(n,t),s=i.overlayClass+" "+(r.cssClass?r.cssClass:"");L(o,s),o.jtk={overlay:r},r.contentElements.push(o)})}return r.contentElements.forEach(t=>{var o;let n=t.parentNode;if(n==null){let s=(o=r.connection)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&sa(n,t,-1)}}),r.contentElements}function XT(i,r,e,t){let n=r;zT(i,n,r.contentTags);let o=[-t.x,-t.y],s=Object.assign({transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},e.paintStyle);n.contentElements.forEach((a,l)=>{let h=e.atts[l],d=Object.assign(s,h);ie(a,d)})}function sh(i,r){return zT(i,r,r.contentTags)}function Qo(i,r){return zT(i,r,[Q]),r.bgElement==null&&(r.bgElement=M(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=M(et),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function jT(i,r,e,t){Qo(i,r);let n=en(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s="translate("+o[0]+","+o[1]+")";r.rotatable&&e.d.rotation&&(s+=` rotate(${e.d.rotation}, ${e.d.loc.x}, ${e.d.loc.y})`);let a={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:s};r.font&&r.font.size&&(a["font-size"]=r.font.size),r.font&&r.font.style&&(a["font-style"]=r.font.style),r.font&&r.font.family&&(a["font-family"]=r.font.family),ie(r.textElement,a),r.textElement.textContent=n;let l=r.textElement.getBBox(),h=i.currentZoom,d=l.width/h,u=l.height/h,p=5,g={transform:s,x:a.x-p-d/2,y:a.y-p-u/2,width:d+2*p,height:u+2*p,fill:n==null||n.length===0?"none":"white"};ie(r.bgElement,g)}function Af(i,r){i.contentElements!=null&&i.contentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),i.backgroundContentElements!=null&&i.backgroundContentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),delete i.contentElements,delete i.backgroundContentElements}var Ju=class extends li{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var ui="transform",HT=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,GL=/rotate\(([-0-9\.]+)\)/,c1=/translate\(([-0-9\.]+[%|px|em|rem]?),\s*([-0-9\.]+[%|px|em|rem]+)\)/;function Ze(i){let r=i;return r.width&&r.width.baseVal?E1(r):r.getBBox?f1(r):d1(i)}function un(i,r){let e=i;return Lt(i.parentElement)?ah(e,r):e.x&&e.x.baseVal?g1(e):u1(e)}function Ie(i,r){let e=i;Lt(i.parentElement)?dn(e,r):(e.x&&e.x.baseVal&&m1(e,r),er(e,r))}function Ku(i,r,e){if(i===r)return{x:0,y:0};let t=r.createSVGPoint();if(e){let l=i.getBBox();t.x=l.x,t.y=l.y}else t.x=0,t.y=0;let n=i.getScreenCTM(),o=t.matrixTransform(n),s=r.getScreenCTM().inverse(),a=o.matrixTransform(s);return{x:Math.round(a.x),y:Math.round(a.y)}}function $L(i,r,e,t,n){let o=i;if(o instanceof HTMLElement)o.style[e]=`${r}px`;else if(o[t]&&o[t].baseVal)o.setAttribute(t,r);else if(o.localName===Q){let s=ah(o);s[n]=r,dn(o,s)}}function kT(i,r){$L(i,r,We,ee,ee)}function WT(i,r){$L(i,r,Te,fe,fe)}function Or(i,r,e){let t=i;t instanceof HTMLElement?BL(i,r,e):t.width&&t.width.baseVal&&(BL(i,r,e),i.setAttribute(_e,`${r}`),i.setAttribute(Ve,`${e}`))}function ZT(i,r){let e=i;e instanceof HTMLElement?FL(i,r):e.width&&e.width.baseVal&&(FL(i,r),i.setAttribute(_e,`${r}`))}function JT(i,r){let e=i;e instanceof HTMLElement?UL(i,r):e.height&&e.height.baseVal&&(UL(i,r),i.setAttribute(Ve,`${r}`))}function d1(i){return{width:i.offsetWidth,height:i.offsetHeight}}function u1(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function p1(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function er(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function BL(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function FL(i,r){i.style.width=`${r}px`}function UL(i,r){i.style.height=`${r}px`}function g1(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function m1(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function E1(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function f1(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function ah(i,r){let e,t,n,o,s;if(e=i.getAttribute(ui),e!=null){if(t=e.match(HT),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(GL),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=Me(h,{x:o,y:s},a),u=Me({x:o,y:s},d,-a);o=u.x,s=u.y}return{x:o,y:s}}else if(e=i.style.transform,e!=null){t=e.match(HT);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function pi(i,r){if(Lt(i.parentElement)){let t=(i.getAttribute(ui)||"").match(HT);i.setAttribute(ui,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else{let e=(i.style.transform||"").match(c1),t=r==0?"":"rotate("+r+"deg)";i.style.transform=(e==null?"":`${e[0]} `)+t,i.style.transformOrigin="center center"}}function dn(i,r){let t=(i.getAttribute(ui)||"").match(GL);i.setAttribute(ui,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}function YL(i,r,e){let t={x:r.x+i.width/2,y:r.y+i.height/2};return Me(r,t,e)}function KT(i,r){let e=YL(i,r,i.r);dn(i.el,e),pi(i.el,i.r)}var qu=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[_e]:""+(n[0]||0),[Ve]:""+(n[1]||0)};ie(r.canvas,o),Ie(r.canvas,r)}}}};var Sf="vjs-surface",qT="vjs-surface-direct-render",QT="vjs-surface-touch-device",ev="vjs-surface-pointer-device",Tf="vjs-surface-nopan",vf="vjs-surface-canvas",Cf="vjs-surface-pan",y1="vjs-surface-pan-left",x1="vjs-surface-pan-top",b1="vjs-surface-pan-right",A1="vjs-surface-pan-bottom",Pf="vjs-surface-pan-active",_f="vjs-surface-flash",tv="vjs-flash-vertex",Of="vjs-surface-panning",Rf="vjs-surface-element-dragging",lh="vjs-element-dragging",Lf="vjs-group-child-element-dragging",hh="vjs-most-recently-dragged",Gn="vjs-surface-edge-dragging",wf="vjs-edge-relocating",Qu="vjs-edge-will-relocate",rv="vjs-lasso",ch="vjs-lasso-mask",nv="vjs-lasso-mask-left",iv="vjs-lasso-mask-top",ov="vjs-lasso-mask-right",sv="vjs-lasso-mask-bottom",ep="vjs-miniview",av="vjs-miniview-canvas",lv="vjs-miniview-panner",hv="vjs-miniview-lasso",cv="vjs-miniview-element",dv="vjs-miniview-group-element",dh="vjs-miniview-selected",Df="vjs-miniview-panning",uv="vjs-miniview-collapse",tp="vjs-miniview-collapsed",pv="vjs-miniview-click-to-center",mt="vjs-drag-select-defeat",Nf="vjs-default-node",If="vjs-default-group",Qi="vjs-connector-source-drag",eo="vjs-connector-target-drag",gv="vjs-connector-transient-drag",pn="vjs-palette-selected-element",uh="vjs-palette-tap-mode-active",mv="vjs-palette-drag-active",Ev="vjs-palette-drag-hover",fv="vjs-palette-drag-hover-cannot-drop",yv="vjs-palette-current",rp="vjs-palette-current-shape-type",ph="vjs-drag-hover-cannot-drop",Mf="vjs-drag-original-group",Er="vjs-drag-active",fr="vjs-drag-hover",Vf="vjs-source-hover",Gf="vjs-target-hover",gh="vjs-hover",xv="vjs-transient-vertex",$f="vjs-edge-click-entry-method";function S1(i,r){if(r.outlineStroke!=null){let e=r.outlineWidth||1,t=r.strokeWidth+2*e,n=Object.assign({},r);return n.stroke=r.outlineStroke,n.strokeWidth=t,n}else if(i.$paintConnectorOutline){let e=i.$connectorOutlineWidth,t=Object.assign({},r);return t.stroke=i.$connectorOutlineColor||"transparent",t.strokeWidth=e,t}}function bv(i,r,e){zL(i,r);let t=r.connector;qu.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=lS(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[Qe]:r.edge.id},a=S1(i,e);a!=null&&(t.bgPath==null?(t.bgPath=M(q,s),L(t.bgPath,i.connectorOutlineClass),sa(t.canvas,t.bgPath,0)):ie(t.bgPath,s),gf(t,t.bgPath,a,!0)),t.path==null?(t.path=M(q,s),sa(t.canvas,t.path,a!=null?1:0),L(t.path,i.connectorPathClass),r.edge.transient&&L(t.canvas,NS)):(t.path.parentNode!==t.canvas&&sa(t.canvas,t.path,a!=null?1:0),ie(t.path,s)),gf(t,t.path,e,!1),r.detachable&&T1(r,o,i.defaults.edgeRelocateHandleSize)}}function T1(i,r,e){if(i.detachable){let t=i.connector,n={x:t.paintInfo.sx,y:t.paintInfo.sy},o=i.anchors.source.computedPosition.ox,s=i.anchors.source.computedPosition.oy;n.x+=o*e/2,n.y+=s*e/2;let a={d:`M ${n.x-e/2} ${n.y-e/2} L ${n.x+e} ${n.y-e/2} L ${n.x+e} ${n.y+e/2} L ${n.x-e/2} ${n.y+e/2} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.sourceZone==null?(t.sourceZone=M(q,a),L(t.sourceZone,Qi),t.canvas.appendChild(t.sourceZone)):ie(t.sourceZone,a);let l={x:t.paintInfo.tx,y:t.paintInfo.ty},h=$e(t,1,e),d=Dt(h,l,e),u=Dt(l,h,e),p={d:`M ${d[0].x} ${d[0].y} L ${d[1].x} ${d[1].y} L ${u[1].x} ${u[1].y} L ${u[0].x} ${u[0].y} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.targetZone==null?(t.targetZone=M(q,p),L(t.targetZone,eo),t.canvas.appendChild(t.targetZone)):ie(t.targetZone,p)}}function zL(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?M(Le,{[_e]:"0",[Ve]:"0",style:{"pointer-events":pt,position:qe},[Qe]:r.edge.id}):M(Q,{[Qe]:r.edge.id});return e.canvas=t,i.$appendEdgeElement(e.canvas),e.cssClass!=null&&L(t,e.cssClass),L(t,i.connectorClass),e.classesToAddWhenRendered!=null&&(L(t,e.classesToAddWhenRendered.join(" ")),delete e.classesToAddWhenRendered),t.jtk=t.jtk||{},t.jtk.connection=r,t}}var Bf=class{constructor(r,e){this.container=r;c(this,"lr",!0);c(this,"ye");c(this,"xl");c(this,"$i");c(this,"Al");c(this,"He");c(this,"Fu");c(this,"nt");c(this,"hr");c(this,"Bt",{});c(this,"wn",[]);c(this,"q");c(this,"Jr");c(this,"Bi");c(this,"Fi");c(this,"Ui");c(this,"Sl");e=e||{init:null},this.ye=new ye,this.xl=this.Bf.bind(this),this.ye.on(r,ge,"*",this.xl),this.$i=this.Ff.bind(this),this.Al=this.Uf.bind(this),this.Ui=e.translate||(t=>Object.assign({},t)),this.Sl=e.init}$enable(){this.lr=!0}$disable(){this.lr=!1}addHandler(r){let e=this.Bt[r.selector];e==null&&(this.Bt[r.selector]=[],e=this.Bt[r.selector],this.wn.push(r.selector)),e.push(r),e.sort((t,n)=>{let o=t.priority==null?0:t.priority,s=n.priority==null?0:n.priority;return o>s?-1:s>o?1:0})}removeHandler(r){let e=this.Bt[r.selector];e!=null&&(this.Bt[r.selector]=e.filter(t=>t!==r),this.Bt[r.selector].length===0&&(delete this.Bt[r.selector],this.wn=this.wn.filter(t=>t!==r.selector)))}Bf(r){if(!this.lr||r.zf===!0)return;let e=!1;this.nt=r.target;let t=()=>{e||(e=!0,this.Sl&&this.Sl(r),this.hr=Ze(this.nt),this.He=null,this.q=me(r),this.Bi=this.Ui(this.q),this.Jr=Object.assign({},this.q),this.Fi=Object.assign({},this.Bi))};for(let n=0;n<this.wn.length;n++)if($t(this.nt,this.wn[n],this.container)){let o=this.Bt[this.wn[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.nt,l=this.hr;if(o[s].target){if(a=this.nt.closest(o[s].target),a==null)continue;l=Ze(a)}if(this.Fu=o[s].start({pagePosition:this.q,e:r,el:a,size:l,translatedPosition:this.Bi}),this.Fu!==!1){this.nt=a,this.hr=l,this.He=o[s],oe(r),r.zf=!0;break}}}}this.He!=null&&(this.ye.on(document,ae,this.$i),this.ye.on(document,le,this.Al))}Ff(r){if(!this.lr)return;let e=me(r),t=this.Ui(e);this.He!=null&&(this.He.constrainFunction&&(this.He.usesPageCoordinates?(e=this.He.constrainFunction(e,this.nt,{width:0,height:0},this.hr,this.Jr,r),t=this.Ui(e)):t=this.He.constrainFunction(t,this.nt,{width:0,height:0},this.hr,this.Fi,r)),this.He.drag({e:r,el:this.nt,pagePosition:e,size:this.hr,originalPagePosition:this.q,translatedPosition:t,originalTranslatedPosition:this.Bi}),this.Jr=e,this.Fi={x:t.x,y:t.y})}Uf(r){this.Jr=me(r),this.Fi=this.Ui(this.Jr),this.He!=null&&this.He.stop({e:r,el:this.nt,pagePosition:this.Jr,size:this.hr,originalPagePosition:this.q,translatedPosition:this.Fi,originalTranslatedPosition:this.Bi}),this.Q()}Q(){this.ye.off(document,ae,this.$i),this.ye.off(document,le,this.Al),this.He=null,this.nt=null,this.hr=null,this.q=null,this.Jr=null}destroy(){Object.values(this.Bt).forEach(r=>r.forEach(e=>e.destroy&&e.destroy())),this.ye.off(this.container,ge,this.xl),this.Q()}};var np={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},mh="start",Eh="center",fh="end",v1="Default",C1="Default shapes",Av="vjs-shape",ip="vjs-shape-label",yh="vjs-shape";var P1="http://www.w3.org/2000/svg",_1="http://www.w3.org/1999/xlink",O1="svg",R1="xlink",L1="html";function Ff(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var es=class extends Ro{constructor(r){super(r),this.namespaceHandlers[O1]=e=>document.createElementNS(P1,e.split(":")[1]),this.namespaceHandlers[L1]=e=>document.createElement(e.split(":")[1]),this.namespaces[R1]=_1}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}Qd(){return Ff}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function yr(i){return new es(i||{})}var op="link",sp="clone",ap="trash",Sv="cross",Tv="plus",vv="circle",Cv="gear",XL={x:0,y:0,width:32,height:32},xh={[sp]:{id:sp,viewBox:XL,shapes:[{tag:q,atts:{d:"M 6 24 L 2 24 L 2 2 L 24 2 L 24 6 M 8 8 L 30 8 L 30 30 L 8 30 Z",stroke:"currentColor","stroke-width":3,fill:"none","stroke-linejoin":"round"}}]},[op]:{id:op,viewBox:XL,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:Be,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:q,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:q,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[ap]:{id:ap,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:q,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:q,atts:{d:"M 12 26 L 10 8"}},{tag:q,atts:{d:"M 20 26 L 22 8"}},{tag:q,atts:{d:"M 16 26 L 16 8.5"}}]},[Sv]:{id:Sv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:q,atts:{d:"M 2 2 L 30 30"}},{tag:q,atts:{d:"M 30 2 L 2 30"}}]},[Tv]:{id:Tv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:q,atts:{d:"M 16 2 L 16 30"}},{tag:q,atts:{d:"M 2 16 L 30 16"}}]},[vv]:{id:vv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:Be,atts:{cx:16,cy:16,r:15}}]},[Cv]:{id:Cv,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:q,atts:{"fill-rule":"evenodd",d:"M 16.0000,4.5000 L 18.1126,3.3755 L 18.6424,1.7428 L 20.8402,2.3317 L 20.4827,4.0106 L 21.7500,6.0407 L 24.1418,6.1232 L 25.4170,4.9741 L 27.0259,6.5830 L 25.8768,7.8582 L 25.9593,10.2500 L 27.9894,11.5173 L 29.6683,11.1598 L 30.2572,13.3576 L 28.6245,13.8874 L 27.5000,16.0000 L 28.6245,18.1126 L 30.2572,18.6424 L 29.6683,20.8402 L 27.9894,20.4827 L 25.9593,21.7500 L 25.8768,24.1418 L 27.0259,25.4170 L 25.4170,27.0259 L 24.1418,25.8768 L 21.7500,25.9593 L 20.4827,27.9894 L 20.8402,29.6683 L 18.6424,30.2572 L 18.1126,28.6245 L 16.0000,27.5000 L 13.8874,28.6245 L 13.3576,30.2572 L 11.1598,29.6683 L 11.5173,27.9894 L 10.2500,25.9593 L 7.8582,25.8768 L 6.5830,27.0259 L 4.9741,25.4170 L 6.1232,24.1418 L 6.0407,21.7500 L 4.0106,20.4827 L 2.3317,20.8402 L 1.7428,18.6424 L 3.3755,18.1126 L 4.5000,16.0000 L 3.3755,13.8874 L 1.7428,13.3576 L 2.3317,11.1598 L 4.0106,11.5173 L 6.0407,10.2500 L 6.1232,7.8582 L 4.9741,6.5830 L 6.5830,4.9741 L 7.8582,6.1232 L 10.2500,6.0407 L 11.5173,4.0106 L 11.1598,2.3317 L 13.3576,1.7428 L 13.8874,3.3755 Z M 23.2500,16.0000 A 7.25,7.25 0 1 0 8.7500,16.0000 A 7.25,7.25 0 1 0 23.2500,16.0000 Z"}}]}};function w1(i,r){let e=typeof i=="string"?xh[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function lp(i,r,e,t,n,o,s){t=t||[],n=n||{};let a=Object.assign({viewBox:`0 0 ${i.viewBox.width} ${i.viewBox.height}`,"pointer-events":"all",width:r,height:e},i.atts||{}),l=M(Le,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=M(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function hp(i,r,e,t,n,o,s){return lp(xh[i],r,e,t,n,o,s)}var D1={x:0,y:0,width:32,height:32},N1={stroke:"currentColor",fill:"none"},Uf=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return xh[r]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){let r=this.getAttribute("icon-id"),e=this.getAttribute("width")||"32",t=this.getAttribute("height")||"32",n=this.findIcon(r)||xh[r];if(!n){this.innerHTML="";return}let o=n.viewBox||D1,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",e),s.setAttribute("height",t),s.setAttribute("viewBox",`${o.x} ${o.y} ${o.width} ${o.height}`);let a=xn(xn({},N1),n.atts);for(let[l,h]of Object.entries(a))s.setAttribute(l,h);n.shapes.forEach(l=>{let h=document.createElementNS("http://www.w3.org/2000/svg",l.tag);for(let[d,u]of Object.entries(l.atts))h.setAttribute(d,u);s.appendChild(h)}),this.innerHTML="",this.appendChild(s)}};customElements.define("vjs-icon",Uf);var I1="label",jL="transform",HL="x",kL="y",cp="origin",_v="originX",Ov="originY",WL="orientation",Rv="size",Lv="key",ZL="iconId",bh="middle",Pv="type",Yf="category",wv="horizontal",M1="vertical",dp="vjs-shape-icon",JL="vjs-include-icon",KL="vjs-include-icons",V1="category",G1="type",ro="__vjsRootSet",to=I1,zf="fill",Ah="outline",Sh="outlineWidth",Xf="color",Th="#FFFFFF",ts="#000000",vh=2,Dv="#000000",qL=.8,ca=class{constructor(r,e){c(this,"compiledShapes",new Map);c(this,"templateRenderer",yr({defaultNamespace:"svg"}));c(this,"shapeSets",new Map);c(this,"defaultCategoryId");c(this,"labelPosition");c(this,"rootSet");c(this,"iconContainerTemplate",`<svg:svg class="${dp}" x="{{x}}" y="{{y}}" viewBox="{{viewBox}}" width="{{width}}" height="{{height}}" style="overflow:visible"/>`);c(this,"iconContainerAst");c(this,"iconSpecs",new Map);c(this,"iconList",[]);c(this,"typeParameter");c(this,"categoryParameter");c(this,"multilineLabels");c(this,"labelFillRatio");e=e||{},r==null?(U("WARN: no shapes were provided to shape library."),r=[]):Array.isArray(r)||(r=[r]),this.typeParameter=e.typeParameter||G1,this.categoryParameter=e.categoryParameter||V1,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||qL,this.labelPosition=e.labelPosition||"center",this.Yf(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:be,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.Xf(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||to)}Yf(r){let e=(t,n)=>{let o=[];return t!=null&&t.forEach(s=>{let a=Object.assign(s,{parent:n,children:e(s.children,s.id)});if(this.shapeSets.set(a.id,a),a.icons){let l=vs(this.iconSpecs,a.id,()=>new Map);a.icons.forEach(h=>{l.set(h.id,h)}),this.iconList.push(...a.icons)}o.push(a)}),o};this.rootSet={children:e(r,ro),parent:null,id:ro,name:ro,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}getShapeSets(){return Array.from(this.shapeSets.values())}getShapeDefinition(r,e){return e=e||this.defaultCategoryId,this.shapeSets.get(e).shapes.find(t=>t.type===r)}$getShapeDefinitionForObject(r,e,t){let n=e||this.typeParameter,o=t||this.categoryParameter;return this.getShapeDefinition(r[n],r[o])}getShapeTemplate(r,e){let t=this.getShapeDefinition(r,e);return t==null?(U(`Cannot find shape [${r}] in set [${e}]. Returning default shape.`),this.jf()):t.template}getCompiledShape(r,e){let t=this.kf(r,e);if(!this.compiledShapes.has(t)){let n=this.templateRenderer.parse(this.getShapeTemplate(r,e)),o=s=>this.templateRenderer.render(n,s).fragment;this.compiledShapes.set(t,o)}return this.compiledShapes.get(t)}Hf(r){r.setAttribute&&r.setAttribute(Lu,wu),r.hasChildNodes&&r.childNodes.forEach(e=>this.Hf(e))}renderCompiledShape(r,e,t,n){e=r.outlineWidth||e||1;let o=t||this.typeParameter,s=n||this.categoryParameter,a=this.getShapeDefinition(r[o],r[s]),l=a.square?Math.min(r.width,r.height):r.width,h=a.square?Math.min(r.width,r.height):r.height;return this.getCompiledShape(r[o],r[s])(Object.assign({outlineWidth:e},r,{width:l,height:h})).childNodes[0]}renderShapeLabel(r,e,t,n,o,s,a){e=e||to;let l=M(et,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":bh,"dominant-baseline":bh,class:ip,"stroke-width":t||"0.25px"});l.textContent=n||r[e]||"";let h=r.fontSize||(a==null?void 0:a.size),d=r.fontStyle||(a==null?void 0:a.style),u=r.fontWeight||(a==null?void 0:a.weight),p=r.fontFamily||(a==null?void 0:a.family);return h&&l.setAttribute("font-size",h.toString()),d&&l.setAttribute("font-style",d),u&&l.setAttribute("font-weight",u),p&&l.setAttribute("font-family",p),l}kf(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}Wf(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:bh,dominantBaseline:bh},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:bh,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:bh,dominantBaseline:"auto"}}[r]}Zf(r,e,t=to){let n={};return this.shapeSets.forEach(o=>{o.shapes.forEach(s=>{let a=s.font||e,l=a==null?14:a.size||14,h=a==null?"normal":a.style||"normal",d=a==null?"normal":a.weight||"normal",u=(a==null?void 0:a.family)||"",p=s.labelPosition||this.labelPosition,{x:g,y:m,transform:E,textAnchor:y,dominantBaseline:x}=this.Wf(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${ju}>${s.template}</svg:g><svg:g ${Hu}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${g}" y="${m}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${ip}" font-size="{{fontSize || ${l}}}" font-style="{{fontStyle || '${h}'}}" font-weight="{{fontWeight || '${d}'}}" font-family="{{fontFamily || '${u}'}}">{{${t}}}</svg:text>`:"");n[`${o.id}:${s.type}`]=b,n[`${be}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=to,s=Th,a=ts,l=ts,h=vh){return e=e||h,{template:r?`<svg:g class="${yh}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
|
|
5
|
-
<r-fragment key="${
|
|
6
|
-
</svg:g>`:`<svg:svg class="${
|
|
7
|
-
<r-fragment key="${
|
|
8
|
-
</svg:svg>`,fragments:{[`${
|
|
4
|
+
`;return e+="]}",e}isChildOf(e){return!1}},im=class im extends wc{constructor(e,t,n){super(e,t,n);c(this,"objectType",im.objectType);c(this,"ports",[]);c(this,"group");c(this,"portMap",{});c(this,"defaultInternalCost",0);c(this,"internalEdges",{})}getAllEdges(e){let t=e==null?null:{filter:e},n=this.getEdges(t).slice(0);for(let o=0;o<this.ports.length;o++)n.push.apply(n,this.ports[o].getEdges(t));return n}getAllSourceEdges(){let e=this.getSourceEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getAllTargetEdges(){let e=this.getTargetEdges().slice(0);for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getDirectEdges(e){return this.getEdges(e==null?null:{filter:e})}getDirectSourceEdges(){return this.getSourceEdges()}getDirectTargetEdges(){return this.getTargetEdges()}getPortEdges(e){let t=[];for(let n=0;n<this.ports.length;n++)t.push.apply(t,this.ports[n].getEdges(e==null?null:{filter:e}));return t}getPortSourceEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getSourceEdges());return e}getPortTargetEdges(){let e=[];for(let t=0;t<this.ports.length;t++)e.push.apply(e,this.ports[t].getTargetEdges());return e}getIndegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getIndegreeCentrality();return this.indegreeCentrality+e}getOutdegreeCentrality(){let e=0;for(let t=0;t<this.ports.length;t++)e+=this.ports[t].getOutdegreeCentrality();return this.outdegreeCentrality+e}getPorts(){return this.ports}$addPort(e,t){let n=this.graph.getId(e,t),o=this.getPort(n);return o==null&&(o=new de(this,e,t),this.ports.push(o),this.portMap[o.id]=o),o}$setPort(e,t){let n=this.getPort(e);return n||(n=this.$addPort({id:e})),n.data=t,n.setType(this.graph.getType(t)),n}getPort(e){return this.portMap[e]}$renamePort(e,t){return this.portMap[e.id]?(this.portMap[t]=this.portMap[e.id],delete this.portMap[e.id],!0):!1}$removePort(e){let t=!1;if(e){let n=Rc(e),o=-1;for(let s=0;s<this.ports.length;s++)if(this.ports[s].id===n){o=s;break}if(o!=-1){let s=this.ports[o];this.graph.deletePort(s),this.ports.splice(o,1),t=!0}delete this.portMap[n]}return t}$setDefaultInternalCost(e){this.defaultInternalCost=e}getInternalEdge(e,t){let n=Rc(e),o=Rc(t),s={source:this.portMap[n],target:this.portMap[o],cost:1/0};if(s.source&&s.target){let a=this.internalEdges[n+"-"+o]||{cost:this.defaultInternalCost,directed:!1};Object.assign(s,a)}return s}$setInternalEdge(e,t,n,o){let s=Rc(e),a=Rc(t);return this.internalEdges[s+"-"+a]={cost:n||this.defaultInternalCost,directed:o},this.getInternalEdge(e,t)}};c(im,"objectType","Node");var ce=im,om=class om extends wc{constructor(e,t,n){super(e.graph,t,n);this.parent=e;c(this,"objectType",om.objectType)}getParent(){return this.parent}getFullId(){return this.parent.id+this.graph.getPortSeparator()+this.id}isChildOf(e){return this.parent===e}getAllEdges(e){return this.getEdges(e==null?null:{filter:e})}};c(om,"objectType","Port");var de=om,sm=class sm extends ce{constructor(e,t,n){super(e,t,n);c(this,"objectType",sm.objectType);c(this,"members",[]);c(this,"Yo",{})}$addMember(e){return this.Yo[e.id]!=null?!1:(this.members.push(e),this.Yo[e.id]=e,e.group=this,!0)}getMemberCount(){return this.members.length}getMembers(){return this.members}$removeMember(e){let t=typeof e=="string"?this.Yo[e]:e;if(t){let n=this.members.indexOf(t);return n!=-1&&(this.members.splice(n,1),delete this.Yo[t.id]),t.group&&t.group.id===this.id&&delete t.group,!0}else return!1}getAllDirectEdges(e){let t=[],n,o=e==null?null:{filter:e};t.push.apply(t,this.getEdges(o).slice(0));let s=this.getPorts();for(n=0;n<s.length;n++)t.push.apply(t,s[n].getEdges(o));return t}getInternalEdges(e){let t=[],n={};for(let o=0;o<this.members.length;o++)Array.prototype.push.apply(t,this.members[o].getAllEdges(e).filter(function(s){let a=s.getId(),l=n[a]==null;return n[a]=!0,l}));return t}};c(sm,"objectType","Group");var se=sm,am=class am extends Lc{constructor(e){super(e.graph,e.data);c(this,"objectType",am.objectType);c(this,"source");c(this,"target");c(this,"cost");c(this,"directed");c(this,"id");c(this,"geometry");c(this,"transient");c(this,"anchors");this.transient=e.transient===!0,this.source=e.source,this.target=e.target,this.cost=e.cost||1,this.directed=e.directed!==!1,this.id=e.id,e.anchors&&(this.anchors=e.anchors)}getCost(){return this.cost}setCost(e){this.cost=e}getId(){return this.id==null?this.source.id+"_"+this.target.id:this.id}getFullId(){return this.getId()}setId(e){this.id=e}isDirected(){return this.directed}setDirected(e){this.directed=e}inspect(){if(this.id!=null)return"{ id:"+this.id+", cost:"+this.cost+", directed:"+this.directed+", source:"+this.source.id+", target:"+this.target.id+"}"}};c(am,"objectType","Edge");var Ue=am;var kx="undoRedo",yo="userActivity",pl="api",gl="dataLoad",Wx="transient",Zx="copyPaste";var VN=(i,r,e)=>{let t=i.nodes||[],n=i.edges||[],o=i.groups||[],s=new Map,a=new Map,l=new Map,h=r.getGroups().map(p=>p.id),d=p=>{let g=l.get(p);g!=null&&g.forEach(m=>{h.push(r.addGroup(m).id)}),l.delete(p),g!=null&&g.forEach(m=>{d(m.id)})};for(let p=0;p<o.length;p++){let g=o[p];if(e.groupDecorator&&e.groupDecorator(g),g[r.groupProperty]!=null&&h.indexOf(g[r.groupProperty])===-1)vs(l,g[r.groupProperty],()=>[]).push(g);else{let m=r.addGroup(g);a.set(m.id,g),h.push(m.id),d(m.id)}}l.forEach((p,g)=>{if(h.indexOf(g)===-1)throw new Error("Parent group ["+g+"] not found");p.forEach(m=>h.push(r.addGroup(m).id))});for(let p=0;p<t.length;p++){e.nodeDecorator&&e.nodeDecorator(t[p]);let g=r.addNode(t[p]);s.set(g.id,t[p])}function u(p){return X(p)?s.get(p)||a.get(p)||{}:{}}for(let p=0;p<n.length;p++){let g=n[p].data||{},m={source:n[p].source,target:n[p].target,cost:n[p].cost||1,directed:n[p].directed,data:g};if(e.edgeDecorator){let E=u(n[p].source),y=u(n[p].target);e.edgeDecorator(g,E,y)}n[p].anchors&&(m.anchors=n[p].anchors),n[p].geometry&&(m.geometry=n[p].geometry),r.$_addEdge(m,gl,null)}},GN=(i,r)=>{let e=i.getGraph(),t={nodes:[],edges:[],groups:[]},n,o,s;for(let a=0;a<e.nodes.length;a++){n=e.nodes[a];let l=n.transient;if(!l){let h=Object.assign({},n.data);n.group==null&&delete h[i.groupProperty],t.nodes.push(h)}o=n.getAllEdges();for(let h=0;h<o.length;h++){let d=o[h],u={},p=!1;(d.source===n||d.source.objectType===de.objectType&&d.source.getParent()==n)&&(d.source.dummy?(p=!0,u.source={x:d.source.data[i.modelLeftAttribute],y:d.source.data[i.modelTopAttribute]}):u.source=d.source.getFullId(),d.target.dummy?(p=!0,u.target={x:d.target.data[i.modelLeftAttribute],y:d.target.data[i.modelTopAttribute]}):u.target=d.target.getFullId(),(!l||p)&&(d.data&&(u.data=Object.assign({},d.data)),d.geometry&&(u.geometry=Object.assign({},d.geometry)),t.edges.push(u)))}}for(let a=0;a<e.groups.length;a++){s=e.groups[a];let l=Object.assign({},s.data);s.group==null&&delete l[i.groupProperty],t.groups.push(l),o=s.getEdges();for(let h=0;h<o.length;h++)if(o[h].source===s||o[h].source.objectType===de.objectType&&o[h].source.getParent()==s){let d={source:s.getFullId()};o[h].target.dummy?d.target={x:o[h].target.data[i.modelLeftAttribute],y:o[h].target.data[i.modelTopAttribute]}:d.target=o[h].target.getFullId(),o[h].data&&(d.data=Object.assign({},o[h].data)),o[h].geometry&&(d.geometry=Object.assign({},o[h].geometry)),t.edges.push(d)}}return t},$N=(i,r,e)=>{let t=n=>{let o=r.addNode(n);if(n.children)for(let s=0;s<n.children.length;s++){let a=r.addNode(n.children[s]);r.$_addEdge({source:o,target:a},gl,null),t(n.children[s])}};t(i)},kt="json",um="hierarchical-json",SO={[kt]:GN},TO={[kt]:VN,[um]:$N};function Jx(i,r){TO[i]=r}function BN(i,r){SO[i]=r}function Kx(i,r,e,t){let n=TO[i];if(n==null)throw new Error("VisuallyJs - parse - ["+i+"] is an unsupported type");return n(r,e,t)}function pm(i,r,e){let t=SO[i];if(t===null)throw new Error("VisuallyJs - exportData - ["+i+"] is an unsupported type");return t(r,e)}var gm=class{constructor(){c(this,"ze",{});c(this,"Aa",!1);c(this,"Sa",!1);c(this,"pE",{ready:!0});c(this,"zc",[])}fire(r,e,t){return this.fireUnchecked(r,e,t)}fireUnchecked(r,e,t){let n=null;if(this.Sa)this.zc.unshift(arguments);else{if(this.Sa=!0,!this.Aa&&this.ze[r]){let o=this.ze[r].length,s=0,a=!1;if(!this.shouldFireEvent||this.shouldFireEvent(r,e,t))for(;!a&&s<o&&n!==!1;){if(this.pE[r])this.ze[r][s](e,t);else try{n=this.ze[r][s](e,t)}catch(l){U("VisuallyJs: fire failed for event "+r+" : "+(l.message||l))}s++,(this.ze==null||this.ze[r]==null)&&(a=!0)}}this.Sa=!1,this.mE()}return n}mE(){let r=this.zc.pop();r&&this.fire.apply(this,r)}unbind(r,e){if(arguments.length===0)this.ze={};else if(arguments.length===1){if(typeof r=="string")delete this.ze[r];else if(r.li){let t;for(let n in r.li)t=r.li[n],qg(this.ze[t]||[],r)}}else arguments.length===2&&qg(this.ze[r]||[],e);return this}getListener(r){return this.ze[r]||[]}isSuspendEvents(){return this.Aa}setSuspendEvents(r){this.Aa=r}bind(r,e,t){return this.bindUnchecked(r,e,t)}bindAll(r,e,t){return r.forEach(n=>this.bind(n,e,t)),this}bindUnchecked(r,e,t){return(o=>{Mx(this.ze,o,e,t),e.li=e.li||{},e.li[G()]=o})(r),this}silently(r){this.setSuspendEvents(!0);try{r()}catch(e){U("Cannot execute silent function "+e)}this.setSuspendEvents(!1)}},Ft=class extends gm{shouldFireEvent(r,e,t){return!0}};var ml=class{constructor(r,e){this.instance=r;c(this,"result");c(this,"Yc",[]);c(this,"pn",{});this.result=r.getGraph().findPath(e.source,e.target,e.strict,e.nodeFilter,e.edgeFilter);for(let t=0;t<this.result.path.length;t++)this.Yc.push(this.result.path[t].vertex),this.pn[this.result.path[t].vertex.getFullId()]=[this.result.path[t].vertex,t]}deleteEdges(){for(let r=0;r<this.result.path.length;r++)this.result.path[r].edge&&this.instance.removeEdge(this.result.path[r].edge);return this}deleteVertices(){for(let r=0;r<this.result.path.length;r++)this.instance.removeNode(this.result.path[r].vertex);return this}contains(r,e){let t=this.instance.findGraphObject(r),n=!1;if(t){for(let o=0;o<this.result.path.length;o++)if(this.result.path[o].vertex==t||this.result.path[o].edge==t||!e&&this.result.path[o].vertex.objectType==de.objectType&&this.result.path[o].vertex.isChildOf(t)){n=!0;break}}return n}getVertices(){return this.Yc}getVertex(r){return this.pn[typeof r=="string"?r:r.id][0]}getAllEdgesFor(r){let e=this.pn[r.id][1];return e<this.result.path.length-1?[this.result.path[e+1].edge]:[]}filter(r,e){U("not implemented.")}Ye(r,e){for(let t=e||0;t<this.result.path.length;t++)try{r(t,this.result.path[t])}catch(n){U("Path iterator function failed",n)}}each(r){this.Ye((e,t)=>{r(e,t)})}eachVertex(r){this.Ye((e,t)=>{r(e,t.vertex)})}eachEdge(r){this.Ye((e,t)=>{r(e,t.edge)},1)}eachNode(r){this.Ye((e,t)=>{J(t.vertex)&&r(e,t.vertex)})}eachGroup(r){this.Ye((e,t)=>{Y(t.vertex)&&r(e,t.vertex)})}getVertexCount(){return this.result.path.length}getNodeAt(r){return this.result.path[r].vertex}getEdgeCount(){return this.result.path.length==0?0:this.result.path.length-1}getEdgeAt(r){return r<0&&(r=this.result.path.length-1+r),this.result.path.length>r+1?this.result.path[r+1].edge:null}deleteAll(){this.deleteVertices()}isEmpty(){return this.result.path.length==0}getCost(){return this.result.pathDistance}exists(){return this.result.pathDistance!=null}};var Nc=class{constructor(r,e){c(this,"Xc",new Map);c(this,"jc",new Map);c(this,"kc",new Map);if(e!=null){let t=e.nodes||{};for(let s in t)this.Xc.set(s,t[s]);let n=e.groups||{};for(let s in n)this.jc.set(s,n[s]);let o=e.ports||{};for(let s in o)this.kc.set(s,o[s])}}getNodeDefinition(r){return this.Xc.get(r)||{}}getGroupDefinition(r){return this.jc.get(r)||{}}getPortDefinition(r){return this.kc.get(r)||{}}};var Ir=class i{constructor(r){c(this,"instance");c(this,"adapter");c(this,"$vertices",[]);c(this,"parameters");c(this,"done");c(this,"width");c(this,"height");c(this,"container");c(this,"containerSize");c(this,"padding");c(this,"xShift");c(this,"yShift");c(this,"hi");this.hi=r.options.locationFunction,this.adapter=r.adapter,this.instance=r.instance,this.container=r.container,this.containerSize=this.adapter.getSize(this.container),this.width=r.options.width||this.containerSize.width,this.height=r.options.height||this.containerSize.height,this.padding=r.options.padding,this.done=!1,this.parameters=r.options||{}}mn(){this.done=!1,this.$vertices.length=0,this.reset()}static gE(){return{padding:{x:0,y:0}}}EE(){let r=Object.assign(i.gE(),this.getDefaultParameters()||{});return Object.assign(r,this.parameters||{}),this.parameters=r,this.parameters}getSize(r,e){return Cs(e,r,()=>{let t=this.adapter.getViewportPositionById(r);return t!=null?{width:t.width,height:t.height}:{width:0,height:0}})}fE(r,e,t,n,o){t=t||10,n=n||10;let s=Math.floor(Math.random()*t),a=Math.floor(Math.random()*n);return{x:s,y:a}}Hc(r){if(this.instance==null)return;this.containerSize=this.adapter.getSize(this.container),this.width=this.containerSize.width,this.height=this.containerSize.height;let e=this.EE();this.$vertices=this.adapter.getElements().slice();let t={},n={},o=1/0,s=1/0,a=-1/0,l=-1/0,h=(p,g,m)=>{let E=n[p]||{width:0,height:0};o=Math.min(o,g),s=Math.min(s,m),a=Math.max(a,g+E.width),l=Math.max(l,m+E.height),t[p]={x:g,y:m}},d=p=>t[p];this.$vertices.forEach(p=>this.getSize(p.id,n)),this.begin(this.instance,d,h,n,e);let u=()=>{let p={};this.$vertices.forEach(g=>p[g.id]=t[g.id]),this.end(this.instance,d,h,n,e),r&&r({positions:p,bounds:{xmin:o,ymin:s,xmax:a,ymax:l},sizes:n,layout:this})};for(;!this.done;)this.step(this.instance,d,h,n,e);u()}relayout(r,e){this.mn(),r!=null&&(this.parameters=r),this.Hc(e)}layout(r){this.done=!1,this.Hc(r)}};var Ic=class{};var vO={},Ke={get:(i,r)=>{let e=vO[i];if(e)return r.options=r.options||{},new e(r);throw{message:"VisuallyJs: unknown layout type '"+i+"'"}},register:(i,r)=>{vO[i]=r}};var mm=class mm extends Ir{constructor(e){super(e);c(this,"type",mm.type)}getDefaultParameters(){return{}}reset(){}begin(e,t,n,o,s){this.$vertices.forEach(a=>n(a.id,0,0))}end(e,t,n,o,s){}step(e,t,n,o,s){this.done=!0}};c(mm,"type","Empty");var _s=mm;Ke.register(_s.type,_s);function FN(i){return{x:i.data.left,y:i.data.top}}var qn=class extends Ir{constructor(e){super(e);c(this,"Wc");c(this,"absoluteBacked");this.absoluteBacked=e.options.absoluteBacked===!0,this.Wc=e.options.locationFunction}$_findLocation(e,t){return(t!=null&&t.locationFunction?t.locationFunction:this.Wc||FN)(e)}begin(e,t,n,o,s){let a=this.adapter.getElements(),l=a.length;for(let h=0;h<l;h++){let d=a[h],u=d.getFullId(),p=t(u);p==null&&(p=this.$_findLocation(d,s),isNaN(p.x)&&(p.x=0),isNaN(p.y)&&(p.y=0)),n(u,p.x,p.y)}}step(e,t,n,o,s){this.done=!0}end(e,t,n,o,s){}reset(){}getAbsolutePosition(e,t){return e==null?{x:null,y:null}:this.$_findLocation(e,t)}},CO="Absolute",Em=class Em extends qn{constructor(e){super(e);c(this,"type",Em.type)}getDefaultParameters(){return{}}};c(Em,"type",CO);var xo=Em;Ke.register(xo.type,xo);function UN(i,r,e,t){return i[r]<=t&&t<=i[r]+i[e]}var fm=[(i,r)=>i.x+i.width-r.x,(i,r)=>i.x-(r.x+r.width)],ym=[(i,r)=>i.y+i.height-r.y,(i,r)=>i.y-(r.y+r.height)],PO=[null,[fm[0],ym[1]],[fm[0],ym[0]],[fm[1],ym[0]],[fm[1],ym[1]]],YN=(i,r,e,t,n)=>{isNaN(e)&&(e=0);let o=r.y+r.height,s=e==1/0||e==-1/0?r.x+r.width/2:(o-t)/e,a=Math.atan(e),l,h,d;return UN(r,"x","width",s)?(l=PO[n][1](i,r),h=l/Math.sin(a),d=h*Math.cos(a),{x:d,y:l}):(d=PO[n][0](i,r),h=d/Math.cos(a),l=h*Math.sin(a),{x:d,y:l})};function Ri(i,r){let e=i.center||{x:i.x+i.width/2,y:i.y+i.height/2},t=r.center||{x:r.x+r.width/2,y:r.y+r.height/2},n=Nr(e,t),o=As(e,t),s=n==1/0||n==-1/0||isNaN(n)?0:e.y-n*e.x;return YN(i,r,n,s,o)}function Oi(i,r,e){let t=r.width+2*e.x,n=r.height+2*e.y;return{x:i.x-t/2,y:i.y-n/2,width:t,height:n}}function _O(i){let r=[];if(i==null)return null;if(Array.isArray(i)){let e=[];return e.push.apply(e,i),e}else for(let e in i)r.push(i[e]);return r}var zN={x:20,y:20},XN=1/0;function OO(i,r){let e={x:i.x,y:i.y};if(r!=null){let t=he(i,r);i.x=t.x,i.y=t.y,i.center!=null&&(i.center.x=i.x+i.width/2,i.center.y=i.y+i.height/2)}return{moved:e.x!==i.x||e.y!==i.y,pos:i}}var Li=class{constructor(r){c(this,"De");c(this,"k");c(this,"Ta");c(this,"mt");c(this,"Zc");c(this,"$r",null);c(this,"gn");c(this,"W");c(this,"En");c(this,"Jc");c(this,"Z",[]);c(this,"de",new Map);c(this,"Xo",new Map);c(this,"yn",new Map);c(this,"xn",new Set);c(this,"jo",!1);c(this,"Kc");c(this,"Rt",new Map);this.En=r.positionGetter,this.Jc=r.positionSetter,this.W=r.getId,this.gn=r.getSize,this.k=_O(r.elements||[]),this.mt=r.filter||(e=>!0),this.Zc=r.exclude||(e=>!1),this.Ta=r.constrain||((e,t,n)=>n)}executeAtPoint(r,e){return this.k.length>0?(this.ci((e==null?void 0:e.getSize)||this.gn,(e==null?void 0:e.getPosition)||this.En,e==null?void 0:e.knownLocations),this.va(r),this.$r=null,this.Ca(e)):{original:{},current:{}}}executeAtCenter(r){if(this.k.length>0){let e=this.ci((r==null?void 0:r.getSize)||this.gn,(r==null?void 0:r.getPosition)||this.En,r==null?void 0:r.knownLocations);return this.va({x:(e.minx+e.maxx)/2,y:(e.miny+e.maxy)/2}),this.$r=null,this.Ca(r)}else return{original:{},current:{}}}executeWithFocus(r,e){return this.k.length>0?(this.ci((e==null?void 0:e.getSize)||this.gn,(e==null?void 0:e.getPosition)||this.En,e==null?void 0:e.knownLocations,e==null?void 0:e.knownSizes),this.$r={id:r,bounds:this.de.get(r),element:this.k.find(t=>t.id===r)},this.va(this.$r.bounds.center),this.Ca(e)):{original:{},current:{}}}snapToGrid(r){let e={original:{},current:{}};this.ci(this.gn,this.En);for(let t=0;t<this.Z.length;t++){let n=this.de.get(this.Z[t].id),{moved:o,pos:s}=OO(this.Z[t].bounds,r);o&&(e.original[this.Z[t].id]=n,e.current[this.Z[t].id]=s)}return this.qc(e),e}setElements(r){return this.k=_O(r),this}startTracking(r,e,t){return this.setElements(r),this.ci(this.gn,this.En),this.Kc=t||XN,this.yn.clear(),this.xn.clear(),this.Xo.entries().forEach(n=>{this.yn.set(n[0],Object.assign({},n[1]))}),this.jo=e,this}stopTracking(){this.yn.clear(),this.xn.clear(),this.jo=!1}addElement(r,e){return r!=null&&(e||this.k.indexOf(r)===-1)&&this.k.push(r),this}addElements(r,e){if(e)Array.prototype.push.apply(this.k,r);else for(let t=0;t<r.length;t++)this.addElement(r[t]);return this}removeElement(r){let e=-1;for(let t=0;t<this.k.length;t++)if(this.k[t]===r){e=t;break}return e!==-1&&this.k.splice(e,1),this}reset(){this.k.length=0}va(r){r!=null&&(this.De=r)}ci(r,e,t,n){return this.Z.length=0,this.de.clear(),this.Xo.clear(),this.Rt.clear(),this.yE(this.k,r,e,t,n)}yE(r,e,t,n,o){let s,a,l,h;s=a=1/0,l=h=-1/0,n=n||{},o=o||{};for(let d=0;d<r.length;d++){let u=n[r[d].id]||t(r[d]),p=o[r[d].id]||e(r[d]),g=this.W(r[d]),m={x:u.x,y:u.y,width:p.width,height:p.height,center:{x:u.x+p.width/2,y:u.y+p.height/2}};this.de.set(g,m),this.Xo.set(g,Object.assign({},m)),this.Z.push({bounds:m,id:g,element:r[d]}),this.Rt.set(g,p),s=Math.min(s,u.x),a=Math.min(a,u.y),l=Math.max(l,u.x+p.width),h=Math.max(h,u.y+p.height)}return{minx:s,maxx:l,miny:a,maxy:h}}xE(r,e,t,n){if(this.yn.has(r)){let o=this.yn.get(r),s=this.de.get(r),a={x:s.x+o.width/2,y:s.y+o.height/2},l=Pe(o.center,a),h=l/Math.ceil(l/10),d=Math.round(l/h)+1,u=Math.atan2(o.center.y-a.y,o.center.x-a.x);if(l>this.Kc)return null;let p=null,g=0;for(let m=1;m<d;m++){let E={x:a.x+m*h*Math.cos(u),y:a.y+m*h*Math.sin(u)},y=Oi(E,o,{x:0,y:0});OO(y,n);let x=!0;for(let f=0;f<this.Z.length;f++){let b=this.Z[f];if(b.id!==r&&!t(b.id,b.element)){let A=b.bounds,T=Oi(A.center,A,e);if(rt(y,T)){x=!1;break}}}if(x)g=m,p={x:E.x-o.width/2,y:E.y-o.height/2};else break}return p!=null?{moved:!0,reverted:g===d-1,positionReached:p}:null}else return null}bE(r={},e,t,n,o){if((this.jo&&!o||!this.jo&&o)&&this.xn.size>0){let a=!1;for(;!a;){let l=!0;this.xn.forEach(h=>{let d=this.xE(h,e,t,n);if(d!=null&&d.moved){let u=this.yn.get(h),p=d.reverted?{x:u.x,y:u.y}:d.positionReached;r[h]=p;let g=this.de.get(h);g.x=p.x,g.y=p.y,g.center.x=p.x+u.width/2,g.center.y=p.y+u.height/2,d.reverted&&this.xn.delete(h),l=!1}}),a=l}}}Ca(r){let e={};if(this.k.length>1){r=r||{};let n=r.filter||this.mt,o=r.padding||zN,s=r.iterations,a=r.exclude||this.Zc;r.gather&&Object.assign(e,this.AE(o,this.Ta,n,a)),Object.assign(e,this.SE(o,this.Ta,n,s,a,r.grid)),this.bE(e,o,a,r.grid,r.invertTrackbackPreference)}let t={original:{},current:{}};for(let n in e)t.original[n]=this.Xo.get(n),t.current[n]=e[n],this.xn.add(n);return this.qc(t),t}AE(r,e,t,n){let o={},s=Oi(this.De,{width:0,height:0},r);this.Qc();let a={},l=h=>{let d=[this.De,h],u=[];Array.prototype.push.apply(u,ar(d,s).map(p=>[s,p,null]));for(let p in a){let g=this.de.get(p);Array.prototype.push.apply(u,ar(d,g).map(m=>[g,m,p]))}return u.filter(p=>p!=null)};for(let h=0;h<this.Z.length;h++){if(n(this.Z[h].id,this.Z[h].element))continue;let d=this.Z[h].bounds,u=this.Z[h].bounds,p=Oi(d.center,u,r);if(t(this.Z[h].id,this.Z[h].element)){let g=l(d.center);if(g.length>0){g.sort((y,x)=>{let f=Pe(y[1],d),b=Pe(x[1],d);return f<b?-1:1});let m=g[0][0],E=Ri(m,p);d.x+=E.x,d.y+=E.y,d.center.x+=E.x,d.center.y+=E.y,o[this.Z[h].id]=d,a[this.Z[h].id]=!0}}}return o}SE(r,e,t,n,o,s){n=n||2;let a,l;this.$r!=null?(a=Oi(this.De,this.$r.bounds,{x:0,y:0}),l=this.$r.id):a=Oi(this.De,{width:0,height:0},r),this.Qc();let h=1,d=!0,u,p,g={},m=(x,f,b,A)=>{f.x+=b,f.y+=A,f.center.x+=b,f.center.y+=A,g[x]=f},E=(x,f)=>{if(s==null)return f;{let b=Ci(x,f),A=b.x/s.width,T=b.y/s.height,S=f.x>=0?Math.ceil(A):Math.floor(A),O=f.y>=0?Math.ceil(T):Math.floor(T),v={x:s.width*S,y:s.height*O};return Px(v,x)}},y=()=>{let x,f;for(let b=0;b<this.Z.length;b++){if(x=this.Z[b],o(x.id,x.element))continue;let A=x.bounds,T=Oi(A.center,A,r);x.id!==l&&t(x.id,x.element)&&rt(a,T)&&(u=Ri(a,T),u=E(A,u),p=e(x.id,A,u),m(x.id,A,p.x,p.y),T=Oi(A.center,A,r));for(let S=0;S<this.Z.length;S++)if(b!==S){if(f=this.Z[S],f.id===l||o(f.id,f.element))continue;if(t(f.id,f.element)){let O=f.bounds,v=Oi(O.center,O,r);rt(T,v)&&(d=!0,u=Ri(T,v),u=E(O,u),p=e(f.id,O,u),m(f.id,O,p.x,p.y))}}}d&&h<n&&(d=!1,h++,y())};return y(),g}qc(r){for(let e=0;e<this.k.length;e++){let t=this.W(this.k[e]);r.current[t]&&this.Jc(this.k[e],r.current[t])}}Qc(){let r={};this.Z.sort((e,t)=>{let n=r[e.id]||Math.min(Pe(e.bounds,this.De),Pe(Ci(e.bounds,{x:e.bounds.width,y:0}),this.De),Pe(Ci(e.bounds,{x:e.bounds.width,y:e.bounds.height}),this.De),Pe(Ci(e.bounds,{x:0,y:e.bounds.height}),this.De)),o=r[t.id]||Math.min(Pe(t.bounds,this.De),Pe(Ci(t.bounds,{x:t.bounds.width,y:0}),this.De),Pe(Ci(t.bounds,{x:t.bounds.width,y:t.bounds.height}),this.De),Pe(Ci(t.bounds,{x:0,y:t.bounds.height}),this.De));return r[e.id]=n,r[t.id]=o,n===o?0:n<o?-1:1})}};var RO={x:30,y:30},xm=class xm extends Ir{constructor(e){super(e);c(this,"ed");c(this,"td");c(this,"type",xm.type);c(this,"padding",RO);this.ed=e.options.centerRoot===!0,this.padding=e.options.padding||RO,this.td=e.options.centerContent===!0}getDefaultParameters(){return{padding:this.padding,locationFunction:this.hi}}begin(e,t,n,o,s){}end(e,t,n,o,s){}reset(){}step(e,t,n,o,s){let a=this.$vertices.slice(),l=0,h=0,d,u,p=10;if(this.ed&&a.length>0){let y=this.getSize(a[0].id,o);p=Math.max(y.width,y.height)+80,n(a[0].id,0,0),a=a.slice(1)}if(a.length===0){this.done=!0;return}let g=2*Math.PI/a.length,m=-Math.PI/2;for(d=0;d<a.length;d++)if(u=a[d],n(u.id,l+Math.sin(m)*p,h+Math.cos(m)*p),m+=g,d>0){let y=a[d-1],x=this.getSize(y.id,o),f=t(y.id),b={x:f.x-s.padding.x,y:f.y-s.padding.y,width:x.width+2*s.padding.x,height:x.height+2*s.padding.y},A=a[d],T=this.getSize(A.id,o),S=t(A.id),O={x:S.x-s.padding.x,y:S.y-s.padding.y,width:T.width+2*s.padding.x,height:T.height+2*s.padding.y},v=Ri(b,O),_=[f.x+x.width/2,f.y+x.height/2],P=[S.x+v.x+T.width/2,S.y+v.y+ +(T.height/2)],I=Math.sqrt(Math.pow(_[0]-P[0],2)+Math.pow(_[1]-P[1],2));p=Math.max(p,I/2/Math.sin(g/2))}let E=this.td?{x:this.width/2,y:this.height/2}:{x:0,y:0};for(d=0;d<a.length;d++)u=a[d],n(u.id,l+Math.sin(m)*p+E.x,h+Math.cos(m)*p+E.y),m+=g;this.done=!0}};c(xm,"type","Circular");var Mc=xm;Ke.register(Mc.type,Mc);var bm="Grid",Am="Column",Sm="Row";var _e="width",Ve="height",jN="rotation",Vc="v",qx="h",Te="top",We="left",yt="right",ht="bottom",It="center",ee="x",fe="y",Tn="dlr",Qn="drl",nn="none",on="orthogonal",Qx="manhattan",Gc="diagonal",eb="metro",tb=-1,pe="v",ne="h",rb="undefined",be="default",Ct="true",ct="false",nb="left",ib="top",ob="rotation",sb="width",ab="height",it="source",vn="target";var HN={x:30,y:30},wi="row",lb="column",bo=class extends Ir{constructor(e){super(e);c(this,"bn",[]);c(this,"Pa");c(this,"Oa");c(this,"H");c(this,"An");c(this,"Sn");c(this,"Br");c(this,"Fr");c(this,"_a");c(this,"type");this.type=bm,this.H=e.options.orientation||wi,this.padding=e.options.padding||HN,this.Pa=e.options.verticalAlignment||It,this.Oa=e.options.horizontalAlignment||It,this.An=e.options.rows||-1,this.Sn=e.options.columns||-1,this._a=e.options.sort}getDefaultParameters(){return{orientation:wi,rows:-1,columns:-1}}begin(e,t,n,o,s){this.bn.length=0;let a,l;if(this._a!=null){let p=this.$vertices.slice();p.sort(this._a),this.$vertices=p}if(this.An===-1&&this.Sn===-1){let p=Math.round(Math.sqrt(this.$vertices.length));a=p+(this.H===wi?1:0),l=p+(this.H===lb?1:0)}else this.An!==-1?(a=this.An,l=Math.ceil(this.$vertices.length/a)):this.Sn!==-1&&(l=this.Sn,a=Math.ceil(this.$vertices.length/l));this.Br=-1/0,this.Fr=-1/0;let h=0,[d,u]=this.H===wi?[a,l]:[l,a];for(let p=0;p<d;p++){this.bn[p]=[];for(let g=0;g<u;g++)if(h=p*u+g,h<this.$vertices.length){let m=this.$vertices[h],E=this.getSize(m.id,o);this.Br=Math.max(this.Br,E.width),this.Fr=Math.max(this.Fr,E.height),this.bn[p][g]={vertex:m,size:E}}}}end(e,t,n,o,s){}reset(){}TE(e){let t=this.H===wi&&this.An===1||this.Oa===We?0:this.Oa===It?(this.Br-e.width)/2:this.Br-e.width,n=this.H===lb&&this.Sn===1||this.Pa===Te?0:this.Pa===It?(this.Fr-e.height)/2:this.Fr-e.height;return{padX:t,padY:n}}step(e,t,n,o,s){let a=0,l=0;for(let h=0;h<this.bn.length;h++){for(let d=0;d<this.bn[h].length;d++){let u=this.bn[h][d],{padX:p,padY:g}=this.TE(u.size);n(u.vertex.id,a+p,l+g),this.H===wi?a+=this.padding.x*2+(this.An===1?u.size.width:this.Br):l+=this.padding.y*2+(this.Sn===1?u.size.height:this.Fr)}this.H===wi?(l+=this.padding.y*2+this.Fr,a=0):(a+=this.padding.x*2+this.Br,l=0)}this.done=!0}};c(bo,"type",bm),Ke.register(bo.type,bo);var El=class extends bo{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:lb,columns:1})})),this.type=Am}};c(El,"type",Am),Ke.register(El.type,El);var fl=class extends bo{constructor(r){super(Object.assign(r,{options:Object.assign(r.options||{},{orientation:wi,rows:1})})),this.type=Sm}};c(fl,"type",Sm),Ke.register(fl.type,fl);var LO=1e-11,Tm=class Tm extends qn{constructor(e){super(e);c(this,"ko");c(this,"type",Tm.type);c(this,"k",new Map);c(this,"di",new Map);c(this,"pi");c(this,"Lt");c(this,"Ho",1/0);c(this,"Wo",-1/0);c(this,"Zo",1/0);c(this,"Jo",-1/0);c(this,"wt",[]);c(this,"Ra",new Map);c(this,"Dt");c(this,"La");this.Dt=An(this.getDefaultParameters(),e.options),this.Lt=e.options.absoluteBacked!==!1}getDefaultParameters(){return{iterations:15,spacing:250,r:.25,locationFunction:this.hi}}Tn(e,t,n){return t=Jg(t),n=Jg(n),e.x=t,e.y=n,e.center.x=t+e.width/2,e.center.y=n+e.height/2,{vE:t,CE:n}}vn(e){return this.di.get(e.id)===!0}PE(e){this.di.set(e.id,!0)}reset(){super.reset(),this.k.clear(),this.di.clear(),this.ko=0,this.Ho=this.Zo=1/0,this.Wo=this.Jo=-1/0,this.Ra.clear()}begin(e,t,n,o,s){this.wt.length=0,this.k.clear(),this.ko=0,this.Ho=1/0,this.Wo=-1/0,this.Zo=1/0,this.Jo=-1/0,this.La=this.Dt.r,this.Lt&&this.$vertices.forEach(a=>{let l=this.$_findLocation(a,s);l!=null&&l.x!=null&&l.y!=null&&n(a.id,l.x,l.y)})}gt(e,t,n){let o=j(e)?e.getParent():e,s=this.k.get(o.id);if(!s){let a=t(o.id)||this.fE(o.id,n,this.width,this.height,!0),l=this.getSize(o.id,n);l.width===0&&(l.width=1),l.height===0&&(l.height=1),s={id:o.id,n:o,x:a.x,y:a.y,f:[0,0],width:l.width,height:l.height,center:{x:a.x+l.width/2,y:a.y+l.height/2}},this.k.set(o.id,s),this.Ra.set(o.id,this.instance.getAllEdgesFor(o).filter(h=>this.adapter.filter(h.target)))}return s}wa(e,t,n){return this.wt[e]?this.wt[e]:(this.wt[e]=this.gt(this.$vertices[e],t,n),this.wt[e])}step(e,t,n,o,s){let a;for(this.pi=0,a=0;a<this.$vertices.length;a++){let l=this.wa(a,t,o);if(this.Lt&&!this.vn(l)){let d=this.getAbsolutePosition(l.n,s);if(d!=null&&d.x!=null&&d.y!=null&&!isNaN(d.x)&&!isNaN(d.y)){this.rd(l,d.x,d.y),n(l.id,d.x,d.y),this.PE(l),l.x=d.x,l.y=d.y,l.f[0]=0,l.f[1]=0;continue}}for(let d=a+1;d<this.$vertices.length;d++){let u=this.wa(d,t,o);this.OE(l,u)}let h=this.Ra.get(l.id);for(let d=0;d<h.length;d++)this._E(l,h[d],t,o)}if(this.pi!==0){let l=s.spacing*.62;for(a=0;a<this.$vertices.length;a++){let h=this.wa(a,t,o);if(!this.vn(h)){let d=h.f[0],u=h.f[1],p=Math.sqrt(d*d+u*u);p>l&&(d=d/p*l,u=u/p*l),this.rd(h,h.x+d,h.y+u)}h.f[0]=0,h.f[1]=0}}this.ko++,(this.pi===0||this.ko>=this.Dt.iterations)&&(this.RE(n,o),this.done=!0)}end(e,t,n,o,s){this.di.clear(),this.k.forEach((a,l)=>{this.di.set(l,!0)})}rd(e,t,n){let{vE:o,CE:s}=this.Tn(e,t,n);this.Ho=Math.min(this.Ho,o),this.Zo=Math.min(this.Zo,s),this.Wo=Math.max(this.Wo,o),this.Jo=Math.max(this.Jo,s)}RE(e,t){this.k.forEach((n,o)=>{let s=this.k.get(o);e(o,Math.floor(s.x),Math.floor(s.y))})}OE(e,t){let n=this.vn(e),o=this.vn(t);if(n&&o||e.width===0||e.height===0||t.width===0||t.height===0)return;let s,a,l,h;if(rt(e,t))h=1,s=1,a=1;else{let d=[e.center,t.center],u=ar(d,e)[0],p=ar(d,t)[0];s=p.x-u.x,a=p.y-u.y,l=s*s+a*a,h=Math.sqrt(l),h<LO&&(h=1,s=1,a=1)}if(h<this.Dt.spacing){this.pi++;let d=this.La*(this.Dt.spacing-h),u=1,p=1,g=u*d*s/h,m=p*d*a/h,E=o?0:(n?2:1)*g,y=o?0:(n?2:1)*m,x=n?0:(o?2:1)*g,f=n?0:(o?2:1)*m;t.f[0]+=E,t.f[1]+=y,e.f[0]-=x,e.f[1]-=f}}_E(e,t,n,o){let s=this.gt(t.target,n,o),a=this.vn(e),l=this.vn(s);if(a&&l)return;this.pi++;let h,d,u,p,g;if(rt(e,s))p=-2*this.Dt.spacing,h=-2*this.Dt.spacing,d=-2*this.Dt.spacing;else{let y=[e.center,s.center],x=ar(y,e)[0],f=ar(y,s)[0];h=f.x-x.x,d=f.y-x.y,u=h*h+d*d,p=Math.sqrt(u),p<LO&&(p=1,h=1,d=1)}g=this.La*(p-this.Dt.spacing),(t.cost==null||t.cost<1)&&(t.cost=1),g*=Math.log(t.cost)*.5+1;let m=g*h/p,E=g*d/p;s.f[0]-=l?0:(a?2:1)*m,s.f[1]-=l?0:(a?2:1)*E,e.f[0]+=a?0:(l?2:1)*m,e.f[1]+=a?0:(l?2:1)*E}};c(Tm,"type","ForceDirected");var $c=Tm;Ke.register($c.type,$c);function kN(i,r){for(let e=0;e<i.length;e++)if(i[e].target!==r||i[e].source!==r)return!1;return!0}var Os=class extends qn{constructor(e){super(e);c(this,"nd");c(this,"Et");c(this,"od");this.nd=!!e.options.ignoreLoops,this.od=e.options.ignorePorts===!0,this.Et=e.options.getRootNode||(t=>e.options.multipleRoots!==!1?t.filter(n=>{if(Xx(n)){let o=n.getTargetEdges();return(o.length===0||kN(o,n))&&this.adapter.filter(n)}else return!1}).getAll():this.$vertices.length>0?[this.$vertices[0]]:null)}begin(e,t,n,o,s){super.begin(e,t,n,o,s),s.ignoreLoops=this.nd,s.getRootNode=this.Et,s.getChildVertices=s.getChildVertices||((a,l,h)=>{let d=[];return h.getAllEdgesFor(a).forEach(u=>{let p=j(u.target)?u.target.getParent():u.target;(u.source===a||this.od!==!0&&j(u.source)&&u.source.getParent()===a)&&this.adapter.filter(p)&&d.push(p)}),d}),s.rootNode=s.getRootNode(e),s.rootNode||(this.done=!0)}};var hb=It,cb={x:60,y:60},db="auto",ub=It;function Bc(i){return i.parents.length>0?i.parents[0].loc:null}function vm(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function WN(i){return i.parents.length>0?i.parents[0].root===!0:!1}function wO(i){return i.parents.length>0?i.parents[0].childGroup:null}function ZN(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var Fc=class{constructor(r,e){this.dataSource=r;c(this,"Ur");c(this,"Qt");c(this,"Pe");c(this,"L",[]);c(this,"zr",[]);c(this,"mi",{});c(this,"ie");c(this,"ee");c(this,"Nt");c(this,"ge");c(this,"gi");c(this,"Se");c(this,"Lt");c(this,"I");c(this,"Cn",-1/0);c(this,"Pn",1/0);c(this,"Ei");c(this,"It");c(this,"fi");c(this,"Ne",[]);c(this,"positions",new Map);c(this,"Da",{[It]:r=>Bc(r)+vm(r,this.ee)/2-(r.size-this.ee)/2,start:r=>Bc(r),end:r=>Bc(r)+vm(r,0)-(r.size-this.ee)});c(this,"W");c(this,"Vt");c(this,"er");c(this,"yi");c(this,"$a",{center:(r,e,t)=>(e+t)/2-vm(r)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Ur=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Qt=e.compress===!0,this.Lt=e.absoluteBacked===!0,this.W=e.idFunction,this.Vt=e.sizeFunction,this.er=e.childVerticesFunction,this.yi=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.gi=this.ge===0?1:0,this.Ei=this.Se?"y":"x",this.It=this.Se?_e:Ve,this.fi=this.Se?Ve:_e,this.Pe=e.invert===!0,this.I=e.alignment||ub,this.ie=e.padding,this.ee=this.Se?this.ie.x:this.ie.y,this.Nt=this.Se?this.ie.y:this.ie.x}execute(){let r,e,t;for(let n=0;n<this.Ur.length;n++){r=this.Ur[n];let o=this.Vt(r.id),s=this.et(r,o,0,null,null),a=0;s.root=!0,a=this.xi(s,0);let l=0,h,d,u=(g,m)=>this.Qt&&g.parents&&g.parents.length>0?this.positions.get(this.W(g.parents[0].node)).position[this.Ei]+this.Na(g,this.gi)+this.Nt:m,p=!1;if(a===0&&this.Lt===!0){let g=this.yi(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.bi(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.bi(this.W(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Nt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Nt,l+=this.L[e].otherAxisSize)}}return this.positions}bi(r,e,t){this.positions.set(r,{position:e,layer:t});let n=this.Vt(r),o=this.ge===0?e.x+n.width:e.y+n.height;this.Cn=Math.max(this.Cn,o),this.Pn=Math.min(this.Pn,o)}gt(r){let e=this.L[r];return e||(e={entries:[],pointer:0},this.L[r]=e),e}et(r,e,t,n,o){let s=this.gt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.It],children:[]},l=e[this.fi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.It]+this.ee,s.entries.push(a),n&&n.children.push(a),a}Ia(r,e){let t=this.zr[e];t||(t=[],this.zr[e]=t),r.index=t.length,t.push(r)}Va(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.gt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.ee)}}Na(r,e){let t=r.parents.map(n=>n.dimensions[e===0?_e:Ve]);return Math.max.apply(null,t)}Ma(r){if(r.size>0){let e=this.Da[this.I](r),t=this.zr[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.ee}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.ee;o!==0&&this.Ga(r),this.Ia(r,r.depth)}}Ba(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.$a[this.I](r,e,t),o=n-Bc(r);if(this.Va(r,n),!WN(r)){let s=wO(r),a=ZN(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ga(r){let e=r;for(;e!=null;)this.Ba(e),e=wO(e)}xi(r,e){if(this.mi[r.node.id])return;this.mi[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[]},n=[],o,s={},a=this.gt(e+1),l=this.er(r.node,e,this.dataSource);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.Vt(this.W(h)),u=a.entries.find(p=>this.W(p.node)===this.W(h));if(u!=null){u.parents.push(r);let p=Bc(u),g=vm(u,this.ee),m=p+g/2-u.size/2,E=m-u.loc,y=x=>{for(let f=x.childGroupIndex;f<x.childGroup.nodes.length;f++)x.childGroup.nodes[f].loc+=E,x.children.forEach(y),x.childGroup.size+=E};y(u)}else{let p=this.et(h,d,e+1,r,t);p.childGroupIndex=t.nodes.length,t.nodes.push(p);let g=d[this.It];t.size+=g+this.ee,n.push(p)}s[h.id]=!0}}for(this.Ma(t),o=0;o<n.length;o++)this.xi(n[o],e+1);return l.length}};var DO="Hierarchical",Cm=class Cm extends Os{constructor(e){super(e);c(this,"type",Cm.type);c(this,"H");c(this,"Se");c(this,"ge");c(this,"Qt");c(this,"Pe");c(this,"I");c(this,"sd");c(this,"L",[]);c(this,"er");this.Pe=e.options.invert,this.sd=e.options.spacing||db,this.Qt=this.sd==="compress",this.I=e.options.align||hb,this.H=e.options.orientation!=null?e.options.orientation:"horizontal"}getDefaultParameters(){return{padding:cb,orientation:this.H,locationFunction:this.hi,align:this.I}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.H=s.orientation,this.Se=this.H==="horizontal",this.ge=this.Se?0:1,this.padding=s.padding,this.L.length=0,this.er=s.getChildVertices}step(e,t,n,o,s){new Fc(e,{rootNode:s.rootNode,compress:this.Qt,padding:this.padding,axisIndex:this.ge,invert:this.Pe,alignment:this.I,idFunction:h=>e.getNodeId(h),sizeFunction:h=>this.getSize(h,o),childVerticesFunction:(h,d,u)=>this.er(h,d,u),absoluteBacked:this.absoluteBacked,absolutePositionFunction:h=>this.getAbsolutePosition(h,s)}).execute().forEach((h,d)=>{n(d,h.position.x,h.position.y)}),this.done=!0}getHierarchy(){return this.L}getOrientation(){return this.H}};c(Cm,"type",DO);var Uc=Cm;Ke.register(Uc.type,Uc);var Pm=class{constructor(r){this.focus=r;c(this,"id");c(this,"children",new Set);c(this,"de",new Map);c(this,"ad",new Map);c(this,"group");c(this,"extents");c(this,"offsets");this.id=G(),this.group=[r]}setPosition(r,e,t){this.de.set(r,{x:e,y:t})}getPosition(r){return this.de.get(r)}getIncidentAngle(r){return this.ad.get(r)}setIncidentAngle(r,e){this.ad.set(r,e)}getPositions(){return this.de}},JN=100,KN={x:50,y:50},_m=class _m extends Os{constructor(e){super(e);c(this,"type",_m.type);c(this,"ld");c(this,"tt",[]);c(this,"clusterMagnetizer");c(this,"groupPadding");this.groupPadding=e.options.groupPadding||JN,this.padding=e.options.padding||KN,this.clusterMagnetizer=new Li({positionGetter:t=>({x:t.extents[0],y:t.extents[2]}),positionSetter:(t,n)=>{for(let o=0;o<t.group.length;o++){let s=t.offsets[t.group[o].id];t.setPosition(t.group[o].id,n.x+s.x,n.y+s.y)}},getSize:t=>({width:t.extents[1]-t.extents[0],height:t.extents[3]-t.extents[2]}),getId:t=>t.focus.id,filter:t=>this.tt[0].focus.id!==t})}getDefaultParameters(){return{padding:this.padding,locationFunction:this.hi,groupPadding:this.groupPadding,getChildEdges:(e,t,n)=>n.getAllEdgesFor(e,o=>{let s=j(o.source)?o.source.getParent():o.source,a=j(o.target)?o.target.getParent():o.target;return s===e&&s!==a&&this.adapter.filter(a)})}}begin(e,t,n,o,s){super.begin(e,t,n,o,s),this.tt.length=0,this.ld=s.getChildEdges}hd(e,t,n,o,s,a,l){let h=(T,S,O,v)=>({x:T-a.padding.x,y:S-a.padding.y,width:O+2*a.padding.x,height:v+2*a.padding.y}),d,u=new Pm(e),p=s?s.position:{x:0,y:0},g=p.x,m=p.y,E={},y=T=>E[T]||(E[T]=this.getSize(T,o),E[T]),x,f,b;u.setPosition(e.id,p.x,p.y);let A=this.ld(e,l,this.instance);for(let T=0;T<A.length;T++){let S=A[T].target,O=j(S)?S.getParent():S;u.children.add(O)}if(x=y(u.focus.id),d=Math.max(x.width,x.height),b=h(g-x.width/2,m-x.height/2,x.width,x.height),n(u.focus.id,-(x.width/2),-(x.height/2)),u.children.size>0){this.tt.push(u);let T=2*Math.PI/(u.children.size+(s?1:0)),S=s?s.incidentAngle+Math.PI+T:Math.PI,O=S,v=null;u.children.forEach(N=>{f=y(N.id);let V=h(g+Math.sin(S)*f.width,m+Math.cos(S)*f.height,f.width,f.height),D=Ri(b,V),$=Math.sqrt(Math.pow(V.x+D.x-g,2)+Math.pow(V.y+D.y-m,2));if(d=Math.max(d,$),u.setPosition(N.id,V.x+D.x,V.y+D.y),S+=T,v!=null){let K=y(v.id),xe=u.getPosition(v.id),H=h(xe.x,xe.y,K.width,K.height),Ee=y(N.id),Fe=u.getPosition(N.id),Je=h(Fe.x,Fe.y,Ee.width,Ee.height),Xt=Ri(H,Je),sr={x:xe.x+K.width/2,y:xe.y+K.height/2},rr={x:Fe.x+Xt.x+Ee.width/2,y:Fe.y+Xt.y+ +(Ee.height/2)},Dr=Math.sqrt(Math.pow(sr.x-rr.x,2)+Math.pow(sr.y-rr.y,2));d=Math.max(d,Dr/2/Math.sin(T/2))}v=N}),S=O,u.children.forEach(N=>{u.setIncidentAngle(N.id,S),u.setPosition(N.id,g+Math.sin(S)*d,m+Math.cos(S)*d),S+=T});let _=u.getPosition(e.id),P=_.x,I=y(e.id),C=P+I.width,R=_.y,w=R+I.height,B;u.children.forEach(N=>{if(!this.hd(N,t,n,o,{parent:e,incidentAngle:u.getIncidentAngle(N.id),position:u.getPosition(N.id)},a,l+1)){B=y(N.id),u.group.push(N);let D=u.getPosition(N.id);P=Math.min(P,D.x),C=Math.max(C,D.x+B.width),R=Math.min(R,D.y),w=Math.max(w,D.y+B.height)}}),u.extents=[P,C,R,w],u.offsets={};for(let N=0;N<u.group.length;N++){let V=u.group[N],D=u.getPosition(V.id);u.offsets[V.id]={x:D.x-u.extents[0],y:D.y-u.extents[2]}}}return u.children.size}step(e,t,n,o,s){if(s.rootNode&&s.rootNode.length>0){if(this.hd(s.rootNode[0],t,n,o,null,s,0),this.tt.length>0){let a=(this.tt[0].extents[0]+this.tt[0].extents[1])/2,l=(this.tt[0].extents[2]+this.tt[0].extents[3])/2;this.clusterMagnetizer.setElements(this.tt),this.clusterMagnetizer.executeAtPoint({x:a,y:l},{padding:{x:100,y:100}})}for(let a=0;a<this.tt.length;a++)this.tt[a].getPositions().forEach((h,d)=>{n(d,h.x,h.y)})}this.done=!0}};c(_m,"type","Balloon");var Yc=_m;Ke.register(Yc.type,Yc);var Rs=class{constructor(r){this.model=r}};var Cr="edge",yl="vertex",zc="center",Om=30;function dt(i){return i.type===Cr}var Xc=class extends Rs{constructor(e,t){super(e);this.vertexSet=t;c(this,"rr",new Map);c(this,"Ko",!1);c(this,"nr");c(this,"Yr",[]);c(this,"cd",new Set);c(this,"Ai");this.Ai=e.layout.Ai}LE(e){let t=this.model.getAdjacentVertices(e);return t.vertices.filter(n=>this.rr.has(n.id)==!1).filter(n=>t.target.findIndex(o=>o.id===n.id)!==-1?t.source.findIndex(o=>o.id===n.id)===-1:!1).length}dd(e,t){let n=this.model.getAdjacentVertices(e.id),o=n.vertices;Array.from(n.filteredEdges).forEach(h=>this.cd.add(h));let s=[],a,l;for(a=0;a<o.length;a++)if(!this.rr.has(o[a].id))if(l=this.model.getVertex(o[a].id),l!=null)if(this.LE(o[a].id)===0){let d=t+1,u=this.model.getAdjacentVertices(o[a].id).target.filter(p=>this.rr.has(p.id));if(u.length>0){let p=Math.max(...u.map(g=>this.vertexSet.findLayerIndex(g.id)));d=Math.max(d,p+1)}this.vertexSet.addToLayer(d,l),s.push(l),o[a].edges.forEach(p=>{let g={edge:p,id:p.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1,type:Cr,entries:[]};this.vertexSet.edgeNodes.push(g),this.vertexSet.edgeNodeMap.set(p.id,g)})}else o[a].edges.forEach(d=>{let u={edge:d,id:d.id,sourceNode:e,targetNode:l,rootLayer:-1,targetLayer:-1,span:-1/0,type:Cr,entries:[]};this.vertexSet.edgeNodes.push(u),this.vertexSet.edgeNodeMap.set(d.id,u),this.Yr.push([l,t+1,u])});else this.model.excludedNodes[o[a].id]=!0;for(a=0;a<s.length;a++)this.rr.set(s[a].id,!0),this.dd(s[a],t+1)}wE(){let e,t=(o,s)=>o.span>s.span?-1:o.span<s.span?1:o.rootLayer<s.rootLayer?-1:o.rootLayer>s.rootLayer?1:0,n=[];this.vertexSet.edgeNodes.forEach(o=>{o.rootLayer=this.model.getLayer(o.sourceNode),o.targetLayer=this.model.getLayer(o.targetNode),o.rootLayer!=null&&o.targetLayer!=null&&(o.span=o.targetLayer-o.rootLayer,o.span>1&&(n.length===0?n.push(o):t(o,n[0])<=0?n.unshift(o):n.push(o)))});for(let o=0;o<n.length;o++){let s=n[o];if(s.span>1){let l=this.vertexSet.layers[s.rootLayer].entries.filter(u=>!dt(u)),h=l.findIndex(u=>u.obj.id===s.sourceNode.id),d=l.length===1?!1:h<l.length/2;e=this.vertexSet.insertEdgeNodeInLayer(s.rootLayer+1,s,d),this.vertexSet.edgeEntryMap.set(e.id,e);for(let u=s.rootLayer+2;u<s.targetLayer;u++){let p=this.vertexSet.addToLayer(u,s,d);this.vertexSet.edgeEntryMap.set(p.id,p),p.previous=e,e.next=p,e=p}}}}execute(e){for(this.rr.clear(),this.Ko=!1,this.nr=0,this.Yr.length=0,this.rr.set(e.id,!0);!this.Ko;)if(this.dd(e,this.nr),this.Yr.length>0)if(this.Yr=this.Yr.filter(t=>!this.rr.has(t[0].id)),this.Yr.length>0){let t=this.Yr.splice(0,1)[0];e=t[0],this.nr=t[1],this.rr.set(e.id,!0),this.vertexSet.addToLayer(this.nr,e)}else this.Ko=!0;else this.Ko=!0;this.Ai&&this.DE(),this.wE()}DE(){let e=this.vertexSet.layers.length-1;if(!(e<=0))for(let t=0;t<e;t++)this.vertexSet.layers[t].entries.filter(s=>!dt(s)&&s.leaf).forEach(s=>{this.vertexSet.removeFromLayer(t,s),this.vertexSet.addToLayer(e,s)})}getFilteredEdges(){return Array.from(this.cd)}};var pb=i=>{let r=0;for(let e=0;e<i.length;e++){let t=i[e];t.length>0&&t[0].leaf&&r++,t.length>1&&t[t.length-1].leaf&&r++}return r};function qN(i){let r=0;return i.forEach(e=>r+=e[1]),r/i.length}var Ls=class{constructor(r,e,t){this.vertexSet=r;this.getAdjacentEntries=e;c(this,"Si");c(this,"Ti");t=t||{},this.Si=t.maxIterations||24,this.Ti=t.maxIterationsWithoutImprovement||5}NE(){let r=[];for(let e=0;e<this.vertexSet.layers.length;e++)r.push(this.vertexSet.layers[e].entries.slice());return r}execute(){let r=this.NE(),e=r,t=0,n=this.ud(r),o=pb(e);for(let s=0;s<this.Si;s++){let a=this.IE(s,e),l=this.ud(a);if(l.total<n.total)n=l,t=0,o=pb(a);else if(l.total===n.total){let h=pb(a);h>o&&(n=l,t=0,o=h)}else t++;if(e=a,n.total===0||t>=this.Ti)break}this.vertexSet.layers.forEach((s,a)=>{s.entries=n.ordering[a]})}ud(r){let e=0,t=[],n;for(let o=r.length-2;o>-1;o--)n=this.VE(o,r,o+1),t[o]=n,e+=n.length;return{total:e,layers:t,ordering:r}}VE(r,e,t){let n=[],o=e[r],s=e[t],a=new Array(s.length);for(let u=0;u<a.length;u++)a[u]=[];let l=[],h,d=[];for(h=0;h<o.length;h++){let u=o[h],p=h,g=this.getAdjacentEntries(e,t,u),m=[];for(let E=0;E<g.length;E++){let y=g[E][1];m.push(y)}m.sort(function(E,y){return E-y}),l[p]=m}for(h=0;h<l.length;h++)d=d.concat(l[h].map(u=>[h,u]));for(h=0;h<d.length;h++){let u=d[h],p={sourceLayer:r,targetLayer:t,sourceVertex:u[0],targetVertex:u[1]};a[u[1]].push(p);for(let g=u[1]+1;g<a.length;g++)n.push(...a[g])}return n}IE(r,e){let t=[],n;if(r%2===0){for(n=e.length-1;n>0;n--)t[n]=this.pd(n,e,!1);t[0]=e[0].slice()}else{for(n=0;n<e.length-1;n++)t[n]=this.pd(n,e,!0);t[e.length-1]=e[e.length-1].slice()}return t}pd(r,e,t){let n=e[r],o=n.length,s=[],a=t?r+1:r-1,l={},h;if(o===1)return n;for(h=0;h<o;h++){let d=n[h],u=this.getAdjacentEntries(e,a,d),p=u.filter(m=>!dt(m[0])),g=u.filter(m=>dt(m[0]));g.length>0&&(g.sort((m,E)=>m[0].obj.span>E[0].obj.span?-1:E[0].obj.span>m[0].obj.span?1:0),p.push(g[0])),u.length>0?s.push([d,qN(p)]):(l[d.obj.id]=!0,s.push([d,-1]))}return s.sort((d,u)=>l[d[0].id]||l[u[0].id]?0:d[1]<u[1]?-1:u[1]<d[1]?1:d[0].type===yl&&u[0].type===yl?0:d[0].type===Cr&&u[0].leaf?-1:u[0].type===Cr&&d[0].leaf?1:0),s.map(d=>d[0])}};var NO="xmax",IO="ymax",MO="xmin",VO="ymin",Rm="_min",Lm="_max",jc=class{constructor(r,e,t,n,o){this.D=r;this.ue=e;this.axis=t;this.Pe=n;this.ME=o;c(this,"vi",{})}execute(){this.vi={};let r=this.ME(),e={},t=this.axis===0?{[Rm]:MO,[Lm]:NO}:{[Rm]:VO,[Lm]:IO},n=this.axis===1?{[Rm]:MO,[Lm]:NO}:{[Rm]:VO,[Lm]:IO},o=null;for(let a=0;a<this.ue.layers.length-1;a++){let l=this.ue.layers[a],h=this.ue.layers[a+1],d=Math.min(l[t.Te],h[t.Te]),p=Math.max(l[t.Mt],h[t.Mt])-d,g=this.Pe?n.Te:n.Mt,m=this.Pe?n.Mt:n.Te,E=l[g],x=h[m]-E,f={id:`r${a}`,type:"channel",axis:this.axis,left:this.axis===0?d:E,top:this.axis===1?d:E,width:this.axis===0?p:x,height:this.axis===1?p:x,lines:[]};this.ue.regions.push(f);for(let b=0;b<l.entries.length;b++){let A=l.entries[b],T=r.getVertexPosition(A.id)||A.loc,S={left:T.x,top:T.y,width:A.size.width,height:A.size.height,type:A.type,id:A.id,lines:[],paddingRegion:null,paddingRegionGate:null,gateDown:null,gateUp:null};this.ue.regions.push(S),this.vi[A.id]=S;let O=S;if(this.axis===0){let v=this.axis===0?S.top+S.height:S.left+S.width,_=this.axis===0?f.top:f.left;if(v<_){let P={left:this.axis===0?T.x:T.x+A.size.width,top:this.axis===0?T.y+A.size.height:T.y,width:this.axis===0?A.size.width:_-v,height:this.axis===0?_-v:A.size.height,type:A.type,id:`${A.id}_pad`,lines:[]};this.ue.regions.push(P),S.paddingRegion=P,S.paddingRegionGate=this.qo(A,T,S,P,!0),O=P}}S.gateDown=this.qo(A,T,O,f,!0),o!=null&&(S.gateUp=this.qo(A,T,o,S,!1))}o=f}let s=this.ue.layers[this.ue.layers.length-1];for(let a=0;a<s.entries.length;a++){let l=s.entries[a],h=r.getVertexPosition(l.id),d={left:h.x,top:h.y,width:l.size.width,height:l.size.height,type:l.type,id:l.id,lines:[],gateUp:null};this.ue.regions.push(d),this.vi[l.id]=d,o!=null&&(d.gateUp=this.qo(l,h,o,d,!1))}return this.ue.edgeNodes.forEach(a=>{let l=a.edge,h=j(l.source)?l.source.getParent():l.source,d=j(l.target)?l.target.getParent():l.target,u=this.D.entryMap[h.id],p=this.D.entryMap[d.id],g=this.vi[u.id],m=this.vi[p.id],E=[],y=u.layer<p.layer?1:-1;if(u.layer<p.layer){g.paddingRegionGate!=null&&E.push(g.paddingRegionGate),E.push(g.gateDown);for(let f=0;f<a.entries.length;f++){let b=a.entries[f],A=`r${b.layer-1}:${b.id}`;E.push(this.ue.gateMap[A]);let T=`${b.id}:r${b.layer}`;E.push(this.ue.gateMap[T])}E.push(m.gateUp)}else{E.push(g.gateUp);for(let f=a.entries.length-1;f>-1;f--){let b=a.entries[f],A=`${b.id}:r${b.layer}`;E.push(this.ue.gateMap[A]);let T=`r${b.layer-1}:${b.id}`;E.push(this.ue.gateMap[T])}m.paddingRegionGate!=null&&E.push(m.paddingRegionGate),E.push(m.gateDown)}let x={id:l.id,sourceId:l.source.id,targetId:l.target.id,path:E.map(f=>f.id),pathDirection:y};this.ue.edgeRoutingMap[l.id]=x,this.ue.edgeRouting.push(x),e[l.id]=E}),e}qo(r,e,t,n,o){let s=this.axis===0?e.x:e.y,a=this.axis===0?r.size.width:r.size.height,l=this.axis===0?e.y:e.x,h=this.axis===0?r.size.height:r.size.width,d=this.Pe?l+(o?0:h):l+(o?h:0);return this.GE(t,n,this.axis,{point1:s,point2:s+a},a,d,{x:this.axis===0?s+a/2:d,y:this.axis===0?d:s+a/2})}GE(r,e,t,n,o,s,a){let l={id:`${r.id}:${e.id}`,a:{type:r.type,id:r.id},b:{type:e.type,id:e.id},axis:t,otherAxisLocation:s,segment:n,length:o,midpoint:a,edges:[]};return this.ue.gates.push(l),this.ue.gateMap[l.id]=l,l}};function QN(i,r){let e=[],t=[],n=[],o={},s={},a={},l=i.getAllEdges(),h=[],d=new Set,u=(p,g)=>{let m=Kn(p.source),y={edge:p,isSource:m===g,sourceVertex:m,targetVertex:Kn(p.target)};return h.push(y),y};Y(i)&&i.getMembers().forEach(p=>{p.getAllEdges().forEach(g=>{(ke(g.source,i)&&!ke(g.target,i)||ke(g.target,i)&&!ke(g.source,i))&&u(g,p)})}),r!=null?l.forEach(p=>{r(p)?u(p,i):d.add(p)}):l.forEach(p=>u(p,i));for(let p=0;p<h.length;p++){let g=h[p].isSource?h[p].targetVertex.id:h[p].sourceVertex.id;o[g]||(o[g]={id:g,edges:new Set},e.push(o[g])),o[g].edges.add(h[p].edge),h[p].isSource?(s[g]||(s[g]={id:g,edges:new Set},t.push(s[g])),s[g].edges.add(h[p].edge)):(a[g]||(a[g]={id:g,edges:new Set},n.push(a[g])),a[g].edges.add(h[p].edge))}return{vertices:e,source:t,target:n,filteredEdges:d}}function eI(i){return i.target.length===1&&(i.source.length===0||i.source[0].id===i.target[0].id)}var Hc=class{constructor(r,e,t){this.instance=r;this.layout=t;c(this,"ie");c(this,"pn",{});c(this,"Rt",{});c(this,"Qo",null);c(this,"md",[]);c(this,"gd",new Map);c(this,"Fa");c(this,"Ie");c(this,"Ci");c(this,"Pi",[]);c(this,"unattachedRootPadding");c(this,"vertexEntryMap",new Map);c(this,"entryMap",{});c(this,"assignedVertices",new Map);c(this,"axis");c(this,"invert");c(this,"sets",[]);c(this,"excludedNodes",{});c(this,"Ed");c(this,"adjacentVertices",{});this.ie=e.padding||{x:50,y:50},this.unattachedRootPadding=e.unattachedRootPadding,this.axis=e.axis,this.invert=e.invert===!0,this.Ed=e.setPosition,this.Fa=e.getSize,this.Qo=e.rootNode,this.Ie=e.edgeNodeSize,this.Ci=e.edgeFilter}nextRoot(){let r=this.Pi.find(t=>!this.assignedVertices.has(t.id));return r?r.obj:null}getVertex(r){return this.pn[r]}setRootNode(r){this.Qo=r}getLayer(r){return this.getLayerForId(r.id)}getLayerForId(r){return this.assignedVertices.get(r)}getSize(r){return this.Rt[r.id]}getNodeSizeInMainAxis(r){return this.getSizeInMainAxis(this.getSize(r))}getNodeSizeInOtherAxis(r){return this.getSizeInOtherAxis(this.getSize(r))}fd(){let r={width:50,height:50};return this.axis===0?r.width=this.Ie:r.height=this.Ie,r}getSizeInMainAxis(r){return this.axis===0?r.width:r.height}getSizeInOtherAxis(r){return this.axis===0?r.height:r.width}getPaddingInMainAxis(){return this.axis===0?this.ie.x:this.ie.y}getPaddingInOtherAxis(){return this.axis===0?this.ie.x:this.ie.y}initialize(){this.Pi.length=0,this.md.length=0,this.gd.clear(),this.assignedVertices.clear();let r=this.layout.$vertices.length;if(r>0){let e;for(let t=0;t<r;t++){e=this.layout.$vertices[t],this.Rt[e.id]=this.Fa(e.id),this.pn[e.id]=e;let n=QN(e,this.Ci);this.adjacentVertices[e.id]=n;let o={obj:e,id:e.id,adjacent:n.vertices,sourceEdges:n.source,targetEdges:n.target,leaf:eI(n),size:this.Fa(e.id),type:yl,layer:-1,vertexSet:null};this.Pi.push(o),this.vertexEntryMap.set(e.id,o),n.target.length===0&&(this.md.push(o),this.gd.set(e.id,o))}this.Pi.sort((t,n)=>{let o=this.Qo?this.Qo.id:"";return t.obj.id===o?-1:n.obj.id===o||t.adjacent.length===0?1:n.adjacent.length===0||t.targetEdges.length<n.targetEdges.length?-1:n.targetEdges.length<t.targetEdges.length?1:t.sourceEdges.length>n.sourceEdges.length?-1:n.sourceEdges.length>t.sourceEdges.length?1:0})}}isEmpty(){return this.Pi.length===0}getAdjacentEntries(r,e,t){let n=[];for(let o=0;o<r[e].length;o++)this.areConnected(r[e][o],t)&&n.push([r[e][o],o]);return n}getAdjacentEntriesInLayer(r,e){let t=[];for(let n=0;n<r.length;n++)this.areConnected(r[n],e)&&t.push({entry:r[n],index:n});return t}areConnected(r,e){return dt(r)&&r.obj.edge.source===e.obj||dt(e)&&e.obj.edge.source===r.obj||dt(r)&&r.obj.edge.target===e.obj||dt(e)&&e.obj.edge.target===r.obj||dt(r)&&dt(e)&&(r.next===e||r.previous===e||e.next===r||e.previous===r)?!0:this.areAdjacent(r.obj.id,e.obj.id)}areAdjacent(r,e){let t=this.getAdjacentVertices(r),n=this.getAdjacentVertices(e);return t!=null&&t.vertices.findIndex(o=>o.id===e)!==-1||n!=null&&n.vertices.findIndex(o=>o.id===r)!==-1}getAdjacentVertices(r){return this.adjacentVertices[r]||{vertices:[],source:[],target:[],filteredEdges:new Set}}isLeaf(r){let e=this.vertexEntryMap.get(r);return e!=null?e.leaf:!1}};function kc(i){return i.parents.length>0?i.parents[0].loc:null}function wm(i,r){if(i.parents.length===0)return null;{let e=i.parents[0].size;for(let t=1;t<i.parents.length;t++)e+=r+i.parents[t].size;return e}}function tI(i){return i.parents.length>0?i.parents[0].root===!0:!1}function GO(i){return i.parents.length>0?i.parents[0].childGroup:null}function rI(i){return i.parents.length>0?i.parents[i.parents.length-1].childGroupIndex:null}var ws=class{constructor(r,e){this.model=r;c(this,"Cn",-1/0);c(this,"Pn",1/0);c(this,"Ur");c(this,"Qt");c(this,"Pe");c(this,"L",[]);c(this,"zr",[]);c(this,"mi",{});c(this,"ie");c(this,"ee");c(this,"Nt");c(this,"ge");c(this,"gi");c(this,"Se");c(this,"Lt");c(this,"I");c(this,"Ei");c(this,"It");c(this,"fi");c(this,"Ne",[]);c(this,"de",new Map);c(this,"Da",{center:r=>kc(r)+wm(r,this.ee)/2-(r.size-this.ee)/2,start:r=>kc(r),end:r=>kc(r)+wm(r,0)-(r.size-this.ee)});c(this,"W");c(this,"Vt");c(this,"er");c(this,"yi");c(this,"$a",{center:(r,e,t)=>(e+t)/2-wm(r,0)/2,start:(r,e,t)=>e,end:(r,e,t)=>e});this.Ur=Array.isArray(e.rootNode)?e.rootNode:[e.rootNode],this.Qt=e.compress===!0,this.Lt=e.absoluteBacked===!0,this.W=e.idFunction,this.Vt=e.sizeFunction,this.er=e.childVerticesFunction,this.yi=e.absolutePositionFunction,this.ge=e.axisIndex,this.Se=this.ge!==1,this.gi=this.ge===0?1:0,this.Ei=this.Se?fe:ee,this.It=this.Se?_e:Ve,this.fi=this.Se?Ve:_e,this.Pe=e.invert===!0,this.I=e.alignment||zc,this.ie=e.padding||{x:50,y:50},this.ee=this.Se?this.ie.x:this.ie.y,this.Nt=this.Se?this.ie.y:this.ie.x}execute(){let r,e,t;for(let n=0;n<this.Ur.length;n++){r=this.Ur[n];let o=this.Vt(r.id),s=this.et(r,o,0,null,null),a=0;s.root=!0,a=this.xi(s,0);let l=0,h,d,u=(g,m)=>this.Qt&&g.parents&&g.parents.length>0?this.de.get(this.W(g.parents[0].node)).position[this.Ei]+this.Na(g,this.gi)+this.Nt:m,p=!1;if(a===0&&this.Lt===!0){let g=this.yi(r);!isNaN(g.x)&&!isNaN(g.y)&&(this.bi(r.id,g,0),p=!0)}if(!p)for(e=0;e<this.L.length;e++){for(this.L[e].otherAxis=l,t=0;t<this.L[e].entries.length;t++)h=this.ge===0?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),d=this.ge===1?this.L[e].entries[t].loc:u(this.L[e].entries[t],l),this.bi(this.W(this.L[e].entries[t].node),{x:h,y:d},e);this.Pe?e<this.L.length-1&&(this.L[e].otherAxisSize=this.Ne[e+1]+this.Nt,l-=this.L[e].otherAxisSize):(this.L[e].otherAxisSize=this.Ne[e]+this.Nt,l+=this.L[e].otherAxisSize)}}return this.de}bi(r,e,t){this.de.set(r,{position:e,layer:t});let n=this.Vt(r),o=this.ge===0?e.x+n.width:e.y+n.height,s=this.ge===0?e.x:e.y;this.Cn=Math.max(this.Cn,o),this.Pn=Math.min(this.Pn,s)}gt(r){let e=this.L[r];return e||(e={entries:[],pointer:0,otherAxis:null,otherAxisSize:null},this.L[r]=e),e}et(r,e,t,n,o){let s=this.gt(t),a={node:r,parents:n==null?[]:[n],childGroup:o,childGroupIndex:o==null?void 0:o.nodes.length,loc:s.pointer,index:s.entries.length,dimensions:e,size:e[this.It],children:[]},l=e[this.fi];return this.Ne[t]==null?this.Ne[t]=l:this.Ne[t]=Math.max(this.Ne[t],l),s.pointer+=e[this.It]+(r.type===Cr?0:this.ee),s.entries.push(a),n&&n.children.push(a),a}Ia(r,e){let t=this.zr[e];t||(t=[],this.zr[e]=t),r.index=t.length,t.push(r)}Va(r,e){if(r.parents.length>0){let t=e-r.parents[0].loc;for(let s=0;s<r.parents.length;s++)r.parents[s].loc+=t;let n=r.parents[r.parents.length-1],o=this.gt(r.depth-1);o.pointer=Math.max(o.pointer,n.loc+n.size+this.ee)}}Na(r,e){let t=r.parents.map(n=>n.dimensions[e===0?_e:Ve]);return Math.max.apply(null,t)}Ma(r){if(r.size>0){let e=this.Da[this.I](r),t=this.zr[r.depth],n=this.I==="end"?1/0:-1/0,o=0;if(t!=null&&t.length>0){let d=t[t.length-1],u=d.nodes[d.nodes.length-1];n=this.I==="end"?u.loc-r.size:u.loc+u.size+this.ee}this.I!=="end"&&e>=n||this.I==="end"&&e<=n?r.loc=e:(o=n-e,r.loc=n);let s=r.loc,a=this.I==="end"?r.nodes.length-1:0,l=this.I==="end"?-1:r.nodes.length,h=this.I==="end"?-1:1;for(let d=a;d!==l;d+=h)r.nodes[d].loc=s,s+=r.nodes[d].size,s+=this.ee;o!==0&&this.Ga(r),this.Ia(r,r.depth)}}Ba(r){let e=r.nodes[0].loc,t=r.nodes[r.nodes.length-1].loc+r.nodes[r.nodes.length-1].size,n=this.$a[this.I](r,e,t),o=n-kc(r);if(this.Va(r,n),!tI(r)){let s=GO(r),a=rI(r);for(let l=a+1;l<s.nodes.length;l++)s.nodes[l].loc+=o}}Ga(r){let e=r;for(;e!=null;)this.Ba(e),e=GO(e)}xi(r,e){if(this.mi[r.node.id])return;this.mi[r.node.id]=!0;let t={nodes:[],loc:0,size:0,parents:[r],depth:e+1,children:[],index:-1,id:G()},n=[],o,s={},a=this.gt(e+1),l=this.er(r.node,e,this.model);for(o=0;o<l.length;o++){let h=l[o];if(h!=null&&h!==r.node&&!s[h.id]){let d=this.Vt(this.W(h)),u=a.entries.find(p=>this.W(p.node)===this.W(h));if(u!=null){u.parents.push(r);let p=u.loc+u.size/2,g=kc(u),m=wm(u,this.ee),E=g+m/2,y=E-p;y>0&&this.$E(u,y,r)}else{let p=this.et(h,d,e+1,r,t);t.nodes.push(p);let g=d[this.It];t.size+=g+this.ee,n.push(p)}s[h.id]=!0}}for(this.Ma(t),o=0;o<n.length;o++)this.xi(n[o],e+1);return l.length}$E(r,e,t){let n={},o=s=>{let a=s.childGroup;if(n[a.id]!==!0){n[a.id]=!0;let l=s.childGroupIndex;for(let h=l;h<a.nodes.length;h++)a.nodes[h].loc+=e;l===0?a.loc+=e:a.size+=e}s.children.forEach(o)};o(r)}};var Wc=class extends Rs{constructor(e,t,n){super(e);this.model=e;this.vertexSet=t;c(this,"ir");c(this,"nr");c(this,"ie");c(this,"On");c(this,"_n");c(this,"I");c(this,"Ie");c(this,"Oi");n=n||{},this.ie=n.padding||{x:50,y:50},this.On=n.unattachedRootPadding||150,this.ir=n.lastPlacements,this._n=n.strategy||"parent",this.Ie=n.edgeNodeSize,this.Oi=n.gatherUnattachedRoots,this.I=n.alignment||"center"}BE(e,t){return{mainAxis:(e.length-1)*t+e.reduce((n,o)=>dt(o)?n+this.Ie:n+this.model.getSizeInMainAxis(o.size),0),otherAxis:e.reduce((n,o)=>Math.max(n,this.model.getSizeInOtherAxis(o.size)),0)}}execute(e){let t=0,n,o=this.model.getPaddingInMainAxis(),s=this.model.getPaddingInOtherAxis(),a=this.model.axis,l=this.ir?this.ir.maximumPointer+o:0,h=this.vertexSet.layers,d=l,u=h.map(m=>this.BE(m.entries,o)),p={rootId:e.id,rootSize:this.model.getNodeSizeInMainAxis(e),maximumPointer:d,rootPosition:d,biggestLayer:Math.max(...u.map(m=>m.mainAxis))},g=this.model.getNodeSizeInMainAxis(e);return n=this._n==="center"?(p.biggestLayer-g)/2:this._n==="start"?0:p.biggestLayer-g,h.length>0&&(this.model.invert?t-=u[0].otherAxis+2*s:t+=this.model.getNodeSizeInOtherAxis(e)+2*s,this._n==="parent"?this.FE(p,l):this.UE(h,n,a,p,l,t,u,o,s)),p.maximumPointer=Math.max(p.maximumPointer,p.rootPosition+p.rootSize+o),p}UE(e,t,n,o,s,a,l,h,d){let u=s,p;for(let g=0;g<e.length;g++){this.nr=e[g],t=this._n==="center"?(o.biggestLayer-l[g].mainAxis)/2:this._n==="start"?0:o.biggestLayer-l[g].mainAxis,u=s;for(let m=0;m<this.nr.entries.length;m++){p=this.nr.entries[m];let E=t+u,y=a,x=n===0?E:y,f=n===0?y:E;if(dt(p)){let b=n===0?this.Ie:y,A=n===0?y:this.Ie;p.loc={x,y:f,w:b,h:A},u+=this.Ie+h}else this.vertexSet.setPosition(p.obj,x,f,g),u+=this.model.getSizeInMainAxis(p.size)+h}o.maximumPointer=Math.max(o.maximumPointer,u),g<e.length-1&&(this.model.invert?a-=l[g+1].otherAxis+2*d:a+=l[g].otherAxis+2*d)}}FE(e,t){let n=new ws(this.model.layout.instance,{rootNode:this.vertexSet.layers[0].entries,padding:this.ie,axisIndex:this.model.axis,invert:this.model.invert,alignment:this.I,idFunction:d=>this.model.layout.instance.getNodeId(d),sizeFunction:d=>this.model.entryMap[d].size,childVerticesFunction:(d,u,p)=>{let g=[];if(u<this.vertexSet.layers.length-1){let m=this.model.getAdjacentEntriesInLayer(this.vertexSet.layers[u+1].entries,d).map(E=>E.entry);g.push(...m)}return g},absoluteBacked:this.model.layout.absoluteBacked,absolutePositionFunction:d=>this.model.layout.getAbsolutePosition(d,this.model.layout.parameters)}),o=n.execute(),s=n.Cn,a=n.Pn,l=0,h=0;if(this.Oi&&o.size===1&&this.ir!=null){let d=this.ir.rootPosition+this.ir.rootSize+this.On;o.get(e.rootId).position[this.model.axis===0?"x":"y"]=d,e.maximumPointer=d+e.rootSize}else if(this.ir){let d=this.ir.maximumPointer-a;this.model.axis===0?l=d:h=d}o.forEach((d,u)=>{this.vertexSet.setPositionById(u,d.position.x+l,d.position.y+h,d.layer),u===e.rootId&&(e.rootPosition=this.model.axis===0?d.position.x+l:d.position.y+h)}),e.maximumPointer=t+(s-a)}};var Zc=class{constructor(r,e){this.D=r;this.index=e;c(this,"layers",[]);c(this,"regions",[]);c(this,"gateMap",{});c(this,"edgeNodes",[]);c(this,"edgeNodeMap",new Map);c(this,"gates",[]);c(this,"edgeRoutingMap",{});c(this,"edgeRouting",[]);c(this,"yd",[]);c(this,"edgeEntryMap",new Map)}addToLayer(r,e,t){let n=this.xd(r),o=dt(e),s;return o?(s={id:G(),obj:e,previous:null,size:this.D.fd(),next:null,leaf:!1,type:Cr,layer:r,vertexSet:this},e.entries.push(s)):(s=this.D.vertexEntryMap.get(e.id),s.layer=r,s.vertexSet=this),this.D.entryMap[s.id]=s,t?n.entries.unshift(s):n.entries.push(s),this.D.assignedVertices.set(e.id,r),this.yd.push(s),s}findLayerIndex(r){var e;return(e=this.yd.find(t=>t.id===r))==null?void 0:e.layer}insertEdgeNodeInLayer(r,e,t){let n=this.xd(r),o=this.D.fd();this.D.assignedVertices.set(e.id,r);let s={id:G(),obj:e,size:o,leaf:!1,type:Cr,layer:r,vertexSet:this};e.entries.push(s),this.D.entryMap[s.id]=s;let a=t?1:-1,l=t?0:n.entries.length-1,h=null;for(;h==null&&l>=0&&l<n.entries.length;)dt(n.entries[l])?n.entries[l].obj.span<e.span&&(h=l):h=l,l+=a;let d=h!=null?t?h:h+1:t?0:n.entries.length;return n.entries.splice(d,0,s),s}removeFromLayer(r,e){let t=this.layers[r];t.entries.splice(t.entries.indexOf(e),1),this.D.assignedVertices.delete(e.id)}setPositionById(r,e,t,n){if(!this.D.layout.absoluteBacked)this.Rn(r,e,t,n);else{let o=this.D.layout.model.getVertex(r),s=this.D.layout.getAbsolutePosition(o);s.x!=null&&s.y!=null&&!isNaN(s.x)&&!isNaN(s.y)?this.Rn(r,s.x,s.y,n):this.Rn(r,e,t,n)}}setPosition(r,e,t,n){if(!this.D.layout.absoluteBacked)this.Rn(r.id,e,t,n);else{let o=this.D.layout.getAbsolutePosition(r);o.x!=null&&o.y!=null&&!isNaN(o.x)&&!isNaN(o.y)?this.Rn(r.id,o.x,o.y,n):this.Rn(r.id,e,t,n)}}xd(r){return this.layers[r]==null&&(this.layers[r]={layer:r,entries:[],xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0}),this.layers[r]}Rn(r,e,t,n){this.D.Ed(r,e,t,n);let o=this.layers[n],s=this.D.vertexEntryMap.get(r)||this.edgeEntryMap.get(r);if(s){let a=e+s.size.width,l=t+s.size.height;o.xmin=Math.min(o.xmin,e),o.ymin=Math.min(o.ymin,t),o.xmax=Math.max(o.xmax,a),o.ymax=Math.max(o.ymax,l)}}};var gb="Hierarchy",Ao=class extends qn{constructor(e){super(e);c(this,"type",gb);c(this,"axis");c(this,"model");c(this,"On");c(this,"Ti");c(this,"Si");c(this,"Pe");c(this,"Oi");c(this,"bd");c(this,"Et");c(this,"_i");c(this,"I");c(this,"Ad");c(this,"Ai");c(this,"Ie");c(this,"Ci");c(this,"Ua");c(this,"routingInformation");c(this,"resultSets",[]);this.On=e.options.unattachedRootPadding==null?150:e.options.unattachedRootPadding,this.axis=e.options.axis?e.options.axis==="horizontal"?0:1:0,this.Ti=e.options.maxIterationsWithoutImprovement||5,this.Si=e.options.maxIterations||24,this._i=e.options.rootNode,this.Et=e.options.getRootNode,this.Ad=e.options.placementStrategy,this.Ie=e.options.edgeNodeSize||Om,this.Pe=e.options.invert===!0,this.Oi=e.options.gatherUnattachedRoots===!0,this.I=e.options.alignment||zc,this.bd=e.options.generateRouting===!0,this.Ci=e.options.edgeFilter,this.Ua=e.options.filteredEdgeProcessor,this.Ai=e.options.leavesAtBottom}begin(e,t,n,o,s){this.resultSets.length=0;let a=this.Et?this.Et():this._i;this.model=new Hc(e,{getSize:l=>this.getSize(l,o),axis:this.axis,padding:this.padding,setPosition:n,rootNode:a,invert:s.invert===!0,unattachedRootPadding:this.On,edgeNodeSize:this.Ie,edgeFilter:this.Ci},this),this.model.initialize()}end(e,t,n,o,s){}reset(){}getDefaultParameters(){return{padding:{x:50,y:50},unattachedRootPadding:150,axis:"horizontal",maxIterations:24,maxIterationsWithoutImprovement:2,placementStrategy:"parent",alignment:"center",edgeNodeSize:Om}}step(e,t,n,o,s){let a=0;if(!this.model.isEmpty()){let l=this.model.nextRoot(),h=null;for(;l!=null;){let d=new Zc(this.model,a++);d.addToLayer(0,l),this.model.sets.push(d);let u=new Xc(this.model,d);u.execute(l),new Ls(d,(m,E,y)=>this.model.getAdjacentEntries(m,E,y),{maxIterations:this.Si,maxIterationsWithoutImprovement:this.Ti}).execute(),h=new Wc(this.model,d,{padding:this.padding,strategy:this.Ad,edgeNodeSize:this.Ie,lastPlacements:h,gatherUnattachedRoots:this.Oi,unattachedRootPadding:this.On,alignment:this.I}).execute(l);let p=[];if(d.layers.flatMap(m=>m.entries.map(E=>{if(dt(E)){p.push(E);let y=this.axis===0?m.ymax-m.ymin:m.xmax-m.xmin;this.axis===0?E.size.height=y:E.size.width=y}})),this.Ua){let m=u.getFilteredEdges().map(E=>{let y=this.model.entryMap[E.source.id],x=this.model.entryMap[E.target.id],f=d.layers[y.layer].entries.findIndex(A=>A.id===y.id),b=d.layers[x.layer].entries.findIndex(A=>A.id===x.id);return{sourceEntry:y,sourceEntryIndex:f,targetEntry:x,targetEntryIndex:b,edge:E}});this.Ua(m,this)}let g={};this.bd&&(this.routingInformation=this.model.sets.map(m=>{let E={gates:m.gates,edges:m.edgeRouting,edgeMap:m.edgeRoutingMap,regions:m.regions,getVertexPosition:y=>t(y),getVertexSize:y=>o[y]};return new jc(this.model,d,this.axis,this.Pe,()=>E).execute(),E})),this.resultSets.push({node:l,edgeNodes:p,paths:g}),l=this.model.nextRoot()}}this.done=!0}getRoutingInformation(){return this.routingInformation}};c(Ao,"type",gb),Ke.register(Ao.type,Ao);var mb="Bowtie",xl=class extends Ir{constructor(e){super(e);c(this,"focusVertex");c(this,"type",mb);c(this,"Et");c(this,"_i");c(this,"Ln");c(this,"Sd");c(this,"Td");c(this,"vd");this._i=e.options.rootNode,this.Et=e.options.getRootNode,this.Ln=e.options.axis||"horizontal",this.Sd=e.options.getUpstream,this.Td=e.options.getDownstream,this.vd=e.options.childVerticesFunction||((t,n)=>this.zE(n,t))}zE(e,t){let o=e.getVertex(t.id).getAllSourceEdges().map(a=>a.target).filter(a=>a.id!==this.focusVertex.id),s=new Set(o);return Array.from(s)}begin(e,t,n,o,s){let a=this.Et?this.Et(e):this._i;this.focusVertex=X(a)?e.getVertex(a):a,n(this.focusVertex.id,0,0)}end(e,t,n,o,s){}getDefaultParameters(){return{padding:{x:100,y:100},getUpstream:()=>[],getDownstream:()=>[]}}reset(){}step(e,t,n,o,s){let a=this.Ln==="horizontal"?-1:1,l=this.Ln==="horizontal"?1:-1;if(this.focusVertex!=null){let h=y=>new ws(e,{rootNode:this.focusVertex,idFunction:x=>x.id,sizeFunction:x=>o[x],childVerticesFunction:x=>x.id===this.focusVertex.id?y==="up"?this.Sd(e,this.focusVertex):this.Td(e,this.focusVertex):this.vd(x,e),padding:this.padding,absolutePositionFunction:x=>null,axisIndex:this.Ln==="horizontal"?1:0}),d=h("down").execute(),u=vr({},d.get(this.focusVertex.id).position),p=h("up").execute();p.forEach((y,x)=>{n(x,y.position.x*a,y.position.y*l)});let g=vr({},p.get(this.focusVertex.id).position),m=this.Ln==="horizontal"?g.y-u.y:0,E=this.Ln==="vertical"?g.x-u.x:0;d.forEach((y,x)=>{x!==this.focusVertex.id&&n(x,y.position.x+E,y.position.y+m)})}this.done=!0}};c(xl,"type",mb),Ke.register(xl.type,xl);var Jc=class{constructor(r){this.color=r}generate(r){return this.color}},Di=class i{constructor(r,e,t){this.r=r;this.g=e;this.b=t}toString(){return`rgb(${this.r}, ${this.g}, ${this.b})`}static fromString(r){if(r.startsWith("#")){let e=r.substring(1);e.length===3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]].join(""));let t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),o=parseInt(e.substring(4,6),16);return new i(t,n,o)}else if(r.startsWith("rgb")){let e=r.match(/\d+/g);if(e&&e.length>=3)return new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}else{let e=nI(r);return i.fromString(e)}}};function nI(i){let r=document.createElement("div");r.style.color=i,document.body.appendChild(r);let e=getComputedStyle(r).color;return document.body.removeChild(r),e}function $O(){return new Di(Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20),Math.floor(Math.random()*225+20))}var Ds=class{constructor(){c(this,"assignedColors",[])}generate(r){let n=0,o=$O(),s=this.assignedColors.find(a=>fb(a,o)<20);for(;s!=null&&n<10;)o=$O(),s=this.assignedColors.find(a=>fb(a,o)<20),n++;return this.assignedColors.push(o),o.toString()}reset(){this.assignedColors.length=0}},Eb=class{constructor(...r){c(this,"colors");c(this,"counter",0);this.colors=r}generate(r){let e=this.colors[this.counter];return this.counter++,this.counter>=this.colors.length&&(this.counter=0),e}};function fb(i,r){let e=(i.r+r.r)/2,t=i.r-r.r,n=i.g-r.g,o=i.b-r.b;return Math.sqrt(((512+e)*t*t>>8)+4*n*n+((767-e)*o*o>>8))}function Kc(i){let r=X(i)?Di.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Di(Math.floor(r.r*.3),Math.floor(r.g*.3),Math.floor(r.b*.3)):new Di(Math.min(255,Math.floor(r.r+(255-r.r)*.7)),Math.min(255,Math.floor(r.g+(255-r.g)*.7)),Math.min(255,Math.floor(r.b+(255-r.b)*.7)))}function iI(i){let r=X(i)?Di.fromString(i):i;return(.2126*r.r+.7152*r.g+.0722*r.b)/255>.5?new Di(0,0,0):new Di(255,255,255)}var Dm="empty",BO=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1},{dx:-1,dy:-1,axis:Tn,directionFromParent:-1},{dx:1,dy:-1,axis:Qn,directionFromParent:-1},{dx:1,dy:1,axis:Tn,directionFromParent:1},{dx:-1,dy:1,axis:Qn,directionFromParent:1}],FO=[{dx:0,dy:-1,axis:pe,directionFromParent:-1},{dx:1,dy:0,axis:ne,directionFromParent:1},{dx:0,dy:1,axis:pe,directionFromParent:1},{dx:-1,dy:0,axis:ne,directionFromParent:-1}],yb=(i,r,e,t)=>FO.filter(n=>n.axis!==e||n.directionFromParent===t),Nm=(i,r,e,t)=>{let n=[];switch(e){case Qn:n.push({x:-t,y:0}),n.push({x:-t,y:t}),n.push({x:0,y:t});break;case Tn:n.push({x:t,y:0}),n.push({x:t,y:t}),n.push({x:0,y:t});break;case ne:n.push({x:t,y:-1}),n.push({x:t,y:0}),n.push({x:t,y:1});break;case pe:n.push({x:-1,y:t}),n.push({x:0,y:t}),n.push({x:1,y:t});break}return BO.filter(o=>n.find(s=>s.x===o.dx&&s.y===o.dy))};var Is=class{constructor(r,e,t,n,o,s){this.gridCellSize=t;this.vertexBorder=n;this.vertexBuffer=o;this.getCoincidentObstacles=s;c(this,"ft",{});c(this,"Ri");c(this,"Cd");c(this,"sourceId");c(this,"targetId");c(this,"sourceObstacles",[]);c(this,"targetObstacles",[]);c(this,"sourceBuffers",[]);c(this,"targetBuffers",[]);c(this,"sourceAxis");c(this,"sourceDirection");c(this,"targetAxis");c(this,"targetDirection");this.Ri={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},this.Cd=t*(n+o)}es(r,e){return{x:Math.floor((r-this.Ri.x)/this.gridCellSize),y:Math.floor((e-this.Ri.y)/this.gridCellSize)}}YE(r){let e=this.es(r.x,r.y),t=this.es(r.x+r.width,r.y+r.height);return{x:e.x,y:e.y,width:t.x-e.x,height:t.y-e.y}}XE(r,e){let t=r*this.gridCellSize,n=e*this.gridCellSize,o=this.Ri.x+t,s=this.Ri.y+n;return{x:o,y:s,width:this.gridCellSize,height:this.gridCellSize}}makeKey(r,e){return`${r}_${e}`}jE(r){return this.sourceObstacles.indexOf(r)!==-1||this.sourceBuffers.indexOf(r)!==-1||this.targetObstacles.indexOf(r)!==-1||this.targetBuffers.indexOf(r)!==-1}kE(r,e,t,n){let o=this.makeKey(r,e);if(this.ft[o]==null){let s=this.XE(r,e),a=s.x,l=s.y,h=this.getCoincidentObstacles(a,l,this.Cd),d=[],u=[],p=!1,g=!1;h.forEach(m=>{if(!p&&(this.sourceId===m.id||this.sourceObstacles.indexOf(m.id)!==-1)&&(p=!0),!g&&(this.targetId===m.id||this.targetObstacles.indexOf(m.id)!==-1)&&(g=!0),!this.jE(m.id)){let E=Rx(this.YE(m),this.vertexBorder,this.vertexBorder);u.push(m.id),E.x<=r&&E.x+E.width>=r&&E.y<=e&&E.y+E.height>=e&&d.push(m.id)}}),this.ft[o]={key:o,f:0,g:1/0,h:null,opened:!1,closed:!1,x:r,y:e,cx:a,cy:l,ax:t,ay:n,parent:null,fixedAxis:null,directionFromParent:null,obstacles:d,buffers:u,hasSourceObstacles:p,hasTargetObstacles:g}}else t&&(this.ft[o].ax=t),n&&(this.ft[o].ay=n);return this.ft[o]}setSourceCell(r,e,t,n,o,s,a){this.sourceId=r;let l=this.getCell(e,t,n,o);return this.sourceObstacles=l.obstacles.slice(),this.sourceBuffers=l.buffers.slice(),this.sourceAxis=s,this.sourceDirection=a,l.opened=!0,l.g=0,l.f=0,l.fixedAxis=s,l.directionFromParent=a,l}setTargetCell(r,e,t,n,o,s,a){this.targetId=r;let l=this.getCell(e,t,n,o);return this.targetObstacles=l.obstacles.slice(),this.targetBuffers=l.buffers.slice(),this.targetAxis=s,this.targetDirection=a,l.fixedAxis=s,l.directionFromParent=this.targetDirection,l}get sourceAndTargetObstacles(){let r=this.sourceObstacles.slice(),e=this.targetObstacles.slice();return r.push(...e),r}getCell(r,e,t,n){return this.kE(r,e,t,n)}reinitialize(){Object.entries(this.ft).forEach(r=>{r[1].f=0,r[1].g=1/0,r[1].h=null,r[1].closed=!1,r[1].opened=!1,r[1].parent=null,r[1].directionFromParent=null,r[1].ax=null,r[1].ay=null,r[1].fixedAxis=null}),this.sourceObstacles.length=0,this.sourceBuffers.length=0,this.targetObstacles.length=0,this.targetBuffers.length=0}};function Ns(i,r){return i===0&&r===0?void 0:i===0&&r!==0?pe:i!==0&&r===0?ne:Math.sign(r)===Math.sign(i)?Tn:Qn}function xb(i,r,e){return e==null?0:e===ne?i>0?1:-1:e===pe?r>0?1:-1:e===Tn?i>0&&r>0?1:-1:i<0&&r>0?1:-1}function Im(i){let r=Ns(i.ox,i.oy);return{axis:r,direction:xb(i.ox,i.oy,r)}}function bb(i,r){let e=Math.abs(r.x-i.x),t=Math.abs(r.y-i.y);return e>t?ne:pe}function Mr(i){if(i.parent==null)return i.fixedAxis;{let r=Math.sign(i.parent.x-i.x),e=Math.sign(i.parent.y-i.y);return Ns(r,e)}}function Ab(i){if(i.parent==null)return i.directionFromParent;{let r=Math.sign(i.x-i.parent.x),e=Math.sign(i.y-i.parent.y),t=Ns(r,e);return xb(r,e,t)}}function oI(i,r,e){if(r.f<e.f)return-1;if(e.f<r.f)return 1;if(r.h<e.h)return-1;if(e.h<r.h)return 1;{let t=Mr(i);return Mr(r)===t?-1:Mr(e)===t?1:0}}var qc=class{constructor(){c(this,"node")}sort(r,e){return oI(this.node,r,e)}};var Wt="group:added",Ni="group:member:added",Ms="group:member:removed",Oe="group:removed",So="dataLoadStart",Mm="dataAppendStart",Vr="dataLoadEnd",Vm="dataAppendEnd",Gm="dataUpdated",Cn="graphClearStart",Zt="graphCleared",Sb="graphChanged",ve="group:updated",Re="node:updated",hr="port:updated",xt="edge:updated",cr="edge:added",Jt="node:added",bt="edge:removed",Ce="node:removed",ei="port:added",Gr="port:removed",sn="edge:target",an="edge:source",Kt="select",qt="deselect",nr="selection:cleared",ti="edge:geometry",ri="edge:pathEdited",Tb="edge:dragStart",vb="edge:drag",Cb="edge:dragEnd",Pb="edge:dragAbort",Qc="edge:typeChanged",ed="node:typeChanged",td="port:typeChanged",rd="group:typeChanged",_b="group:move:start",To="group:move",$r="group:move:end",nd="internal:group:sizeChanged",id="internal:group:sizeChangedRedo",od="internal:group:sizeChangedUndo",Ob="internal:edge:redraw",Rb="renderer:added",Vs="node:move:start",Mt="node:move",Vt="node:move:end",sd="node:move:abort",Gs="undoredo:update",Lb="undo",wb="redo",Ii="destroy";var sI=[Jt,ei,cr,Wt,Ce,Gr,bt,Oe,Re,hr,xt,ve,Vt,$r,an,sn,Ni,Ms],$s=(i,r,e)=>{i.instance.bind(r,e),i.bindings.push([r,e])},bl=class{constructor(r,e){this.instance=r;c(this,"bindings",[]);c(this,"ts",null);if(e.saveUrl==null&&e.autoSaveHandler==null)throw new Error("VisuallyJs autosave: neither saveUrl nor autoSaveHandler was specified");function t(a){return function(){a&&a.apply(a,arguments),e.onAfterAutoSave&&e.onAfterAutoSave()}}let n=!1,o=function(){if(!n){try{e.onBeforeAutoSave&&e.onBeforeAutoSave()}catch(a){}e.autoSaveHandler!=null?e.autoSaveHandler(r):r.save({type:e.type||kt,url:e.saveUrl,success:t(e.onAutoSaveSuccess),error:t(e.onAutoSaveError),headers:e.saveHeaders})}},s=()=>{e.debounceTimeout==null?o():this.ts==null?this.ts=setTimeout(o,e.debounceTimeout):(clearTimeout(this.ts),this.ts=setTimeout(o,e.debounceTimeout))};$s(this,So,()=>{n=!0}),$s(this,Vr,()=>{n=!1}),$s(this,Cn,()=>{n=!0}),$s(this,Zt,()=>{n=!1}),$s(this,Gm,s),$s(this,ri,s)}discard(){this.bindings.forEach(r=>this.instance.unbind(r[0],r[1])),this.bindings.length=0}},ad=class{constructor(r){this.instance=r;c(this,"bindings",[]);let e=()=>{r.fire(Gm)};sI.forEach(t=>$s(this,t,e))}};var Db="mixed",ld="isolated",Nb="nodesOnly",Ib="groupsOnly",Mb="edgesOnly",Bs=class Bs extends Ft{constructor(e,t){super();this.instance=e;c(this,"or",1/0);c(this,"Pd",1/0);c(this,"Od",1/0);c(this,"pe",[]);c(this,"te",[]);c(this,"ne",[]);c(this,"capacityPolicy");c(this,"generator");c(this,"onReload");c(this,"onBeforeReload");c(this,"onClear");c(this,"autoFill");c(this,"Ve",{});c(this,"Xr");c(this,"rs",!1);c(this,"edgeFactory");t=t||{},this.edgeFactory=e.edgeFactory,this.generator=t.generator,this.onReload=t.onReload,this.onBeforeReload=t.onBeforeReload,this.autoFill=t.autoFill===!0,this.onClear=t.onClear||function(){},this.Xr=t.mode||Db,this.instance.bind(Ce,n=>{this.Gt(n.node)}),this.instance.bind(Oe,n=>{this.Gt(n.group)}),this.instance.bind(Gr,n=>{this.Gt(n.port)}),this.instance.bind(bt,n=>{this.Gt(n.edge)}),this.instance.bind(sn,n=>{this.Ve[n.edge.getFullId()]&&this.fire(sn,n)}),this.instance.bind(an,n=>{this.Ve[n.edge.getFullId()]&&this.fire(an,n)}),this.instance.bind(Jt,n=>{this.generator&&this.autoFill&&!this.rs&&this.reload()}),this.instance.bind(Wt,n=>{this.generator&&this.autoFill&&!this.rs&&this.reload()}),this.instance.bind(Re,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(Re,n)}),this.instance.bind(ve,n=>{this.Ve[n.vertex.getFullId()]&&this.fire(ve,n)}),this.instance.bind(xt,n=>{this.Ve[n.edge.getFullId()]&&this.fire(xt,n)}),this.instance.bind(hr,n=>{n.port!=null&&this.Ve[n.port.getFullId()]&&this.fire(hr,n)}),this.instance.bind(Zt,()=>{this.clear()}),this.instance.bind(Vr,()=>{this.reload()}),this.setCapacityPolicy(Bs.DISCARD_EXISTING),t.lazy!==!0&&this.reload()}isEmpty(){return this.pe.length===0&&this.te.length===0&&this.ne.length===0}_d(e){return e.objectType===Ue.objectType?this.ne:e.objectType===ce.objectType?this.pe:this.te}setMode(e){this.Xr=e,e===ld?this.HE():e===Mb?this.Rd():e===Nb?(this.za(),this.Ld()):e===Ib&&(this.za(),this.wd())}WE(e){let t=[],n=this._d(e),o=e.objectType===Ue.objectType?this.Pd:e.objectType===ce.objectType?this.or:this.Od;if(n.length>=o){if(this.capacityPolicy===Bs.DISCARD_NEW)return!1;t=n.splice(0,1),this.Ya(t[0],":removed"),delete this.Ve[t[0].getFullId()]}return n.push(e),this.Ya(e,":added"),t}Ya(e,t){let n=e.objectType.toLowerCase()+t,o={Group:s=>({data:s.data,group:s}),Node:s=>({data:s.data,node:s}),Port:s=>({data:s.data,node:s.getParent(),port:s}),Edge:s=>({data:s.data,edge:s})};this.fire(n,o[e.objectType](e))}Dd(e,t){if(this.ZE(e)&&!this.Ve[e.getFullId()]){let n=this.WE(e);return n===!1?[[],[]]:(this.Ve[e.getFullId()]=e,t&&t(e,!0),[[e],n])}return[[],[]]}ZE(e){return this.Xr===Db||this.Xr===Nb&&e.objectType===ce.objectType||this.Xr===Ib&&e.objectType===se.objectType||this.Xr===Mb&&e.objectType===Ue.objectType?!0:this.Xr===ld?e.objectType===Ue.objectType?this.pe.length===0&&this.te.length===0:this.ne.length===0:!1}Gt(e,t){let n=e.getFullId();return Nt(this._d(e),s=>s.getFullId()==n)?(delete this.Ve[e.getFullId()],t&&t(e,!1),this.Ya(e,":removed"),[[],[e]]):[[],[]]}JE(e,t){return this.Ve[e.getFullId()]?this.Gt(e,t):this.Dd(e,t)}Xa(e,t,n){let o=[],s=[],a;if(e==null)return o;let l=h=>{let d;if(X(h))d=this.instance.getNode(h)||this.instance.getEdge(h)||this.instance.getGroup(h),d!=null&&(a=t(d,n),o.push.apply(o,a[0]),s.push.apply(s,a[1]));else if(h.eachVertex&&h.eachEdge)h.eachVertex((u,p)=>{l(p)}),h.eachEdge((u,p)=>{l(p)});else if(h.Ye)h.each((u,p)=>{l(p.vertex||p)});else if(h.length!=null)for(let u=0;u<h.length;u++)l(h[u]);else a=t(h,n),o.push.apply(o,a[0]),s.push.apply(s,a[1])};return l(e),[o,s]}remove(e,t){return this.Xa(e,this.Gt.bind(this),t)}append(e,t){return this.Xa(e,this.Dd.bind(this),t)}toggle(e,t){return this.Xa(e,this.JE.bind(this),t)}setMaxNodes(e){this.or=e}setMaxGroups(e){this.Od=e}setMaxEdges(e){this.Pd=e}setCapacityPolicy(e){this.capacityPolicy=e}za(){for(let e=this.ne.length,t=0;t<e;t++)this.Gt(this.ne[0])}wd(){for(let e=this.pe.length,t=0;t<e;t++)this.Gt(this.pe[0])}Ld(){for(let e=this.te.length,t=0;t<e;t++)this.Gt(this.te[0])}Rd(){this.wd(),this.Ld()}HE(){this.Rd(),this.za()}clear(e){this.pe.length=0,this.ne.length=0,this.te.length=0,this.Ve={},this.fire(Cn),e||this.onClear(this)}KE(e){let t=[];for(let n=0;n<e.length;n++)this.Ve[e[n].getId()]!=null&&t.push(e[n]);return t}reload(){this.generator!=null&&(this.onBeforeReload&&this.onBeforeReload(),this.clear(),this.rs=!0,this.fire(So,{}),this.generator(this,this.instance),this.fire(Vr,{}),this.onReload&&this.onReload(),this.rs=!1)}Ye(e,t){let n=t===Ue.objectType?this.ne:t===se.objectType?this.te:this.pe;for(let o=0;o<n.length;o++)try{e(o,n[o])}catch(s){}}eachNode(e){this.Ye(e,ce.objectType)}eachGroup(e){this.Ye(e,se.objectType)}eachVertex(e){this.Ye(e,ce.objectType),this.Ye(e,se.objectType)}eachEdge(e){this.Ye(e,Ue.objectType)}getNodeCount(){return this.pe.length}getNodeAt(e){return this.pe[e]}getNodes(){return this.pe}getNode(e){return this.pe.find(t=>t.id===e)}getGroupAt(e){return this.te[e]}getGroups(){return this.te}getGroup(e){return this.te.find(t=>t.id===e)}getGroupCount(){return this.te.length}getAll(){let e=[];return Array.prototype.push.apply(e,this.pe),Array.prototype.push.apply(e,this.ne),Array.prototype.push.apply(e,this.te),e}getAllEdgesFor(e,t){return this.KE(e.getAllEdges(t))}getEdgeCount(){return this.ne.length}getAllEdges(){return this.getEdges()}getEdgeAt(e){return this.ne[e]}getEdges(){return this.ne}getGroupType(e){return this.instance.getGroupType(e)}getNodeType(e){return this.instance.getNodeType(e)}getModel(){return this.instance.getModel()}getGraph(){return this.instance.getGraph()}getNodeId(e){return this.instance.getNodeId(e)}getGroupId(e){return this.instance.getGroupId(e)}getPortType(e){return this.instance.getPortType(e)}addPort(e,t){return this.instance.addPort(e,t)}getPortId(e){return this.instance.getPortId(e)}getEdge(e){return this.instance.getEdge(e)}getEdgeType(e){return this.instance.getEdgeType(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}containsVertex(e){return this.getVertex(e)!=null}getObjectInfo(e){return this.instance.getObjectInfo(e)}beforeConnect(e,t,n,o){return this.instance.beforeConnect(e,t,n,o)}beforeMoveConnection(e,t,n){return this.instance.beforeMoveConnection(e,t,n)}beforeStartConnect(e,t){return this.instance.beforeStartConnect(e,t)}beforeDetach(e,t,n){return this.instance.beforeDetach(e,t,n)}beforeStartDetach(e,t){return this.instance.beforeStartDetach(e,t)}get debugEnabled(){return this.instance.debugEnabled}qE(e){return new Bs(this.instance,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1;for(let h in e){let d=e[h]===a[h];if(!d&&!t)return!1;l=l||d}return l},o=this.qE();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getAncestors(e){return this.instance.getAncestors(e).filter(t=>this.containsVertex(t.id))}getDescendants(e){return this.instance.getDescendants(e)}getType(e){return this.instance.getType(e)}isAncestor(e,t){return this.instance.isAncestor(e,t)}isDescendantGroup(e,t){return this.instance.isDescendantGroup(e,t)}resolveFullId(e){return this.instance.resolveFullId(e)}};c(Bs,"DISCARD_EXISTING","discardExisting"),c(Bs,"DISCARD_NEW","discardNew");var dr=Bs;var Mi=class{constructor(r,e,t){this.obj=r;this.instance=e;this.manager=t;c(this,"edgeId");c(this,"source");c(this,"target");c(this,"ja");c(this,"ka");c(this,"Li");c(this,"Nd");c(this,"Id");c(this,"Vd");c(this,"Md");this.source=r.source.getFullId(),this.target=r.target.getFullId(),j(r.source)&&(this.ja=r.source.id,this.source=r.source.getParent().getFullId()),j(r.target)&&(this.ka=r.target.id,this.target=r.target.getParent().getFullId()),this.edgeId=r.getId(),this.Li=r.geometry,r.source.dummy&&(this.Nd=!0,this.Vd={x:r.source.data[e.modelLeftAttribute],y:r.source.data[e.modelTopAttribute]}),r.target.dummy&&(this.Id=!0,this.Md={x:r.target.data[e.modelLeftAttribute],y:r.target.data[e.modelTopAttribute]})}generateSourceIdentifier(){return this.Nd?this.Vd:this.ja==null?this.source:this.source+this.instance.getGraph().getPortSeparator()+this.ja}generateTargetIdentifier(){return this.Id?this.Md:this.ka==null?this.target:this.target+this.instance.getGraph().getPortSeparator()+this.ka}et(){let r={source:this.generateSourceIdentifier(),target:this.generateTargetIdentifier(),data:this.obj.data,geometry:this.Li},e=this.instance.$_addEdge(r,kx,null);this.manager.edgeChange(this.edgeId,e)}rt(){this.instance.removeEdge(this.obj)}edgeChange(r){this.obj=r,this.edgeId=this.obj.getId()}},Bm=class extends Mi{constructor(){super(...arguments);c(this,"type","addEdge")}undo(){this.rt()}redo(){this.et()}hasDeltas(){return this.obj!=null}},Fm=class extends Mi{constructor(){super(...arguments);c(this,"type","removeEdge")}undo(){this.et()}redo(){this.rt()}hasDeltas(){return this.obj!=null}},$m=class extends Mi{constructor(e,t,n,o,s){super(n,e,t);this.oldVertex=o;this.newVertex=s}verticesAreTheSame(){return _i(this.newVertex)&&_i(this.oldVertex)&&this.newVertex.id===this.oldVertex.id}pointsAreTheSame(){return!_i(this.newVertex)&&!_i(this.oldVertex)&&Bx(this.newVertex,this.oldVertex)}hasDeltas(){return this.obj!=null&&!this.verticesAreTheSame()&&!this.pointsAreTheSame()}},Um=class extends $m{constructor(){super(...arguments);c(this,"type","edgeSourceChanged")}undo(){this.instance.setSource(this.obj,this.oldVertex)}redo(){this.instance.setSource(this.obj,this.newVertex)}},Ym=class extends $m{constructor(){super(...arguments);c(this,"type","edgeTargetChanged")}undo(){this.instance.setTarget(this.obj,this.oldVertex)}redo(){this.instance.setTarget(this.obj,this.newVertex)}};var vo=class i{constructor(r){this.actions=r;c(this,"id");c(this,"type","compound");this.actions==null&&(this.actions=[]),this.id=G()}$mergeInto(r){this.actions.reverse().forEach(e=>r.addAction(e,!0))}addAction(r,e){e?this.actions.unshift(r):this.actions.push(r)}undo(){this.actions.slice().reverse().forEach(r=>r.undo())}redo(){this.actions.forEach(r=>r.redo())}edgeChange(r,e){this.actions.forEach(t=>{t instanceof Mi&&t.edgeId===r&&t.edgeChange(e)})}hasDeltas(){for(let r=0;r<this.actions.length;r++)if(this.actions[r].hasDeltas())return!0;return!1}compress(){let r=new i,e={},t={},n={};for(let o=0;o<this.actions.length;o++){let s=this.actions[o];Vb(s)?e[s.obj.id]!=null?Object.assign(e[s.obj.id].$nd,s.$nd):(e[s.obj.id]=s,r.addAction(s)):Gb(s)?t[s.obj.id]!=null?Object.assign(t[s.obj.id].pos,s.pos):(t[s.obj.id]=s,r.addAction(s)):$b(s)?n[s.group.id]!=null?Object.assign(n[s.group.id].newGroupSize,s.newGroupSize):(n[s.group.id]=s,r.addAction(s)):r.addAction(s)}return r}};var Fs=class{constructor(r,e,t,n){this.obj=r;this.originalPosition=e;this.pos=t;this.renderer=n;c(this,"type","moveAction")}redo(){this.renderer.setPosition(this.obj,this.pos.x,this.pos.y)}undo(){this.renderer.setPosition(this.obj,this.originalPosition.x,this.originalPosition.y)}hasDeltas(){return this.pos.x!==this.originalPosition.x||this.pos.y!==this.originalPosition.y}};var hd=class{constructor(r,e){this.obj=r;this.instance=e}$add(){this.obj.objectType===ce.objectType?this.obj=this.instance.addNode(this.obj.data):this.obj.objectType===se.objectType&&(this.obj=this.instance.addGroup(this.obj.data))}Gd(){this.instance.remove(this.obj)}getTerminusId(){return this.obj.getFullId()}hasDeltas(){return this.obj!=null}},Sl=class extends hd{constructor(){super(...arguments);c(this,"type","terminusAdd")}undo(){this.Gd()}redo(){this.$add()}},Al=class extends hd{constructor(){super(...arguments);c(this,"type","terminusRemove")}undo(){this.$add()}redo(){this.Gd()}isConnectedTo(e){let t=this.getTerminusId();return e.source===t||e.target===t}},cd=class extends Al{constructor(e,t){super(e.group,t);c(this,"type","groupRemove");c(this,"childrenRemoved");c(this,"orphanedChildren");this.childrenRemoved=e.removeChildren,this.orphanedChildren=e.children.slice()}$add(){super.$add(),this.childrenRemoved||this.orphanedChildren.forEach(e=>this.instance.$addToGroup(e,this.obj,null,null,null,null))}},Tl=class{constructor(r,e,t,n,o){this.group=r;this.originalGroupSize=e;this.newGroupSize=t;this.instance=n;this.source=o;c(this,"type","groupSizeChanged")}hasDeltas(){return Math.round(this.originalGroupSize.width)!==Math.round(this.newGroupSize.width)||Math.round(this.originalGroupSize.height)!==Math.round(this.newGroupSize.height)}redo(){this.jr(id,this.newGroupSize,this.originalGroupSize)}undo(){this.jr(od,this.originalGroupSize,this.newGroupSize)}jr(r,e,t){this.instance.fire(r,{group:this.group,source:this.source,sizeAfterUndo:e,sizeBeforeUndo:t})}};function Us(i,r,e){let t;i=i||{},r=r||{};let n=i,o=r;if(e)for(t=0;t<e.length;t++)n[e[t]]=o[e[t]];else for(t in o)n[t]=o[t];return i}function aI(i,r){i=i.length==null||typeof i=="string"?[i]:i;for(let e=0;e<i.length;e++)r(i[e])}function dd(i,r,e){return function(){let t=null;try{r!=null&&(t=r.apply(this,arguments))}catch(n){U("VisuallyJs: function failed : "+n)}if(i!=null&&(e==null||t!==e))try{t=i.apply(this,arguments)}catch(n){U("VisuallyJs: wrapped function failed : "+n)}return t}}var Vi=class{constructor(r,e,t,n,o,s,a){this.obj=r;this.instance=t;this.typeChanged=o;this.newType=s;this.previousType=a;c(this,"type","update");c(this,"$nd");c(this,"$od");c(this,"reason");this.$nd=Us({},r.data),this.$od=Us({},e),this.reason=n}$d(r){this.obj.objectType===ce.objectType?this.instance.$_updateNode(this.obj,r,this.reason,!0):this.obj.objectType===se.objectType?this.instance.$_updateGroup(this.obj,r,this.reason,!0):this.obj.objectType===de.objectType?this.instance.$_updatePort(this.obj,r,this.reason,!0):this.obj.objectType===Ue.objectType&&this.instance.$_updateEdge(this.obj,r,this.reason,!0)}undo(){this.$d(this.$od),this.typeChanged&&this.instance.setType(this.obj,this.previousType)}redo(){this.$d(this.$nd),this.typeChanged&&this.instance.setType(this.obj,this.newType)}hasDeltas(){return!hl(this.$nd,this.$od)||this.typeChanged&&this.newType!==this.previousType}};var ud=class{constructor(r,e,t){this.obj=r;this.wn=e;this.instance=t}et(){this.instance.addPort(this.wn,this.obj.data)}rt(){this.instance.removePort(this.wn,this.obj.id)}getTerminusId(){return this.obj.getFullId()}},pd=class extends ud{constructor(){super(...arguments);c(this,"type","portAdd")}undo(){this.rt()}redo(){this.et()}hasDeltas(){return this.obj!=null}},gd=class extends ud{constructor(){super(...arguments);c(this,"type","portRemove")}undo(){this.et()}redo(){this.rt()}isConnectedTo(e){let t=this.getTerminusId();return e.generateSourceIdentifier()===t||e.generateTargetIdentifier()===t}hasDeltas(){return this.obj!=null}};var zm=class{constructor(r,e,t){this.node=r;this.group=e;this.instance=t}hasDeltas(){return this.node!=null}},md=class extends zm{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.sourceGroup=n;this.Wa=o;this.Ha=s;this.instance=a;this.renderer=l;c(this,"type","addGroupMember")}redo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ha!=null&&this.renderer.setPosition(this.node.id,this.Ha.x,this.Ha.y)}undo(){this.sourceGroup?this.instance.addToGroup(this.node,this.sourceGroup):this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Wa!=null&&this.renderer.setPosition(this.node.id,this.Wa.x,this.Wa.y)}},Ed=class extends zm{constructor(e,t,n,o,s,a,l){super(e,t,a);this.node=e;this.group=t;this.targetGroup=n;this.Ja=o;this.Za=s;this.instance=a;this.renderer=l;c(this,"type","removeGroupMember")}redo(){this.instance.removeFromGroup(this.node),this.renderer!=null&&this.Za!=null&&this.renderer.setPosition(this.node.id,this.Za.x,this.Za.y)}undo(){this.instance.addToGroup(this.node,this.group),this.renderer!=null&&this.Ja!=null&&this.renderer.setPosition(this.node.id,this.Ja.x,this.Ja.y)}},fd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupCollapse")}redo(){this.renderer.collapseGroup(this.group)}undo(){this.renderer.expandGroup(this.group)}hasDeltas(){return this.group!=null}},yd=class{constructor(r,e){this.group=r;this.renderer=e;c(this,"type","groupExpand")}redo(){this.renderer.expandGroup(this.group)}undo(){this.renderer.collapseGroup(this.group)}hasDeltas(){return this.group!=null}};var vl=class{constructor(r,e,t){this.Ka=r;this.vertex=e;this.pos=t;c(this,"type","rendererVertexRemovedAction")}redo(){}undo(){this.Ka.setPosition(this.vertex,this.pos.x,this.pos.y)}hasDeltas(){return this.vertex!=null}};var Bb="internal.connection",xd="internal.element:repainted",Cl="context:update",bd="group:collapse",Ad="group:expand",Br="zoom",Sd="render:start",Fr="render:end",Fb="adhocLayout",Ys="afterLayoutRefresh",Pl="group:relayout",Ur="group:render",zs="internal.vertex:updated",Yr="node:render",Td="node:visibility",vd="plugin:added",Ub="plugin:removed",Pn="relayout",Yb="objectRepainted",Ye="click",At="contextmenu",Co="dblclick",zr="dbltap",zb="focus",ge="mousedown",Xm="mouseenter",jm="mouseexit",ae="mousemove",Xb="mouseleave",le="mouseup",ot="mouseout",st="mouseover",W="tap",jb="touchstart",Hb="touchend",kb="touchmove",Wb="vertex:click",Zb="vertex:dblclick",Jb="vertex:dbltap",Kb="vertex:mouseout",qb="vertex:mouseover",Qb="vertex:mousemove",lI="vertex:mouseup",hI="vertex:mousedown",eA="vertex:contextmenu",tA="vertex:tap",rA="edge:click",nA="edge:dblclick",iA="edge:dbltap",Cd="edge:mouseout",Pd="edge:mouseover",oA="edge:mouseup",_l="edge:mousedown",sA="edge:contextmenu",aA="edge:tap",_n="canvasClick",lA="canvasDblClick",_d="edge:redraw",Od="start",Rd="lasso:update",Ld="lasso:end",Gi="pan",On="modeChanged",cI="allGroupsRelayout",hA="groupRelayoutAdhoc",dI="groupMemberRemoved",cA="newVertexAddedToGroup",dA="existingVertexAddedToGroup";var Ol=class extends Vi{constructor(e,t,n,o,s,a,l){super(e,t,n,o,s,a,l);this.obj=e;this.instance=n;this.typeChanged=s;this.newType=a;this.previousType=l;c(this,"type","vertexUpdate");o===Xs&&t[this.instance.modelRotationAttribute]==null&&(this.$od[this.instance.modelRotationAttribute]=0)}};var js=class{constructor(r,e,t,n){this.obj=r;this.previousType=e;this.newType=t;this.instance=n;c(this,"type","setTypeAction")}hasDeltas(){return this.previousType!==this.newType}redo(){this.instance.setType(this.obj,this.newType)}undo(){this.instance.setType(this.obj,this.previousType)}};var uA=class{constructor(r,e,t,n,o){this.T=r;this.QE=e;this.Fd=t;this.Li=n;this.Ka=o;c(this,"type","edgePath")}Bd(r){this.T.setEdgeGeometry(this.QE,r,null,this.Ka)}undo(){this.Bd(this.Fd)}redo(){this.Bd(this.Li)}hasDeltas(){return!hl(this.Fd,this.Li)}},uI=50,pA="Cannot start a new transaction while one is active. Either commit/rollback the current transaction before creating a new one, or pass a cleanup flag in to this method",pI="Cannot rollback transaction from here; it has been appended to. Close all transaction appenders before attempting to rollback the transaction.",wd=class{constructor(r){c(this,"T");c(this,"is");c(this,"$t");c(this,"qa");c(this,"undoStack");c(this,"redoStack");c(this,"Qa",[]);c(this,"me");c(this,"yt",0);this.T=r.instance,this.$t=!1,this.undoStack=[],this.redoStack=[],this.is=r.maximumSize||uI,this.qa=r.onChange,this.ef()}Ud(r){this.$t=r}dataLoadStart(){this.clear(),this.Ud(!0)}dataAppendStart(){this.dataLoadStart()}dataLoadEnd(){this.Ud(!1)}dataAppendEnd(){this.dataLoadEnd()}ef(){this.T.bind(Zt,()=>{this.clear()}),this.T.bind(Jt,r=>{this.command(new Sl(r.node,this.T))}),this.T.bind(Ce,r=>{this.command(new Al(r.node,this.T))}),this.T.bind(Re,r=>{ll(r.updates)||this.command(new Ol(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(Wt,r=>{this.command(new Sl(r.group,this.T))}),this.T.bind(Oe,r=>{this.command(new cd(r,this.T))}),this.T.bind(ve,r=>{ll(r.updates)||this.command(new Ol(r.vertex,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(nd,r=>{let e=new Tl(r.group,r.originalGroupSize,r.newGroupSize,this.T,r.source);e.hasDeltas()&&this.command(e)}),this.T.bind(cr,r=>{this.command(new Bm(r.edge,this.T,this))}),this.T.bind(bt,r=>{this.command(new Fm(r.edge,this.T,this))}),this.T.bind(xt,r=>{ll(r.updates)||this.command(new Vi(r.edge,r.originalData,this.T,r.reason,r.typeChanged,r.newType,r.previousType))}),this.T.bind(an,r=>{this.command(new Um(this.T,this,r.edge,r.old,r.new))}),this.T.bind(sn,r=>{this.command(new Ym(this.T,this,r.edge,r.old,r.new))}),this.T.bind(ri,r=>{this.command(new uA(this.T,r.edge,r.originalGeometry,r.geometry,r.ui))}),this.T.bind(ei,r=>{this.command(new pd(r.port,r.vertex,this.T))}),this.T.bind(Gr,r=>{this.command(new gd(r.port,r.vertex,this.T))}),this.T.bind(hr,r=>{ll(r.updates)||this.command(new Vi(r.port,r.originalData,this.T,null,!1,null,null))}),this.T.bind(Ni,r=>{r.vertexIsNew!==!0&&this.command(new md(r.vertex,r.group,r.sourceGroup,r.originalPosition,r.pos,this.T,r.source))}),this.T.bind(Ms,r=>{this.command(new Ed(r.vertex,r.group,r.targetGroup,r.originalPosition,r.newPosition,this.T,r.source))}),this.T.bind(ed,r=>{r.isPartOfUpdate||this.command(new js(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(td,r=>{r.isPartOfUpdate||this.command(new js(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(rd,r=>{r.isPartOfUpdate||this.command(new js(r.obj,r.previousType,r.newType,this.T))}),this.T.bind(Qc,r=>{r.isPartOfUpdate||this.command(new js(r.obj,r.previousType,r.newType,this.T))}),this.T.bind("renderer:added",r=>{r.renderer.bind(Vt,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Fs(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind($r,e=>{e.dragGroup.forEach(t=>{t.originalPosition!=null&&this.command(new Fs(t.vertex,t.originalPosition,t.pos,e.ui))})}),r.renderer.bind(bd,e=>{this.command(new fd(e.group,r.renderer))}),r.renderer.bind(Ad,e=>{this.command(new yd(e.group,r.renderer))}),r.renderer.bind(Ce,e=>{this.command(new vl(r.renderer,e.vertex,e.pos))}),r.renderer.bind(Oe,e=>{this.command(new vl(r.renderer,e.vertex,e.pos))})})}wi(){this.qa&&this.qa(this,this.undoStack.length,this.redoStack.length)}command(r,e){if(!this.$t){if(!r.hasDeltas())return;zO(r)&&(r=r.compress()),this.me!=null?this.me.addAction(r,e):(this.undoStack.push(r),this.undoStack.length>this.is&&this.undoStack.splice(this.undoStack.length-this.is-1,this.undoStack.length-this.is),this.redoStack.length=0,this.wi())}}edgeChange(r,e){let t=n=>{n.forEach(o=>{o instanceof Mi&&o.edgeId===r?o.edgeChange(e):o instanceof vo&&o.edgeChange(r,e)})};t(this.undoStack),t(this.redoStack)}undo(){let r=this.undoStack.pop();r&&(this.$t=!0,this.redoStack.push(r),r.undo(),this.$t=!1,this.wi())}redo(){let r=this.redoStack.pop();r&&(this.$t=!0,this.undoStack.push(r),r.redo(),this.$t=!1,this.wi())}clear(){this.undoStack.length=0,this.redoStack.length=0,this.me=null,this.yt=0,this.$t=!1,this.wi()}transaction(r,e,t){if(this.me!=null&&e==null)return U(pA),!1;if(this.openTransaction(e)==null){if(t)return r()}else try{if(r()!==!1){let a=this.me;return this.yt===0?(this.me=null,this.command(a)):this.yt--,a.id}else return this.rollbackTransaction(),!1}catch(s){return U("Exception thrown in transaction "+s.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}mergeTransaction(r){if(this.me!=null)return this.transaction(r,ut);try{let e=this.transaction(r);if(e!==!1){if(this.undoStack.length>1){let t=this.undoStack.pop(),n=this.undoStack.pop();this.tf(t,n),this.undoStack.push(t)}return e}else return this.rollbackTransaction(),!1}catch(e){return U("Exception thrown in transaction "+e.message+"; rolling transaction back"),this.rollbackTransaction(),!1}}tf(r,e){e instanceof vo?e.$mergeInto(r):r.addAction(e,!0)}rf(){return this.me=new vo,this.yt=0,this.me.id}openTransaction(r){if(!this.$t){let e=!0;if(this.me!=null)if(r!=null)if(r===UO)this.commitTransaction();else if(r===YO)this.rollbackTransaction();else if(r===ut)e=!1,this.yt++;else throw new Error(pA);else throw new Error(pA);return e&&this.rf(),this.me.id}return null}rollbackTransaction(){this.me!=null&&(this.yt>0?(this.yt--,U(pI)):(this.me.undo(),this.me=null,this.wi(),this.Qa.length=0))}commitTransaction(r){if(this.me!=null)if(r!==!0&&this.yt>0)this.yt--;else{let e=this.me;this.me=null,this.command(e),this.yt=0,this.nf()}}nf(){this.me==null&&(this.Qa.forEach(r=>{try{r()}catch(e){}}),this.Qa.length=0)}},UO="commitCurrent",YO="rollbackCurrent",ut="appendToCurrent";function zO(i){return i instanceof vo}function Vb(i){return i instanceof Vi||i instanceof Ol}function Gb(i){return i instanceof Fs}function $b(i){return i instanceof Tl}var Hm="1.2.4";var gA="type",mA="default",gI="group",xA="groupResized",XO="addPort",jO="addNewPort",HO="removePort",Dd="updatePort",Hs="moved",mI="layout",km="updateVertex",EA="updateNode",fA="updateGroup",bA="magnetizer",Id="setPosition",AA="snapToGrid",EI="sizeGroupToFit",Rl="drawingToolsResize",Xs="rotation",SA="resized",yA="updated",Nd=class extends Ft{constructor(e){super();c(this,"graph");c(this,"autoSaver");c(this,"idFunction");c(this,"typeProperty");c(this,"edgeTypeProperty");c(this,"portTypeProperty");c(this,"groupProperty");c(this,"typeFunction");c(this,"edgeIdFunction");c(this,"edgeTypeFunction");c(this,"portIdFunction");c(this,"portTypeFunction");c(this,"portExtractor");c(this,"portUpdater");c(this,"portDataProperty");c(this,"portOrderProperty");c(this,"modelTopAttribute");c(this,"modelLeftAttribute");c(this,"modelWidthAttribute");c(this,"modelHeightAttribute");c(this,"modelRotationAttribute");c(this,"model");c(this,"nl");c(this,"zd");c(this,"debugEnabled");c(this,"defaultObjectFactory");c(this,"nodeFactory");c(this,"edgeFactory");c(this,"portFactory");c(this,"groupFactory");c(this,"undoRedo");c(this,"Yd");c(this,"beforeConnect");c(this,"beforeMoveConnection");c(this,"beforeStartConnect");c(this,"beforeDetach");c(this,"beforeStartDetach");c(this,"Ee");c(this,"kr",new Map);c(this,"Di",{});c(this,"$transientVerticesByRenderer",{});e=e||{};let t=e.undoRedo||{};t.enabled!==!1&&(this.undoRedo=new wd({instance:this,maximumSize:t.maximumSize,onChange:(o,s,a)=>{this.fire(Gs,{undoCount:s,redoCount:a})}})),this.idFunction=e.idFunction||cm,this.typeProperty=e.typeProperty||gA,this.edgeTypeProperty=e.edgeTypeProperty||gA,this.portTypeProperty=e.portTypeProperty||gA,this.groupProperty=e.groupProperty||gI,this.typeFunction=e.typeFunction||(o=>o[this.typeProperty]||mA),this.edgeIdFunction=e.edgeIdFunction||this.idFunction,this.edgeTypeFunction=e.edgeTypeFunction||(o=>o[this.edgeTypeProperty]||mA),this.portIdFunction=e.portIdFunction||this.idFunction,this.portTypeFunction=e.portTypeFunction||(o=>o[this.portTypeProperty]||mA),this.portExtractor=e.portExtractor,this.portUpdater=e.portUpdater,this.portDataProperty=e.portDataProperty,this.portOrderProperty=e.portOrderProperty,this.debugEnabled=!1,this.model=new Nc(this,e.model),this.defaultObjectFactory=(o,s,a,l)=>(a=a==null||!lr(a)?{}:a,a=lt(a),a.id=a.id||G(),a.type=a.type||(s==null?null:s.type||s),l(a),!0),this.modelLeftAttribute=e.modelLeftAttribute||nb,this.modelTopAttribute=e.modelTopAttribute||ib,this.modelWidthAttribute=e.modelWidthAttribute||sb,this.modelHeightAttribute=e.modelHeightAttribute||ab,this.modelRotationAttribute=e.modelRotationAttribute||ob,this.Di=Object.assign({},e.groupTemplates||{}),this.nodeFactory=e.nodeFactory||this.defaultObjectFactory,this.edgeFactory=e.edgeFactory||this.defaultObjectFactory,this.portFactory=e.portFactory||this.defaultObjectFactory,this.groupFactory=e.groupFactory||this.defaultObjectFactory,this.zd=e.autoSave&&e.autoSave.enabled!==!1,this.Yd={portSeparator:e.portSeparator,defaultCost:e.defaultCost,defaultDirected:e.defaultDirected,enableSubgraphs:e.enableSubgraphs},this.portDataProperty!=null&&this.portExtractor==null&&(this.portExtractor=o=>{let s=o[this.portDataProperty]||[];return this.portOrderProperty!=null&&s.sort((a,l)=>{let h=a[this.portOrderProperty],d=l[this.portOrderProperty],u=h==null?1/0:h,p=d==null?1/0:d;return u-p}),s}),this.portDataProperty!=null&&this.portUpdater==null&&(this.portUpdater=(o,s,a)=>{let l={};return this.portOrderProperty!=null&&a.sort((h,d)=>{let u=h.data[this.portOrderProperty],p=d.data[this.portOrderProperty],g=u==null?1/0:u,m=p==null?1/0:p;return g-m}),l[this.portDataProperty]=a.map(h=>h.data),Object.assign(o,l)}),this.graph=new dl(this.Yd),this.zd&&(this.autoSaver=new bl(this,e.autoSave)),new ad(this);let n=(o,s)=>{if(this.model==null)return!0;let a=this.getType(o),l=this.getType(s),h=j(o)?o.getParent():o,d=j(s)?s.getParent():s,u=j(o)?this.model.getPortDefinition(a):J(o)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),p=j(s)?this.model.getPortDefinition(l):J(s)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l),g=J(h)?this.model.getNodeDefinition(a):this.model.getGroupDefinition(a),m=J(d)?this.model.getNodeDefinition(l):this.model.getGroupDefinition(l);return u.maxConnections!=null&&o.getEdges().length>=u.maxConnections||p.maxConnections!=null&&s.getEdges().length>=p.maxConnections?!1:o===s?!(g.allowLoopback===!1||u.allowLoopback===!1||p.allowLoopback===!1||m.allowLoopback===!1):h===d?!(g.allowVertexLoopback===!1||u.allowVertexLoopback===!1||p.allowVertexLoopback===!1||m.allowVertexLoopback===!1):!0};if(this.beforeConnect=e.beforeConnect||n,this.beforeMoveConnection=e.beforeMoveConnection||n,this.beforeStartConnect=e.beforeStartConnect||((o,s)=>({})),this.beforeDetach=e.beforeDetach||((o,s,a)=>!0),this.beforeStartDetach=e.beforeStartDetach||((o,s)=>!0),this.Ee=this.os(o=>{this.N(s=>s.$selectionCleared(o)),this.fire(nr,{selection:o})}),e.selectionMode&&this.Ee.setMode(e.selectionMode),e.maxSelectedNodes&&this.Ee.setMaxNodes(e.maxSelectedNodes),e.maxSelectedGroups&&this.Ee.setMaxGroups(e.maxSelectedGroups),e.maxSelectedEdges&&this.Ee.setMaxEdges(e.maxSelectedEdges),e.selectionCapacityPolicy&&this.Ee.setCapacityPolicy(e.selectionCapacityPolicy),e.events)for(let o in e.events)this.bind(o,e.events[o]);e.data!=null&&this.load({data:e.data})}get portSeparator(){return this.graph.portSeparator}of(e,t,n){return{id:`${e}_${n}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y}}ss(e,t,n,o){if(X(e))return[this.graph.getVertex(e,!0),!1];if(J(e)||Y(e)||j(e))return[e,!1];{let s=e,a=s.x==null?0:s.x,l=s.y==null?0:s.y;return[this.Xd(this.of(t,{x:a,y:l},n),o),!0]}}os(e){return new dr(this,{onClear:e||function(){}})}filter(e,t){let n=typeof e=="function"?e:function(s){let a=s.data,l=!1,h=e;for(let d in h){let u=h[d]===a[d];if(!u&&!t)return!1;l=l||u}return l},o=this.os();return this.eachNode(function(s,a){n(a)&&o.append(a);let l=a.getPorts();for(let h=0;h<l.length;h++)n(l[h])&&o.append(l[h])}),this.eachEdge(function(s,a){n(a)&&o.append(a)}),this.eachGroup(function(s,a){n(a)&&o.append(a)}),o}getModel(){return this.model}setAutoSave(e){this.autoSaver!=null&&this.autoSaver.discard(),this.autoSaver=new bl(this,e)}connect(e){let t,n=this.graph.getVertex(e.source),o=this.graph.getVertex(e.target),s=e.cost,a=e.directed;if(!n)if(!e.doNotCreateMissingNodes)n=this.graph.addNode(e.source),this.il(n);else return;if(!o)if(!e.doNotCreateMissingNodes)o=this.graph.addNode(e.target),this.il(o);else return;let l=e.data||{},h=this.beforeStartConnect(n,this.edgeTypeFunction(l));return h&&(typeof h=="object"&&(l=Object.assign(h,l)),this.beforeConnect(n,o,l,!1)!==!1&&(t=this.$_addEdge({source:n,target:o,cost:s,directed:a,data:l,geometry:e.geometry},pl,null))),t}clear(){return this.N(e=>e.$graphClearStart()),this.fire(Cn),this.graph.clear(),this.$transientVerticesByRenderer={},this.N(e=>e.$graphClearEnd()),this.fire(Zt,this),this}destroy(){this.clear(),delete this.kr,delete this.$transientVerticesByRenderer}getGraph(){return this.graph}getNodeCount(){return this.graph.getVertexCount()}getNodeAt(e){return this.graph.getVertexAt(e)}getNodes(){return this.graph.getVertices()}eachNode(e){let t;for(let n=0,o=this.graph.getVertexCount();n<o;n++)t=this.graph.getVertexAt(n),e(n,t)}eachGroup(e){let t;for(let n=0,o=this.graph.getGroupCount();n<o;n++)t=this.graph.getGroupAt(n),e(n,t)}eachVertex(e){this.eachNode(e),this.eachGroup(e)}eachEdge(e){let t=this.graph.getEdges();for(let n=0,o=t.length;n<o;n++)e(n,t[n])}getEdgeCount(){return this.graph.getEdgeCount()}getGroupCount(){return this.graph.getGroupCount()}getGroupAt(e){return this.graph.getGroupAt(e)}getGroups(){return this.graph.getGroups()}addGroupTemplate(e,t){this.Di[e]=t}getDescendants(e){return Ps(e)}getAncestors(e){return Sn(e)}isAncestor(e,t){return ke(e,t)}isDescendantGroup(e,t){return jx(e,t)}getClusters(){return this.graph.getClusters()}getCluster(e){let t=X(e)?this.getVertex(e):e;return this.graph.getCluster(t)}getNodeId(e){return typeof e=="string"?e:this.idFunction(e)}getNodeType(e){return this.typeFunction(e)||"default"}getGroupId(e){return typeof e=="string"?e:this.idFunction(e)}getGroupType(e){return this.typeFunction(e)||"default"}getEdgeType(e){return this.edgeTypeFunction(e)||"default"}getPortId(e){return this.portIdFunction(e)}getPortType(e){return this.portTypeFunction(e)||"default"}getType(e){return(J(e)?this.typeFunction:j(e)?this.portTypeFunction:this.edgeTypeFunction)(e.data)||"default"}setType(e,t){let n=this.getType(e);if(n===t)return;let o=e.objectType===ce.objectType?this.typeProperty:e.objectType===de.objectType?this.portTypeProperty:this.edgeTypeProperty;e.data[o]=t,e.type=t,this.$dispatchTypeChange(e,n,t,!1)}$dispatchTypeChange(e,t,n,o){let s,a;J(e)?(s=ed,a=()=>this.N(l=>l.$nodeTypeChanged(e,t,n))):j(e)?(s=td,a=()=>this.N(l=>l.$portTypeChanged(e,t,n))):nt(e)?(s=Qc,a=()=>this.N(l=>l.$edgeTypeChanged(e,t,n))):Y(e)&&(s=rd,a=()=>this.N(l=>l.$groupTypeChanged(e,t,n))),s!=null&&(this.fire(s,{obj:e,previousType:t,newType:n,isPartOfUpdate:o}),a())}resolveFullId(e){if(nt(e))return e.id;if(J(e))return e.id;if(Y(e))return e.id;if(j(e))return e.parent.id+this.graph.portSeparator+e.id}resolveNode(e){return j(e)?e.parent:e}addNode(e,t){let n=this.idFunction(e),o=null;n==null&&typeof e!="string"&&(e.id=G());let s=this.graph.addNode(e,this.idFunction);if(s!=null){if(this.portExtractor!=null){let a=this.portExtractor(s.data,s);if(a!=null)for(let l=0;l<a.length;l++)s.$addPort(a[l],this.portIdFunction)}if(typeof e!="string"&&e[this.groupProperty]!=null)if(o=this.getGroup(e[this.groupProperty]),o!=null)this.graph.$addMemberToGroup(s,o);else throw new Error("parent group ["+e[this.groupProperty]+"] not found");return this.il(s,o),o!=null&&this.fire(Ni,{group:o,vertex:s,vertexIsNew:!0}),s}else return this.graph.getVertex(n)}il(e,t){let n={node:e,parentGroup:t};this.N(o=>o.$nodeAdded(n)),this.fire(Jt,n)}sf(e,t){let n={group:e,parentGroup:t};this.N(o=>o.$groupAdded(n)),this.fire(Wt,n)}addFactoryNode(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t={}),t.type=t.type||e;try{this.nodeFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addNode(a);try{n&&n(l)}catch(h){U("WARN: Factory node callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: Factory node threw an error",a),s!==!1&&this.rollbackTransaction()}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t]);return this}jd(e){return Cs(this.$transientVerticesByRenderer,e.id,()=>({}))}$addTransientVertex(e,t){let n=this.graph.addNode(e);if(n.transient=!0,t!=null){let o=this.jd(t);o[n.id]=n,n.transientRenderer=t.id}return n}Xd(e,t){let n=this.$addTransientVertex(e,t);return n.dummy=!0,this.N(o=>{o.$renderDummyVertex(n)}),n}as(e){this.graph.deleteNode(e),this.N(t=>{t.$nodeRemoved({vertex:e,node:e,edges:[],parentGroupIsBeingRemoved:!1})})}$setEdgeDetached(e,t,n){let o=this.Xd({id:`${e.id}_${n===it?"0":"1"}`,[this.modelLeftAttribute]:t.x,[this.modelTopAttribute]:t.y});n===it?this.setSource(e,o):this.setTarget(e,o)}$cleanupTransientVertex(e,t){let n=e.getAllEdges()||[];this.graph.deleteNode(e);for(let o=0;o<n.length;o++)this.graph.deleteEdge(n[o]),t.$edgeRemoved({edge:n[o],source:t});if(t.$nodeRemoved({vertex:e,node:e,edges:n,parentGroupIsBeingRemoved:!1}),t!=null){let o=this.jd(t);o&&delete o[e.id]}}$addTransientEdge(e,t,n,o,s,a){let l={source:t,target:n,data:o||{},geometry:s,transient:!0},h=this.graph.addEdge(l);return e.$edgeAdded({edge:h,source:e,geometry:h.geometry,transient:!0,reason:Wx},a),h}addFactoryGroup(e,t,n,o,s){n==null&&(t!=null?(t=typeof t=="object"?t:{},n=typeof t=="function"?t:null):t==null&&n==null&&(t={})),t.type=t.type||e;try{this.groupFactory(this,e,t,a=>{s!==!1&&this.openTransaction(ut);let l=this.addGroup(a);try{n&&n(l)}catch(h){U("WARN: Factory group callback threw an error",h)}s!==!1&&this.commitTransaction()},()=>{o&&o(),s!==!1&&this.rollbackTransaction()})}catch(a){U("WARN: group factory threw an error",a),s!==!1&&this.rollbackTransaction()}}addFactoryGroupWithTemplate(e,t,n,o,s,a){o==null&&(n!=null?(n=typeof n=="object"?n:{},o=typeof n=="function"?n:null):n==null&&o==null&&(n={})),n.type=n.type||e;try{this.groupFactory(this,e,n,l=>{a!==!1&&this.openTransaction(ut);let h=this.Di[t]!=null?this.addGroupWithTemplate(l,t):this.addGroup(l);try{o&&o(h)}catch(d){U("WARN: Factory group callback threw an error",d)}a!==!1&&this.commitTransaction()},()=>{s&&s(),a!==!1&&this.rollbackTransaction()})}catch(l){U("WARN: group factory threw an error",l),a!==!1&&this.rollbackTransaction()}}addGroup(e,t){let n,o;if(this.idFunction(e)==null&&typeof e!="string"&&(e.id=G()),o=this.graph.addGroup(e,this.idFunction),o!=null){if(typeof e!="string"&&e[this.groupProperty]!=null){if(n=this.getGroup(e[this.groupProperty]),n==null)throw new Error("Cannot find parent group ["+e[this.groupProperty]+"]");this.graph.$addMemberToGroup(o,n)}this.sf(o,n),n!=null&&this.fire(Ni,{group:n,vertex:o,vertexIsNew:!0})}return o}addToGroup(e,t,n){return this.$addToGroup(e,t,null,null,n,null)}addGroupWithTemplate(e,t){let n;return this.transaction(()=>{let o;if(typeof t=="string"){let l=this.Di[t];if(l==null)return U("No group template found with name ["+t+"]"),null;try{o=l}catch(h){return U("Error parsing group template ["+t+"]: "+h.message),null}}else o=t;n=this.addGroup(e);let s=new Map,a=(l,h)=>{(l.nodes||[]).forEach(d=>{let u=d.id,p=Object.assign({},d,{id:G(),group:h.id}),g=this.addNode(p);s.set(u,g.id)}),(l.groups||[]).forEach(d=>{let u=d.id,p=d.groupTemplate,g=Object.assign({},d,{id:G(),group:h.id});p&&typeof p!="string"&&delete g.groupTemplate;let m=this.addGroup(g);if(s.set(u,m.id),p)if(typeof p=="string"){let E=this.Di[p];if(E)try{a(E,m)}catch(y){U("Error parsing nested group template ["+p+"]: "+y.message)}else U("No group template found for nested group with name ["+p+"]")}else a(p,m)}),(l.edges||[]).forEach(d=>{let u=d.source.split(this.portSeparator),p=d.target.split(this.portSeparator),g=s.get(u[0])||u[0],m=s.get(p[0])||p[0],E=u[1]==null?g:[g,u[1]].join(this.portSeparator),y=p[1]==null?m:[m,p[1]].join(this.portSeparator);this.addEdge({source:E,target:y,data:d.data||{}})})};return a(o,n),n},ut),n}$addToGroup(e,t,n,o,s,a){let l=!1,h=this.getObjectInfo(t),d=this.getObjectInfo(e);if(n=n||d.obj.group,d.obj&&h.obj&&(l=h.obj.$addMember(d.obj),l)){n&&n.$removeMember(d.obj),d.obj.data[this.groupProperty]=h.obj.id;let u={vertex:d.obj,group:h.obj,pos:s,originalPosition:o,source:a,positionInGroup:s};n&&(u.sourceGroup=n),this.N(p=>{p.$groupMemberAdded(u)}),this.fire(Ni,u)}return l}removeFromGroup(e){return this.$removeFromGroup(e,null,null,null,null)}$removeFromGroup(e,t,n,o,s){let a=this.getObjectInfo(e),l;if(a.obj&&a.obj.group&&(l=a.obj.group,l.$removeMember(a.obj))){let h={vertex:a.obj,group:l,newPosition:o,originalPosition:n,source:s};t&&(h.targetGroup=t),this.N(d=>{d.$groupMemberRemoved(h)}),delete a.obj.data[this.groupProperty],this.fire(Ms,h)}return l}kd(e,t,n,o){e.nestedGroups.forEach(a=>this.kd(a,t,!0,o)),e.nodes.forEach(a=>this.Hd(a,!0,o));for(let a=0;a<e.edges.length;a++)this.ol(e.edges[a]);let s={vertex:e.group,edges:e.edges,group:e.group,removeChildren:t,children:e.children,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:n};this.N(a=>a.$groupRemoved(s)),o||this.fire(Oe,s)}Hd(e,t,n){for(let s=0;s<e.edges.length;s++)this.ol(e.edges[s]);let o={vertex:e.node,node:e.node,edges:e.edges,parentGroup:e.parentGroup,parentGroupIsBeingRemoved:t};this.N(s=>s.$nodeRemoved(o)),n||this.fire(Ce,o)}removeGroup(e,t,n){let o=this.graph.getVertex(X(e)?e:e.id);if(o){this.openTransaction(ut);let s=this.graph.deleteGroup(o,t);return s.group&&(t||s.children.forEach(a=>delete a.data[this.groupProperty]),this.kd(s,t===!0,!1,n)),this.commitTransaction(),!0}return!1}getNode(e){return this.graph.getVertex(e)}getEdge(e){return this.graph.getEdge(e)}getGroup(e){return this.graph.getGroup(e)}getVertex(e){return this.getNode(e)||this.getGroup(e)}getPort(e){let t=this.graph.getVertexByPortId(e);if(t)return t.getPort(this.graph.splitPortId(e)[1])}exists(...e){for(let t=0;t<e.length;t++)if(this.graph.getVertex(e[t])==null)return!1;return!0}removeNode(e){if(!X(e)&&e.transient===!0)return!1;let t=this.graph.getVertex(X(e)?e:e.id);if(t!=null){this.openTransaction(ut);let n=t.getAllEdges()||[];for(let s=0;s<n.length;s++)this.removeEdge(n[s]);let o=this.graph.deleteNode(t);return this.Hd(o,!1),this.commitTransaction(),!0}return!1}addEdge(e){return this.$_addEdge(e,pl,null)}$_addEdge(e,t,n,o){let s=this.$_deriveEdgeId(e.data),[a,l]=this.ss(e.source,s,0,n),[h,d]=this.ss(e.target,s,1,n);if(a==null||a.objectType==null)throw new TypeError("Unknown source node ["+e.source+"]");if(h==null||h.objectType==null)throw new TypeError("Unknown target node ["+e.target+"]");if(!l&&a.dummy)return U(`Cannot add edge to dummy vertex ${a.id}`),null;if(!d&&h.dummy)return U(`Cannot add edge to dummy vertex ${h.id}`),null;let u=Object.assign(e,{source:a,target:h});if(this.beforeConnect(a,h,e.data,e.addedByMouse===!0)!==!1){let p=this.graph.addEdge(u,s,this.edgeIdFunction),g={edge:p,source:n,geometry:e.geometry,addedByMouse:e.addedByMouse,reason:t};return this.N(m=>m.$edgeAdded(g,e.context)),o||this.fire(cr,g,null),p}else return this.debugEnabled&&U("Could not add edge"),null}ol(e,t){let n={edge:e,source:t};this.N((o,s)=>o.$edgeRemoved(n)),this.fire(bt,n,null)}removeEdge(e,t){let n=this.graph.getEdge(e);return n!=null&&(this.graph.deleteEdge(n),n.source.dummy&&J(n.source)&&this.as(n.source),n.target.dummy&&J(n.target)&&this.as(n.target),this.ol(n,t)),this}setTarget(e,t){if(t==null)return{success:!1};let[n]=this.ss(t,e.id,1);if(n==null||this.beforeConnect(e.source,n,e.data)===!1)return{success:!1};let o=this.graph.setTarget(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.as(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeTargetChanged(l)}),this.fire(sn,l)}return o}setSource(e,t){if(t==null)return{success:!1};let[n]=this.ss(t,e.id,0);if(n==null||this.beforeConnect(n,e.target,e.data)===!1)return{success:!1};let o=this.graph.setSource(e,n);if(o.success!==!1){let s=o.old;o.old.dummy===!0&&(s={x:o.old.data[this.modelLeftAttribute],y:o.old.data[this.modelTopAttribute]},this.as(o.old));let a=o.new;o.new.dummy===!0&&(a={x:o.new.data[this.modelLeftAttribute],y:o.new.data[this.modelTopAttribute]});let l={edge:e,old:s,new:a,success:!0};this.N(h=>{h.$edgeSourceChanged(l)}),this.fire(an,l)}return o}addNewPort(e,t,n){let o=this.graph.getVertex(e);this.portFactory(this,t,n,s=>{let a=this.portIdFunction(s),l=o.$addPort(a);l.data=s,this.ls(o,jO);let h={vertex:o,data:s,port:l};this.N(d=>d.$portAdded(h)),this.fire(ei,h,null)},()=>{})}addPort(e,t){let n=this.graph.getVertex(e),o=n.$addPort(t,this.portIdFunction);this.ls(n,XO);let s={vertex:n,data:t,port:o};return this.N(a=>a.$portAdded(s)),this.fire(ei,s,null),o}removePort(e,t){let n;if(typeof e=="string"){let o=this.graph.splitPortId(e);o.length===2?(n=this.graph.getVertex(o[0]),t=o[1]):n=this.graph.getVertex(e)}else j(e)?(t=e.id,n=e.getParent()):n=this.graph.getVertex(e);if(n!=null&&t!=null){let o=n.getPort(t);if(o){this.openTransaction(ut);let s=o.getAllEdges();for(let l=s.length,h=0;h<l;h++)this.removeEdge(s[0]);n.$removePort(o),this.ls(n,HO);let a={vertex:n,port:o,edges:s};return this.N(l=>l.$portRemoved(a)),this.fire(Gr,a,null),this.commitTransaction(),!0}}return!1}remove(e,t){if(e==null)return;let n=this.getObjectInfo(e);this.setSuspendRendering(!0);try{if(n.obj&&J(n.obj))this.removeNode(n.obj);else if(n.obj&&Y(n.obj))this.removeGroup(n.obj);else if(n.obj&&nt(n.obj))this.removeEdge(n.obj);else if(n.obj&&j(n.obj))this.removePort(n.obj);else{if(e.getNodeCount!=null)for(;e.getNodeCount()>0;)this.removeNode(e.getNodeAt(0));if(e.getEdgeCount!=null)for(;e.getEdgeCount()>0;)this.removeEdge(e.getEdgeAt(0));if(e.getGroupCount!=null)for(;e.getGroupCount()>0;)this.removeGroup(e.getGroupAt(0),t!==!1)}}finally{this.setSuspendRendering(!1,!0)}}setSuspendRendering(e,t){for(let n in this.kr)this.kr.get(n).setSuspendRendering(e,t)}batch(e){this.setSuspendRendering(!0);try{e()}catch(t){U("Error in transaction "+t)}finally{this.setSuspendRendering(!1,!0)}}updateGroup(e,t){this.$_updateVertex(e,t,fA,!1)}$_updateGroup(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateNode(e,t){this.$_updateVertex(e,t,EA,!1)}$_updateNode(e,t,n,o){this.$_updateVertex(e,t,n,o)}updateVertex(e,t){this.$_updateVertex(e,t,km,!1)}$_updateVertex(e,t,n,o,s){let a=this.getObjectInfo(e);if(a.obj){let h=(j(a.obj)?a.obj.getParent():a.obj).objectType===ce.objectType?Re:ve;this.Wd(a.obj,t,o,h,(d,u)=>({vertex:d,updates:t||{},originalData:u,reason:n||km,source:s}))}}updateVertices(e,t){this.af(e,km,!1,t)}af(e,t,n,o){this.transaction(()=>{e.forEach(s=>{this.$_updateVertex(s.id,s.updates,t,n)})},o||ut)}updatePort(e,t){this.$_updatePort(e,t,Dd,!1)}$_updatePort(e,t,n,o){let s=this.getObjectInfo(e);s.obj&&this.Wd(s.obj,t,o,hr,(a,l)=>({port:a,vertex:a.getParent(),updates:t||{},originalData:l,reason:n||Dd}))}updateEdge(e,t){this.$_updateEdge(e,t,yA,!1)}$_updateEdge(e,t,n,o){let s=typeof e=="string"?this.graph.getEdge(e):e;if(s!=null){let a=Object.assign({},s.data);if(t)if(o)s.data=Object.assign({},t);else for(let u in t)s.data[u]==null?s.data[u]=t[u]:nm(s.data,u,t[u]);let{changed:l,newType:h,previousType:d}=this.Zd(a,s,!0);this.fire(xt,{edge:s,updates:t||{},originalData:a,reason:n,typeChanged:l,newType:h,previousType:d},null)}}update(e,t){this.Tn(e,t,null,!1)}Tn(e,t,n,o){if(J(e)){let s=n==null?EA:n;this.$_updateVertex(e,t,s,o)}else if(Y(e)){let s=n==null?fA:n;this.$_updateVertex(e,t,s,o)}else if(nt(e)){let s=n==null?yA:n;this.$_updateEdge(e,t,s,o)}else if(j(e)){let s=n==null?Dd:n;this.$_updatePort(e,t,s,o)}}setEdgeGeometry(e,t,n,o){n=lt(n||e.geometry),e.geometry=lt(t),this.fire(ri,{edge:e,geometry:t,originalGeometry:n,ui:o}),this.N(s=>{s.$edgeGeometryUpdated(e,t,n)})}clearEdgeGeometry(e){this.setEdgeGeometry(e,null,null,null)}getPath(e){return new ml(this,e)}findGraphObject(e){return e==null?null:e==="*"?this.graph:e.constructor===ce||e.constructor===de||e.constructor===se||e.constructor===Ue?e:X(e)||lr(e)?this.graph.getVertex(e):null}hs(e,t,n,o){return t||n.clear(),n.append(e,s=>{let a={obj:s,selection:n};o&&(this.N(l=>{l.$select(a)}),this.fire(Kt,a))})}lf(e,t,n){e=e||{};let o=[],s={},a=h=>{s[h.getId()]||(o.push(h),s[h.getId()]=!0)},l=(h,d,u,p)=>{if(h!=null){let g;nt(h)?g=[h]:g=t(h),e.filter&&(g=g.filter(e.filter));for(let m=0;m<g.length;m++){let E=d&&h===this.graph||g[m].source===h||n&&j(g[m].source)&&g[m].source.getParent()===h,y=u&&h===this.graph||g[m].target===h||n&&j(g[m].target)&&g[m].target.getParent()===h;(d&&E||u&&y||p&&(E||y))&&a(g[m])}}};return l(this.findGraphObject(e.source),!0,!1,!1),l(this.findGraphObject(e.target),!1,!0,!1),l(this.findGraphObject(e.element),!1,!1,!0),o}Zd(e,t,n){let o=t.objectType===Ue.objectType?this.edgeTypeProperty:t.objectType===de.objectType?this.portTypeProperty:this.typeProperty;if(t.data[o]!=null&&t.data[o]!==e[o]){let s=t.data[o],a=e[o];return t.type=s,this.$dispatchTypeChange(t,a,s,n),{changed:!0,newType:s,previousType:a}}return{changed:!1,newType:null,previousType:null}}Wd(e,t,n,o,s){if(e&&e.objectType){let a=Object.assign({},e.data),l=e.objectType===de.objectType?e.getFullId():e.id,h=e.objectType===de.objectType?this.portIdFunction(a):null,d;if(t){if(n)e.data=Object.assign({},t);else for(let E in t)nm(e.data,E,t[E]);e.objectType===de.objectType&&(d=this.portIdFunction(e.data),d!==e.id&&this.graph.renamePort(e,d),this.ls(e.getParent(),Dd))}let u=s(e,a);u.originalId=l,h!=null&&(u.originalPortId=h),this.N(E=>E.$vertexUpdated(u));let{changed:p,newType:g,previousType:m}=this.Zd(a,e,!0);p&&(u.typeChanged=!0,u.newType=g,u.previousType=m),this.fire(o,u,null)}}ls(e,t){if(this.portUpdater!=null){let n=this.portUpdater(e.data,e,e.getPorts());if(n!=null&&(e.data=n,!this.nl)){let o=Y(e)?ve:Re,s={vertex:e,updates:{},originalData:e.data,reason:t};this.N(a=>a.$vertexUpdated(s)),this.fire(o,s)}}}getEdges(e){return this.lf(e,t=>t.getEdges(),!1)}getAllEdges(){return this.graph.getAllEdges()}getAllEdgesFor(e,t){return e.getAllEdges(t)}selectAllEdges(){return this.filter(nt)}addAllEdgesToSelection(){this.addToSelection(this.getAllEdges())}setSelection(e){let t=this.Ni(e);this.hs(t,!1,this.Ee,!0)}select(e,t){let n=this.os(),o=this.Ni(e),s=this.hs(o,!0,n);if(t)for(let a=0;a<s[0].length;a++){let l=s[0][a];if(J(l||Y(l)||j(l))){let h=l.getAllEdges();for(let d=0;d<h.length;d++)n.append(h[d])}}return n}Jd(e,t,n,o){let s=e.getAllEdges();for(let a=0,l=s.length;a<l;a++)if(s[a].source===e){let h=s[a].target,d=h.getFullId();o[d]||(t.append(h),n&&t.append(s[a]),o[d]=!0,this.Jd(h,t,n,o))}}selectDescendants(e,t,n){let o=this.getObjectInfo(e),s=this.os();if(o.obj&&o.obj.objectType===ce.objectType){t&&this.hs(o.obj,!0,s);let a={};a[o.obj.getFullId()]=!0,this.Jd(o.obj,s,n,a)}return s}Ni(e){return e instanceof ml||e instanceof dr?e:X(e)?this.getVertex(e)||this.getEdge(e):Array.isArray(e)?e.map(t=>X(t)?this.getVertex(e)||this.getEdge(e):t):e}addToSelection(e){let t=this.Ni(e);if(t){let n=this.hs(t,!0,this.Ee,!1);n[1]!=null&&n[1].length>0&&this.Ii(!1,n[1]),n[0]!=null&&n[0].length>0&&this.Ii(!0,n[0])}}Ii(e,t){let n=e?Kt:qt;for(let o=0;o<t.length;o++){let s={obj:t[o],selection:this.Ee};this.N(a=>{e?a.$select(s):a.$deselect(s)}),this.fire(n,s)}}toggleSelection(e){let t=this.Ni(e);if(t){let n=[],o=this.Ee.toggle(t,(s,a)=>{a||n.push(s)});this.Ii(!1,o[1]),this.Ii(!1,n),this.Ii(!0,o[0])}}removeFromSelection(e){let t=this.Ni(e);t&&this.Ee.remove(t,n=>{let o={obj:n,selection:this.Ee};this.N(s=>{s.$deselect(o)}),this.fire(qt,o)})}addPathToSelection(e){this.addToSelection(this.getPath(e))}clearSelection(){this.Ee.clear()}getSelection(){return this.Ee}setMaxSelectedNodes(e){this.Ee.setMaxNodes(e)}setMaxSelectedEdges(e){this.Ee.setMaxEdges(e)}setSelectionCapacityPolicy(e){this.Ee.setCapacityPolicy(e)}hf(e){this.fire(e),this.nl=!1}Kd(e,t,n){e=e||{};let o=e.type||"json",s=e.data,a=e.url,l=e.jsonp,h=e.onload,d=e.parameters||{},u=e.error||function(g){};if(s==null&&a==null)throw new TypeError("You must supply either data or url to load.");let p=g=>{e.incremental===!1&&this.clear(),this.nl=!0,t===So?(this.undoRedo&&this.undoRedo.dataLoadStart(),this.N(m=>m.$dataLoadStart())):t===Mm&&(this.undoRedo&&this.undoRedo.dataAppendStart(),this.N(m=>m.$dataAppendStart())),this.fire(t),Kx(o,g,this,d),this.hf(n),h&&h(this,g),this.fire(Sb),n===Vr?(this.N(m=>m.$dataLoadEnd()),this.undoRedo&&this.undoRedo.dataLoadEnd()):n===Vm&&(this.N(m=>m.$dataAppendEnd()),this.undoRedo&&this.undoRedo.dataAppendEnd())};if(s)p(s);else if(a){if(l){let E=a.indexOf("?")===-1?"?":"&";a=a+E+"callback=?"}let g=o===kt||o===um?kt:e.dataType,m=e.headers||{Accept:"application/json"};this.fetchUrl({url:a,success:p,dataType:g,error:u,headers:m})}return this}load(e){return this.Kd(e,So,Vr)}append(e){return this.Kd(e,Mm,Vm)}save(e){if(e==null){U("VisuallyJs: save method requires at least URL parameter - no params given.");return}if(e.url==null){U("VisuallyJs: save method requires at least URL parameter");return}let t=e.data||this.exportData(e),n={"Content-Type":"application/json"};Object.assign(n,e.headers||{}),this.fetchUrl({url:e.url,type:"POST",data:t,success:e.success||function(o){},error:e.error||function(o){},headers:n})}exportData(e){return e=e||{},pm(e.type||kt,this,e.parameters)}toJSON(){return pm(kt,this,{})}getRenderer(e){return this.kr.get(e)}N(e,t){this.kr.forEach((n,o)=>{if(t==null||t!==n)try{e(n,o)}catch(s){U("WARN: could not invoke renderer "+o+" ["+s+"]")}})}$addRenderer(e,t){t=t||G(),this.kr.set(t,e),e.id=t,e.onDestroy(n=>{this.kr.delete(n.id)}),this.fire(Rb,{renderer:e,id:t})}getObjectInfo(e){let t={obj:null,type:null,id:null};if(e!=null){if(typeof e=="string")e=this.getNode(e)||this.getGroup(e)||this.getPort(e)||this.getEdge(e);else if(typeof e=="object"&&typeof e.objectType=="undefined"){let n=this.idFunction(e),o=this.edgeIdFunction(e);e=this.getNode(n)||this.getGroup(n)||this.getEdge(o)}if(e!=null)t.obj=e;else return t;t.obj!=null&&(t.id=t.obj.id,t.type=t.obj.objectType)}return t}undo(){this.undoRedo&&(this.undoRedo.undo(),this.fire(Lb,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}redo(){this.undoRedo&&(this.undoRedo.redo(),this.fire(wb,{undoCount:this.undoRedo.undoStack.length,redoCount:this.undoRedo.redoStack.length}))}transaction(e,t){return this.undoRedo?this.undoRedo.transaction(e,t):null}$transaction(e,t,n){return this.undoRedo?this.undoRedo.transaction(e,t,n):null}mergeTransaction(e){return this.undoRedo?this.undoRedo.mergeTransaction(e):null}openTransaction(e){return this.undoRedo?this.undoRedo.openTransaction(e):null}rollbackTransaction(){this.undoRedo&&this.undoRedo.rollbackTransaction()}commitTransaction(e){this.undoRedo&&this.undoRedo.commitTransaction(e)}flushUndoRedo(){this.undoRedo&&this.undoRedo.clear()}get version(){return Hm}$_deriveEdgeId(e){return e==null?G():typeof e=="string"?e:this.edgeIdFunction(e)||G()}};var fI="csv";function kO(i){let r=[],e="",t=!1;for(let n=0;n<i.length;n++){let o=i[n],s=i[n+1];t?o==='"'&&s==='"'?(e+='"',n++):o==='"'?t=!1:e+=o:o==='"'?t=!0:o===","?(r.push(e),e=""):e+=o}return r.push(e),r}var Wm=class{constructor(r,e){c(this,"csv");c(this,"lines");c(this,"startLine");c(this,"headers");this.csv=r,this.lines=r.split(/\r?\n/).map(t=>t.trim()),e=e||{},this.startLine=e.skipLines!=null?e.skipLines:e.readHeaders?1:0,e.readHeaders?this.lines[0]&&this.lines[0].length>0&&(this.headers=kO(this.lines[0])):this.headers=e.headers}qd(r){for(let e=this.startLine;e<this.lines.length;e++){let t=this.lines[e].trim();if(t.length===0)continue;let n=kO(t);r(n)}}readLines(r){this.qd(e=>r(e))}readRecords(r){this.qd(e=>{let t={};for(let n=0;n<e.length;n++){let o=this.headers?this.headers[n]||`Field ${n+1}`:`Field ${n+1}`;t[o]=e[n]}r(t)})}},TA=(i,r,e)=>{e=e||{};let t=e.nodeDecorator||(l=>l),n=e.edgeDecorator||(l=>l),o=new Map,s=[];new Wm(i,{readHeaders:e.readHeaders!==!1,headers:e.readHeaders===!1?["source","target","value"]:null}).readRecords(l=>{o.has(l.source)||o.set(l.source,t({id:l.source},!0)),o.has(l.target)||o.set(l.target,t({id:l.target},!1)),s.push({source:l.source,target:l.target,data:n({value:parseFloat(l.value)},o.get(l.source),o.get(l.target))})}),s.sort((l,h)=>h.data.value-l.data.value),Array.from(o.values()).forEach(l=>r.addNode(l)),s.forEach(l=>r.addEdge(l))};function vA(i){return i.eachNode!=null&&i.eachEdge!=null&&i.eachGroup!=null&&i.filter!=null}function WO(i,r){return r?i:i.toLowerCase()}function yI(i){i=""+i;let r=i.split(/\s/),e=[],t=[],n=4;for(let o=0;o<r.length;o++){let s=vt(r[o].replace(/[^\w]*/,""));s.length>0&&(e.push({token:s,context:""}),t.unshift(s),t.splice(n-1),t.length>1&&(t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse()))}for(t.pop();t.length>1;)t.reverse(),e.push({token:t.join(" "),context:""}),t.reverse(),t.pop();return e}var xI=yI;function bI(i){return i=vt(i),[{token:i.replace(/\s/g,"_"),context:i}]}function ZO(i){return[{token:vt(i),context:i}]}function AI(i,r){return i.score>r.score?-1:1}var SI=i=>i.id;function TI(i,r,e){if(i.length===0){i.push(r);return}let t=(n,o)=>{let s=n+Math.floor((o-n)/2),a=i[s],l=e(a,r),h;if(l===0){i.splice(s,0,r);return}else if(l===-1){if(s===i.length-1){i.push(r);return}else if(h=e(i[s+1],r),h!==l){i.splice(s+1,0,r);return}t(s+1,o)}else{if(s===0){i.unshift(r);return}else if(h=e(i[s-1],r),h!==l){i.splice(s,0,r);return}t(n,n+Math.floor((o-n)/2))}};t(0,i.length-1)}var vI=10,ks=class{constructor(r){c(this,"fields");c(this,"root");c(this,"tokenizer");c(this,"searchTokenizer");c(this,"limit");c(this,"exclusions");c(this,"caseSensitive");c(this,"idFunction");c(this,"sorter");c(this,"Qd",0);c(this,"Vi",new Map);c(this,"Hr",[]);c(this,"cs",0);c(this,"we",{});r=r||{},this.fields=r.fields,this.root=this.sl(),this.tokenizer=r.tokenizer||xI,this.searchTokenizer=r.searchTokenizer||ZO,this.limit=r.limit||vI,this.exclusions=r.exclusions||[],this.caseSensitive=r.caseSensitive===!0,this.idFunction=r.idFunction||SI,this.sorter=r.sorter||AI}sl(r){return{index:this.Qd++,children:{},documentIds:{},key:r}}df(r,e,t){let n=this.we[r];n||(n={},this.we[r]=n),n[e.index]=e}uf(r,e,t){let n=(o,s,a,l)=>{if(s!==a.length){var h=a[s],d=o.children[h];d||(d=this.sl(h),o.children[h]=d),d.documentIds[l]=d.documentIds[l]||[],d.documentIds[l].push(a),this.df(l,d,t),n(d,s+1,a,l)}};n(this.root,0,r,e)}removeExclusions(r){let e={};for(let t in r)this.exclusions.indexOf(t)===-1&&(e[t]=r[t]);return e}add(r){let e=t=>{let n=this.removeExclusions(t);TI(this.Hr,{document:n,score:1},this.sorter);var o=this.idFunction(t),s={fields:a=>{for(let l=0;l<this.fields.length;l++){let h=t[this.fields[l]];typeof h=="string"&&a(h)}},document:a=>{for(let l in t)if(l!=="id"){let h=t[l];typeof h=="string"&&a(h)}}};this.Vi.set(o,n),s[this.fields?"fields":"document"](a=>{if(a){let l=this.tokenizer(a);for(let h=0;h<l.length;h++)this.uf(WO(l[h].token,this.caseSensitive),o,l[h].context)}}),this.cs++};if(r.constructor===Array)for(let t=0;t<r.length;t++)e(r[t]);else e(r)}addAll(...r){for(let e=0;e<r.length;e++)this.add(r[e])}reindex(r){this.remove(r),this.add(r)}remove(r){let e=this.idFunction(r),t=this.we[e],n;if(t)for(n in t)delete t[n].documentIds[e];let o=-1;for(n=0;n<this.Hr.length;n++)if(this.idFunction(this.Hr[n].document)===e){o=n;break}o!==-1&&(this.Hr.splice(o,1),this.cs=this.Hr.length),this.Vi.delete(e)}clear(){this.Vi.clear(),this.we={},this.Qd=0,this.Hr.length=0,this.cs=0,this.root=this.sl()}getDocumentCount(){return this.cs}getDocumentList(){return this.Hr}getDocument(r){return this.Vi.get(r)}search(r,e){let t=this.searchTokenizer(r),n={},o=[],s={},a={},l=(d,u,p)=>{let g=n[d];g||(g={},n[d]=g,s[d]=0,a[d]=[]),a[d].push(p),g[u]||(g[u]=!0,s[d]++)},h=(d,u,p)=>{if(u===p.length){for(let m in d.documentIds)if(d.documentIds.hasOwnProperty(m)){let E=d.documentIds[m];for(let y=0;y<E.length;y++)l(m,p,E[y])}return}let g=p[u];d.children[g]&&h(d.children[g],u+1,p)};for(let d=0;d<t.length;d++)h(this.root,0,WO(t[d].token,this.caseSensitive));for(let d in n)o.unshift({document:this.Vi.get(d),score:s[d],contexts:a[d]});return o.sort(this.sorter),o.slice(0,e==null?this.limit:e)}},CA=class{constructor(r,e){this.instance=r;c(this,"nodeIndex");c(this,"groupIndex");c(this,"edgeIndex");c(this,"portIndex");this.nodeIndex=new ks(e),this.groupIndex=new ks(e),this.edgeIndex=new ks(e),this.portIndex=new ks(e),r.bind(Jt,t=>{this.eu(t.node)}),r.bind(Ce,t=>{this.nodeIndex.remove(t.node.data),t.node.getPorts().forEach(n=>this.portIndex.remove(n.data))}),r.bind(Re,t=>{this.nodeIndex.remove(t.vertex.data),this.nodeIndex.add(t.vertex.data)}),r.bind(Wt,t=>{this.tu(t.group)}),r.bind(Oe,t=>{this.groupIndex.remove(t.group.data)}),r.bind(ve,t=>{this.groupIndex.remove(t.vertex.data),this.groupIndex.add(t.vertex.data)}),r.bind(cr,t=>{this.ru(t.edge)}),r.bind(bt,t=>{this.edgeIndex.remove({id:t.edge.getId()})}),r.bind(xt,t=>{let n=Object.assign(t.originalData||{},{id:t.edge.getId()});this.edgeIndex.remove(n);let o=Object.assign(t.edge.data||{},{id:t.edge.getId()});this.edgeIndex.add(o)}),r.bind(ei,t=>{this.portIndex.add(t.port.data)}),r.bind(Gr,t=>{this.portIndex.remove(t.port.data)}),r.bind(hr,t=>{this.portIndex.remove(t.port.data),this.portIndex.add(t.port.data)}),r.bind(Zt,()=>{this.nodeIndex.clear(),this.groupIndex.clear(),this.edgeIndex.clear(),this.portIndex.clear()}),this.instance.eachNode((t,n)=>{this.eu(n)}),this.instance.eachGroup((t,n)=>{this.tu(n)}),this.instance.eachEdge((t,n)=>{this.ru(n)})}eu(r){this.nodeIndex.add(r.data),r.getPorts().forEach(e=>this.portIndex.add(e.data))}tu(r){this.groupIndex.add(r.data)}ru(r){let e=Object.assign(r.data||{},{id:r.getId()});this.edgeIndex.add(e)}search(r){let e=this.nodeIndex.search(r).map(s=>this.instance.getNode(s.document.id)),t=this.portIndex.search(r).map(s=>this.instance.getPort(s.document.id)),n=this.groupIndex.search(r).map(s=>this.instance.getGroup(s.document.id)),o=this.edgeIndex.search(r).map(s=>this.instance.getEdge(s.document.id));return{nodes:e,groups:n,edges:o,ports:t}}};var PA="context",Zm="lookup",_A="default",ni="element",$i="text",Po="tmpl",ii="each",Ll="if",OA="root",RA="class",LA="style",_o="$value",wl="$key",wA="attribute";function Jm(i,r){if(i==null)return i;{let e=i.replace(/\n/g,"").replace(/^[\s]+</,"<").replace("/>",">").replace(/>[\s]+$/,">").split(/^<|>$/)[1].split(r);return Gx(e)}}function NA(i){return i.length>0?i[i.length-1]:null}function IA(i){if(i==null||i.length===0)return!1;for(let r=i.length-1;r>-1;r--)if(i[r].type==="each")return!0;return!1}function Km(i,r,e,t,n){let o=G(),s={w:r,expressions:[],id:o};return e.bindings[i]=s,r.replace(/\{\{([^\}]*)\}\}/g,(a,l,h,d)=>{let u=!1;return l.startsWith(":")&&(u=!0,l=l.substring(1)),s.expressions.push([a,l,u]),""}),o}function DA(i,r,e,t,n){e.atts[i]=r,Km(i,r,e,t,n)}function MA(i,r){let e=Jm(i,r.attributesRe),t={el:vt(e[0]),atts:{},bindings:{}},n=(o,s)=>{let a=o.match(/([^=]+)=['"](.*)['"]/);return a==null&&s==null?t.atts[o]="":a==null?DA(o,"",t,s,r):DA(a[1],a[2],t,s,r),a};for(let o=1;o<e.length;o++){let s=vt(e[o]);s!=null&&s.length>0&&n(s)}return t}var CI=["*","-","+","/","%"],JO=["==",">","<",">=","<=","===","!=","!==","||"],PI=/([(])|([)])|(===)|(==)|(!==)|(!=)|(!{1,2})|(\|\|)|(<=)|(>=)|(<)|(>)|(\+)|(-)|(\*)|(\/)|(\s+)|([0-9\.]+)|(\$data\[[0-9]+\])|(\$value\[[0-9]+\])|(\$key)|(\$value)|('[^']+')|([#a-zA-Z\$]+[0-9a-zA-Z_\$\.]*)/g,Md="bool",KO="num",qO="group",QO="var",_I="op",VA="comp",eR="exp",tR="string",rR="array",nR="key",iR="value";function OI(i){return i[i.length-1]}function oR(i){return i.t===qO}function RI(i){return i.t===QO}function LI(i){return i.t===eR}function wI(i){return i.t===KO}function DI(i){return i.t===Md}function NI(i){return i.t===tR}function II(i){return i.t===rR}function MI(i){return i.t===nR}function VI(i){return i.t===iR}function sR(i){let r=i.match(PI),e,t=[{t:"root",c:[],e:i,v:null}];for(let n=0;n<r.length;n++){e=r[n];let o=OI(t);if(e==="("){let s={t:qO,c:[],v:null};o.c.push(s),t.push(s)}else if(e===")")t.pop();else if(e.match(/\$value\[[0-9]+\]/)){let s=parseInt(e.substring(7,e.length-1),10);o.c.push({t:rR,v:e,index:s})}else if(e.match(/\$key/))o.c.push({t:nR,v:null});else if(e.match(/\$value/))o.c.push({t:iR,v:null});else if(e.match(/^#/))o.c.push({t:eR,v:e.substring(1)});else if(e.match(/'[a-zA-Z0-9#_\$\.]+'/))o.c.push({t:tR,v:e.replace(/'/g,"")});else if(e.match(/true/))o.c.push({t:Md,v:!0});else if(e.match(/false/))o.c.push({t:Md,v:!1});else if(e.match(/^[0-9\.]+$/)){let s=e.indexOf(".")!==-1?parseFloat(e):parseInt(e,10);o.c.push({t:KO,v:s})}else e.match(/[a-zA-Z_\$\.]+/)?o.c.push({t:QO,v:e}):CI.indexOf(e)!==-1?o.c.push({t:_I,v:e}):JO.indexOf(e)!==-1?o.c.push({t:VA,v:e}):e.match(/!{1,2}/)&&(e.length===1?(o.c.push({t:Md,v:!1}),o.c.push({t:VA,v:"=="})):(o.c.push({t:Md,v:!1}),o.c.push({t:VA,v:"!=="})))}return t[0]}function GI(i){let r=null,e={t:"root",c:[],v:""},t={t:"root",c:[],v:""},n=e.c;for(let a=0;a<i.c.length;a++)if(JO.indexOf(i.c[a].v)!==-1){if(r!=null)throw new Error("Cannot parse expression; more than one comparator.");r=i.c[a].v,n=t.c}else n.push(i.c[a]);let o=a=>(oR(a)&&(a.c=s(a)),a),s=a=>{let l=a.c;if(l.length===0)return[];let h=[],d=o(l[0]);if(l.length===1)return[d];if(l.length===3)return[d,l[1],o(l[2])];{let u=d,p=null,g;for(let m=1;m<l.length;m+=2)g=l[m],(g.v==="+"||g.v==="-"?1:2)===2?p==null?(p={t:"group",c:[u,g],v:null},h.push(p)):p.c.push(u,g):(p!=null?p.c.push(u):h.push(u),p=null,h.push(g)),u=o(l[m+1]);return p!=null?p.c.push(u):h.push(u),h}};return e.c=s(e),t.c=s(t),{left:e,right:t,comparator:r}}function Dl(i){let r=sR(i);return GI(r)}function Bi(i,r,e,t,n){let o=qm(i.left.c,r,e,t,n);if(i.comparator==null)return o;{let s=qm(i.right.c,r,e,t,n);if(i.comparator==="==")return o==s;if(i.comparator==="===")return o===s;if(i.comparator===">")return o>s;if(i.comparator===">=")return o>=s;if(i.comparator==="<")return o<s;if(i.comparator==="<=")return o<=s;if(i.comparator==="!=")return o!=s;if(i.comparator==="!==")return o!==s;if(i.comparator==="||")return o||s}}function qm(i,r,e,t,n){let o=i.map(l=>oR(l)?qm(l.c,r,e,t,n):RI(l)?r(l.v):LI(l)?e(l.v):II(l)?r(_o)[l.index]:MI(l)?r(wl):VI(l)?r(_o):wI(l)||NI(l)||DI(l)?l.v:l),s=o[0],a;for(let l=1;l<o.length;l+=2){a=o[l].v;let h=o[l+1];a==="+"?s+=h:a==="-"?s-=h:a==="*"?s*=h:a==="/"&&(s/=h)}return typeof s=="undefined"?"":n!=null?n(s,t):s}var Fi=class{constructor(r){this.instance=r;c(this,"tag");c(this,"remove");c(this,"uuid");c(this,"children",[]);c(this,"elements",[]);c(this,"bindings");c(this,"context");c(this,"compiledBindings");this.uuid=G(),r.entries[this.uuid]=this,this.compiledBindings={}}nu(r){for(let e in r){let t=r[e];t.expressions.length>0&&(this.compiledBindings[e]={id:G(),name:e,expressions:t.expressions.map(([n,o,s])=>{let[a,l]=o==null?[null,null]:o.split(":");return{source:n,expression:Dl(a),once:s,format:l}})})}}};var Qm=class Qm extends Fi{constructor(e,t){super(t);c(this,"type","text");c(this,"value");this.value=e.value,this.bindings={};let n={id:G(),w:e.value,expressions:[]};e.value.replace(/\{\{([^\}]*)\}\}/g,function(o,s,a,l){let h=!1;return s.startsWith(":")&&(h=!0,s=s.substring(1)),n.expressions.push([o,s,h]),""}),this.nu({[Qm.TEXT_BINDING_NAME]:n})}};c(Qm,"TEXT_BINDING_NAME","__element");var Ui=Qm;var eE=class eE extends Fi{constructor(e,t){super(t);c(this,"type",eE.type);c(this,"comment");this.comment=e}};c(eE,"type","comment");var Ws=eE;var tE=class tE extends Fi{constructor(e,t,n,o,s){super(t);this.templateResolver=n;this.stack=o;this.parseIdStack=s;c(this,"type",tE.type);c(this,"namespace");c(this,"atts");c(this,"custom");let a=e.el.split(":");this.tag=e.el,a.length===2&&(this.namespace=a[0]),this.atts=e.atts,this.nu(e.bindings),this.remove=!1}};c(tE,"type",ni);var Xr=tE;var GA={},oi={construct:(i,r,e,t,n,o)=>{let s=GA[i];if(s)return new s(r,e,t,n,o);throw{message:"Recado: unknown element '"+i+"'"}},register:(i,r)=>{GA[i]=r},exists:i=>GA[i]!=null};var rE=class rE extends Xr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"key");c(this,"type",ii);this.context=e.atts.in,this.key=e.atts.key,this.tag=rE.tag}};c(rE,"tag","r-each");var Vd=rE;oi.register(Vd.tag,Vd);function nE(i,r,e){i.entryMap[r]=i.entryMap[r]||[],i.entryMap[r].push(e)}function $A(i,r,e,t){for(let n=0;n<r.children.length;n++){let o=r.children[n];nE(i,e,o)}Array.from(r.fragment.childNodes).forEach(n=>t.added.push({el:n})),i.placeholder.before(r.fragment)}var Gd=class{constructor(r,e,t){this.instance=r;this.tagName=e;this.options=t;c(this,"id");c(this,"template");c(this,"rendered");c(this,"updated");c(this,"fragments",{});c(this,"mounted");c(this,"defaultableFragmentKeys");c(this,"fragmentKeys");c(this,"parsedTemplates",{});c(this,"defaultNamespace");c(this,"decorator");this.id=`custom-${e}`;let n=t.fragments||{};this.defaultableFragmentKeys=t.defaultableFragmentKeys||[],this.template=t.template,this.defaultNamespace=t.defaultNamespace,this.decorator=t.decorator||((s,a)=>null);let o=new Set;for(let s in n){this.fragments[s]=this.fragments[s]||{},o.add(s);for(let a in n[s]){let l=`custom-${e}-${s}-${a}`,h=n[s][a];r.addTemplate(l,h),this.fragments[s][a]=r.parseAndCache(l,d=>{if(d===l)return h})}}this.fragmentKeys=Array.from(o),this.fragmentKeys.sort(),this.parsedTemplates[be]=this.iu(this.id),this.rendered=t.rendered||function(s,a,l){},this.updated=t.updated||function(s,a,l){},this.mounted=t.mounted}iu(r){return this.instance.parseAndCache(r,e=>{if(e===r)return this.template})}extractTemplateData(r,e){let t=r.split(":"),n=[];for(let o=0;o<t.length;o++){let s=e[t[o]];if(s==null)if(this.defaultableFragmentKeys.indexOf(t[o])!==-1)n.push(be);else return null;else n.push(s)}return n.join(":")}getAST(r){if(r==null)return this.parsedTemplates[be];{let e=[],t={};if(this.fragmentKeys.forEach(n=>{let o=this.extractTemplateData(n,r);o!=null&&(t[n]=this.fragments[n][o]||[],e.push(`${n}:${o}`))}),e.length>0){let n=e.join(" ");if(this.parsedTemplates[n]!=null)return this.parsedTemplates[n];{let o=this.iu(n);return this.ou(o[0],t),this.parsedTemplates[n]=o,o}}return this.parsedTemplates[be]}}ou(r,e){let t=[];for(let n=0;n<r.children.length;n++)if(r.children[n].tag==="r-fragment"){let o=e[r.children[n].atts.key]||[];t.push(...o)}else t.push(r.children[n]),this.ou(r.children[n],e);r.children=t}};function aR(i,r,e,t){t?i.el.style[r]=e:i.el.setAttribute(r,e)}function $I(i,r){i.el.nodeValue=r}function BI(i,r){let e=[];for(let t=0;t<r.children.length;t++)e.push(...$d(i,r.children[t]));return e}function $d(i,r){let e=BI(i,r);return r.type===ni?(i.removeElement(r.el),e.unshift(r.el)):r.type===$i?(i.removeTextNode(r.el),e.unshift(r.el)):r.type===ii&&(r.entryMap={}),e}function lR(i,r,e,t){for(let n in i.bindings)if(n!==RA){let o=i.bindings[n],s=o.binding,a=o.originalValue,l=!1;for(let h=0;h<s.expressions.length;h++)if(!s.expressions[h].once){let d=Bi(s.expressions[h].expression,r,u=>e(u),s.expressions[h].format,t);a=a.replace(s.expressions[h].source,d),d!==o.results[h].result&&(l=!0,o.results[h].result=d)}l&&(i.type===ni?n!==LA?aR(i,n,a,!1):a.split(";").forEach(h=>{let d=h.indexOf(":"),u=h.substring(0,d);aR(i,u,h.substring(d+1),!0)}):i.type===$i&&$I(i,a))}}function hR(){return{added:[],removed:[],elements:[]}}var iE=class iE extends Xr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"type","if");c(this,"tag",iE.tag);c(this,"test");c(this,"expression");this.test=e.atts.test,this.expression=Dl(this.test)}};c(iE,"tag","r-if");var Bd=iE;oi.register(Bd.tag,Bd);function oE(i,r,e,t,n){return i.resolution=Bi(i.entry.expression,o=>De(r,o),o=>e(o),t,n),i.resolution}var Oo=class extends Xr{constructor(e,t,n,o,s){super(e,t,n,o,s);c(this,"templateId");c(this,"lookup");c(this,"default");if(this.context=e.atts[PA],this.type=Po,this.remove=!0,e.atts[Zm])this.lookup=e.atts[Zm],this.default=e.atts[_A]||"";else{this.templateId=e.atts.id;let a=IA(o);if(s.indexOf(this.templateId)!==-1){if(!a)throw new TypeError("recursive template call ["+this.templateId+"]")}else{let l=n(this.templateId);s.push(this.templateId);let h=this.instance.parse(l,n,null,s);for(let d=0;d<h.length;d++)h[d].context=this.context;this.children=h,s.pop()}}}};c(Oo,"tag","r-tmpl"),oi.register(Oo.tag,Oo);function cR(i,r){if(Array.isArray(i))for(let e=0;e<i.length;e++)r(i[e],e);else if(lr(i)){let e=i;for(let t in e)r(e[t],t)}}var Ro=class{constructor(r){c(this,"templateResolver");c(this,"defaultTemplate");c(this,"defaultNamespace");c(this,"macros");c(this,"entries");c(this,"customTags",{});c(this,"formatter");c(this,"wt",new Map);c(this,"ds",new Map);c(this,"openRe",new RegExp("<([^/>]*?)>$|<([^/].*[^/])>$"));c(this,"closeRe",new RegExp("^</([^>]+)>"));c(this,"openCloseRe",new RegExp("<(.*)(/>$)"));c(this,"tokenizerRe",/(<[^\^>]+\/>)|(<!--[\s\S]*?-->)|(<[\/a-zA-Z0-9\-:]+(?:\s*[\(a-zA-Z\-\):]+=\"[^\"]*\"|\s*[a-zA-Z\-:]+='[^']+'|\s*[\(a-zA-Z\-\):]|\s*\{\{.*\}\}|\s*\{#.*\})*>)/);c(this,"commentRe",/<!--[\s\S]*?-->/);c(this,"attributesRe",/([\(a-zA-Z0-9\-_:\)]+="[^"]*")|\s+([\(a-zA-Z0-9\-_:\)]+(?=\s.|$))/);c(this,"us");c(this,"namespaceHandlers",{});c(this,"namespaces",{});r=r||{},this.us=r.templates||{},this.entries={},this.defaultTemplate=r.defaultTemplate,this.templateResolver=r.templateResolver||this.su(),this.macros=r.templateMacros||{},this.formatter=r.formatter,this.defaultNamespace=r.defaultNamespace}resolveTemplate(r){return this.us[r]!=null?this.us[r]:this.templateResolver(r)}setAttribute(r,e,t){let n=e.split(":");n.length===1?r.setAttribute(n[0],t):this.namespaces[n[0]]==null?r.setAttribute(e,t):r.setAttributeNS(this.namespaces[n[0]],n[1],t)}clearCache(){this.wt.clear(),this.ds.clear()}parseAttributes(r){return Jm(r,this.attributesRe)}au(r,e){return t=>{let n=e?null:this.wt.get(t);return n==null&&(n=r(t)),n==null&&(n=this.defaultTemplate),n!=null&&this.wt.set(t,n),n}}addTemplate(r,e){this.us[r]=e}template(r,e,t,n,o){e=e||{};let s=n?null:this.ds.get(r);if(s!=null)return this.render(s,e,t,o).fragment;{let a=this.parseAndCache(r,t,n);return a!=null?this.render(a,e,t,o).fragment:this.cf()}}mounted(r){r.$recado.mountings.forEach(e=>{e.mount(e.el,e.data,this,e.parent,e.context)})}parseAndCache(r,e,t){let n=this.ds.get(r);if(n==null||t===!0){e=this.au(e||(s=>this.resolveTemplate(s)),t);let o=e(r);if(o!=null){let s=dR(this,o,e,null,[r]);return this.ds.set(r,s),s}}else return n}data(r,e,t){return De(r,e,t)}each(r,e,t,n,o){let s;if(Array.isArray(r))for(s=0;s<r.length;s++)e(r[s],t,s,n,o);else for(s in r)r.hasOwnProperty(s)&&e({$key:s,$value:r[s]},t,s,n,o)}lookupValueInDataOrContext(r,e,t){return t.indexOf("$context.")===0?De(e,t.substring(9)):De(r,t)}update(r,e,t){let n=r.$recado,o=hR();return t=t||{},n!=null&&this.Dn(n,e,o,t),o}onUpdate(r,e){r.$recado!=null&&(r.$recado.updaters=r.$recado.updaters||[],r.$recado.updaters.push(e))}Dn(r,e,t,n,o){if(r.type===OA)for(let s=0;s<r.children.length;s++)this.Dn(r.children[s],e,t,n,o);else if(r.type===ni||r.type===$i){let s=e,a=this.customTags[r.entry.tag];a!=null&&(s=Object.assign({},e),Object.assign(s,a.decorator(e,n)||{})),lR(r,l=>this.lookupValueInDataOrContext(s,n,l),l=>this.Mi(l,s,n),this.formatter),a!=null&&a.updated&&a.updated(r.el,s,this);for(let l=0;l<r.children.length;l++)this.Dn(r.children[l],s,t,n,o)}else if(r.type===Ll){let s=r,a=s.resolution,l=oE(s,e,h=>this.Mi(h,e,n),null,this.formatter);if(!l){for(let h=0;h<r.children.length;h++)$d(this,r.children[h]).map(d=>t.removed.push({el:d}));r.children.length=0}if(l)if(a)for(let h=0;h<r.children.length;h++)this.Dn(r.children[h],e,t,n,s.defaultNamespace||o);else{let h=this.render(r.entry.children,e,this.templateResolver,n,s.defaultNamespace||o);r.children=h.children;for(let d=0;d<r.children.length;d++){let u=r.children[d];s.placeholder.before(u.el),t.added.push({el:u.el})}}}else if(r.type===Po){let s=r.entry.context==null||r.entry.context.length===0?e:this.lookupValueInDataOrContext(e,n,r.entry.context);for(let a=0;a<r.children.length;a++)this.Dn(r.children[a],s,t,n)}else if(r.type===ii){let s=r,a=this.lookupValueInDataOrContext(e,n,r.entry.context);if(a==null)$d(this,r).map(l=>t.removed.push({el:l}));else if(s.entry.key==null||s.entry.key.length===0)U("WARN: Cannot update r-each entry when no `key` parameter was set.");else{let l={},h=[],d=[];cR(a,(u,p)=>{let g=De(u,s.entry.key);if(l[g]=u,s.entryMap[g]!=null){let m=s.entryMap[g];for(let E=0;E<m.length;E++)h.push({data:u,key:g,execution:m[E]})}else h.push({data:u,key:g})});for(let u in s.entryMap)if(l[u]==null)for(let p=0;p<s.entryMap[u].length;p++)d.push({e:s.entryMap[u][p],key:u});for(let u=0;u<d.length;u++)delete s.entryMap[d[u].key],$d(this,d[u].e).map(p=>t.removed.push({el:p}));for(let u=0;u<h.length;u++){let p=h[u];if(p.execution)this.Dn(p.execution,p.data,t,n),p.execution.el!=null?s.placeholder.before(p.execution.el):p.execution.children.forEach(g=>{g.el!=null&&s.placeholder.before(g.el)});else{let g=this.render(r.entry.children,p.data,null,n);$A(s,g,p.key,t)}}}}if(r.updaters)for(let s=0;s<r.updaters.length;s++)r.updaters[s](r.el);return t}remove(r,e){e&&r.parentNode&&r.parentNode.removeChild(r)}registerTag(r,e){this.customTags[r]=new Gd(this,r,e)}parse(r,e,t,n){return dR(this,r,e,t,n)}Mi(r,e,t){return this.macros[r]&&this.macros[r](e,t)||""}render(r,e,t,n,o){let s={id:G(),fragment:this.cf(),children:[],type:"root",bindings:{},entry:null,mountings:[]},a=s.fragment,l=null,h=s;a.$recado=s,n=n||{};let d=(f,b,A)=>{let T={id:b,entry:f,placeholder:this.cc(`${ii}:${b}`),entryMap:{},type:ii,children:[]};return E(T.placeholder,A),h.children.push(T),T},u=(f,b,A)=>{let T={placeholder:this.cc(`${Po}:${b}`),entry:f,id:b,children:[],type:Po};return E(T.placeholder,A),h.children.push(T),T},p=(f,b,A,T)=>{y(f,T);let S={id:G(),entry:b,bindings:A,children:[],el:f,type:ni};return h.children.push(S),f.$recado=S,S},g=(f,b,A,T)=>{y(f,T);let S={id:G(),el:f,entry:b,bindings:A,children:[],type:$i};return h.children.push(S),f.$recado=S,S},m=(f,b,A)=>{let T=G(),S={id:T,entry:f,resolution:!1,placeholder:this.cc(`${Ll}:${T}`),type:Ll,children:[],defaultNamespace:A};return E(S.placeholder,b),h.children.push(S),S},E=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},y=(f,b)=>{b!=null?b.before(f):l!=null?l.appendChild(f):a.appendChild(f)},x=(f,b,A,T)=>{b=b||{};let S=!1,O=null;if(f.type===Ll){let v=h,_=m(f,A,o);if(h=_,S=oE(_,b,P=>this.Mi(P,b,n),null,this.formatter),S)for(let P=0;P<f.children.length;P++)x(f.children[P],b,_.placeholder,T);h=v,O=_}else if(f.type===ii){let v=f,_=l,P=f.context===_o?b:this.lookupValueInDataOrContext(b,n,f.context),I=h,C=G(),R=d(v,C,A);h=R,P!=null&&cR(P,(w,B)=>{let N=v.key&&lr(w)?De(w,v.key):B||null;for(let V=0;V<f.children.length;V++){let D=x(f.children[V],w,R.placeholder,B);N!=null&&nE(R,N,D)}}),l=_,h=I,O=R}else if(f.type===Po){let v=f,_=l,P=h,I=G(),C=u(v,I,A);h=C;let R=f.context==null||f.context.length===0?b:De(b,f.context),w=v.lookup!=null?De(b,v.lookup.replace(/[\{\{\}\}]/g,"")):v.templateId,B=this.parseAndCache(w,t);B==null&&v.default!=null&&(B=this.parseAndCache(v.default,t));for(let N=0;N<B.length;N++)x(B[N],R,C.placeholder,T);l=_,h=P,O=C}else if(f.type===ni){let v,_=f,P,I={},C=[];if(this.customTags[f.tag]!=null){P=this.customTags[f.tag];let N=Object.assign({},b);Object.assign(N,P.decorator(b,n)||{});let V=this.render(P.getAST(N),N,t,n,P.defaultNamespace);v=V.fragment.childNodes[0];let D=V.children[0].bindings;for(let $ in D)I[$]=D[$];C.push(...V.children[0].children)}else if(_.namespace!=null&&this.namespaceHandlers[_.namespace])v=this.namespaceHandlers[_.namespace](f.tag);else{let N=o||this.defaultNamespace;N!=null&&this.namespaceHandlers[N]?v=this.namespaceHandlers[N](`${N}:${f.tag}`):v=this.ce(f.tag)}for(let N in _.atts)if(_.atts.hasOwnProperty(N)){let V=_.atts[N];if(f.compiledBindings[N]!=null){let D=f.compiledBindings[N];I[N]={id:D.id,binding:D,results:[],originalValue:V,type:wA};for(let $=0;$<D.expressions.length;$++){let K=D.expressions[$],xe=Bi(K.expression,H=>H===wl?T:H===_o?b:this.lookupValueInDataOrContext(b,n,H),H=>this.Mi(H,b,n),K.format,this.formatter);V=V.replace(K.source,xe),I[N].results.push({source:K.source,result:xe})}}this.setAttribute(v,N,V)}P&&(P.rendered&&P.rendered(v,b,this,l,n),P.mounted&&s.mountings.push({mount:P.mounted,el:v,data:b,parent:l,context:n}));let R=l,w=h,B=p(v,_,I,A);B.children.push(...C),h=B,l=v;for(let N=0;N<f.children.length;N++)x(f.children[N],b,null,T);h=w,l=R,O=B}else if(f.type===$i){let v=f.value||"",_={},P=f.compiledBindings[Ui.TEXT_BINDING_NAME];if(P!=null){_[Ui.TEXT_BINDING_NAME]={id:P.id,binding:P,results:[],originalValue:v,type:$i};for(let R=0;R<P.expressions.length;R++){let w=P.expressions[R],B=Bi(w.expression,N=>N===wl?T:N===_o?b:this.lookupValueInDataOrContext(b,n,N),N=>this.Mi(N,b,n),w.format,this.formatter);v=v.replace(w.source,B),_[Ui.TEXT_BINDING_NAME].results.push({source:w.source,result:B})}}let I=this.ctn(v);O=g(I,f,_,A)}return O};for(let f=0;f<r.length;f++)x(r[f],e||{},null,null),l=null,h=s;return s}};function FI(i){return oi.exists(i)}function UI(i,r,e,t,n,o){return oi.construct(r,e,i,t,n,o)}function dR(i,r,e,t,n){n=n||[],e=i.au(e||(E=>i.resolveTemplate(E)),null);let o=[],s=[],a=(E,y)=>{let x=E.match(y);return x==null?null:x},l=()=>o.length>0?o[o.length-1]:null,h=E=>{let y=l();return y!=null&&y.tag===E},d=(E,y)=>{o.length>0&&l().children.push(E),y?o.length===0&&s.push(E):o.push(E)},u=E=>{d(E,!0)},p=()=>{let E=o.pop();if(o.length===0&&!E.remove)s.push(E);else if(E.remove){let y=l();y&&y.children.pop()}return E},g=(E,y,x,f)=>{let b=MA(E,i);return FI(b.el)?UI(i,b.el,b,x,o,n):new Xr(b,i,x,o,n)},m=[{re:i.commentRe,handler:(E,y,x,f,b)=>{d(new Ws(E,f),!0)}},{re:i.openRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,A.remove)}},{re:i.closeRe,handler:(E,y,x,f,b)=>{if(y[1]!==Oo.tag)if(h(y[1]))p();else throw new TypeError("Unbalanced closing tag '"+y[1]+"'; opening tag was '"+p().tag+"'")}},{re:i.openCloseRe,handler:(E,y,x,f,b)=>{let A=g(E,y,x,b);d(A,!0)}},{re:/.*/,handler:(E,y,x,f,b)=>{let A=new Ui({value:E},f);u(A),E.match(/^[\s]*$/)!=null||Km(Ui.TEXT_BINDING_NAME,E,A,null,f)}}];if($x(vt(r).split(i.tokenizerRe),(E,y)=>{let x=vt(y);for(let f=0;f<m.length;f++){let b=a(x,m[f].re);if(b){m[f].handler(y,b,e,i,n);break}}}),s.length>0&&t)for(let E in t)s[0][E]=t[E];return s}function BA(i,r){let e=typeof i=="string"?parseFloat(i):i;if(isNaN(e))return i;let t=/^(['|,])?(\.(\d+))?([df])$/,n=r.match(t);if(!n)return e.toString();let o=n[1],s=n[3]?parseInt(n[3],10):null,a=n[4],l;a==="d"?l=Math.floor(e).toString():l=s!==null?e.toFixed(s):e.toString();let h=l.split("."),d="";return o===","?d=",":o==="'"?d=" ":d=1e3.toLocaleString().substring(1,2),h[0]=h[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),h.join(".")}var Fd=class{constructor(){c(this,"childNodes");this.childNodes=[]}removeChild(r){this.childNodes=this.childNodes.filter(e=>e!==r)}appendChild(r){this.childNodes.push(r)}insertAfter(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t,0,e)}insertBefore(r,e){let t=this.childNodes.indexOf(r);t!=null&&this.childNodes.splice(t-1,0,e)}toString(){let r="";for(let e=0;e<this.childNodes.length;e++)r+=this.childNodes[e].toString();return r}},sE=class extends Fd{constructor(e){super();c(this,"nodeType",1);c(this,"parentElement");c(this,"tag");c(this,"atts");c(this,"style",{});this.tag=e,this.atts={}}getAttribute(e){return this.atts[e]}setAttributeNS(e,t,n){this.atts[e+":"+t]=n}setAttribute(e,t){this.atts[e]=t}toString(){let e="<"+this.tag,t="";for(let n in this.atts)t+=" "+n+'="'+this.atts[n]+'"';e=e+t+">";for(let n=0;n<this.childNodes.length;n++)e+=this.childNodes[n].toString();return e+"</"+this.tag+">"}after(e){this.parentElement.insertAfter(this,e)}before(e){this.parentElement.insertBefore(this,e)}},aE=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",3)}toString(){return this.nodeValue}after(r){this.parentElement.insertAfter(this,r)}},lE=class{constructor(r){this.nodeValue=r;c(this,"parentElement");c(this,"nodeType",8)}before(r){this.parentElement.insertBefore(this,r)}};var hE=class extends Ro{su(){return null}ce(r){return new sE(r)}cf(){return new Fd}ctn(r){return new aE(r)}cc(r){return new lE(r)}removeElement(r){}removeTextNode(r){}};function Ud(i){let r={};for(let e=0;e<i.length;e++)r[i[e].id]=i[e];return r}function cE(i,r){let e=r===0?"x":"y";return i.target[e]<i.source[e]?-1:1}function FA(i,r,e){let t=e===0?"x":"y";return i.source[t]>r.source[t]&&i.source[t]<r.target[t]||r.source[t]>i.source[t]&&r.source[t]<i.target[t]||i.target[t]>r.target[t]&&i.target[t]<r.source[t]||r.target[t]>i.target[t]&&r.target[t]<i.source[t]}function Yd(i,r,e,t,n){let o=i,s=r;for(let a=0;a<o.length;a++){let l=o[a];l.sourcePosition=t(l.sourceId),l.sourceSize=n(l.sourceId),l.targetPosition=t(l.targetId),l.targetSize=n(l.targetId),l.sourceCenter={x:l.sourcePosition.x+l.sourceSize.width/2,y:l.sourcePosition.y+l.sourceSize.height/2},l.targetCenter={x:l.targetPosition.x+l.targetSize.width/2,y:l.targetPosition.y+l.targetSize.height/2};for(let h=0;h<l.path.length;h++){let d=e[l.path[h]],u=h<l.path.length-1?e[l.path[h+1]]:null;d.edges=d.edges||[],d.edges.push({edge:l,next:u})}}for(let a=0;a<s.length;a++)if(s[a].edges){let l=s[a];l.edges.sort((u,p)=>{let g=u.edge.pathDirection,m=p.edge.pathDirection,E=u.edge.path.indexOf(l.id),y=p.edge.path.indexOf(l.id),x=g===1?E+1:E-1,f=m===1?y+1:y-1,b=x>=0&&x<u.edge.path.length?e[u.edge.path[x]]:null,A=f>=0&&f<p.edge.path.length?e[p.edge.path[f]]:null,T=g===1?E-1:E+1,S=m===1?y-1:y+1,O=T>=0&&T<u.edge.path.length?e[u.edge.path[T]]:null,v=S>=0&&S<p.edge.path.length?e[p.edge.path[S]]:null,_=l.axis===0?ee:fe,P=b?b.midpoint[_]:O?O.midpoint[_]:p.edge.sourceCenter[_]!==u.edge.sourceCenter[_]?u.edge.sourceCenter[_]:u.edge.targetCenter[_],I=b?A.midpoint[_]:v?v.midpoint[_]:u.edge.sourceCenter[_]!==p.edge.sourceCenter[_]?p.edge.sourceCenter[_]:p.edge.targetCenter[_];return P-I});let h=s[a].length/(s[a].edges.length+1),d=h;for(let u=0;u<s[a].edges.length;u++)s[a].edges[u].location=d,d+=h}}function zd(i,r,e){for(let t=0;t<i.length;t++){let n=i[t];n.regionPath=n.regionPath||[];for(let o=0;o<n.path.length;o++){let s=e[n.path[o]],a=s.edges.find(d=>d.edge.id===n.id),l=a.edge.pathDirection;if(!(a.edge.pathDirection===1&&s.b.type==="vertex"||a.edge.pathDirection===-1&&s.a.type==="vertex")){let d=a.next.edges.find(A=>A.edge.id===n.id),u=r.find(A=>A.id===(l===1?s.b.id:s.a.id)),p=s.axis===0?l===1?0:u.height:l===1?0:u.width,g=s.axis===0?l===1?u.height:0:l===1?u.width:0,m=s.segment.point1-(s.axis===0?u.left:u.top),E=a.next.segment.point1-(s.axis===0?u.left:u.top),y=s.axis===0?"x":"y",x=s.axis===0?"y":"x",f={[y]:a.location+m,[x]:p},b={[y]:d.location+E,[x]:g};u.lines.push({source:f,target:b,id:n.id}),n.regionPath.push(u)}}}}var Xd="separate",YI="bus";function UA(i){let r=i.axis,e=i.gates,t=i.gateMap||Ud(e),n=i.mode||Xd,o=i.regions,s=i.edges,a=i.pad||10,l={};Yd(s,e,t,i.getVertexPosition,i.getVertexSize),zd(s,o,t);for(let h=0;h<o.length;h++){o[h].edgeMap={};let d=[],u=o[h].lines;for(let x=0;x<u.length;x++){let f=[];for(let b=0;b<d.length;b++)e:for(let A=0;A<d[b].length;A++)if(FA(u[x],d[b][A],r)){f.push(b);break e}if(f.length===0)d.push([u[x]]);else{let b=[u[x]],A=[];for(let T=0;T<d.length;T++)f.indexOf(T)!==-1?b=b.concat(d[T]):A.push(d[T]);A.push(b),d=A}}for(let x=0;x<d.length;x++)d[x].sort((f,b)=>{let A=cE(f,r),T=cE(b,r),S=r==0?"x":"y";return A===T?A<0?f.source[S]-b.source[S]:b.source[S]-f.source[S]:f.source[S]-b.source[S]});o[h].lineSets=d;let p=r===0?o[h].height:o[h].width,g=r===0?o[h].left:o[h].top,m=r===0?o[h].top:o[h].left,E=r===0?"x":"y",y=r===1?"x":"y";if(n===Xd)for(let x=0;x<d.length;x++){let f=(p-a)/(d[x].length+1),b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];l[T.id]=l[T.id]||[],o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}],b+=f}}else for(let x=0;x<d.length;x++){let f=(p-a)/2,b=a+f;for(let A=0;A<d[x].length;A++){let T=d[x][A];o[h].edgeMap[T.id]=[{[E]:T.source[E]+g,[y]:T.source[y]+m},{[E]:T.source[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:b+m},{[E]:T.target[E]+g,[y]:T.target[y]+m}]}}}for(let h=0;h<s.length;h++){let d=s[h];l[d.id]=[],d.regionPath.forEach(p=>{let g=p.edgeMap[d.id];l[d.id].push(...g)})}return l}function YA(i){let r=i.gates,e=Ud(r),t=i.regions,n=i.edges,o={};Yd(n,r,e,i.getVertexPosition,i.getVertexSize),zd(n,t,e);for(let s=0;s<t.length;s++){t[s].edgeMap={};let a=t[s].lines;for(let l=0;l<a.length;l++){let h=a[l];t[s].edgeMap[h.id]=[{x:h.source.x+t[s].left,y:h.source.y+t[s].top},{x:h.target.x+t[s].left,y:h.target.y+t[s].top}]}}for(let s=0;s<n.length;s++){let a=n[s];o[a.id]=[],a.regionPath.forEach(h=>{let d=h.edgeMap[a.id];o[a.id].push(...d)})}return o}var zA=4;function uR(i){return{x:Math.ceil(i.x+i.width/2),y:Math.ceil(i.y+i.height/2)}}var Zs={sortRect:i=>{let r,e=1/0,t=-1/0;i.forEach(s=>{r=uR(s),t=Math.max(t,r.x,r.y),e=Math.min(e,r.x,r.y)});let n=t-e;return i.sort(s=>(r=uR(s),Zs.toHilbertCoordinates(n,r.x-e,r.y-e)))},toHilbertCoordinates:(i,r,e)=>{let t=i,n=(1<<t)-1,o=0,s=r^e,a=~r&n,l=~e&n,h=a^e,d=0,u=0;for(let p=1;p<t;p++)u=(u&s|(d^l)&h)>>1,d=(d&(u^a)|~d&(u^l))>>1;return o=~d&(u^r)|d&(u^l),Zs.hilbertInterleaveBits(o,s)},hilbertInterleaveBits:(i,r)=>{let e=0,t=Math.max(i,r),n=0;for(;t>0;)n++,t>>=1;for(let o=0;o<n;o++){let s=1<<o,a=(r&s)>0?1<<2*o:0,l=(i&s)>0?1<<2*o+1:0;e+=a+l}return e}};function pR(i){return i.height*i.width}function dE(i,r){i.x===1/0?(i.height=r.height,i.width=r.width,i.x=r.x,i.y=r.y):(i.height=Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y),i.width=Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x),i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y))}function uE(i){i.x=Math.min(...i.children.map(r=>r.x)),i.y=Math.min(...i.children.map(r=>r.y)),i.width=Math.max(...i.children.map(r=>r.x+r.width))-i.x,i.height=Math.max(...i.children.map(r=>r.y+r.height))-i.y,i.parent!=null&&uE(i.parent)}function XA(i,r){return i.x===1/0?pR(r):(Math.max(i.y+i.height,r.y+r.height)-Math.min(i.y,r.y))*(Math.max(i.x+i.width,r.x+r.width)-Math.min(i.x,r.x))-pR(i)}function pE(i){let r=Math.floor(i.children.length/2),e=Lo(),t=Lo();return Zs.sortRect(i.children).forEach((n,o)=>{o<=r?wo(e,n):wo(t,n)}),i.children.length=0,[e,t]}function Lo(i){return{x:1/0,y:1/0,width:0,height:0,children:[],parent:null,id:i,data:null}}function jd(i){return i.children==null||i.children.length===0}function jA(i){return jd(i)||jd(i.children[0])}function wo(i,r){r.parent=i,i.children.push(r),dE(i,r)}function gE(i,r){let e=i.children.indexOf(r);return e>=0?(i.children.splice(e,1),!0):!1}function gR(i){return i.reduce(function(r,e){return Array.isArray(e)?r.concat(gR(e)):r.concat(e)},[])}function HA(i,r){let e=i.map(r);return i[e.indexOf(Math.min.apply(null,e))]}function mR(i){i.parent&&(gE(i.parent,i),uE(i.parent))}var Do=class{constructor(r){c(this,"or");c(this,"oe");c(this,"Wr",{});this.or=r||zA,this.oe=Lo()}search(r,e){let t=[];return this.lu(r,(n,o)=>t.push(n),e),t}searchAndRank(r,e){let t=[];return this.lu(r,(n,o)=>t.push({node:n,overlap:Zg(n,r)}),e),t.sort((n,o)=>n.overlap<o.overlap?-1:1),t}lu(r,e,t){if(this.oe.children.length===0)return;t=t||{};let n=Object.assign({},r);t.margin&&(n.x-=t.margin,n.y-=t.margin,n.width+=2*t.margin,n.height+=2*t.margin);let o=s=>{if(rt(s,n))for(let a=0;a<s.children.length;a++){let l=s.children[a];if(rt(l,n))if(l.id!=null){if(t.minimumOverlap!=null&&Zg(l,n)<t.minimumOverlap)continue;if(e(l,n),t.greedy)return}else o(l)}};o(this.oe)}findIntersectionsWithLine(r,e){let t=[];e=e||[];let n=o=>{Ox(r,o)&&(jd(o)?e.indexOf(o.id)===-1&&t.push(o):o.children.forEach(n))};return n(this.oe),t}insert(r){let e=n=>{let o=this.oe;if(o){let s={x:n.x,y:n.y,width:n.width,height:n.height,data:n.data,children:[],id:n.id};for(n.id&&(this.Wr[n.id]=s);!jA(o);)dE(o,s),o=HA(o.children,a=>XA(a,s));wo(o,s),this.pf(s)}},t=Array.isArray(r)?r:[r];for(let n=0;n<t.length;n++)e(t[n])}pf(r){let e=r;for(;e.parent&&e.parent.children.length>this.or;)e=e.parent,e!=this.oe?(gE(e.parent,e),pE(e).forEach(t=>{wo(e.parent,t)})):e==this.oe&&pE(e).forEach(t=>{wo(e,t)})}hu(r,e){e===void 0&&(e=1);let t=Math.ceil(r.length/this.or),n=[],o=0,s;for(let a=0;a<t;a++){s=Lo(),o=Math.min(this.or,r.length);for(let l=0;l<o;l++){let h=r.pop();h.id&&(this.Wr[h.id]=h),wo(s,h)}n.push(s)}return t>1?this.hu(n,e+1):n}load(r){if(r!=null&&r.length>0){let e=Zs.sortRect(r);this.oe=this.hu(e)[0]||Lo()}}getBounds(){return{x:this.oe.x,y:this.oe.y,width:this.oe.width,height:this.oe.height}}getExtents(){return{xmin:this.oe.x,ymin:this.oe.y,xmax:this.oe.x+this.oe.width,ymax:this.oe.y+this.oe.height}}removeById(r){let e=this.searchById(r);return e&&e.parent&&this.cu(e),e}cu(r,e){let t=[],n=r.parent;for(mR(r),r.id!=null&&delete this.Wr[r.id];n!=null&&n!==this.oe;)n.children.length<=this.or/2&&(mR(n),t.push(...this.mf(n))),n=n.parent;e&&t.push(...e),this.insert(t)}searchById(r){return r==null?null:this.Wr[r]}update(r,e,t,n,o,s){let a=this.searchById(r);a?this.cu(a,[{x:e,y:t,width:n,height:o,data:s||a.data,children:[],id:r}]):this.insert({id:r,x:e,y:t,width:n,height:o,data:s,children:[]})}clear(){this.oe=Lo(),this.Wr={}}getLeafNodes(){return Object.values(this.Wr)}has(r){return this.Wr.hasOwnProperty(r)}mf(r){let e=[],t=n=>{n.id!=null?e.push(n):n.children.forEach(t)};return t(r),e}};var Hd=class i{constructor(r){this.instance=r;c(this,"pe",[]);c(this,"te",[]);c(this,"ne",[])}static from(r){let e=new i(r.instance);return e.pe=r.pe.slice(),e.te=r.te.slice(),e.ne=r.ne.slice(),e}paste(r,e){let t=e&&e.origin,n=e&&e.hermetic===!0,o=e&&e.shallow===!0,s=this.gf(r,t,n,o);return this.instance.transaction(()=>{s.groups.forEach(a=>this.instance.addGroup(a)),s.nodes.forEach(a=>this.instance.addNode(a)),s.edges.forEach(a=>this.instance.$_addEdge(a,Zx,null))}),s}gf(r,e,t,n){let o={nodes:[],groups:[],edges:[],vertexMap:new Map,edgeMap:new Map,origin:{x:0,y:0},transform:{x:0,y:0}},s=[],a=this.instance.modelLeftAttribute,l=this.instance.modelTopAttribute,h=1/0,d=1/0,u=new Map;function p(m){let E=r.getCoordinates(m,!0);u.set(m.id,E),m.group==null&&(h=Math.min(h,E.x),d=Math.min(d,E.y))}this.te.forEach(p),this.pe.forEach(p),o.origin.x=h,o.origin.y=d,o.transform.x=e!=null?e.x-o.origin.x:0,o.transform.y=e!=null?e.y-o.origin.y:0;let g=(m,E,y)=>{y=y||0;let x=Object.assign({},m.data),f=G();if(o.vertexMap.set(m.getFullId(),f),x.id=f,E==null){let b=u.get(m.getFullId());x[a]=b.x+o.transform.x,x[l]=b.y+o.transform.y,x[this.instance.groupProperty]!=null&&delete x[this.instance.groupProperty]}else x[this.instance.groupProperty]=E.id;return!n&&Y(m)&&m.getMembers().forEach(b=>{let A=g(b,x,y+1);Y(b)?s.push(A):o.nodes.push(A[0])}),[x,y]};return this.pe.forEach(m=>o.nodes.push(g(m,null,0)[0])),this.te.forEach(m=>s.push(g(m,null,0))),s.sort((m,E)=>m[1]<E[1]?-1:1),o.groups=s.map(m=>m[0]),this.ne.forEach(m=>{let E,y,x=m.source,f=j(x)?x.getParent():x,b=o.vertexMap.get(f.id),A=m.target,T=j(A)?A.getParent():A,S=o.vertexMap.get(T.id);if(b==null){if(t)return;E=f.id}else E=b;if(S==null){if(t)return;y=T.id}else y=S;let O={source:E,target:y,data:Object.assign({},m.data||{})};if(O.data.id!=null){let v=G();o.edgeMap.set(O.data.id,v),O.data.id=v}m.geometry!=null&&S!=null&&b!=null&&(O.geometry=r.transformGeometry(m,o.transform.x,o.transform.y)),o.edges.push(O)}),o}};var kd=class{constructor(r){this.instance=r;c(this,"stack",[])}copy(r){let e=this.instance.select(r);this.stack.push(Hd.from(e))}paste(r){let t=r&&r.clear===!0?this.stack.pop():this.stack[this.stack.length-1];return t!=null?t.paste(this.$getCopyDataTransformer(),r):null}clear(){this.stack.length=0}copyCurrentSelection(){this.copy(this.instance.getSelection())}pasteCurrentSelection(r){return this.copyCurrentSelection(),this.paste(r)}};var mE="Anchor",Pt="top",_t="left",Ot="right",Rt="bottom",EE={[Pt]:{x:0,y:-1},[Rt]:{x:0,y:1},[Ot]:{x:1,y:0},[_t]:{x:-1,y:0}},zI=[_t,Ot],XI=[Pt,Rt],jI={[Pt]:[_t,Ot],[Rt]:[_t,Ot],[_t]:[Rt,Pt],[Ot]:[Rt,Pt]},HI={[Pt]:Rt,[Rt]:Pt,[_t]:Ot,[Ot]:_t},ER=(s=>(s.Circle="Circle",s.Ellipse="Ellipse",s.Triangle="Triangle",s.Diamond="Diamond",s.Rectangle="Rectangle",s.Square="Square",s))(ER||{}),Nl=(f=>(f.Assign="Assign",f.AutoDefault="AutoDefault",f.Bottom="Bottom",f.BottomLeft="BottomLeft",f.BottomRight="BottomRight",f.Center="Center",f.Continuous="Continuous",f.ContinuousBottom="ContinuousBottom",f.ContinuousLeft="ContinuousLeft",f.ContinuousRight="ContinuousRight",f.ContinuousTop="ContinuousTop",f.ContinuousLeftRight="ContinuousLeftRight",f.ContinuousTopBottom="ContinuousTopBottom",f.Left="Left",f.Right="Right",f.Top="Top",f.TopLeft="TopLeft",f.TopRight="TopRight",f))(Nl||{});var Rn={};function Js(i,r){Rn[i]=r}var ur={lineIntersection(i,r,e,t,n){return Rn[i.type].lineIntersection(i,r,e,t,n)},boxIntersection(i,r,e,t,n){return Rn[i.type].boxIntersection(i,r,e,t,n)},boundingBoxIntersection(i,r){return Rn[i.type].boundingBoxIntersection(i,r)},pointOnPath(i,r,e){return Rn[i.type].pointOnPath(i,r,e)},gradientAtPoint(i,r,e){return Rn[i.type].gradientAtPoint(i,r,e)},pointAlongPathFrom(i,r,e,t){return Rn[i.type].pointAlongPathFrom(i,r,e,t)},findClosestPointOnPath(i,r,e){return Rn[i.type].findClosestPointOnPath(i,r,e)},getPath(i,r){return Rn[i.type].getPath(i,r)}};function fE(i){return Rn[i.type].getLength(i)}function kA(i,r){return Rn[i].create(r)}function kI(){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}function WA(i,r,e){return kI()}function ZA(i,r,e,t,n){return[]}function Il(i,r,e,t,n){let o=[];return o.push.apply(o,ur.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,ur.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,ur.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,ur.lineIntersection(i,r,e+n,r,e)),o}function JA(i,r){return Il(i,r.x,r.y,r.width,r.height)}function Ks(i){return Object.assign({extents:Pi()},i)}function fR(){return{sx:0,sy:0,tx:0,ty:0,so:{x:0,y:0},to:{x:0,y:0},x:0,y:0,w:0,h:0,quadrant:1,startStubX:0,startStubY:0,endStubX:0,endStubY:0,isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1,opposite:!1,perpendicular:!1,orthogonal:!1,sourceAxis:ee,stubs:[0,0]}}function qs(i,r,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+r,curY:i.curY+e}}function Wd(i,r,e,t){let n=e.gap||0,o=e.stub||t,s=Array.isArray(o)?o[0]:o,a=Array.isArray(o)?o[1]:o;return{type:i,internalSegments:[],segmentProportionalLengths:[],segmentProportions:[],totalLength:0,cssClass:e.cssClass||"",hoverClass:e.hoverClass||"",gap:n,stub:o,sourceStub:s,targetStub:a,sourceGap:Array.isArray(n)?n[0]:n,targetGap:Array.isArray(n)?n[1]:n,typeDescriptor:"connector",geometry:null,idPrefix:"_vjs_connector",bounds:Pi(),x:0,y:0,width:0,height:0,edited:!1,strokeWidth:1,typeId:null,quadrant:0,paintInfo:fR()}}function yE(i,r,e){let t=e===0?r.anchors.source:r.anchors.target;t.isFixed=!0,t.fixedLocation=Object.assign({},i,{offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY})}var KA=.45,yR=62;function Zd(i,r,e){let t=Wd(i,r,e,[0,0]);return Object.assign(t,{curviness:e.curviness||10,gap:e.gap||5,proximityLimit:e.proximityLimit||80,clockwise:e.orientation&&e.orientation==="clockwise",loopbackDistance:e.loopbackDistance||yR,isLoopbackCurrently:!1,constrain:nn,smooth:!0})}var si={subtract:(i,r)=>({x:i.x-r.x,y:i.y-r.y}),dotProduct:(i,r)=>i.x*r.x+i.y*r.y,square:i=>Math.sqrt(i.x*i.x+i.y*i.y),scale:(i,r)=>({x:i.x*r,y:i.y*r})},xR=64,WI=Math.pow(2,-xR-1);function SR(i,r){let e=[],t=ZI(i,r),n=r.length-1,o=2*n-1,s=qA(t,o,e,0),a=si.subtract(i,r[0]),l=si.square(a),h=0,d;for(let u=0;u<s;u++)a=si.subtract(i,QA(r,n,e[u],null,null)),d=si.square(a),d<l&&(l=d,h=e[u]);return a=si.subtract(i,r[n]),d=si.square(a),d<l&&(l=d,h=1),{location:h,distance:l}}function rS(i,r){let e=SR(i,r);return{point:QA(r,r.length-1,e.location,null,null),location:e.location}}function ZI(i,r){let e=r.length-1,t=2*e-1,n=[],o=[],s=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]];for(let u=0;u<=e;u++)n[u]=si.subtract(r[u],i);for(let u=0;u<=e-1;u++)o[u]=si.subtract(r[u+1],r[u]),o[u]=si.scale(o[u],3);for(let u=0;u<=e-1;u++)for(let p=0;p<=e;p++)s[u]||(s[u]=[]),s[u][p]=si.dotProduct(o[u],n[p]);for(let u=0;u<=t;u++)a[u]||(a[u]=[]),a[u].y=0,a[u].x=parseFloat(""+u)/t;let h=e,d=e-1;for(let u=0;u<=h+d;u++){let p=Math.max(0,u-d),g=Math.min(u,h);for(let m=p;m<=g;m++){let E=u-m;a[m+E].y+=s[E][m]*l[E][m]}}return a}function qA(i,r,e,t){let n=[],o=[],s,a,l=[],h=[];switch(JI(i,r)){case 0:return 0;case 1:{if(t>=xR)return e[0]=(i[0].x+i[r].x)/2,1;if(KI(i,r))return e[0]=qI(i,r),1;break}}QA(i,r,.5,n,o),s=qA(n,r,l,t+1),a=qA(o,r,h,t+1);for(let d=0;d<s;d++)e[d]=l[d];for(let d=0;d<a;d++)e[d+s]=h[d];return s+a}function JI(i,r){let e=0,t,n;t=n=Math.sign(i[0].y);for(let o=1;o<=r;o++)t=Math.sign(i[o].y),t!=n&&e++,n=t;return e}function KI(i,r){let e,t,n,o,s,a,l,h,d,u,p,g,m,E,y,x;a=i[0].y-i[r].y,l=i[r].x-i[0].x,h=i[0].x*i[r].y-i[r].x*i[0].y;let f,b;f=b=0;for(let A=1;A<r;A++){let T=a*i[A].x+l*i[A].y+h;T>f?f=T:T<b&&(b=T)}return p=0,g=1,m=0,E=a,y=l,x=h-f,d=p*y-E*g,u=1/d,t=(g*x-y*m)*u,E=a,y=l,x=h-b,d=p*y-E*g,u=1/d,n=(g*x-y*m)*u,o=Math.min(t,n),s=Math.max(t,n),e=s-o,e<WI?1:0}function qI(i,r){let e=1,t=0,n=i[r].x-i[0].x,o=i[r].y-i[0].y,s=i[0].x-0,a=i[0].y-0,l=n*t-o*e,h=1/l,d=(n*a-o*s)*h;return 0+e*d}function QA(i,r,e,t,n){let o=[[]];for(let s=0;s<=r;s++)o[0][s]=i[s];for(let s=1;s<=r;s++)for(let a=0;a<=r-s;a++)o[s]||(o[s]=[]),o[s][a]||(o[s][a]={}),o[s][a].x=(1-e)*o[s-1][a].x+e*o[s-1][a+1].x,o[s][a].y=(1-e)*o[s-1][a].y+e*o[s-1][a+1].y;if(t!=null)for(let s=0;s<=r;s++)t[s]=o[s][0];if(n!=null)for(let s=0;s<=r;s++)n[s]=o[r-s][s];return o[r][0]}function QI(i,r){let e=[];i--;for(let t=0;t<=i;t++)e.push(eM(t/i,r));return e}function eM(i,r){let e={x:0,y:0};if(i===0)return r[0];let t=r.length-1;if(i===1)return r[t];let n=r,o=1-i;if(t===0)return r[0];if(t===1)return{x:o*n[0].x+i*n[1].x,y:o*n[0].y+i*n[1].y};if(4>t){let s=o*o,a=i*i,l=0,h,d,u;return t===2?(n=[n[0],n[1],n[2],e],h=s,d=2*(o*i),u=a):t===3&&(h=s*o,d=3*(s*i),u=3*(o*a),l=i*a),{x:h*n[0].x+d*n[1].x+u*n[2].x+l*n[3].x,y:h*n[0].y+d*n[1].y+u*n[2].y+l*n[3].y}}else return e}function nS(i){let r=0;if(!tS(i)){let t=QI(16,i);for(let n=0;n<15;n++){let o=t[n],s=t[n+1];r+=eS(o,s)}}return r}var bR=new Map;function tM(i){let r=bR.get(i);if(!r){r=[];let e=()=>l=>Math.pow(l,i),t=()=>l=>Math.pow(1-l,i),n=l=>h=>l,o=()=>l=>l,s=()=>l=>1-l,a=l=>h=>{let d=1;for(let u=0;u<l.length;u++)d=d*l[u](h);return d};r.push(e());for(let l=1;l<i;l++){let h=[n(i)];for(let d=0;d<i-l;d++)h.push(o());for(let d=0;d<l;d++)h.push(s());r.push(a(h))}r.push(t()),bR.set(i,r)}return r}function Qs(i,r){let e=tM(i.length-1),t=0,n=0;for(let o=0;o<i.length;o++)t=t+i[o].x*e[o](1-r),n=n+i[o].y*e[o](1-r);return{x:t,y:n}}function eS(i,r){return Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2))}function tS(i){return i[0].x===i[1].x&&i[0].y===i[1].y}function Jd(i,r,e){if(tS(i))return{point:i[0],location:r};let t=Qs(i,r),n=0,o=r,s=e>0?1:-1,a=null;for(;n<Math.abs(e);)o+=.005*s,a=Qs(i,o),n+=eS(a,t),t=a;return{point:a,location:o}}function iS(i,r,e){return Jd(i,r,e).point}function oS(i,r,e){return Jd(i,r,e).location}function Kd(i,r){let e=Qs(i,r),t=Qs(i.slice(0,i.length-1),r),n=t.y-e.y,o=t.x-e.x;return n===0?1/0:Math.atan(n/o)}function rM(i,r,e){let t=Jd(i,r,e);return t.location>1&&(t.location=1),t.location<0&&(t.location=0),Kd(i,t.location)}function nM(i,r,e,t){t=t==null?0:t;let n=Jd(i,r,t),o=Kd(i,n.location),s=Math.atan(-1/o),a=e/2*Math.sin(s),l=e/2*Math.cos(s);return[{x:n.point.x+l,y:n.point.y+a},{x:n.point.x-l,y:n.point.y-a}]}function Ln(i,r,e,t,n){let o=t-r,s=i-e,a=i*(r-t)+r*(e-i),l=sM(n),h=[o*l[0][0]+s*l[1][0],o*l[0][1]+s*l[1][1],o*l[0][2]+s*l[1][2],o*l[0][3]+s*l[1][3]+a],d=aM.apply(null,h),u=[];if(d!=null)for(let p=0;p<3;p++){let g=d[p],m=Math.pow(g,2),E=Math.pow(g,3),y={x:l[0][0]*E+l[0][1]*m+l[0][2]*g+l[0][3],y:l[1][0]*E+l[1][1]*m+l[1][2]*g+l[1][3]},x;e-i!==0?x=(y.x-i)/(e-i):x=(y.y-r)/(t-r),g>=0&&g<=1&&x>=0&&x<=1&&u.push(y)}return u}function iM(i,r,e,t,n){let o=[];return o.push.apply(o,Ln(i,r,i+e,r,n)),o.push.apply(o,Ln(i+e,r,i+e,r+t,n)),o.push.apply(o,Ln(i+e,r+t,i,r+t,n)),o.push.apply(o,Ln(i,r+t,i,r,n)),o}function oM(i,r){let e=[];return e.push.apply(e,Ln(i.x,i.y,i.x+i.width,i.y,r)),e.push.apply(e,Ln(i.x+i.width,i.y,i.x+i.width,i.y+i.height,r)),e.push.apply(e,Ln(i.x+i.width,i.y+i.height,i.x,i.y+i.height,r)),e.push.apply(e,Ln(i.x,i.y+i.height,i.x,i.y,r)),e}function AR(i,r){return[-i[0][r]+3*i[1][r]+-3*i[2][r]+i[3][r],3*i[0][r]-6*i[1][r]+3*i[2][r],-3*i[0][r]+3*i[1][r],i[0][r]]}function sM(i){return[AR(i,"x"),AR(i,"y")]}function aM(i,r,e,t){let n=r/i,o=e/i,s=t/i,a=(3*o-Math.pow(n,2))/9,l=(9*n*o-27*s-2*Math.pow(n,3))/54,h=Math.pow(a,3)+Math.pow(l,2),d,u,p=[0,0,0];if(h>=0)d=Math.sign(l+Math.sqrt(h))*Math.pow(Math.abs(l+Math.sqrt(h)),1/3),u=Math.sign(l-Math.sqrt(h))*Math.pow(Math.abs(l-Math.sqrt(h)),1/3),p[0]=-n/3+(d+u),p[1]=-n/3-(d+u)/2,p[2]=-n/3-(d+u)/2,Math.abs(Math.sqrt(3)*(d-u)/2)!==0&&(p[1]=-1,p[2]=-1);else{let g=Math.acos(l/Math.sqrt(-Math.pow(a,3)));p[0]=2*Math.sqrt(-a)*Math.cos(g/3)-n/3,p[1]=2*Math.sqrt(-a)*Math.cos((g+2*Math.PI)/3)-n/3,p[2]=2*Math.sqrt(-a)*Math.cos((g+4*Math.PI)/3)-n/3}for(let g=0;g<3;g++)(p[g]<0||p[g]>1)&&(p[g]=-1);return p}var No="Bezier";function sS(i,r,e){return e&&(r=oS(i,r>0?0:1,r)),r}var TR={create(i){let r=Ks(i),e=i.cp1,t=i.cp2,n=[{x:r.x1,y:r.y1},{x:e.x,y:e.y},{x:t.x,y:t.y},{x:r.x2,y:r.y2}],o={xmin:Math.min(r.x1,r.x2,e.x,t.x),ymin:Math.min(r.y1,r.y2,e.y,t.y),xmax:Math.max(r.x1,r.x2,e.x,t.x),ymax:Math.max(r.y1,r.y2,e.y,t.y)};return Object.assign(r,{cp1:e,cp2:t,curve:n,extents:o,length:0,type:No})},boundingBoxIntersection(i,r){return JA(i,r)},boxIntersection(i,r,e,t,n){return Il(i,r,e,t,n)},findClosestPointOnPath(i,r,e){let t=rS({x:r,y:e},i.curve);return{d:Math.sqrt(Math.pow(t.point.x-r,2)+Math.pow(t.point.y-e,2)),x:t.point.x,y:t.point.y,l:1-t.location,s:i,x1:null,y1:null,x2:null,y2:null}},getLength(i){return(i.length==null||i.length===0)&&(i.length=nS(i.curve)),i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"C "+i.cp1.x+" "+i.cp1.y+" "+i.cp2.x+" "+i.cp2.y+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return r=sS(i.curve,r,e),Kd(i.curve,r)},lineIntersection(i,r,e,t,n){return Ln(r,e,t,n,i.curve)},pointAlongPathFrom(i,r,e,t){return r=sS(i.curve,r,t),iS(i.curve,r,e)},pointOnPath(i,r,e){return r=sS(i.curve,r,e),Qs(i.curve,r)}};Js(No,TR);var qd={};function lM(i){return i.x1!=null&&!isNaN(i.x1)&&i.y1!=null&&!isNaN(i.y1)&&i.x2!=null&&!isNaN(i.x2)&&i.y2!=null&&!isNaN(i.y2)}function vR(i){return i.curX!=null&&!isNaN(i.curX)&&i.curY!=null&&!isNaN(i.curY)&&i.x!=null&&!isNaN(i.x)&&i.y!=null&&!isNaN(i.y)&&i.ox!=null&&!isNaN(i.ox)&&i.oy!=null&&!isNaN(i.oy)}function hM(i){return!i.source||!i.target||!vR(i.source)||!vR(i.target)||i.segments==null||i.segments.length===0?!1:i.segments.find(r=>!lM(r))==null}var ln=i=>lt(i.geometry),ze={get:(i,r,e)=>{let t=qd[r];if(t)return t.create(i,e);throw"VisuallyJs: unknown connector type '"+r+"'"},register:(i,r)=>{qd[i]=r},compute:(i,r,e)=>{let t=qd[i.connector.type];if(t)return t.compute(i,r,e);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},update:(i,r,e,t,n)=>{let o=qd[i.connector.type];if(o)return o.update(i,r,e,t,n);throw"VisuallyJs: unknown connector type '"+i.connector.type+"'"},importGeometry(i,r){if(hM(r)){let e=i.connector;e.geometry=lt(r),e.edited=!0,ze.$_setAnchorsFromGeometry(i,r)}else U("VisuallyJS WARN: edge geometry invalid")},$_setAnchorsFromGeometry(i,r){yE(r.source,i,0),yE(r.target,i,1)},transformGeometry(i,r,e,t){let n=qd[i.type];if(n)return n.transformGeometry(r,e,t);throw"VisuallyJs: unknown connector type '"+i.type+"'"},setGeometry(i,r,e){if(r!=null){let t=i.connector;t.geometry=lt(r),e||(t.edited=!0,i.edge.geometry=ln(t))}}};function cM(i){return i.geometry}function dM(i,r){return i.geometry=r,!0}function PR(i,r){let e=r.extents;i.bounds.xmin=Math.min(i.bounds.xmin,e.xmin),i.bounds.xmax=Math.max(i.bounds.xmax,e.xmax),i.bounds.ymin=Math.min(i.bounds.ymin,e.ymin),i.bounds.ymax=Math.max(i.bounds.ymax,e.ymax)}function bE(i){i.totalLength=0,i.internalSegments.length=0,i.segmentProportions.length=0,i.segmentProportionalLengths.length=0}function Io(i){return Math.round(i*2)/2}function jr(i,r,e){if(e.x1=Io(e.x1),e.y1=Io(e.y1),e.x2=Io(e.x2),e.y2=Io(e.y2),e.x1===e.x2&&e.y1===e.y2)return;let t=kA(r,e);i.internalSegments.push(t),i.totalLength+=fE(t),PR(i,t)}function xE(i,r,e){let t,n,o;if(e&&(r=r>0?r/i.totalLength:(i.totalLength+r)/i.totalLength),r===1)t=i.internalSegments.length-1,o=1;else if(r===0)o=0,t=0;else if(r>=.5){for(t=0,o=0,n=i.segmentProportions.length-1;n>-1;n--)if(i.segmentProportions[n][1]>=r&&i.segmentProportions[n][0]<=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}}else for(t=i.segmentProportions.length-1,o=1,n=0;n<i.segmentProportions.length;n++)if(i.segmentProportions[n][1]>=r){t=n,o=(r-i.segmentProportions[n][0])/i.segmentProportionalLengths[n];break}return{segment:i.internalSegments[t],proportion:o,index:t}}function pr(i,r,e){let t=xE(i,r,e);return t.segment&&ur.pointOnPath(t.segment,t.proportion,!1)||{x:0,y:0}}function uM(i,r,e){let t=xE(i,r,e);return t.segment&&ur.gradientAtPoint(t.segment,t.proportion,!1)||0}function $e(i,r,e,t){let n=xE(i,r,t);return n.segment&&ur.pointAlongPathFrom(n.segment,n.proportion,e,!1)||{x:0,y:0}}function AE(i){let r=0;for(let e=0;e<i.internalSegments.length;e++){let t=fE(i.internalSegments[e]);i.segmentProportionalLengths[e]=t/i.totalLength,i.segmentProportions[e]=[r,r+=t/i.totalLength]}}function CR(i){return!((i.ox===0||i.ox==null)&&(i.oy===0||i.oy==null))}function SE(i,r){i.strokeWidth=r.strokeWidth;let e=r.sourcePos.curX,t=r.targetPos.curX,n=r.sourcePos.curY,o=r.targetPos.curY,s=t<e,a=o<n,l={x:r.sourcePos.ox,y:r.sourcePos.oy},h={x:r.targetPos.ox,y:r.targetPos.oy},d=s?t:e,u=a?o:n,p=Math.abs(t-e),g=Math.abs(o-n),m=!CR(r.sourcePos),E=!CR(r.targetPos);if(m||E){let S=p>g,O=S?e:n,v=S?t:o,_=O>v?-1:1,P=O>v?1:-1;m&&(l.x=S?_:0,l.y=S?0:_),E&&(h.x=S?P:0,h.y=S?0:P)}let y=e+i.sourceGap*l.x,x=n+i.sourceGap*l.y,f=t+i.targetGap*h.x,b=o+i.targetGap*h.y,A=l.x*h.x+l.y*h.y,T={sx:y,sy:x,tx:f,ty:b,so:l,to:h,x:d,y:u,w:p,h:g,quadrant:As({x:e,y:n},{x:t,y:o}),startStubX:y+l.x*i.sourceStub,startStubY:x+l.y*i.sourceStub,endStubX:f+h.x*i.targetStub,endStubY:b+h.y*i.targetStub,isXGreaterThanStubTimes2:Math.abs(y-f)>i.sourceStub+i.targetStub,isYGreaterThanStubTimes2:Math.abs(x-b)>i.sourceStub+i.targetStub,opposite:A===-1,perpendicular:A===0,orthogonal:A===1,sourceAxis:l.x===0?fe:ee,stubs:[i.sourceStub,i.targetStub]};return T.anchorOrientation=T.opposite?"opposite":T.orthogonal?"orthogonal":"perpendicular",T}function pM(i,r){let e=i.connector;e.paintInfo=SE(e,r),bE(e),ze.compute(i,e.paintInfo,r),e.x=e.paintInfo.x,e.y=e.paintInfo.y,e.width=e.paintInfo.w,e.height=e.paintInfo.h,e.quadrant=e.paintInfo.quadrant,AE(e)}function Yi(i){i.connector.geometry=null,i.connector.edited=!1,[i.anchors.source,i.anchors.target].forEach(r=>{r.locations.length>0&&(delete r.fixedLocation,r.isFixed=!1)})}function aS(i){i.bounds=Pi()}function lS(i,r,e){let t={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null};for(let n=0;n<i.internalSegments.length;n++){let o=ur.findClosestPointOnPath(i.internalSegments[n],r,e);o.d<t.d&&(t.d=o.d,t.l=o.l,t.x=o.x,t.y=o.y,t.s=i.internalSegments[n],t.x1=o.x1,t.x2=o.x2,t.y1=o.y1,t.y2=o.y2,t.index=n,t.connectorLocation=i.segmentProportions[n][0]+o.l*(i.segmentProportions[n][1]-i.segmentProportions[n][0]))}return t}function gM(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,ur.lineIntersection(i.internalSegments[s],r,e,t,n));return o}function mM(i,r,e,t,n){let o=[];for(let s=0;s<i.internalSegments.length;s++)o.push.apply(o,ur.boxIntersection(i.internalSegments[s],r,e,t,n));return o}function hS(i,r){let e=[];for(let t=0;t<i.internalSegments.length;t++)e.push.apply(e,ur.boundingBoxIntersection(i.internalSegments[t],r));return e}function EM(i){return i.typeDescriptor==="connector"}function cS(i){let r="";for(let e=0;e<i.internalSegments.length;e++)r+=ur.getPath(i.internalSegments[e],e===0),r+=" ";return r}function fM(i,r,e,t,n,o,s){let a=t,l=n,h=r.sx,d=r.sy,u=r.tx,p=r.ty,g,m;if(r.perpendicular){let E=h+a.ox*i.loopbackDistance,y=d+a.oy*i.loopbackDistance,x=u+l.ox*i.loopbackDistance,f=p+l.oy*i.loopbackDistance;g={x:E,y},m={x,y:f}}else{let E=Math.sign(r.tx-r.sx),y=Math.sign(r.ty-r.sy),x=a.ox===0?.25*i.loopbackDistance*-E:a.ox*i.loopbackDistance,f=a.oy===0?.25*i.loopbackDistance*-y:a.oy*i.loopbackDistance,b=l.ox===0?.25*i.loopbackDistance*E:l.ox*i.loopbackDistance,A=l.oy===0?.25*i.loopbackDistance*y:l.oy*i.loopbackDistance;g={x:r.sx+x,y:r.sy+f},m={x:r.tx+b,y:r.ty+A}}return[g,m]}function yM(i,r,e,t,n,o,s){let a=t,l=n,h,d,[u,p]=[i.scale*r.w,i.scale*r.h];return e.sourceInfo.id===e.targetInfo.id?[h,d]=fM(i,r,e,t,n,o,s):(h={x:r.sx+a.ox*u,y:r.sy+a.oy*p},d={x:r.tx+l.ox*u,y:r.ty+l.oy*p}),[h,d]}function _R(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp1]}function xM(i,r,e,t,n,o,s){let a=r.sx,l=r.sy,h=r.tx,d=r.ty,u,p=(a+h)/2,g=(l+d)/2,m=Math.sqrt(Math.pow(h-a,2)+Math.pow(d-l,2));return u=bM(p,g,r.quadrant,e.sourcePos,e.targetPos,i.curviness,i.curviness,m,i.proximityLimit),[u,u]}function bM(i,r,e,t,n,o,s,a,l){if(a<=l)return{x:i,y:r};if(e===1)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===2)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX>=1&&n.curX<=0?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s};if(e===3)return t.curY>=1&&n.curY<=0?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+-1*o,y:r+-1*s};if(e===4)return t.curY<=0&&n.curY>=1?{x:i+(t.x<.5?-1*o:o),y:r}:t.curX<=0&&n.curX>=1?{x:i,y:r+(t.y<.5?-1*s:s)}:{x:i+o,y:r+-1*s}}function OR(i){return[i.geometry.segments[0].cp1,i.geometry.segments[0].cp2]}function Qd(i,r,e,t,n){let o=i.connector,s,a;o.type===Mo?[s,a]=OR(o):[s,a]=_R(o);let l={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}],source:e.sourcePos,target:e.targetPos};return jr(o,No,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:s,cp2:a}),l}function eu(i,r,e){let t=i.connector,n=e.sourcePos,o=e.targetPos,s=Math.abs(n.curX-o.curX),a=Math.abs(n.curY-o.curY),l,h;t.type===Mo?t.edited?[l,h]=OR(t):[l,h]=yM(t,r,e,n,o,s,a):t.edited?[l,h]=_R(t):[l,h]=xM(t,r,e,n,o,s,a);let d={segments:[{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}],source:e.sourcePos,target:e.targetPos};return jr(t,No,{x1:r.sx,y1:r.sy,x2:r.tx,y2:r.ty,cp1:l,cp2:h}),d}function tu(i,r,e){return{source:qs(i.source,r,e),target:qs(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e,cp1:{x:t.cp1.x+r,y:t.cp1.y+e},cp2:{x:t.cp2.x+r,y:t.cp2.y+e}}))}}var Mo="Bezier";function RR(i,r){let e=Zd(Mo,i,r);return Object.assign(e,{scale:r.scale||KA})}ze.register(Mo,{compute:eu,update:Qd,create:RR,transformGeometry:tu});var ru="QuadraticBezier";function LR(i,r){let e=Zd(ru,i,r);return Object.assign(e,{curviness:r.curviness||10,gap:r.gap||5,proximityLimit:r.proximityLimit||80,clockwise:r.orientation&&r.orientation==="clockwise",nS:{x:0,y:0}})}ze.register(ru,{compute:eu,update:Qd,create:LR,transformGeometry:tu});var TE="perpendicular",vE="orthogonal",CE="opposite",zi="Orthogonal",dS="Smooth",uS=30;function Ml(i,r,e,t){let n=Math.max(r,e),o=Math.min(r,e);return t?o<=i&&n>=i:o<i&&n>i}function pS(i,r,e){return nu(r,"h",e,1)}function gS(i,r,e){return nu(r,"h",e,-1)}function mS(i,r,e){return nu(r,"v",e,1)}function ES(i,r,e){return nu(r,"v",e,-1)}function nu(i,r,e,t){let n=r==="h"?"v":"h",o=[],s=i,a=t===-1?-1:e.length;for(;s!==a;){let l=e[s];if(l.o===n)o.push(l),s+=t;else return{segment:l,others:o,index:s}}return null}function iu(i,r,e,t){let n=null,o;if(t!=null){if(o=i.indexOf(t),o===-1)return null;o+=r}else o=r===-1?i.length-2:1;for(let s=o;s>0&&s<i.length-1;s+=r)if(i[s].o===e){n=[i[s],s];break}return n}function ou(i,r,e,t){let n=i.indexOf(t),o=iu(i,r,e,t);return o&&o[1]==n+r?o:null}function Vo(i){return{[ne]:Math.sign(i.x2-i.x1),[pe]:Math.sign(i.y2-i.y1)}}function PE(i,r){return i.curX===r.curX&&i.curY===r.curY}function Vl(i,r,e,t,n,o){if(i.lastx===r&&i.lasty===e)return;let s=i.lastx==null?t.sx:i.lastx,a=i.lasty==null?t.sy:i.lasty,l=s===r?pe:ne;i.lastx=r,i.lasty=e;let h={x1:s,y1:a,x2:r,y2:e,o:l};i.orthogonalSegments.push(h)}function fS(i,r,e){let t=i[1],n=!1,o=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];if(t.o===ne){if(Ml(t.x2,i[0].x1,i[0].x2)||ar(o,r).length>0){let a=mS(t,1,i);if(a!=null){let l=(a.segment.y1+a.segment.y2)/2;if(n=!0,l<t.y1){let h=Math.round((r.y-e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}else{let h=Math.round((r.y2+e)*100)/100,d=t.y1;a.others.forEach(u=>{u.y1=h,u.y2=h}),i.splice(1,0,{x1:t.x1,x2:t.x1,y1:d,y2:h,o:pe}),a.segment.y1=h}}}}else if(t.o===pe&&(Ml(t.y2,i[0].y1,i[0].y2)||ar(o,r).length>0)){let a=pS(t,1,i);if(a!=null){let l=(a.segment.x1+a.segment.x2)/2;if(n=!0,l<t.x1){let h=Math.round((r.x-e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}else{let h=Math.round((r.x2+e)*100)/100,d=t.x1;a.others.forEach(u=>{u.x1=h,u.x2=h}),i.splice(1,0,{y1:t.y1,y2:t.y1,x1:d,x2:h,o:ne}),a.segment.x1=h}}}return n}function yS(i,r,e){let t=i.length-2,n=i[t],o=!1,s=[{x:n.x1,y:n.y1},{x:n.x2,y:n.y2}],a=i[i.length-1];if(n.o===ne){if(Ml(n.x1,a.x1,a.x2)||ar(s,r).length>0){let h=ES(n,t,i);if(h!=null){let d=(h.segment.y1+h.segment.y2)/2;if(o=!0,d<n.y1){let u=Math.round((r.y-e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}else{let u=Math.round((r.y2+e)*100)/100,p=n.y1;h.others.forEach(g=>{g.y1=u,g.y2=u}),i.splice(t+1,0,{x1:n.x2,x2:n.x2,y1:u,y2:p,o:pe}),h.segment.y2=u}}}}else if(n.o===pe&&(Ml(n.y1,a.y1,a.y2)||ar(s,r).length>0)){let h=gS(n,t,i);if(h!=null){let d=(h.segment.x1+h.segment.x2)/2;if(o=!0,d<n.x1){let u=Math.round((r.x-e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}else{let u=Math.round((r.x2+e)*100)/100,p=n.x1;h.others.forEach(g=>{g.x1=u,g.x2=u}),i.splice(t+1,0,{y1:n.y2,y2:n.y2,x1:u,x2:p,o:ne}),h.segment.x2=u}}}return o}function xS(i,r,e,t,n){if(i.vertexAvoidance===!1)return{segments:r,sourceAdjusted:!1,targetAdjusted:!1};{let o,s;return n?(o=yS(r,t,i.targetStub),s=fS(r,e,i.sourceStub)):(s=fS(r,e,i.sourceStub),o=yS(r,t,i.targetStub)),{segments:r,sourceAdjusted:s,targetAdjusted:o}}}var wn="Straight";function ai(i,r,e){return e>r?r<=i&&i<=e:r>=i&&i>=e}function _E(i,r,e){return e>=Math.min(i,r)&&e<=Math.max(i,r)}function OE(i,r,e){return Math.abs(e-i)<Math.abs(e-r)?i:r}var Go={create(i){let r=Ks(i),e=Math.sqrt(Math.pow(r.x2-r.x1,2)+Math.pow(r.y2-r.y1,2)),t=Nr({x:r.x1,y:r.y1},{x:r.x2,y:r.y2}),n=-1/t,o={xmin:Math.min(r.x1,r.x2),ymin:Math.min(r.y1,r.y2),xmax:Math.max(r.x1,r.x2),ymax:Math.max(r.y1,r.y2)};return Object.assign(r,{length:e,m:t,m2:n,extents:o,type:wn})},boundingBoxIntersection(i,r){return Go.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){let o=[];return o.push.apply(o,Go.lineIntersection(i,r,e,r+t,e)),o.push.apply(o,Go.lineIntersection(i,r+t,e,r+t,e+n)),o.push.apply(o,Go.lineIntersection(i,r+t,e+n,r,e+n)),o.push.apply(o,Go.lineIntersection(i,r,e+n,r,e)),o},findClosestPointOnPath(i,r,e){let t={d:1/0,x:null,y:null,l:null,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2};if(i.m===0)t.y=i.y1,t.x=_E(i.x1,i.x2,r)?r:OE(i.x1,i.x2,r);else if(i.m===1/0||i.m===-1/0)t.x=i.x1,t.y=_E(i.y1,i.y2,e)?e:OE(i.y1,i.y2,e);else{let o=i.y1-i.m*i.x1,s=e-i.m2*r,a=(s-o)/(i.m-i.m2),l=i.m*a+o;t.x=_E(i.x1,i.x2,a)?a:OE(i.x1,i.x2,a),t.y=_E(i.y1,i.y2,l)?l:OE(i.y1,i.y2,l)}let n=Pe({x:t.x,y:t.y},{x:i.x1,y:i.y1});return t.d=Pe({x:r,y:e},t),t.l=n/i.length,t},getLength(i){return i.length},getPath(i,r){return(r?"M "+i.x1+" "+i.y1+" ":"")+"L "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){return i.m},lineIntersection(i,r,e,t,n){let o=Math.abs(Nr({x:r,y:e},{x:t,y:n})),s=Math.abs(i.m),a=s===1/0?i.x1:i.y1-s*i.x1,l=[],h=o===1/0?r:e-o*r;if(o!==s)if(o===1/0&&s===0)ai(r,i.x1,i.x2)&&ai(i.y1,e,n)&&l.push({x:r,y:i.y1});else if(o===0&&s===1/0)ai(e,i.y1,i.y2)&&ai(i.x1,r,t)&&l.push({x:i.x1,y:e});else{let d,u;o===1/0?(d=r,ai(d,i.x1,i.x2)&&(u=s*r+a,ai(u,e,n)&&l.push({x:d,y:u}))):o===0?(u=e,ai(u,i.y1,i.y2)&&(d=(e-a)/s,ai(d,r,t)&&l.push({x:d,y:u}))):(d=(h-a)/(s-o),u=s*d+a,ai(d,i.x1,i.x2)&&ai(u,i.y1,i.y2)&&l.push({x:d,y:u}))}return l},pointAlongPathFrom(i,r,e,t){let n=Go.pointOnPath(i,r,t),o=e<=0?{x:i.x1,y:i.y1}:{x:i.x2,y:i.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),jt(n,o,e)},pointOnPath(i,r,e){if(r===0&&!e)return{x:i.x1,y:i.y1};if(r===1&&!e)return{x:i.x2,y:i.y2};{let t=e?r>0?r:i.length+r:r*i.length;return jt({x:i.x1,y:i.y1},{x:i.x2,y:i.y2},t)}}};Js(wn,Go);var wR=1e-10;function DR(i){let r=Math.floor(i),e=Math.ceil(i);return i-r<wR?r:e-i<wR?e:i}var Gl="Arc";function NR(i,r,e,t){return il({x:i,y:r},{x:e,y:t})}function AM(i,r){if(i.anticlockwise){let e=i.startAngle<i.endAngle?i.startAngle+vi:i.startAngle,t=Math.abs(e-i.endAngle);return e-t*r}else{let e=i.endAngle<i.startAngle?i.endAngle+vi:i.endAngle,t=Math.abs(e-i.startAngle);return i.startAngle+t*r}}var su={create(i){let r=Ks(i),e=i.cx,t=i.cy,n=i.r,o=i.ac,s,a;i.startAngle&&i.endAngle?(s=i.startAngle,a=i.endAngle,r.x1=e+n*Math.cos(s),r.y1=t+n*Math.sin(s),r.x2=e+n*Math.cos(a),r.y2=t+n*Math.sin(a)):(s=NR(e,t,r.x1,r.y1),a=NR(e,t,r.x2,r.y2)),a<0&&(a+=vi),s<0&&(s+=vi);let l=a<s?a+vi:a,h=Math.abs(l-s);o&&(h=vi-h);let d=2*Math.PI*n,u=h/vi,p=d*u,g={xmin:e-n,xmax:e+n,ymin:t-n,ymax:t+n};return Object.assign(r,{extents:g,length:p,frac:u,circumference:d,sweep:h,startAngle:s,endAngle:a,anticlockwise:o,cx:e,cy:t,radius:n,type:Gl})},boundingBoxIntersection(i,r){return su.boxIntersection(i,r.x,r.y,r.width,r.height)},boxIntersection(i,r,e,t,n){return Il(i,r,e,t,n)},findClosestPointOnPath(i,r,e){return WA(i,r,e)},getLength(i){return i.length},getPath(i,r){let e=i.sweep>Math.PI?1:0,t=i.anticlockwise?0:1;return(r?"M"+i.x1+" "+i.y1+" ":"")+"A "+i.radius+" "+i.radius+" 0 "+e+","+t+" "+i.x2+" "+i.y2},gradientAtPoint(i,r,e){let t=su.pointOnPath(i,r,e),n=_x({x:i.cx,y:i.cy},t);return!i.anticlockwise&&(n===1/0||n===-1/0)&&(n*=-1),n},lineIntersection(i,r,e,t,n){return ZA(i,r,e,t,n)},pointAlongPathFrom(i,r,e,t){let n=su.pointOnPath(i,r,t),o=e/i.circumference*2*Math.PI,s=i.anticlockwise?-1:1,a=n.theta+s*o,l=i.cx+i.radius*Math.cos(a),h=i.cy+i.radius*Math.sin(a);return{x:l,y:h}},pointOnPath(i,r,e){if(r===0)return{x:i.x1,y:i.y1,theta:i.startAngle};if(r===1)return{x:i.x2,y:i.y2,theta:i.endAngle};e&&(r=r/length);let t=AM(i,r),n=i.cx+i.radius*Math.cos(t),o=i.cy+i.radius*Math.sin(t);return{x:DR(n),y:DR(o),theta:t}}};Js(Gl,su);var IR={x:[ee,fe],y:[fe,ee]};function MR(i,r){return[i.startStubX,i.startStubY,i.endStubX,i.endStubY]}var $l=new Map;$l.set(TE,MR),$l.set(vE,MR),$l.set(CE,(i,r)=>{let e=i,t=e.sourceAxis,n={[ee]:function(){return e.so[t]===1&&(e.startStubX>e.endStubX&&e.tx>e.startStubX||e.sx>e.endStubX&&e.tx>e.sx)||e.so[t]===-1&&(e.startStubX<e.endStubX&&e.tx<e.startStubX||e.sx<e.endStubX&&e.tx<e.sx)},[fe]:function(){return e.so[t]===1&&(e.startStubY>e.endStubY&&e.ty>e.startStubY||e.sy>e.endStubY&&e.ty>e.sy)||e.so[t]===-1&&(e.startStubY<e.endStubY&&e.ty<e.startStubY||e.sy<e.endStubY&&e.ty<e.sy)}};return!r&&n[e.sourceAxis]()?{[ee]:[(i.sx+i.tx)/2,i.startStubY,(i.sx+i.tx)/2,i.endStubY],[fe]:[i.startStubX,(i.sy+i.ty)/2,i.endStubX,(i.sy+i.ty)/2]}[e.sourceAxis]:[i.startStubX,i.startStubY,i.endStubX,i.endStubY]});var Bl=new Map;Bl.set(TE,(i,r,e,t,n,o,s,a,l,h)=>{let d={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]},u={x:[[i.startStubX,i.endStubX],null,[i.endStubX,i.startStubX]],y:[[i.startStubY,i.endStubY],null,[i.endStubY,i.startStubY]]},p={x:[{x:a,y:i.startStubY},{x:a,y:i.endStubY}],y:[{x:i.startStubX,y:l},{x:i.endStubX,y:l}]},g={x:[{x:i.endStubX,y:i.startStubY}],y:[{x:i.startStubX,y:i.endStubY}]},m={x:[{x:i.startStubX,y:i.endStubY},{x:i.endStubX,y:i.endStubY}],y:[{x:i.endStubX,y:i.startStubY},{x:i.endStubX,y:i.endStubY}]},E={x:[{x:i.startStubX,y:l},{x:i.endStubX,y:l},{x:i.endStubX,y:i.endStubY}],y:[{x:a,y:i.startStubY},{x:a,y:i.endStubY},{x:i.endStubX,y:i.endStubY}]},y={x:[i.startStubY,i.endStubY],y:[i.startStubX,i.endStubX]},x=IR[e][0],f=IR[e][1],b=i.so[x]+1,A=i.to[f]+1,T=i.to[f]===-1&&y[e][1]<y[e][0]||i.to[f]===1&&y[e][1]>y[e][0],S=u[e][b][0],O=u[e][b][1],v=d[e][b][A];if(i.quadrant===v[3]||i.quadrant===v[2]&&T)return p[e];if(i.quadrant===v[2]&&O<S)return g[e];if(i.quadrant===v[2]&&O>=S||i.quadrant===v[1]&&!T)return E[e];if(i.quadrant===v[0]||i.quadrant===v[1]&&T)return m[e]}),Bl.set(vE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[ee]:i.so.x===-1?Math.min(t,o):Math.max(t,o),[fe]:i.so.y===-1?Math.min(t,o):Math.max(t,o)}[e];return{[ee]:[{x:d,y:n},{x:d,y:s},{x:o,y:s}],[fe]:[{x:n,y:d},{x:s,y:d},{x:s,y:o}]}[e]}),Bl.set(CE,(i,r,e,t,n,o,s,a,l,h)=>{let d={[ee]:fe,[fe]:ee}[e],u=e===ee?i.isXGreaterThanStubTimes2:i.isYGreaterThanStubTimes2;if(r.sourceInfo.id===r.targetInfo.id){let p={[ee]:Ve,[fe]:_e}[e],g=n+(1-r.sourcePos[d])*r.sourceInfo[p]+h;return{[ee]:[{x:t,y:g},{x:o,y:g}],[fe]:[{x:g,y:t},{x:g,y:o}]}[e]}else{if(!u||i.so[e]===1&&t>o||i.so[e]===-1&&t<o)return{[ee]:[{x:t,y:l},{x:o,y:l}],[fe]:[{x:a,y:t},{x:a,y:o}]}[e];if(i.so[e]===1&&t<o||i.so[e]===-1&&t>o)return{[ee]:i.sy===i.ty?[{y:i.ty,x:o}]:[{x:a,y:i.sy},{x:a,y:i.ty}],[fe]:i.sx===i.tx?[{x:i.tx,y:o}]:[{x:i.sx,y:l},{x:i.tx,y:l}]}[e]}});function bS(i,r,e){let t={lastx:null,lasty:null,orthogonalSegments:[]},n=e.targetPos.curX>=e.sourcePos.curX?e.sourcePos.curX:e.targetPos.curX,o=e.targetPos.curY>=e.sourcePos.curY?e.sourcePos.curY:e.targetPos.curY,s=$l.get(r.anchorOrientation)(r,i.alwaysRespectStubs),a=r.sourceAxis===ee?0:1,l=r.sourceAxis===ee?1:0,h=s[a],d=s[l],u=s[a+2],p=s[l+2];Vl(t,s[0],s[1],r,n,o);let g=r.startStubX+(r.endStubX-r.startStubX)*i.midpoint,m=r.startStubY+(r.endStubY-r.startStubY)*i.midpoint,y=Bl.get(r.anchorOrientation)(r,e,r.sourceAxis,h,d,u,p,g,m,Math.max(i.sourceStub,i.targetStub));if(y)for(let x=0;x<y.length;x++)Vl(t,y[x].x,y[x].y,r,n,o);return Vl(t,s[2],s[3],r,n,o),Vl(t,r.tx,r.ty,r,n,o),t.orthogonalSegments}function au(i,r){let e=r;return i.smooth===!0&&e.length>=2?vM(i,e).map(n=>jr(i,n.type,n.segment)):i.cornerRadius!=null&&e.length>1?SM(i,e):e.map(t=>jr(i,wn,t)),i.$pathSegments=e,e}function AS(i){return Math.atan2(i.y1-i.y2,i.x1-i.x2)}function SS(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}function SM(i,r){let e=null,t,n,o;for(let s=0;s<r.length-1;s++){if(e=e||Object.assign({},r[s]),t=Object.assign({},r[s+1]),n=AS(e),o=AS(t),i.cornerRadius>0&&n!==o){let a=Math.min(SS(e),SS(t)),l=Math.min(i.cornerRadius,.99*a/2),h={x:e.x2+l*Math.cos(n),y:e.y2+l*Math.sin(n)},d={x:t.x1-l*Math.cos(o),y:t.y1-l*Math.sin(o)},u=Math.atan((n-o)/(1+n*o)),p=Dt({x:e.x1,y:e.y1},h,1e4),g=Dt({x:t.x1,y:t.y1},d,1e4),m=ol(p,g),E=m!=null?Pe(m,h):0;E>0?(e.x2=h.x,e.y2=h.y,t.x1=d.x,t.y1=d.y,jr(i,wn,Object.assign({},e)),i.slightlyWonky?jr(i,Gl,Object.assign({r:l,cx:m.x,cy:m.y,ac:u>0},e)):jr(i,Gl,{r:E,x1:h.x,y1:h.y,x2:d.x,y2:d.y,cx:m.x,cy:m.y,ac:u>0})):jr(i,wn,Object.assign({},e))}else jr(i,wn,Object.assign({},e));e=t}t!=null&&jr(i,wn,Object.assign({},e))}var TM=(i,r)=>{let e=r.x-i.x,t=r.y-i.y;return{length:Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),angle:Math.atan2(t,e)}},VR=(i,r,e,t,n)=>{let a=TM(r||i,e||i),l=a.angle+(n?Math.PI:0),h=a.length*t,d=i.x+Math.cos(l)*h,u=i.y+Math.sin(l)*h;return{x:d,y:u}};function RE(i,r){let e=[];for(let t=1;t<i.length;t++){let n=VR(i[t-1],i[t-2],i[t],r),o=VR(i[t],i[t-1],i[t+1],r,!0);e.push({type:No,segment:{x1:i[t-1].x,y1:i[t-1].y,cp1:n,cp2:o,x2:i[t].x,y2:i[t].y}})}return e}function vM(i,r){let e=[{x:r[0].x1,y:r[0].y1}];for(let t=1;t<r.length;t++)e.push({x:r[t].x1,y:r[t].y1});return e.push({x:r[r.length-1].x2,y:r[r.length-1].y2}),RE(e,i.smoothing)}function GR(i,r,e){return LE([{x1:r.sx,y1:r.sy,x2:r.startStubX,y2:r.startStubY},{x1:r.startStubX,y1:r.startStubY,x2:r.endStubX,y2:r.endStubY},{x1:r.endStubX,y1:r.endStubY,x2:r.tx,y2:r.ty}])}function lu(i,r,e,t,n){let o=i.connector;o.lastx=null,o.lasty=null,o.lastOrientation=null;let s=e.sourcePos,a=e.targetPos;return o.$pathSegments=o.geometry.segments,o.constrain===on?TS(s,a,o,r,e,t,n):CM(s,a,o,r.quadrant,t,n),au(o,o.$pathSegments),{segments:o.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function hu(i,r,e){let t=i.connector;return t.lastx=null,t.lasty=null,t.lastOrientation=null,t.constrain===on?t.$pathSegments=bS(t,r,e):t.$pathSegments=GR(t,r,e),au(t,t.$pathSegments),{segments:t.$pathSegments,source:e.sourcePos,target:e.targetPos,quadrant:r.quadrant}}function CM(i,r,e,t,n,o){if(o){let s=e.geometry.segments[e.geometry.segments.length-1];s.x2=r.curX,s.y2=r.curY,e.geometry.target.curX=r.curX,e.geometry.target.curY=r.curY}else if(n){let s=e.geometry.segments[0];s.x1=i.curX,s.y1=i.curY,e.geometry.source.curX=i.curX,e.geometry.source.curY=i.curY}e.geometry.quadrant=t,e.$pathSegments=e.geometry.segments}function cu(i,r,e){return{source:qs(i.source,r,e),target:qs(i.target,r,e),segments:i.segments.map(t=>({x1:t.x1+r,y1:t.y1+e,x2:t.x2+r,y2:t.y2+e}))}}function LE(i){return i.length===0?[]:i.filter(r=>!(r.x1===r.x2&&r.y1===r.y2))}var $R=.15,Hr="Straight";function ea(i){return Math.sqrt(Math.pow(i.x2-i.x1,2)+Math.pow(i.y2-i.y1,2))}ze.register(Hr,{compute:hu,update:lu,create:vS,transformGeometry:cu});function PM(i,r){let e=Object.assign(r,{constrain:on});return vS(i,e)}ze.register(zi,{compute:hu,update:lu,create:PM,transformGeometry:cu});function _M(i,r){let e=Object.assign(r,{constrain:nn,smooth:!0});return vS(i,e)}ze.register(dS,{compute:hu,update:lu,create:_M,transformGeometry:cu});function OM(i){return i==null?null:i===Qx?on:i===eb?Gc:i}function vS(i,r){let e=OM(r.constrain);r.stub=r.stub==null?e===on?uS:null:r.stub;let t=Wd(Hr,i,r,[0,0]),n=r.midpoint==null||isNaN(r.midpoint)?.5:r.midpoint,o=r.alwaysRespectStubs!==!1,s=r.loopbackRadius||25;return Object.assign(t,{cornerRadius:r.cornerRadius!=null?r.cornerRadius:null,smooth:r.smooth===!0,smoothing:r.smoothing==null?$R:r.smoothing,geometry:{segments:[]},constrain:e==null?nn:e,$pathSegments:[],loopbackRadius:s,isLoopbackCurrently:!1,alwaysRespectStubs:o,midpoint:n,lastOrientation:null,lastx:null,lasty:null,slightlyWonky:r.slightlyWonky===!0})}function PS(i,r,e){CS(1,i,r,e),CS(0,i,r,e)}var $o="x2",Bo="x1",Fo="y1",Uo="y2";function RM(i,r,e){let t=e===i.x1?{value:i.x2,coord:$o,prev:!0}:{value:i.x1,coord:Bo,prev:!0},n=e===r.x1?{value:r.x2,coord:$o,prev:!1}:{value:r.x1,coord:Bo,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function LM(i,r,e){let t=e===i.y1?{value:i.y2,coord:Uo,prev:!0}:{value:i.y1,coord:Fo,prev:!0},n=e===r.y1?{value:r.y2,coord:Uo,prev:!1}:{value:r.y1,coord:Fo,prev:!1},o=Math.abs(e-t.value),s=Math.abs(e-n.value),a=o>s?t:n,l=o>s?n:t;return Object.assign(a,{ref:l.value})}function BR(i,r){if(r.length<5)return r;function e(d,u,p){let g=p===d.x1?d.x2:d.x1,m=p===u.x1?u.x2:u.x1;if(g>u.x1&&u.x2>g||g>u.x2&&u.x1>g)return g;if(m>d.x1&&d.x2>m||m>d.x2&&d.x1>m)return m}function t(d,u,p){let g=p===d.y1?d.y2:d.y1,m=p===u.y1?u.y2:u.y1;if(g>u.y1&&u.y2>g||g>u.y2&&u.y1>g)return g;if(m>d.y1&&d.y2>m||m>d.y2&&d.y1>m)return m}let n=r[1],o,s,a=Math.max(i.sourceStub,i.targetStub),l=[];for(let d=2;d<r.length-2;d++)if(o=r[d],s=Vo(n)[n.o],o.o!==n.o)if(ea(o)<a){let p=r[d+1];if(Vo(p)[p.o]!==s){let m=Object.assign({},o);if(o.o===pe){let E=RM(n,p,o.x1),y=e(n,p,o.x1);if(y!=null){if(m.x1=y,m.x2=y,E.prev){let x=Object.assign({},n);n.x2===o.x1?x.x2=y:x.x1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.x1===o.x1?x.x1=y:x.x2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}else if(o.o===ne){let E=LM(n,p,o.y1),y=t(n,p,o.y1);if(y!=null){if(m.y1=y,m.y2=y,E.prev){let x=Object.assign({},n);n.y2===o.y1?x.y2=y:x.y1=y,l.push({start:d-1,segments:[x,m]})}else{let x=Object.assign({},p);p.y1===o.y1?x.y1=y:x.y2=y,l.push({start:d-1,segments:[m,x]})}n=p,d+=1}else n=o}}else n=o}else n=o;else n=o;let h=r.slice();for(let d=0;d<l.length;d++)h.splice(l[d].start-d,3,...l[d].segments);return l.length>0?wE(h):h}function CS(i,r,e,t){let n=r.$pathSegments.slice();i===1&&n.reverse();let o=n[0],s=n[n.length-1],a=i===1?r.targetStub:r.sourceStub,l=i===1?t.targetPos.curX:t.sourcePos.curX,h=i===1?t.targetPos.curY:t.sourcePos.curY,d=i===1?e.to:e.so,u=i===1?$o:Bo,p=i===1?Uo:Fo,g=i===1?Bo:$o,m=i===1?Fo:Uo,E=1,y=n.length-2,x=1,f=n[1];o[g]=l+a*d.x,o[m]=h+a*d.y,o[u]=l,o[p]=h,o.o=o.x1===o.x2?"v":"h";let b=Vo(o),A=o.o,T=o.o===ne?pe:ne,S=o.o===ne?[$o,Bo]:[Uo,Fo],O=o.o===ne?[Bo,$o]:[Fo,Uo],v=o.o===ne?[Uo,Fo]:[$o,Bo],_=o.o===ne?[Fo,Uo]:[Bo,$o],P=S[i],I=O[i],C=v[i],R=_[i];if(f!=null)if(f.o===o.o){f[I]=o[P],f[C]=f[R]=o[C];let B=Vo(f)[A],N=ou(n,x,T,f);if(B!==b[A]){if(N!=null){let V=ou(n,x,A,N[0]);if(V!=null)n.splice(E,1),V[0][I]=o[P],N[0][P]=o[P],N[0][I]=o[P],N[0][R]=o[C];else{let D=(N[0][C]+N[0][R])/2;N[0][R]=D,f[C]=f[R]=D;let $={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[R]:o[C],[I]:o[P]};n.splice(E,0,$)}}}else if(f[C]=f[R]=o[C],N!=null)N[0][R]=o[C];else if(f[C]!==s[R]){let V={o:f.o==="h"?"v":"h",[P]:f[P],[I]:f[P],[C]:s[C],[R]:f[R]},D=n.length-1;n.splice(D,0,V)}}else{f[R]=o[C],f[P]=f[I]=o[P];let B=ou(n,x,A,f);if(B!=null){let N=Vo(B[0])[A];B[0][I]=o[P];let V=Vo(B[0])[A];if(N!==V&&B[1]===y){n.splice(B[1],1);let D=(f[C]+f[R])/2;f[R]=D,f[P]=f[I]=s[I];let $={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:D,[R]:D,[I]:o[P]};n.splice(E,0,$);let K={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:D,[R]:o[C],[I]:o[P]};n.splice(E,0,K)}}else{let N=(f[C]+f[R])/2;f[R]=N,f[P]=f[I]=s[I];let V={x1:0,y1:0,x2:0,y2:0,o:A,[P]:s[I],[C]:N,[R]:N,[I]:o[P]};n.splice(E,0,V);let D={x1:0,y1:0,x2:0,y2:0,o:T,[P]:o[P],[C]:N,[R]:o[C],[I]:o[P]};n.splice(E,0,D)}}let w=BR(r,n);i===1&&w.reverse(),r.$pathSegments=w}function TS(i,r,e,t,n,o,s){let a=e.geometry;if(o||s){let l=i.curX-a.source.curX,h=i.curY-a.source.curY,d=r.curX-a.target.curX,u=r.curY-a.target.curY;if(l===d&&h===u){let p=[];e.$pathSegments.forEach(g=>{let m=Object.assign({},g);m.x1+=l,m.x2+=l,m.y1+=h,m.y2+=h,p.push(m)}),e.$pathSegments=p;return}PS(e,t,n)}}function wM(i,r,e){let t=i.findIndex(n=>n.x1===r.x1&&n.y1===r.y1&&n.x2===r.x2&&n.y2===r.y2);if(t>-1){let n=i[t].o,o=i[t];return{segment:o,index:t,axis:n,prev:t>1?i[t-1]:null,next:t<i.length-2?i[t+1]:null,left:e?iu(i,-1,n,o):null,right:e?iu(i,1,n,o):null}}else return null}function _S(i,r,e,t,n){let o=wM(r.$pathSegments,e);if(o!=null){o.axis===pe?o.segment.x1=o.segment.x2=t.x:o.segment.y1=o.segment.y2=t.y;let s=o.axis===pe,a=o.index,l=o.index,h=a>1?r.$pathSegments[a-1]:null,d=o.segment;for(;h!=null;)h.o===d.o?s?(h.x1=d.x1,h.x2=d.x2):(h.y1=d.y1,h.y2=d.y2):(h.x2=d.x1,h.y2=d.y1),d=h,a--,h=a>1?r.$pathSegments[a-1]:null;if(d.x1!==r.$pathSegments[0].x2){let g={o:ne,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}else if(d.y1!==r.$pathSegments[0].y2){let g={o:pe,x1:r.$pathSegments[0].x2,y1:r.$pathSegments[0].y2,x2:d.x1,y2:d.y1};r.$pathSegments.splice(1,0,g),l++}d=o.segment,a=l;let u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;for(;u!=null;)u.o===d.o?s?(u.x1=d.x1,u.x2=d.x2):(u.y1=d.y1,u.y2=d.y2):(u.x1=d.x2,u.y1=d.y2),d=u,a++,u=a<r.$pathSegments.length-2?r.$pathSegments[a+1]:null;let p=r.$pathSegments[r.$pathSegments.length-1];if(d.x2!==p.x1){let g={o:ne,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}else if(d.y2!==p.y1){let g={o:pe,x1:d.x2,y1:d.y2,x2:p.x1,y2:p.y1};r.$pathSegments.splice(r.$pathSegments.length-1,0,g)}if(n!==!0){let g=i.instance.getElement(i.sourceId),m=i.instance.getElement(i.targetId);xS(r,r.$pathSegments,g,m,!1).sourceAdjusted&&(l+=1)}return r.edited=!0,{ctx:o,segments:r.$pathSegments,index:l}}else return null}function wE(i){let r=[lt(i[0])],e=lt(i[i.length-1]),t=i.slice(1,i.length-1).filter(s=>ea(s)>0).map(lt);if(t.length===0)return i;let n=null,o=null;for(let s=0;s<t.length;s++)n==null||o==null?(n=t[s],o=t[s].o):t[s].o===o?(n.y2=t[s].y2,n.x2=t[s].x2):(r.push(n),n=t[s],o=t[s].o);if(r.push(n),r.push(e),r.length===3){let s=r[1],a=s.o,l=Object.assign({},s),h=Object.assign({},s),d=Object.assign({},s);h.o=a===ne?pe:ne,h.x1=l.x1,h.y1=l.y1,h.x2=l.x1,h.y2=l.y1,d.o=a===ne?pe:ne,d.x1=l.x2,d.y1=l.y2,d.x2=l.x2,d.y2=l.y2,r=[r[0],h,l,d,r[2]]}return r}function OS(i){let r=wE(i.$pathSegments);i.$pathSegments=r,i.geometry!=null&&(i.geometry.segments=r)}var du=class extends Ft{constructor(e){super();c(this,"$context");this.$context=e||{}}getFromContext(e){return this.$context[e]}ensureContext(e,t){let n=this.$context[e];return n==null&&(n=t(),this.$context[e]=n,this.fire(Cl,{key:e,value:n})),n}updateContext(e,t){this.$context[e]=t,this.fire(Cl,{key:e,value:t})}};var Xi=(e=>(e.SVG="SVG",e.HTML="HTML",e))(Xi||{});var Dn="px",kr="50px",Pr="block",pt="none",Qe="absolute",DE="fixed",RS="static",LS="relative",DM="data-vjs-group",gt="data-vjs-managed",Fl="data-vjs-not-draggable",wS="data-vjs-no-events",DS="data-vjs-elements-draggable",NE="tabindex",te="data-vjs-vertex",hn="data-vjs-port",Ul="data-vjs-port-id",Wr="data-vjs-port-type",uu="data-vjs-edge-type",NS="data-vjs-source",Yo="data-vjs-target",IE="data-vjs-allow-loopback",ME="data-vjs-source-port-id",pu="data-vjs-target-port-id",ta="data-vjs-source-port",zo="data-vjs-target-port",ji="data-vjs-source-port-type",Hi="data-vjs-target-port-type",gu="data-vjs-magnet",et="data-vjs-edge",mu="data-vjs-overlay-id",gr="*";var ra="vjs-connector",Eu="vjs-connector-path",IS="vjs-connector-outline",MS="vjs-connector-transient",Yl="vjs-connected",VE="vjs-group-collapsed",GE="vjs-group-expanded",fu="vjs-toggle-group-collapse",na="vjs-overlay",zl="vjs-overlay-hide",VS="vjs-label-overlay",ki="vjs-node",GS="vjs-port",Xo="vjs-group",$S="vjs-dummy-vertex",Xl="vjs-selected-connection",Wi="vjs-selected-element",ia="vjs-edge-delete",yu="vjs-edge-delete-i";var $E="allowNestedGroups",jl="anchor",Hl="anchors",BS="astarVertexBorder",FS="astarVertexBuffer",NM="edgesDetachable",xu="connector",US="cssClass",YS="edgeRelocateHandleSize",IM="groupSize",zS="hoverClass",bu="hoverPaintStyle",XS="maxConnections",MM="nodeSize",jo="paintStyle",VM="reattachEdges",BE="scope",jS=[.05,3];function HS(i){return i.type!=null&&i.options!=null}function hi(i){let r=null;return X(i)?r={type:i,options:{}}:r=i,r.options.id=r.options.id||G(),r}var Au="always",Zi="hover";function FE(i,r){let e=i.location==null?.5:i.location;if(r!=null)try{let t=typeof r=="string"?parseFloat(r):r;isNaN(t)||(e=t)}catch(t){}i.location=e}var li=class{constructor(r,e){this.connection=r;c(this,"id");c(this,"cssClass");c(this,"ps");c(this,"visible",!0);c(this,"location",.5);c(this,"events");c(this,"attributes");c(this,"ignoreTypes",!1);e=e||{},this.id=e.id||G(),this.cssClass=e.cssClass||"",FE(this,e.location),this.events=e.events||{},this.attributes=e.attributes||{},this.ps=r.instance.$isTouchDevice()?Au:e.visibility||Au,this.ps===Zi&&(this.visible=!1)}},Nn=class extends li{constructor(e,t,n){super(t,n);this.component=t;c(this,"paintStyle");c(this,"$hollow");c(this,"isSimpleShape",!0);n=n||{},this.paintStyle=n.paintStyle||{strokeWidth:1},this.$hollow=n.hollow===!0}$getStyle(e){let t=this.paintStyle.stroke||e.stroke,n=this.$hollow?"none":this.paintStyle.fill||e.stroke,o=this.paintStyle.strokeWidth||e.strokeWidth;return{stroke:t,fill:n,lineWidth:o}}updateFrom(e,t){}};var FR={},at={get:(i,r,e,t)=>{let n=FR[r];if(n)return new n(i,e,t);throw{message:"VisuallyJs: unknown overlay type '"+r+"'"}},register:(i,r)=>{FR[i]=r}};var UE=class UE extends li{constructor(e,t,n){super(t,n);this.instance=e;this.connection=t;c(this,"label");c(this,"type",UE.type);c(this,"useHTMLElement");c(this,"rotatable");c(this,"font");c(this,"isSimpleShape",!1);n=n||{label:""},this.useHTMLElement=e.containerType!=="SVG"&&n.useHTMLElement===!0,this.font=n.font,this.setLabel(n.label),this.rotatable=n.rotatable}getLabel(){return rn(this.label)?this.label(this):this.label}setLabel(e){this.label=e,this.instance.updateLabel(this)}updateFrom(e,t){e.font!=null&&(this.font=e.font),e.label!=null&&this.setLabel(e.label),e.location!=null&&FE(this,e.location),YE(this,t)}};c(UE,"type","Label");var mr=UE;function Zr(i){return i.type===mr.type}at.register(mr.type,mr);function YE(i,r){if(r){let e=r.fontSize;e!=null&&(i.font=i.font||{},i.font.size=e);let t=r.fontStyle;t!=null&&(i.font=i.font||{},i.font.style=t);let n=r.fontFamily;n!=null&&(i.font=i.font||{},i.font.family=n)}}var zE="labelLocation",GM=[jl,Hl,"cssClass",xu,jo,bu],$M="parent";function Su(i,r){let e=h=>h?r[h]:null,t=(h,d)=>{if(h==null)return null;{let u=h[$M],p;if(Array.isArray(u)?p=u:p=[u],p.find(m=>d.indexOf(m)!==-1))throw new Error("circular view reference");return d.push(...p),p.map(m=>e(m)).filter(m=>m!=null)}},n=(h,d,u)=>{let p=GM.slice();d.mergeStrategy==="override"&&Array.prototype.push.apply(p,["events","overlays"]);let g=An(h,d,[],p);return o(t(h,u),g,u)},o=(h,d,u)=>{if(h==null)return d;{let p=d;for(let g=0;g<h.length;g++)p=n(h[g],p,u);return p}},s=h=>{if(h==null)return{};if(typeof h=="string")return e(h);if(h.length){let d=!1,u=0,p;for(;!d&&u<h.length;)p=s(h[u]),p?d=!0:u++;return p}},a=s(i),l=[];return a?o(t(a,l),a,l):{}}function oa(i){return(r,e,t)=>{let n=Oc(e,{x:0,y:0,width:1,height:1},i);return Object.assign(n.p,{portId:i[n.idx].portId})}}function kS(i){i.anchorPositions!=null&&(i.anchorPositionFinder=oa(i.anchorPositions))}var Tu=class{constructor(r,e,t,n){this.model=r;this.viewOptions=t;c(this,"defMap",{nodes:new Map,edges:new Map,groups:new Map,ports:new Map});c(this,"nodes");c(this,"edges");c(this,"groups");c(this,"ports");this.viewOptions=this.viewOptions||{},this.nodes=this.viewOptions.nodes||{},this.edges=this.viewOptions.edges||{},this.ports=this.viewOptions.ports||{},this.groups=this.viewOptions.groups||{};let o,s;function a(l,h){return d=>{l.call(h,{overlay:d.overlay,e:d.e,connection:d.overlay.connection,edge:d.overlay.connection.edge,model:d.overlay.connection.instance.model})}}for(let l in this.viewOptions.edges){if(o=this.getEdgeDefinition(l),o.overlays)for(s=0;s<o.overlays.length;s++){let h=o.overlays[s];if(HS(h)){let d=h.options;if(d.events!=null)for(let u in d.events){let p=d.events[u];d.events[u]=a(p,h)}}}n.$registerConnectionType(l,o)}}getEdgeDefinition(r){if(r==null)return null;if(this.defMap.edges.has(r))return this.defMap.edges.get(r);{let e=Su([r,be],this.edges);if(e.label!=null){e.overlays=e.overlays||[];let t={type:mr.type,options:{useHTMLElement:e.useHTMLLabel===!0,id:"label",label:e.label,rotatable:e.labelsRotatable}};e.labelClass&&(t.options.cssClass=e.labelClass);let n=e.labelLocationAttribute||zE;e.labelLocation?t.options.location=e.labelLocation:t.options.location=`{{${n}}}`,e.labelLocationAttribute&&(t.options.labelLocationAttribute=e.labelLocationAttribute),e.labelFont&&(t.options.font=Object.assign({},e.labelFont)),e.overlays.push(t),delete e.label}if(e.deleteButton!=null){e.overlays=e.overlays||[];let t=(e.deleteButtonClass||ia)+" "+yu,n=e.deleteButtonLocation||.1;(Array.isArray(n)?n:[n]).forEach(s=>{e.overlays.push({type:mr.type,options:{location:s,label:"\u2716",cssClass:t,visibility:e.deleteButton===Zi?Zi:Au}})})}return delete e.parent,this.defMap.edges.set(r,e),e}}getNodeDefinition(r){if(r==null)return null;if(this.defMap.nodes.has(r))return this.defMap.nodes.get(r);{let e=Su([r,be],this.nodes);return delete e.parent,kS(e),this.defMap.nodes.set(r,e),e}}getPortDefinition(r){if(r==null)return null;if(this.defMap.ports.has(r))return this.defMap.ports.get(r);{let e=Su([r,be],this.ports);return delete e.parent,kS(e),this.defMap.ports.set(r,e),e}}getGroupDefinition(r){if(r==null)return null;if(this.defMap.groups.has(r))return this.defMap.groups.get(r);{let e=Su([r,be],this.groups);return delete e.parent,kS(e),this.defMap.groups.set(r,e),e}}getTypeDefinition(r){let e=this.model.getType(r);if(J(r))return this.getNodeDefinition(e);if(Y(r))return this.getGroupDefinition(e);if(j(r))return this.getPortDefinition(e)}};function vu(){return new Set}var UR=class{constructor(){c(this,"affectedElements",new Set)}};function zR(i){return{id:i,el:null,dirty:!0,x:NaN,y:NaN,width:NaN,height:NaN,modelObject:null,r:0,c:{x:0,y:0},ro:{x:0,y:0},x2:0,y2:0,t:{id:i,c:{x:0,y:0},x:NaN,y:NaN,width:NaN,height:NaN,r:0,x2:0,y2:0,cr:0,sr:0,ro:{x:0,y:0}}}}function BM(i,r,e,t,n,o){let s=o/360*Math.PI*2,a={x:r+t/2,y:e+n/2},l=Math.cos(s),h=Math.sin(s),d=(A,T)=>Me({x:A,y:T},a,o),u=d(r,e),p=d(r+t,e),g=d(r+t,e+n),m=d(r,e+n),E=d(r+t/2,e+n/2),y=Math.min(u.x,p.x,g.x,m.x),x=Math.max(u.x,p.x,g.x,m.x),f=Math.min(u.y,p.y,g.y,m.y),b=Math.max(u.y,p.y,g.y,m.y);return{x:y,y:f,width:x-y,height:b-f,c:E,r:o,x2:x,y2:b,cr:l,sr:h,id:i,ro:{x:y,y:f}}}var XE=(i,r)=>{let e=0;return r.value>i.value?e=-1:r.value<i.value&&(e=1),e},YR=(i,r)=>XE(i,r)*-1;function jE(i,r,e,t,n){tm({id:i,value:r,otherBound:e},t,XE,n)}function Ho(i,r){let e=r.findIndex(t=>t.id===i);e>-1&&r.splice(e,1)}var Cu=class{constructor(r,e){this.instance=r;this.getRenderedElement=e;c(this,"du",null);c(this,"rtree");c(this,"edgertree");c(this,"Xe",!1);c(this,"al",!0);c(this,"P",{xmin:[],xmax:[],ymin:[],ymax:[]});c(this,"V",{});c(this,"ll",{});c(this,"je",{xmin:0,xmax:0,ymin:0,ymax:0});this.rtree=new Do(4),this.edgertree=new Do(4)}setSuspended(r){this.Xe=r,this.Xe||(this.recomputeBounds(),this.Ef())}getExtents(){return Object.assign({},this.je)}ff(r,e,t){e!=null&&(Ho(r,this.P.xmin),Ho(r,this.P.xmax),Ho(r,this.P.ymin),Ho(r,this.P.ymax),jE(r,e.t.x,e.t.x2,this.P.xmin,!1),jE(r,e.t.x2,e.t.x,this.P.xmax,!0),jE(r,e.t.y,e.t.y2,this.P.ymin,!1),jE(r,e.t.y2,e.t.y,this.P.ymax,!0),t!==!0&&this.ms())}ms(){this.je.xmin=this.P.xmin.length>0?this.P.xmin[0].value:0,this.je.xmax=this.P.xmax.length>0?this.P.xmax[0].value:0,this.je.ymin=this.P.ymin.length>0?this.P.ymin[0].value:0,this.je.ymax=this.P.ymax.length>0?this.P.ymax[0].value:0}recomputeBounds(){if(this.al){this.al=!1,this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0;for(let r in this.V){let e=this.V[r];this.P.xmin.push({id:r,value:e.t.x,otherBound:e.t.x2}),this.P.xmax.push({id:r,value:e.t.x2,otherBound:e.t.x}),this.P.ymin.push({id:r,value:e.t.y,otherBound:e.t.y2}),this.P.ymax.push({id:r,value:e.t.y2,otherBound:e.t.y})}this.P.xmin.sort(XE),this.P.ymin.sort(XE),this.P.xmax.sort(YR),this.P.ymax.sort(YR),this.ms()}}findVerticesAtPoint(r,e,t,n,o){t=t==null?0:t;let s=[];if(o=o||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(o.indexOf(l.id)===-1&&l.value-t<r&&l.otherBound+t>r){let h=this.V[l.id];if(h.y-t<e&&h.y2+t>e&&(s.push(h),n))return s}}else{let a=this.rtree.search({x:r-t,y:e-t,width:t===0?1:t*2,height:t===0?1:t*2});for(let l=0;l<a.length;l++){let h=a[l].id;if(o.indexOf(h)===-1&&(s.push(this.V[h]),n))return s}}return s}findVerticesIntersectingWithRect(r,e,t,n,o){e=e==null?0:e;let s=[];if(n=n||[],this.rtree==null)for(let a=0;a<this.P.xmin.length;a++){let l=this.P.xmin[a];if(n.indexOf(l.id)===-1&&Kg(l.value-e,l.otherBound+e,r.x,r.x+r.width,1)){let d=this.V[l.id];if(Kg(d.y-e,d.y2+e,r.y,r.y+r.height,1)&&(s.push(d),t))return s}}else{let a=o?1:0,l=this.rtree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(this.V[d]),t))return s}}return s}findConnectorBoundsIntersectingWithRect(r,e,t,n,o){let s=[],a=o?1:0,l=this.edgertree.search({x:r.x-e+a,y:r.y-e+a,width:r.width+2*e-2*a,height:r.height+2*e-2*a});for(let h=0;h<l.length;h++){let d=l[h].id;if(n.indexOf(d)===-1&&(s.push(l[h]),t))return s}return s}findVerticesEnclosedByRect(r,e,t,n,o){let s=r.x+r.width,a=r.y+r.height;return this.findVerticesIntersectingWithRect(r,e,t,n,o).filter(l=>o?r.x<l.x&&r.y<l.y&&s>l.x2&&a>l.y2:r.x<=l.x&&r.y<=l.y&&s>=l.x2&&a>=l.y2)}hasVerticesIntersectingWithRect(r,e,t,n){return this.findVerticesIntersectingWithRect(r,e,!0,t,n).length>0}hasLineOfSight(r,e,t){let n=Dx(r,e/2);return this.rtree.findIntersectionsWithLine(n[0],t).length===0&&this.rtree.findIntersectionsWithLine(n[1],t).length===0}yf(r,e,t){e.t=BM(r,e.x,e.y,e.width,e.height,e.r),this.ll[r]=e.t,this.al=!0,t!==!0&&(this.Xe||this.ff(r,e,t)),this.rtree!=null&&e.modelObject!=null&&(this.Xe||this.rtree.update(r,e.t.x,e.t.y,e.t.width,e.t.height,{id:r}))}updateElement(r,e,t,n,o,s,a,l){let h=Cs(this.V,r,()=>this.addElement(r,this.getRenderedElement(r),a,{x:e,y:t},{width:n,height:o},s));return h!=null&&(h.dirty=!1,a!=null&&(h.modelObject=a),e!=null&&(h.x=e),t!=null&&(h.y=t),n!=null&&(h.width=n),o!=null&&(h.height=o),h.c.x=h.x+h.width/2,h.c.y=h.y+h.height/2,h.x2=h.x+h.width,h.y2=h.y+h.height,s!=null&&(h.r=s||0),h.r==null||h.r===0?h.ro={x:h.x,y:h.y}:h.ro=Me({x:h.x,y:h.y},h.c,h.r),this.du==null?this.yf(r,h,l):this.du.affectedElements.add(r)),h}$updateEdge(r){this.edgertree.update(r.id,r.x,r.y,r.width,r.height)}$removeEdge(r){this.edgertree.removeById(r)}$forEachElement(r){for(let e in this.V)r(this.V[e])}$refreshEveryElement(){for(let r in this.V)this.$refreshElement(r,!0)}$refreshElement(r,e,t,n,o){let s=this.V[r];if(s!=null){let a=n||(this.instance.$_useModelForSizes&&s.modelObject.objectType!==de.objectType?{width:s.width,height:s.height}:this.instance.$getSize(s.el)),l=t&&!isNaN(t.x)&&!isNaN(t.y)?t:null;return l==null&&(l=this.instance.$getElementPositionInUIRelativeToCanvasOrigin(s,a)),this.updateElement(r,l==null?void 0:l.x,l==null?void 0:l.y,a.width,a.height,o,null,e)}else return null}xf(r,e){return this.updateElement(r,null,null,null,null,e,null,!1)}getBoundsWidth(){return this.je.xmax-this.je.xmin}getBoundsHeight(){return this.je.ymax-this.je.ymin}getX(){return this.je.xmin}getY(){return this.je.ymin}setSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}$_updatePosition(r,e,t){if(this.V[r]!=null)return this.updateElement(r,e,t,null,null,null,null,!1)}$_updateSize(r,e,t){if(this.V[r]!=null)return this.updateElement(r,null,null,e,t,null,null,!1)}reset(){this.P.xmin.length=0,this.P.xmax.length=0,this.P.ymin.length=0,this.P.ymax.length=0,this.V={},this.ll={},this.rtree.clear(),this.edgertree.clear(),this.ms()}remove(r){Ho(r,this.P.xmin),Ho(r,this.P.xmax),Ho(r,this.P.ymin),Ho(r,this.P.ymax),delete this.V[r],delete this.ll[r],this.rtree!=null&&this.rtree.removeById(r),this.ms()}$computeGroupContentExtents(r,e,t,n,o){let s=r.members.map(l=>l.id),a=t!=null?t[r.id]:null;if(a==null){let l=this.instance.viewport.getGroupElement(r.id);o=o||this.instance.$_getGroupContentAreaInfo(r.id),a={x:l.x+o.internalOffset.x,y:l.y+o.internalOffset.y}}return this.$computeExtentsForElementIds(s,e?null:a.x,e?null:a.y,t,n)}$computeExtentsForElementIds(r,e=0,t=0,n,o){let s=1/0,a=-1/0,l=1/0,h=-1/0;return n=n||{},o=o||{},r.forEach(d=>{var p,g,m,E,y,x,f,b;let u=this.getElement(d);if(u!=null){let A=((p=n[u.id])==null?void 0:p.x)||((g=u.t)==null?void 0:g.x)||u.x,T=((m=n[u.id])==null?void 0:m.y)||((E=u.t)==null?void 0:E.y)||u.y,S=((y=o[u.id])==null?void 0:y.width)||((x=u.t)==null?void 0:x.width)||u.width,O=((f=o[u.id])==null?void 0:f.height)||((b=u.t)==null?void 0:b.height)||u.height;s=Math.min(s,A-e),l=Math.min(l,T-t),a=Math.max(a,A-e+S),h=Math.max(h,T-t+O)}}),{xmin:s,xmax:a,ymin:l,ymax:h}}Ef(){this.rtree.clear();let r=Object.values(this.V).map(e=>({id:e.id,x:e.t.x,y:e.t.y,width:e.t.width,height:e.t.height,children:[]}));this.rtree.load(r)}getPosition(r){return this.V[r]}getElements(){return this.V}isEmpty(){return Object.keys(this.V).length===0}getElement(r){return this.V[r]}getElementPosition(r){return this.V[r]!=null?ft(this.V[r]):null}getElementSize(r){return this.V[r]!=null?Jn(this.V[r]):null}getElementBounds(r){return this.V[r]!=null?Object.assign(ft(this.V[r]),Jn(this.V[r])):null}getGroupElement(r){return this.getElement(r)}getNodeElement(r){return this.getElement(r)}addElement(r,e,t,n,o,s){let a=zR(r);a.el=e;let l=Object.assign(a,{connections:[],modelObject:t,visible:!0});if(this.V[r]=l,Y(t)){let g=a;g.collapsed=!1,g.enabled=!0,g.contentArea=this.instance.$getGroupContentAreaElement(e),g.contentAreaOffset=this.instance.$getElementPositionInUIRelativeToParent(g.contentArea)}let h=n==null?{x:0,y:0}:n,d=o==null?{width:0,height:0}:o,u=s==null?0:s,p=this.updateElement(r,h.x,h.y,d.width,d.height,u,t,!0);return p.el=e,l}getTopLevelExtents(){let r=this.instance.model.graph.getTopLevelElements(),e=Object.keys(r);return e.length===0?{xmin:0,xmax:0,ymin:0,ymax:0}:this.$computeExtentsForElementIds(e,0,0,{},{})}};var FM="currentFace",XR={[Pt]:Rt,[Ot]:_t,[_t]:Ot,[Rt]:Pt},jR={[Pt]:Ot,[Ot]:Rt,[_t]:Pt,[Rt]:_t},HR={[Pt]:_t,[Ot]:Pt,[_t]:Rt,[Rt]:Ot};function kl(i,r){return i.faces.indexOf(r)!==-1}function UM(i,r){return(i.clockwise?jR:HR)[r]}function YM(i,r){return(i.clockwise?HR:jR)[r]}function HE(i,r,e){let t=()=>kl(i,r)===!0&&!e(r);return i.lockedAxis==null?i.lockedFace==null?t():i.lockedFace===r:i.lockedAxis.indexOf(r)!==-1}function zM(i,r){if(kl(i,r))return r;if(kl(i,XR[r]))return XR[r];{let e=UM(i,r);if(kl(i,e))return e;{let t=YM(i,r);if(kl(i,t))return t}}return r}function WS(i,r,e){let t={type:i,locations:[{x:0,y:0,offx:0,offy:0,ox:0,oy:0}],currentLocation:0,locked:!1,id:G(),cssClass:e.cssClass||"",isContinuous:!0,timestamp:null,faces:e.faces||r,lockedFace:null,lockedAxis:null,clockwise:e.clockwise!==!1,uu:null};return Object.defineProperty(t,FM,{get(){return this.uu},set(n){this.uu=zM(this,n)}}),t}var ZS={Continuous:{faces:[Pt,_t,Rt,Ot]},ContinuousTop:{faces:[Pt]},ContinuousRight:{faces:[Ot]},ContinuousBottom:{faces:[Rt]},ContinuousLeft:{faces:[_t]},ContinuousLeftRight:{faces:[_t,Ot]},ContinuousTopBottom:{faces:[Pt,Rt]}};function XM(i,r){let e=1/0,t=-1;for(let n=0;n<i.locations.length;n++){let o=Math.sqrt(Math.pow(r.x-i.locations[n].x,2)+Math.pow(r.y-i.locations[n].y,2));o<e&&(e=o,t=n,i.currentLocation=n)}return t}var kR={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},WR={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},ZR={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},JR={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},jM={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},HM={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},kM={x:0,y:1,ox:0,oy:1,offx:0,offy:0},WM={x:1,y:1,ox:0,oy:1,offx:0,offy:0},ZM={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},KR={Top:[kR],Bottom:[WR],Left:[ZR],Right:[JR],TopLeft:[jM],TopRight:[HM],BottomLeft:[kM],BottomRight:[WM],Center:[ZM],AutoDefault:[kR,ZR,WR,JR]};function qR(i,r){r=r||{};let e=KR[i];if(e!=null)return kE(i,e.map(n=>Object.assign({iox:n.ox,ioy:n.oy},n)),r,null);let t=ZS[i];if(t!=null)return WS(i,t.faces,r);throw{message:"VisuallyJs: unknown anchor type '"+i+"'"}}function kE(i,r,e,t){return{objectType:mE,type:i,locations:r,currentLocation:0,id:G(),isContinuous:!1,isDynamic:r.length>1,isFixed:t!=null,fixedLocation:t,timestamp:null,cssClass:e.cssClass||""}}function QR(i){return i.type==null&&i.x!=null&&i.y!=null&&i.ox!=null&&i.oy!=null}function Pu(i,r,e){let t=St(i);return r!=null&&r<i.length?t.currentLocation=r:e!=null&&XM(t,e),t}function JM(i){return i.objectType===mE}function St(i,r){if(JM(i))return i;if(r!=null&&(isNaN(r.offsetX)&&(r.offsetX=0),isNaN(r.offsetY)&&(r.offsetY=0),isNaN(r.ox)&&(r.ox=0),isNaN(r.oy)&&(r.oy=0)),X(i)){let e=qR(i,null);return r!=null&&(e.fixedLocation=r,e.isFixed=!0),e}else{if(QR(i))return kE(null,[{x:i.x,y:i.y,ox:i.ox,oy:i.oy,offsetX:i.offsetX==null?0:i.offsetX,offsetY:i.offsetY==null?0:i.offsetY}],{},r);if(Array.isArray(i)){let e=i.map(t=>{if(X(t)){let n=KR[t];return n!=null?Object.assign({iox:n[0].ox,ioy:n[0].oy,cls:""},n[0]):null}else if(QR(t))return Object.assign({iox:t.ox,ioy:t.oy,offx:t.offsetX==null?0:t.offsetX,offy:t.offsetY==null?0:t.offsetY,cls:null},t)}).filter(t=>t!=null);return kE("Dynamic",e,{},null)}else if(i.type!=null){let e=i;return qR(e.type,e.options)}else throw`Cannot parse anchor specification ${i}`}}var KM="___sourceMarker",qM="___targetMarker",Ou="__label",QS="vjs-default-label",JS="overlay",tL="labelLocation";function QM(i,r){let e=null;if(X(r))e=at.get(i.instance,r,i,{});else if(r.type!=null&&r.options!=null){let t=r,n=Object.assign({},t.options);e=at.get(i.instance,t.type,i,n)}else e=r;return e.id=e.id||G(),Ne.cacheTypeItem(i,JS,e,e.id),i.overlays[e.id]=e,e}function Wl(i,r){let e=QM(i,r);if(e.type===mr.type&&!X(r)){let t=e,o=r.options.labelLocationAttribute||tL,s=i.edge.data[o];s&&(t.location=s),YE(t,i.edge.data)}return e}function ZE(i,r){return i.overlays[r]}function rL(i){return i.overlays}function nL(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!1)}function iL(i,...r){r=r||[];for(let e in i.overlays)(r.length===0||r.indexOf(e)!==-1)&&i.instance.setOverlayVisible(i.overlays[e],!0)}function ko(i,r,e){let t=i.overlays[r];t&&(i.instance.setOverlayVisible(t,!1),e||i.instance.destroyOverlay(t),delete i.overlays[r],i.overlayPositions&&delete i.overlayPositions[r],i.overlayPlacements&&delete i.overlayPlacements[r])}function eV(i){return ZE(i,Ou)}var KS="add",qS="remove",_u="anchors",WE="connector";function eL(i,r,e){for(let t in i.overlays)r===KS?i.instance.$addOverlayClass(i.overlays[t],e):r===qS&&i.instance.$removeOverlayClass(i.overlays[t],e)}function eT(i,r,e){let t=null;r.connector!=null&&(t=Ne.getCachedTypeItem(i,WE,e.connector),t==null&&(t=Qt.pu(i,r.connector,e.connector),Ne.cacheTypeItem(i,WE,t,e.connector)),Qt.setPreparedConnector(i,t)),Ne.applyType(i,r,e);let n={};function o(h,d){let u=h.options;if(d)return d.updateFrom(u,i.edge.data),n[u.id]=!0,i.instance.$reattachOverlay(d,i),d;{let p=Ne.getCachedTypeItem(i,JS,u.id);return p!=null?(i.instance.$reattachOverlay(p,i),p.ps!==Zi&&i.instance.setOverlayVisible(p,!0),p.updateFrom(u,i.edge.data),i.overlays[p.id]=p):p=Wl(i,h),n[p.id]=!0,p}}if(r.overlays)for(let h in r.overlays)o(r.overlays[h],i.overlays[r.overlays[h].options.id]);if(r.sourceMarker){let h=i.sourceMarker==null?null:i.sourceMarker.id===r.sourceMarker.options.id?i.sourceMarker:null;i.sourceMarker=o(r.sourceMarker,h)}else i.sourceMarker=null;if(r.targetMarker){let h=i.targetMarker==null?null:i.targetMarker.id===r.targetMarker.options.id?i.targetMarker:null;i.targetMarker=o(r.targetMarker,h)}else i.targetMarker=null;for(let h in i.overlays)i.overlays[h].ignoreTypes!==!0&&n[i.overlays[h].id]==null&&ko(i,i.overlays[h].id,!0);r.detachable!=null&&(i.detachable=r.detachable===!0),r.reattach!=null&&(i.reattach=r.reattach===!0),r.scope&&(i.scope=r.scope);let s=null;r.anchor?(s=Ne.getCachedTypeItem(i,_u,e.anchor),s==null&&(s=[St(r.anchor),St(r.anchor)],Ne.cacheTypeItem(i,_u,s,e.anchor))):r.anchors&&(s=Ne.getCachedTypeItem(i,_u,e.anchors),s==null&&(s=[St(r.anchors[0]),St(r.anchors[1])],Ne.cacheTypeItem(i,_u,s,e.anchors))),s!=null&&(i.anchors.source=s[0],i.anchors.target=s[1]);let a={};i.instance.$_extractSimpleEdgeStyles(r,a)&&i.instance.$_setLineStyle(i,a,!1),i.instance.$applyConnectorType(i.connector,r)}function Jr(i,r){Ne.addClass(i,r),eL(i,KS,r),i.connector&&i.instance.$addConnectorClass(i.connector,r)}function _r(i,r){Ne.removeClass(i,r),eL(i,qS,r),i.connector&&i.instance.$removeConnectorClass(i.connector,r)}var Qt={getAbsoluteOverlayPosition(i,r){return i.overlayPositions?i.overlayPositions[r.id]:null},setPreparedConnector(i,r,e,t,n){if(i.connector!==r){let o,s="";if(i.connector!=null&&(o=i.connector,s=i.instance.$getConnectorClass(i.connector),i.instance.$destroyConnector(i)),i.connector=r,n&&Ne.cacheTypeItem(i,WE,r,n),Jr(i,s),o!=null){let a=rL(i);for(let l in a)i.instance.$reattachOverlay(a[l],i)}e||i.instance.$paintConnection(i)}},destroy(i){for(let r in i.overlays)i.instance.destroyOverlay(i.overlays[r]);i.overlays={},i.overlayPositions={},i.sourceElement=null,i.targetElement=null,i.instance.$destroyConnector(i),i.connector=null,Ne.destroy(i)},setVisible(i,r){Ne.setVisible(i,r),r?iL(i):nL(i),i.connector&&i.instance.$setConnectorVisible(i.connector,r),i.instance.$paintConnection(i)},pu(i,r,e){let t={},n;if(X(r))n=ze.get(i,r,t);else{let o=r;n=ze.get(i,o.type,An(o.options||{},t))}return e!=null&&(n.typeId=e),n},mu(i,r,e,t,n){let o=Qt.pu(i,r,n);Qt.setPreparedConnector(i,o,e,t,n)}};function tT(i){return i==null?null:i.split(" ").filter(r=>r!=null&&r.length>0)}function oL(i,r,e){for(let t in r)i[t]=e}var tV="connector",rV="override",nV="cssClass",sL="__default",iV="anchor",oV="anchors";function JE(i,r){let e={},t=i.$defaultType,n=Object.assign({},t);return oL(e,t,sL),i.$types.forEach(o=>{if(o!==sL){let s=i.instance.$getConnectionType(o);if(s!=null){let a=new Set([tV,iV,oV]);if(s.mergeStrategy===rV)for(let l in s)a.add(l);n=An(n,s,[nV],Array.from(a)),oL(e,s,o)}}}),r&&(n=fo(n,r,"_")),sa(i)&&eT(i,n,e),e}function sa(i){return i.objectType===KE}var KE="connection";function rT(i,r){let e=i.instance.$getConnectionType(r);e!=null&&e.cssClass&&sa(i)&&_r(i,e.cssClass)}function Ru(i){if(i.paintStyle&&i.hoverPaintStyle){let r={};Object.assign(r,i.paintStyle),Object.assign(r,i.hoverPaintStyle),i.hoverPaintStyle=r}}var sV="add",aV="remove";function nT(i,r,e){return e=e||{},{cssClass:e.cssClass||"",hoverClass:e.hoverClass||i.defaults.hoverClass,$types:new Set,$typeCache:{},id:e.id||G(),$defaultType:{scope:e.scope||i.defaultScope,overlays:{}},instance:i,deleted:!1,objectType:r,visible:!0,$hover:!1,paintStyle:{},paintStyleInUse:{},hoverPaintStyle:{}}}var Ne={create(i,r,e){e=e||{};let t=e.cssClass||"",n=e.hoverClass||i.defaults.hoverClass,o=new Set,s={},a=e.id||r+new Date().getTime(),l={scope:e.scope||i.defaultScope,overlays:{}};return{cssClass:t,instance:i,hoverClass:n,$types:o,$typeCache:s,$defaultType:l,id:a}},addClass(i,r){let e=(i.cssClass||"").split(" ");e.push(r),i.cssClass=e.join(" ")},removeClass(i,r,e){let t=(i.cssClass||"").split(" ");i.cssClass=t.filter(n=>n!==r).join(" ")},cacheTypeItem(i,r,e,t){i.$typeCache[t]=i.$typeCache[t]||{},i.$typeCache[t][r]=e},hasType(i,r){return i.$types.has(r)},removeType(i,r,e){let t=tT(r),n=!1,o=s=>i.$types.has(s)?(rT(i,s),i.$types.delete(s),!0):!1;if(t!=null){for(let s=0,a=t.length;s<a;s++)n=o(t[s])||n;n&&JE(i,e)}},addType(i,r,e){let t=tT(r),n=!1;if(t!=null){for(let o=0,s=t.length;o<s;o++)i.$types.has(t[o])||(i.$types.add(t[o]),n=!0);n&&JE(i,e)}},getCachedTypeItem(i,r,e){return i.$typeCache[e]?i.$typeCache[e][r]:null},setPaintStyle(i,r){i.paintStyle=r,i.paintStyleInUse=i.paintStyle,Ru(i)},setHoverPaintStyle(i,r){i.hoverPaintStyle=r,Ru(i)},getType(i){return Array.from(i.$types.keys())},clearTypes(i,r){i.$types.forEach(e=>{rT(i,e)}),i.$types.clear(),JE(i,r)},setType(i,r,e){return Ne.clearTypes(i),(tT(r)||[]).forEach(i.$types.add,i.$types),JE(i,e)},applyType(i,r,e){Ne.setPaintStyle(i,r.paintStyle),Ne.setHoverPaintStyle(i,r.hoverPaintStyle),i.paintStyleInUse=i.paintStyle},appendToDefaultType(i,r){Object.assign(i.$defaultType,r)},destroy(i){i.deleted=!0,delete i.instance},setVisible(i,r){i.visible=r}};function aL(i,r){return r.theta-i.theta}function lL(i,r){let e=i.theta<0?-Math.PI-i.theta:Math.PI-i.theta,t=r.theta<0?-Math.PI-r.theta:Math.PI-r.theta;return e-t}var iT={[Pt]:lL,[Ot]:aL,[Rt]:aL,[_t]:lL};function oT(i,r,e,t,n){let o=e?i.width:i.height,s=e?i.height:i.width,a=[],l=o/(r.length+1);for(let h=0;h<r.length;h++){let d=(h+1)*l,u=t*s;n&&(d=o-d);let p=e?d:u,g=i.x+p,m=i.width===0?0:p/i.width,E=e?u:d,y=i.y+E,x=i.height===0?0:E/i.height;if(i.r!==0&&i.r!=null){let f=Me({x:g,y},i.c,i.r);g=f.x,y=f.y}a.push({x:g,y,xLoc:m,yLoc:x,c:r[h].c,a:r[h].anchor})}return a}function Wo(i){return!i.isFixed&&i.isContinuous===!0}function sT(i){return[i.currentLocation,i.locations[i.currentLocation]]}function lV(i,r,e,t,n){let o={x:i.x+t*r,y:i.y+t*e},s=Dt(i,o,n),a=Dt(o,i,n),l=Math.min(s[0].x,s[1].x,a[0].x,a[1].x),h=Math.max(s[0].x,s[1].x,a[0].x,a[1].x),d=Math.min(s[0].y,s[1].y,a[0].y,a[1].y),u=Math.max(s[0].y,s[1].y,a[0].y,a[1].y);return{x:l,y:d,width:h-l,height:u-d}}function Lu(i,r,e,t){let n,o=t.rotation,s={curX:r.x+i.x*e.width+(isNaN(i.offsetX)?0:i.offsetX),curY:r.y+i.y*e.height+(isNaN(i.offsetY)?0:i.offsetY),x:i.x,y:i.y,ox:i.ox,oy:i.oy};if(o!=null&&o.length>0&&!(o.length===0&&o[0].r===0)){let a=[i.ox,i.oy],l={x:s.curX,y:s.curY,cr:0,sr:0};o.forEach(h=>{l=Me(l,h.c,h.r),a=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)].slice()}),n={curX:l.x,curY:l.y,x:i.x,y:i.y,ox:a[0],oy:a[1]}}else n=Object.assign({},s);return n}function hL(i,r,e,t,n,o,s,a){let l=Mr(r),h=Ab(r),d=s(e,t,l,h);d.sort((p,g)=>{let m=p.axis===l&&p.directionFromParent===r.directionFromParent,E=p.axis===l&&p.directionFromParent!==r.directionFromParent,y=g.axis===l&&g.directionFromParent===r.directionFromParent,x=g.axis===l&&g.directionFromParent!==r.directionFromParent;return m||x?-1:y||E?1:0});let u=[];for(let p=0;p<d.length;p++){let g=d[p],m=e+g.dx,E=t+g.dy,y=g.axis,x=g.directionFromParent,f=r.ax+g.dx*n,b=r.ay+g.dy*n,A=i.getCell(m,E,null,null),T=A===a,S={cx:m,cy:E,obj:A,axis:y,directionFromParent:x,ax:f,ay:b,g:r.g+(m-r.x===0||E-r.y===0?1:Math.SQRT2),obstacles:A.obstacles,buffers:A.buffers,isTarget:T};if(A===a)return[S];u.push(S)}return u}function aT(i){let r=[],e=Mr(i),t=i,n=!1,o=0;for(;!n&&t!=null;)r.push(t),o++,Mr(t)!==e&&(n=!0),t=t.parent;return r.length===0?null:{source:i,target:r[r.length-1],isFirstSegment:r[r.length-1].parent==null,axis:Mr(i),length:o}}function hV(i){return i.axis===Tn||i.axis===Qn}function cV(i){return i.axis===pe&&i.source.ax===i.target.ax||i.axis===ne&&i.source.ay===i.target.ay}function cL(i,r,e){r.push({ax2:i.source.ax,ay2:i.source.ay,ax1:i.target.ax,ay1:i.target.ay,axis:i.axis,pathId:e})}function dV(i,r,e){if(hV(i)||cV(i))cL(i,r,e);else{let t=i.axis===ne?(i.source.ax+i.target.ax)/2:i.source.ax,n=i.axis===pe?(i.source.ay+i.target.ay)/2:i.source.ay,o=i.axis===ne?(i.source.ax+i.target.ax)/2:i.target.ax,s=i.axis===pe?(i.source.ay+i.target.ay)/2:i.target.ay,a=i.axis===pe?ne:pe,l={ax2:i.source.ax,ay2:i.source.ay,ax1:t,ay1:n,axis:i.axis,pathId:e};r.push(l);let h={ax2:t,ay2:n,ax1:o,ay1:s,axis:a,pathId:e};r.push(h);let d={ax2:o,ay2:s,ax1:i.target.ax,ay1:i.target.ay,axis:a,pathId:e};r.push(d)}}function dL(i,r,e){if(e===ne)return[{x:i-50,y:r},{x:i+50,y:r}];if(e===pe)return[{x:i,y:r-50},{x:i,y:r+50}];if(e===Tn)return[{x:i+50,y:r+50},{x:i-50,y:r-50}];if(e===Qn)return[{x:i-50,y:r+50},{x:i+50,y:r-50}]}function lT(i,r,e,t,n,o){let s=i,a=[];n=n||G();let l=aT(s);if(l.isFirstSegment)t===nn?cL(l,a,n):dV(l,a,n);else{let d=l.source.ax,u=l.source.ay,p=!1,g=aT(l.target);for(;!p&&g!=null;){let m=dL(d,u,l.axis),E;E=dL(g.isFirstSegment?g.target.ax:g.target.cx,g.isFirstSegment?g.target.ay:g.target.cy,g.axis);let y=wx(m,E);y!=null&&(a.push({ax1:y.x,ay1:y.y,ax2:d,ay2:u,axis:l.axis,pathId:n}),d=y.x,u=y.y,l=g),g.isFirstSegment?p=!0:g=aT(g.target)}g!=null&&a.push({ax1:g.target.ax,ay1:g.target.ay,ax2:d,ay2:u,pathId:n,axis:g.axis})}return a.reverse(),{id:n,segments:a,targetCell:i,sourceCell:r,isEmpty:a.length===0}}function uL(i,r,e,t,n,o){let s=lT(i,r,e,t,o,!1);if(s.segments.length<2)return s;let a=[],l=0,h=!1;function d(u){let p={x:s.segments[u].ax1,y:s.segments[u].ay1},g=u+1,m=!1;for(;!m;){let E=s.segments[g];if(E==null||!n(e,[p,{x:E.ax2,y:E.ay2}]))return{startIdx:u,endIdx:g-1,segment:{ax1:p.x,ay1:p.y,ax2:s.segments[g-1].ax2,ay2:s.segments[g-1].ay2},finished:E==null};g++}}for(;!h;){let u=d(l);a.push(u.segment),u.finished?h=!0:l=u.endIdx+1}return{targetCell:s.targetCell,sourceCell:s.sourceCell,isEmpty:s.isEmpty,segments:a,id:s.id}}function pL(i,r,e,t,n,o,s,a,l,h,d,u,p,g,m,E,y){E==null?E=new Is(i,r,s,h,d,u):E.reinitialize();let x=E.es(i.x,i.y),f=E.es(r.x,r.y),b=Im(n);b.axis==null&&(b.axis=bb(i,r));let A=Im(o),T=E.setSourceCell(e,x.x,x.y,i.x,i.y,b.axis,b.direction),S=E.setTargetCell(t,f.x,f.y,r.x,r.y,A.axis,A.direction);if(S.x===T.x&&S.y===T.y)return{targetCell:S,sourceCell:T,segments:[],id:Dm,isEmpty:!0};S.fixedAxis=S.fixedAxis||b.axis;let O=T,v=S,_=()=>a===nn?uL(v,O,E,a,m,y):lT(v,O,E,a,y,!0),P=new qc,I=new Ts(P.sort.bind(P),T),C,R,w=Pc(T.x,T.y,S.x,S.y)*100,B=0;for(;I.length>0;){if(C=I.pop(),C.closed=!0,R=Mr(C),B++,B>w)throw`too many iterations ${B} `;if(C===S)return _();P.node=C;let N=hL(E,C,C.x,C.y,s,u,g,S);for(let V=0,D=N.length;V<D;V++){let $=N[V];if($.isTarget)return $.obj.parent=C,_();if($.obj.closed||$.obj===T||$.obj===S||$.obstacles.length>0||$.buffers.length>0)continue;let K=0;$.axis!==R&&(K=.5),(!$.obj.opened||$.g<$.obj.g)&&($.obj.g=$.g,$.obj.h=l($.cx,$.cy,S.x,S.y)+K,$.obj.f=$.obj.g+$.obj.h,$.obj.parent=C,$.obj.ax=$.ax,$.obj.ay=$.ay,$.obj.opened?I.update($.obj):(I.add($.obj),$.obj.opened=!0))}}return{targetCell:S,sourceCell:T,segments:[],id:Dm,isEmpty:!0}}function hT(i,r,e,t,n,o,s,a,l,h,d,u,p,g){return pL(i,r,e,t,n,o,a,l,h,d,u,s.findVerticesAtPoint.bind(s),s.findVerticesIntersectingWithRect.bind(s),(m,E,y,x)=>{if(l===nn||l==null)return Nm(m,E,y,x);if(l===Gc)return Nm(m,E,y,x);if(l===on)return yb(m,E,y,x)},(m,E)=>{let y=a*d;return s.hasLineOfSight(E,y,m.sourceAndTargetObstacles)},p,g)}var uV=10;function pV(i,r,e,t,n,o,s){let a=t.x+i.x*n.width,l=t.y+i.y*n.height;if(o!=null&&o.length>0){let h=Fx([a,l,0,0],o);a=h.x,l=h.y}return Math.sqrt(Math.pow(r-a,2)+Math.pow(e-l,2))}var Zl=class{constructor(r,e){this.instance=r;c(this,"gu");c(this,"$anchorLists",new Map);c(this,"Eu");c(this,"Gi");c(this,"$i");c(this,"Bi");c(this,"gs",new Map);c(this,"fu",null);c(this,"ft");e=e||{},this.Gi=e.gridCellSize||uV,this.Eu=e.avoidVertices===!0,this.$i=e.vertexBuffer||2,this.Bi=e.vertexBorder||2}$computePath(r,e){let t=this.instance.viewport.getPosition(r.sourceId),n=this.instance.viewport.getPosition(r.targetId),o=r.connector,s=ft(t),a=Jn(t),l=ft(n),h=Jn(n),d=this.instance.$getRotations(r.sourceId),u=this.instance.$getRotations(r.targetId);if(j(t.modelObject)){let x=this.instance.getElement(t.modelObject.parent.id);if(x.r!==0){let f={x:s.x+a.width/2,y:s.y+a.height/2},b=Me(f,x.c,x.r);s.x=b.x-a.width/2,s.y=b.y-a.height/2,d.pop(),d.push({r:x.r,c:b})}}if(j(n.modelObject)){let x=this.instance.getElement(n.modelObject.parent.id);if(x.r!==0){let f={x:l.x+h.width/2,y:l.y+h.height/2},b=Me(f,x.c,x.r);l.x=b.x-h.width/2,l.y=b.y-h.height/2,u.pop(),u.push({r:x.r,c:b})}}let p=this.yu(r.anchors.source,{xy:s,wh:a,elementId:t.id,timestamp:e,rotation:d,txy:l,twh:h}),g=this.yu(r.anchors.target,{xy:l,wh:h,elementId:n.id,timestamp:e,rotation:u,txy:s,twh:a});aS(r.connector);let m={sourcePos:p,targetPos:g,strokeWidth:r.paintStyleInUse.strokeWidth,sourceInfo:t,targetInfo:n};o.paintInfo=SE(o,m),bE(o),o.x=o.paintInfo.x,o.y=o.paintInfo.y,o.quadrant=o.paintInfo.quadrant;let E=o.geometry==null||o.geometry.source==null?!1:!PE(p,o.geometry.source),y=o.geometry==null||o.geometry.target==null?!1:!PE(g,o.geometry.target);if(this.instance.$_discardEdgeEditsOnDrag&&(E||y)&&Yi(r),o.edited){let x=this.bf(r,o,m,e,E,y);ze.setGeometry(r,x,!1)}else{let x=this.Af(r,o,m,e);ze.setGeometry(r,x,!0)}AE(o),o.width=Math.max(10,o.bounds.xmax-o.x),o.height=Math.max(10,o.bounds.ymax-o.y)}$connectionDetachedFromElement(r,e){this.Sf(r,e)}$connectionRemoved(r){Wo(r.connection.anchors.source)&&this.xu(r.connection.sourceId,r.connection.anchors.source),Wo(r.connection.anchors.target)&&this.xu(r.connection.targetId,r.connection.anchors.target)}$elementRemoved(r){r!=null&&this.$anchorLists.delete(r.id)}$redrawConnections(r,e){let t=new Set,n=new Set;if(!this.instance.xt){e=e||G();let o={};for(let s=0;s<r.length;s++){let a=r[s];if(a.visible===!1)continue;t.add(a);let l=a.sourceId,h=a.targetId,d=Wo(a.anchors.source),u=Wo(a.anchors.target);if(d||u){let p=(a.anchors.source.faces||[]).join("-"),g=(a.anchors.target.faces||[]).join("-"),m=[l,p,h,g].join("-"),E=o[m];d&&!this.$anchorLists.has(l)&&this.$anchorLists.set(l,{top:[],right:[],bottom:[],left:[]}),u&&!this.$anchorLists.has(h)&&this.$anchorLists.set(h,{top:[],right:[],bottom:[],left:[]});let y=this.instance.viewport.getPosition(h),x=this.instance.viewport.getPosition(l);if(h===l&&(d||u))this.Es(l,a.anchors.source,-Math.PI/2,0,a,h,0,!1,Te,t),this.Es(h,a.anchors.target,-Math.PI/2,0,a,l,1,!1,Te,t);else{let f=this.instance.$getRotations(l),b=this.instance.$getRotations(h);E||(E=this.Tf(l,h,x,y,a.anchors.source,a.anchors.target,f,b,a,a.connector.sourceStub+a.connector.targetStub,e,m),o[m]=E),d&&this.Es(l,a.anchors.source,E.theta,0,a,h,0,!1,E.a[0],t),u&&this.Es(h,a.anchors.target,E.theta2,-1,a,l,1,!0,E.a[1],t)}d&&n.add(l),u&&n.add(h)}}n.forEach(s=>{this.vf(s,this.$anchorLists.get(s))})}return t}$reset(){this.$anchorLists.clear(),this.gs.clear()}Sf(r,e){let t=this.$anchorLists.get(e.id),n=0;t!=null&&function(o){if(o){let s=a=>a.c.id===r.id;Nt(o.top,s),Nt(o.left,s),Nt(o.bottom,s),Nt(o.right,s),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t),n===0&&this.$anchorLists.delete(e.id)}Cf(r,e){let t;if(r.isFixed&&r.fixedLocation!=null)t=Lu(r.fixedLocation,e.xy,e.wh,e);else{let n=e.xy,o=e.wh,s=e.txy,a=e.twh,[l,h]=sT(r);if(r.locations.length===1||s==null||a==null)t=Lu(h,n,o,e);else{let[d,u]=this.Pf(n,o,s,a,e.rotation,e.tRotation,r.locations,e.otherAnchor);d!==l&&(r.currentLocation=d),t=Lu(u,n,o,e)}}return t.curX=Io(t.curX),t.curY=Io(t.curY),r.computedPosition=t,t}vf(r,e){let t=this.instance.viewport.getPosition(r),n=(o,s,a,l,h,d)=>{if(a.length>0){let u=a.sort(iT[o]),p=o===yt||o===Te,g=oT(t,u,l,h,p);for(let m=0;m<g.length;m++)g[m].a.locations[0]={x:g[m].xLoc,y:g[m].yLoc,ox:d.x,oy:d.y,offsetX:0,offsetY:0},g[m].a.currentLocation=0}};n(ht,t,e.bottom,!0,1,{x:0,y:1}),n(Te,t,e.top,!0,0,{x:0,y:-1}),n(We,t,e.left,!1,0,{x:-1,y:0}),n(yt,t,e.right,!1,1,{x:1,y:0})}Es(r,e,t,n,o,s,a,l,h,d){this.$anchorLists.has(r)||this.$anchorLists.set(r,{top:[],right:[],bottom:[],left:[]});let u=this.$anchorLists.get(r),p=-1,g=-1,m={theta:t,order:n,c:o,elId:s,anchor:e},E=u[h],y=e.currentFace?u[e.currentFace]:null,x;if(y){let f=y.findIndex(b=>b.anchor.id===e.id);if(f!==-1){y.splice(f,1);for(let b=0;b<y.length;b++)x=y[b].c,x.placeholder!==!0&&d.add(x)}}for(let f=0;f<E.length;f++)x=E[f].c,x.placeholder!==!0&&d.add(x);if(p!==-1)E[p]=m;else{let f=l?g!==-1?g:0:E.length;E.splice(f,0,m)}e.currentFace=h}xu(r,e){let t=this.$anchorLists.get(r),n=0;t!=null&&function(o,s){if(o){let a=l=>l.anchor.id===s;Nt(o.top,a),Nt(o.left,a),Nt(o.bottom,a),Nt(o.right,a),n+=o.top.length,n+=o.left.length,n+=o.bottom.length,n+=o.right.length}}(t,e.id),n===0&&this.$anchorLists.delete(r)}yu(r,e){let t=this.Cf(r,e);return r.computedPosition=t,r.timestamp=e.timestamp,t}Af(r,e,t,n){return this.Eu||r.avoidVertices?this.Of(r,e,t,n):this.fs(r,e,t)}bf(r,e,t,n,o,s){return ze.update(r,e.paintInfo,t,o,s)}fs(r,e,t){return ze.compute(r,e.paintInfo,t)}Of(r,e,t,n){if(e.edited)this.fs(r,e,t);else{let o=e,s=cT(t.sourcePos,e.sourceGap),a=cT(t.targetPos,e.targetGap),l={x:s.curX+e.sourceStub*s.ox,y:s.curY+e.sourceStub*s.oy},h={x:a.curX+e.targetStub*a.ox,y:a.curY+e.targetStub*a.oy},d=Math.min(l.x,h.x),u=Math.max(l.x,h.x),p=Math.min(l.y,h.y),g=Math.max(l.y,h.y),m={x:d,y:p,width:Math.max(u-d,10),height:Math.max(g-p,10)};if(!this.instance.viewport.hasVerticesIntersectingWithRect(m,0,[],!1))return this.fs(r,e,t);(this.ft==null||n!==this.gu)&&(this.ft=new Is(l,h,this.Gi,this.Bi,this.$i,(E,y,x)=>this.instance.viewport.findVerticesAtPoint(E,y,x))),this.gu=n;try{let E=r.edge?r.edge.id:r.id,y=hT(l,h,r.sourceId,r.targetId,s,a,this.instance.viewport,this.Gi,o.constrain,Pc,this.Bi,this.$i,this.ft,E);if(y.isEmpty)ze.compute(r,e.paintInfo,t);else{y.segments.unshift({ax1:s.curX,ay1:s.curY,ax2:l.x,ay2:l.y,axis:Ns(s.ox,s.oy),pathId:E}),y.segments.push({ax1:h.x,ay1:h.y,ax2:a.curX,ay2:a.curY,axis:Ns(a.ox,a.oy),pathId:E});let x=LE(y.segments.map(b=>Object.assign({x1:b.ax1,y1:b.ay1,x2:b.ax2,y2:b.ay2,o:b.axis||gV(b)},b)));return au(r.connector,x),{segments:o.$pathSegments,source:t.sourcePos,target:t.targetPos,quadrant:e.paintInfo.quadrant}}}catch(E){return this.fs(r,e,t)}}}Tf(r,e,t,n,o,s,a,l,h,d,u,p){if(u===this.fu){let v=this.gs.get(p);if(v!=null)return v}else this.gs.clear();this.fu=u;let g={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(r===e)return{orientation:g.IDENTITY,a:[Te,Te]};let m=Math.atan2(n.c.y-t.c.y,n.c.x-t.c.x),E=Math.atan2(t.c.y-n.c.y,t.c.x-n.c.x),y=[],x={};((v,_)=>{for(let P=0;P<v.length;P++)if(x[v[P]]={[We]:{x:_[P][0].x,y:_[P][0].c.y},[yt]:{x:_[P][0].x+_[P][0].width,y:_[P][0].c.y},[Te]:{x:_[P][0].c.x,y:_[P][0].y},[ht]:{x:_[P][0].c.x,y:_[P][0].y+_[P][0].height}},_[P][1]!=null&&_[P][1].length>0)for(let I in x[v[P]])x[v[P]][I]=Ux(x[v[P]][I],_[P][1])})([it,vn],[[t,a],[n,l]]);let f=[Te,We,yt,ht];for(let v=0;v<f.length;v++)for(let _=0;_<f.length;_++)y.push({source:f[v],target:f[_],dist:Math.round(Pe(x.source[f[v]],x.target[f[_]]))});y.sort(function(v,_){if(v.dist<_.dist)return-1;if(_.dist<v.dist)return 1;{let P={[We]:0,[Te]:1,[yt]:2,[ht]:3},I=P[v.source],C=P[_.source],R=P[v.target],w=P[_.target];return I<C?-1:C<I?1:R<w?-1:w<R?1:0}});let b=y[0].source,A=y[0].target,T={},S={};for(let v=0;v<y.length;v++){let _=y[v];if(!Wo(o)||HE(o,_.source,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(T[P]==null){let I=h.connector.sourceGap+h.connector.sourceStub,C=EE[P],R=this.Gi*(this.Bi+this.$i),w={x:x.source[P].x+I*C.x,y:x.source[P].y+I*C.y,width:Math.max(1,Math.abs(R*C.x)),height:Math.max(1,Math.abs(R*C.y))};T[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[r],!1)}return T[P]})?b=y[v].source:b=null,!Wo(s)||HE(s,_.target,P=>{if(!h.avoidVertices||h.connector==null)return!1;if(S[P]==null){let I=h.connector.targetGap+h.connector.targetStub,C=EE[P],R=this.Gi*(this.Bi+this.$i),w={x:x.target[P].x+I*C.x,y:x.target[P].y+I*C.y,width:Math.max(1,Math.abs(R*C.x)),height:Math.max(1,Math.abs(R*C.y))};S[P]=this.instance.viewport.hasVerticesIntersectingWithRect(w,0,[e],!1)}return S[P]})?A=y[v].target:A=null,b!=null&&A!=null)break}b==null&&(b=y[0].source),A==null&&(A=y[0].target);let O={a:[b,A],theta:m,theta2:E};return this.gs.set(p,O),O}Pf(r,e,t,n,o,s,a,l){if(l!=null){let h=a.map((p,g)=>{let m=r.x+p.x*e.width,E=r.y+p.y*e.height;return{x:m,y:E,idx:g}}),d=l.locations.map((p,g)=>{let m=t.x+p.x*n.width,E=t.y+p.y*n.height;return{idx:g,x:m,y:E}}),u=[];for(let p=0;p<h.length;p++)for(let g=0;g<d.length;g++){let m=Math.round(Pe(h[p],d[g]));u.push({d:m,idx:p,idx2:g})}return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}else{let h=t.x+n.width/2,d=t.y+n.height/2,u=a.map((p,g)=>({d:pV(p,h,d,r,e,o,s),idx:g}));return u.sort((p,g)=>p.d-g.d),[u[0].idx,a[u[0].idx]]}}};c(Zl,"type",be);function gV(i){return i.axis!=null?i.axis:i.ax1===i.ax2?pe:i.ay1===i.ay2?ne:null}function cT(i,r){return{curX:i.curX+i.ox*r,curY:i.curY+i.oy*r,ox:i.ox,oy:i.oy,x:i.x,y:i.y}}var dT="fill",qE="stroke",uT="stroke-width",mV="strokeWidth",Le="svg",pT="defs",q="path",Be="circle",gT="ellipse",tt="text",QE="tspan",Z="rect",Q="g",EV="version",fV="xmlns",mT="fill",ef="stroke-dasharray",yV="stroke-linejoin",xV="stroke-linecap",bV="stroke-miterlimit",AV="stroke-dashoffset",SV="stroke-opacity",TV="stroke",vV="stroke-width",wu="vector-effect",Du="non-scaling-stroke",CV="text-anchor",Gt="http://www.w3.org/2000/svg",PV="http://www.w3.org/1999/xlink",_V="http://www.w3.org/1999/xhtml";var Nu=class{constructor(r,e){c(this,"$properties");c(this,"$values");this.$values=e||{},this.$properties=Object.keys(e),r.bindAll([Re,ve],t=>{this.$properties.forEach(n=>{t.updates[n]!=null&&(this.$values[n]=t.updates[n])})})}getValue(r,e){return this.$values[r]||e}getValues(){return Object.assign({},this.$values)}};var gL=.5;function ET(i,r){var b,A;let e=nT(i,KE,r),t=r.overlays||[],n={},o=i.$defaultOverlays;o&&t.push(...o);for(let T=0;T<t.length;T++){let S=hi(t[T]);n[S.options.id]=S}if(e.$defaultType.overlays=n,r.label&&(e.$defaultType.overlays[Ou]={type:mr.type,options:{label:r.label,useHTMLElement:r.useHTMLLabel===!0,location:r.labelLocation||gL,id:Ou,cssClass:QS,rotatable:r.labelsRotatable}}),r.sourceMarker){let T=hi(r.sourceMarker);T.options.location=0,T.options.direction=-1,T.sourceMarker=!0,e.$defaultType.sourceMarker=T}if(r.targetMarker){let T=hi(r.targetMarker);T.options.location=1,T.options.direction=1,T.targetMarker=!0,e.$defaultType.targetMarker=T}let s=r.source,a=r.target,l=(r.anchors?r.anchors[0]:r.anchor)||i.$defaultAnchors[0]||i.$defaultAnchor,h=(r.anchors?r.anchors[1]:r.anchor)||i.$defaultAnchors[1]||i.$defaultAnchor,d=(b=r.edge.anchors)==null?void 0:b.source,u=(A=r.edge.anchors)==null?void 0:A.target,p=St(l,d),g=St(h,u),m=i.$_edgesDetachable;r.detachable===!1&&(m=!1);let E=i.$_reattachEdges===!0,y=Us({},r.paintStyle||i.defaults.paintStyle);Ne.appendToDefaultType(e,{detachable:m,reattach:E,paintStyle:y,hoverPaintStyle:Us({},r.hoverPaintStyle||i.defaults.hoverPaintStyle)}),r.outlineWidth&&(y.outlineWidth=r.outlineWidth),r.outlineColor&&(y.outlineStroke=r.outlineColor),r.lineWidth&&(y.strokeWidth=r.lineWidth),r.color&&(y.stroke=r.color),r.gradient&&(y.gradient=r.gradient),r.dashArray&&(y.dashArray=r.dashArray);let x=Object.assign(e,{anchorDefs:{source:l,target:h},anchors:{source:p,target:g},sourceId:r.edge.source.getFullId(),sourceElement:s,targetId:r.edge.target.getFullId(),targetElement:a,scope:r.scope,lastPaintedAt:null,visible:!0,paintStyle:r.paintStyle,hoverPaintStyle:r.hoverPaintStyle,detachable:m,reattach:E,edge:r.edge,suspendedElement:null,suspendedElementId:null,suspendedElementType:null,suspendedEndpoint:null,suspendedIndex:null,overlays:{},overlayPlacements:{},overlayPositions:{},connector:null,proxies:{[it]:[],[vn]:[]},avoidVertices:r.avoidVertices===!0,sourceMarker:null,targetMarker:null});Qt.mu(x,r.connector||i.$defaultConnector,!0);let f=[be,r.type].join(" ");return/[^\s]/.test(f)&&Ne.addType(x,f,r.data),x}var Jl=class{constructor(r){c(this,"grid");c(this,"snap",!1);c(this,"fitGroupsToGrid",!1);r!=null&&(this.snap=r.snap===!0,this.grid=r.size,this.fitGroupsToGrid=r.fitGroupsToGrid!==!1)}};var Iu=class{constructor(r){c(this,"afterGroupCollapse");c(this,"afterGroupExpand");c(this,"afterGroupResize");c(this,"afterGroupShrink");c(this,"afterGroupGrow");c(this,"afterLayout");c(this,"afterDrag");c(this,"constant");c(this,"trackback");c(this,"trackbackThreshold");c(this,"constrainToViewport");c(this,"repositionDraggedElement");c(this,"grid");r=r||{},this.afterDrag=r.afterDrag===!0,this.constant=r.constant===!0,this.trackback=r.trackback!==!1,this.trackbackThreshold=r.trackbackThreshold,this.constrainToViewport=r.constrainToViewport===!0,this.repositionDraggedElement=r.repositionDraggedElement===!0,this.afterLayout=r.afterLayout===!0,this.afterGroupResize=r.afterGroupResize===!0,this.afterGroupShrink=r.afterGroupShrink===!0||this.afterGroupResize&&r.afterGroupShrink!==!1,this.afterGroupGrow=r.afterGroupGrow===!0||this.afterGroupResize&&r.afterGroupGrow!==!1,this.afterGroupCollapse=r.afterGroupCollapse===!0,this.afterGroupExpand=r.afterGroupExpand===!0,this.constant&&this.afterDrag&&(this.constant=!1),this.constant&&(this.repositionDraggedElement=!1)}};var mL={},cn={get:i=>{let r=mL[i];if(!r)U("WARN: VisuallyJs: unknown UI plugin '"+i+"'");else return new r},register:(i,r)=>{mL[i]=r}};function Xe(i){return function(r){cn.register(i,r)}}function Mu(i,r,e,t,n,o,s){s=s||r.minSize;let a=r.maxSize,l=r.padding||0,h=(s==null?void 0:s.width)||0,d=(s==null?void 0:s.height)||0,u=0,p=0;isFinite(i.xmin)&&i.xmin<l&&n&&(u=l-i.xmin),isFinite(i.ymin)&&i.ymin<l&&n&&(p=l-i.ymin);let g=(isFinite(i.xmax)?i.xmax:0)+u+l,m=(isFinite(i.ymax)?i.ymax:0)+p+l,E=Math.min((a==null?void 0:a.width)||g,g),y=Math.min((a==null?void 0:a.height)||m,m);if(E=Math.max(h,E),y=Math.max(d,y),e){if(isFinite(i.xmin)&&i.xmin>l&&t){let x=i.xmin-l,f=E-x;E=Math.max((s==null?void 0:s.width)||f,f),E>f&&(x-=E-f),u=-x}if(isFinite(i.ymin)&&i.ymin>l&&t){let x=i.ymin-l,f=y-x;y=Math.max((s==null?void 0:s.height)||f,f),y>f&&(x-=y-f),p=-x}}if(o.grid&&o.fitGroupsToGrid!==!1){let x=E/o.grid.width;E=o.grid.width*Math.ceil(x);let f=y/o.grid.height;y=o.grid.height*Math.ceil(f);let b=u/o.grid.width;u=o.grid.width*Math.ceil(b);let A=p/o.grid.height;p=o.grid.height*Math.ceil(A)}return{width:E,height:y,layoutShiftX:u,layoutShiftY:p}}function fT(i,r,e,t){let n=i.$_connMap[r.id];if(n){if(n.proxies==null||n.proxies[e]==null||n.proxies[e].length===0)return;let o=n.proxies[e].pop(),s=o.originalElement,a=o.element,l=o.originalAnchor;return t!=null&&(l=St(t)),i.$sourceOrTargetChanged(a.id,s.id,n,s.el,e),e===it?n.anchors.source=l:n.anchors.target=l,Qt.setVisible(n,o.originallyVisible),s}return null}function yT(i,r,e,t,n){let o=i.$_connMap[r.id];if(o){let s=e==="source"?0:1;if(n==null)if(Y(t.modelObject)){let d=i.view.getGroupDefinition(i.model.getNodeType(t.modelObject.data));n=St(d.anchor||i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous")}else n=St(i.$defaultAnchors[s]||i.$defaultAnchor||"Continuous");let a=NA(o.proxies[e]),l=a!=null?a.originalElement.id:e===it?o.sourceId:o.targetId,h=a!=null?a.originalAnchor:e===it?o.anchors.source:o.anchors.target;e===it?o.anchors.source=n:o.anchors.target=n,i.$sourceOrTargetChanged(l,t.id,o,t.el,e),o.proxies[e].push({originalAnchor:h,element:t,originalElement:i.$getManagedElement(l),originallyVisible:o.visible}),Qt.setVisible(o,!0),i.$revalidateElementById(t.id)}}var OV=["color","lineWidth","outlineWidth","outlineColor","dashArray","gradient"];function tf(i,r,e){r!=null&&(Qg(r.connections,i),r.connections.length===1&&i.instance.$addClassToElement(r.el,Yl)),e!=null&&(r==null||i.sourceId!==i.targetId)&&(Qg(e.connections,i),e.connections.length===1&&i.instance.$addClassToElement(e.el,Yl))}function rf(i,r,e){if(r!=null){let t=r.connections.length;Nt(r.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,r),t>0&&r.connections.length===0&&i.instance.$removeClassFromElement(r.el,Yl)}if(e!=null){let t=e.connections.length;(r==null||i.sourceId!==i.targetId)&&Nt(e.connections,n=>i.id===n.id),i.instance.router.$connectionDetachedFromElement(i,e),t>0&&e.connections.length===0&&i.instance.$removeClassFromElement(e.el,Yl)}}var RV=2,LV=2,Vu=class extends Ft{constructor(e,t,n,o,s){var l,h,d,u,p,g,m,E,y,x,f,b,A,T;super();c(this,"hl",[]);c(this,"cl",[]);c(this,"containerType",null);c(this,"id");c(this,"defaults");c(this,"Fi",{});c(this,"hoverSuspended",!1);c(this,"xt",!1);c(this,"bu",null);c(this,"$_dataLoading",!1);c(this,"zoomToFitOnLoad");c(this,"plugins",[]);c(this,"pluginMap",new Map);c(this,"dl",[]);c(this,"connectorClass",ra);c(this,"connectorOutlineClass",IS);c(this,"connectorPathClass",Eu);c(this,"overlayClass",na);c(this,"labelOverlayClass",VS);c(this,"$_connMap",{});c(this,"allowNestedGroups");c(this,"$_discardEdgeEditsOnDrag");c(this,"$_vertexBuffer");c(this,"$_vertexBorder");c(this,"ys");c(this,"viewport",new Cu(this,e=>this.getRenderedElement(e)));c(this,"router");c(this,"ul",new Map);c(this,"fe");c(this,"pl",new Set);c(this,"Au");c(this,"$defaultConnector");c(this,"$defaultOverlays");c(this,"$defaultAnchor");c(this,"$defaultAnchors");c(this,"Su");c(this,"Tu");c(this,"$isInMotion");c(this,"magnetizerProfile");c(this,"magnetizer");c(this,"$unrenderedVertices",new Map);c(this,"$unprocessedGroupMemberships",new Map);c(this,"$_useModelForSizes");c(this,"$_writeSizeToElements");c(this,"$_useModelForPositions");c(this,"$_allowUnattachedEdges");c(this,"$_edgesDetachable");c(this,"$_reattachEdges");c(this,"$paintConnectorOutline");c(this,"$connectorOutlineColor");c(this,"$connectorOutlineWidth");c(this,"K",1);c(this,"$collapsedGroupSizeCalculator");c(this,"vu");c(this,"ml");c(this,"gl");c(this,"view");c(this,"gridProfile");c(this,"$connectionEstablished");c(this,"vertexList",[]);c(this,"logicalPorts");c(this,"objectFilter");c(this,"layoutMap",new Map);c(this,"$_layout");c(this,"model");c(this,"dataSource");c(this,"$relayoutOnEdgeConnect");c(this,"$relayoutOnResize");c(this,"$relayoutOnVertexRemove");c(this,"xs");c(this,"rootElement");c(this,"Bt",[]);c(this,"$_dataHooks",[]);this.model=e,this.dataSource=t,this.rootElement=n,this.id=o.id||G(),this.gridProfile=new Jl(o.grid),this.$connectionEstablished=o.connectionEstablished||(S=>{}),this.logicalPorts=o.logicalPorts===!0,this.objectFilter=o.objectFilter||function(S){return!0},this.$defaultConnector=((l=o.edges)==null?void 0:l.connector)||Hr,this.Su=(h=o.edges)==null?void 0:h.sourceMarker,this.Tu=(d=o.edges)==null?void 0:d.targetMarker,this.$defaultOverlays=(((u=o.edges)==null?void 0:u.overlays)||[]).map(S=>hi(S)),this.$defaultAnchor=((p=o.edges)==null?void 0:p.anchor)||"Continuous",this.$defaultAnchors=((g=o.edges)==null?void 0:g.anchors)||[null,null],this.$relayoutOnEdgeConnect=o.relayoutOnEdgeConnect,this.$relayoutOnResize=o.relayoutOnResize,this.$relayoutOnVertexRemove=o.relayoutOnVertexRemove,this.defaults={[bu]:null,[XS]:1,[jo]:{strokeWidth:2,stroke:"#000000"},[BE]:"vjs_defaultscope",[$E]:!0,[YS]:20},s&&Object.assign(this.defaults,s),Object.assign(this.Fi,this.defaults),this.Fi[jo]!=null&&(this.Fi[jo].strokeWidth=this.Fi[jo].strokeWidth||2),this.Au=this.defaults[BE],this.allowNestedGroups=this.Fi[$E]!==!1,this.$_discardEdgeEditsOnDrag=o.edges&&o.edges.discardEditsOnDrag===!0,this.$_vertexBuffer=o.edges?o.edges[FS]:RV,this.$_vertexBorder=o.edges?o.edges[BS]:LV,this.ys=((m=o.edges)==null?void 0:m.avoidVertices)===!0,this.$_allowUnattachedEdges=((E=o.edges)==null?void 0:E.allowUnattached)===!0,this.$_edgesDetachable=((y=o.edges)==null?void 0:y.detachable)!==!1,this.$_reattachEdges=((x=o.edges)==null?void 0:x.reattach)===!0,this.$paintConnectorOutline=((f=o.edges)==null?void 0:f.paintOutline)!==!1,this.$connectorOutlineWidth=((b=o.edges)==null?void 0:b.outlineWidth)||20,this.$connectorOutlineColor=((A=o.edges)==null?void 0:A.outlineColor)||"transparent",this.zoomToFitOnLoad=o.zoomToFit===!0,this.router=o.router?o.router(this):new Zl(this,{gridCellSize:((T=o.edges)==null?void 0:T.astarGridCellSize)||10,avoidVertices:this.ys}),this.$_useModelForSizes=o.useModelForSizes===!0,this.$_writeSizeToElements=o.writeSizeToElements!==!1,this.$_useModelForPositions=o.useModelForPositions!==!1,this.magnetizerProfile=new Iu(o.magnetizer||{}),this.magnetizer=new Li({positionGetter:S=>this.getElementPosition(S.id),getSize:S=>this.getElementSize(S.id),getId:S=>S.id,positionSetter:(S,O)=>{}}),this.xs=!0,o.edges!=null&&o.edges.simpleEdgeStyles===!1&&(this.xs=!1),this.setContainer(n),this.$setView(o.view),this.El(xt,S=>{let O=this.$_connMap[S.edge.getId()];if(O){let v=this.dataSource.getEdgeType(S.edge.data),_=[...new Set([be,v])];if(this.$_setConnectionType(O,_.join(" "),S.edge.data),this.xs===!0){let P={};this.$_extractSimpleEdgeStyles(S.edge.data,P)&&this.$_setLineStyle(O,P,!0)}this.se(P=>{P.$edgeUpdated(S.edge,O)})}}),this.El(od,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var O=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(O),this.se(v=>{v.$groupResized({element:O,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.El(id,S=>{if(S.source===this){S.group.data[this.$modelWidthAttribute]=S.sizeAfterUndo.width,S.group.data[this.$modelHeightAttribute]=S.sizeAfterUndo.height;var O=this.viewport.updateElement(S.group.id,null,null,S.sizeAfterUndo.width,S.sizeAfterUndo.height,null,null,!1);this.$setGroupElementSize(S.group,S.sizeAfterUndo),this.$doVertexUpdated(O),this.se(v=>{v.$groupResized({element:O,newGroupSize:S.sizeAfterUndo,originalGroupSize:S.sizeBeforeUndo})})}}),this.$_layout=Ke.get(_s.type,{adapter:this.$createDefaultLayoutAdapter(),instance:this.model,dataSource:this.dataSource,container:this.rootElement,options:{}});let a=o.layout||{type:xo.type};this.setLayout(a,!0),this.$collapsedGroupSizeCalculator=o.getCollapsedGroupSize,this.vu=o.defaultCollapsedGroupSize||{width:200,height:150},this.ml=o.canCollapseGroup,this.gl=o.canExpandGroup}get defaultScope(){return this.Au}get $modelTopAttribute(){return this.model.modelTopAttribute}get $modelLeftAttribute(){return this.model.modelLeftAttribute}get $modelWidthAttribute(){return this.model.modelWidthAttribute}get $modelHeightAttribute(){return this.model.modelHeightAttribute}get $modelRotationAttribute(){return this.model.modelRotationAttribute}get currentZoom(){return this.K}getLayout(){return this.$_layout}$edgeTargetChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.target.getFullId(),s=this.$getManagedElement(o);s==null&&j(t.target)&&(s=this.Cu(t.target),s==null&&(s=this.$getManagedElement(t.target.parent.id))),n?s!=null?(this.dataSource.debugEnabled&&console.log("DEBUG: target change",n),this._f(n,s,!_i(e.old))):(delete this.$_connMap[t.getId()],this.fl(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Target for Edge "+t.getId()+" changed to Node "+s.id+"; we have no valid connection.")}}$select(e){if(J(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$addClassToElement(t,Wi)}else if(nt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$addConnectorClass(t.connector,Xl)}else if(j(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$addClassToElement(t,Wi)}}setSuspendRendering(e,t){}$deselect(e){if(J(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.$removeClassFromElement(t,Wi)}else if(nt(e.obj)){let t=this.$_connMap[e.obj.id];t&&this.$removeConnectorClass(t.connector,Xl)}else if(j(e.obj)){let t=this.getRenderedElement(e.obj.getFullId());t&&this.$removeClassFromElement(t,Wi)}}$selectionCleared(e){this.$getSelector(this.fe,z(Xl)).forEach(t=>this.$removeClassFromElement(t,Xl)),this.$getSelector(this.fe,z(Wi)).forEach(t=>this.$removeClassFromElement(t,Wi))}Cu(e){let t=this.getRenderedPort(e);if(t!=null)return this.$manage(t,e,null,null,null,!1)}$edgeSourceChanged(e){if(e.source==null||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()],o=t.source.getFullId(),s=this.$getManagedElement(o);s==null&&j(t.source)&&(s=this.Cu(t.source),s==null&&(s=this.$getManagedElement(t.source.parent.id))),n&&s?s!=null?this.Rf(n,s,!_i(e.old)):(delete this.$_connMap[t.getId()],this.fl(n,{force:!0,fireEvent:!1})):s!=null&&this.dataSource.debugEnabled&&U("DEBUG: Source for Edge "+t.getId()+" changed to Node "+t.source.getFullId()+"; we have no valid connection.")}}onDestroy(e){this.bind(Ii,e)}El(e,t){this.hl.push({event:e,fn:t}),this.dataSource.bind(e,t,!0)}$dataLoadStart(){this.$_dataLoading=!0,this.$_setSuspendDrawing(!0),this.viewport.setSuspended(!0),this.fire(Sd)}$dataAppendStart(){this.$_setSuspendDrawing(!0)}$dataAppendEnd(e){}$dataLoadEnd(e){if(this.$unrenderedVertices.size===0){let t=G();this.$_setSuspendDrawing(!1,!1),e?this.viewport.setSuspended(!1):(this.relayout(null,!0),this.viewport.setSuspended(!1),this.$flushUnrenderedEdges(t),this.$redrawEveryConnection()),this.zoomToFitOnLoad&&!e&&this.zoomToFit(),this.$_dataLoading=!1,this.fire(Fr)}}zoomToFit(e){this.$zoomToFit(e)}zoomToFitIfNecessary(e){this.$zoomToFitIfNecessary(e)}zoomToElements(e){this.$zoomToElements(e)}cloneVertex(e,t){var o,s;let n=this.getObjectInfo(e,!1);if(n.obj){let a=t==null?void 0:t.newPosition,l=lt(n.obj.data);if(delete l.id,a!=null)l[this.$modelLeftAttribute]=a.x,l[this.$modelTopAttribute]=a.y;else{let d=((o=t==null?void 0:t.offsetPosition)==null?void 0:o.x)||50,u=((s=t==null?void 0:t.offsetPosition)==null?void 0:s.y)||50;l[this.$modelLeftAttribute]+=d,l[this.$modelTopAttribute]+=u}let h;return this.model.transaction(()=>{h=Y(n.obj)?this.model.addGroup(l):this.model.addNode(l),a==null&&(this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)!==!1||!this.magnetizerProfile.constant&&(t==null?void 0:t.magnetize)===!0)&&this.bs(h,null,!1,{},{},null,!0,!1,!1),(t==null?void 0:t.selectAfterCreate)===!0&&setTimeout(()=>this.model.setSelection(h))},ut),h}}Pu(){let e,t,n,o,s,a=!1,l=G();for(e=0,n=this.dataSource.getGroupCount();e<n;e++)o=this.dataSource.getGroupAt(e),this.objectFilter(o)&&(this.$doRenderGroup(o),a=!0);for(e=0,n=this.dataSource.getNodeCount();e<n;e++)t=this.dataSource.getNodeAt(e),this.objectFilter(t)&&(this.$doRenderNode(t),a=!0);let h=this.dataSource.getAllEdges();for(e=0,n=h.length;e<n;e++)s=h[e],this.objectFilter(s)&&(this.Ou(h[e],gl,null,null,l),a=!0);return this.$flushUnrenderedEdges(l),a}$_hasUnrenderedEdges(){return this.Bt.length!==0}Lf(e,t,n,o){let s=j(o.source)?o.source.getParent():o.source,a=j(o.target)?o.target.getParent():o.target,l=n.sourcePortType||(j(o.source)?null:this.$getAttribute(e,ji)||this.$getAttribute(e,Wr)),h=n.targetPortType||(j(o.target)?null:this.$getAttribute(e,Hi)||this.$getAttribute(t,Wr));return{sourceDef:l!=null?this.view.getPortDefinition(l):this.view.getTypeDefinition(o.source),targetDef:h!=null?this.view.getPortDefinition(h):this.view.getTypeDefinition(o.target),sourceParentDef:this.view.getTypeDefinition(s),targetParentDef:this.view.getTypeDefinition(a)}}$_extractSimpleEdgeStyles(e,t){let n=!1;return OV.forEach(o=>{e.hasOwnProperty(o)&&(n=!0,t[o]=e[o])}),n}wf(e,t,n,o){var O,v;let s=e.edge,a=e.context||{},l=a.edgeType||this.dataSource.getEdgeType(s.data),h=e.def||this.view.getEdgeDefinition(l),d=j(s.source)?s.source.getParent():s.source,u=this.getElement(d.id),p=j(s.target)?s.target.getParent():s.target,g=this.getElement(p.id),{sourceDef:m,targetDef:E,sourceParentDef:y,targetParentDef:x}=this.Lf(u.el,g.el,a,s),f={type:l,data:s.data,cost:s.getCost(),directed:s.isDirected(),geometry:s.geometry,id:s.id,edge:s,anchor:null,anchors:[null,null],source:t,target:n,sourceMarker:h.sourceMarker||this.Su,targetMarker:h.targetMarker||this.Tu};[xu,US,zS].forEach(_=>{h.hasOwnProperty(_)&&(f[_]=h[_])}),f.anchor&&!f.anchors&&(f.anchors=[f.anchor,f.anchor],delete f.anchor);let A=(_,P,I,C,R)=>{if(C&&C[I]){let w=_[P]||[C[I],C[I]];w[R]=C[I],_[P]=w}};m!=null&&A(f,Hl,jl,m,0),E!=null&&A(f,Hl,jl,E,1);let T=f;if(T.avoidVertices=this.ys||h.avoidVertices,this.dataSource.debugEnabled&&console.log("Renderer","adding connection with params",T),h!=null&&Object.assign(f,fo(h,s.data,null,!0)),this.$manage(T.source,s.source,null,null,null,!1),(O=s.anchors)!=null&&O.source)f.anchors[0]=St(s.anchors.source);else{let _=a.positionOnSource||{x:0,y:0},P=m.anchorPositions||y.anchorPositions,I=m.anchorPositionFinder||y.anchorPositionFinder;if(P!=null)f.anchors[0]=Pu(P.slice(),null,_);else if(I!=null){let C=I(u.el,_,s.source,E);f.anchors[0]=C}}if(this.$manage(T.target,s.target,null,null,null,!1),(v=s.anchors)!=null&&v.target)f.anchors[1]=St(s.anchors.target);else{let _=a.positionOnTarget||{x:0,y:0},P=E.anchorPositions||x.anchorPositions,I=E.anchorPositionFinder||x.anchorPositionFinder;if(a.targetAnchor!=null)f.anchors[1]=Pu([a.targetAnchor]);else if(P!=null)f.anchors[1]=Pu(P.slice(),null,_);else if(I!=null){let C=I(g.el,_,s.target,E);f.anchors[1]=C}}this.xs===!0&&this.$_extractSimpleEdgeStyles(s.data,f);let S=ET(this,f);if(S!=null){tf(S,this.getElement(S.sourceId),this.getElement(S.targetId)),T.geometry&&(ze.importGeometry(S,T.geometry),this.$repaintUIElementById(S.sourceId),this.$repaintUIElementById(S.targetId)),S.edge=s,this.$_connMap[s.getId()]=S,s.source.dummy&&(S.anchors.source.isFixed=!0,S.anchors.source.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),s.target.dummy&&(S.anchors.target.isFixed=!0,S.anchors.target.fixedLocation={x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.$relayoutOnEdgeConnect&&this.refresh(),(g.visible===!1||u.visible===!1)&&this.As(s,!1),T.geometry||this.$repaintUIElementById(S.sourceId);let _={connection:S,edge:s,reason:e.reason};this.se(P=>P.$edgeRendered(_)),this.fire(Bb,_)}else U("VisuallyJs - WARN : An edge could not be rendered "+s+" and is being removed from the dataset."),this.model.removeEdge(s,this);return S}$graphClearStart(){this.$_layout&&this.$_layout.mn(),this.layoutMap.clear(),this.reset()}$graphClearEnd(){}$groupRemoved(e){let t=this.viewport.getGroupElement(e.group.id);return t&&(this.vertexList=this.vertexList.filter(o=>o.id!==e.group.id),e.removeChildren===!1&&e.children.forEach(o=>{let s=this.$getManagedElement(o.id);o.data[this.$modelLeftAttribute]=s.x,o.data[this.$modelTopAttribute]=s.y,this.$appendElementToVertexLayer(s.el),this.$setViewportElementPosition(s,s)}),e.group.getPorts().map(o=>this.$getManagedElement(o.getFullId())).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.$__unmanage(t.el,e.removeChildren===!0,!0),this.se(o=>{o.$groupRemoved(t)})),t}Ou(e,t,n,o,s,a){this.Bt.push({edge:e,reason:t,context:n,def:o}),a&&this.$flushUnrenderedEdges(s)}$flushUnrenderedEdges(e){let t=this.Bt.length,n=[];if(t>0){let o=[];for(let s=0;s<this.Bt.length;s++)this.Df(this.Bt[s],e)==null?o.push(this.Bt[s]):n.push(this.Bt[s].edge);this.Bt=o}return n}Df(e,t){let n=this.getRenderedElement(e.edge.target),o=this.getRenderedElement(e.edge.source);return n==null||o==null?null:this.wf(e,o,n,t)}$edgeAdded(e,t){if(e.source!==this||e.transient===!0&&e.source===this){let n=e.edge;if(this.objectFilter(n.source)&&this.objectFilter(n.target)){let o=this.view.getEdgeDefinition(this.dataSource.getEdgeType(n.data||{}));if(o&&o.ignore===!0)return;this.Ou(n,e.reason,t,o,null,!this.$_dataLoading)}}}$edgeRemoved(e){if(e.edge.transient||e.source!==this){let t=e.edge,n=this.$_connMap[t.getId()];n&&(this.viewport.$removeEdge(t.id),this.dataSource.debugEnabled&&console.log("Renderer","removing edge",t),delete this.$_connMap[t.getId()],this.fl(n,{fireEvent:!1,force:!0}),this.se(o=>{o.$edgeRemoved(t,n)}))}}$edgeGeometryUpdated(e,t,n){let o=this.getRenderedConnection(e.id);o!=null&&(t!=null?ze.importGeometry(o,t):Yi(o),this.$repaintUIElementById(e.source.getFullId()),this.fire(ti,{edge:e,geometry:t,originalGeometry:n}))}$exportEdgeGeometry(e){let t=this.$_connMap[e.id];return t==null?null:ln(t.connector)}$nodeAdded(e){let t=e.node;this.objectFilter(t)&&this.$doRenderNode(t,e.eventInfo)}$groupAdded(e){let t=e.group;this.objectFilter(t)&&this.$doRenderGroup(t,e.eventInfo)}$portAdded(e){this.objectFilter(e.port.getParent())&&setTimeout(()=>this.$flushUnrenderedEdges(G()))}$vertexUpdated(e){if(e.vertex!=null){let t=this.getElement(e.vertex.getFullId());if(t){let n=null,o=e.vertex.data[this.$modelLeftAttribute],s=null,a=e.vertex.data[this.$modelTopAttribute];if(e.updates!=null){if((e.updates[this.$modelWidthAttribute]!=null||e.updates[this.$modelHeightAttribute]!=null)&&(n=e.vertex.data[this.$modelWidthAttribute],s=e.vertex.data[this.$modelHeightAttribute],this.$_useModelForSizes)){let d=this.$resolveVertexSizeFromModel(e.vertex,this.view.getTypeDefinition(e.vertex));this.$setElementSizeInUI(t.el,d.width,d.height),n=d.width,s=d.height,this.se(u=>{u.$vertexResized(this.getElement(e.vertex.getFullId()),n,s)})}e.updates[this.$modelRotationAttribute]!=null&&this._u(e.vertex,e.updates[this.$modelRotationAttribute],!1,!0)}let l=o,h=a;if(e.vertex.group!=null){let d=this.$_getGroupContentAreaInfo(e.vertex.group.id).pageOrigin;l+=d.x,h+=d.y}if(this.viewport.updateElement(t.id,l,h,n,s,null,e.vertex,!1),(e.updates[this.$modelLeftAttribute]!=null||e.updates[this.$modelTopAttribute]!=null)&&this.$setViewportElementPosition(t,{x:o,y:a}),this.$doVertexUpdated(t),this.$repaintUIElement(this.getElement(t.id)),e.reason===Hs&&this.ys){let d=this.model.getAllEdges().filter(u=>Kn(u.source).id!==e.vertex.id&&Kn(u.target).id!==e.vertex.id);this.repaintEdges(d)}e.reason===Id?this.Nf(this.getElement(t.id),e.originalData):this.fire(zs,this.getElement(t.id)),this.se(d=>d.$vertexUpdated(this.getElement(t.id),e.reason))}}}Nf(e,t){let n={x:t[this.$modelLeftAttribute],y:t[this.$modelTopAttribute]},o={dragGroup:[{element:e,vertex:e.modelObject,pos:{x:e.x,y:e.y},originalPos:n}],positions:{[e.id]:{x:e.x,y:e.y}},ui:this},s=Y(e.modelObject)?$r:Vt;this.fire(s,o)}If(e){this.fire(Ce,e)}getLayoutFor(e){return lm(e)||hm(e)?this.layoutMap.get(e.group.id):this.$_layout}$groupMemberAdded(e){this.$_processGroupAddition(e,!1)||(this.$unprocessedGroupMemberships.has(e.group.id)||this.$unprocessedGroupMemberships.set(e.group.id,[]),this.$unprocessedGroupMemberships.get(e.group.id).push(e))}$_processGroupAddition(e,t){let n=this.$getManagedElement(e.vertex.id),o=this.viewport.getGroupElement(e.group.id);if(o!=null&&n!=null){this.$appendElement(n.el,o.contentArea);let s=this.$_getGroupContentAreaInfo(e.group.id),a=e.positionInGroup?e.positionInGroup.x:n.x-o.x,l=e.positionInGroup?e.positionInGroup.y:n.y-o.y;return this.$_updateVertexPositions({positions:{[n.id]:{x:a,y:l}},sizes:null,offset:{x:o.x+s.internalOffset.x,y:o.y+s.internalOffset.y},storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),e.source!=this&&this.relayoutGroup(e.group.id,dA),this.se(h=>{h.$groupMemberAdded(n)}),t||setTimeout(()=>this.$revalidateElement(n.el)),!0}else return!1}$groupMemberRemoved(e){let t=this.$getManagedElement(e.vertex.id),n=this.viewport.getGroupElement(e.group.id),o=this.$_getGroupContentAreaInfo(e.group.id);this.$appendElementToVertexLayer(t.el),this.$_updateVertexPositions({positions:{[t.id]:{x:t.x-n.x-o.internalOffset.x,y:t.y-n.y-o.internalOffset.y}},sizes:null,offset:null,storePositionsInModel:!0,repaintConnections:!0,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.se(s=>{s.$groupMemberRemoved(t)})}$nodeRemoved(e){let t=this.$getManagedElement(e.node.id);return t&&(e.node.getPorts().map(o=>this.$getManagedElement(o.getFullId())).filter(o=>o!=null).forEach(o=>this.$__unmanage(o.el,!1,!0)),this.vertexList=this.vertexList.filter(o=>o.id!==e.node.id),this.$__unmanage(t.el,!1,!0),this.se(o=>{o.$nodeRemoved(t)}),this.If(t)),t}$portRemoved(e){let t=this.$getManagedElement(e.port.getFullId());if(t){let n=this.$getManagedElement(e.port.getParent().id);n.el!==t.el?this.$__unmanage(t.el,!1,!1):(this.$removeAttribute(n.el,Ul),this.$removeAttribute(n.el,Wr))}}$edgeTypeChanged(e,t,n){let o=this.$_connMap[e.getId()];if(o){let s=this.view.getEdgeDefinition(n);if(s&&s.ignore===!0)return;s.connector&&Qt.mu(o,s.connector),Ne.setType(o,n,e.data)}}$groupTypeChanged(e,t,n){}$nodeTypeChanged(e,t,n){this.$reRenderNode(e)}$portTypeChanged(e,t,n){}$vertexRendered(e,t,n,o){if(!t)throw new Error("Cannot render vertex");let s=J(e),a=Y(e);this.$setAttribute(t,te,e.getFullId());let l=s?ki:a?Xo:j(e)?GS:"";this.$addClassToElement(t,l),t.jtk=t.jtk||{},t.jtk[e.objectType.toLowerCase()]=e,t.jtk.vertex=e;let h=this.getElement(e.id),d=h!=null;if(d&&(this.$setAttribute(t,gt,this.$getAttribute(h.el,gt)),h.el=t,this.model.getSelection().containsVertex(e.id)&&this.$addClassToElement(t,Wi)),J(e)||Y(e))if(this.vertexList.push(e),e.group==null)this.$appendVertexElement(t);else{let m=this.Ru(e.group);this.$appendElement(t,m)}let u=null,p=e.data[this.$modelRotationAttribute];this.$_useModelForSizes?(u=this.$resolveVertexSizeFromModel(e,n),this.$_writeSizeToElements!==!1&&this.$setElementSizeInUI(t,u.width,u.height),e.data[this.$modelWidthAttribute]=u.width,e.data[this.$modelHeightAttribute]=u.height):u=this.$getSize(t);let g=this.$manage(t,e,null,u,null,!1);if(p!=null&&this._u(e,p,!this.$_dataLoading,!1),J(e)){if(!d){let m={el:t,id:e.id,vertex:e,size:u};this.fire(Yr,m)}}else if(Y(e)){let m={el:t,vertex:e,id:e.id,size:u},E=g,y=n;E.contentArea=this.$getGroupContentAreaElement(t),E.elastic=y.elastic===!0;let x=y.layout||{type:xo.type};this.layoutMap.set(e.id,this.Lu(x,e)),this.fire(Ur,m),this.$unprocessedGroupMemberships.has(e.id)&&(this.$unprocessedGroupMemberships.get(e.id).forEach(b=>this.$_processGroupAddition(b,!0)),this.$unprocessedGroupMemberships.delete(e.id))}this.$unrenderedVertices.delete(e.id),this.$_dataLoading&&this.$isAsynchronousRender()?this.$dataLoadEnd(!1):this.$_dataLoading||(d&&this.se(m=>{m.$vertexRerendered({el:t,id:e.id,vertex:e,size:u})}),this.$flushUnrenderedEdges(null),this.$unrenderedVertices.size===0&&this.refresh())}$redrawEveryConnection(){let e=G();this.wu(Object.values(this.$_connMap),e)}$redrawConnectionsForViewportElement(e,t,n){let o=e.connections||[];return this.wu(o,t,n),o}wu(e,t,n){this.router.$redrawConnections(e,t),e.forEach(o=>{this.$paintConnection(o,{timestamp:t,fireEvent:n})})}As(e,t,n){let o=this.$_connMap[e.id];o&&Qt.setVisible(o,t)}isVisible(e){return this.Du(e,t=>{switch(t.type){case Ue.objectType:let n=this.$_connMap[t.obj.id];return n?n.visible:!1;case ce.objectType:case se.objectType:return t.managedElement.visible!==!1}})}setVisible(e,t,n){if(e==null)return;let o=s=>{switch(s.type){case Ue.objectType:this.As(s.obj,t,n);break;case ce.objectType:case se.objectType:this.Vf(s,t,n);break;case de.objectType:U("WARN togglePort method not implemented in 7.x");break}};this.Du(e,o)}Vf(e,t,n){if(e.el&&(this.$setElementVisible(e.el,t),e.el.iS=t,e.managedElement.visible=t,this.fire(Td,{node:e.obj,el:e.el,state:t}),!n)){let o=this.dataSource.getAllEdgesFor(e.obj);for(let s=0;s<o.length;s++)if(!t)this.As(o[s],t,n);else{let a=Kn(o[s].source),l=Kn(o[s].target),h=a===e.obj?l:a;this.isVisible(h)&&this.As(o[s],t,n)}}}Du(e,t){let n;if(vA(e))n={nodes:[],edges:[]},e.eachVertex((o,s)=>{n.nodes.push(t(this.getObjectInfo(s,!1)))}),e.eachEdge((o,s)=>{n.edges.push(t(this.getObjectInfo(s,!1)))});else if(this.$isArrayLike(e)){n=[];for(let o=0;o<e.length;o++)n.push(t(this.getObjectInfo(e[o],!1)))}else n=t(this.getObjectInfo(e,!1));return n}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);return n!=null?n:this.$_getDefaultSizeForVertex(e,t)}$_getDefaultSizeForVertex(e,t){let n=J(e)?this.defaults.nodeSize||{width:100,height:80}:this.defaults.groupSize||{width:300,height:300};return t.defaultSize&&(n.width=t.defaultSize.width,n.height=t.defaultSize.height),n}$_getModelSizeForVertex(e){let t=e.data[this.$modelWidthAttribute],n=e.data[this.$modelHeightAttribute];if(t!=null&&n!=null)return{width:e.data[this.$modelWidthAttribute],height:e.data[this.$modelHeightAttribute]}}getContainer(){return this.fe}setZoom(e,t){return this.K=e,e}W(e){if(e==null)return null;let t=this.$getAttribute(e,gt);return(!t||t==="undefined")&&(t=`vjs-${G()}`,this.$setAttribute(e,gt,t)),t}setContainer(e){this.fe=e}Nu(e,t,n,o){let s=n===0?e.sourceId:e.targetId;if(o){let l=n===0?e.anchors.source:e.anchors.target;l.isFixed=!1,delete l.fixedLocation}let a={index:n,originalSourceId:n===0?s:e.sourceId,newSourceId:e.sourceId,originalTargetId:n===1?s:e.targetId,newTargetId:e.targetId,connection:e};return n===0?(a.newSourceId=t.id,e.sourceId=t.id,e.sourceElement=t.el):(a.newTargetId=t.id,e.targetId=t.id,e.targetElement=t.el),a}Rf(e,t,n){rf(e,this.getElement(e.sourceId)),this.$repaintUIElement(this.getElement(e.sourceId));let o=this.Nu(e,t,0,n);tf(e,this.getElement(o.newSourceId),this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(o.newSourceId))}_f(e,t,n){rf(e,this.getElement(e.targetId)),this.$repaintUIElement(this.getElement(e.targetId));let o=this.Nu(e,t,1,n);tf(e,this.getElement(e.sourceId),this.getElement(o.newTargetId)),this.$repaintUIElement(this.getElement(o.newTargetId))}$_setConnectionType(e,t,n){let o=Ne.setType(e,t,n);return this.$paintConnection(e),o}$_setSuspendDrawing(e,t){let n=this.xt;return this.xt=e,e?this.bu=""+new Date().getTime():this.bu=null,this.xt||(this.autoSizeGroups(Array.from(this.pl.keys()).map(o=>o.modelObject)),this.pl.clear(),t&&this.repaintEverything()),n}$batch(e,t){let n=this.xt===!0;n||this.$_setSuspendDrawing(!0),e(),n||this.$_setSuspendDrawing(!1,!t)}Mf(e,t){return this.dataSource.beforeDetach(e.edge.source,e.edge.target,e.edge)}fl(e,t){return e!=null&&e.deleted!==!0&&(t=t||{},t.force||this.Mf(e)===!0)?(rf(e,this.getElement(e.sourceId),this.getElement(e.targetId)),this.router.$connectionRemoved({connection:e,reason:pl,edge:e.edge}),delete this.$_connMap[e.id],Qt.destroy(e),!0):!1}$manage(e,t,n,o,s,a){let l=t.getFullId();this.$getAttribute(e,gt)==null&&this.$setAttribute(e,gt,l);let h=this.getElement(l);if(h==null)h=this.viewport.addElement(l,e,t,n,o,s),this.xt||this.viewport.$refreshElement(l,!1,n,o);else if(a)return this.viewport.$refreshElement(l);return h}$getManagedElement(e){return this.viewport.getElement(e)}$__unmanage(e,t,n){let o=s=>{let a=this.W(s),l=this.getElement(a);this.router.$elementRemoved(l),this.viewport.remove(a),this.$removeAttribute(s,gt),s&&n&&this.$removeElement(s)};t&&this.$getAssociatedElements(e).map(o),o(e)}rotate(e,t){this.getObjectInfo(e,!1).obj&&this.model.$_updateVertex(e,{[this.$modelRotationAttribute]:t},Xs,!1)}setSize(e,t,n){this.getObjectInfo(e,!1).obj&&this.model.transaction(()=>{this.model.$_updateVertex(e,{[this.$modelWidthAttribute]:t,[this.$modelHeightAttribute]:n},SA,!1)},ut)}_u(e,t,n,o){let s=X(e)?e:e.id;if(this.getElement(s)){this.viewport.xf(s,t);let a=this.getElement(s);if(this.$syncManagedElementWithView(a,!1),this.se(l=>{l.$vertexRotated(a,t)}),n!==!0)return this.$repaintUIElementById(s)}}$getRotation(e){let t=this.getElement(e);return t!=null&&t.r||0}$getRotations(e){let t=[],n=this.getElement(e),o=s=>{if((J(s.modelObject)||Y(s.modelObject))&&s.modelObject.group){let a=this.getElement(s.modelObject.group.id);a!=null&&(t.push({r:a.r,c:a.c}),o(a))}};return n!=null&&(j(n.modelObject)?n=this.getElement(n.modelObject.parent.id):t.push({r:n.r||0,c:n.c}),o(n)),t}$revalidateElement(e,t){let n=this.W(e);return this.$revalidateElementById(n)}$revalidateElementById(e,t){return this.$revalidateManagedElement(this.getElement(e),t)}$revalidateManagedElement(e,t){return e!=null?(this.viewport.$refreshElement(e.id),this.$repaintUIElement(e)):vu()}repaintEverything(e){let t=G();e!==!0&&this.viewport.$refreshEveryElement(),this.viewport.recomputeBounds(),this.viewport.$forEachElement(n=>this.$repaintUIElement(n,t,!0))}$repaintUIElementById(e,t,n,o){this.$repaintUIElement(this.getElement(e),t,n,o)}$repaintUIElement(e,t,n,o){let s=vu(),a=l=>{l.forEach(h=>s.add(h))};if(!this.xt){if(e!=null){let l=this.$getAssociatedElements(e.el).map(h=>this.getElement(this.W(h))).filter(h=>h!=null&&h.id!==e.id);t==null&&(t=G());for(let h=0;h<l.length;h++)(j(l[h].modelObject)||!n)&&this.viewport.$refreshElement(l[h].id);if(a(this.$redrawConnectionsForViewportElement(e,t,o)),l.length>0)for(let h=0;h<l.length;h++)a(this.$redrawConnectionsForViewportElement(l[h],t,o))}o&&this.fire(xd,e)}return s}reset(){this.$_connMap={},this.vertexList.length=0,this.viewport.reset(),this.router.$reset(),this.Bt.length=0,this.$unrenderedVertices.clear(),this.pl.clear()}getRenderedConnection(e){return this.$_connMap[e]}getNodes(){return this.vertexList.filter(J)}getGroups(){return this.vertexList.filter(Y)}getUIGroups(){return this.getGroups().map(e=>this.viewport.getGroupElement(e.id))}destroy(){for(let e=0;e<this.cl.length;e++)this.off(this.fe,this.cl[e][0],this.cl[e][1]);this.reset(),this.unbind(),this.ul.clear()}$registerConnectionType(e,t){let n=Object.assign({},t);if(this.ul.set(e,n),t.overlays){let o={};for(let s=0;s<t.overlays.length;s++){let a=hi(t.overlays[s]);o[a.options.id]=a}n.overlays=o}if(t.sourceMarker){let o=hi(t.sourceMarker);o.options.direction=-1,o.options.location=0,o.sourceMarker=!0,n.sourceMarker=o}if(t.targetMarker){let o=hi(t.targetMarker);o.options.direction=1,o.options.location=1,o.targetMarker=!0,n.targetMarker=o}}$getConnectionType(e){return this.ul.get(e)}$sourceOrTargetChanged(e,t,n,o,s){let a,l,h,d;e!==t&&(s===it?(n.sourceId=t,n.sourceElement=o,h=this.getElement(e),a=this.getElement(t),l=this.getElement(n.targetId),d=l):s===vn&&(n.targetId=t,n.targetElement=o,l=this.getElement(t),d=this.getElement(e),a=this.getElement(n.sourceId),h=a),rf(n,h,d),tf(n,a,l))}yl(e,t,n,o){n=n||{},o=o||{},t=t||{};let s={},a=Sn(e);a.unshift(e),a.forEach(l=>{let h=this.viewport.getGroupElement(l.id),d=o[l.id]||this.viewport.$computeGroupContentExtents(l,!1,t,n,null),u=this.xl(l,t,n,d,!1);if(u!=null&&(s[l.id]=u,n[l.id]=u.size,t[l.id]=u.position,(u.originalSize.width!==u.size.width||u.originalSize.height!==u.size.height)&&(this.$trackGroupSizeChanges({[l.id]:{element:h,originalGroupSize:u.originalSize,newGroupSize:u.size}}),l.group==null))){let p=u.size.width-u.originalSize.width,g=u.size.height-u.originalSize.height;if(this.magnetizerProfile.afterGroupShrink&&(p<0||g<0)){let m=this.$provisionallyGather(l,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}else if(this.magnetizerProfile.afterGroupGrow){let m=this.$provisionallyMagnetize(l,!1,t,n,!1,!1);this.$_updateVertexPositions({positions:m.current,storePositionsInModel:!0,sizes:null,resizedGroups:null,offset:null,repaintConnections:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}}})}expandGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o=this.gl?this.gl(t,n.lastExpandedSize):null;if(o===!1)return;let s=n.el;if(this.Iu(n)==null){n.collapsed=!1,this.$updateElementClasses(s,[GE],[VE]);let l=new Set,h=new Set,d=new Set;this.Vu(n,l,h,d,!0),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!0)),l.forEach(p=>this.$_unproxyEdge(p.edge,p.index));let u={};if(this.$_useModelForSizes&&n.lastExpandedSize!=null&&(u[t.id]=n.lastExpandedSize,this.model.updateGroup(t,n.lastExpandedSize)),o!=null){let p=o;for(let g in p)this.model.updateVertex(g,p[g])}this.yl(t,null,u,null),this.magnetizerProfile.afterGroupExpand===!0&&this.magnetize(n.modelObject),this.$revalidateManagedElement(n),this.se(p=>{p.$groupExpanded(n)}),this.fire(Ad,{group:t})}}},ut,!0)}$_proxyEdge(e,t,n,o){yT(this,e,t,n,o)}$_unproxyEdge(e,t,n){return fT(this,e,t,n)}Vu(e,t,n,o,s){let a=e.modelObject.members.map(d=>d.id),l=dm(e.modelObject,!0,!0);this.viewport.$refreshElement(e.id),a.forEach(d=>{this.viewport.$refreshElement(d)});let h=al(l,d=>!(a.indexOf(d.source.id)!==-1&&a.indexOf(d.target.id)!==-1));h.left.forEach(d=>{t.add({edge:d,index:a.indexOf(d.source.id)===-1?vn:it})}),h.right.forEach(d=>{o.add(d)}),this.Mu(e).forEach(d=>{this.Vu(d,t,n,o,!1)})}toggleGroup(e){let t=this.viewport.getGroupElement(X(e)?e:e.id);t!=null&&(t.collapsed?this.expandGroup(e):this.collapseGroup(e))}Iu(e){let t=null;if(e.modelObject.group==null)return null;{let n=e.modelObject.group;for(;n!=null;){let o=this.$getManagedElement(n.id);o.collapsed&&(t=o),n=o.modelObject.group}return t}}collapseGroup(e){this.model.$transaction(()=>{let t=X(e)?this.dataSource.getGroup(e):e,n=this.viewport.getGroupElement(t.id);if(n!=null){let o={width:n.width,height:n.height},s=this.ml==null?null:this.ml(t,o);if(s===!1)return;let a=n.el;if(n.lastExpandedSize=o,this.Iu(n)==null){n.collapsed=!0,this.$updateElementClasses(a,[VE],[GE]);let h=new Set,d=new Set;this.Gu(n,h,d),d.forEach(p=>this.$setConnectionVisible(this.$_connMap[p.id],!1)),h.forEach(p=>this.$_proxyEdge(p.edge,p.index,n));let u={};if(this.$_useModelForSizes){let p=this.$getCollapsedGroupSize(t,{width:n.width,height:n.height});u[t.id]=p,this.model.updateGroup(t,p)}if(s!=null){let p=s;for(let g in p)this.model.updateVertex(g,p[g])}this.yl(t,null,u,null),this.$revalidateManagedElement(n),this.magnetizerProfile.afterGroupCollapse===!0&&this.gather(n.modelObject),this.se(p=>{p.$groupCollapsed(n)}),this.fire(bd,{group:t})}}},ut,!0)}$computeCollapsedGroupSize(e,t){return this.$collapsedGroupSizeCalculator!=null?this.$collapsedGroupSizeCalculator(e,t):null}$getCollapsedGroupSize(e,t){try{let o=this.$computeCollapsedGroupSize(e,t);if(o!=null)return o}catch(o){U("ERROR: user function getGroupCollapsedSize threw error",o)}let n=this.getGroupDefinition(e);return n&&n.collapsedSize?n.collapsedSize:this.vu}Mu(e){return e.modelObject.members.filter(t=>t.objectType===se.objectType).map(t=>this.viewport.getGroupElement(t.id))}Gu(e,t,n){let o=e.modelObject.members.map(a=>a.id),s=dm(e.modelObject,!0,!0);if(e.proxied!==!1){let a=al(s,l=>!(o.indexOf(l.source.id)!==-1&&o.indexOf(l.target.id)!==-1));a.left.forEach(l=>{t.add({edge:l,index:o.indexOf(l.source.id)===-1?vn:it})}),a.right.forEach(l=>{n.add(l)})}else s.forEach(a=>n.add(a));this.Mu(e).forEach(a=>{this.Gu(a,t,n)})}Gf(){return this.$u(this.dataSource.getGroups().filter(this.objectFilter))}$u(e){let t=[];return e.forEach(n=>{let o=Sn(n);t.push({group:n,depth:o.length})}),t.sort((n,o)=>n.depth===o.depth?0:n.depth>o.depth?-1:1),t}relayoutGroup(e,t){let n=Y(e)?e:this.dataSource.getGroup(e),o=this.layoutMap.get(n.id);if(o==null)return;let s=this.getElement(n.id),a=s;o.relayout(null,h=>{this.$_updateVertexPositions({positions:h.positions,sizes:h.sizes,resizedGroups:null,offset:{x:a.x,y:a.y},storePositionsInModel:!0,repaintConnections:!1,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.fire(Pl,{element:s,positions:h.positions,sizes:h.sizes,extents:h.bounds})});let l=!0;this.$_dataLoading&&this.$_useModelForSizes&&(l=!1),t===cA&&(l=!1),l&&this.autoSizeGroup(n),this.$revalidateManagedElement(s)}$_updateVertexPositions(e){let t=e.offset||{x:0,y:0},n=new Set,o=vu();for(let s in e.positions){let a=e.positions[s],l=e.sizes!=null?e.sizes[s].width:null,h=e.sizes!=null?e.sizes[s].height:null,d=this.viewport.updateElement(s,a.x+t.x,a.y+t.y,l,h,null,null,!1);e.writeSizesToElements&&l!=null&&h!=null&&this.$setElementSizeInUI(this.getElement(s).el,l,h),n.add(this.getElement(s)),this.$setViewportElementPosition(d,a),e.storePositionsInModel&&this.$storePositionInModel({id:s,pos:a})}if(e.resizedGroups!=null)for(let s in e.resizedGroups){let a=e.resizedGroups[s].newGroupSize;this.viewport.updateElement(s,null,null,a.width,a.height,null,e.resizedGroups[s].group,!1),n.add(this.getElement(s)),this.$_useModelForSizes&&this.$f(s,a)}if(e.rotations!=null)for(let s in e.rotations){let a=this.getElement(s);this.viewport.updateElement(s,null,null,null,null,e.rotations[s],null,!1),n.add(a),e.writeRotationsToElements&&this.$setElementRotation(a.el,e.rotations[s])}return e.repaintConnections&&n.forEach(s=>{this.$repaintUIElement(s).forEach(l=>o.add(l))}),o}relayout(e,t){this.Bu(n=>{this.$_layout.relayout(e,n)},n=>{this.$afterRelayout(n)},Pn,t)}refresh(e){this.Bu(t=>{this.$_layout.layout(t)},t=>{this.$afterRefresh(t)},Ys,e)}Bu(e,t,n,o){if(!this.xt){let s={};e(a=>{let l=a.positions;if(this.magnetizerProfile.afterLayout){let p=[];for(let m in l)p.push(this.dataSource.getVertex(m));this.magnetizer.setElements(p);let g=this.magnetizer.executeAtCenter({getPosition:m=>l[m.id],getSize:m=>a.sizes[m.id]});for(let m in g.current)l[m]=g.current[m]}let h=this.Bf(),d=h.orderedGroups.length>0&&!(this.$_dataLoading&&this.$_useModelForSizes),u={};if(d){let p=(m,E)=>h.info[m].positions[E]||this.getElementPosition(E),g=(m,E)=>a.sizes[E]||h.info[m].sizes[E]||this.getElementSize(E);h.orderedGroups.forEach(m=>{let E=Pi();m.group.members.forEach(x=>{let f=p(m.group.id,x.id),b=g(m.group.id,x.id);E.xmin=Math.min(E.xmin,f.x),E.ymin=Math.min(E.ymin,f.y),E.xmax=Math.max(E.xmax,f.x+b.width),E.ymax=Math.max(E.ymax,f.y+b.height)});let y=this.xl(m.group,l,a.sizes,E,!1);if(y!=null&&(s[m.group.id]={group:m.group,newGroupSize:y.size,originalGroupSize:y.originalSize},l[m.group.id]!=null&&(l[m.group.id]=y.position),u[m.group.id]=this.$_getGroupContentAreaInfo(m.group.id),a.sizes[m.group.id]=y.size,y.layoutShiftX!==0||y.layoutShiftY!==0)){let x=h.info[m.group.id].positions;for(let f in x)x[f].x+=y.layoutShiftX,x[f].y+=y.layoutShiftY}})}this.$_updateVertexPositions({positions:l,sizes:a.sizes,resizedGroups:s,offset:null,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),h.orderedGroups.reverse().forEach(p=>{let g=p.group.id,m=h.info[g],E=l[g]||ft(m.element),y=u[g]||this.$_getGroupContentAreaInfo(g);y&&(E.x+=y.internalOffset.x,E.y+=y.internalOffset.y),this.$_updateVertexPositions({positions:m.positions,sizes:m.sizes,resizedGroups:s,offset:E,repaintConnections:!1,storePositionsInModel:!0,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1})}),o!==!0&&this.repaintEverything(!0),t({bounds:a.bounds,positions:a.positions,sizes:a.sizes,layout:a.layout}),this.fire(n,{positions:a.positions,sizes:a.sizes,layout:a.layout});for(let p in h.info)this.fire(Pl,h.info[p])})}}repaintEdge(e){let t=this.getRenderedConnection(e.id);this.$paintConnection(t)}repaintEdges(e){let t=G();e.forEach(n=>{let o=this.getRenderedConnection(n.id);this.$paintConnection(o,{timestamp:t})})}$paintConnection(e,t){if(!this.xt&&e.visible!==!1){t=t||{};let n=t.timestamp;if(n!=null&&n===e.lastPaintedAt)return;if(n==null||n!==e.lastPaintedAt){this.router.$computePath(e,n);let o=e.sourceMarker;if(o!=null&&o.visible){let a=this.$drawOverlay(o,e.connector,e.paintStyleInUse);e.overlayPlacements[o.id]=a,e.connector.internalSegments.length>0&&(e.connector.internalSegments[0].x1=a.tail.x,e.connector.internalSegments[0].y1=a.tail.y)}let s=e.targetMarker;if(s!=null&&s.visible){let a=this.$drawOverlay(s,e.connector,e.paintStyleInUse);e.overlayPlacements[s.id]=a;let l=e.connector.internalSegments.length-1;e.connector.internalSegments.length>0&&(e.connector.internalSegments[l].x2=a.tail.x,e.connector.internalSegments[l].y2=a.tail.y)}for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l!==o&&l!==s&&l.visible&&(e.overlayPlacements[a]=this.$drawOverlay(l,e.connector,e.paintStyleInUse,Qt.getAbsoluteOverlayPosition(e,l)))}this.$paintConnector(e,e.paintStyleInUse);for(let a in e.overlays)if(e.overlays.hasOwnProperty(a)){let l=e.overlays[a];l.visible&&this.$paintOverlay(l,e.overlayPlacements[a],e.connector)}this.viewport.$updateEdge({id:e.edge.id,x:e.connector.x,y:e.connector.y,width:e.connector.width,height:e.connector.height})}e.lastPaintedAt=n,t.fireEvent&&this.fire(Ob,e),this.dl.length>0&&this.dl.forEach(o=>o.$edgeRedraw(e))}}$addOverlay(e,t,n){let o=Wl(e,t);return o!=null&&(o.ignoreTypes=!0,n||this.$repaintUIElementById(e.sourceId)),o}$removeOverlay(e,t){ko(e,t),this.$repaintUIElementById(e.sourceId)}$_setLineStyle(e,t,n){t.hasOwnProperty("lineWidth")&&(e.paintStyle.strokeWidth=t.lineWidth,e.hoverPaintStyle.strokeWidth=t.lineWidth),t.hasOwnProperty("outlineWidth")&&(e.paintStyle.outlineWidth=t.outlineWidth,e.hoverPaintStyle.outlineWidth=t.outlineWidth),t.hasOwnProperty("color")&&(e.paintStyle.stroke=t.color),t.hasOwnProperty("outlineColor")&&(e.paintStyle.outlineStroke=t.outlineColor),t.hasOwnProperty("dashArray")&&(e.paintStyle.dashArray=t.dashArray),Ru(e),n&&this.$paintConnection(e)}$setView(e){this.view=new Tu(this.dataSource,this.dataSource.getModel(),e,this)}findIntersectingVertices(e){if(e.dontIncludeNodes===!0&&e.dontIncludeGroups===!0&&e.dontIncludeNodesInsideGroups===!0)return[];let t={x:e.origin.x,y:e.origin.y,width:e.dimensions.width,height:e.dimensions.height},o=(e.enclosed?this.viewport.findVerticesEnclosedByRect(t,0,!1,[],!1):this.viewport.findVerticesIntersectingWithRect(t,0,!1,[],!1)).filter(a=>{let l=J(a.modelObject),h=l&&lm(a.modelObject),d=Y(a.modelObject),u=d&&hm(a.modelObject),p=e.dontIncludeNodes===!0&&l,g=e.dontIncludeGroups===!0&&d,m=e.dontIncludeNodesInsideGroups&&h,E=e.dontIncludeNestedGroups&&u;return!(p||g||m||E)}),s=e.filter||(()=>!0);return o.filter(a=>s(a.modelObject)).map(a=>({enclosed:e.enclosed,id:a.id,r:a,v:a.modelObject,el:a.el}))}findEnclosedVertices(e){return this.findIntersectingVertices(Object.assign(e,{enclosed:!0}))}Ru(e){let t=this.viewport.getGroupElement(e.id);return t==null?null:this.$getGroupContentAreaElement(t.el)}$_getGroupContentAreaInfo(e){let t=this.viewport.getGroupElement(e);if(t==null)return{pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0},contentArea:null,isGroupElement:!0};{let n=this.$getGroupContentAreaElement(t.el);if(n!==t.el){let o=this.$getElementPositionInUIRelativeToParent(n);return{pageOrigin:{x:t.x+o.x,y:t.y+o.y},internalOffset:{x:o.x,y:o.y},contentArea:n,isGroupElement:!1}}else return{pageOrigin:{x:t.x,y:t.y},internalOffset:{x:0,y:0},contentArea:t.el,isGroupElement:!0}}}getElementPosition(e){return this.viewport.getElementPosition(e)}getElementSize(e){return this.viewport.getElementSize(e)}getElement(e){return this.viewport.getElement(e)}getGroupElement(e){return this.viewport.getGroupElement(e)}getObjectInfo(e,t){if(e==null)return{id:null,obj:null,el:null,type:null,managedElement:null};if(sa(e)){let n=e.edge;return{obj:n,id:n.id,type:Ue.objectType,el:e.connector.canvas,managedElement:null}}else if(this.$isElement(e)){let n=this.getModelObjectFromElement(e,!0,t);if(n!=null){let o=this.dataSource.resolveFullId(n.obj);return{el:n.el,obj:n.obj,type:n.obj.objectType,id:o,managedElement:this.getElement(o)}}else{let o=this.W(e);return{id:o,obj:null,el:e,type:null,uiOnly:!0,managedElement:this.getElement(o)}}}else{let n=this.dataSource.getObjectInfo(e);return n.obj!=null?n.type===Ue.objectType?Object.assign({el:this.getRenderedConnection(n.id).connector.canvas,managedElement:null},n):Object.assign({el:this.getRenderedElement(n.obj),managedElement:this.getElement(n.obj.getFullId())},n):Object.assign({el:null,managedElement:null},n)}}Al(){let e=this.dataSource.getNodes().filter(t=>t.group==null);return e.push(...this.dataSource.getGroups().filter(t=>t.group==null)),e}Ff(e,t,n,o,s,a,l,h,d,u){let p={invertTrackbackPreference:u};if(t&&(p.origin=t),n&&(p.gather=n),!h&&!d&&this.magnetizer.setElements(a),e){let m=this.getObjectInfo(e,!1);if(m.obj)if(!l)p.focus=m.obj.id;else{let E=this.getElement(m.obj.id);p.origin={x:E.x+E.width/2,y:E.y+E.height/2},p.filter=y=>y===m.obj.id}}o&&(p.knownLocations=o),s&&(p.knownSizes=s);let g=this.getGrid();return g&&(p.grid=g),p}Ss(e,t,n,o,s,a,l,h,d,u){a==null&&(a=h?[]:this.Al());let p=this.Ff(e,t,n,o,s,a,l,h,d,u);return p.focus!=null?this.magnetizer.executeWithFocus(p.focus,p):t!=null?this.magnetizer.executeAtPoint(t,p):this.magnetizer.executeAtCenter(p)}bs(e,t,n,o,s,a,l,h,d){let u=this.Ss(e,t,n,o,s,null,a,l,h,d);this.Ts(u,bA)}magnetize(e,t){this.bs(e,null,!1,null,null,t,!1,!1,!1)}$provisionallyMagnetize(e,t,n,o,s,a){return this.Ss(e,null,!1,n,o,null,t,!1,s,a)}$provisionallyGather(e,t,n,o,s){return this.Ss(e,null,!0,t,n,null,!1,!1,o,s)}magnetizeAtPoint(e){this.bs(null,e,!1,null,null,null,!1,!1,!1)}gather(e){this.bs(e,null,!0,null,null,null,!1,!1,!1)}$startMagnetizer(){this.magnetizer.startTracking(this.Al(),this.magnetizerProfile.trackback,this.magnetizerProfile.trackbackThreshold)}$stopMagnetizer(){this.magnetizer.stopTracking()}$startMotion(){this.$isInMotion=!0}$stopMotion(){this.$isInMotion=!1}Fu(e){return{[this.$modelLeftAttribute]:e.x,[this.$modelTopAttribute]:e.y}}Uf(e,t){let n=this.Fu(t);this.model.updateVertex(e,n)}Ts(e,t,n){this.model.openTransaction(ut);try{for(let o in e.current){let s=this.Fu(e.current[o]);this.model.$_updateVertex(o,s,t,!1)}n&&n()}catch(o){U("Exception thrown when setting position",o)}finally{this.model.commitTransaction()}}$storePositionInModel(e){let t=typeof e=="string"?e:e.id,n=typeof e=="string"?null:e.pos,o=this.getModelPositionAttributes(),s=typeof e=="string"?o.x:e.leftAttribute||o.x,a=typeof e=="string"?o.y:e.topAttribute||o.y,l=e.obj||this.dataSource.getVertex(t);return l&&(n==null&&(n=this.getElementPosition(l.id)),De(l.data,s,n.x),De(l.data,a,n.y)),n}$f(e,t){let n=X(e)?this.dataSource.getVertex(e):e;n&&(t==null&&(t=this.getElementSize(n.id)),De(n.data,this.$modelWidthAttribute,t.width),De(n.data,this.$modelHeightAttribute,t.height))}setMagnetizedPosition(e,t,n){this.setPosition(e,t,n,!0)}setPosition(e,t,n,o,s){let a=this.getObjectInfo(e,!1);if(a.obj)if(a.obj.group==null){let l=this.zf(a.obj,t,n,o,s===!1,!1,!1,!1);this.Ts(l,Id)}else{let l=a.obj.group,h=this.viewport.getGroupElement(l.id);if(h!=null){let d={[a.id]:{x:t+h.x,y:n+h.y}},u={[a.id]:{x:t,y:n}},p=this.viewport.$computeGroupContentExtents(l,!1,d,null,null);this.Ts({original:{},current:u},Id,()=>{this.yl(l,u,null,{[l.id]:p})})}}}adHocGroupLayout(e,t){if(t){let n=this.dataSource.getObjectInfo(e);if(n.obj){let o=this.layoutMap.get(n.id);this.layoutMap.set(n.id,this.Lu(t,n.obj)),this.relayoutGroup(n.obj,hA),this.layoutMap.set(n.id,o)}}}getGroupDefinition(e){return this.view.getGroupDefinition(this.model.getNodeType(e.data))}getPortDefinition(e){return this.view.getPortDefinition(this.model.getPortType(e.data))}getNodeDefinition(e){return this.view.getNodeDefinition(this.model.getNodeType(e.data))}zf(e,t,n,o,s,a,l,h){let d={x:t,y:n};if(o){let u=this.Ss(e,{x:t,y:n},!1,{[e.id]:{x:t,y:n}},null,null,s,a,l,h);return u.original[e.id]={x:t,y:n},u.current[e.id]={x:t,y:n},u}else return this.Yf()&&(d=he(d,this.getGrid())),{original:{[e.id]:d},current:{[e.id]:d}}}getModelPositionAttributes(){return{x:this.$modelLeftAttribute,y:this.$modelTopAttribute}}storePositionsInModel(e){e=e||{};let t=this.getModelPositionAttributes(),n=e.leftAttribute||t.x,o=e.topAttribute||t.y,s=(a,l)=>{let h=this.getElement(l.id);De(l.data,n,h.x),De(l.data,o,h.y)};this.dataSource.eachNode((a,l)=>s(a,l)),this.dataSource.eachGroup((a,l)=>s(a,l))}setGrid(e){this.gridProfile==null?this.gridProfile=new Jl({size:e}):this.gridProfile.grid=e}getGrid(){return this.gridProfile==null?null:this.gridProfile.grid}Yf(){return this.gridProfile!=null&&this.gridProfile.snap}oS(e){if(this.gridProfile!=null){let t=this.$getSize(e),n=he({x:t.width,y:t.height},this.gridProfile.grid);return this.$setElementSizeInUI(e,n.x,n.y),{width:n.x,height:n.y}}return null}snapToGrid(e,t){t=t||this.getGrid();let n;if(t){e!=null&&(n=this.getObjectInfo(e,!1).obj),n!=null?this.magnetizer.setElements([n]):this.magnetizer.setElements(this.Al());let o=this.magnetizer.snapToGrid(t);return this.Ts(o,AA),o}}autoSizeGroup(e,t){let n=new Set;return n.add(e),this.$_sizeGroupsToFit(n,null,null,t)[e.id]}$_sizeGroupsToFit(e,t,n,o){let s=this.$u(Array.from(e));t=t||{},n=n||{};let a={};return s.forEach(l=>{if(a[l.group.id]==null){let h=this.Xf(l.group,o,t,n);Object.assign(a,h)}}),this.$trackGroupSizeChanges(a),a}Xf(e,t,n,o){let s={};n=n||{},o=o||{};let a=l=>{let h=this.viewport.getGroupElement(l.id),d=this.viewport.$computeGroupContentExtents(l,!1,null,o,null),u=this.xl(l,n,o,d,t);u!=null&&(o[l.id]=u.size,s[l.id]={element:h,newGroupSize:u.size,originalGroupSize:u.originalSize},l.group&&a(l.group))};return e&&a(e),s}Bf(){let e={orderedGroups:this.Gf(),info:{}};return e.orderedGroups.forEach(t=>{let n=this.layoutMap.get(t.group.id);if(n!=null){let o=this.viewport.getGroupElement(t.group.id);n.relayout(null,s=>{e.info[t.group.id]={positions:s.positions,sizes:s.sizes,extents:s.bounds,element:o}})}}),e}getGroupContentExtents(e,t){return this.viewport.$computeGroupContentExtents(e,t,null,null,null)}$trackGroupSizeChanges(e){for(let t in e){let n=e[t];if(n.originalGroupSize.width!==n.newGroupSize.width||n.originalGroupSize.height!==n.newGroupSize.height){let o=n.element.modelObject,s={[this.$modelWidthAttribute]:n.newGroupSize.width,[this.$modelHeightAttribute]:n.newGroupSize.height};o.data[this.$modelWidthAttribute]=n.newGroupSize.width,o.data[this.$modelHeightAttribute]=n.newGroupSize.height;let a=this.viewport.updateElement(o.id,null,null,n.newGroupSize.width,n.newGroupSize.height,null,null,!1);this.$doVertexUpdated(a),this.$repaintUIElement(a,null,!0),this.model.fire(nd,{group:o,originalGroupSize:n.originalGroupSize,newGroupSize:n.newGroupSize,source:this}),this.se(l=>{l.$groupResized(n)}),this.model.fire(ve,{vertex:o,updates:s,originalData:o.data,reason:xA},null)}}}xl(e,t,n,o,s){t=t||{},n=n||{};let a=this.getGroupDefinition(e),l=s||a.autoShrink||a.autoGrow||a.autoSize||a.elastic,h=a.autoShrink===!0||a.elastic===!0||a.autoSize===!0&&a.autoShrink!==!1,d=a.autoGrow===!0||a.elastic===!0||a.autoSize===!0&&a.autoGrow!==!1;if(!l)return null;let u=P=>t[P]||this.getElementPosition(P),p=P=>n[P]||this.getElementSize(P),g=this.$_getGroupContentAreaInfo(e.id),m=g.contentArea,E=0,y=0,x,f,b=p(e.id),A=g.isGroupElement?p(e.id):this.$getSize(m),T=Math.max(A.width,b.width),S=Math.max(A.height,b.height),O=Object.assign({},u(e.id)),v,_=null;if(_!=null)E=_.layoutShiftX,y=_.layoutShiftY,x=_.width,f=_.height,v={x:O.x-E,y:O.y-y};else{let P=Mu(o,a,!1,h,d,this.gridProfile);x=P.width,f=P.height,E=P.layoutShiftX,y=P.layoutShiftY,v={x:O.x-E,y:O.y-y}}if(x=parseInt(x,10),f=parseInt(f,10),this.$setElementSizeInUI(m,x,f),!g.isGroupElement){let P=this.viewport.getGroupElement(e.id),I=this.$getSize(P.el),C=I.width-T,R=I.height-S;if(!s&&h===!1){let w=!1;C<0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),R<0&&(this.$setElementHeight(m,S-g.internalOffset.y),R=0,w=!0),w&&(I=this.$getSize(P.el))}if(!s&&d===!1){let w=!1;C>0&&(this.$setElementWidth(m,T-g.internalOffset.x),C=0,w=!0),R>0&&(this.$setElementHeight(m,S-g.internalOffset.y),R=0,w=!0),w&&(I=this.$getSize(P.el))}x=I.width,f=I.height}return{position:v,size:{width:x,height:f},originalSize:{width:T,height:S},layoutShiftX:E,layoutShiftY:y}}autoSizeGroups(e,t){return e=e||this.getGroups(),this.$_sizeGroupsToFit(new Set(e),null,null,t)}Uu(e){let t={container:this.fe,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createDefaultLayoutAdapter()};return t.options.locationFunction||(t.options.locationFunction=n=>({x:De(n.data,this.$modelLeftAttribute),y:De(n.data,this.$modelTopAttribute)})),Ke.get(e.type,t)}Lu(e,t){let n=this.Ru(t);n==null&&(n=this.$getManagedElement(t.id).el);let o={container:n,options:e.options||{},instance:this.model,dataSource:this.dataSource,adapter:this.$createGroupLayoutAdapter(t)};return o.options.locationFunction||(o.options.locationFunction=s=>{let a={x:De(s.data,this.$modelLeftAttribute),y:De(s.data,this.$modelTopAttribute)};return X(a.x)&&(a.x=parseInt(a.x,10)),X(a.y)&&(a.y=parseInt(a.y,10)),a}),Ke.get(e.type,o)}setLayout(e,t){e&&(this.$_layout=this.Uu(e),t||this.refresh())}adHocLayout(e){e&&this.model.transaction(()=>{for(let n in this.$_connMap){let o=this.$_connMap[n].edge;this.model.clearEdgeGeometry(o)}this.Uu(e).layout(n=>{for(let o in n.positions)this.Uf(o,n.positions[o])})})}$_doRenderTransientVertex(e,t,n,o,s,a,l){let h=this.$renderTransientVertex(t,n,o,s,a,l);return this.$appendVertexElement(h),this.$manage(h,e,t,n,null,!1)}$addTransientVertex(e,t,n,o,s,a){let l=this.model.$addTransientVertex(n,this),h=this.$_doRenderTransientVertex(l,e,t,n,o,s,a);return{vertex:l,el:h}}$renderDummyVertex(e){let t={x:e.data[this.$modelLeftAttribute]||0,y:e.data[this.$modelTopAttribute]||0};this.$_doRenderTransientVertex(e,t,{width:1,height:1},e.data,{},[ki,$S].join(" "),{[te]:e.id})}$removeTransientVertex(e){this.model.$cleanupTransientVertex(e.modelObject,this)}$addTransientEdge(e,t,n,o){return this.model.$addTransientEdge(this,e,t,n,null,o)}$isUnattachedEdgeAllowed(e){let t=this.model.getEdgeType(e.data),n=this.view.getEdgeDefinition(t);return n.allowUnattached!=null?n.allowUnattached:this.$_allowUnattachedEdges===!0}zu(e){(e.plugins||[]).forEach(n=>{this.Yu(n,!0)})}addPlugin(e){return this.Yu(e,!0)}Yu(e,t){let n=X(e)?e:e.type,o=X(e)?{}:e.options||{},s=cn.get(n);if(s!=null)return s.initialise(this,o),this.plugins.push(s),this.pluginMap.set(n,s),s.tracksEdgeRedraws&&this.dl.push(s),t&&this.fire(vd,s),s}getPlugin(e){return this.pluginMap.get(e)}se(e){this.plugins.forEach(t=>{try{e(t)}catch(n){U(`WARN: could not dispatch event to plugin ${t.id} [${n}]`)}})}registerDataHook(e){this.$_dataHooks.push(e)}save(e){let t={data:this.model.exportData(e),zoom:this.K};return this.$_dataHooks.forEach(n=>{n.save(t)}),t}saveToUrl(e){this.model.save(Object.assign(e,{data:this.save(e)}))}load(e,t){this.model.load({data:e.data,onload:()=>{e.zoom&&this.setZoom(e.zoom),this.$_dataHooks.forEach(n=>{n.load(e)}),t&&t()}})}$isArrayLike(e){return!X(e)&&Array.isArray(e)}};var wV=20,DV=20,nf=class nf extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"length");c(this,"foldback");c(this,"direction");c(this,"type",nf.type);c(this,"contentTags",[q]);n=n||{},this.width=n.width||wV,this.length=n.length||DV,this.direction=(n.direction||1)<0?-1:1,this.foldback=n.foldback||.623}draw(e,t,n){let o,s,a,l,h;if(this.location>1||this.location<0){let m=this.location<0?1:0;o=$e(e,m,this.location,!1),s=$e(e,m,this.location-this.direction*this.length/2,!1),a=jt(o,s,this.length)}else if(this.location===1){if(o={x:e.paintInfo.tx,y:e.paintInfo.ty},s=$e(e,this.location,-this.length),a=jt(o,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else if(this.location===0){if(a={x:e.paintInfo.sx,y:e.paintInfo.sy},s=$e(e,this.location,this.length),o=jt(a,s,this.length),this.direction===-1){let m=a;a=o,o=m}}else o=$e(e,this.location,this.direction*this.length/2),s=pr(e,this.location),a=jt(o,s,this.length);l=Dt(o,a,this.width),h=jt(o,a,this.foldback*this.length);let{stroke:d,fill:u,lineWidth:p}=this.$getStyle(t);return{atts:[{d:isNaN(h.x)||isNaN(h.y)?"M 0 0":"M"+o.x+","+o.y+" L"+l[0].x+","+l[0].y+" L"+h.x+","+h.y+" L"+l[1].x+","+l[1].y+" Z","stroke-width":p,stroke:d,fill:u}],xmin:Math.min(o.x,l[0].x,l[1].x),xmax:Math.max(o.x,l[0].x,l[1].x),ymin:Math.min(o.y,l[0].y,l[1].y),ymax:Math.max(o.y,l[0].y,l[1].y),tail:h}}};c(nf,"type","Arrow");var Or=nf;at.register(Or.type,Or);var of=class of extends Or{constructor(e,t,n){super(e,t,n);c(this,"type",of.type);this.foldback=1}};c(of,"type","PlainArrow");var Gu=of;at.register(Gu.type,Gu);var sf=class sf extends Or{constructor(e,t,n){super(e,t,n);c(this,"type",sf.type);this.length=this.length/2,this.foldback=2}};c(sf,"type","Diamond");var $u=sf;at.register($u.type,$u);var af="Custom",lf=class extends li{constructor(e,t,n){super(t,n);this.connection=t;c(this,"create");c(this,"isSimpleShape",!1);c(this,"rotatable");c(this,"type",af);this.create=n.create,this.rotatable=n.rotatable}updateFrom(e,t){}};function dn(i){return i.type===af}at.register(af,lf);var EL=5,hf=class hf extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"Oe");c(this,"Zr");c(this,"type",hf.type);c(this,"contentTags",[Be]);n=n||{},this.Oe=n.radius||EL,this.Zr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h;if(this.location===0)if(this.Zr==="center")l={x:e.paintInfo.sx,y:e.paintInfo.sy},h=$e(e,this.location,this.Oe);else{let d={x:e.paintInfo.sx,y:e.paintInfo.sy},u=$e(e,this.location,this.Oe);l=jt(d,u,this.Oe),h=$e(e,this.location,2*this.Oe)}else if(this.location===1)if(this.Zr==="center")l={x:e.paintInfo.tx,y:e.paintInfo.ty},h=$e(e,this.location,-this.Oe);else{let d={x:e.paintInfo.tx,y:e.paintInfo.ty},u=$e(e,this.location,-this.Oe);l=jt(d,u,this.Oe),h=$e(e,this.location,-2*this.Oe)}else l=pr(e,this.location),h=$e(e,this.location,this.Oe);return{atts:[{cx:l.x,cy:l.y,r:this.Oe,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.Oe,xmax:l.x+this.Oe,ymin:l.y-this.Oe,ymax:l.y+this.Oe,tail:h}}};c(hf,"type","Dot");var Bu=hf;at.register(Bu.type,Bu);var fL=10,yL=10,cf=class cf extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"width");c(this,"height");c(this,"Xu");c(this,"Zr");c(this,"type",cf.type);c(this,"contentTags",[q]);n=n||{},this.width=n.width||fL,this.height=n.height||yL,this.Xu=n.rotate===!0,this.Zr=n.align||"flush"}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,O;if(this.Xu){if(this.location===0){let v={x:e.paintInfo.sx,y:e.paintInfo.sy},_,P;this.Zr==="center"?(P=$e(e,this.location,this.width/2),_=jt(P,v,this.width)):(_=v,P=$e(e,this.location,this.width)),S=Dt(P,_,this.height),O=Dt(_,P,this.height),g=P}else if(this.location===1){let v={x:e.paintInfo.tx,y:e.paintInfo.ty},_,P;this.Zr==="center"?(P=$e(e,this.location,-this.width/2),_=jt(P,v,this.width)):(_=v,P=$e(e,this.location,-this.width)),S=Dt(_,P,this.height),O=Dt(P,_,this.height),g=P}else{let v=$e(e,this.location,this.width/2),_=pr(e,this.location),P=jt(v,_,this.width);S=Dt(v,P,this.height),O=Dt(P,v,this.height),g=P}m=S[0].x,E=S[0].y,y=S[1].x,x=S[1].y,f=O[1].x,b=O[1].y,A=O[0].x,T=O[0].y}else{let v;this.location===0?v={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?v={x:e.paintInfo.tx,y:e.paintInfo.ty}:v=pr(e,this.location),g=v,m=v.x-this.width/2,E=v.y-this.height/2,y=m+this.width,x=E,f=y,b=E+this.height,A=m,T=E+this.height}return h=Math.min(m,y,f,A),d=Math.max(m,y,f,A),u=Math.min(E,x,b,T),p=Math.max(E,x,b,T),l=`M ${m} ${E} L ${y} ${x} L ${f} ${b} L ${A} ${T} Z`,{atts:[{"stroke-width":a,stroke:o,fill:s,d:l}],xmin:h,xmax:d,ymin:u,ymax:p,tail:g}}};c(cf,"type","Rectangle");var Fu=cf;at.register(Fu.type,Fu);var xL=8,bL=5,df=class df extends Nn{constructor(e,t,n){super(e,t,n);this.component=t;c(this,"rx");c(this,"ry");c(this,"type",df.type);c(this,"contentTags",[gT]);n=n||{},this.rx=n.rx||xL,this.ry=n.ry||bL}draw(e,t,n){let{stroke:o,fill:s,lineWidth:a}=this.$getStyle(t),l;return this.location===0?l={x:e.paintInfo.sx,y:e.paintInfo.sy}:this.location===1?l={x:e.paintInfo.tx,y:e.paintInfo.ty}:l=pr(e,this.location),{atts:[{cx:l.x,cy:l.y,rx:this.rx,ry:this.ry,"stroke-width":a,stroke:o,fill:s}],xmin:l.x-this.rx,xmax:l.x+this.rx,ymin:l.y-this.ry,ymax:l.y+this.ry,tail:$e(e,this.location,(this.ry+this.rx)/2)}}};c(df,"type","Ellipse");var Uu=df;at.register(Uu.type,Uu);var Yu=class{constructor(r,e){this.surface=r;c(this,"ar");c(this,"ju");e=e||{edgeMappings:[]},this.ar=e.edgeMappings||[],this.ju=this.surface.model.edgeTypeFunction,this.jf()}computeTypes(r){let e=[this.ju(r)];for(let t=0;t<this.ar.length;t++){let n=this.ar[t].property,o=this.ar[t].mappings;if(X(n)){if(r[n]!=null){let s=X(r[n])?r[n].split(" "):[r[n]];e.push(...s.filter(a=>o[a]!=null).map(a=>`${n}_${a}`))}o[gr]!=null&&r[n]!=null&&e.push(`${n}_${gr}`)}else{let s=n.map(a=>r[a]);if(s.every(a=>a!=null)){let a=s.join(" ");o[a]!=null&&e.push(`${n.join("_")}_${a.replace(/ /g,"_")}`)}}}return e.join(" ")}jf(){for(let r=0;r<this.ar.length;r++){let e=this.ar[r].property,t=this.ar[r].mappings;for(let n in t)if(t.hasOwnProperty(n)){let o=X(e)?`${e}_${n}`:`${e.join("_")}_${n.replace(/ /g,"_")}`;this.surface.$registerConnectionType(o,t[n])}}this.surface.model.edgeTypeFunction=r=>this.computeTypes(r)}getPropertyMappings(){return this.ar}};function NV(i,r,e,t,n,o,s){return new Touch({target:i,identifier:G(),pageX:r,pageY:e,screenX:t,screenY:n,clientX:o||t,clientY:s||n})}function IV(...i){let r=[];return r.push(...i),r.item=function(e){return this[e]},r}function MV(i,r,e,t,n,o,s){return IV(NV(i,r,e,t,n,o,s))}function Kl(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function zu(i){return i.srcElement||i.target}function xT(i,r,e,t){if(t){let n=i.composedPath?i.composedPath():i.path;if(typeof n!="undefined"&&n.indexOf)return{path:n,end:n.indexOf(e)};{let o={path:[],end:-1},s=a=>{o.path.push(a),a===e?o.end=o.path.length-1:a.parentNode!=null&&s(a.parentNode)};return s(r),o}}else return{path:[r],end:1}}function VV(i,r){let e=0,t;for(e=0,t=i.length;e<t&&i[e][0]!==r;e++);e<i.length&&i.splice(e,1)}var GV=1,AL=!1,SL=!1;function In(){return AL||"ontouchstart"in document.documentElement||navigator.maxTouchPoints!=null&&navigator.maxTouchPoints>0}function ci(){return SL||"onmousedown"in document.documentElement}function PL(i){AL=i}function _L(i){SL=i}var Ji={[ge]:jb,[le]:Hb,[ae]:kb};function bT(i,r){if(i==null)return{x:0,y:0};let e=Zo(i),t=mf(e,0);return r(t)}function me(i){return bT(i,r=>({x:r.pageX,y:r.pageY}))}function $V(i){return bT(i,r=>({x:r.screenX,y:r.screenY}))}function BV(i){return bT(i,r=>({x:r.clientX,y:r.clientY}))}function mf(i,r){return i.item?i.item(r):i[r]}function Zo(i){return i.touches!=null&&i.touches.length>0?i.touches:i.changedTouches&&i.changedTouches.length>0?i.changedTouches:i.targetTouches&&i.targetTouches.length>0?i.targetTouches:[i]}function vT(i){return Zo(i).length}function OL(i){if(i==null)return{x:0,y:0};if(i.pageX!==null)return{x:i.pageX,y:i.pageY};{let r=Zo(i),e=mf(r,0);return e!=null&&e.pageX!=null?{x:e.pageX,y:e.pageY}:{x:0,y:0}}}function uf(i,r,e,t,n){vL(i,r,e),t.lr=e.lr,i.addEventListener&&i.addEventListener(r,e,!1,n)}function Xu(i,r,e){e!=null&&TL(i,t=>{FV(t,r,e),e.lr!=null&&t.removeEventListener&&(t.removeEventListener(r,e,!1),In()&&Ji[r]&&t.removeEventListener(Ji[r],e,!1)),e.ku&&Xu(i,e.ku[1],e.ku[0])})}function TL(i,r){if(i==null)return;let e=typeof i=="string"?document.querySelectorAll(i):Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++)r(e[t])}function vL(i,r,e){let t=GV++;return i.Jr=i.Jr||{},i.Jr[r]=i.Jr[r]||{},i.Jr[r][t]=e,e.lr=t,t}function FV(i,r,e){if(i.Jr&&i.Jr[r]&&delete i.Jr[r][e.lr],e.Kr){for(let t=0;t<e.Kr.length;t++)Xu(i,e.Kr[t][0],e.Kr[t][1]);e.Kr.length=0}e.Sl&&e.Sl()}var UV=/:not\(([^)]+)\)/;function pf(i,r,e,t){if(i==null)return e;{let n=i.split(","),o=[],s=[];n.forEach(l=>{let h=l.match(UV);h!=null?s.push(h[1]):o.push(l)}),s.length>0&&o.length===0&&o.push(gr);let a=l=>{a.lr=e.lr;let h=zu(l),d=!1,u=h,p=xT(l,h,r,i!=null);if(p.end!=-1)for(let g=0;!d&&g<p.end;g++){u=p.path[g];for(let m=0;m<s.length;m++)if(Kl(u,s[m],r))return;for(let m=0;!d&&m<o.length;m++)if(Kl(u,o[m],r)){e.apply(u,[l,u]),d=!0;break}}};return YV(e,t,a),a}}function YV(i,r,e){i.Kr=i.Kr||[],i.Kr.push([r,e])}var gf=(i,r,e,t,n)=>{if(In()&&Ji[r]){let o=pf(t,i,e,Ji[r]);uf(i,Ji[r],o,e,n)}r===zb&&i.getAttribute(NE)==null&&i.setAttribute(NE,"1"),uf(i,r,pf(t,i,e,r),e,n)},AT={[W]:{touches:1,taps:1},[zr]:{touches:1,taps:2},[At]:{touches:2,taps:1}};function CL(i,r,e,t){for(let n in e.Me[i])e.Me[i].hasOwnProperty(n)&&e.Me[i][n].apply(t,[r])}var ST=class{static generate(r,e){return(t,n,o,s)=>{if(n==At&&ci())gf(t,n,o,s);else{if(t.ke==null){let a=t.ke={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},l=function(){a.down=!1},h=function(){a.taps=0},d=p=>{let g=zu(p),m=xT(p,g,t,s!=null),E=!1;for(let y=0;y<m.end;y++){if(E)return;g=m.path[y];for(let x=0;x<a.downSelectors.length;x++)if(a.downSelectors[x]==null||Kl(g,a.downSelectors[x],t)){a.down=!0,setTimeout(l,r),setTimeout(h,e),E=!0;break}}},u=p=>{if(a.down){let g=zu(p),m,E;a.taps++;let y=vT(p);for(let x in AT)if(AT.hasOwnProperty(x)){let f=AT[x];if(f.touches===y&&(f.taps===1||f.taps===a.taps))for(let b=0;b<a[x].length;b++){E=xT(p,g,t,a[x][b][1]!=null);for(let A=0;A<E.end;A++)if(m=E.path[A],a[x][b][1]==null||Kl(m,a[x][b][1],t)){a[x][b][0].apply(m,[p,m]);break}}}}};t.ke.downHandler=d,t.ke.upHandler=u,gf(t,ge,d),gf(t,le,u)}t.ke.downSelectors.push(s),t.ke[n].push([o,s]),o.Sl=function(){t.ke!=null&&(Nt(t.ke.downSelectors,a=>a===s),VV(t.ke[n],o),t.ke.downSelectors.length===0&&(Xu(t,ge,t.ke.downHandler),Xu(t,le,t.ke.upHandler),delete t.ke))}}}}},TT=class{static generate(){let r=[];return(e,t,n,o)=>{if(!e.Me){e.Me={over:!1,mouseenter:[],mouseexit:[]};let s=l=>{let h=zu(l);(o==null&&h==e&&!e.Me.over||Kl(h,o,e)&&(h.Me==null||!h.Me.over))&&(CL(Xm,l,e,h),h.Me=h.Me||{},h.Me.over=!0,r.push(h))},a=l=>{let h=zu(l);for(let d=0;d<r.length;d++)h==r[d]&&!Kl(l.relatedTarget||l.toElement,"*",h)&&(h.Me.over=!1,r.splice(d,1),CL(jm,l,e,h))};uf(e,st,pf(o,e,s,st),s),uf(e,ot,pf(o,e,a,ot),a)}n.Sl=function(){delete e.Me[t][n.lr]},vL(e,t,n),e.Me[t][n.lr]=n}}},ye=class{constructor(r){c(this,"clickThreshold");c(this,"dblClickThreshold");c(this,"tapHandler");c(this,"mouseEnterExitHandler");r=r||{},this.clickThreshold=r.clickThreshold||250,this.dblClickThreshold=r.dblClickThreshold||450,this.mouseEnterExitHandler=TT.generate(),this.tapHandler=ST.generate(this.clickThreshold,this.dblClickThreshold)}kf(r,e,t,n,o){if(t==null)return;let s=r;e===W||e===zr||e===At?this.tapHandler(s,e,t,n,o):e===Xm||e==jm?this.mouseEnterExitHandler(s,e,t,n,o):gf(s,e,t,n,o)}on(r,e,t,n,o){let s=n==null?null:t,a=n==null?t:n;return this.kf(r,e,a,s,o),this}off(r,e,t){return Xu(r,e,t),this}trigger(r,e,t,n,o){let s=ci()&&(typeof MouseEvent=="undefined"||t==null||t.constructor===MouseEvent),a=In()&&!ci()&&Ji[e]?Ji[e]:e,l=!(In()&&!ci()&&Ji[e]),h=me(t),d=$V(t),u=BV(t);return TL(r,p=>{let g;t=t||{screenX:d.x,screenY:d.y,clientX:u.x,clientY:u.y};let m=f=>{n&&(f.payload=n)},E={TouchEvent:f=>{let b=MV(p,h.x,h.y,d.x,d.y,u.x,u.y);(f.initTouchEvent||f.initEvent)(a,!0,!0,window,null,d.x,d.y,u.x,u.y,!1,!1,!1,!1,b,b,b,1,0)},MouseEvents:f=>{f.initMouseEvent(a,!0,!0,window,o==null?1:o,d.x,d.y,u.x,u.y,t.ctrlKey===!0,t.altKey===!0,t.shiftKey===!0,t.metaKey===!0,1,p)}},y=!l&&!s&&In()&&Ji[e],x=y?"TouchEvent":"MouseEvents";g=document.createEvent(x),E[x](g),m(g),p.dispatchEvent(g)}),this}};var zV=["stroke-linejoin","stroke-dashoffset","stroke-linecap"];function ie(i,r){for(let e in r){let t=r[e];if(e==="style"&&typeof t=="object"){let n=Object.entries(t);for(let o=0;o<n.length;o++){let s=n[o];i.style[s[0]]=s[1]}}else i.setAttribute(e,""+r[e])}}function M(i,r,e,t){return r=r||{},la(Gt,i,e,t,r)}function RL(i,r){let e=r.map(t=>M("stop",{offset:`${t[0]}%`,"stop-color":t[1]}));i.replaceChildren(...e)}function XV(i,r){i.gradient==null&&(i.gradient=M("linearGradient",{id:Eo(),gradientUnits:"userSpaceOnUse"}),i.canvas.insertBefore(i.gradient,i.canvas.childNodes[0])),i.gradient.setAttribute("x1",`${i.x}`),i.gradient.setAttribute("x2",`${i.x+i.width}`),RL(i.gradient,r)}function CT(i,r,e){let t=Eo(),n=M("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,x2:r});return RL(n,e),{id:t,g:n}}function Ef(i,r,e,t){r.setAttribute(dT,e.fill?e.fill:pt),!t&&e.gradient?(XV(i,e.gradient),r.setAttribute(qE,`url(#${i.gradient.id})`)):r.setAttribute(qE,e.stroke?e.stroke:pt),e.strokeWidth&&r.setAttribute(uT,e.strokeWidth),e.dashArray?r.setAttribute(ef,e.dashArray):r.removeAttribute(ef),zV.forEach(n=>{e[n]&&r.setAttribute(n,e[n])})}function aa(i,r,e){e>=0?i.insertBefore(r,i.childNodes[e]):i.appendChild(r)}function jV(i,r,e){let t=[];return i!=null&&i.split(/\n/).forEach(o=>{t.push(...HV(o,r,e))}),t}function HV(i,r,e){let t=(i||"").split(/\s/),n=[];if(t.length===0)return[];if(t.length===1)return[i];let o=[t[0]],s=1,a=0,l=!1,h=M(QE);for(e.appendChild(h);!l;){let d=t.slice(a,s+1),u=d.join(" ");h.innerHTML=u,h.getBBox().width<r||o.length===0?(o=d.slice(),s+=1,s>=t.length&&(l=!0)):(n.push(o),a=s,o=[t[a]],s=a+1,s>=t.length&&(l=!0))}return e.removeChild(h),n.push(o),n.map(d=>d.join(" "))}function kV(i,r,e){return jV(i,r,e).map(t=>{let n=M(QE);return n.innerHTML=t,n})}function ju(i,r,e){let n=i.getAttribute(ee)||"50%",o=kV(r,e,i);i.innerHTML="";let s=0;return o.forEach((a,l)=>{i.appendChild(a),a.setAttribute("dominant-baseline","hanging"),a.setAttribute(ee,n),a.setAttribute("dy",s==0?"0":`${s+3}`),s=a.getBBox().height}),o.length>0&&o[0].setAttribute("dy",`${-i.getBBox().height/2}`),i}var ff="data-vjs-container",yf="data-vjs-group-content",Hu="data-vjs-expanded-content",ku="data-vjs-collapsed-content",Er="data-vjs-enabled",Jo="data-vjs-scope",ql="data-vjs-is-group",WV="element",ZV="connection",qe="div",xf="position",Kr=z(ra),PT=Ae(yf),Mn=z(na),_T=z(fu);function $t(i,r,e){e=e||i.parentNode;let t=e.querySelectorAll(r);for(let n=0;n<t.length;n++)if(t[n]===i)return!0;return!1}function oe(i,r){i.stopPropagation?i.stopPropagation():i.returnValue=!1,!r&&i.preventDefault&&i.preventDefault()}function Bt(i,r,e,t){if(i.contains(e))return null;if(t&&$t(i,r,e))return i;for(i=i.parentNode;i!=null&&i!==e;){if($t(i,r))return i;i=i.parentNode}}function JV(i,r,e){e=e||document.body;let t=[],n=Bt(i,r,e,!1);for(;n!=null;)t.push(n),n=Bt(n,r,e,!1);return t}function Ko(i){return i.srcElement||i.target}function LL(i,r){r=vt(r),typeof i.className.baseVal!="undefined"?i.className.baseVal=r:i.className=r}function bf(i){return i.className!=null?typeof i.className.baseVal=="undefined"?i.className:i.className.baseVal:""}function wL(i,r,e){let t=r==null?[]:Array.isArray(r)?r:r.split(/\s+/),n=e==null?[]:Array.isArray(e)?e:e.split(/\s+/),o=bf(i),s=o.split(/\s+/),a=(l,h)=>{for(let d=0;d<h.length;d++)if(l)s.indexOf(h[d])===-1&&s.push(h[d]);else{let u=s.indexOf(h[d]);u!==-1&&s.splice(u,1)}};a(!0,t),a(!1,n),LL(i,s.join(" "))}function Vn(i){return!X(i)&&!Array.isArray(i)&&i.length!=null&&i.documentElement==null&&i.nodeType==null}function KV(i){return!X(i)&&(Array.isArray(i)||Vn(i))}function RT(i){return!X(i)&&(Array.isArray(i)||Vn(i))}function LT(i){return bf(i)}function L(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?vt(n).split(/\s+/).forEach(s=>{t.classList.add(s)}):wL(t,n))};Vn(i)?i.forEach(t=>e(t,r)):e(i,r)}function un(i,r){return i.classList?i.classList.contains(r):bf(i).indexOf(r)!==-1}function F(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?vt(n).split(/\s+/).forEach(s=>{t.classList.remove(s)}):wL(t,null,n))};Vn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Af(i,r){let e=(t,n)=>{t!=null&&n!=null&&n.length>0&&(t.classList?t.classList.toggle(n):un(t,n)?F(t,n):L(t,n))};Vn(i)?i.forEach(t=>e(t,r)):e(i,r)}function Ut(i,r=[],e=[]){let n=bf(i).split(" ").filter(o=>e.indexOf(o)===-1&&r.indexOf(o)===-1);n.push(...r),LL(i,n.join(" "))}function wT(i,r){let e=null;if(arguments.length===1){if(!X(i)){let t=document.createDocumentFragment();return t.appendChild(i),Array.from(t.childNodes)}e=Array.from(document.querySelectorAll(i))}else e=Array.from(i.querySelectorAll(r));return e}function qr(i,r,e,t){return la(null,i,r,e,t)}function la(i,r,e,t,n){let o=i==null?document.createElement(r):document.createElementNS(i,r);return e=e||{},Object.assign(o.style,e),t&&L(o,t),ie(o,n||{}),o}function Qr(i,r,e,t,n,o,s){let a=la(i,r||qe,e,t,n);return o!=null&&(s?o.insertBefore(a,o.lastChild):o.appendChild(a)),a}function Ki(i,r){let e=i.getBoundingClientRect(),t=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||t.scrollTop,s=window.pageXOffset||n.scrollLeft||t.scrollLeft,a=n.clientTop||t.clientTop||0,l=n.clientLeft||t.clientLeft||0,h=e.top+o-a,d=e.left+s-l;return{x:r?d:Math.round(d),y:r?h:Math.round(h)}}function Wu(i){return i==null?"HTML":i instanceof SVGElement?"SVG":"HTML"}function Lt(i){return Wu(i)==="SVG"}function qi(i){return i.nodeType!=null&&i.nodeType!==3&&i.nodeType!==8}var OT=class i{static setNodeText(r,e){r.text=e;try{r.textContent=e}catch(t){}}static getNodeText(r){return r!=null?r.text||r.textContent:""}static getChild(r,e){let t=null;for(let n=0;n<r.childNodes.length;n++)if(r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e){t=r.childNodes[n];break}return t}static getChildren(r,e){let t=[];for(let n=0;n<r.childNodes.length;n++)r.childNodes[n].nodeType===1&&r.childNodes[n].nodeName===e&&t.push(r.childNodes[n]);return t}static xmlToString(r){try{return new XMLSerializer().serializeToString(r).replace(/\s*xmlns=\"http\:\/\/www.w3.org\/1999\/xhtml\"/g,"")}catch(e){try{return r.xml}catch(t){throw new Error("Cannot serialize XML "+t)}}}static createElement(r,e,t){let n;if(n=document.createElement(r),t&&i.setNodeText(n,t),e)for(let o in e)n.setAttribute(o,e[o]);return n}};function ha(i,r){r=r||150;let e=null;return()=>{window.clearTimeout(e),e=window.setTimeout(i,r)}}function ca(i){let r=new XMLHttpRequest,e=i.type||"GET";if(r){let t=i.dataType===kt?o=>JSON.parse(o):o=>o;r.open(e,i.url,!0);let n=i.headers||{};for(let o in n)r.setRequestHeader(o,n[o]);r.onreadystatechange=()=>{r.readyState===4&&((""+r.status)[0]==="2"?i.success(t(r.responseText)):i.error&&i.error(r.responseText,r.status))},r.send(i.data?JSON.stringify(i.data):null)}else i.error&&i.error("ajax not supported")}function Zu(i,r,e){let t=r.getBoundingClientRect(),n=me(i);return{x:t.width===0?0:(n.x-t.x)/t.width,y:t.height===0?0:(n.y-t.y)/t.height}}function DT(i){return i==null?!1:Object.prototype.toString.call(i).match(/\[object .*Element]/)!=null}function qV(i){return i==null?!1:Object.prototype.toString.call(i)==="[object Text]"}function di(i,r){return"["+i+"='"+r+"']"}function QV(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function e1(i){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",r=>{i(r.matches)})}function z(...i){return i.map(r=>"."+r).join(",")}function t1(...i){return i.join(" ")}function Ae(...i){return i.map(r=>"["+r+"]").join(",")}var Ql=Ae(gt);function eh(i,r,e){return function(t){return t[i]/r*(e?-1:1)}}var DL="deltaY",NL="deltaX",r1="wheelDeltaY",n1="wheelDeltaX",Sf="webkit",th="mac",Ju="win",NT="ie",IT="safari",MT="firefox",VT="default";function IL(i){return i.deltaY*(i.deltaMode===1?25:1)/120}function ML(i){return i.deltaX*(i.deltaMode===1?25:1)/120}var GT={[Sf]:{[th]:eh(DL,120),[Ju]:eh(DL,100)},[IT]:eh(r1,120,!0),[MT]:{[th]:IL,[Ju]:IL},[NT]:function(i){return i.wheelDelta/120},[VT]:function(i){return i.deltaY||i.wheelDelta}},$T={[Sf]:{[th]:eh(NL,120),[Ju]:eh(NL,100)},[IT]:eh(n1,120,!0),[MT]:{[th]:ML,[Ju]:ML},[NT]:function(i){return i.wheelDelta/120},[VT]:function(i){return i.deltaX||i.wheelDelta}},VL=typeof navigator!="undefined",GL=VL?/Mac/.test(navigator.userAgent)?th:Ju:th,rh=VL?navigator.userAgent.indexOf("Firefox")!==-1?MT:/Chrome/.test(navigator.userAgent)?Sf:/Safari/.test(navigator.userAgent)?IT:/WebKit/.test(navigator.userAgent)?Sf:/Trident/.test(navigator.userAgent)?NT:"default":VT,i1=typeof GT[rh]=="function"?GT[rh]:GT[rh][GL],o1=typeof $T[rh]=="function"?$T[rh]:$T[rh][GL],s1=function(i){return i1(i||event)},a1=function(i){return o1(i||event)},l1=function(i,r,e){let t=n=>{let o=s1(n),s=a1(n);n.normalizedWheelDelta=o,(!e||n.metaKey||n.ctrlKey)&&i(n,s,o,n.metaKey||n.ctrlKey)};return i.Hf=t,t},h1=typeof document!="undefined",$L=h1?"onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll":"wheel";function nh(i,r,e,t){let n=l1(r,e,t);return i.addEventListener?i.addEventListener($L,n,!1):i.attachEvent&&i.attachEvent("onmousewheel",n),n}function ih(i,r){let e=r.Hf;e!=null&&(i.removeEventListener?i.removeEventListener($L,e,!1):i.detachEvent&&i.detachEvent("onmousewheel",e))}function BT(i){return i.startEditingPath!=null&&i.stopEditingPath!=null}var FT="vjs-paper",UT="vjs-paper-no-scale",YT="vjs-paper-canvas",zT=20,c1="vjs-paper-node",oh="start",qo="center",sh="end";function XT(i){return Zr(i)&&i.useHTMLElement===!0}var ah=class{constructor(r,e){this.instance=r;this.overlay=e;c(this,"htmlElementOverlay");this.htmlElementOverlay=e}static getElement(r,e,t,n){if(e.contentElement==null){if(n&&t){e.contentElement=n(t);let s=r.overlayClass+" "+(e.cssClass?e.cssClass:"");L(e.contentElement,s)}else e.contentElement=qr(qe,{},r.overlayClass+" "+(e.cssClass?e.cssClass:""));t&&t.edge&&e.contentElement.setAttribute(et,t.edge.id),e.contentElement.setAttribute(mu,e.id);for(let s in e.attributes)e.contentElement.setAttribute(s,e.attributes[s]);e.contentElement.style.position=Qe,r.$appendOverlayElement(e.contentElement);let o="translate(-50%, -50%)";e.contentElement.style.webkitTransform=o,e.contentElement.style.mozTransform=o,e.contentElement.style.msTransform=o,e.contentElement.style.oTransform=o,e.contentElement.style.transform=o,e.visible||L(e.contentElement,zl),e.contentElement.jtk={overlay:e}}return e.contentElement}static destroy(r){r.contentElement&&r.contentElement.parentNode&&r.contentElement.parentNode.removeChild(r.contentElement),delete r.contentElement}};function jT(i,r,e){if(r.contentElements==null){r.contentElements=[];let t=Object.assign({[mu]:r.id},r.attributes);e.forEach(n=>{let o=M(n,t),s=i.overlayClass+" "+(r.cssClass?r.cssClass:"");L(o,s),o.jtk={overlay:r},r.contentElements.push(o)})}return r.contentElements.forEach(t=>{var o;let n=t.parentNode;if(n==null){let s=(o=r.connection)==null?void 0:o.connector;n=s!=null?s.canvas:null,n!=null&&aa(n,t,-1)}}),r.contentElements}function HT(i,r,e,t){let n=r;jT(i,n,r.contentTags);let o=[-t.x,-t.y],s=Object.assign({transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},e.paintStyle);n.contentElements.forEach((a,l)=>{let h=e.atts[l],d=Object.assign(s,h);ie(a,d)})}function lh(i,r){return jT(i,r,r.contentTags)}function Qo(i,r){return jT(i,r,[Q]),r.bgElement==null&&(r.bgElement=M(Z),r.contentElements[0].appendChild(r.bgElement)),r.textElement==null&&(r.textElement=M(tt),r.contentElements[0].appendChild(r.textElement)),r.contentElements}function kT(i,r,e,t){Qo(i,r);let n=rn(r.label)?r.label(r):r.label,o=[-t.x,-t.y],s="translate("+o[0]+","+o[1]+")";r.rotatable&&e.d.rotation&&(s+=` rotate(${e.d.rotation}, ${e.d.loc.x}, ${e.d.loc.y})`);let a={x:e.d.loc.x,y:e.d.loc.y,"text-anchor":"middle","dominant-baseline":"middle","pointer-events":"visibleStroke",transform:s};r.font&&r.font.size&&(a["font-size"]=r.font.size),r.font&&r.font.style&&(a["font-style"]=r.font.style),r.font&&r.font.family&&(a["font-family"]=r.font.family),ie(r.textElement,a),r.textElement.textContent=n;let l=r.textElement.getBBox(),h=i.currentZoom,d=l.width/h,u=l.height/h,p=5,g={transform:s,x:a.x-p-d/2,y:a.y-p-u/2,width:d+2*p,height:u+2*p,fill:n==null||n.length===0?"none":"white"};ie(r.bgElement,g)}function Tf(i,r){i.contentElements!=null&&i.contentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),i.backgroundContentElements!=null&&i.backgroundContentElements.forEach(e=>{e!=null&&e.parentNode!=null&&e.parentNode.removeChild(e)}),delete i.contentElements,delete i.backgroundContentElements}var Ku=class extends li{constructor(){super(...arguments);c(this,"contentElements");c(this,"backgroundContentElements")}};var ui="transform",WT=/translate\(([-0-9\.]+),\s*([-0-9\.]+)\)/,BL=/rotate\(([-0-9\.]+)\)/,d1=/translate\(([-0-9\.]+[%|px|em|rem]?),\s*([-0-9\.]+[%|px|em|rem]+)\)/;function Ze(i){let r=i;return r.width&&r.width.baseVal?f1(r):r.getBBox?y1(r):u1(i)}function gn(i,r){let e=i;return Lt(i.parentElement)?hh(e,r):e.x&&e.x.baseVal?m1(e):p1(e)}function Ie(i,r){let e=i;Lt(i.parentElement)?pn(e,r):(e.x&&e.x.baseVal&&E1(e,r),er(e,r))}function qu(i,r,e){if(i===r)return{x:0,y:0};let t=r.createSVGPoint();if(e){let l=i.getBBox();t.x=l.x,t.y=l.y}else t.x=0,t.y=0;let n=i.getScreenCTM(),o=t.matrixTransform(n),s=r.getScreenCTM().inverse(),a=o.matrixTransform(s);return{x:Math.round(a.x),y:Math.round(a.y)}}function FL(i,r,e,t,n){let o=i;if(o instanceof HTMLElement)o.style[e]=`${r}px`;else if(o[t]&&o[t].baseVal)o.setAttribute(t,r);else if(o.localName===Q){let s=hh(o);s[n]=r,pn(o,s)}}function ZT(i,r){FL(i,r,We,ee,ee)}function JT(i,r){FL(i,r,Te,fe,fe)}function Rr(i,r,e){let t=i;t instanceof HTMLElement?UL(i,r,e):t.width&&t.width.baseVal&&(UL(i,r,e),i.setAttribute(_e,`${r}`),i.setAttribute(Ve,`${e}`))}function KT(i,r){let e=i;e instanceof HTMLElement?YL(i,r):e.width&&e.width.baseVal&&(YL(i,r),i.setAttribute(_e,`${r}`))}function qT(i,r){let e=i;e instanceof HTMLElement?zL(i,r):e.height&&e.height.baseVal&&(zL(i,r),i.setAttribute(Ve,`${r}`))}function u1(i){return{width:i.offsetWidth,height:i.offsetHeight}}function p1(i){return{x:parseFloat(i.offsetLeft),y:parseFloat(i.offsetTop)}}function g1(i){return{x:parseInt(i.style.left,10),y:parseInt(i.style.top,10)}}function er(i,r){i.style.left=r.x+"px",i.style.top=r.y+"px"}function UL(i,r,e){i.style.width=`${r}px`,i.style.height=`${e}px`}function YL(i,r){i.style.width=`${r}px`}function zL(i,r){i.style.height=`${r}px`}function m1(i){try{return{x:parseFloat(i.x.baseVal.value),y:parseFloat(i.y.baseVal.value)}}catch(r){return{x:0,y:0}}}function E1(i,r){i.setAttribute("x",`${r.x}`),i.setAttribute("y",`${r.y}`)}function f1(i){try{return{width:parseFloat(i.width.baseVal.value),height:parseFloat(i.height.baseVal.value)}}catch(r){return{width:0,height:0}}}function y1(i){try{let r=i.getBBox();return{width:r.width,height:r.height}}catch(r){return{width:0,height:0}}}function hh(i,r){let e,t,n,o,s;if(e=i.getAttribute(ui),e!=null){if(t=e.match(WT),o=parseFloat(t[1]),s=parseFloat(t[2]),n=e.match(BL),n!=null){let a=parseFloat(n[1]),l=r||i.getBBox(),h={x:o+l.width/2,y:s+l.height/2},d=Me(h,{x:o,y:s},a),u=Me({x:o,y:s},d,-a);o=u.x,s=u.y}return{x:o,y:s}}else if(e=i.style.transform,e!=null){t=e.match(WT);try{return{x:parseFloat(t[1]),y:parseFloat(t[2])}}catch(a){return{x:0,y:0}}}return{x:0,y:0}}function pi(i,r){if(Lt(i.parentElement)){let t=(i.getAttribute(ui)||"").match(WT);i.setAttribute(ui,(t==null?"":`${t[0]} `)+`rotate(${r})`)}else{let e=(i.style.transform||"").match(d1),t=r==0?"":"rotate("+r+"deg)";i.style.transform=(e==null?"":`${e[0]} `)+t,i.style.transformOrigin="center center"}}function pn(i,r){let t=(i.getAttribute(ui)||"").match(BL);i.setAttribute(ui,`translate(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`+(t==null?"":` ${t[0]}`))}function XL(i,r,e){let t={x:r.x+i.width/2,y:r.y+i.height/2};return Me(r,t,e)}function QT(i,r){let e=XL(i,r,i.r);pn(i.el,e),pi(i.el,i.r)}var Qu=class{static paint(r,e,t){if(t!=null){let n=[r.width,r.height];if(isFinite(n[0])&&isFinite(n[1])){let o={[_e]:""+(n[0]||0),[Ve]:""+(n[1]||0)};ie(r.canvas,o),Ie(r.canvas,r)}}}};var vf="vjs-surface",ev="vjs-surface-direct-render",tv="vjs-surface-touch-device",rv="vjs-surface-pointer-device",Cf="vjs-surface-nopan",Pf="vjs-surface-canvas",_f="vjs-surface-pan",x1="vjs-surface-pan-left",b1="vjs-surface-pan-top",A1="vjs-surface-pan-right",S1="vjs-surface-pan-bottom",Of="vjs-surface-pan-active",Rf="vjs-surface-flash",nv="vjs-flash-vertex",Lf="vjs-surface-panning",wf="vjs-surface-element-dragging",ch="vjs-element-dragging",Df="vjs-group-child-element-dragging",dh="vjs-most-recently-dragged",Gn="vjs-surface-edge-dragging",Nf="vjs-edge-relocating",ep="vjs-edge-will-relocate",iv="vjs-lasso",uh="vjs-lasso-mask",ov="vjs-lasso-mask-left",sv="vjs-lasso-mask-top",av="vjs-lasso-mask-right",lv="vjs-lasso-mask-bottom",tp="vjs-miniview",hv="vjs-miniview-canvas",cv="vjs-miniview-panner",dv="vjs-miniview-lasso",uv="vjs-miniview-element",pv="vjs-miniview-group-element",ph="vjs-miniview-selected",If="vjs-miniview-panning",gv="vjs-miniview-collapse",rp="vjs-miniview-collapsed",mv="vjs-miniview-click-to-center",mt="vjs-drag-select-defeat",Mf="vjs-default-node",Vf="vjs-default-group",Qi="vjs-connector-source-drag",eo="vjs-connector-target-drag",Ev="vjs-connector-transient-drag",mn="vjs-palette-selected-element",gh="vjs-palette-tap-mode-active",fv="vjs-palette-drag-active",yv="vjs-palette-drag-hover",xv="vjs-palette-drag-hover-cannot-drop",bv="vjs-palette-current",np="vjs-palette-current-shape-type",mh="vjs-drag-hover-cannot-drop",Gf="vjs-drag-original-group",fr="vjs-drag-active",yr="vjs-drag-hover",$f="vjs-source-hover",Bf="vjs-target-hover",Eh="vjs-hover",Av="vjs-transient-vertex",Ff="vjs-edge-click-entry-method";function T1(i,r){if(r.outlineStroke!=null){let e=r.outlineWidth||1,t=r.strokeWidth+2*e,n=Object.assign({},r);return n.stroke=r.outlineStroke,n.strokeWidth=t,n}else if(i.$paintConnectorOutline){let e=i.$connectorOutlineWidth,t=Object.assign({},r);return t.stroke=i.$connectorOutlineColor||"transparent",t.strokeWidth=e,t}}function Sv(i,r,e){jL(i,r);let t=r.connector;Qu.paint(t,i,e);let n="",o={x:-t.x,y:-t.y};if(t.internalSegments.length>0){n=cS(t);let s={d:n,transform:"translate("+o.x+","+o.y+")","pointer-events":"visibleStroke",[et]:r.edge.id},a=T1(i,e);a!=null&&(t.bgPath==null?(t.bgPath=M(q,s),L(t.bgPath,i.connectorOutlineClass),aa(t.canvas,t.bgPath,0)):ie(t.bgPath,s),Ef(t,t.bgPath,a,!0)),t.path==null?(t.path=M(q,s),aa(t.canvas,t.path,a!=null?1:0),L(t.path,i.connectorPathClass),r.edge.transient&&L(t.canvas,MS)):(t.path.parentNode!==t.canvas&&aa(t.canvas,t.path,a!=null?1:0),ie(t.path,s)),Ef(t,t.path,e,!1),r.detachable&&v1(r,o,i.defaults.edgeRelocateHandleSize)}}function v1(i,r,e){if(i.detachable){let t=i.connector,n={x:t.paintInfo.sx,y:t.paintInfo.sy},o=i.anchors.source.computedPosition.ox,s=i.anchors.source.computedPosition.oy;n.x+=o*e/2,n.y+=s*e/2;let a={d:`M ${n.x-e/2} ${n.y-e/2} L ${n.x+e} ${n.y-e/2} L ${n.x+e} ${n.y+e/2} L ${n.x-e/2} ${n.y+e/2} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.sourceZone==null?(t.sourceZone=M(q,a),L(t.sourceZone,Qi),t.canvas.appendChild(t.sourceZone)):ie(t.sourceZone,a);let l={x:t.paintInfo.tx,y:t.paintInfo.ty},h=$e(t,1,e),d=Dt(h,l,e),u=Dt(l,h,e),p={d:`M ${d[0].x} ${d[0].y} L ${d[1].x} ${d[1].y} L ${u[1].x} ${u[1].y} L ${u[0].x} ${u[0].y} Z`,cursor:"move","pointer-events":"fill",transform:`translate(${r.x},${r.y})`};t.targetZone==null?(t.targetZone=M(q,p),L(t.targetZone,eo),t.canvas.appendChild(t.targetZone)):ie(t.targetZone,p)}}function jL(i,r){let e=r.connector;if(e.canvas!=null)return e.canvas;{let t=i.containerType==="HTML"?M(Le,{[_e]:"0",[Ve]:"0",style:{"pointer-events":pt,position:Qe},[et]:r.edge.id}):M(Q,{[et]:r.edge.id});return e.canvas=t,i.$appendEdgeElement(e.canvas),e.cssClass!=null&&L(t,e.cssClass),L(t,i.connectorClass),e.classesToAddWhenRendered!=null&&(L(t,e.classesToAddWhenRendered.join(" ")),delete e.classesToAddWhenRendered),t.jtk=t.jtk||{},t.jtk.connection=r,t}}var Uf=class{constructor(r,e){this.container=r;c(this,"hr",!0);c(this,"ye");c(this,"Tl");c(this,"Ui");c(this,"vl");c(this,"He");c(this,"Hu");c(this,"nt");c(this,"dr");c(this,"Ft",{});c(this,"Nn",[]);c(this,"q");c(this,"qr");c(this,"zi");c(this,"Yi");c(this,"Xi");c(this,"Cl");e=e||{init:null},this.ye=new ye,this.Tl=this.Wf.bind(this),this.ye.on(r,ge,"*",this.Tl),this.Ui=this.Zf.bind(this),this.vl=this.Jf.bind(this),this.Xi=e.translate||(t=>Object.assign({},t)),this.Cl=e.init}$enable(){this.hr=!0}$disable(){this.hr=!1}addHandler(r){let e=this.Ft[r.selector];e==null&&(this.Ft[r.selector]=[],e=this.Ft[r.selector],this.Nn.push(r.selector)),e.push(r),e.sort((t,n)=>{let o=t.priority==null?0:t.priority,s=n.priority==null?0:n.priority;return o>s?-1:s>o?1:0})}removeHandler(r){let e=this.Ft[r.selector];e!=null&&(this.Ft[r.selector]=e.filter(t=>t!==r),this.Ft[r.selector].length===0&&(delete this.Ft[r.selector],this.Nn=this.Nn.filter(t=>t!==r.selector)))}Wf(r){if(!this.hr||r.Kf===!0)return;let e=!1;this.nt=r.target;let t=()=>{e||(e=!0,this.Cl&&this.Cl(r),this.dr=Ze(this.nt),this.He=null,this.q=me(r),this.zi=this.Xi(this.q),this.qr=Object.assign({},this.q),this.Yi=Object.assign({},this.zi))};for(let n=0;n<this.Nn.length;n++)if($t(this.nt,this.Nn[n],this.container)){let o=this.Ft[this.Nn[n]];if(o!=null){t();for(let s=0;s<o.length;s++){let a=this.nt,l=this.dr;if(o[s].target){if(a=this.nt.closest(o[s].target),a==null)continue;l=Ze(a)}if(this.Hu=o[s].start({pagePosition:this.q,e:r,el:a,size:l,translatedPosition:this.zi}),this.Hu!==!1){this.nt=a,this.dr=l,this.He=o[s],oe(r),r.Kf=!0;break}}}}this.He!=null&&(this.ye.on(document,ae,this.Ui),this.ye.on(document,le,this.vl))}Zf(r){if(!this.hr)return;let e=me(r),t=this.Xi(e);this.He!=null&&(this.He.constrainFunction&&(this.He.usesPageCoordinates?(e=this.He.constrainFunction(e,this.nt,{width:0,height:0},this.dr,this.qr,r),t=this.Xi(e)):t=this.He.constrainFunction(t,this.nt,{width:0,height:0},this.dr,this.Yi,r)),this.He.drag({e:r,el:this.nt,pagePosition:e,size:this.dr,originalPagePosition:this.q,translatedPosition:t,originalTranslatedPosition:this.zi}),this.qr=e,this.Yi={x:t.x,y:t.y})}Jf(r){this.qr=me(r),this.Yi=this.Xi(this.qr),this.He!=null&&this.He.stop({e:r,el:this.nt,pagePosition:this.qr,size:this.dr,originalPagePosition:this.q,translatedPosition:this.Yi,originalTranslatedPosition:this.zi}),this.Q()}Q(){this.ye.off(document,ae,this.Ui),this.ye.off(document,le,this.vl),this.He=null,this.nt=null,this.dr=null,this.q=null,this.qr=null}destroy(){Object.values(this.Ft).forEach(r=>r.forEach(e=>e.destroy&&e.destroy())),this.ye.off(this.container,ge,this.Tl),this.Q()}};var ip={FILL:"#FFFFFF",STROKE:"#000000",TEXT_COLOR:"#000000",STROKE_WIDTH:1.25},fh="start",yh="center",xh="end",C1="Default",P1="Default shapes",Tv="vjs-shape",op="vjs-shape-label",bh="vjs-shape";var _1="http://www.w3.org/2000/svg",O1="http://www.w3.org/1999/xlink",R1="svg",L1="xlink",w1="html";function Yf(i){let r=document.getElementById(i);return r!=null?r.innerHTML:null}var es=class extends Ro{constructor(r){super(r),this.namespaceHandlers[R1]=e=>document.createElementNS(_1,e.split(":")[1]),this.namespaceHandlers[w1]=e=>document.createElement(e.split(":")[1]),this.namespaces[L1]=O1}ce(r){return document.createElement(r)}cf(){return document.createDocumentFragment()}ctn(r){return document.createTextNode(r)}cc(r){return document.createComment(r)}su(){return Yf}removeElement(r){r.parentElement.removeChild(r)}removeTextNode(r){r.parentNode.removeChild(r)}};function xr(i){return new es(i||{})}var sp="link",ap="clone",lp="trash",vv="cross",Cv="plus",Pv="circle",_v="gear",HL={x:0,y:0,width:32,height:32},Ah={[ap]:{id:ap,viewBox:HL,shapes:[{tag:q,atts:{d:"M 6 24 L 2 24 L 2 2 L 24 2 L 24 6 M 8 8 L 30 8 L 30 30 L 8 30 Z",stroke:"currentColor","stroke-width":3,fill:"none","stroke-linejoin":"round"}}]},[sp]:{id:sp,viewBox:HL,shapes:[{tag:Z,atts:{x:0,y:0,width:32,height:32,fill:"transparent",stroke:"none"}},{tag:Be,atts:{cx:5,cy:16,r:5,fill:"currentColor"}},{tag:q,atts:{d:"M 5 16 L 22 16",stroke:"currentColor","stroke-width":3,fill:"none"}},{tag:q,atts:{d:"M 22 16 L 20 8 L 30 16 L 20 24",fill:"currentColor"}}]},[lp]:{id:lp,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},shapes:[{tag:q,atts:{d:"M 7 30 L 4 2 L 28 2 L 25 30 Z","stroke-width":"3"}},{tag:q,atts:{d:"M 12 26 L 10 8"}},{tag:q,atts:{d:"M 20 26 L 22 8"}},{tag:q,atts:{d:"M 16 26 L 16 8.5"}}]},[vv]:{id:vv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:q,atts:{d:"M 2 2 L 30 30"}},{tag:q,atts:{d:"M 30 2 L 2 30"}}]},[Cv]:{id:Cv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:q,atts:{d:"M 16 2 L 16 30"}},{tag:q,atts:{d:"M 2 16 L 30 16"}}]},[Pv]:{id:Pv,viewBox:{x:0,y:0,width:32,height:32},atts:{fill:"none",stroke:"currentColor","stroke-width":3,"stroke-linecap":"round"},shapes:[{tag:Be,atts:{cx:16,cy:16,r:15}}]},[_v]:{id:_v,viewBox:{x:0,y:0,width:32,height:32},atts:{},shapes:[{tag:q,atts:{"fill-rule":"evenodd",d:"M 16.0000,4.5000 L 18.1126,3.3755 L 18.6424,1.7428 L 20.8402,2.3317 L 20.4827,4.0106 L 21.7500,6.0407 L 24.1418,6.1232 L 25.4170,4.9741 L 27.0259,6.5830 L 25.8768,7.8582 L 25.9593,10.2500 L 27.9894,11.5173 L 29.6683,11.1598 L 30.2572,13.3576 L 28.6245,13.8874 L 27.5000,16.0000 L 28.6245,18.1126 L 30.2572,18.6424 L 29.6683,20.8402 L 27.9894,20.4827 L 25.9593,21.7500 L 25.8768,24.1418 L 27.0259,25.4170 L 25.4170,27.0259 L 24.1418,25.8768 L 21.7500,25.9593 L 20.4827,27.9894 L 20.8402,29.6683 L 18.6424,30.2572 L 18.1126,28.6245 L 16.0000,27.5000 L 13.8874,28.6245 L 13.3576,30.2572 L 11.1598,29.6683 L 11.5173,27.9894 L 10.2500,25.9593 L 7.8582,25.8768 L 6.5830,27.0259 L 4.9741,25.4170 L 6.1232,24.1418 L 6.0407,21.7500 L 4.0106,20.4827 L 2.3317,20.8402 L 1.7428,18.6424 L 3.3755,18.1126 L 4.5000,16.0000 L 3.3755,13.8874 L 1.7428,13.3576 L 2.3317,11.1598 L 4.0106,11.5173 L 6.0407,10.2500 L 6.1232,7.8582 L 4.9741,6.5830 L 6.5830,4.9741 L 7.8582,6.1232 L 10.2500,6.0407 L 11.5173,4.0106 L 11.1598,2.3317 L 13.3576,1.7428 L 13.8874,3.3755 Z M 23.2500,16.0000 A 7.25,7.25 0 1 0 8.7500,16.0000 A 7.25,7.25 0 1 0 23.2500,16.0000 Z"}}]}};function D1(i,r){let e=typeof i=="string"?Ah[i]:i;if(e==null)return null;{let t=Object.assign({},e);return t.id=r,t}}function hp(i,r,e,t,n,o,s){t=t||[],n=n||{};let a=Object.assign({viewBox:`0 0 ${i.viewBox.width} ${i.viewBox.height}`,"pointer-events":"all",width:r,height:e},i.atts||{}),l=M(Le,Object.assign(n||{},a),null,t.join(" "));return i.shapes.forEach(h=>{let d=M(h.tag,Object.assign(h.atts,s||{}));l.appendChild(d)}),o&&o.appendChild(l),l}function cp(i,r,e,t,n,o,s){return hp(Ah[i],r,e,t,n,o,s)}var N1={x:0,y:0,width:32,height:32},I1={stroke:"currentColor",fill:"none"},zf=class extends HTMLElement{static get observedAttributes(){return["icon-id","width","height"]}findIcon(r){return Ah[r]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){let r=this.getAttribute("icon-id"),e=this.getAttribute("width")||"32",t=this.getAttribute("height")||"32",n=this.findIcon(r)||Ah[r];if(!n){this.innerHTML="";return}let o=n.viewBox||N1,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width",e),s.setAttribute("height",t),s.setAttribute("viewBox",`${o.x} ${o.y} ${o.width} ${o.height}`);let a=vr(vr({},I1),n.atts);for(let[l,h]of Object.entries(a))s.setAttribute(l,h);n.shapes.forEach(l=>{let h=document.createElementNS("http://www.w3.org/2000/svg",l.tag);for(let[d,u]of Object.entries(l.atts))h.setAttribute(d,u);s.appendChild(h)}),this.innerHTML="",this.appendChild(s)}};customElements.define("vjs-icon",zf);var M1="label",kL="transform",WL="x",ZL="y",dp="origin",Rv="originX",Lv="originY",JL="orientation",wv="size",Dv="key",KL="iconId",Sh="middle",Ov="type",Xf="category",Nv="horizontal",V1="vertical",up="vjs-shape-icon",qL="vjs-include-icon",QL="vjs-include-icons",G1="category",$1="type",ro="__vjsRootSet",to=M1,jf="fill",Th="outline",vh="outlineWidth",Hf="color",Ch="#FFFFFF",ts="#000000",Ph=2,Iv="#000000",e0=.8,da=class{constructor(r,e){c(this,"compiledShapes",new Map);c(this,"templateRenderer",xr({defaultNamespace:"svg"}));c(this,"shapeSets",new Map);c(this,"defaultCategoryId");c(this,"labelPosition");c(this,"rootSet");c(this,"iconContainerTemplate",`<svg:svg class="${up}" x="{{x}}" y="{{y}}" viewBox="{{viewBox}}" width="{{width}}" height="{{height}}" style="overflow:visible"/>`);c(this,"iconContainerAst");c(this,"iconSpecs",new Map);c(this,"iconList",[]);c(this,"typeParameter");c(this,"categoryParameter");c(this,"multilineLabels");c(this,"labelFillRatio");e=e||{},r==null?(U("WARN: no shapes were provided to shape library."),r=[]):Array.isArray(r)||(r=[r]),this.typeParameter=e.typeParameter||$1,this.categoryParameter=e.categoryParameter||G1,this.multilineLabels=e.multilineLabels!==!1,this.labelFillRatio=e.labelFillRatio||e0,this.labelPosition=e.labelPosition||"center",this.qf(r),this.defaultCategoryId=this.rootSet.children.length>0?this.rootSet.children[0].id:be,this.iconContainerAst=this.templateRenderer.parse(this.iconContainerTemplate)}useMultilineLabels(){return this.multilineLabels}refresh(r,e,t){this.Qf(r,e);let n=r.closest(".vjs-shape")||r;this.$applyMultilineLabel(n.querySelector(":scope > .vjs-shape-label"),e,t||to)}qf(r){let e=(t,n)=>{let o=[];return t!=null&&t.forEach(s=>{let a=Object.assign(s,{parent:n,children:e(s.children,s.id)});if(this.shapeSets.set(a.id,a),a.icons){let l=vs(this.iconSpecs,a.id,()=>new Map);a.icons.forEach(h=>{l.set(h.id,h)}),this.iconList.push(...a.icons)}o.push(a)}),o};this.rootSet={children:e(r,ro),parent:null,id:ro,name:ro,shapes:[]}}getShapeSet(r){return this.shapeSets.get(r)}getShapeSets(){return Array.from(this.shapeSets.values())}getShapeDefinition(r,e){return e=e||this.defaultCategoryId,this.shapeSets.get(e).shapes.find(t=>t.type===r)}$getShapeDefinitionForObject(r,e,t){let n=e||this.typeParameter,o=t||this.categoryParameter;return this.getShapeDefinition(r[n],r[o])}getShapeTemplate(r,e){let t=this.getShapeDefinition(r,e);return t==null?(U(`Cannot find shape [${r}] in set [${e}]. Returning default shape.`),this.ey()):t.template}getCompiledShape(r,e){let t=this.ny(r,e);if(!this.compiledShapes.has(t)){let n=this.templateRenderer.parse(this.getShapeTemplate(r,e)),o=s=>this.templateRenderer.render(n,s).fragment;this.compiledShapes.set(t,o)}return this.compiledShapes.get(t)}iy(r){r.setAttribute&&r.setAttribute(wu,Du),r.hasChildNodes&&r.childNodes.forEach(e=>this.iy(e))}renderCompiledShape(r,e,t,n){e=r.outlineWidth||e||1;let o=t||this.typeParameter,s=n||this.categoryParameter,a=this.getShapeDefinition(r[o],r[s]),l=a.square?Math.min(r.width,r.height):r.width,h=a.square?Math.min(r.width,r.height):r.height;return this.getCompiledShape(r[o],r[s])(Object.assign({outlineWidth:e},r,{width:l,height:h})).childNodes[0]}renderShapeLabel(r,e,t,n,o,s,a){e=e||to;let l=M(tt,{x:"50%",y:"50%",fill:o,stroke:s,"text-anchor":Sh,"dominant-baseline":Sh,class:op,"stroke-width":t||"0.25px"});l.textContent=n||r[e]||"";let h=r.fontSize||(a==null?void 0:a.size),d=r.fontStyle||(a==null?void 0:a.style),u=r.fontWeight||(a==null?void 0:a.weight),p=r.fontFamily||(a==null?void 0:a.family);return h&&l.setAttribute("font-size",h.toString()),d&&l.setAttribute("font-style",d),u&&l.setAttribute("font-weight",u),p&&l.setAttribute("font-family",p),l}ny(r,e){return e=e||this.defaultCategoryId,[r,e].join(":")}ly(r,e,t){return{center:{x:"{{width/2}}",y:"{{height/2}}",transform:"",textAnchor:Sh,dominantBaseline:Sh},top:{x:"{{width/2}}",y:"0",transform:`translate(0, -${e+t})`,textAnchor:Sh,dominantBaseline:"hanging"},bottom:{x:"{{width/2}}",y:"{{height}}",transform:`translate(0, ${t})`,textAnchor:Sh,dominantBaseline:"auto"}}[r]}hy(r,e,t=to){let n={};return this.shapeSets.forEach(o=>{o.shapes.forEach(s=>{let a=s.font||e,l=a==null?14:a.size||14,h=a==null?"normal":a.style||"normal",d=a==null?"normal":a.weight||"normal",u=(a==null?void 0:a.family)||"",p=s.labelPosition||this.labelPosition,{x:g,y:m,transform:E,textAnchor:y,dominantBaseline:x}=this.ly(p,l,20),b=(s.collapsedTemplate==null?s.template:`<svg:g ${Hu}>${s.template}</svg:g><svg:g ${ku}>${s.collapsedTemplate}</svg:g>`)+(r?`<svg:text x="${g}" y="${m}" transform="${E}" fill="{{color}}" stroke="{{color}}" stroke-width="0.25px" text-anchor="${y}" dominant-baseline="${x}" class="${op}" font-size="{{fontSize || ${l}}}" font-style="{{fontStyle || '${h}'}}" font-weight="{{fontWeight || '${d}'}}" font-family="{{fontFamily || '${u}'}}">{{${t}}}</svg:text>`:"");n[`${o.id}:${s.type}`]=b,n[`${be}:${s.type}`]=b})}),n}getShapeTagDefinition(r,e,t,n={size:14,style:"normal"},o=to,s=Ch,a=ts,l=ts,h=Ph){return e=e||h,{template:r?`<svg:g class="${bh}" fill="{{fill}}" stroke="{{outline}}" stroke-width="{{outlineWidth}}">
|
|
5
|
+
<r-fragment key="${Xf}:${Ov}"/>
|
|
6
|
+
</svg:g>`:`<svg:svg class="${bh}" fill="{{fill}}" stroke="{{outline}}" viewBox="0 0 {{width}} {{height}}" preserveAspectRatio="none" stroke-width="{{outlineWidth}}">
|
|
7
|
+
<r-fragment key="${Xf}:${Ov}"/>
|
|
8
|
+
</svg:svg>`,fragments:{[`${Xf}:${Ov}`]:this.hy(t,n,o)},defaultNamespace:"svg",decorator:(d,u)=>d.fill==null||d.outline==null||d.color==null||d.outlineWidth==null||d.fontSize==null||d.fontStyle==null?{fill:d.fill||s,outline:d.outline||a,color:d.color||l,outlineWidth:d.outlineWidth||h,fontSize:d.fontSize,fontStyle:d.fontStyle}:null,defaultableFragmentKeys:[Xf],rendered:(d,u,p,g)=>{this.refresh(d,u,o)},updated:(d,u,p)=>{this.refresh(d,u,o)},mounted:(d,u,p,g)=>{this.$applyMultilineLabel(d.querySelector(z(op)),u,o)}}}ey(){return'<svg:rect x="0" y="0" width="{{width}}" height="{{height}}"/>'}Wu(r,e){return e!=null?this.iconSpecs.get(e).get(r):this.iconList.find(t=>t.id===r)}$applyMultilineLabel(r,e,t){if(this.multilineLabels&&r!=null){let n=e.width,o=e.height;if(r!=null&&n!=null&&o!=null){let s=this.labelFillRatio*n;ju(r,e[t],s)}}}Qf(r,e){Array.from(r.querySelectorAll(`svg.${up}:not(:scope .vjs-group *, :scope .vjs-node *)`)).forEach(t=>t.parentNode.removeChild(t)),Array.from(r.querySelectorAll(qL)).forEach(t=>{let n=t.getAttribute(Dv),o=n!=null?e[n]:t.getAttribute(KL);if(o!=null){let s=this.Wu(o,e.category);if(s!=null){let a=parseFloat(t.getAttribute(WL))*e.width,l=parseFloat(t.getAttribute(ZL))*e.height,h=Math.min(e.width,e.height),d=parseFloat(t.getAttribute(wv))*h,u=t.getAttribute(Rv)||t.getAttribute(dp)||fh,p=t.getAttribute(Lv)||t.getAttribute(dp)||fh,g=hp(s,d,d,[up],{[wu]:Du,x:a,y:l},r),m=u===yh?-d/2:u===xh?-d:0,E=p===yh?-d/2:p===xh?-d:0;g.setAttribute(kL,`translate(${m}, ${E})`)}}}),Array.from(r.querySelectorAll(QL)).forEach(t=>{let n=t.getAttribute(Dv),o=e[n];if(o!=null&&o.length>0){let s=Math.min(e.width,e.height),a=parseFloat(t.getAttribute(wv))*s,l=t.getAttribute(Rv)||t.getAttribute(dp)||fh,h=t.getAttribute(Lv)||t.getAttribute(dp)||fh,d=M(Q),u=(t.getAttribute(JL)||Nv)===Nv;r.appendChild(d);let p=0,g=5,m=0;o.forEach(T=>{let S=this.Wu(T,e.category);S!=null&&(hp(S,a,a,[up],{[wu]:Du,x:p,y:m},d),u?p+=a+g:m+=a+g)});let E=parseFloat(t.getAttribute(WL))*e.width,y=parseFloat(t.getAttribute(ZL))*e.height,x=u?p-g:0,f=u?0:m-g,b=l===yh?-x/2:l===xh?-x:0,A=h===yh?-f/2:h===xh?-f:0;d.setAttribute(kL,`translate(${E+b}, ${y+A})`)}})}parseDefs(){let r=[];return this.rootSet.children.forEach(e=>{if(e.defs)for(let t in e.defs){let n=this.templateRenderer.parse(e.defs[t]);n[0].atts.id=t,r.push(n)}}),r}getDefsElements(){return this.parseDefs().map(r=>this.templateRenderer.render(r,{}).fragment.childNodes[0])}getSvgDefsElement(){let r=M(Le),e=M(pT);return r.appendChild(e),this.getDefsElements().forEach(t=>{e.appendChild(t)}),r}};var B1={id:"flowchart",name:"Flowchart",shapes:[{type:"process",label:"Process",description:"A process (also known as 'Action') can represent a single step or a sub-process",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"decision",label:"Decision",template:'<path d="M {{width/2}} 0 L {{width}} {{height/2}} L {{width/2}} {{height}} L 0 {{height/2}} Z"/>'},{type:"terminus",label:"Terminus",description:"Used to mark the start/end of the system",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/6}}"/>'},{type:"input",label:"Input/Output",description:"Represents something entering or leaving the system",template:'<path d="M {{width / 7}} 0 L {{width}} 1 L {{width - (width/7)}} {{height}} L 1 {{height}} Z"/>'},{type:"document",label:"Document",description:"A printed document or report",template:'<path d="M 0 {{height-(height/8)}} C {{width - (width/4)}},{{height + (height/8)}} {{width- (width/3)}},{{height/2}} {{width}},{{height-(height/8)}} L {{width}} 0 L 0 0 L 0 {{height-(height/8)}}"/>'},{type:"manualInput",label:"Manual Input",template:'<path d="M 0 {{height}} L 0 {{height/3}} L {{width}} {{height/9}} L {{width}} {{height}} Z"/>'},{type:"manualOperation",label:"Manual Operation",template:'<path d="M 0 0 L {{width}} 0 L {{width- (width/8)}} {{height}} L {{width/8}} {{height}} Z"/>'},{type:"preparation",label:"Preparation",template:'<path d="M 0 {{height/2}} L {{width/8}} 0 L {{width- (width/8}} 0 L {{width}} {{height/2}} L {{width-(width/8)}} {{height}} L {{width/ 8}} {{height}} Z"/>'},{type:"connector",label:"Connector",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"merge",label:"Merge",template:'<path d="M 0 0 L {{width}} 1 L {{width/2}} {{height}} Z"/>'},{type:"collate",label:"Collate",template:`<g><path d="M 0 0 L {{width}} 0 L {{width/2}} {{height/2}} Z"/>
|
|
9
9
|
<path d="M 0 {{height}} L {{width}} {{height}} L {{width/2}} {{height/2}} Z"/>
|
|
10
10
|
</g>`},{type:"subroutine",label:"Subroutine",template:`<g>
|
|
11
11
|
<rect x="0" y="0" width="{{width}}" height="{{height}}"/>
|
|
@@ -27,7 +27,7 @@ var Ac=Object.defineProperty,iN=Object.defineProperties,oO=Object.getOwnProperty
|
|
|
27
27
|
<path d="M {{width}} {{height/5}} A {{width/2}} {{height/5}} 0 0 1 0 {{height/5}}" fill="none"/>
|
|
28
28
|
<path d="M {{width}} {{height/ 3}} A {{width/2}} {{height/ 5}} 0 0 1 0 {{height/ 3}}" fill="none"/>
|
|
29
29
|
</g>
|
|
30
|
-
`},{type:"dataStorage",label:"Data Storage",template:'<path d="M {{width/5}} 0 A {{width/5}} {{height/2}} 0 0 0 {{width/5}} {{height}} L {{width-(width/5)}} {{height}} A {{(width/5)}} {{height/2}} 0 0 1 {{width-(width/5)}} 0 L {{width/5}} 0"/>'}]};var
|
|
30
|
+
`},{type:"dataStorage",label:"Data Storage",template:'<path d="M {{width/5}} 0 A {{width/5}} {{height/2}} 0 0 0 {{width/5}} {{height}} L {{width-(width/5)}} {{height}} A {{(width/5)}} {{height/2}} 0 0 1 {{width-(width/5)}} 0 L {{width/5}} 0"/>'}]};var ube='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 85 L 45 15 L 55 15 L 80 85 M 30 60 L 70 60" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><svg:path d="M 15 85 L 30 85 M 70 85 L 85 85" fill="none" stroke="currentColor" stroke-width="8" stroke-linecap="round"/></svg:svg>',F1='<svg:svg viewBox="0 0 100 100"><svg:rect x="10" y="10" width="80" height="80" rx="5" fill="none" stroke="currentColor" stroke-width="2" stroke-dasharray="8,4" opacity="0.6"/><svg:path d="M 35 75 L 48 30 L 52 30 L 65 75 M 40 62 L 60 62" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',pbe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 35 20 L 65 20 M 50 20 L 50 80 M 35 80 L 65 80" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:path d="M 70 50 L 78 30 L 86 50 M 73 45 L 83 45" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg:svg>',gbe='<svg:svg viewBox="0 0 100 100"><svg:path d="M 20 20 L 60 20 L 85 45 L 85 80 L 20 80 Z" fill="none" stroke="currentColor" stroke-width="6" stroke-linejoin="round"/><svg:circle cx="35" cy="35" r="5" fill="currentColor"/><svg:line x1="35" y1="55" x2="70" y2="55" stroke="currentColor" stroke-width="6" stroke-linecap="round"/><svg:line x1="35" y1="68" x2="60" y2="68" stroke="currentColor" stroke-width="6" stroke-linecap="round"/></svg:svg>',Mv={id:"basic",name:"Basic",shapes:[{type:"rectangle",label:"Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}"/>'},{type:"rounded-rectangle",label:"Rounded Rectangle",template:'<rect x="0" y="0" width="{{width}}" height="{{height}}" rx="{{width/10}}"/>'},{type:"ellipse",label:"Ellipse",template:'<ellipse cx="{{width/2}}" cy="{{height/2}}" rx="{{width/2}}" ry="{{height/2}}"/>'},{type:"diamond",label:"Diamond",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height/2}} {{width/2}} {{height}} 0 {{height /2}}"/>'},{type:"isosceles-triangle",label:"Isosceles Triangle",template:'<polygon points="{{width/2}} 0 {{width}} {{height}} 0 {{height}}"/>'},{type:"inverted-isosceles-triangle",label:"Inverted Isosceles Triangle",template:'<polygon points="{{width/2}} {{height}} {{width}} 0 0 0"/>'},{type:"right-triangle",label:"Right Triangle",template:'<polygon points="0 0 0 {{height}} {{width}} {{height}}"/>'},{type:"label",label:"Label",icon:F1,template:`<g>
|
|
31
31
|
<r-if test="!text">
|
|
32
32
|
<svg:rect x="0" y="0" width="{{width}}" height="{{height}}" stroke="#888" stroke-dasharray="2" stroke-width="1" fill="{{'transparent'}}"/>
|
|
33
33
|
</r-if>
|
|
@@ -40,50 +40,50 @@ var Ac=Object.defineProperty,iN=Object.defineProperties,oO=Object.getOwnProperty
|
|
|
40
40
|
<r-if test="scaled === false">
|
|
41
41
|
<svg:text dominant-baseline="hanging" stroke="none" fill="{{color}}" font-size="{{fontSize}}" font-style="{{fontStyle}}">{{text}}</svg:text>
|
|
42
42
|
</r-if>
|
|
43
|
-
</g>`,payload:{text:"Label",scaled:!0},properties:[{id:"fill",label:"Background Color",type:"color",defaultValue:"transparent"},{id:"color",label:"Text Color",type:"color",defaultValue:"#000000"},{id:"text",label:"Text",type:"string",defaultValue:"Text"},{id:"scaled",label:"Scaled",type:"boolean",defaultValue:!0}]},{type:"inverted-right-triangle",label:"Right Triangle",template:'<polygon points="{{width}} {{height}} {{width}} 0 0 {{height}}"/>'},{type:"hexagon",label:"Hexagon (pointy)",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*1732/6000}} {{width}} {{height-(height*1732/6000)}} {{width/2}} {{height}} 0 {{height-(height*1732/6000)}} 0 {{height*1732/6000}}"/>'},{type:"hexagon-flat",label:"Hexagon (flat)",square:!0,template:'<polygon points="0 {{height/2}} {{width*1732/6000}} {{height}} {{width-(width*1732/6000)}} {{height}} {{width}} {{height/2}} {{width-(width*1732/6000)}} 0 {{width*1732/6000}} 0"/>'},{type:"octagon",label:"Octagon",square:!0,template:'<polygon points="{{width * 293 / 1000}} 0 {{width * 707 / 1000}} 0 {{width}} {{height * 293 / 1000}} {{width}} {{height * 707 / 1000}} {{width * 707 / 1000}} {{height}} {{width * 293 / 1000}} {{height}} 0 {{height * 707 / 1000}} 0 {{height * 293 / 1000}}"/>'},{type:"pentagon",label:"Pentagon",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*343/1000}} {{width*793/1000}} {{height*904/1000}} {{width*206/1000}} {{height*904/1000}} 0 {{height*343/1000}}"/>'},{type:"parallelogram",label:"Parallelogram",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width}} 0 {{width * 7 / 8}} {{height}}"/>'},{type:"trapezoid",label:"Trapezoid",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width * 7 / 8}} 0 {{width}} {{height}}"/>'},{type:"cross",label:"Cross",template:'<path d="M 0 {{height*3/10}} L 0 {{height * 7/10}} L {{width *3/10}} {{ height * 7/10}} L {{width *3/10}} {{height}} L {{width *7/10}} {{height}} L {{width*7/10}} {{height*7/10}} L {{width}} {{height * 7/10}} L {{width}} {{height*3/10}} L {{width *7/10}} {{height*3/10}} L {{width*7/10}} 0 L {{width*3/10}} 0 L {{width*3/10}} {{height*3 /10}} Z"/>'},{type:"l-shape-bl",label:"L Shape (Bottom left)",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} {{height / 2}} L {{width/2}} {{height/2}} L {{width/2}} 0 Z"/>'},{type:"l-shape-br",label:"L Shape (Bottom right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L {{width/2}} 0 L {{width/2}} {{height/2}} L 0 {{height/2}} L 0 {{height}} Z"/>'},{type:"l-shape-tl",label:"L Shape (Top left)",template:'<path d="M 0 0 L 0 {{height}} L {{width/2}} {{height}} L {{width/2}} {{height / 2}} L {{width}} {{height/2}} L {{width}} 0 Z"/>'},{type:"l-shape-tr",label:"L Shape (Top right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L 0 0 L 0 {{height/2}} L {{width/2}} {{height/2}} L {{width/2}} {{height}} Z"/>'},{type:"u-shape",label:"U Shape",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} 0 L {{width*2/3}} 0 L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} 0 Z"/>'},{type:"inverted-u-shape",label:"U Shape (Inverted)",template:'<path d="M 0 0 L {{width}} 0 L {{width}} {{height}} L {{width*2/3}} {{height}} L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} {{height}} L 0 {{height}} Z"/>'}]};var da=class extends Dc{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var up=class extends da{constructor(e){super(e);this.uiCore=e}filter(e){return e.group==null}getElements(){let e=this.uiCore.getNodes();return Array.prototype.push.apply(e,this.uiCore.getGroups()),e=e.filter((t,n,o)=>t.group==null),e}};var pp=class extends da{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||J(e))&&e.group==this.group}};var gp=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?ze.transformGeometry(n.connector,r.geometry,e,t):r.geometry}getCoordinates(r,e){let t=this.ui.viewport.getElement(r.id);return{x:t.x,y:t.y,width:t.width,height:t.height}}};var mp=class extends Hd{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new gp(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function gi(i){return kr(i)&&i.useHTMLElement!==!0}function rs(i){return i.isSimpleShape}function F1(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function U1(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function ua(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=oh.getElement(r,i,i.connection);return L(e,r.labelOverlayClass),e}else return Qo(r,i),i.textElement}function Ch(i,r){return oh.getElement(r,i,i.connection,e=>{let t=i.create(e,e.edge,r,r.model);return L(t,r.overlayClass),t})}var pa=class extends Mu{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"M");c(this,"Tl");c(this,"zu");c(this,"Dn");c(this,"dr");c(this,"Ge");c(this,"ur");c(this,"Yu");c(this,"ye");c(this,"Xu",[`[${RS}='true']`]);c(this,"vl");c(this,"ju",new Set([$l,Yo,zo,uu,Hi,pu,Jo]));c(this,"it",null);c(this,"Yi",[]);if(o=o||{},a=a||{},this.ye=new ye,this.clipboard=new mp(this),this.M=s,this.containerType=ku(this.getContainer()),this.Yu=a.hoverEvents!==!1,this.ur=Kl,this.Tl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.zu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.vl=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new Uu(this,{edgeMappings:o.edges.propertyMappings})),this.Dn=[],this.ku(),this.on(n,"animationend",z(ki,Xo),h=>{let d=h.target;d.style.animation=null,F(d,_f)}),a.resizeObserver!==!1&&!this.$_useModelForSizes)try{this.Ge=new ResizeObserver(h=>{window.requestAnimationFrame(()=>{if(!this.$_dataLoading){let d=[];h.forEach(u=>{if(u.borderBoxSize!=null&&u.borderBoxSize.length>0){let p=this.$getAttribute(u.target,gt);if(p!=null){let g={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},m=this.viewport.getElement(p);m!=null&&(m.width!==g.width||m.height!==g.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u)),this.$relayoutOnResize&&d.length>0&&this.relayout()}})})}catch(h){U("WARN: ResizeObserver could not be attached.")}if(o.shapes!=null)if(o.shapes.library==null&&o.shapes.sets==null)U('Render option "shapes" passed to UI but no "library" or "sets" value is present. Shape library is not enabled.');else{o.shapes.library!=null?this.$shapeLibrary=o.shapes.library:this.$shapeLibrary=new ca(o.shapes.sets,o.shapes);let h=this.getShapeLibrary().getShapeTagDefinition(o.useSvgContainer===!0,o.shapes.strokeWidth||2,o.shapes.showLabels,o.shapes.font,o.shapes.labelAttribute,o.shapes.defaultFillColor,o.shapes.defaultOutlineColor,o.shapes.defaultColor);this.registerTag(o.shapes.tagName||Av,h),this.Jf(),this.Kf()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((J(e.modelObject)||Y(e.modelObject))&&e.modelObject.group){let a=this.getGroupElement(e.modelObject.group.id),l=this.$_getGroupContentAreaInfo(e.modelObject.group.id);s.x-=a.x+l.internalOffset.x,s.y-=a.y+l.internalOffset.y}};if(Lt(n.parentElement)){let s=Me(e,e.c,e.r);o(s),dn(n,s),pi(n,e.r)}else{pi(n,e.r);let s=ft(e);o(s),Ie(n,s)}t&&(this.$repaintUIElement(e),this.se(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.ju.add(t))}$enableVertexDrag(){this.dr.$enable()}$disableVertexDrag(){this.dr.$disable()}$canDrop(e,t,n){return this.vl!=null?this.vl(e,t,n):!0}addElementEventFilter(e){this.Xu.push(e)}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.M.usesWrapperElement&&t.firstElementChild!=null&&this.ju.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new up(this)}$createGroupLayoutAdapter(e){return new pp(e,this)}$startPanRepeat(e,t,n,o,s,a){U("startPanRepeat not implemented in BrowserUI. Subclasses should implement.")}$stopPanRepeat(){U("stopPanRepeat not implemented in BrowserUI. Subclasses should implement.")}Jf(){this.it=this.getShapeLibrary().getSvgDefsElement(),this.it.style.position="absolute",this.it.style.width="1px",this.it.style.height="1px",this.it.style.left="-10000px",this.it.style.top="-10000px",this.getContainer().appendChild(this.it)}Kf(){this.$shapeLibrary&&this.$shapeLibrary.getShapeSets().forEach(t=>{t.shapes.forEach(n=>{var o,s;n.objectType===se.objectType&&n.members!=null&&((o=n.members.nodes)==null||o.forEach(a=>a.category=a.category||t.id),(s=n.members.groups)==null||s.forEach(a=>a.category=a.category||t.id),this.model.addGroupTemplate(`${t.id}:${n.type}`,n.members))})})}qf(e,t,n){let s=["edge",t].join(":");if(n.Qf=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.zi(t,s,e.connection,n,e)}$isAsynchronousRender(){return this.M.asynchronous===!0}$isDraggingSupported(){return!1}$removeElement(e){e!=null&&e.parentNode&&e.parentNode.removeChild(e)}$appendElement(e,t,n){t&&(n?t.insertBefore(e,t.firstElementChild):t.appendChild(e))}$setElementVisible(e,t){e.style.display=t?Cr:pt}$doVertexUpdated(e){this.M.reactive===!1&&this.M.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.M.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.getContainer(),t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendEdgeElement(e,t){this.$appendElementToVertexLayer(e,t)}$getAssociatedElements(e){let t=[];if(e.nodeType!==3&&e.nodeType!==8){let n=e.querySelectorAll(Kl);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return OT(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return cn(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){xf(e,t)}$updateElementClasses(e,t,n){Ut(e,t,n)}$setAttribute(e,t,n){e.setAttribute(t,n)}$getAttribute(e,t){return e.getAttribute(t)}$setAttributes(e,t){for(let n in t)e.setAttribute(n,t[n])}$removeAttribute(e,t){e.removeAttribute&&e.removeAttribute(t)}on(e,t,n,o){let s=a=>{o==null?this.ye.on(a,t,n):this.ye.on(a,t,n,o)};return Vn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Vn(e)?e.forEach(o=>this.ye.off(o,t,n)):this.ye.off(e,t,n),this}trigger(e,t,n,o,s){this.ye.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return Ki(e)}ey(e,t,n){function o(l){return l.offsetParent||l.parentNode}let s=e!==n&&o(e)!==n?o(e):null,a=l=>{l!=null&&l!==document.body&&!isNaN(l.scrollTop)&&!isNaN(l.scrollLeft)&&(l.scrollTop>0||l.scrollLeft>0)&&(t.x-=l.scrollLeft,t.y-=l.scrollTop)};for(;s!=null;){let l=un(s)||{x:0,y:0};t.x+=l.x,t.y+=l.y,a(s),s=o(s)===n?null:o(s)}}$getElementPositionInUIRelativeToCanvasOrigin(e,t){let n=e.el,o={x:0,y:0};if(this.containerType==="SVG"){let s=Ku(n,this.getContainer(),!0);if(j(e.modelObject)){let a=this.getElement(e.modelObject.parent.id);if(a.r!==0){let l=Ku(a.el,this.getContainer(),!0),h={x:l.x+a.width/2,y:l.y+a.height/2},d=Me(h,l,a.r);return Me(s,d,-a.r)}}else if(e.r!==0){let a={x:s.x+t.width/2,y:s.y+t.height/2},l=Me(a,s,e.r);return Me(s,l,-e.r)}return s}else{if(n.namespaceURI===Gt){let l=n.closest(Le);l!=null&&l!==n&&(o=Ku(n,l,!0),n=l)}let s=this.getContainer(),a=un(n,t);if(this.ey(n,a,s),s!=null&&!isNaN(s.scrollTop)&&!isNaN(s.scrollLeft)&&(s.scrollTop>0||s.scrollLeft>0)){let l=n.offsetParent!=null?this.$getStyle(n.offsetParent,ff):_S,h=this.$getStyle(n,ff);h!==qe&&h!==LE&&l!==qe&&l!==LE&&(a.x-=s.scrollLeft,a.y-=s.scrollTop)}return{x:a.x+o.x,y:a.y+o.y}}}$setElementSizeInUI(e,t,n){Or(e,t,n)}$setElementWidth(e,t){ZT(e,t)}$setElementHeight(e,t){JT(e,t)}$getSize(e){return Ze(e)}$setElementRotation(e,t){pi(e,t)}$setVisibleElementRotation(e,t){pi(e.el,t),this.se(n=>n.$vertexRotated(e,t))}$getElementPositionInUIRelativeToParent(e){return un(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==tb?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,vT);return t&&t.length>0?t[0]:this.M.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return RT.apply(null,arguments)}$setViewportElementPosition(e,t){e.r!==0?Lt(e.el.parentElement)?KT(e,t):Ie(e.el,t):Ie(e.el,t)}setDraggable(e,t){let n=this.getObjectInfo(e,!1);n.obj&&(t?this.$removeAttribute(n.el,$l):this.$setAttribute(n.el,$l,Ct))}isDraggable(e){let t=this.$getAttribute(e,$l);return t==null||t===ct}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}zi(e,t,n,o,s,a){let l=n.edge;if(!l.transient||a){let h={obj:l,e:o,model:this.model,ui:this,connection:n,overlay:s,def:null},d=this.view.getEdgeDefinition(this.model.getEdgeType(l.data));d&&d.events&&d.events[e]?d.events[e](h):e===W&&this.$edgeTap(h),this.fireUnchecked(t,h)}}$edgeTap(e){}getLabelLocationAttribute(e){return this.view.getEdgeDefinition(this.model.getEdgeType(e.data||{})).labelLocationAttribute||UE}As(e,t){let o=Bt(Ko(t),Mn,this.getContainer(),!0).jtk.overlay;o&&this.qf(o,e,t)}ny(e){this.As(Ye,e)}iy(e){this.As(Co,e)}ly(e){this.As(W,e)}hy(e){this.As(Ur,e)}Ss(e,t,n){if(!n.defaultPrevented&&n.Qf==null){let o=Bt(Ko(n),Zr,this.getContainer(),!0);this.zi(e,t,o.jtk.connection,n,null)}}uy(e){this.Ss(Ye,eA,e)}py(e){this.Ss(Co,tA,e)}my(e){this.Ss(W,oA,e)}gy(e){this.Ss(Ur,rA,e)}Hu(e,t){let o=Bt(Ko(t),Mn,this.getContainer(),!0).jtk.overlay;o&&this.Wu(o.connection,e,t)}Ey(e){this.Hu(!0,e)}fy(e){this.Hu(!1,e)}Wu(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(Qe)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(Qe)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(Qe)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Ut(e.sourceElement,[Vf]),Ut(e.targetElement,[Gf])):(Ut(e.sourceElement,[],[Vf]),Ut(e.targetElement,[],[Gf]));let a=t?st:ot,l=t?Cd:vd;this.zi(a,l,e,n,null)}}Zu(e,t){var o;let n=Ko(t).parentNode;this.Wu((o=n.jtk)==null?void 0:o.connection,e,t)}yy(e){this.Zu(!0,e)}by(e){this.Zu(!1,e)}Ju(e,t){let n=Ko(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(Qi)&&!o.classList.contains(eo)){let s=e?le:ge,a=e?nA:Cl;this.zi(s,a,n.jtk.connection,t,null)}}}Ay(e){this.Ju(!0,e)}Sy(e){this.Ju(!1,e)}Ty(e){let t=Ko(e).parentNode;t.jtk&&t.jtk.connection&&this.zi(At,iA,t.jtk.connection,e,null)}vy(e){let t=e.target,n=this.getModelObjectFromElement(t,!0,!1);if(n!=null)return this.Xu.find(s=>Bt(t,s,n.el,!0))!=null?null:{el:n.el,obj:n.obj,e,model:this.model,ui:this}}pr(e,t,n){if(!e.defaultPrevented){let o=this.vy(e);if(o!=null){let s=J(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):j(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}Cy(e){this.pr(e,Ye,Hb)}Py(e){this.pr(e,Co,kb)}Oy(e){this.pr(e,W,Qb)}_y(e){this.pr(e,Ur,Wb)}Ry(e){this.pr(e,At,qb)}Ly(e){this.pr(e,ot,Zb)}wy(e){this.pr(e,st,Jb)}Dy(e){this.pr(e,ae,Kb)}Ny(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}Iy(e,t,n){let o=n.bind(this);this.Dn.push({eventName:e,handler:o}),this.ye.on(this.getContainer(),e,t,o)}addDragHandler(e){this.dr==null?this.Yi.push(e):this.dr.addHandler(e)}Vy(){this.dr!=null&&this.dr.destroy(),this.Yi=this.Yi||[],this.dr=new Bf(this.fe,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.Ku(e)}),this.Yi.forEach(e=>this.dr.addHandler(e)),this.Yi.length=0}Ku(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=he(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.Ts(ce.objectType,this.getContainer())}$getGroupsInViewport(){return this.Ts(se.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return In()}$isArrayLike(e){return super.$isArrayLike(e)||Vn(e)}Ts(e,t,n){let o=t.getBoundingClientRect(),s={};return Object.values(this.viewport.getElements()).filter(l=>{if(l.modelObject.objectType===e){let h=n?n(l.el):l.el;return s[l.modelObject.id]=h.getBoundingClientRect(),tt(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}ku(){if(this.Dn!=null){this.Cl();let e=[[Ye,Mn,this.ny],[Co,Mn,this.iy],[W,Mn,this.ly],[Ur,Mn,this.hy],[Ye,Zr,this.uy],[Co,Zr,this.py],[W,Zr,this.my],[Ur,Zr,this.gy],[Ye,this.ur,this.Cy],[Co,this.ur,this.Py],[W,this.ur,this.Oy],[Ur,this.ur,this._y],[W,CT,this.Ny],[At,Zr,this.Ty],[le,Zr,this.Ay],[ge,Zr,this.Sy],[At,Kl,this.Ry]];this.Yu===!0&&e.push.apply(e,[[st,Zr,this.yy],[ot,Zr,this.by],[st,Mn,this.Ey],[ot,Mn,this.fy],[ot,this.ur,this.Ly],[st,this.ur,this.wy],[ae,this.ur,this.Dy]]),e.forEach(t=>{this.Iy(t[0],t[1],t[2])})}}Cl(){let e=this.getContainer();e&&this.Dn!=null&&(this.Dn.forEach(t=>{this.ye.off(e,t.eventName,t.handler)}),this.Dn.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this.Cl(),this.$setAttribute(e,mf,G().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(mf),Array.from(t.childNodes).filter(o=>o!=null&&(cn(o,ta)||cn(o,ra)||o.getAttribute&&o.getAttribute(gt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=ku(e),this.ye!=null&&(this.Vy(),this.ku())}reset(){super.reset(),this.Ge&&this.Ge.disconnect(),this.getContainer().querySelectorAll([Kl,Zr,Mn].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.it!=null&&this.it.parentNode!=null&&this.it.parentNode.removeChild(this.it),this.Cl(),super.destroy()}$__unmanage(e,t,n){this.Ge!=null&&this.Ge.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(rs(e))sh(this,e).map(n=>L(n,t));else if(gi(e))Qo(this,e).map(n=>L(n,t));else if(kr(e))L(ua(e,this),t);else if(hn(e))L(Ch(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(rs(e))sh(this,e).map(n=>F(n,t));else if(gi(e))Qo(this,e).map(n=>F(n,t));else if(kr(e))F(ua(e,this),t);else if(hn(e))F(Ch(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.Pl(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.Pl(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.Pl(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(j(e))return this.getPortDefinition(e);if(J(e))return this.getNodeDefinition(e)}Pl(e){return e!=null&&e.template&&e.templateId==null&&this.M.addTemplate&&(e.templateId=G(),this.M.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.M.recado!=null&&this.M.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),g=a,m;g=Object.assign({},l?l.parameters||{}:{}),Object.assign(g,a);let E={};for(m in g)g.hasOwnProperty(m)&&g[m]!=null&&(g[m].constructor==Function?E[m]=g[m](a):E[m]=g[m]);if(g=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(l.templateIdResolver&&(y=l.templateIdResolver(g,this,this.model,s)),this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);g[this.$modelWidthAttribute]=x.width,g[this.$modelHeightAttribute]=x.height}d?this.M.rerender(y,g,this.model,e,this,l,s,h,u):this.M.render(y,g,this.model,e,this,l,s,h)}}}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.initialSize!=null)return Object.assign({},a.initialSize)}return this.$_getDefaultSizeForVertex(e,t)}$doRenderNode(e,t){if(this.getElement(e.id)==null){let n=this.getNodeDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.Tl(e,e.data,n,t,!1,null))}}$reRenderNode(e){let t=this.$getManagedElement(e.id);if(t==null)this.$doRenderNode(e);else{let n=this.getNodeDefinition(e);this.Tl(e,e.data,n,null,!0,t.el)}}$doRenderGroup(e,t){if(this.getElement(e.id)==null){let n=this.getGroupDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.zu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(rs(e))XT(this,e,t,n);else if(gi(e))jT(this,e,t,n);else if(kr(e)){ua(e,this);let o=t,s=e;this.qu(s,o,e.rotatable!=null)}else if(hn(e)){Ch(e,this);let o=t,s=e;this.qu(s,o,e.rotatable!=null)}else throw"Could not paint overlay of type ["+e.type+"]"}qu(e,t,n){if(e.location===0||e.location===1){let s=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(e.contentElement,{"data-anchor-x":`${s.x}`,"data-anchor-y":`${s.y}`,"data-anchor-ox":`${s.ox}`,"data-anchor-oy":`${s.oy}`})}e.contentElement.style.left=t.d.minx+Dn,e.contentElement.style.top=t.d.miny+Dn,n&&pi(e.contentElement,t.d.rotation||0)}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,Ul):L(o,Ul))}if(rs(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else gi(e)?e.contentElements&&e.contentElements.forEach(n):kr(e)?n(ua(e,this)):hn(e)&&n(Ch(e,this))}$reattachOverlay(e,t){rs(e)?sh(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):gi(e)?Qo(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):kr(e)?this.$appendElement(ua(e,this),this.getContainer()):hn(e)&&this.$appendElement(Ch(e,this),this.getContainer())}$setOverlayHover(e,t){let n;rs(e)?n=sh(this,e):gi(e)?n=Qo(this,e):kr(e)?n=[ua(e,this)]:hn(e)&&(n=[Ch(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Ut(o,t?[gh]:[],t?[]:[gh])}),this.$setHover(e.connection,t))}destroyOverlay(e){rs(e)&&e instanceof Ju?Af(e):gi(e)?Af(e):YT(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):hn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(rs(e))return e.draw(t,n,o);if(gi(e)){let s=ur(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth,d=null;if(e.rotatable!=null){let u=e.location,p=!1;(X(e.location)||e.location<0||e.location>1)&&(u=parseInt(""+e.location,10),p=!0);let g=ur(t,u,p),m=$e(t,u,.01,p);d=ol(nl(g,m)*180/Math.PI),e.rotatable!=="strict"&&d>90&&d<270&&(d=ol(d-180))}return{d:{loc:s,rotation:d},"stroke-width":h,stroke:a,fill:l,xmin:s.x,xmax:s.x,ymin:s.y,ymax:s.y,tail:s}}else if(kr(e)||hn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0),s=ur(t,d,u)}let a=s.x,l=s.y,h=null;if(e.rotatable!=null){let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0);let p=ur(t,d,u),g=$e(t,d,.01,u);h=ol(nl(p,g)*180/Math.PI),e.rotatable!=="strict"&&h>90&&h<270&&(h=ol(h-180))}return{d:{minx:a,miny:l,cxy:s,rotation:h},xmin:a,xmax:a,ymin:l,ymax:l,tail:s}}else U("WARN: VisuallyJs - could not draw overlay of type ["+e.type+"]. Overlay type unknown.")}updateLabel(e){let t=ua(e,this),n=e.getLabel();n!=null?(t.innerText=n,t.textContent=n):(t.innerText="",t.textContent="")}$setHover(e,t){e.connector!=null&&this.$setConnectorHover(e,t)}$paintConnector(e,t){bv(this,e,t)}$setConnectorHover(e,t){if(t===!1||!this.$isInMotion&&!this.hoverSuspended){e.$hover=t;let n=e.connector,o=n.canvas;o!=null&&(n.hoverClass!=null&&Ut(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Ut(o,t?[gh]:[],t?[]:[gh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.cs===Zi&&this.setOverlayVisible(s,t)}),this.yt||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&U1(e.connector)}$addConnectorClass(e,t){e.canvas&&L(e.canvas,t)}$removeConnectorClass(e,t){e.canvas&&F(e.canvas,t)}$getConnectorClass(e){return e.canvas?e.canvas.className.baseVal:""}$setConnectorVisible(e,t){F1(e,t)}$applyConnectorType(e,t){if(t.cssClass){let n=Array.isArray(t.cssClass)?t.cssClass:[t.cssClass];e.canvas?L(e.canvas,n.join(" ")):e.classesToAddWhenRendered=n}}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.M.cleanupVertex(e.node.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()})),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.M.cleanupVertex(e.group.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()}),t}addClass(e,t){e.constructor===cr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.Ol(e,t,L)}removeClass(e,t){e.constructor===cr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.Ol(e,t,F)}toggleClass(e,t){e.constructor===cr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.Ol(e,t,xf)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?cn(n.el,t):qi(e)?cn(e,t):!1}}Ol(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):qi(s)&&n(s,t)};e!=null&&(Vn(e)?n(e,t):_T(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){Qt.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!Lt(e))throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");let l=super.$manage(e,t,n,o,s,a);return l!=null&&this.Ge!=null&&this.Ge.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Bt(e,Ae(an),this.getContainer(),!0)||Bt(e,Ae(te),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!rt(h.obj)){l=h.obj;let u=h.missingPortCreated,p=j(l)?l.getParent():l,g={},m=t?ji:Hi;if(o=e.getAttribute(m)||e.getAttribute(Hr),!j(l)){let E=t?[ea,NE]:[zo,uu];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(an)||e.getAttribute(Bl),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return j(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?g=this.view.getPortDefinition(o):g=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:g,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return qi(e)}getElementFromEvent(e){let t=Bt(e.target,Ae(gt),this.getContainer(),!0);return t!=null?this.getElement(t.getAttribute(gt)):null}getModelObjectFromElement(e,t,n){let o=s=>{let a;if(s.jtk!=null){if(s.jtk.node!=null)return{obj:s.jtk.node,el:s,missingPortCreated:!1};if(s.jtk.group!=null)return{obj:s.jtk.group,el:s,missingPortCreated:!1};if(s.jtk.port!=null)return{obj:s.jtk.port,el:s,missingPortCreated:!1};if(s.jtk.overlay!=null)return{obj:s.jtk.overlay.connection.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(te);if(l!=null){let h=this.model.getVertex(l);h!=null&&(a={obj:h,el:s,missingPortCreated:!1})}if(a==null){let h=s.getAttribute(an)||s.getAttribute(ea)||s.getAttribute(zo);if(h!=null){let d=Bt(s,Ae(gt),this.fe,!1);if(d!=null){let u=d.getAttribute(gt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let g=s.getAttribute(Hr)||s.getAttribute(ji)||s.getAttribute(Hi)||be;return{obj:p.$addPort({id:h,type:g}),el:s,missingPortCreated:!0}}else{let g=p.getPort(h);return g==null?null:{obj:g,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.fe?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(j(e)?e.getFullId():e).split(this.model.portSeparator),o=this.getRenderedElement(n[0]);return o?o.querySelector(di(an,n[1]))||o.querySelector(di(zo,n[1]))||o.querySelector(di(ea,n[1]))||o:null}$isSupportedElement(e){return qi(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=M(Le,a,o,s);return Or(l,t.width,t.height),this.containerType==="SVG"?dn(l,e):Ie(l,e),l}getRenderedElement(e){var a;if(e==null)return null;let n=(X(e)?e:e.getFullId()).split(this.model.portSeparator),o=(a=this.$getManagedElement(n[0]))==null?void 0:a.el;function s(l,h){return o.querySelector(`:scope [${l}="${h}"]:not(:scope [data-vjs-managed] [${l}="${h}"])`)}if(o&&n.length>1){let l=s(an,n[1])||s(ea,n[1])||s(zo,n[1]);if(l==null){if(this.logicalPorts===!0||o.getAttribute(an)===n[1]||o.getAttribute(ea)===n[1]||o.getAttribute(zo)===n[1]||o.getAttribute(Bl)===n[1]||o.getAttribute(NE)===n[1]||o.getAttribute(uu)===n[1])return o}else return l}else return o}getZoom(){return this.currentZoom}getEffectiveVisibleZoom(){return this.getZoom()}getShapeLibrary(){return this.$shapeLibrary}$getEdgePropertyMappings(){var e;return(e=this.$_propertyMapper)==null?void 0:e.getPropertyMappings()}setSuspendRendering(e,t){this.$suspendRendering=e,this.$_setSuspendDrawing(e),t&&this.refresh()}isSuspendRendering(){return this.$suspendRendering}$getCollapsedGroupSize(e,t){let n=this.$computeCollapsedGroupSize(e,t);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.collapsedSize!=null)return Object.assign({},a.collapsedSize)}return super.$getCollapsedGroupSize(e,t)}$drawAdHocEdge(e,t,n,o=[],s,a,l={}){let h=document.createElement("div"),d=e.lineWidth||2,u=e.color||"#000000",p=Math.max(d,Math.abs(n.x-t.x)),g=Math.max(d,Math.abs(n.y-t.y)),m=M(Le,{viewBox:`0 0 ${p} ${g}`});m.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:g,x=t.x>n.x?0:p,f=t.y>n.y?0:g,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:g},type:wn,length:0}],A={internalSegments:b,totalLength:0,segmentProportions:[[0,1]],segmentProportionalLengths:[1],paintInfo:{sx:E,sy:y,tx:x,ty:f,so:{x:1,y:0},to:{x:-1,y:0},quadrant:1,x:E,y,w:x-E,h:f-y,startStubX:0,endStubX:0,startStubY:0,endStubY:0,opposite:!1,perpendicular:!1,orthogonal:!1,stubs:[0,0],sourceAxis:"x",isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1}},T=(O,v,_)=>{let[P,I]=X(O)?[O,{}]:[O.type,O.options],C=fo(I,l,"_");C.location=v,C.direction=_;let R=at.get(this,P,{instance:this},C),w=this.$drawOverlay(R,A,{stroke:u,fill:u});if(R.isSimpleShape){let B=R,N=w;B.contentTags.forEach((V,D)=>{let $=M(V,N.atts[D]);m.appendChild($)})}else if(gi(R)){let B=R,N=w;B.contentElements.forEach(V=>{dn(V,N.d.loc),m.appendChild(V)})}else if(hn(R)){let B=R,N=w;B.contentElements.forEach(V=>{dn(V,N.d.loc),m.appendChild(V)})}return w};if(s!=null){let O=T(s,0,-1);E=O.tail.x,y=O.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let O=T(a,1,1);x=O.tail.x,f=O.tail.y,b[0].x2=x,b[0].y2=f}b[0].length=Math.sqrt(Math.pow(x-E,2)+Math.pow(f-y,2)),A.totalLength=b[0].length;let S=M(q,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return m.appendChild(S),o.forEach(O=>{let[v,_]=X(O)?[O,{}]:[O.type,O.options],P=fo(_,l,"_"),I=at.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let R=I,w=C;R.contentTags.forEach((B,N)=>{let V=M(B,w.atts[N]);m.appendChild(V)})}else if(gi(I)){let R=I,w=C;R.contentElements.forEach(B=>{dn(B,w.d.loc),m.appendChild(B)})}else if(kr(I))if(I.useHTMLElement){let R=C,w=I.contentElement;h.appendChild(w),w.style.left=`${R.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${R.d.cxy.y}px)`}else{let R=M(q,C.atts[0]);m.appendChild(R)}else if(hn(I)){let R=C,w=I.create(null,null,this,this.model);w.style.position=qe,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${R.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${R.d.cxy.y}px)`}}),h.appendChild(m),h}toBack(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a)),t&&n.obj.group!=null&&this.toBack(n.obj.group)}}toFront(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a))}}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(Lt(n.el))this.$setElementSizeInUI(n.el,t.width,t.height);else{let o=n.contentArea||n.el;this.$setElementSizeInUI(o,t.width,t.height)}}setMode(e,t){}batch(e){this.setSuspendEvents(!0),this.model.batch(e),this.setSuspendEvents(!1)}setEnabled(e,t){let n=e.getFullId(),o=this.getRenderedElement(n)||this.getRenderedPort(n);return o!=null&&qi(o)&&(t?o.removeAttribute(mr):o.setAttribute(mr,ct)),t}flashVertex(e,t=1e3,n=tv){let o=Array.isArray(e)?e:[e],s=`${n} ${t}ms`;o.forEach(a=>{let l=this.getObjectInfo(a,!1);l.obj&&l.el&&(l.el.style.animation=s,L(l.el,_f))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof cr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var ga=`<div data-vjs-vertex="{{id}}" class="${ki} ${Nf}">{{label}}</div>`,QL="<div/>",e0=`<div data-vjs-vertex="{{id}}" class="${Xo} ${If}">{{label}}</div>`,ma=`<svg:rect data-vjs-vertex="{{id}}" class="${ki} ${Nf}" x="0" y="0" width="80" height="60"/>`,t0='<svg:rect x="0" y="0" width="100%" height="30"/>',r0=`<svg:rect data-vjs-vertex="{{id}}" class="${Xo} ${If}" x="0" y="0" width="300" height="250"/>`,Y1={html:{"vjs-node-default":ga,"vjs-group-default":e0,"vjs-port-default":QL},svg:{"vjs-node-default":ma,"vjs-group-default":r0,"vjs-port-default":t0}},Iv=(i,r)=>Y1[i][r],Ep=class{constructor(r,e,t){c(this,"recado");c(this,"asynchronous",!1);c(this,"reactive",!1);c(this,"usesWrapperElement",!1);c(this,"uicore",null);c(this,"currentVertex",null);if(t=t||{},this.recado=yr({defaultTemplate:r,templates:t.templates,templateMacros:t.templateMacros,templateResolver:e}),t.tags)for(let n in t.tags)this.registerTag(n,t.tags[n])}render(r,e,t,n,o,s,a,l){this.uicore=o,this.currentVertex=a;let h=this.recado.template(r,e,null,!1,{obj:a,ui:o,model:o.model}),d=h.childNodes[0];o.$vertexRendered(a,d,s,null),h.$recado.mountings.length>0&&this.recado.mounted(h),this.currentVertex=null}rerender(r,e,t,n,o,s,a,l,h){this.Q(h),this.render(r,e,t,n,o,s,a,l)}Q(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.Q(e)}cleanupPort(r,e){this.Q(e)}addTemplate(r,e){this.recado.addTemplate(r,e)}registerTag(r,e){this.recado.registerTag(r,{template:e.template,rendered:(t,n,o,s)=>{e.rendered&&e.rendered(t,n,o,this.uicore,this.currentVertex)},updated:(t,n,o)=>{e.updated&&e.updated(t,n,o,this.uicore,this.currentVertex)},mounted:e.mounted,fragments:e.fragments})}update(r,e,t,n){if(r.$recado){this.currentVertex=t,this.uicore=n;let o=this.recado.update(r,e,{obj:t});for(let s=0;s<o.removed.length;s++)o.removed[s].el.nodeType!==3&&o.removed[s].el.nodeType!==8&&n.$__unmanage(o.removed[s].el,!1,!0)}}removeElement(r){this.Q(r)}};function Ph(i,r,e){let t=n=>Iv(r?"svg":"html",n)||Ff(n)||i;return new Ep(i,t,e)}var z1="pointerdown",X1="pointermove",j1="pointerup",H1="touchstart",n0="touchmove",i0="touchend";function o0(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var fp=class{constructor(r){c(this,"isPointerDevice");c(this,"isTouchDevice");c(this,"center");c(this,"radius");c(this,"startRadius");c(this,"onPinchStart");c(this,"onPinch");c(this,"onPinchEnd");c(this,"eventManager");c(this,"listenerTypes",{pointer:r=>{let e={},t=[],n=0,o=!1,s=()=>{n===2&&(this.center={x:(t[1].p[0]+t[0].p[0])/2,y:(t[1].p[1]+t[0].p[1])/2},this.radius=o0(t[1].p[0],t[1].p[1],t[0].p[0],t[0].p[1]))},a=d=>{n>=2||o||(t[n]={e:d,p:[d.pageX,d.pageY]},e[""+d.pointerId]=n,n++,s(),n===2&&(this.startRadius=this.radius,this.Yr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this.Qu())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.Yr(this.onPinch))};this.bind(r.el,z1,a,{passive:!1}),this.bind(document,j1,l,{passive:!1}),this.bind(document,X1,h,{passive:!1})},touch:r=>{let e=d=>d.touches||[],t=(d,u)=>d.item?d.item(u):d[u],n=d=>{let u=t(d,0),p=t(d,1);return o0(u.pageX,u.pageY,p.pageX,p.pageY)},o=d=>{let u=t(d,0),p=t(d,1);return{x:(u.pageX+p.pageX)/2,y:(u.pageY+p.pageY)/2}},s=!1,a=d=>{let u=e(d);u.length===2&&r.enableWheelZoom!==!1&&(this.center=o(u),this.radius=this.startRadius=n(u),s=!0,this.bind(document,n0,h),this.bind(document,i0,l),oe(d),this.Yr(this.onPinchStart))},l=d=>{s=!1,oe(d),this.unbind(document,n0,h),this.unbind(document,i0,l),this.Qu()},h=d=>{if(s){let u=e(d);u.length===2&&(oe(d),this.radius=n(u),this.center=o(u),this.Yr(this.onPinch))}};this.bind(r.el,H1,a)}});this.eventManager=new ye,this.isPointerDevice="onpointerdown"in document.documentElement,this.isTouchDevice="ontouchstart"in document.documentElement,this.center={x:0,y:0},this.radius=0,this.startRadius=0,this.onPinch=r.onPinch,this.onPinchStart=r.onPinchStart,this.onPinchEnd=r.onPinchEnd,this.isPointerDevice?this.listenerTypes.pointer(r):this.isTouchDevice&&this.listenerTypes.touch(r)}Yr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}Qu(){this.onPinchEnd()}bind(r,e,t,n){this.eventManager.on(r,e,t)}unbind(r,e,t){this.eventManager.off(r,e,t)}destroy(){}};var yp=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}My(r,e){if(e===ee){let t=r.pos[e];if(r.alignX===yt){let n=Ze(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===ht){let n=Ze(r.el);return t-n.height}return t}}_l(r){let e,t;for(let n in this.fixedElements)if(this.fixedElements.hasOwnProperty(n)){if(e=e||this.panZoom.getApparentCanvasLocation(),t=t==null?this.panZoom.getZoom():t,r!=null&&r!==n)continue;let o=this.fixedElements[n],s=(a,l,h)=>{if(o[a]){let d=this.My(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(We,"x",(a,l)=>{kT(a,l),o.currentPosition.x=l}),s(Te,"y",(a,l)=>{WT(a,l),o.currentPosition.y=l})}}pan(){this._l()}append(r,e,t,n,o){if(r==null)return;let s=r;if(Lt(this.panZoom.canvasElement)&&!Lt(r))return U("ERROR: cannot add non-svg element to fixed layer when container is an SVG element."),null;t=t||{};let a=this.panZoom.idFunction(r);return this.fixedElements[a]={el:s,left:t.left,top:t.top,pos:e,alignX:t.alignX||We,alignY:t.alignY||Te,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},Lt(s)||(s.style.position="absolute"),this.elementPositionSetter(s,e),o?this.panZoom.canvasElement.appendChild(r):this.panZoom.canvasElement.insertBefore(r,this.panZoom.canvasElement.childNodes[0]),this._l(a),this.fixedElements[a]}remove(r){let e=this.panZoom.idFunction(r);e&&this.fixedElements[e]&&(this.panZoom.canvasElement.removeChild(this.fixedElements[e].el),delete this.fixedElements[e],this._l())}destroy(){this.panZoom=null,this.fixedElements=null}};var k1="transformOrigin",s0="transform",W1="translateX",Z1="translateY",J1="scale",a0="px",h0="vjs-pan-zoom",c0="vjs-pan-zoom-canvas";function Ea(){}function l0(i){let r=i,e=0,t=0;for(;r!=null;)isNaN(r.scrollLeft)||(e+=r.scrollLeft),isNaN(r.scrollTop)||(t+=r.scrollTop),r=r.parentNode;return{x:e,y:t}}var fa=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"ep");c(this,"Ft");c(this,"eventManager");c(this,"pinchListener");c(this,"position",{x:0,y:0});c(this,"zoom");c(this,"transformOrigin",{x:0,y:0});c(this,"Rl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"Ll");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"Kr");c(this,"Nn");c(this,"zoomRange");c(this,"zoomAtZoomStart");c(this,"maximumZoomTravel",150);c(this,"distanceAtZoomStart");c(this,"lastDistance");c(this,"canvasAtPanStart");c(this,"lastMouseX",-1);c(this,"lastMouseY",-1);c(this,"fixedTransformOrigin",null);c(this,"lastMovedAt",null);c(this,"lastVelocity",0);c(this,"lastAcceleration",0);c(this,"onZoom");c(this,"onMaybeZoom");c(this,"onPan");c(this,"onPanStart");c(this,"onMouseDown");c(this,"onMouseUp");c(this,"onMouseMove");c(this,"onSetTransformOrigin");c(this,"clamp");c(this,"clampZoom");c(this,"enablePan");c(this,"panWithMetaKey");c(this,"enableWheelZoom");c(this,"enableAnimation");c(this,"wheelCssFilterSpec");c(this,"wheelFilter");c(this,"wheelCssFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"wl");c(this,"Dl");c(this,"Xi");c(this,"Nl");c(this,"Il");c(this,"viewport");c(this,"vs");c(this,"Ge");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"ji",{});c(this,"Vl",!1);c(this,"handlers",{start:(r,e)=>{if(this.pinchZooming)return;(n=>{if(this.enabled){let o=n.srcElement||n.target;return o===this.canvasElement||o===this.viewportElement||o.$jtkDecoration||this.background&&this.background.owns(o)||this.filter(o,n)===!0||n.jy===!0}else return!1})(r)&&(this.$computeCompoundZoom(),this.zoomingWithWheel=!1,this.lastMouseX=-1,this.lastMouseY=-1,r.which===3&&this.enableWheelZoom!==!1&&(r.mozInputSource==null||r.mozInputSource===1)?(this.zooming=!0,this.downAt=me(r),this.Kr=this.$_getViewportSize(),this.mr(),this.ap(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.Xy(r)&&(this.Kr=this.$_getViewportSize(),this.mr(),this.panning=!0,this.aboutToPan=!0,this.downAt=me(r),this.canvasAtPanStart=Object.assign({},this.position),oe(r))),this.onMouseDown(r,this)},move:(r,e)=>{let t,n,o;if(this.zoomingWithWheel=!1,!this.pinchZooming){if(this.zooming)o=me(r),t=o.x-this.downAt.x,n=o.y-this.downAt.y,this.Fl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){oe(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=me(r),t=(o.x-this.downAt.x)/this.vs,n=(o.y-this.downAt.y)/this.vs;let s=this.ot({x:this.canvasAtPanStart.x+t,y:this.canvasAtPanStart.y+n,animate:!1});this.onPan(s.x,s.y,this.zoom,this.zoom,r),this.background&&this.background.pan(),this.fixedLayer.pan(),oe(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||(this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.Kr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,ae,this.wl),this.eventManager.off(document,le,this.Dl),this.eventManager.on(document,ae,this.Xi),this.onMouseUp(r,this))},[At]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||zS,this.Rl=r.zoomStep||.25,this.fixedLayer=new yp(this,r.elementPositionSetter),this.eventManager=new ye,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ge=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.mr()})}),this.Ge.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.ot({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,h0),L(this.canvasElement,c0),new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.$_getViewportSize()})}).observe(this.viewportElement),this.idFunction=r.idFunction,this.onZoom=r.events.zoom||Ea,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||Ea,this.onPanStart=r.events.panStart||Ea,this.onMouseDown=r.events.mousedown||Ea,this.onMouseUp=r.events.mouseup||Ea,this.onMouseMove=r.events.mousemove||Ea,this.onSetTransformOrigin=r.events.transformOrigin||Ea,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.Ll=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let t=r.wheel||{};this.enableWheelZoom=t.zoom!==!1,this.wheelFilter=t.filter||(()=>!0),this.wheelCssFilterSpec=t.cssFilter,this.wheelZoomRequiresMetaKey=t.useMetaKey===!0,this.wheelDirection=t.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(t.sensitivity||10),this.wheelPan=t.pan===!0,this.wheelPanAxis=t.axis||"both",this.rp(),this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.wl=function(n){this.Ml("move",n)}.bind(this),this.Dl=function(n){this.Ml("end",n)}.bind(this),this.Xi=function(n){this.zoomingWithWheel=!1}.bind(this),this.enabled=r.enabled!==!1,this.clampToBackground=r.clampToBackground,this.clampToBackgroundExtents=r.clampToBackgroundExtents,this.filter=r.filter||(()=>!1),(this.enableWheelZoom||this.wheelPan)&&(this.Ft=(n,o,s,a)=>this.wheelPanOrZoom(n,o,s,a),th(this.viewportElement,this.Ft,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new fp({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(n,o,s,a)=>{this.K(a*this.zoomAtZoomStart);let l=n.x-this.downAt.x,h=n.y-this.downAt.y;this.ot({x:this.canvasAtPanStart.x+l,y:this.canvasAtPanStart.y+h,animate:!1})},onPinchStart:(n,o)=>{this.pinchZooming=!0,this.downAt=n,this.distanceAtZoomStart=this.lastDistance=o,this.zoomAtZoomStart=this.zoom,this.Gl(this.downAt.x,this.downAt.y),this.canvasAtPanStart=Object.assign({},this.position)},onPinchEnd:()=>{this.pinchZooming=!1,this.downAt=null}}),this.K(this.zoom,null,!1,!1,!0),this.$l(),this.background=new Mv,r.background&&this.background.addBackground(r.background),this.Nl=n=>{this.start(n)},this.eventManager.on(this.viewportElement,ge,this.Nl),this.eventManager.on(document,ae,this.Xi),this.Il=n=>{this.Ml(At,n)},this.eventManager.on(this.viewportElement,At,this.Il),this.mr(),this.$computeCompoundZoom()}getCompoundZoom(){return this.vs}$addWheelSelectorFilter(r){r!=null&&r.length>0&&(this.wheelCssFilterSpec=[r,this.wheelCssFilterSpec||""].join(" "),this.rp())}$computeCompoundZoom(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.vs=e.width/r.width}$_getViewportSize(){return this.Kr=Ze(this.viewportElement),this.Kr}mr(){return this.Nn=Ze(this.canvasElement),this.Nn}rp(){this.wheelCssFilterSpec!=null&&this.wheelCssFilterSpec.length>0&&(this.wheelCssFilter=r=>{let e=r.srcElement||r.target;return!$t(e,this.wheelCssFilterSpec)})}Gy(r,e,t,n){n=n||150;let{x:o,y:s}=this.position,a=this.zoom,l=r-a,h=e-o,d=t-s,u=null,p=g=>{u||(u=g);let m=g-u,E=m/n,y=a+E*l,x=o+E*h,f=s+E*d;this.canvasElement.style.transform=`scale(${y}) translateX(${x/y}px) translateY(${f/y}px)`,m<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}ot(r){let e=this.np(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.ip(r.zoom);this.Gy(t,e.x,e.y,r.animationDuration)}else this.position=e,this.op(null,r.onComplete);else this.position=e,this.Bl(),r.onComplete&&r.onComplete(this.position);return this.position}sp(r,e,t,n,o){let s=this.position;return this.ot({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}$y(r,e,t,n){n||this.pan(-e*100,-t*100)}By(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.ap(r),this.zoomingWithWheel=!0),this.Fl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(this.wheelCssFilter==null||this.wheelCssFilter(r))&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.By(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===ee?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===fe?t:0,this.$y(r,e,t,n)))}Fy(r,e,t){this.canvasElement.animate(r,{duration:e||250}).finished.then(()=>{for(let n in r)this.canvasElement.style[n]=r[n];t&&t(this.position)})}lp(){return`${J1}(${this.zoom}) ${W1}(${this.position.x/this.zoom}${a0}) ${Z1}(${this.position.y/this.zoom}${a0})`}Bl(){this.canvasElement.style[s0]=this.lp()}op(r,e){if(this.canvasElement.animate!=null){let t={[s0]:this.lp()};this.Fy(t,r,e)}else this.Bl()}Uy(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}$l(){this.canvasElement.style[k1]=this.Uy()}zy(r,e){let t=this.fromPageLocation(r,e),n=this.Nn||this.mr();return{width:n.width,height:n.height,xy:t,xScale:t.x/n.width,yScale:t.y/n.height,o:{x:t.x/n.width*100,y:t.y/n.height*100}}}hp(r,e,t){let n,o,s,a,l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t;n=-(l*(1-this.zoom)),o=-(h*(1-this.zoom)),this.transformOrigin=r,this.$l(),l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t,s=-(l*(1-this.zoom)),a=-(h*(1-this.zoom));let d=this.sp(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}Gl(r,e){if(this.fixedTransformOrigin==null){let t=this.zy(r,e);this.hp(t.o,t.width,t.height)}}ap(r){if(this.fixedTransformOrigin==null){let e=me(r);this.Gl(e.x,e.y)}}$setTransformOriginToCanvasPoint(r,e){if(this.fixedTransformOrigin==null){let t=this.Nn||this.mr();this.hp({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}ip(r){let e=this.zoomRange[0];if(this.smartMinimumZoom){e=.5;let t=this.getBoundsInfo().minimumFill;r/t<e&&(r=t*e)}else r<e&&(r=e);return r>this.zoomRange[1]&&(r=this.zoomRange[1]),r}K(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.ip(r);let s=this.zoom,a=l=>{if(!this.Vl&&(o||this.onZoom(0,0,r,s,e,t),this.background!=null&&this.background.setZoom(r),this.fixedLayer.pan(),this.clampZoom)){let h=this.position,d=this.np(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.ot({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.$setTransformOriginToCanvasPoint(l.x,l.y),this.zoom=r,this.op(null,a)}else this.zoom=r,this.Bl(),a(this.position);return this.zoom}Fl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.Yy(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}Yy(r,e,t,n,o,s){let a=e/(e>=0?n:t),l=e>=0?1:0,h=r+a*(this.zoomRange[l]-r);this.K(h,o,s)}np(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.Kr||this.$_getViewportSize(),o=this.st(),s=r,a=e,l=this.clamp?this.getBoundsInfo():{x:0,y:0,width:0,height:0,vw:n.width,vh:n.height,padding:t,minimumFill:1};if(t=0,(this.clampToBackground||this.clampToBackgroundExtents)&&this.background!=null){let m=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,m),x=Math.max(l.y+l.height,E);l.width=y-l.width,l.height=x-l.height;let f=l.vw/l.width,b=l.vh/l.height;l.minimumFill=Math.min(f,b),this.clampToBackgroundExtents&&(t=Math.max(l.vw,l.vh))}let h=[l.x+l.width,l.y+l.height];this.background&&(h[0]=Math.max(h[0],this.background.getWidth()),h[1]=Math.max(h[1],this.background.getHeight()));let d=r+o.x+h[0]*this.zoom-t,u=e+o.y+h[1]*this.zoom-t,p=r+o.x+l.x*this.zoom+t,g=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),g>l.vh&&(a-=g-l.vh),{x:s,y:a}}}st(){let r=this.Nn||this.mr(),e=this.transformOrigin.x/100*r.width,t=this.transformOrigin.y/100*r.height;return{x:e*(1-this.zoom),y:t*(1-this.zoom)}}Xy(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.Ll!=null?this.Ll(e)!==!1:!0}Ml(r,e){r===At&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=Zo(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,ae,this.Xi),this.eventManager.on(document,ae,this.wl),this.eventManager.on(document,le,this.Dl),this.handlers.start(r,Zo(r)))}getBoundsInfo(r,e){let t=this.Kr||this.$_getViewportSize();if(this.viewport.isEmpty())return{width:0,height:0,x:0,y:0,vw:t.width,vh:t.height,minimumFill:1,zoom:1};r=r||0,e=e||.9;let n=this.viewport.getTopLevelExtents(),o=n.xmax-n.xmin,s=n.ymax-n.ymin,a=t.width/((o+r*2)/e),l=t.height/((s+r*2)/e),h=Math.min(a,l);return{width:o,height:s,x:n.xmin,y:n.ymin,vw:t.width,vh:t.height,minimumFill:h,zoom:this.zoom}}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.ji[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.ji[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.ji[e]}remove(r){let e=this.idFunction(r);delete this.ji[e]}reset(){this.ji={},this.ot({x:0,y:0,animate:!1})}zoomToFit(r){r=r||{};let e=this.getBoundsInfo(r.padding,r.fill);r.doNotZoomIfVisible&&e.minimumFill>this.zoom||this.K(e.minimumFill),this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToFitIfNecessary(r){let e=Object.assign(r||{},{});e.doNotZoomIfVisible=!0,this.zoomToFit(e)}zoomToElements(r){let e=this.$_getViewportSize(),t={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:e.width,vh:e.height};for(let o=0;o<r.elements.length;o++){let s=r.elements[o],a=this.viewport.getPosition(this.idFunction(s));a&&(t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),t.xMax=Math.max(t.xMax,a.x2),t.yMax=Math.max(t.yMax,a.y2))}let n=r.fill||.9;t.width=t.xMax-t.x,t.height=t.yMax-t.y,t.z=n*Math.min(t.vw/t.width,t.vh/t.height),r.doNotZoomIfVisible&&t.z>this.zoom||this.K(t.z),this.centerContent({bounds:t,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToBackground(r){if(r=r||{},this.background!=null){let e=this.background.getWidth(),t=this.background.getHeight(),n=this.$_getViewportSize(),o=n.width/e,s=n.height/t,a=Math.min(o,s),l={width:e,height:t,x:0,y:0,vw:n.width,vh:n.height,padding:0,minimumFill:a,zoom:a};this.K(l.minimumFill),this.centerContent({bounds:l,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}}zoomToExtents(r){let e=Array.isArray(r.extents)?r.extents:[r.extents];if(e.length>0){let t=this.$_getViewportSize(),n={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:t.width,vh:t.height};e.forEach(s=>{n.x=Math.min(n.x,s.x),n.y=Math.min(n.y,s.y),n.xMax=Math.max(n.xMax,s.x+s.width),n.yMax=Math.max(n.yMax,s.y+s.height)});let o=r.fill||.9;n.width=n.xMax-n.x,n.height=n.yMax-n.y,n.z=o*Math.min(n.vw/n.width,n.vh/n.height),r.doNotZoomIfVisible&&n.z>this.zoom||this.K(n.z),this.centerContent({bounds:n,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}}setFilter(r){this.filter=r||(()=>!1)}centerBackground(r){if(this.background!=null){let e=Object.assign({},this.getBoundsInfo());e.x=this.background.getWidth()/2,e.y=this.background.getHeight()/2,e.width=1,e.height=1,this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,vertical:!0,horizontal:!0})}}alignBackground(r,e){if(this.background!=null){let t=r.split(" "),n=t[0]||We,o=t[1]||Te,s=this.getBoundsInfo(),a=n===We?0:s.vw-this.background.getWidth()*this.zoom,l=o===Te?0:s.vh-this.background.getHeight()*this.zoom,h=this.st();this.ot({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}nudgeZoom(r,e){let t=Ki(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.Gl(o,s),this.K(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Fl(0,r,e,!0)}alignContent(r){r=r||{};let e=r.bounds||this.getBoundsInfo(),t=this.position;r.zoom&&this.setZoom(r.zoom,!1);let n=this.Nn||this.mr(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.st(),l=e.x*this.zoom+e.width*this.zoom/2,h=e.y*this.zoom+e.height*this.zoom/2,d=e.vw/2-l,u=e.vh/2-h,p=r.padding||10,g=this.position.x,m=this.position.y,E=o*this.transformOrigin.y/100-e.y+p/this.zoom,y=(E-e.height-2*p+e.vh/this.zoom)*this.zoom,x=r.alignY==null?m:r.alignY===ht?y:r.alignY===It?u-a.y:E*this.zoom,f=s*this.transformOrigin.x/100-e.x+p/this.zoom,b=(f-e.width-2*p+e.vw/this.zoom)*this.zoom,A=r.alignX==null?g:r.alignX===yt?b:r.alignX===It?d-a.x:f*this.zoom;this.ot({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.Vl||(r.doNotFirePanEvent||this.onPan(A-t.x,x-t.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan()),r.onComplete&&r.onComplete({x:A,y:x})}})}alignContentTop(r){r=r||{},r.alignY=Te,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=ht,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=We,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=yt,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:It,r.alignY=r.vertical===!1?null:It,this.alignContent(r)}centerContentHorizontally(r){this.centerContent(Object.assign({horizontal:!0,vertical:!1},r))}centerContentVertically(r){this.centerContent(Object.assign({vertical:!0,horizontal:!1},r))}centerOn(r){let e=Object.assign({},this.getBoundsInfo());Object.assign(e,r.bounds);let t=()=>{this.$setTransformOriginToCanvasPoint(e.x+e.width/2,e.y+e.height/2),r.onComplete&&r.onComplete(e)};this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:t,vertical:r.vertical!==!1,horizontal:r.horizontal!==!1,zoom:r.zoom})}centerOnHorizontally(r){this.centerOn({vertical:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,bounds:r.bounds})}centerOnVertically(r){this.centerOn({bounds:r.bounds,horizontal:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}centerOnAndZoom(r){let e=r.fillRatio||.6,t=r.bounds,n=this.getBoundsInfo(),o=n.vw<n.vh?[n.vw,"width"]:[n.vh,"height"],s=e*o[0],a=s/t[o[1]];a<this.zoomRange[0]&&(a=this.zoomRange[0]),a>this.zoomRange[1]&&(a=this.zoomRange[1]),this.$setTransformOriginToCanvasPoint(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a,doNotAnimate:r.doNotAnimate})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.st(),t=this.position,n={x:r.vw/2,y:r.vh/2};return{x:(n.x-(t.x+e.x))/this.zoom,y:(n.y-(t.y+e.y))/this.zoom}}setViewportCenter(r){let e=Object.assign({},this.getBoundsInfo()),t=this.st(),n={x:e.vw/2,y:e.vh/2},o={x:-(r.x*this.zoom-n.x+t.x),y:-(r.y*this.zoom-n.y+t.y)};this.ot({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.K(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.K(this.zoom+this.Rl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.K(this.zoom-this.Rl,null,null,e)}setZoomRange(r,e){return r!=null&&r.length===2&&r[0]<r[1]&&r[0]!=null&&r[1]!=null&&r[0]>0&&r[1]>0&&(this.zoomRange=r,e||(this.zoom<this.zoomRange[0]||this.zoom>this.zoomRange[1])&&this.K(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.sp(r,e,t,o=>{this.onPan(o.x,o.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan(),n&&n(o)})}setPan(r,e,t,n){let o=this.ot({x:r,y:e,animate:t,onComplete:n});return this.onPan(o.x,o.y,this.zoom,this.zoom),o}startPanRepeat(r,e,t,n,o,s){this.stopPanRepeat();let a=()=>{let l=r*t,h=e*n;s&&s({x:l,y:h}),this.pan(l,h,!1)};a(),this.ep=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.ep)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.$l()}fromPageLocation(r,e,t){let n=this.st(),o=this.position,s=l0(this.viewportElement),a=this.viewportElement.getBoundingClientRect(),l=this.getCompoundZoom(),h={x:((r-(a.x+s.x))/l-(o.x+n.x))/this.zoom,y:((e-(a.y+s.y))/l-(o.y+n.y))/this.zoom};return t&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),h}fromWindowLocation(r,e,t){let n=this.st(),o=this.position,s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l={x:((r-s.x)/a-(o.x+n.x))/this.zoom,y:((e-s.y)/a-(o.y+n.y))/this.zoom};return t&&(l.x=Math.round(l.x),l.y=Math.round(l.y)),l}toPageLocation(r,e){let t=this.st(),n=this.position,o=l0(this.viewportElement),s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l=a*(this.zoom*r+(n.x+t.x))+(s.x+o.x),h=a*(this.zoom*e+(n.y+t.y))+(s.y+o.y);return{x:l,y:h}}toViewportLocation(r,e){let t=this.st(),n=this.position,o=this.getCompoundZoom(),s=o*(this.zoom*r+(n.x+t.x)),a=o*(this.zoom*e+(n.y+t.y));return{x:s,y:a}}mapEventLocation(r){let e=me(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r}getApparentCanvasLocation(){let r=this.st(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.st(),n=this.ot({x:r-t.x,y:e-t.y,animate:!1});return this.background&&this.background.pan(),this.fixedLayer.pan(),n}getVisibleContentArea(){this.$_getViewportSize();let r=this.getApparentCanvasLocation(),e=this.getBoundsInfo(),t=-r.x/e.zoom,n=-r.y/e.zoom,o=e.vw/e.zoom,s=e.vh/e.zoom;return{x:t,y:n,width:o,height:s}}floatElement(r,e){if(r==null)return;let t=r;t.style.position="absolute",t.style.left=e.x+"px",t.style.top=e.y+"px",this.viewportElement.appendChild(r)}fixElement(r,e,t,n,o){return this.fixedLayer.append(r,e,t,n,o)}unfixElement(r){this.fixedLayer.remove(r)}isInViewport(r,e){let t=this.viewportElement.getBoundingClientRect();return t.x<=r&&r<=t.x+t.width&&t.y<=e&&e<=t.y+t.height}setWheelFilter(r){this.wheelFilter=r||(e=>!0)}addBackground(r){this.background.addBackground(r)}removeBackground(r){this.background.removeBackground(r)}destroy(){this.Ge!=null&&(this.Ge.disconnect(),this.Ge=null),this.Ft!=null&&rh(this.viewportElement,this.Ft),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,ae,this.Xi),this.eventManager.off(this.viewportElement,ge,this.Nl),this.eventManager.off(this.viewportElement,At,this.Il),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.Vl=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},Mv=class{constructor(){c(this,"backgrounds",[])}addBackground(r){this.backgrounds.push(r)}removeBackground(r){this.backgrounds=this.backgrounds.filter(e=>e!==r)}getWidth(){return Math.max(...this.backgrounds.map(r=>r.getWidth()))}getHeight(){return Math.max(...this.backgrounds.map(r=>r.getHeight()))}setZoom(r,e){this.backgrounds.forEach(t=>t.setZoom(r,e))}owns(r){return this.backgrounds.find(e=>e.owns(r))!=null}pan(){this.backgrounds.forEach(r=>r.pan())}destroy(){this.backgrounds.forEach(r=>r.destroy()),this.backgrounds.length=0}Ut(r){this.backgrounds.forEach(e=>e.Ut(r))}};function ive(i,r,e,t=500){let n=i.getPan(),o=i.getZoom(),s=performance.now(),a=h=>h<.5?4*h*h*h:1-Math.pow(-2*h+2,3)/2;function l(h){let d=h-s,u=Math.min(d/t,1),p=a(u),g=o+(e-o)*p;i.setZoom(g);let m={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(m.x,m.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var Vv={},xp=class{constructor(r,e,t,n){this.adapter=e;this.container=t;this.id=n;c(this,"fixedElements",new Set);c(this,"floatedElements",new Set);c(this,"appendedElements",new Set)}getFixedElement(r){return Array.from(this.fixedElements).find(e=>e.id===r)}getBounds(){let r=1/0,e=-1/0,t=1/0,n=-1/0,o=s=>{let a=un(s.el),l=Ze(s.el);r=Math.min(r,a.x),e=Math.max(e,a.x+l.width),t=Math.min(t,a.y),n=Math.max(n,a.y+l.height)};return this.fixedElements.forEach(o),this.floatedElements.forEach(o),this.appendedElements.forEach(o),{x:r,y:t,width:e-r,height:n-t}}clear(){this.appendedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.floatedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.fixedElements.forEach(r=>this.adapter.unfixElement(r.el)),this.appendedElements.clear(),this.floatedElements.clear(),this.fixedElements.clear()}},_h=class extends xp{constructor(e,t,n,o,s,a){super(t,n,o,s);this.methods=e;c(this,"incremental");this.incremental=a===!0}decorate(e){this.methods.decorate(e)}reset(e){this.methods.reset(e)}};function K1(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new _h(s,e,t,n,o,s.incremental)}}var bp={get:(i,r,e,t,n)=>{let o=Vv[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{Nx(r,xp)?Vv[i]=r:Vv[i]=K1(r)}};function Gv(i,r,e){if(i==null)return[];let t=[],n=o=>{let s,a,l,h,d=o;if(typeof d=="string"?(s=d,a={},h=G()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||G()),s!=null&&a!=null)l=bp.get(s,a,r,e,h);else{let u=o;h=u.id||G(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new _h(u,{},r,e,h,u.incremental):U('Cannot register decorator. Ensure both "reset" and "decorate" methods are provided.')}return l||(U("Decorator ["+s+"] nor registered VisuallyJs. Not fatal."),null)};for(let o=0;o<i.length;o++){let s=n(i[o]);s&&t.push(s)}return t}var jf=class{constructor(r,e){this.path=r;this.ui=e}getVertexCount(){return this.path.getVertexCount()}getEdgeCount(){return this.path.getEdgeCount()}setVisible(r){this.ui.setVisible(this.path,r)}addVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.addClass(t,r)})}removeVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.removeClass(t,r)})}addEdgeClass(r){this.path.eachEdge((e,t)=>{Wr(this.ui.$_connMap[t.getId()],r)})}removeEdgeClass(r){this.path.eachEdge((e,t)=>{Pr(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var $v="default",q1="center",d0="perimeter",Ap=di(wS,Ct),u0=di(Yo,Ct);function p0(i){return g0(i,u0)}function g0(i,r){let e=Array.from(i.getContainer().querySelectorAll(r)),t=Array.from(i.getContainer().querySelectorAll(".vjs-surface")),n=[];return t.forEach(o=>{let s=Array.from(o.querySelectorAll(r));n.push(...s)}),e.filter(o=>n.indexOf(o)===-1)}function Sp(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function Tp(i,r,e,t,n){let o=null,s=i.getEffectiveVisibleZoom(),a={x:e.x-s*((n==null?void 0:n.x)||0),y:e.y-s*((n==null?void 0:n.y)||0),width:e.width,height:e.height};for(let l=0;l<r.length;l++)if(tt(a,r[l].r)){o=r[l];let h=r[l].modelInfo.typeDef,d=r[l].modelInfo.objEl,u=Wu(t,d,s);r[l].positionOnElement=u,h.anchorPositionFinder!=null?r[l].anchor=h.anchorPositionFinder(d,u,o.modelInfo.vertex,h):r[l].anchor=null;break}return o}function Q1(i,r,e,t,n,o){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let s=o?e.obj:t,a=o?t:e.obj;if(i.model.beforeConnect(s,a,n,!0)===!1)return!1}return!0}function Oh(i,r,e,t,n,o){return Bv(i,r,e,!1,t,n,o)}function Fv(i,r,e,t,n,o){return Bv(i,r,e,!0,t,n,o)}function Bv(i,r,e,t,n,o,s){let a=[],l=[];return p0(i).forEach(d=>{if(d.getAttribute(mr)!==ct){if(s!=null&&d.getAttribute(Jo)!==s)return;let u=Sp(i,d,!1);if(!n&&u.obj===e)return;if(Q1(i,r,u,e,o,t)){let p=d.getBoundingClientRect();a.push({modelInfo:u,isGroup:Y(u.obj),r:p,targetEl:d,targetPortType:d.getAttribute(Hr)||d.getAttribute(Hi),magnet:d.getAttribute(pu)===Ct}),L(d,Er)}else r&&(d.setAttribute(mr,ct),l.push(d))}}),a.sort((d,u)=>{if(d.isGroup&&!u.isGroup)return 1;if(!d.isGroup&&u.isGroup)return-1;if(d.isGroup&&u.isGroup){if(ke(d.modelInfo.vertex,u.modelInfo.obj))return-1;if(ke(u.modelInfo.vertex,d.modelInfo.obj))return-1}else return 0}),{dropTargets:a,disabledDropTargets:l}}var ya=class{constructor(r){c(this,"surface");c(this,"container");c(this,"edgeSnap");c(this,"edgeSnapRequiresMagnets");c(this,"edgeSnapSizeThreshold");c(this,"edgeSnapThreshold");c(this,"edgeSnapType");c(this,"allowLoopbackEdges");c(this,"activeFiltering");c(this,"$active",!1);c(this,"rtree");c(this,"disabledDropTargets",[]);c(this,"dropTargets",[]);c(this,"currentDropTarget");this.surface=r.instance,this.container=this.surface.getContainer(),this.activeFiltering=r.activeFiltering===!0,this.allowLoopbackEdges=r.allowLoopbackEdges===!0;let e=r.edgeSnap||{enabled:!1};this.edgeSnap=e.enabled===!0,this.edgeSnapThreshold=e.threshold||50,this.edgeSnapSizeThreshold=e.sizeThreshold||30,this.edgeSnapType=e.type||$v,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.surface.bind(Gr,t=>{this.$active&&requestAnimationFrame(()=>this.$refreshTree(!0))}),this.surface.bind(yd,t=>{this.$active&&this.rtree.has(t.id)&&requestAnimationFrame(()=>this.$refreshTree(!0,t.id))}),this.rtree=new Do}$refreshTree(r,...e){this.rtree.clear(),this.dropTargets.forEach(t=>{(!this.edgeSnapRequiresMagnets||t.magnet)&&(r&&(e.length===0||e.indexOf(t.modelInfo.obj.id)!==-1)&&(t.r=t.targetEl.getBoundingClientRect()),this.rtree.insert({x:t.r.x,y:t.r.y,width:t.r.width,height:t.r.height,children:[],id:t.modelInfo.obj.id}))})}cp(r,e,t,n){let o=this.rtree.search({x:r.x-e,y:r.y-e,width:e*2,height:e*2});return o.length>0?(o.sort((s,a)=>{let l=Pe(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Pe(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),Ss(o[0],r,!0)?r:n===d0||n===$v&&(o[0].width>t||o[0].height>t)?Mx(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function vp(i){let r=[{x:.5,y:0,ox:0,oy:-1},{x:1,y:.5,ox:1,oy:0},{x:.5,y:1,ox:0,oy:1},{x:0,y:.5,ox:-1,oy:0}].map((e,t)=>[e,Pe(e,i)]);return r.sort((e,t)=>e[1]<t[1]?-1:e[1]>t[1]?1:0),{ox:r[0][0].ox,oy:r[0][0].oy}}var mi=class{constructor(r,e){this.draggableInstance=r;this.options=e;c(this,"In");c(this,"O",{x:0,y:0});c(this,"Cs",{x:0,y:0});c(this,"Ps",!1);c(this,"ae",null);c(this,"dp");this.dp=e.boundsStrategy||"contained",typeof IntersectionObserver!="undefined"&&(this.In=new IntersectionObserver(t=>{this.options.shouldHandle()&&t.forEach(n=>{this.ae=n.rootBounds,n.isIntersecting?this.qr():this.Ps||this.pp(n.boundingClientRect)})},{root:this.draggableInstance.$getDragViewportContainer(),threshold:.99}))}updateDragElementPosition(r){this.options.shouldHandle()&&(this.ae&&!this.ky(r)?this.pp(r):this.qr())}$updateRootBounds(){this.ae=this.draggableInstance.$getDragViewportContainer().getBoundingClientRect()}Hy(r){return this.ae?!(r.right<this.ae.left||r.left>this.ae.right||r.bottom<this.ae.top||r.top>this.ae.bottom):!0}Wy(r){return this.ae?this.ae.left<r.left&&this.ae.right>r.right&&this.ae.top<r.top&&this.ae.bottom>r.bottom:!0}ky(r){return this.dp==="contained"?this.Wy(r):this.Hy(r)}pp(r){if(!this.ae)return;let e=0,t=0;if(r.x<this.ae.x?e=1:r.x+r.width>this.ae.x+this.ae.width&&(e=-1),r.y<this.ae.y?t=1:r.y+r.height>this.ae.y+this.ae.height&&(t=-1),e===0&&t===0){this.qr();return}(!this.Ps||this.Cs.x!==e||this.Cs.y!==t)&&(this.qr(),this.Cs={x:e,y:t},this.Ps=!0,this.draggableInstance.$startPanRepeat(e,t,this.options.autoPanDelta,this.options.autoPanDelta,this.options.autoPanRepeat,n=>{let o=this.draggableInstance.getEffectiveVisibleZoom();this.O.x+=n.x/o,this.O.y+=n.y/o,this.options.onPan(this.O)}))}qr(){this.draggableInstance.$stopPanRepeat(),this.Ps=!1,this.Cs={x:0,y:0}}reset(){this.O.x=0,this.O.y=0,this.qr()}observe(r){this.In!=null&&this.In.observe(r)}unobserve(r){this.In!=null&&(this.In.unobserve(r),this.qr())}disconnect(){var r;(r=this.In)==null||r.disconnect(),this.qr()}};var Bn="keyup",$n="drag",Rh="click",Lh="idle",iPe="dragging",Hf="awaitingClick",kf="locked",Cp=class extends ya{constructor(e){super(e);c(this,"pageDownAt");c(this,"canvasPositionAtDown");c(this,"currentPagePosition");c(this,"scrollAtPageDown");c(this,"currentSource");c(this,"currentPoints",[]);c(this,"mousemoveHandler");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"currentMethod",$n);c(this,"currentState",Lh);c(this,"Ul");c(this,"zl");c(this,"Yl");c(this,"Xl");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"R");c(this,"O",{x:0,y:0});this.currentMethod=e.method||$n,this.Ul=e.Ul,this.zl=e.zl,this.Yl=e.Yl,this.Xl=e.Xl,this.tapHandler=this.Zy.bind(this),this.mousemoveHandler=this.$i.bind(this),this.canvasTapHandler=this.Jy.bind(this),this.documentKeypressHandler=this.jl.bind(this),this.surface.addDragHandler({selector:Ap,start:t=>this.Ky(t),drag:t=>this.qy(t),stop:t=>{this.Qy(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h=this.surface.getEffectiveVisibleZoom(),d=h*this.O.x,u=h*this.O.y,p={x:t.x-this.scrollAtPageDown.x-d,y:t.y-this.scrollAtPageDown.y-u},g=this.cp(p,this.edgeSnapThreshold*h,this.edgeSnapSizeThreshold*h,this.edgeSnapType);return{x:g.x+this.scrollAtPageDown.x+d,y:g.y+this.scrollAtPageDown.y+u}}else return t}}),this.surface.on(this.container,W,Ap,this.tapHandler),this.surface.addDragSelectorFilter(Ap),this.currentMethod===$n&&this.surface.dragOptions.autoPan!==!1&&(this.R=new mi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O.x=t.x,this.O.y=t.y,this.mp()},shouldHandle:()=>!0}))}Q(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,Er),j(e.modelInfo.obj)&&e.modelInfo.obj.edges.length===0&&e.modelInfo.missingPortCreated&&e.modelInfo.obj.getParent().$removePort(e.modelInfo.obj.id)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(e=>{e.removeAttribute(mr)}),this.disabledDropTargets.length=0,F(document.body,mt),F(document.body,$f),F(this.surface.rootElement,Gn),this.surface.off(document,ae,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Bn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,fr),this.currentDropTarget=null),this.transientInfo!=null&&(this.O={x:0,y:0},this.R&&this.R.reset(),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Lh}gp(e,t,n,o){var h;let s=n.getAttribute(du)||((h=e.typeDef)==null?void 0:h.edgeType),a=me(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:qe,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},xv);let l=Object.assign({},o||{});if(s!=null&&(l.type=s),this.transientEdge=this.surface.$addTransientEdge(e.obj,this.transientInfo.vertex,l,{targetAnchor:{x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}}),L(this.surface.rootElement,Gn),this.R!=null){this.R.$updateRootBounds();let d=this.transientInfo.el.el.getBoundingClientRect();this.R.updateDragElementPosition(d)}}Ep(e){return this.currentPagePosition={x:e.x,y:e.y},this.mp()}mp(){if(this.currentPagePosition!=null){let e=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),t=this.transientInfo.el.id;this.surface.viewport.$_updatePosition(t,e.x,e.y),this.surface.$repaintUIElement(this.surface.$getManagedElement(t));let n=this.transientInfo.el.el.getBoundingClientRect();return this.surface.fire(Sb,this.transientEdge),{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}}fp(e){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections>=0&&e.obj.getEdges().length>=e.typeDef.maxConnections)return{canStart:!1,payload:null};let t=this.surface.model.beforeStartConnect(e.obj,e.obj.type);return t===!1?{canStart:!1,payload:null}:{canStart:!0,payload:mo(t)?{}:t}}Ky(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===$n){this.$active=!0;let t=e.el;if(t.getAttribute(mr)!==ct){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=Sp(this.surface,t,!0);if(n!=null){let o=this.fp(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(ji),this.u.edgeType=t.getAttribute(du)||"";let s=t.getAttribute(Jo);this.u.scope=s,this.gp(n,e.e,t,o.payload),L(document.body,mt);let a=n.typeDef.allowLoopback===!0||t.getAttribute(DE)===Ct||this.allowLoopbackEdges,l=Oh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.$refreshTree(),this.surface.$startMotion(),this.surface.fire(Ab,this.transientEdge),!0}}}}return!1}kl(){this.surface.$stopPanRepeat()}Hl(e){if(this.transientEdge!=null){oe(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=Wu(e,this.currentDropTarget.targetEl,this.surface.currentZoom),this.u.targetPortType=this.currentDropTarget.targetPortType,this.u.targetAnchor=this.currentDropTarget.anchor,this.u.positionOnTarget=o,this.u.targetAnchor!=null&&this.u.targetAnchor.portId!=null?j(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):(Y(n)||J(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=me(e);n=this.surface.fromPageLocation(s.x,s.y)}else this.surface.fire(vb);this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{let a=this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},yo,null);this.surface.fire(Tb,a)},()=>{})}}Qy(e){this.kl(),this.surface.$stopMotion(),this.Hl(e.e),this.$active=!1}yp(e,t){this.ex();let n=e();if(this.currentMethod===Rh&&this.currentState==Hf){let s=me(t);this.Ep(s)}let o=Tp(this.surface,this.dropTargets,n,t,this.O);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,fr),o!=null){if(L(o.targetEl,fr),o.anchor!=null)this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0},o.anchor),this.transientConnection.anchors.target.isFixed=!0;else if(o.positionOnElement!=null){let s=vp(o.positionOnElement);this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},s),this.transientConnection.anchors.target.isFixed=!0}}else delete this.transientConnection.anchors.target.fixedLocation,this.transientConnection.anchors.target.isFixed=!1;this.currentDropTarget=o}$i(e){let t=me(e);this.yp(()=>({x:t.x,y:t.y,width:5,height:5}),e)}qy(e){this.yp(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.Ep(t),this.R!=null&&this.transientInfo!=null&&this.R.updateDragElementPosition({left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height,width:n.width,height:n.height,x:n.x,y:n.y});else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}ex(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}Zy(e){if(this.currentMethod===Rh&&this.currentState!==kf){let t=e.target||e.srcElement;if(t.getAttribute(mr)!==ct){let n=Sp(this.surface,t,!0);if(n!=null){if(this.currentState===Lh){oe(e),this.$active=!0,this.pageDownAt=me(e),this.u={};let o=this.fp(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Hr)||t.getAttribute(ji),this.u.edgeType=t.getAttribute(du);let s=t.getAttribute(Jo);this.u.scope=s,this.currentSource=n.obj,L(document.body,$f),this.gp(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(DE)===Ct||this.allowLoopbackEdges,l=Oh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=Hf,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,ae,this.mousemoveHandler),document.addEventListener(Bn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===Hf){for(let o=0;o<this.dropTargets.length;o++)if(this.dropTargets[o].modelInfo.obj===n.obj){this.currentDropTarget=this.dropTargets[o];break}this.currentDropTarget!=null&&this.Hl(e),this.$active=!1}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.Q()}Jy(e){if(!e.defaultPrevented&&this.currentMethod===Rh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=me(e);for(let n=0;n<this.dropTargets.length;n++)Ss(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.Hl(e),this.$_exitTapMode())}}jl(e){this.currentState===Hf&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var Uv="primed",Yv="idle",zv="active",Pp=class extends ya{constructor(e){super(e);c(this,"Wl");c(this,"Os");c(this,"zt");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"R");c(this,"O",{x:0,y:0});c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"_s",!1);c(this,"Qr");c(this,"Vn");this.Wl=e.inputHandler,this.Os=e.method||$n,this.zt=Yv,this.documentKeypressHandler=this.jl.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.zt===Uv){this.Qr=St({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.Qr),this.Vn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,Gn),Ut(a,[wf],[Qu]),this._s=!0,this.zt=zv,this.Wl.currentState=kf}if(oe(n),this.currentPagePosition=me(n),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom(),l=a*this.O.x,h=a*this.O.y,d={x:this.currentPagePosition.x-l,y:this.currentPagePosition.y-h},u=this.cp(d,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType);this.currentPagePosition={x:u.x+l,y:u.y+h},this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.xp();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=Tp(this.surface,this.dropTargets,o,n,this.O);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,fr),s!=null){if(L(s.targetEl,fr),s.anchor!=null)this.Qr.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.Qr.isFixed=!0;else if(s.positionOnElement!=null){let a=vp(s.positionOnElement);this.Qr.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.Qr.isFixed=!0}}this.currentDropTarget=s,this.R!=null&&this.R.updateDragElementPosition(this.transientVertex.el.el.getBoundingClientRect())}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(oe(n),this._s)if(this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.currentDropTarget!=null){let o=this.currentEdge,s=this.currentDropTarget.modelInfo.obj,a=this.currentIndex;this.surface.model.beforeMoveConnection(a===it?s:o.source,a===it?o.target:s,o)===!1?this.Zl():(this.Q(this.currentDropTarget.anchor),a===it?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Vn.dummy===!0?(this.surface.model.updateVertex(this.Vn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.Q()):this.Zl();else(this.Os===$n||this.zt===zv)&&this.Q();else this.Q();this.$active=!1};let t=n=>o=>{if(!o.defaultPrevented){let s=Bt(o.target,Ae(Qe),this.container,!1);if(s!=null){if(this.currentEdge=this.surface.model.getEdge(s.getAttribute(Qe)),this.currentEdge.transient)this.$active=!1,this.currentEdge=null,this.zt=Yv;else if(this.Vn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),this.currentConnection.detachable||this.Vn.dummy===!0){if(this.$active=!0,this._s=!1,this.currentIndex=n,oe(o),this.O={x:0,y:0},this.currentPagePosition=me(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,ae,this.mouseMoveHandler),this.surface.on(document,le,this.mouseUpHandler),this.zt=Uv,this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},gv),this.nx(),L(this.currentConnection.connector.canvas,Qu),this.Os===Rh)document.addEventListener(Bn,this.documentKeypressHandler);else if(this.R!=null){this.R.$updateRootBounds();let a=this.transientVertex.el.el.getBoundingClientRect();this.R.updateDragElementPosition(a)}this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge)}}}};this.surface.on(this.container,ge,z(Qi),t(it)),this.surface.on(this.container,ge,z(eo),t(vn)),this.Os===$n&&this.surface.dragOptions.autoPan!==!1&&(this.R=new mi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:n=>{this.O.x=n.x,this.O.y=n.y,this.xp()},shouldHandle:()=>!0}))}xp(){let e={x:this.currentPosition.x,y:this.currentPosition.y},t={[this.transientVertex.vertex.id]:e};this.surface.$_updateVertexPositions({positions:t,sizes:null,offset:{x:0,y:0},repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.surface.fire(Pd,this.currentEdge)}Zl(e){if(e===!0||this.surface.model.beforeDetach(this.currentEdge.source,this.currentEdge.target,this.currentEdge)===!1||this.currentConnection.reattach)this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex),this.surface.$repaintUIElementById(this.currentEdge.source.id),this.Q();else{let n=this.currentEdge.id;this.Q(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.O.x,y:this.currentPosition.y+this.O.y},this.currentIndex):this.surface.model.removeEdge(n)}}Q(e){if(this.rtree.clear(),this.Qr=null,this.dropTargets.forEach(t=>{F(t.targetEl,Er)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(mr)}),this.disabledDropTargets.length=0,F(document.body,mt),F(this.surface.rootElement,Gn),Ut(this.currentConnection.connector.canvas,[],[wf,Qu]),document.removeEventListener(Bn,this.documentKeypressHandler),this.surface.off(document,ae,this.mouseMoveHandler),this.surface.off(document,le,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,fr),this.currentDropTarget=null),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex!=null&&this.surface.$removeTransientVertex(this.transientVertex.el),this.surface.$stopMotion(),this.currentEdge!=null){let t=this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex,e);t&&this.surface.$repaintUIElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this._s=!1,this.zt=Yv,this.Wl.currentState=Lh,this.Vn=null}nx(){if(this.currentIndex===it){let e=Fv(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=Oh(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.$refreshTree()}jl(e){(this.zt===zv||this.zt===Uv)&&(e.keyCode===27||e.key==="Escape")&&this.Zl(!0)}};var xr="pan",Ei="select",ns="disabled",Fn="vertexDrawing";var xa="vjs-anchor-placeholder",eG="vjs-anchor-candidate",Wf="vjs-connection-edit",_p="vjs-edge-guideline",Un="vjs-edge-handle";var Zf=z(xa),Xv=12,jv=15;function Jf(i,r,e,t){let n=M(Q,e||{});L(n,r),t||(n.style.display=pt);let o=M(Be,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function m0(i,r,e,t,n,o,s){let a=M(Q);L(a,n),s||(a.style.display=pt);let l=M(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function Hv(i,r,e,t,n,o,s){let a=Jf(t,n,o,s);return i.$appendElementToToolsLayer(a),Ie(a,{x:r,y:e}),a}function kv(i,r,e,t,n,o,s,a,l,h){let d=m0(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),Ie(d,{x:r,y:e}),d}function Wv(i,r,e){let t=i.faces,n=[{face:We,dist:Math.abs(r.x-e.x),midx:e.x,midy:e.y+e.height/2,x:0,y:.5,ox:-1,oy:0},{face:yt,dist:Math.abs(e.x+e.width-r.x),midx:e.x+e.width,midy:e.y+e.height/2,x:1,y:.5,ox:1,oy:0},{face:Te,dist:Math.abs(r.y-e.y),midx:e.x+e.width/2,midy:e.y,x:.5,y:0,ox:0,oy:-1},{face:ht,dist:Math.abs(e.y+e.height-r.y),midx:e.x+e.width/2,midy:e.y+e.height,x:.5,y:1,ox:0,oy:1}],o=new Map;o.set(Te,[0,-1]),o.set(ht,[0,1]),o.set(We,[-1,0]),o.set(yt,[1,0]),n.sort(function(l,h){return l.dist<h.dist?-1:1});let s=null,a=null;for(let l=0;l<n.length;l++)if(t.indexOf(n[l].face)!=-1){s=n[l].face,r={x:n[l].midx,y:n[l].midy},a={x:n[l].x,y:n[l].y,offsetX:0,offsetY:0,ox:n[l].ox,oy:n[l].oy};break}return[a,s]}function Zv(i,r,e){let t=Pc(r,e,i.locations);return E0(t.p,e)}function Jv(i,r,e,t,n,o,s,a){let l=a.getVertexDefinition(n),h=r(e,t,n,l);if(h!=null){let d={x:h.x,y:h.y,ox:h.ox,oy:h.oy,offx:h.offsetX||0,offy:h.offsetY||0,cls:""};return E0(d,o)}}function E0(i,r){let e=i.offsetX==null?0:i.offsetX,t=i.offsetY==null?0:i.offsetY;return Object.assign({curX:r.x+i.x*r.width+e,curY:r.y+i.y*r.height+t,offsetX:e,offsetY:t},i)}var no=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"bp");c(this,"ix");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"Ap",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"gr");c(this,"Er");c(this,"Jl");c(this,"fr");c(this,"Rs");c(this,"buttonSize");c(this,"Sp");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"Kl");c(this,"yr");c(this,"lx",{});c(this,"xr",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||Xv,this.Sp=e.anchorPlaceholderSize||jv,this.fr=!1,this.ui.model.bind(Cn,()=>{this.deactivate()}),this.ui.bind(ti,l=>{l.edge==this.currentEdge&&this.Yt()}),this.eventManager=new ye,this.$addDragHandler({selector:Zf+" *",target:Zf,constrainFunction:(l,h,d,u,p,g)=>{let m=h.Ls.anchor,E={x:l.x,y:l.y},y=!1,x=this.yr.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.xr.rotation!==0&&(y=!0,E=Me(l,this.xr.center,-this.xr.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.Kl!=null)A=Jv(m,this.Kl,x.el,b,this.yr.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(m.isContinuous){let[T,S]=Wv(m,E,f);A=T,S!=null&&(m.currentFace=S),this.$hasEdits=!0}else A=Zv(m,l,f),this.$hasEdits=!0;return m.fixedLocation=A,m.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x,null,null,!0),y&&(l=Me(l,this.xr.center,this.xr.rotation)),l},start:l=>{let d=l.el.Ls.vertex;if(this.yr=this.ui.getObjectInfo(d,!1),this.Ap.length=0,this.yr.obj!=null)this.Jl=this.$cloneCurrentGeometry(),this.Kl=this.currentEdge.source.id===this.yr.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.xr.rotation=this.ui.$getRotation(d.id),this.xr.rotation!==0&&(this.xr.center={x:this.yr.managedElement.t.c.x,y:this.yr.managedElement.t.c.y});else return!1},stop:l=>{this.Ap.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Jl),this.Jl=null,this.yr=null},drag:l=>{this.Yt()}});let t=(l,h)=>{this.hx(l)?h(l):Y(l)&&(ke(this.currentEdge.source,l)?h(this.currentEdge.source):ke(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.fr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.ux(d)})}),this.Yt())},o=l=>{this.fr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.px(d))})};this.ui.bind(Vt,l=>{o(l)}),this.ui.bind(Mt,l=>{n(l)}),this.ui.bind(Vr,l=>{o(l)}),this.ui.bind(To,l=>{n(l)});let s=l=>{this.fr&&this.currentEdge&&t(l.vertex,h=>this.Yt())};this.ui.model.bind(Re,s),this.ui.model.bind(ve,s);let a=l=>{this.fr&&this.currentEdge&&l.id===this.currentEdge.id&&this.Yt()};this.ui.bind(Pd,l=>{a(l)}),this.ui.model.bind(on,l=>{a(l.edge)}),this.ui.model.bind(nn,l=>{a(l.edge)})}isBusy(){return this.Rs}$cloneCurrentGeometry(){return lt(this.currentConnector.geometry)}Tp(r){return this.ui.view.getTypeDefinition(r).anchorPositions}vp(r,e){let t={type:e.type,options:Object.assign(e.options,{id:G()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}mx(r,e){this.Cp(),e.forEach(t=>{this.vp(r,t)})}Cp(){this.currentOverlays.forEach(r=>{ko(this.current,r.id)})}gx(r){let e=r.deleteButtonClass||na,t=r.deleteButtonLocation||.1,n=()=>this.ui.model.removeEdge(this.currentEdge),o=()=>{r.onMaybeDelete?r.onMaybeDelete(this.currentEdge,this.current,n):n()};(Array.isArray(t)?t:[t]).forEach(a=>{this.vp(this.current,{type:gr.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){if(this.current){let e=Object.assign(r||{},{fireEvent:!0});this.ui.$paintConnection(this.current,e),this.Yt(r)}}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Yt(r){this.current&&(this.ql(),this.$repaint(r))}ql(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=this.ui.getElement(e===0?this.current.sourceId:this.current.targetId);if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),[l,h]=[a.curX-o.x,a.curY-o.y],d;t!=null?d=t:(d=Jf(this.Sp,xa,{[Qe]:this.currentEdge.id},!0),d.Ls={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(d);let u=this.ui.$getSize(d),p={x:o.x+(l-u.width/2),y:o.y+(h-u.height/2)};return Ie(d,p),[[o.x,o.y],d]}else return[[0,0],null]};this.ui.$removeElement(this.gr),this.currentEdge.source.dummy||([this.sourceDimensions,this.gr]=r(0,this.gr)),this.ui.$removeElement(this.Er),this.currentEdge.target.dummy||([this.targetDimensions,this.Er]=r(1,this.Er))}}Ex(){this.current&&(this.gr&&(this.gr.parentNode.removeChild(this.gr),delete this.gr.Ls),this.Er&&(this.Er.parentNode.removeChild(this.Er),delete this.Er.Ls)),this.gr=null,this.Er=null,this.sourceDimensions=null,this.targetDimensions=null}fx(){this.current&&Yi(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.fx(),this.$clearHandles(),this.ui.$repaintUIElementById(this.current.sourceId),this.ui.$repaintUIElementById(this.current.targetId)}isActive(){return this.fr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;Ie(r,{x:o,y:s})}activate(r,e,t){if(!(this.current!=null&&this.current===e)){if(this.deactivate(),this.current=e,this.currentConnector=this.current.connector,this.currentEdge=r,this.bp=this.ui.model.getEdgeType(r.data),this.ix=this.ui.view.getEdgeDefinition(this.bp),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=ia(t.anchorPositions),this.targetAnchorPositionFinder=ia(t.anchorPositions);else{let n=this.Tp(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=ia(n));let o=this.Tp(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=ia(o))}this.$activate(e,t),t.overlays&&this.mx(e,t.overlays),t.deleteButton===!0&&this.gx(t),this.ql(),Wr(this.current,Wf),this.fr=!0}}deactivate(r){this.current!=null&&(this.Cp(),Pr(this.current,Wf),this.Ex()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.fr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.Rs=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=Hv(this.ui,r,e,t,o,{[Qe]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=kv(this.ui,r,e,t,n,o,s,a,{[Qe]:this.currentEdge.id},l);return this.$setElementPosition(h,r,e),h}$makeAndAppendDeleteHandle(r,e,t,n,o,s){let a=this.$makeAndAppendCircularHandle(r,e,t,n,o,s),l=M(et,{x:`${t/2}`,y:`${n/2}`,[Qe]:this.currentEdge.id});return l.innerHTML="\u2716",a.appendChild(l),a}$addDragHandler(r){this.ui.addDragHandler({selector:r.selector,target:r.target,start:e=>{let t=r.start(e);return t!==!1&&(this.Rs=!0),t},drag:e=>r.drag(e),stop:e=>{this.Rs=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.lx[r.selector]=r}ux(r){this.ql(),this.$elementDragging(r)}px(r){this.$elementDragged(r)}hx(r){return this.currentEdge==null?!1:r.id===dl(this.currentEdge.source)||r.id===dl(this.currentEdge.target)}};var Rr=new Map;function tG(i,r,e){let t=Rr.get(i);return new t(r,e)}function rG(i){return i.type===Xr&&i.constrain===rn?zi:i.type}var ba=class{constructor(r,e){this.ui=r;this.ws=e;c(this,"Ql",new Map);c(this,"Pp");c(this,"Xe",!1);c(this,"Mn");c(this,"at");r.bind(Ii,()=>(this.destroy(),!0)),this.ws=this.ws||{},this.Pp=this.ws.hoverMode===!0,this.ui.model.bind(bt,t=>{this.Mn&&this.Mn.id===t.edge.id&&this.stopEditing()}),this.Pp&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.Mn&&this.Mn.id===t.id&&(this.Xe=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Xe=!1}),ci()&&(this.ui.bind(Cd,t=>{t.obj.transient||(!this.at||!this.at.isBusy()&&this.at.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(vd,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Xe){let t=this.Op(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=rG(t.connector);if(Rr.has(o)){if(this.at=this.Ql.get(o),this.at==null){let s=Object.assign({},this.ws||{});this.at=tG(o,this.ui,s),this.Ql.set(o,this.at)}this.Mn=n,this.at.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.at&&this.at.deactivate(),this.Mn=null,this.at=null}clearEdits(r){let e=this.Op(r);return e!=null?(Yi(e),!0):!1}Op(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):oa(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.Ql.clear()}};function Kv(){}function Op(i,r){let e=document.createElement("div");return L(e,r.join(" ")),i.appendChild(e),e}var Aa=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"Ds");c(this,"el");c(this,"lt");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});c(this,"canvasExtent",{x:0,y:0});c(this,"O",{x:0,y:0});c(this,"Xt");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"onClick");c(this,"hasMoved",!1);c(this,"down",!1);c(this,"moving",!1);c(this,"invert");c(this,"surface");c(this,"mt");c(this,"eventManager");c(this,"eh");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",ge);c(this,"upEvent",le);c(this,"moveEvent",ae);c(this,"enabled",!1);c(this,"th");c(this,"_p");c(this,"xt");c(this,"bx",[".vjs-connector-path",".vjs-connector-outline"]);this.surface=r.surface,this.onStart=r.onStart||Kv,this.onEnd=r.onEnd||Kv,this.onSelect=r.onSelect||Kv,this.onClick=r.onClick||null,this.Ds=r.generateLassoContent,this.eh=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.en.bind(this),this.upListener=this.Ar.bind(this),this.moveListener=this.rn.bind(this),this.eventManager=new ye,this.th=r.enableInGroups===null?!0:r.enableInGroups,this.yx(r.filter),this.invert?this.xx():this.el=Op(this.surface.getContainer(),[rv,r.cssClass||""]),this.lt=M(Z,{width:1,height:1,x:0,y:0,fill:"transparent"}),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(_n,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)}),this.surface.addVertexDragFilter(e=>this.enabled&&this.th!==!1?e.vertex.objectType===ce.objectType?!0:!(this.th==="metaKey"?e.e.metaKey:!0):!0),r.autoPan!==!1&&(this.Xt=new mi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:e=>{this.O.x=e.x,this.O.y=e.y,this.Rp()},shouldHandle:()=>!0}))}Ax(r){let e=r.srcElement||r.target;return this.bx.find(t=>$t(e,t))!=null}yx(r){r==null?this.mt=function(){return!1}:X(r)?this.mt=e=>{let t=e.srcElement||e.target;return $t(t,r)}:this.mt=r}Lp(r,e,t){this.visibleOrigin=r,this.size=e;let n=this.surface.fromPageLocation(r.x,r.y);if(this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height),this.invert){let o=window.innerWidth,s=window.innerHeight,a=window.pageXOffset,l=window.pageYOffset,h=s-r.y+l,d=s-h+e.height,u=o-r.x+a,p=o-u+e.width;this.masks.top.style.bottom=h+"px",this.masks.bottom.style.top=d+"px",this.masks.left.style.right=u+"px",this.masks.right.style.left=p+"px",this.masks.top.style.left=o-u+"px",this.masks.top.style.right=o-p+"px",this.masks.bottom.style.left=o-u+"px",this.masks.bottom.style.right=o-p+"px"}else{let o=this.surface.getEffectiveVisibleZoom();er(this.el,{x:n.x,y:n.y}),Or(this.el,e.width/o,e.height/o)}if(this.lt.setAttribute("x",`${t.x}`),this.lt.setAttribute("y",`${t.y}`),this.Xt!=null&&this.lt.parentElement!=null){let o=this.lt.getBoundingClientRect();this.Xt.updateDragElementPosition(o)}}Ut(r){let e=r?Cr:pt;this.invert?(this.masks.top.style.display=e,this.masks.left.style.display=e,this.masks.right.style.display=e,this.masks.bottom.style.display=e):this.el.style.display=e,r?this.surface.addClass(document.body,mt):this.surface.removeClass(document.body,mt)}wp(r){return this.eh==null?r:this.eh(r)}en(r){if(this.enabled&&!this.Ax(r)&&!this.mt(r)){oe(r),this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.O.x=0,this.O.y=0,this.hasMoved=!1;let e={width:1,height:1};this.origin=this.wp(me(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height);let t=this.surface.getElementFromEvent(r);if(!this.invert&&this.Ds){let n=this.Ds(this.origin,r);n!=null?(this._p=n,this.el.replaceChildren(n)):this.el.innerHTML=""}this.Lp(this.origin,e,this.canvasOrigin),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r,t),this.Xt!=null&&(this.Xt.reset(),this.surface.$appendElementToToolsLayer(this.lt),this.Xt.observe(this.lt))}}Rp(r){if(this.xt!=null){let e=this.surface.fromPageLocation(this.xt.x,this.xt.y),t={x:this.canvasOrigin.x+this.O.x,y:this.canvasOrigin.y+this.O.y},n=this.surface.toPageLocation(t.x,t.y),o={width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)},s={width:Math.abs(this.xt.x-n.x),height:Math.abs(this.xt.y-n.y)},a={x:Math.min(n.x,this.xt.x),y:Math.min(n.y,this.xt.y)},l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)};o.width>0&&o.height>0&&(this.hasMoved=!0,this.Lp(a,s,e),this.onSelect(a,s,l,o,[n.x<this.xt.x,n.y<this.xt.y],r,this._p))}}rn(r){this.down&&(this.moving||(this.Ut(!0),this.moving=!0),oe(r),this.xt=this.wp(me(r)),this.Rp(r.shiftKey))}Ar(r){if(this.down){this.lt.parentElement&&this.lt.parentElement.removeChild(this.lt),this.Xt!=null&&(this.Xt.unobserve(this.lt),this.Xt.reset());let e=this.moving;this.down=!1,this.moving=!1,oe(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.Ut(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.Ds&&(this.el.innerHTML="")}}xx(){this.masks.top=Op(document.body,[ch,iv]),this.masks.bottom=Op(document.body,[ch,sv]),this.masks.left=Op(document.body,[ch,nv]),this.masks.right=Op(document.body,[ch,ov])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Se=class{constructor(){c(this,"tracksEdgeRedraws",!1)}$groupMemberAdded(r){}$groupMemberRemoved(r){}$nodeRemoved(r){}$groupRemoved(r){}$groupResized(r){}$groupCollapsed(r){}$groupExpanded(r){}$vertexRotated(r,e){}$vertexResized(r,e,t){}$vertexRerendered(r){}$vertexUpdated(r,e){}$vertexSynced(r){}$edgeRemoved(r){}$edgeUpdated(r){}$edgeRendered(r){}};var qv="logarithmic",Qv="absolute";var f0={},io={get:i=>{let r=f0[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{f0[i]=r}};var Kf=class Kf{constructor(r){c(this,"type",Kf.type);c(this,"canvas");c(this,"onBackgroundReady");c(this,"imagePlaceholder");c(this,"ui");c(this,"image");c(this,"url");this.ui=r.ui,this.canvas=r.canvas,this.onBackgroundReady=r.options.onBackgroundReady||((e,t)=>{}),this.image=r.options.img,this.url=r.options.url,this.imagePlaceholder=new Image,this.imagePlaceholder.onload=()=>{this.canvas.style.backgroundImage="url('"+this.imagePlaceholder.src+"')",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.width=this.imagePlaceholder.width+"px",this.canvas.style.height=this.imagePlaceholder.height+"px",this.onBackgroundReady(this,r.ui)},this.Gn(r.options)}Gn(r){this.imagePlaceholder.src=this.image?this.image.src:this.url}setUrl(r){this.imagePlaceholder&&(this.imagePlaceholder.src=r)}owns(r){return r===this.canvas}getWidth(){return this.imagePlaceholder&&this.imagePlaceholder.width||0}getHeight(){return this.imagePlaceholder&&this.imagePlaceholder.height||0}setZoom(r,e){}pan(){}destroy(){this.imagePlaceholder=null}Ut(r){}};c(Kf,"type","simple");var Rp=Kf;io.register(Rp.type,Rp);var y0="vjs-background-tile",eC=class{constructor(r,e,t){c(this,"scaledImageSize");c(this,"scaledImageSizeH");c(this,"container");c(this,"zoom");c(this,"specs");c(this,"url");c(this,"urlGenerator");c(this,"apparentZoom");c(this,"xTiles");c(this,"yTiles");c(this,"jt",[]);let n=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.width,o=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.height;this.scaledImageSize=n,this.scaledImageSizeH=o,this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.height="100%",this.container.style.width="100%",this.container.style.display="none",e.canvas.insertBefore(this.container,e.canvas.firstElementChild),this.zoom=t,this.specs=r.getTileSpecs(t),this.url=e.options.url,this.urlGenerator=r.urlGenerator,this.apparentZoom=Math.min(this.specs.xSize,this.specs.ySize),this.xTiles=this.specs.xCount,this.yTiles=this.specs.yCount;for(let s=0;s<this.xTiles;s++){this.jt[s]=this.jt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.Sx=!0,l.className=y0,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.jt[s][a]=[l,new Image,!1]}}}Tx(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}vx(r,e,t){return this.urlGenerator==null?this.Tx(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}Cx(r,e,t,n){r.style.left=t*this.scaledImageSize+"px",r.style.top=n*this.scaledImageSizeH+"px",r.style.width=this.scaledImageSize+"px",r.style.height=this.scaledImageSizeH+"px",e.onload=function(){r.setAttribute("src",e.src),r.style.opacity=1},e.src=this.vx(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.jt[o]!=null&&this.jt[o][s]!=null&&(this.jt[o][s][2]||(this.Cx(this.jt[o][s][0],this.jt[o][s][1],o,s),this.jt[o][s][2]=!0))}},qf=class qf{constructor(r){c(this,"type",qf.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"width");c(this,"height");c(this,"tileSize");c(this,"panDebounceTimeout");c(this,"zoomDebounceTimeout");c(this,"maxZoom");c(this,"ui");c(this,"tiling");c(this,"urlGenerator");c(this,"Dp");c(this,"Np");if(r.options.maxZoom==null)throw new Error("Parameter `maxZoom` not set; cannot initialize TiledBackground");if(!r.options.tileSize)throw new Error("Parameter `tileSize not set; cannot initialize TiledBackground. It should be in the form {w:width, h:height}.");if(!r.options.width||!r.options.height)throw new Error("Parameters `width` and `height` must be set");this.canvas=r.canvas,this.viewport=r.viewport,this.urlGenerator=r.options.urlGenerator,this.ui=r.ui,this.tiling=r.options.tiling||qv,this.width=r.options.width,this.height=r.options.height,this.maxZoom=r.options.maxZoom,this.tileSize=r.options.tileSize,this.panDebounceTimeout=r.options.panDebounceTimeout||50,this.zoomDebounceTimeout=r.options.zoomDebounceTimeout||120,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.Dp=this.debounce(this.Ip,this.zoomDebounceTimeout),this.Np=this.debounce(this.Vp,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new eC(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Px(){if(this.widgetZoom<=this.layers[0].apparentZoom)return 0;if(this.widgetZoom>=this.layers[this.layers.length-1].apparentZoom)return this.layers.length-1;for(let r=this.layers.length-1;r>0;r--)if(this.layers[r].apparentZoom>=this.widgetZoom&&this.widgetZoom>=this.layers[r-1].apparentZoom)return r}Ox(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}Vp(){let r=this.ui.getApparentCanvasLocation(),e=this.ui.$getSize(this.viewport),t=e.width,n=e.height,o=this.currentLayer.scaledImageSize*this.widgetZoom,s=this.currentLayer.scaledImageSizeH*this.widgetZoom,a=r.x<0?Math.floor(-r.x/o):r.x<t?0:null,l=r.y<0?Math.floor(-r.y/s):r.y<n?0:null,h=Math.min(this.currentLayer.xTiles,Math.floor((t-r.x)/o)),d=Math.min(this.currentLayer.yTiles,Math.floor((n-r.y)/s));a==null||l==null||this.currentLayer.ensureLoaded(a,l,h,d)}getCurrentLayer(){return this.currentLayer}debounce(r,e){e=e||150;let t=null;return()=>{window.clearTimeout(t),t=window.setTimeout(r.bind(this),e)}}Ip(){this.Ox(this.Px()),this.Vp()}setZoom(r,e){this.widgetZoom=r,e?this.Ip():this.Dp()}pan(){this.Np()}owns(r){return r===this.canvas||r.Sx===!0}getHeight(){return this.height}getWidth(){return this.width}destroy(){}setUrl(r){U("WARN: setUrl not implemented for Tiled backgrounds.")}getTileSpecs(r){return this.tiling===Qv?this._x(r):this.Rx(r)}_x(r){let e=Math.pow(2,this.maxZoom-r),t=Math.ceil(this.width/e/this.tileSize.width),n=Math.ceil(this.height/e/this.tileSize.height),o=t*this.tileSize.width/this.width,s=n*this.tileSize.height/this.height;return{xCount:t,yCount:n,xSize:o,ySize:s}}Rx(r){let e=this.width>this.height?1:this.width/this.height,t=this.height>this.width?1:this.height/this.width,n=Math.pow(2,r+1)*this.tileSize.width*e,o=Math.pow(2,r+1)*this.tileSize.height*t,s=Math.ceil(n/this.tileSize.width),a=Math.ceil(o/this.tileSize.height),l=n/this.width,h=o/this.height;return{xCount:s,yCount:a,xSize:l,ySize:h}}Ut(r){}};c(qf,"type","tiled");var Lp=qf;io.register(Lp.type,Lp);var x0=(e=>(e.dotted="dotted",e.lines="lines",e))(x0||{}),nG="dotted",iG="lines",b0={width:50,height:50},A0=2,tC="#ddd",wh="#ddd",oG=2,sG=1,S0="vjs-background",T0="vjs-background-border",is="vjs-background-grid",v0="vjs-background-grid-minor",C0="vjs-background-grid-major",wp="vjs-background-grid-dotted-major",P0="vjs-background-grid-dotted-minor",Qf=class Qf{constructor(r){c(this,"Xe",!1);c(this,"type",Qf.type);c(this,"grid");c(this,"ui");c(this,"showBorder",!0);c(this,"minWidth");c(this,"minHeight");c(this,"maxWidth");c(this,"maxHeight");c(this,"showTickMarks");c(this,"tickMarksPerCell");c(this,"autoShrink",!0);c(this,"dotRadius");c(this,"tickDotRadius");c(this,"gridType");c(this,"currentBounds");c(this,"We",{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});c(this,"backgroundContainer");c(this,"Ns");c(this,"ki");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.Ns=`p${G().substring(0,8)}`,this.ki=`p${G().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=M(Le),this.backgroundContainer.style.position=qe,L(this.backgroundContainer,S0),this.Ut(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Vt,e=>{this.Sr()}),this.ui.bind(Mt,e=>{this.Sr()}),this.ui.bind(Ad,()=>{this.Xe=!0}),this.ui.bind($r,()=>{this.Xe=!1,this.Sr()}),this.ui.bind(Fr,e=>{this.Sr()}),this.ui.bind(Br,e=>{this.Sr()}),this.ui.model.bind(Ce,e=>{this.Sr()}),this.ui.model.bind(Oe,e=>{this.Sr()}),this.grid=r.options.grid||this.ui.getGrid()||b0,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||A0,this.dotRadius=r.options.dotRadius||oG,this.tickDotRadius=r.options.tickDotRadius||sG,this.minWidth=r.options.minWidth||2e4,this.minHeight=r.options.minHeight||2e4,this.maxWidth=r.options.maxWidth,this.maxHeight=r.options.maxHeight,this.autoShrink=r.options.autoShrink!=!1,this.Sr()}owns(r){return r===this.backgroundContainer||r.parentNode===this.backgroundContainer}getWidth(){return this.currentBounds!=null?this.currentBounds.width+(this.currentBounds.x<0?this.currentBounds.x:0):0}getHeight(){return this.currentBounds!=null?this.currentBounds.height+(this.currentBounds.y<0?this.currentBounds.y:0):0}setZoom(r,e){}pan(){}destroy(){this.backgroundContainer.parentNode&&this.backgroundContainer.parentNode.removeChild(this.backgroundContainer),this.backgroundContainer=null}Sr(){this.Xe||requestAnimationFrame(()=>{this.currentBounds=Object.assign({},this.ui.getViewportBoundsInfo());let r=this.grid.width*(Math.floor(this.currentBounds.x/this.grid.width)-1),e=this.grid.height*(Math.floor(this.currentBounds.y/this.grid.height)-1),t=this.grid.width*(Math.floor(this.currentBounds.width/this.grid.width)+3),n=this.grid.height*(Math.floor(this.currentBounds.height/this.grid.height)+3);if(!isNaN(r)&&!isNaN(e)&&!isNaN(t)&&!isNaN(n)){if(this.minWidth!=null){let s=-this.minWidth/2;s<r&&(t+=r-s,r=s);let a=this.minWidth/2;a>r+t&&(t+=a-(r+t))}if(this.minHeight!=null){let s=-this.minHeight/2;s<e&&(n+=e-s,e=s);let a=this.minHeight/2;a>e+n&&(n+=a-(e+n))}if(this.maxWidth!=null){let s=-this.maxWidth/2;s>r&&(t-=s-r,r=s);let a=this.maxWidth/2;a<r+t&&(t-=r+t-a)}if(this.maxHeight!=null){let s=-this.maxHeight/2;s>e&&(n-=s-e,e=s);let a=this.maxHeight/2;a<e+n&&(n-=e+n-a)}this.autoShrink!==!0&&(r=Math.min(r,this.We.minX),e=Math.min(e,this.We.minY),t=Math.max(r+t,this.We.maxX)-r,n=Math.max(e+n,this.We.maxY)-e);let o=this.ui.$getFixedViewportBoundsInfo();o!=null&&(r=o.x,e=o.y,t=o.width,n=o.height),Ie(this.backgroundContainer,{x:r,y:e}),this.backgroundContainer.setAttribute("width",`${t}`),this.backgroundContainer.setAttribute("height",`${n}`),this.backgroundContainer.setAttribute("viewBox",`0 0 ${t} ${n}`),this.backgroundContainer.innerHTML=this.generateGrid(),this.We.minX=Math.min(this.We.minX,r),this.We.minY=Math.min(this.We.minY,e),this.We.maxX=Math.max(this.We.maxX,r+t),this.We.maxY=Math.max(this.We.maxY,e+n)}else this.backgroundContainer.innerHTML=""})}Lx(r,e){return`<pattern id="${this.ki}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
|
|
44
|
-
<path d="M ${r} 0 L 0 0 0 ${e}" class="${is} ${
|
|
45
|
-
</pattern>`}
|
|
46
|
-
<circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${is} ${
|
|
47
|
-
<circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${is} ${
|
|
48
|
-
<circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${is} ${wp}" fill="${wh}" stroke="none"/></pattern>`}Ix(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.Lx(r,e):this.Dx(r,e),n=()=>this.gridType==="lines"?this.wx():this.Nx();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.Ix(),e=this.showBorder?`<rect class="${T0}" x="0" y="0" width="100%" height="100%" fill="${pt}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.Ns})" stroke="${pt}"/>`;return r+e+t}Ut(r){this.backgroundContainer.style.display=r?Cr:pt}};c(Qf,"type","grid");var Sa=Qf;io.register(Sa.type,Sa);var os=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Is",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=io.get(n);return this.Is=t.options!=null?t.visible!==!1:!0,this.background=new o({type:n,ui:this.ui,canvas:e.$getCanvasElement(),viewport:e.rootElement,options:t,visible:this.Is}),e.addBackground(this.background),!0}destroy(){this.ui.removeBackground(this.background),this.background.destroy()}reset(){}setUrl(e){this.background.setUrl!=null?this.background.setUrl(e):U("The current background does not support the `setUrl` method")}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}toggle(){this.setVisible(!this.Is)}setVisible(e){this.Is=e,this.background.Ut(e)}};c(os,"type","background"),ln.register(os.type,os);var Dh="c-state",Dp=class{constructor(r,e,t){this.id=r;this.state=e;this.ui=t;for(let n in e)if(e.hasOwnProperty(n)){let o=n===pr?`${Dh}-${r}`:`${Dh}-${r}-${n}`;t.$registerConnectionType(o,e[n])}}activate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Dh}-${this.id}-${a}`:null;l&&Ne.addType(s,l,o.data),this.state[pr]&&Ne.addType(s,`${Dh}-${this.id}`,o.data),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state["*"]&&L(l,this.state["*"].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state[pr]&&L(l,this.state[pr].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Dh}-${this.id}-${a}`:null;l&&Ne.removeType(s,l,o.data),this.state[pr]&&Ne.removeType(s,`${Dh}-${this.id}`),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state["*"]&&F(l,this.state[pr].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state[pr]&&F(l,this.state[pr].cssClass)})}};var ey=class{constructor(r){this.ui=r;c(this,"Mp",{});c(this,"model");c(this,"currentStates",[]);c(this,"viewOptions");if(this.model=r.view,this.viewOptions=this.model.viewOptions,this.viewOptions.states)for(let e in this.viewOptions.states)this.Mp[e]=new Dp(e,this.viewOptions.states[e],r)}getState(r){return this.Mp[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.Gp(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.Gp(e),t.deactivate(e,this.ui,this.ui.dataSource),Nt(this.currentStates,function(n){return n==t}))}resetState(){for(let r=0;r<this.currentStates.length;r++)this.currentStates[r].deactivate(this.ui.dataSource,this.ui,this.ui.dataSource);this.currentStates.length=0}Gp(r){if(r==null)return this.ui.dataSource;if(typeof r=="string")return this.ui.model.select(r,!0);if(r.jtk){let e=r.jtk;return this.ui.model.select(e.port||e.node,!0)}else return r}},Nh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new ey(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Nh,"type","ui-states"),ln.register(Nh.type,Nh);var rC="direct",aG="orthogonal",Ih=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"instance");c(this,"mode");c(this,"orthogonalMode");c(this,"orthogonalPadding");c(this,"layoutListener");c(this,"$p");c(this,"de");c(this,"_t")}destroy(){}Vx(){let e=this.ui.getLayout();if(e.type!==Ao.type){U(`INFO: cannot run edge routing; layout is of type ${e.type}. You must use the HierarchyLayout with the edge routing plugin`);return}if(!this.ui.$_hasUnrenderedEdges()){let t=e.axis;this.$p.forEach(n=>{let o=this.mode===rC?FA(n):BA(n);for(let s in o){let a=this.ui.getRenderedConnection(s),l=a.connector,h=n.edgeMap[s],d=h.pathDirection;if(l.type!==Xr){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),g=this.de[p.source.id],m=this.de[p.target.id],E=this._t[p.source.id],y=this._t[p.target.id],x=[],f=u[0].x,b=u[0].y;for(let A=1;A<u.length-1;A++)x.push({x1:f,y1:b,x2:u[A].x,y2:u[A].y}),f=u[A].x,b=u[A].y;x.push({x1:f,y1:b,x2:u[u.length-1].x,y2:u[u.length-1].y}),ze.importGeometry(a,{source:{curX:u[0].x,curY:u[0].y,ox:t===0?d:0,oy:t===1?d:0,x:(u[0].x-g.x)/E.width,y:(u[0].y-g.y)/E.height},target:{curX:u[u.length-1].x,curY:u[u.length-1].y,ox:t===0?-d:0,oy:t===1?-d:0,x:(u[u.length-1].x-m.x)/y.width,y:(u[u.length-1].y-m.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||rC,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||zd,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.$p=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.de=Object.assign({},n.positions),this._t=Object.assign({},n.sizes),this.Vx()}catch(s){U("Cannot retrieve edge routing. Make sure you're using a Hierarchy layout and you have generateRouting:true in its options`")}},this.ui.bind(Pn,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(Pn,this.layoutListener)}};c(Ih,"type","edgeRouting"),ln.register(Ih.type,Ih);var _0="vjs-selected-edge-highlight",ty=class ty extends Se{constructor(){super(...arguments);c(this,"id",ty.type);c(this,"Tr",new Map);c(this,"Bp",_0);c(this,"Hi");c(this,"S");c(this,"Fp",e=>{rt(e.obj)&&(this.Mx(e.obj),this.Gx())});c(this,"zp",e=>{rt(e.obj)&&(this.nh(e.obj.getId()),this.Up())});c(this,"Yp",e=>{this.reset()});c(this,"Vs",e=>{e.edge&&this.Wi(e.edge)});c(this,"Xp",e=>{e.edge&&this.Wi(e.edge)});c(this,"jp",e=>{e.dragGroup.forEach(t=>this.kp(t.vertex))})}initialise(e,t){return this.S=e,this.Bp=t&&t.className||_0,this.Hi=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(Kt,this.Fp),!0}destroy(){this.reset(),this.S.model.unbind(Kt,this.Fp)}reset(){this.Tr.forEach(e=>{this.S.$removeElement(e)}),this.Tr.clear(),this.Up()}Gx(){this.S.model.bind(qt,this.zp),this.S.model.bind(nr,this.Yp),this.S.model.bind(ti,this.Vs),this.S.model.bind(ri,this.Xp),this.S.bind(Mt,this.jp),this.S.bind(ti,this.Vs)}Up(){this.S.model.unbind(qt,this.zp),this.S.model.unbind(nr,this.Yp),this.S.model.unbind(ti,this.Vs),this.S.model.unbind(ri,this.Xp),this.S.unbind(Mt,this.jp),this.S.unbind(ti,this.Vs)}$edgeRemoved(e){this.nh(e.getId())}$edgeUpdated(e){this.Wi(e)}$vertexUpdated(e,t){this.kp(e.modelObject)}kp(e){this.Tr.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Wi(o)})}Mx(e){var s;let t=e.getId();if(this.Tr.has(t)){this.Wi(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=M(Z,{fill:this.Hi.fill||"none",stroke:this.Hi.stroke||"var(--vjs-color-edit)","stroke-width":this.Hi.strokeWidth||2,"stroke-dasharray":this.Hi.dashArray,"pointer-events":"none",rx:2},{},this.Bp);this.Hp(o,n),this.S.$appendElementToToolsLayer(o),this.Tr.set(t,o)}Wi(e){var s;let t=e.getId(),n=this.Tr.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.nh(t);return}this.Hp(n,o)}nh(e){let t=this.Tr.get(e);t&&(this.S.$removeElement(t),this.Tr.delete(e))}Hp(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;ie(e,{x:s,y:a,width:o.width,height:o.height})}};c(ty,"type","selected-edge-highlight");var Ta=ty;ln.register(Ta.type,Ta);var Yn=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",Ei);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[]);c(this,"Zi")}destroy(){}initialise(e,t){return e.bind(On,n=>{this.lasso.enabled=n===Ei}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new Aa({surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,enableInGroups:t.enableInGroups,onStart:(n,o,s,a,l)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,l!=null&&Y(l.modelObject)?this.Zi=l:this.Zi=null,this.onStart&&this.onStart(),e.fireUnchecked(_d,{canvasPosition:o})},onSelect:(n,o,s,a,l,h)=>{e.model.clearSelection(),h&&this.lassoSelections.length>0&&e.model.removeFromSelection(this.lassoSelections);let d=[],u,p=e.findIntersectingVertices({origin:s,dimensions:a,enclosed:!l[0],dontIncludeNodesInsideGroups:this.Zi==null,filter:E=>this.Zi==null||ke(E,this.Zi.modelObject)}),g=p.length,m={};for(u=0;u<g;u++)(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),m[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,g=d.length,t.includeEdges){let E={};for(u=0;u<g;u++){let y=[],x;Array.prototype.push.apply(y,d[u].getAllEdges());for(let f=0;f<y.length;f++)if(x=y[f].getId(),!E[x]){let b=y[f].source.objectType===de.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===de.objectType?y[f].target.getParent().id:y[f].target.id;m[b]&&m[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d),e.fireUnchecked(Od,{canvasPosition:s,canvasSize:a})},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==ns&&e.setMode(xr),e.fireUnchecked(Rd),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c(Yn,"type","lasso"),Yn=He([Xe("lasso")],Yn);var O0="vjs-surface-elastic-group-resize",ry="elasticGroupFrame:resize",ny="elasticGroupFrame:remove",va=class i{constructor(r,e,t,n){this.surface=r;this.focusVertex=e;this.group=t;this.groupDef=n;c(this,"groupEntry");c(this,"focusPosition");c(this,"siblingEntries",[]);c(this,"xMinEntries",[]);c(this,"xMaxEntries",[]);c(this,"yMinEntries",[]);c(this,"yMaxEntries",[]);c(this,"managedElement");c(this,"uiGroup");c(this,"frame");c(this,"layout");c(this,"uiGroupContentArea");c(this,"$x");c(this,"layoutShiftX",0);c(this,"layoutShiftY",0);c(this,"width",0);c(this,"height",0);c(this,"minSize");c(this,"x",0);c(this,"y",0);c(this,"parent");this.managedElement=r.viewport.getGroupElement(t.id),this.uiGroup=r.getGroupElement(t.id),this.uiGroupContentArea=this.surface.$getGroupContentAreaElement(this.uiGroup.el),Lt(this.uiGroupContentArea)?this.frame=M(Z):(this.frame=M(Le),this.frame.appendChild(M(Z,{x:0,y:0,width:"100%",height:"100%"}))),this.layout=r.layoutMap.get(t.id),this.frame.style.visibility="hidden",r.$appendElement(this.frame,this.uiGroupContentArea,!0),L(this.frame,O0),this.groupEntry=r.viewport.getElementBounds(t.id),this.surface.$_useModelForSizes?this.minSize={width:t.data[this.surface.$modelWidthAttribute],height:t.data[this.surface.$modelHeightAttribute]}:this.minSize={width:this.groupEntry.width,height:this.groupEntry.height};let o=Object.assign({},r.viewport.getElement(e.id));if(this.focusPosition=em(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=em(l,this.groupEntry,-1);this.siblingEntries.push(l),this.xMinEntries.push(h),this.xMaxEntries.push(h),this.yMinEntries.push(h),this.yMaxEntries.push(h)}),this.Bx(),this.$x=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Bx(){this.xMinEntries.sort((r,e)=>r.x<e.x?-1:1),this.yMinEntries.sort((r,e)=>r.y<e.y?-1:1),this.xMaxEntries.sort((r,e)=>r.x+r.width>e.x+e.width?-1:1),this.yMaxEntries.sort((r,e)=>r.y+r.height>e.y+e.height?-1:1)}setFocusPosition(r,e,t,n,o){let s=(n==null?void 0:n.width)||this.focusPosition.width,a=(n==null?void 0:n.height)||this.focusPosition.height,l={x:r.x-(o?this.groupEntry.x:0),y:r.y-(o?this.groupEntry.y:0)};this.focusPosition.x=l.x,this.focusPosition.y=l.y,this.focusPosition.width=s,this.focusPosition.height=a,this.Fx(e,t)}Fx(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=Iu(n,this.groupDef,r,!0,!0,this.surface.gridProfile,t?null:this.minSize);this.width=o.width,this.height=o.height,this.layoutShiftX=o.layoutShiftX,this.layoutShiftY=o.layoutShiftY,Or(this.frame,this.width,this.height),Ie(this.frame,{x:-this.layoutShiftX,y:-this.layoutShiftY}),this.parent&&this.parent.setFocusPosition({x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},!1,e,{width:this.width,height:this.height},!0),this.frame.style.visibility="visible",this.surface.fireUnchecked(ry,{groupId:this.group.id,width:this.width,height:this.height,x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY})}getCurrentExtents(){let r=this.xMaxEntries[0]||{x:-1/0,width:0},e=this.yMaxEntries[0]||{y:-1/0,height:0};return{xmin:Math.min(this.focusPosition.x,(this.xMinEntries[0]||{x:1/0}).x),ymin:Math.min(this.focusPosition.y,(this.yMinEntries[0]||{y:1/0}).y),xmax:Math.max(this.focusPosition.x+this.focusPosition.width,r.x+r.width),ymax:Math.max(this.focusPosition.y+this.focusPosition.height,e.y+e.height)}}cleanup(){this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),this.parent&&this.parent.cleanup(),this.surface.fireUnchecked(ny,{groupId:this.group.id})}getValues(r){return r==this.group.id?{layoutShiftX:this.layoutShiftX,layoutShiftY:this.layoutShiftY,width:this.width,height:this.height}:this.parent?this.parent.getValues(r):null}ih(r,e){r=r||{},e=e||{};let t=(s,a,l)=>{r[s]=r[s]||{original:a,current:l},r[s].current=l},n={x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},o=Object.assign({},n);if(this.group.group){let s=this.surface.viewport.getElementPosition(this.group.group.id);o.x-=s.x,o.y-=s.y}return(this.layoutShiftX!==0||this.layoutShiftY!==0)&&(this.group.members.forEach(s=>{let a=this.surface.viewport.getElement(s.id),l={x:a.x+this.layoutShiftX-this.groupEntry.x,y:a.y+this.layoutShiftY-this.groupEntry.y};t(s.id,{x:a.x,y:a.y},l)}),t(this.group.id,{x:this.groupEntry.x,y:this.groupEntry.y},o)),(this.width!==this.groupEntry.width||this.height!==this.groupEntry.height)&&(e[this.group.id]={element:this.managedElement,originalGroupSize:{width:this.groupEntry.width,height:this.groupEntry.height},newGroupSize:{width:this.width,height:this.height}}),this.surface.viewport.updateElement(this.group.id,n.x,n.y,this.width,this.height,null,this.group,!1),this.surface.$setGroupElementSize(this.managedElement.modelObject,{width:this.width,height:this.height}),this.surface.$setViewportElementPosition(this.managedElement,o),this.surface.$repaintUIElement(this.managedElement),this.parent&&this.parent.ih(r,e),{movedElements:r,resizedGroups:e}}};var R0="resize";function Np(i,r,e){let t={width:i.width,height:i.height,position:i.position||qe},n=i.atts||{};i.display!=null&&(t.display=i.display),i.id!=null&&(n.id=i.id),i.top!=null&&(t.top=i.top+"px"),i.left!=null&&(t.left=i.left+"px"),i.right!=null&&(t.right=i.right+"px"),i.bottom!=null&&(t.bottom=i.bottom+"px");let o=aa(i.ns,i.type||Ke,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var iy="vjs-node-id",nC="vjs-miniview-type",L0="miniview",zn=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"lassoElement");c(this,"uiBounds");c(this,"suspended");c(this,"oh");c(this,"typeFunction");c(this,"vr");c(this,"Ms");c(this,"wheelSensitivity");c(this,"wheelReverse");c(this,"panning",!1);c(this,"downAt",null);c(this,"pannerAtMouseDown",null);c(this,"zoomingWithWheel",!1);c(this,"elementFilter");c(this,"visible",!0);c(this,"pannerPos");c(this,"activeTracking");c(this,"Wp");c(this,"Zp");c(this,"Jp");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"sh");c(this,"uiBindings",[]);c(this,"ah");c(this,"viewport");c(this,"Ft");c(this,"en");c(this,"rn");c(this,"Ar");c(this,"lh")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,ge,this.en),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.lassoElement.parentNode&&this.lassoElement.parentNode.removeChild(this.lassoElement),this.eventManager.off(window,R0,this.lh),F(this.containerElement,ep),F(this.containerElement,tp),this.oh&&(this.eventManager.off(this.vr,Ye,this.ah),this.vr.parentNode.removeChild(this.vr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Ir,this.sh),this.Ft&&rh(this.containerElement,this.Ft),this.panzoom=null}Ux(e){}zx(e){}le(e,t){let n=t.bind(this);this.uiBindings.push([e,n]),this.ui.bindUnchecked(e,n)}initialise(e,t){this.ui=e,this.activeTracking=t.activeTracking!==!1,this.Wp=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.Zp=t.showLasso!==!1,this.Jp=t.trackSelection!==!1,this.en=this.downListener.bind(this),this.rn=this.moveListener.bind(this),this.Ar=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Np({position:qe,width:jr,height:jr,left:0,top:0,clazz:lv},this.containerElement),this.canvasElement=Np({position:OS,width:jr,height:jr,left:0,top:0,clazz:av},this.containerElement),this.lassoElement=Np({position:qe,width:jr,height:jr,left:0,top:0,clazz:hv}),this.suspended=t.suspended===!0,this.oh=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.vr=null,this.Ms=!1,this.enableWheelZoom=t.enableWheelZoom!==!1,this.wheelSensitivity=t.wheelSensitivity||10,this.elementFilter=t.elementFilter||(o=>!0),this.visible=t.visible!==!1,this.eventManager=new ye,L(this.containerElement,ep),this.ah=this.toggleCollapsed.bind(this),this.oh&&(this.vr=Np({type:"div"}),this.vr.className=uv,this.containerElement.appendChild(this.vr),this.ui.on(this.vr,Ye,this.ah)),this.viewport=this.ui.viewport,this.panzoom=new fa({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,elementPositionSetter:(o,s)=>Ie(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.W(o),events:{pan:()=>{this.Kp()},mousedown:()=>{L(this.pannerElement,Df)},mouseup:()=>{F(this.pannerElement,Df)}},zoomRange:[-1/0,1/0]}),this.lh=la(()=>{this.$e()},100),this.eventManager.on(window,R0,this.lh),this.enableWheelZoom!==!1&&(this.Ft=this.wheelZoom.bind(this),th(this.containerElement,this.Ft)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,ep),this.eventManager.on(this.pannerElement,ge,this.en),this.sh=()=>{this.$e(),this.ht(!0),setTimeout(()=>{this.$e(),this.ht(!0)},0)},this.le($r,this.sh),this.setVisible(this.visible),this.le(Gi,this.$e),this.le(Gr,this.$e),this.le(Vt,this.Gs),this.le(Mt,o=>{this.activeTracking&&this.Gs(o)}),this.le(Fr,this.hh),this.le(vl,this.Yx),this.le(Pn,this.Xx),this.le(Br,this.qp),this.le(Vr,this.Gs),this.le(To,o=>{this.activeTracking&&this.Gs(o)}),this.Zp&&(this.le(_d,o=>{this.canvasElement.appendChild(this.lassoElement),this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width="1px",this.lassoElement.style.height="1px"}),this.le(Od,o=>{this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width=`${o.canvasSize.width}px`,this.lassoElement.style.height=`${o.canvasSize.height}px`}),this.le(Rd,()=>{this.lassoElement.parentElement&&this.lassoElement.parentElement.removeChild(this.lassoElement)})),this.Jp&&(this.ui.model.bind(Kt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&L(s,dh)}),this.ui.model.bind(qt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&F(s,dh)}),this.ui.model.bind(nr,o=>{Array.from(this.canvasElement.querySelectorAll(`.${dh}`)).forEach(s=>F(s,dh))}));let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&er(l,a)}this.ht(!0)};return this.le(Pn,n),this.le(Us,n),this.le(Fb,this.$n),this.le(Sd,this.jx),this.le(ry,this.Ux),this.le(ny,this.zx),this.kx(),this.Wp&&(L(this.containerElement,pv),this.eventManager.on(this.canvasElement,W,Ae(iy),o=>{let s=o.target.getAttribute(iy);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.Hx(),this.panzoom.setZoom(1),this.panzoom.reset(),this.$e()}Qp(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=ft(t);if(e.group){let o=this.ui.viewport.getElement(e.group.id);o!=null&&(n.x-=o.x,n.y-=o.y)}return n}return{x:0,y:0}}kx(){let e=this.ui.model,t=e.getNodes(),n=e.getGroups();for(let o=0;o<n.length;o++){let s=this.ui.getRenderedElement(n[o]);s!=null&&this.qp({el:s,id:n[o].id,vertex:n[o],pos:this.Qp(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.hh({el:s,id:t[o].id,vertex:t[o],pos:this.Qp(t[o])})}(n.length>0||t.length>0)&&this.ht(!0)}qp(e){this.hh(e,dv)}$groupCollapsed(e){this.em(e.modelObject,!1),this.$n({id:e.id})}$groupExpanded(e){this.em(e.modelObject,!0),this.$n({id:e.id})}$vertexRotated(e,t){let n=this.vertexMap[e.id];n!=null&&(n.style.transform="rotate("+t+"deg)",n.style.transformOrigin="50% 50%")}$vertexResized(e,t,n){let o=this.vertexMap[e.id];o!=null&&Or(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.$s(e),this.ht(!0))}downListener(e){this.panning=!0,this.downAt=me(e),this.pannerAtMouseDown=un(this.pannerElement),this.eventManager.on(document,le,this.Ar),this.eventManager.on(document,ae,this.rn),oe(e)}moveListener(e){if(this.zoomingWithWheel=!1,this.panning){let t=me(e),n=t.x-this.downAt.x,o=t.y-this.downAt.y,s={x:this.pannerAtMouseDown.x+n,y:this.pannerAtMouseDown.y+o};this.Kp(s),er(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,le,this.Ar),this.eventManager.off(document,ae,this.rn)}wheelZoom(e){oe(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.$setTransformOriginToCanvasPoint(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.Ms=!this.Ms,this.Ms?L(this.containerElement,tp):F(this.containerElement,tp),this.ht(!0)}ht(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.$e,doNotFirePanEvent:e})}Gs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.$s(t.element)}),this.ht(!0)}Yx(e){let t=this.vertexMap[e.element.id];e.element.modelObject.members.forEach(o=>{let s=this.vertexMap[o.id];if(s!=null){let a=this.ui.getElement(o.id);er(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Or(s,a.width,a.height)}});let n=ft(e.element);if(e.element.modelObject.group){let o=this.ui.viewport.getGroupElement(e.element.modelObject.group.id);o&&(n.x-=o.x,n.y-=o.y)}er(t,n),Or(t,e.element.width,e.element.height),this.$e()}Xx(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&er(o,n)}this.ht(!0)}Wx(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++){let s=this.vertexMap[n[o].id];s&&t.appendChild(s)}}hh(e,t){if(this.elementFilter(e.vertex)===!1)return;let n=e.vertex,o=n.id;if(this.vertexMap[o]!=null)return;let s=e.pos||{x:0,y:0},a=e.size||this.$__getSize(e.id),l=Np({position:qe,width:a.width+Dn,height:a.height+Dn,left:s.x,top:s.y,clazz:cv+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(nC,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(iy,o),this.canvasElement.appendChild(l),this.panzoom.add(l),this.vertexMap[o]=l,n.data.rotation!=null&&(l.style.transform="rotate("+n.data.rotation+"deg)",l.style.transformOrigin="50% 50%"),e.vertex.group){let h=this.vertexMap[e.vertex.group.id];h&&(h.appendChild(l),this.panzoom.suspend(e.el))}Y(e.vertex)&&this.Wx(e.vertex,l),this.ui.$_dataLoading||(this.ht(!0),this.$e())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Cr:pt}getPan(){return this.panzoom.getPan()}em(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++)this.vertexMap[n[o].id].style.display=t?"block":"none"}$__getSize(e){return this.ui.viewport.getElementSize(e)}$n(e){let t=this.vertexMap[e.id];if(t){let n=e.size||this.$__getSize(e.id);if(t.style.width=n.width+Dn,t.style.height=n.height+Dn,this.$e(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(nC,this.typeFunction(o))}}}invalidate(e){if(e)this.$n({id:e});else for(let t in this.vertexMap)this.$n({id:t})}setSuspended(e,t){this.suspended=e,t&&this.$e()}tm(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.ht(!0)),t||this.$e()}$nodeRemoved(e){this.tm(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.tm(e,!1)}$groupResized(e){this.$n({id:e.element.id,size:e.newGroupSize}),this.ht(!0)}$s(e){let t=this.vertexMap[e.id];if(t){let n=e.modelObject.group,o=n==null?{x:0,y:0}:this.ui.getGroupElement(n.id);er(t,{x:e.x-o.x,y:e.y-o.y})}}$groupMemberRemoved(e){let t=this.vertexMap[e.id];t&&(this.canvasElement.appendChild(t),this.$s(e))}$groupMemberAdded(e){let t=e.modelObject.group;if(t){let n=this.vertexMap[t.id],o=this.vertexMap[e.id];n&&o&&(n.appendChild(o),this.$s(e))}}Hx(){let e;for(let t in this.vertexMap)e=this.vertexMap[t],this.panzoom.remove(e),delete this.vertexMap[t],e.parentNode.removeChild(e);this.$e()}jx(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}$e(){if(this.ui&&this.panzoom&&!this.suspended){this.uiBounds=this.ui.getViewportBoundsInfo();let e=this.ui.panZoom.getApparentCanvasLocation(),t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom;this.pannerElement.style.width=this.uiBounds.vw+Dn,this.pannerElement.style.height=this.uiBounds.vh+Dn,this.pannerElement.style.transform="scale("+o+")";let s={x:e.x*o,y:e.y*o};this.pannerPos={x:t.x-s.x,y:t.y-s.y},er(this.pannerElement,this.pannerPos)}}Kp(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||un(this.pannerElement);let t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom,s=(t.x-e.x)/o,a=(t.y-e.y)/o,l=this.ui.setApparentCanvasLocation(s,a);return{x:t.x-l.x*o,y:t.y-l.y*o}}}getRenderedVertex(e){return this.getRenderedElement(e)}getRenderedElement(e){return this.vertexMap[e]}};c(zn,"type",L0),zn=He([Xe(L0)],zn);var iC="vjs-pan-mode",oC="vjs-zoom-to-fit",sC="vjs-zoom-in",aC="vjs-zoom-out",oy="vjs-select-mode",lC="vjs-undo",hC="vjs-redo",cC="vjs-clear-dataset",lG="vjs-selected-mode",Ip="vjs-controls",dC="vjs-export-controls",uC="vjs-controls-reset-selection",hG="vjs-copy-paste-controls";var pC=class{constructor(r){c(this,"ui");this.ui=r.ui}};var cG="Clear dataset?",gC="vjs-selected-mode",w0="vjs-controls-has-selection",D0="can-undo",N0="can-redo",I0="data-undo",M0="data-redo",Ca="data-mode",V0="data-reset",G0="data-clear",$0="data-zoom-in",B0="data-zoom-out",mC="data-reset-selection",F0="data-vjs-orientation",U0="0 0 32 30",Y0="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",z0="0 0 24 24",X0="M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z",j0="0 0 24 24",H0="M 3.88,20.08 L 3.58,15.46 M 3.58,15.46 L 14.48,0.78 M 14.48,0.78 L 18.25,3.76 M 18.25,3.76 L 7.78,18.2 M 7.7,18.2 L 3.88,20.08 M 3.58,15.46 L 7.76,18.20 M 2,5 V 20.6 M 22,5 V 20.6 M 22,20.6 H 3.94 M 2,5 H 11.2 M 17.6,5 H 22",k0="0 0 24 24",W0="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47",Z0="0 0 24 24",J0="M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15",K0="0 0 24 24",q0="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",EC="0 0 32 32",Q0="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",ew="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0";function dG(){return`<i class="${iC}" ${gC} ${Ca}="${xr}" title="Pan Mode">
|
|
49
|
-
<svg:svg viewBox="${
|
|
50
|
-
</i>`}function
|
|
51
|
-
<svg:svg viewBox="${
|
|
52
|
-
</i>`}function
|
|
53
|
-
<svg:svg viewBox="${
|
|
54
|
-
<svg:path d="${
|
|
43
|
+
</g>`,payload:{text:"Label",scaled:!0},properties:[{id:"fill",label:"Background Color",type:"color",defaultValue:"transparent"},{id:"color",label:"Text Color",type:"color",defaultValue:"#000000"},{id:"text",label:"Text",type:"string",defaultValue:"Text"},{id:"scaled",label:"Scaled",type:"boolean",defaultValue:!0}]},{type:"inverted-right-triangle",label:"Right Triangle",template:'<polygon points="{{width}} {{height}} {{width}} 0 0 {{height}}"/>'},{type:"hexagon",label:"Hexagon (pointy)",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*1732/6000}} {{width}} {{height-(height*1732/6000)}} {{width/2}} {{height}} 0 {{height-(height*1732/6000)}} 0 {{height*1732/6000}}"/>'},{type:"hexagon-flat",label:"Hexagon (flat)",square:!0,template:'<polygon points="0 {{height/2}} {{width*1732/6000}} {{height}} {{width-(width*1732/6000)}} {{height}} {{width}} {{height/2}} {{width-(width*1732/6000)}} 0 {{width*1732/6000}} 0"/>'},{type:"octagon",label:"Octagon",square:!0,template:'<polygon points="{{width * 293 / 1000}} 0 {{width * 707 / 1000}} 0 {{width}} {{height * 293 / 1000}} {{width}} {{height * 707 / 1000}} {{width * 707 / 1000}} {{height}} {{width * 293 / 1000}} {{height}} 0 {{height * 707 / 1000}} 0 {{height * 293 / 1000}}"/>'},{type:"pentagon",label:"Pentagon",square:!0,template:'<polygon points="{{width/2}} 0 {{width}} {{height*343/1000}} {{width*793/1000}} {{height*904/1000}} {{width*206/1000}} {{height*904/1000}} 0 {{height*343/1000}}"/>'},{type:"parallelogram",label:"Parallelogram",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width}} 0 {{width * 7 / 8}} {{height}}"/>'},{type:"trapezoid",label:"Trapezoid",template:'<polygon points="0 {{height}} {{width/8}} 0 {{width * 7 / 8}} 0 {{width}} {{height}}"/>'},{type:"cross",label:"Cross",template:'<path d="M 0 {{height*3/10}} L 0 {{height * 7/10}} L {{width *3/10}} {{ height * 7/10}} L {{width *3/10}} {{height}} L {{width *7/10}} {{height}} L {{width*7/10}} {{height*7/10}} L {{width}} {{height * 7/10}} L {{width}} {{height*3/10}} L {{width *7/10}} {{height*3/10}} L {{width*7/10}} 0 L {{width*3/10}} 0 L {{width*3/10}} {{height*3 /10}} Z"/>'},{type:"l-shape-bl",label:"L Shape (Bottom left)",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} {{height / 2}} L {{width/2}} {{height/2}} L {{width/2}} 0 Z"/>'},{type:"l-shape-br",label:"L Shape (Bottom right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L {{width/2}} 0 L {{width/2}} {{height/2}} L 0 {{height/2}} L 0 {{height}} Z"/>'},{type:"l-shape-tl",label:"L Shape (Top left)",template:'<path d="M 0 0 L 0 {{height}} L {{width/2}} {{height}} L {{width/2}} {{height / 2}} L {{width}} {{height/2}} L {{width}} 0 Z"/>'},{type:"l-shape-tr",label:"L Shape (Top right)",template:'<path d="M {{width}} {{height}} L {{width}} 0 L 0 0 L 0 {{height/2}} L {{width/2}} {{height/2}} L {{width/2}} {{height}} Z"/>'},{type:"u-shape",label:"U Shape",template:'<path d="M 0 0 L 0 {{height}} L {{width}} {{height}} L {{width}} 0 L {{width*2/3}} 0 L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} 0 Z"/>'},{type:"inverted-u-shape",label:"U Shape (Inverted)",template:'<path d="M 0 0 L {{width}} 0 L {{width}} {{height}} L {{width*2/3}} {{height}} L {{width*2/3}} {{height/2}} L {{width/3}} {{height/2}} L {{width/3}} {{height}} L 0 {{height}} Z"/>'}]};var ua=class extends Ic{constructor(e){super();this.ui=e}getViewportPositionById(e){return this.ui.viewport.getPosition(e)}getSize(e){return this.ui.$getSize(e)}};var pp=class extends ua{constructor(e){super(e);this.uiCore=e}filter(e){return e.group==null}getElements(){let e=this.uiCore.getNodes();return Array.prototype.push.apply(e,this.uiCore.getGroups()),e=e.filter((t,n,o)=>t.group==null),e}};var gp=class extends ua{constructor(e,t){super(t);this.group=e;this.ui=t}getElements(){return this.group.getMembers()}filter(e){return(Y(e)||J(e))&&e.group==this.group}};var mp=class{constructor(r){this.ui=r}transformGeometry(r,e,t){let n=this.ui.getRenderedConnection(r.id);return n!=null&&r.geometry!=null?ze.transformGeometry(n.connector,r.geometry,e,t):r.geometry}getCoordinates(r,e){let t=this.ui.viewport.getElement(r.id);return{x:t.x,y:t.y,width:t.width,height:t.height}}};var Ep=class extends kd{constructor(e){super(e.model);this.ui=e;c(this,"transformer");this.transformer=new mp(this.ui)}$getCopyDataTransformer(){return this.transformer}paste(e){return e=e||{},e.event&&(e.origin=this.ui.mapEventLocation(e.event)),super.paste(e)}};function gi(i){return Zr(i)&&i.useHTMLElement!==!0}function rs(i){return i.isSimpleShape}function U1(i,r){i.canvas&&(i.canvas.style.display=r?"block":"none")}function Y1(i){i.canvas&&i.canvas.parentNode.removeChild(i.canvas),delete i.canvas}function pa(i,r){if(i.useHTMLElement&&r.containerType!=="SVG"){let e=ah.getElement(r,i,i.connection);return L(e,r.labelOverlayClass),e}else return Qo(r,i),i.textElement}function _h(i,r){return ah.getElement(r,i,i.connection,e=>{let t=i.create(e,e.edge,r,r.model);return L(t,r.overlayClass),t})}var ga=class extends Vu{constructor(e,t,n,o,s,a){var l;super(e,t,n,o,a);c(this,"$suspendRendering");c(this,"clipboard");c(this,"$shapeLibrary");c(this,"$_propertyMapper");c(this,"M");c(this,"Pl");c(this,"Zu");c(this,"In");c(this,"ur");c(this,"Ge");c(this,"pr");c(this,"Ju");c(this,"ye");c(this,"Ku",[`[${wS}='true']`]);c(this,"Ol");c(this,"qu",new Set([Fl,Yo,zo,pu,Hi,gu,Jo]));c(this,"it",null);c(this,"ki",[]);if(o=o||{},a=a||{},this.ye=new ye,this.clipboard=new Ep(this),this.M=s,this.containerType=Wu(this.getContainer()),this.Ju=a.hoverEvents!==!1,this.pr=Ql,this.Pl=this.createRenderer("node",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.Zu=this.createRenderer("group",this.model.getNodeId.bind(this.model),this.model.getNodeType.bind(this.model)),this.Ol=(l=o.dragOptions)==null?void 0:l.canDrop,o.edges!=null&&o.edges.propertyMappings!=null&&(this.$_propertyMapper=new Yu(this,{edgeMappings:o.edges.propertyMappings})),this.In=[],this.Qu(),this.on(n,"animationend",z(ki,Xo),h=>{let d=h.target;d.style.animation=null,F(d,Rf)}),a.resizeObserver!==!1&&!this.$_useModelForSizes)try{this.Ge=new ResizeObserver(h=>{window.requestAnimationFrame(()=>{if(!this.$_dataLoading){let d=[];h.forEach(u=>{if(u.borderBoxSize!=null&&u.borderBoxSize.length>0){let p=this.$getAttribute(u.target,gt);if(p!=null){let g={width:u.borderBoxSize[0].inlineSize,height:u.borderBoxSize[0].blockSize},m=this.viewport.getElement(p);m!=null&&(m.width!==g.width||m.height!==g.height)&&d.push(this.$getManagedElement(p))}}}),d.forEach(u=>this.$revalidateManagedElement(u)),this.$relayoutOnResize&&d.length>0&&this.relayout()}})})}catch(h){U("WARN: ResizeObserver could not be attached.")}if(o.shapes!=null)if(o.shapes.library==null&&o.shapes.sets==null)U('Render option "shapes" passed to UI but no "library" or "sets" value is present. Shape library is not enabled.');else{o.shapes.library!=null?this.$shapeLibrary=o.shapes.library:this.$shapeLibrary=new da(o.shapes.sets,o.shapes);let h=this.getShapeLibrary().getShapeTagDefinition(o.useSvgContainer===!0,o.shapes.strokeWidth||2,o.shapes.showLabels,o.shapes.font,o.shapes.labelAttribute,o.shapes.defaultFillColor,o.shapes.defaultOutlineColor,o.shapes.defaultColor);this.registerTag(o.shapes.tagName||Tv,h),this.uy(),this.py()}}$syncManagedElementWithView(e,t){let n=e.el,o=s=>{if((J(e.modelObject)||Y(e.modelObject))&&e.modelObject.group){let a=this.getGroupElement(e.modelObject.group.id),l=this.$_getGroupContentAreaInfo(e.modelObject.group.id);s.x-=a.x+l.internalOffset.x,s.y-=a.y+l.internalOffset.y}};if(Lt(n.parentElement)){let s=Me(e,e.c,e.r);o(s),pn(n,s),pi(n,e.r)}else{pi(n,e.r);let s=ft(e);o(s),Ie(n,s)}t&&(this.$repaintUIElement(e),this.se(s=>s.$vertexSynced(e)))}$addTransferrableVertexAttributes(e){e.forEach(t=>this.qu.add(t))}$enableVertexDrag(){this.ur.$enable()}$disableVertexDrag(){this.ur.$disable()}$canDrop(e,t,n){return this.Ol!=null?this.Ol(e,t,n):!0}addElementEventFilter(e){this.Ku.push(e)}$vertexRendered(e,t,n,o){super.$vertexRendered(e,t,n,o),this.M.usesWrapperElement&&t.firstElementChild!=null&&this.qu.forEach(s=>{t.firstElementChild.hasAttribute(s)&&(t.setAttribute(s,t.firstElementChild.getAttribute(s)),t.firstElementChild.removeAttribute(s))})}$createDefaultLayoutAdapter(){return new pp(this)}$createGroupLayoutAdapter(e){return new gp(e,this)}$startPanRepeat(e,t,n,o,s,a){U("startPanRepeat not implemented in BrowserUI. Subclasses should implement.")}$stopPanRepeat(){U("stopPanRepeat not implemented in BrowserUI. Subclasses should implement.")}uy(){this.it=this.getShapeLibrary().getSvgDefsElement(),this.it.style.position="absolute",this.it.style.width="1px",this.it.style.height="1px",this.it.style.left="-10000px",this.it.style.top="-10000px",this.getContainer().appendChild(this.it)}py(){this.$shapeLibrary&&this.$shapeLibrary.getShapeSets().forEach(t=>{t.shapes.forEach(n=>{var o,s;n.objectType===se.objectType&&n.members!=null&&((o=n.members.nodes)==null||o.forEach(a=>a.category=a.category||t.id),(s=n.members.groups)==null||s.forEach(a=>a.category=a.category||t.id),this.model.addGroupTemplate(`${t.id}:${n.type}`,n.members))})})}my(e,t,n){let s=["edge",t].join(":");if(n.gy=e,e.events[t]!=null)try{e.events[t]({e:n,overlay:e})}catch(a){U("WARN: VisuallyJs overlay event threw exception "+a)}this.ji(t,s,e.connection,n,e)}$isAsynchronousRender(){return this.M.asynchronous===!0}$isDraggingSupported(){return!1}$removeElement(e){e!=null&&e.parentNode&&e.parentNode.removeChild(e)}$appendElement(e,t,n){t&&(n?t.insertBefore(e,t.firstElementChild):t.appendChild(e))}$setElementVisible(e,t){e.style.display=t?Pr:pt}$doVertexUpdated(e){this.M.reactive===!1&&this.M.update(e.el,e.modelObject.data,e.modelObject,this)}$graphClearStart(){this.vertexList.forEach(e=>{let t=this.$getManagedElement(e.id);t!=null&&this.M.cleanupVertex(e.id,t.el)}),super.$graphClearStart()}$appendElementToContainer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.fe,t)}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.getContainer(),t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendEdgeElement(e,t){this.$appendElementToVertexLayer(e,t)}$getAssociatedElements(e){let t=[];if(e.nodeType!==3&&e.nodeType!==8){let n=e.querySelectorAll(Ql);Array.prototype.push.apply(t,n)}return t.filter(n=>n.nodeType!==3&&n.nodeType!==8)}$getClassFromElement(e){return LT(e)}$addClassToElement(e,t){L(e,t)}$elementHasClass(e,t){return un(e,t)}$removeClassFromElement(e,t){F(e,t)}$toggleClassOnElement(e,t){Af(e,t)}$updateElementClasses(e,t,n){Ut(e,t,n)}$setAttribute(e,t,n){e.setAttribute(t,n)}$getAttribute(e,t){return e.getAttribute(t)}$setAttributes(e,t){for(let n in t)e.setAttribute(n,t[n])}$removeAttribute(e,t){e.removeAttribute&&e.removeAttribute(t)}on(e,t,n,o){let s=a=>{o==null?this.ye.on(a,t,n):this.ye.on(a,t,n,o)};return Vn(e)?e.forEach(a=>s(a)):s(e),this}off(e,t,n){return Vn(e)?e.forEach(o=>this.ye.off(o,t,n)):this.ye.off(e,t,n),this}trigger(e,t,n,o,s){this.ye.trigger(e,t,n,o,s)}$getOffsetRelativeToRoot(e){return Ki(e)}Ey(e,t,n){function o(l){return l.offsetParent||l.parentNode}let s=e!==n&&o(e)!==n?o(e):null,a=l=>{l!=null&&l!==document.body&&!isNaN(l.scrollTop)&&!isNaN(l.scrollLeft)&&(l.scrollTop>0||l.scrollLeft>0)&&(t.x-=l.scrollLeft,t.y-=l.scrollTop)};for(;s!=null;){let l=gn(s)||{x:0,y:0};t.x+=l.x,t.y+=l.y,a(s),s=o(s)===n?null:o(s)}}$getElementPositionInUIRelativeToCanvasOrigin(e,t){let n=e.el,o={x:0,y:0};if(this.containerType==="SVG"){let s=qu(n,this.getContainer(),!0);if(j(e.modelObject)){let a=this.getElement(e.modelObject.parent.id);if(a.r!==0){let l=qu(a.el,this.getContainer(),!0),h={x:l.x+a.width/2,y:l.y+a.height/2},d=Me(h,l,a.r);return Me(s,d,-a.r)}}else if(e.r!==0){let a={x:s.x+t.width/2,y:s.y+t.height/2},l=Me(a,s,e.r);return Me(s,l,-e.r)}return s}else{if(n.namespaceURI===Gt){let l=n.closest(Le);l!=null&&l!==n&&(o=qu(n,l,!0),n=l)}let s=this.getContainer(),a=gn(n,t);if(this.Ey(n,a,s),s!=null&&!isNaN(s.scrollTop)&&!isNaN(s.scrollLeft)&&(s.scrollTop>0||s.scrollLeft>0)){let l=n.offsetParent!=null?this.$getStyle(n.offsetParent,xf):RS,h=this.$getStyle(n,xf);h!==Qe&&h!==DE&&l!==Qe&&l!==DE&&(a.x-=s.scrollLeft,a.y-=s.scrollTop)}return{x:a.x+o.x,y:a.y+o.y}}}$setElementSizeInUI(e,t,n){Rr(e,t,n)}$setElementWidth(e,t){KT(e,t)}$setElementHeight(e,t){qT(e,t)}$getSize(e){return Ze(e)}$setElementRotation(e,t){pi(e,t)}$setVisibleElementRotation(e,t){pi(e.el,t),this.se(n=>n.$vertexRotated(e,t))}$getElementPositionInUIRelativeToParent(e){return gn(e)}$getElementPositionInWindow(e){return e.getBoundingClientRect()}$getStyle(e,t){return typeof window.getComputedStyle!==rb?getComputedStyle(e,null).getPropertyValue(t):e.currentStyle[t]}$getGroupContentAreaElement(e){let t=this.$getSelector(e,PT);return t&&t.length>0?t[0]:this.M.usesWrapperElement&&e.childElementCount>0?e.firstElementChild:e}$getSelector(e,t){return wT.apply(null,arguments)}$setViewportElementPosition(e,t){e.r!==0?Lt(e.el.parentElement)?QT(e,t):Ie(e.el,t):Ie(e.el,t)}setDraggable(e,t){let n=this.getObjectInfo(e,!1);n.obj&&(t?this.$removeAttribute(n.el,Fl):this.$setAttribute(n.el,Fl,Ct))}isDraggable(e){let t=this.$getAttribute(e,Fl);return t==null||t===ct}toggleDraggable(e){let t=this.isDraggable(e);return this.setDraggable(e,!t),!t}ji(e,t,n,o,s,a){let l=n.edge;if(!l.transient||a){let h={obj:l,e:o,model:this.model,ui:this,connection:n,overlay:s,def:null},d=this.view.getEdgeDefinition(this.model.getEdgeType(l.data));d&&d.events&&d.events[e]?d.events[e](h):e===W&&this.$edgeTap(h),this.fireUnchecked(t,h)}}$edgeTap(e){}getLabelLocationAttribute(e){return this.view.getEdgeDefinition(this.model.getEdgeType(e.data||{})).labelLocationAttribute||zE}vs(e,t){let o=Bt(Ko(t),Mn,this.getContainer(),!0).jtk.overlay;o&&this.my(o,e,t)}fy(e){this.vs(Ye,e)}yy(e){this.vs(Co,e)}by(e){this.vs(W,e)}Ay(e){this.vs(zr,e)}Cs(e,t,n){if(!n.defaultPrevented&&n.gy==null){let o=Bt(Ko(n),Kr,this.getContainer(),!0);this.ji(e,t,o.jtk.connection,n,null)}}Sy(e){this.Cs(Ye,rA,e)}Ty(e){this.Cs(Co,nA,e)}vy(e){this.Cs(W,aA,e)}Cy(e){this.Cs(zr,iA,e)}ep(e,t){let o=Bt(Ko(t),Mn,this.getContainer(),!0).jtk.overlay;o&&this.rp(o.connection,e,t)}Py(e){this.ep(!0,e)}Oy(e){this.ep(!1,e)}rp(e,t,n){if(e&&!e.edge.transient){let o=n.toElement,s=n.target;if(o!=null&&o!==s){if(o.getAttribute(et)===e.edge.id)return;let h=o.closest(".vjs-connector");if(h!=null&&h.getAttribute(et)===e.edge.id)return;let d=o.closest(".vjs-overlay");if(d!=null&&d.getAttribute(et)===e.edge.id)return}this.$setConnectorHover(e,t),t?(Ut(e.sourceElement,[$f]),Ut(e.targetElement,[Bf])):(Ut(e.sourceElement,[],[$f]),Ut(e.targetElement,[],[Bf]));let a=t?st:ot,l=t?Pd:Cd;this.ji(a,l,e,n,null)}}np(e,t){var o;let n=Ko(t).parentNode;this.rp((o=n.jtk)==null?void 0:o.connection,e,t)}_y(e){this.np(!0,e)}Ry(e){this.np(!1,e)}ip(e,t){let n=Ko(t).parentNode;if(n.jtk&&n.jtk.connection){let o=t.target;if(!o.classList.contains(Qi)&&!o.classList.contains(eo)){let s=e?le:ge,a=e?oA:_l;this.ji(s,a,n.jtk.connection,t,null)}}}Ly(e){this.ip(!0,e)}wy(e){this.ip(!1,e)}Dy(e){let t=Ko(e).parentNode;t.jtk&&t.jtk.connection&&this.ji(At,sA,t.jtk.connection,e,null)}Ny(e){let t=e.target,n=this.getModelObjectFromElement(t,!0,!1);if(n!=null)return this.Ku.find(s=>Bt(t,s,n.el,!0))!=null?null:{el:n.el,obj:n.obj,e,model:this.model,ui:this}}mr(e,t,n){if(!e.defaultPrevented){let o=this.Ny(e);if(o!=null){let s=J(o.obj)?this.getNodeDefinition(o.obj):Y(o.obj)?this.getGroupDefinition(o.obj):j(o.obj)?this.getPortDefinition(o.obj):null;s&&s.events&&s.events[t]&&s.events[t](o),this.fireUnchecked(n,o)}}}Iy(e){this.mr(e,Ye,Wb)}Vy(e){this.mr(e,Co,Zb)}My(e){this.mr(e,W,tA)}Gy(e){this.mr(e,zr,Jb)}$y(e){this.mr(e,At,eA)}By(e){this.mr(e,ot,Kb)}Fy(e){this.mr(e,st,qb)}Uy(e){this.mr(e,ae,Qb)}zy(e){let t=this.getModelObjectFromElement(e.target.closest(".vjs-group"),!0,!1);t!=null&&Y(t.obj)&&this.toggleGroup(t.obj)}Yy(e,t,n){let o=n.bind(this);this.In.push({eventName:e,handler:o}),this.ye.on(this.getContainer(),e,t,o)}addDragHandler(e){this.ur==null?this.ki.push(e):this.ur.addHandler(e)}Xy(){this.ur!=null&&this.ur.destroy(),this.ki=this.ki||[],this.ur=new Uf(this.fe,{translate:e=>this.fromPageLocation(e.x,e.y),init:e=>this.op(e)}),this.ki.forEach(e=>this.ur.addHandler(e)),this.ki.length=0}op(e){}snapPageLocationToGrid(e,t,n){let o=this.fromPageLocation(e,t),s=he(o,n);return this.toPageLocation(s.x,s.y)}$getNodesInViewport(){return this.Ps(ce.objectType,this.getContainer())}$getGroupsInViewport(){return this.Ps(se.objectType,this.getContainer(),e=>this.$getGroupContentAreaElement(e))}$isTouchDevice(){return In()}$isArrayLike(e){return super.$isArrayLike(e)||Vn(e)}Ps(e,t,n){let o=t.getBoundingClientRect(),s={};return Object.values(this.viewport.getElements()).filter(l=>{if(l.modelObject.objectType===e){let h=n?n(l.el):l.el;return s[l.modelObject.id]=h.getBoundingClientRect(),rt(s[l.modelObject.id],o)}else return!1}).map(l=>({el:l,bb:s[l.id]}))}Qu(){if(this.In!=null){this._l();let e=[[Ye,Mn,this.fy],[Co,Mn,this.yy],[W,Mn,this.by],[zr,Mn,this.Ay],[Ye,Kr,this.Sy],[Co,Kr,this.Ty],[W,Kr,this.vy],[zr,Kr,this.Cy],[Ye,this.pr,this.Iy],[Co,this.pr,this.Vy],[W,this.pr,this.My],[zr,this.pr,this.Gy],[W,_T,this.zy],[At,Kr,this.Dy],[le,Kr,this.Ly],[ge,Kr,this.wy],[At,Ql,this.$y]];this.Ju===!0&&e.push.apply(e,[[st,Kr,this._y],[ot,Kr,this.Ry],[st,Mn,this.Py],[ot,Mn,this.Oy],[ot,this.pr,this.By],[st,this.pr,this.Fy],[ae,this.pr,this.Uy]]),e.forEach(t=>{this.Yy(t[0],t[1],t[2])})}}_l(){let e=this.getContainer();e&&this.In!=null&&(this.In.forEach(t=>{this.ye.off(e,t.eventName,t.handler)}),this.In.length=0)}setContainer(e){if(e===document||e===document.body)throw new Error("Cannot set document or document.body as container element");this._l(),this.$setAttribute(e,ff,G().replace("-",""));let t=this.getContainer();t!=null&&(t.removeAttribute(ff),Array.from(t.childNodes).filter(o=>o!=null&&(un(o,ra)||un(o,na)||o.getAttribute&&o.getAttribute(gt)!=null)).forEach(o=>{e.appendChild(o)})),super.setContainer(e),this.containerType=Wu(e),this.ye!=null&&(this.Xy(),this.Qu())}reset(){super.reset(),this.Ge&&this.Ge.disconnect(),this.getContainer().querySelectorAll([Ql,Kr,Mn].join(",")).forEach(n=>n.parentNode&&n.parentNode.removeChild(n))}destroy(){this.it!=null&&this.it.parentNode!=null&&this.it.parentNode.removeChild(this.it),this._l(),super.destroy()}$__unmanage(e,t,n){this.Ge!=null&&this.Ge.unobserve(e),super.$__unmanage(e,t,n)}$addOverlayClass(e,t){if(rs(e))lh(this,e).map(n=>L(n,t));else if(gi(e))Qo(this,e).map(n=>L(n,t));else if(Zr(e))L(pa(e,this),t);else if(dn(e))L(_h(e,this),t);else throw"Could not add class to overlay of type ["+e.type+"]"}$removeOverlayClass(e,t){if(rs(e))lh(this,e).map(n=>F(n,t));else if(gi(e))Qo(this,e).map(n=>F(n,t));else if(Zr(e))F(pa(e,this),t);else if(dn(e))F(_h(e,this),t);else throw"Could not remove class from overlay of type ["+e.type+"]"}getGroupDefinition(e){return this.Rl(this.view.getGroupDefinition(this.model.getNodeType(e.data)))}getPortDefinition(e){return this.Rl(this.view.getPortDefinition(this.model.getPortType(e.data)))}getNodeDefinition(e){return this.Rl(this.view.getNodeDefinition(this.model.getNodeType(e.data)))}getVertexDefinition(e){if(Y(e))return this.getGroupDefinition(e);if(j(e))return this.getPortDefinition(e);if(J(e))return this.getNodeDefinition(e)}Rl(e){return e!=null&&e.template&&e.templateId==null&&this.M.addTemplate&&(e.templateId=G(),this.M.addTemplate(e.templateId,e.template)),e}registerTag(e,t){this.M.recado!=null&&this.M.recado.registerTag(e,t)}createRenderer(e,t,n){return(s,a,l,h,d,u)=>{let p=n(a),g=a,m;g=Object.assign({},l?l.parameters||{}:{}),Object.assign(g,a);let E={};for(m in g)g.hasOwnProperty(m)&&g[m]!=null&&(g[m].constructor==Function?E[m]=g[m](a):E[m]=g[m]);if(g=E,l){let y=l.templateId||`vjs-${e}-${p}`;if(l.templateIdResolver&&(y=l.templateIdResolver(g,this,this.model,s)),this.$_useModelForSizes){let x=this.$resolveVertexSizeFromModel(s,l);g[this.$modelWidthAttribute]=x.width,g[this.$modelHeightAttribute]=x.height}d?this.M.rerender(y,g,this.model,e,this,l,s,h,u):this.M.render(y,g,this.model,e,this,l,s,h)}}}$resolveVertexSizeFromModel(e,t){let n=this.$_getModelSizeForVertex(e);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.initialSize!=null)return Object.assign({},a.initialSize)}return this.$_getDefaultSizeForVertex(e,t)}$doRenderNode(e,t){if(this.getElement(e.id)==null){let n=this.getNodeDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.Pl(e,e.data,n,t,!1,null))}}$reRenderNode(e){let t=this.$getManagedElement(e.id);if(t==null)this.$doRenderNode(e);else{let n=this.getNodeDefinition(e);this.Pl(e,e.data,n,null,!0,t.el)}}$doRenderGroup(e,t){if(this.getElement(e.id)==null){let n=this.getGroupDefinition(e);n.ignore!==!0&&(this.$unrenderedVertices.set(e.id,{vertex:e,def:n,eventInfo:t}),this.Zu(e,e.data,n,t,!1,null))}}$paintOverlay(e,t,n){if(rs(e))HT(this,e,t,n);else if(gi(e))kT(this,e,t,n);else if(Zr(e)){pa(e,this);let o=t,s=e;this.sp(s,o,e.rotatable!=null)}else if(dn(e)){_h(e,this);let o=t,s=e;this.sp(s,o,e.rotatable!=null)}else throw"Could not paint overlay of type ["+e.type+"]"}sp(e,t,n){if(e.location===0||e.location===1){let s=(e.location===0?e.connection.anchors.source:e.connection.anchors.target).computedPosition;this.$setAttributes(e.contentElement,{"data-anchor-x":`${s.x}`,"data-anchor-y":`${s.y}`,"data-anchor-ox":`${s.ox}`,"data-anchor-oy":`${s.oy}`})}e.contentElement.style.left=t.d.minx+Dn,e.contentElement.style.top=t.d.miny+Dn,n&&pi(e.contentElement,t.d.rotation||0)}setOverlayVisible(e,t){e.visible=t;function n(o){o!=null&&(t?F(o,zl):L(o,zl))}if(rs(e)){let o=e;o.contentElements&&o.contentElements.forEach(n)}else gi(e)?e.contentElements&&e.contentElements.forEach(n):Zr(e)?n(pa(e,this)):dn(e)&&n(_h(e,this))}$reattachOverlay(e,t){rs(e)?lh(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):gi(e)?Qo(this,e).map(n=>this.$appendElement(n,t.connector.canvas)):Zr(e)?this.$appendElement(pa(e,this),this.getContainer()):dn(e)&&this.$appendElement(_h(e,this),this.getContainer())}$setOverlayHover(e,t){let n;rs(e)?n=lh(this,e):gi(e)?n=Qo(this,e):Zr(e)?n=[pa(e,this)]:dn(e)&&(n=[_h(e,this)]),n!=null&&n.length>0&&(n.forEach(o=>{Ut(o,t?[Eh]:[],t?[]:[Eh])}),this.$setHover(e.connection,t))}destroyOverlay(e){rs(e)&&e instanceof Ku?Tf(e):gi(e)?Tf(e):XT(e)?(e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement),delete e.cachedDimensions):dn(e)&&e.contentElement.parentNode&&e.contentElement.parentNode.removeChild(e.contentElement)}$drawOverlay(e,t,n,o){if(rs(e))return e.draw(t,n,o);if(gi(e)){let s=pr(t,e.location),a=n.stroke,l=n.stroke,h=n.strokeWidth,d=null;if(e.rotatable!=null){let u=e.location,p=!1;(X(e.location)||e.location<0||e.location>1)&&(u=parseInt(""+e.location,10),p=!0);let g=pr(t,u,p),m=$e(t,u,.01,p);d=sl(il(g,m)*180/Math.PI),e.rotatable!=="strict"&&d>90&&d<270&&(d=sl(d-180))}return{d:{loc:s,rotation:d},"stroke-width":h,stroke:a,fill:l,xmin:s.x,xmax:s.x,ymin:s.y,ymax:s.y,tail:s}}else if(Zr(e)||dn(e)){let s={x:0,y:0};if(o)s={x:o.x,y:o.y};else{let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0),s=pr(t,d,u)}let a=s.x,l=s.y,h=null;if(e.rotatable!=null){let d=e.location,u=!1;(X(e.location)||e.location<0||e.location>1)&&(d=parseInt(""+e.location,10),u=!0);let p=pr(t,d,u),g=$e(t,d,.01,u);h=sl(il(p,g)*180/Math.PI),e.rotatable!=="strict"&&h>90&&h<270&&(h=sl(h-180))}return{d:{minx:a,miny:l,cxy:s,rotation:h},xmin:a,xmax:a,ymin:l,ymax:l,tail:s}}else U("WARN: VisuallyJs - could not draw overlay of type ["+e.type+"]. Overlay type unknown.")}updateLabel(e){let t=pa(e,this),n=e.getLabel();n!=null?(t.innerText=n,t.textContent=n):(t.innerText="",t.textContent="")}$setHover(e,t){e.connector!=null&&this.$setConnectorHover(e,t)}$paintConnector(e,t){Sv(this,e,t)}$setConnectorHover(e,t){if(t===!1||!this.$isInMotion&&!this.hoverSuspended){e.$hover=t;let n=e.connector,o=n.canvas;o!=null&&(n.hoverClass!=null&&Ut(o,t?[n.hoverClass]:[],t?[]:[n.hoverClass]),Ut(o,t?[Eh]:[],t?[]:[Eh])),e.hoverPaintStyle!=null&&(e.paintStyleInUse=t?e.hoverPaintStyle:e.paintStyle),Object.values(e.overlays).forEach(s=>{s.ps===Zi&&this.setOverlayVisible(s,t)}),this.xt||this.$paintConnection(e)}}$destroyConnector(e){e.connector!=null&&Y1(e.connector)}$addConnectorClass(e,t){e.canvas&&L(e.canvas,t)}$removeConnectorClass(e,t){e.canvas&&F(e.canvas,t)}$getConnectorClass(e){return e.canvas?e.canvas.className.baseVal:""}$setConnectorVisible(e,t){U1(e,t)}$applyConnectorType(e,t){if(t.cssClass){let n=Array.isArray(t.cssClass)?t.cssClass:[t.cssClass];e.canvas?L(e.canvas,n.join(" ")):e.classesToAddWhenRendered=n}}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.M.cleanupVertex(e.node.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()})),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t)return this.M.cleanupVertex(e.group.id,t.el),requestAnimationFrame(()=>{this.$relayoutOnVertexRemove&&this.refresh()}),t}addClass(e,t){e.constructor===dr?(e.eachVertex((n,o)=>this.addClass(o,t)),e.eachEdge((n,o)=>this.addClass(o,t))):this.Ll(e,t,L)}removeClass(e,t){e.constructor===dr?(e.eachVertex((n,o)=>this.removeClass(o,t)),e.eachEdge((n,o)=>this.removeClass(o,t))):this.Ll(e,t,F)}toggleClass(e,t){e.constructor===dr?(e.eachVertex((n,o)=>this.toggleClass(o,t)),e.eachEdge((n,o)=>this.toggleClass(o,t))):this.Ll(e,t,Af)}hasClass(e,t){if(e!=null){let n=this.getObjectInfo(e,!1);return n.el?un(n.el,t):qi(e)?un(e,t):!1}}Ll(e,t,n){let o=s=>{let a=this.getObjectInfo(s,!1);a.el?n(a.el,t):qi(s)&&n(s,t)};e!=null&&(Vn(e)?n(e,t):RT(e)?e.forEach(s=>o(s)):o(e))}$setConnectionVisible(e,t){Qt.setVisible(e,t)}$manage(e,t,n,o,s,a){return this.getElement(t.getFullId())||(()=>{if(this.containerType==="SVG"&&!Lt(e))throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");let l=super.$manage(e,t,n,o,s,a);return l!=null&&this.Ge!=null&&this.Ge.observe(l.el),l})()}$getModelInfoForDragElement(e,t,n){let o=null,s=null,a=null,l=null,h=null,d=Bt(e,Ae(hn),this.getContainer(),!0)||Bt(e,Ae(te),this.getContainer(),!0);if(d!=null&&(h=this.getModelObjectFromElement(d,!1,n)),h!=null&&!nt(h.obj)){l=h.obj;let u=h.missingPortCreated,p=j(l)?l.getParent():l,g={},m=t?ji:Hi;if(o=e.getAttribute(m)||e.getAttribute(Wr),!j(l)){let E=t?[ta,ME]:[zo,pu];if(a=e.getAttribute(E[0])||e.getAttribute(E[1])||e.getAttribute(hn)||e.getAttribute(Ul),a!=null){let y=l.getPort(a);n?(l=l.$addPort({id:a,type:o}),u=!0):l=y||l}}return j(l)&&(a=l.id,s=this.model.getPortType(l)),o!=null?g=this.view.getPortDefinition(o):g=this.view.getTypeDefinition(l),{vertexEl:d,objEl:this.getModelObjectFromElement(e,!0,!0).el,obj:l,vertex:p,typeDef:g,portType:o||s,portId:a,missingPortCreated:u}}else return null}$isElement(e){return qi(e)}getElementFromEvent(e){let t=Bt(e.target,Ae(gt),this.getContainer(),!0);return t!=null?this.getElement(t.getAttribute(gt)):null}getModelObjectFromElement(e,t,n){let o=s=>{let a;if(s.jtk!=null){if(s.jtk.node!=null)return{obj:s.jtk.node,el:s,missingPortCreated:!1};if(s.jtk.group!=null)return{obj:s.jtk.group,el:s,missingPortCreated:!1};if(s.jtk.port!=null)return{obj:s.jtk.port,el:s,missingPortCreated:!1};if(s.jtk.overlay!=null)return{obj:s.jtk.overlay.connection.edge,el:s,missingPortCreated:!1}}let l=s.getAttribute(te);if(l!=null){let h=this.model.getVertex(l);h!=null&&(a={obj:h,el:s,missingPortCreated:!1})}if(a==null){let h=s.getAttribute(hn)||s.getAttribute(ta)||s.getAttribute(zo);if(h!=null){let d=Bt(s,Ae(gt),this.fe,!1);if(d!=null){let u=d.getAttribute(gt),p=this.model.getNode(u)||this.model.getGroup(u);if(p)if(n){let g=s.getAttribute(Wr)||s.getAttribute(ji)||s.getAttribute(Hi)||be;return{obj:p.$addPort({id:h,type:g}),el:s,missingPortCreated:!0}}else{let g=p.getPort(h);return g==null?null:{obj:g,el:s,missingPortCreated:!1}}}}}if(a==null&&t===!0){let h=s.parentElement;return h!=null&&h!==this.fe?o(h):null}else return a};return o(e)}getRenderedPort(e){let n=(j(e)?e.getFullId():e).split(this.model.portSeparator),o=this.getRenderedElement(n[0]);return o?o.querySelector(di(hn,n[1]))||o.querySelector(di(zo,n[1]))||o.querySelector(di(ta,n[1]))||o:null}$isSupportedElement(e){return qi(e)}$afterRefresh(e){}$afterRelayout(e){}$zoomToFit(e){}$zoomToFitIfNecessary(e){}$zoomToElements(e){}$renderTransientVertex(e,t,n,o,s,a){let l=M(Le,a,o,s);return Rr(l,t.width,t.height),this.containerType==="SVG"?pn(l,e):Ie(l,e),l}getRenderedElement(e){var a;if(e==null)return null;let n=(X(e)?e:e.getFullId()).split(this.model.portSeparator),o=(a=this.$getManagedElement(n[0]))==null?void 0:a.el;function s(l,h){return o.querySelector(`:scope [${l}="${h}"]:not(:scope [data-vjs-managed] [${l}="${h}"])`)}if(o&&n.length>1){let l=s(hn,n[1])||s(ta,n[1])||s(zo,n[1]);if(l==null){if(this.logicalPorts===!0||o.getAttribute(hn)===n[1]||o.getAttribute(ta)===n[1]||o.getAttribute(zo)===n[1]||o.getAttribute(Ul)===n[1]||o.getAttribute(ME)===n[1]||o.getAttribute(pu)===n[1])return o}else return l}else return o}getZoom(){return this.currentZoom}getEffectiveVisibleZoom(){return this.getZoom()}getShapeLibrary(){return this.$shapeLibrary}$getEdgePropertyMappings(){var e;return(e=this.$_propertyMapper)==null?void 0:e.getPropertyMappings()}setSuspendRendering(e,t){this.$suspendRendering=e,this.$_setSuspendDrawing(e),t&&this.refresh()}isSuspendRendering(){return this.$suspendRendering}$getCollapsedGroupSize(e,t){let n=this.$computeCollapsedGroupSize(e,t);if(n!=null)return n;if(this.$shapeLibrary){let o=e.data[this.$shapeLibrary.typeParameter],s=e.data[this.$shapeLibrary.categoryParameter],a=this.$shapeLibrary.getShapeDefinition(o,s);if(a!=null&&a.collapsedSize!=null)return Object.assign({},a.collapsedSize)}return super.$getCollapsedGroupSize(e,t)}$drawAdHocEdge(e,t,n,o=[],s,a,l={}){let h=document.createElement("div"),d=e.lineWidth||2,u=e.color||"#000000",p=Math.max(d,Math.abs(n.x-t.x)),g=Math.max(d,Math.abs(n.y-t.y)),m=M(Le,{viewBox:`0 0 ${p} ${g}`});m.style.overflow="visible";let E=t.x<n.x?0:p,y=t.y<n.y?0:g,x=t.x>n.x?0:p,f=t.y>n.y?0:g,b=[{x1:E,x2:x,y1:y,y2:f,extents:{xmin:0,ymin:0,xmax:p,ymax:g},type:wn,length:0}],A={internalSegments:b,totalLength:0,segmentProportions:[[0,1]],segmentProportionalLengths:[1],paintInfo:{sx:E,sy:y,tx:x,ty:f,so:{x:1,y:0},to:{x:-1,y:0},quadrant:1,x:E,y,w:x-E,h:f-y,startStubX:0,endStubX:0,startStubY:0,endStubY:0,opposite:!1,perpendicular:!1,orthogonal:!1,stubs:[0,0],sourceAxis:"x",isXGreaterThanStubTimes2:!1,isYGreaterThanStubTimes2:!1}},T=(O,v,_)=>{let[P,I]=X(O)?[O,{}]:[O.type,O.options],C=fo(I,l,"_");C.location=v,C.direction=_;let R=at.get(this,P,{instance:this},C),w=this.$drawOverlay(R,A,{stroke:u,fill:u});if(R.isSimpleShape){let B=R,N=w;B.contentTags.forEach((V,D)=>{let $=M(V,N.atts[D]);m.appendChild($)})}else if(gi(R)){let B=R,N=w;B.contentElements.forEach(V=>{pn(V,N.d.loc),m.appendChild(V)})}else if(dn(R)){let B=R,N=w;B.contentElements.forEach(V=>{pn(V,N.d.loc),m.appendChild(V)})}return w};if(s!=null){let O=T(s,0,-1);E=O.tail.x,y=O.tail.y,b[0].x1=E,b[0].y1=y}if(a!=null){let O=T(a,1,1);x=O.tail.x,f=O.tail.y,b[0].x2=x,b[0].y2=f}b[0].length=Math.sqrt(Math.pow(x-E,2)+Math.pow(f-y,2)),A.totalLength=b[0].length;let S=M(q,{stroke:u,"stroke-width":d,"stroke-dasharray":e.dashArray||"",d:`M ${E},${y} L ${x},${f}`});return m.appendChild(S),o.forEach(O=>{let[v,_]=X(O)?[O,{}]:[O.type,O.options],P=fo(_,l,"_"),I=at.get(this,v,{instance:this},P),C=this.$drawOverlay(I,A,{stroke:u,fill:u});if(I.isSimpleShape){let R=I,w=C;R.contentTags.forEach((B,N)=>{let V=M(B,w.atts[N]);m.appendChild(V)})}else if(gi(I)){let R=I,w=C;R.contentElements.forEach(B=>{pn(B,w.d.loc),m.appendChild(B)})}else if(Zr(I))if(I.useHTMLElement){let R=C,w=I.contentElement;h.appendChild(w),w.style.left=`${R.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${R.d.cxy.y}px)`}else{let R=M(q,C.atts[0]);m.appendChild(R)}else if(dn(I)){let R=C,w=I.create(null,null,this,this.model);w.style.position=Qe,w.style.transform="translate(-50%, -50%)",h.appendChild(w),w.style.left=`${R.d.cxy.x/length*100}%`,w.style.top=`calc(50% + ${R.d.cxy.y}px)`}}),h.appendChild(m),h}toBack(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;n.el.parentElement.insertBefore(n.el,n.el.parentElement.childNodes[0]),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a)),t&&n.obj.group!=null&&this.toBack(n.obj.group)}}toFront(e,t){let n=this.getObjectInfo(e,!1);if(n.el&&n.el.parentElement){let o=Y(n.obj)?this.$getGroupContentAreaElement(n.el):n.el,s=o.scrollTop,a=o.scrollLeft;t&&n.obj.group!=null&&this.toFront(n.obj.group,t),n.el.parentElement.insertBefore(n.el,null),o&&(s!=null&&(o.scrollTop=s),a!=null&&(o.scrollLeft=a))}}$setGroupElementSize(e,t){let n=this.getGroupElement(e.id);if(Lt(n.el))this.$setElementSizeInUI(n.el,t.width,t.height);else{let o=n.contentArea||n.el;this.$setElementSizeInUI(o,t.width,t.height)}}setMode(e,t){}batch(e){this.setSuspendEvents(!0),this.model.batch(e),this.setSuspendEvents(!1)}setEnabled(e,t){let n=e.getFullId(),o=this.getRenderedElement(n)||this.getRenderedPort(n);return o!=null&&qi(o)&&(t?o.removeAttribute(Er):o.setAttribute(Er,ct)),t}flashVertex(e,t=1e3,n=nv){let o=Array.isArray(e)?e:[e],s=`${n} ${t}ms`;o.forEach(a=>{let l=this.getObjectInfo(a,!1);l.obj&&l.el&&(l.el.style.animation=s,L(l.el,Rf))})}flashSelection(e,t=1e3,n){this.flashVertex(e.getNodes(),t,n),this.flashVertex(e.getGroups(),t,n)}reload(){this.dataSource instanceof dr?this.dataSource.reload():U("VisuallyJs - WARN: UI not rendering a selection, `reload` has no effect. Not fatal.")}};var ma=`<div data-vjs-vertex="{{id}}" class="${ki} ${Mf}">{{label}}</div>`,t0="<div/>",r0=`<div data-vjs-vertex="{{id}}" class="${Xo} ${Vf}">{{label}}</div>`,Ea=`<svg:rect data-vjs-vertex="{{id}}" class="${ki} ${Mf}" x="0" y="0" width="80" height="60"/>`,n0='<svg:rect x="0" y="0" width="100%" height="30"/>',i0=`<svg:rect data-vjs-vertex="{{id}}" class="${Xo} ${Vf}" x="0" y="0" width="300" height="250"/>`,z1={html:{"vjs-node-default":ma,"vjs-group-default":r0,"vjs-port-default":t0},svg:{"vjs-node-default":Ea,"vjs-group-default":i0,"vjs-port-default":n0}},Vv=(i,r)=>z1[i][r],fp=class{constructor(r,e,t){c(this,"recado");c(this,"asynchronous",!1);c(this,"reactive",!1);c(this,"usesWrapperElement",!1);c(this,"uicore",null);c(this,"currentVertex",null);if(t=t||{},this.recado=xr({defaultTemplate:r,templates:t.templates,templateMacros:t.templateMacros,templateResolver:e}),t.tags)for(let n in t.tags)this.registerTag(n,t.tags[n])}render(r,e,t,n,o,s,a,l){this.uicore=o,this.currentVertex=a;let h=this.recado.template(r,e,null,!1,{obj:a,ui:o,model:o.model}),d=h.childNodes[0];o.$vertexRendered(a,d,s,null),h.$recado.mountings.length>0&&this.recado.mounted(h),this.currentVertex=null}rerender(r,e,t,n,o,s,a,l,h){this.Q(h),this.render(r,e,t,n,o,s,a,l)}Q(r){this.recado.remove(r,!0)}cleanupVertex(r,e){this.Q(e)}cleanupPort(r,e){this.Q(e)}addTemplate(r,e){this.recado.addTemplate(r,e)}registerTag(r,e){this.recado.registerTag(r,{template:e.template,rendered:(t,n,o,s)=>{e.rendered&&e.rendered(t,n,o,this.uicore,this.currentVertex)},updated:(t,n,o)=>{e.updated&&e.updated(t,n,o,this.uicore,this.currentVertex)},mounted:e.mounted,fragments:e.fragments})}update(r,e,t,n){if(r.$recado){this.currentVertex=t,this.uicore=n;let o=this.recado.update(r,e,{obj:t});for(let s=0;s<o.removed.length;s++)o.removed[s].el.nodeType!==3&&o.removed[s].el.nodeType!==8&&n.$__unmanage(o.removed[s].el,!1,!0)}}removeElement(r){this.Q(r)}};function Oh(i,r,e){let t=n=>Vv(r?"svg":"html",n)||Yf(n)||i;return new fp(i,t,e)}var X1="pointerdown",j1="pointermove",H1="pointerup",k1="touchstart",o0="touchmove",s0="touchend";function a0(i,r,e,t){return Math.sqrt(Math.pow(e-i,2)+Math.pow(t-r,2))}var yp=class{constructor(r){c(this,"isPointerDevice");c(this,"isTouchDevice");c(this,"center");c(this,"radius");c(this,"startRadius");c(this,"onPinchStart");c(this,"onPinch");c(this,"onPinchEnd");c(this,"eventManager");c(this,"listenerTypes",{pointer:r=>{let e={},t=[],n=0,o=!1,s=()=>{n===2&&(this.center={x:(t[1].p[0]+t[0].p[0])/2,y:(t[1].p[1]+t[0].p[1])/2},this.radius=a0(t[1].p[0],t[1].p[1],t[0].p[0],t[0].p[1]))},a=d=>{n>=2||o||(t[n]={e:d,p:[d.pageX,d.pageY]},e[""+d.pointerId]=n,n++,s(),n===2&&(this.startRadius=this.radius,this.jr(this.onPinchStart)))},l=d=>{e[""+d.pointerId]!=null&&(delete e[""+d.pointerId],n--,o=n!==0,this.ap())},h=d=>{if(o||n!==2)return;let u=e[d.pointerId];u!=null&&(t[u].p=[d.pageX,d.pageY],s(),this.jr(this.onPinch))};this.bind(r.el,X1,a,{passive:!1}),this.bind(document,H1,l,{passive:!1}),this.bind(document,j1,h,{passive:!1})},touch:r=>{let e=d=>d.touches||[],t=(d,u)=>d.item?d.item(u):d[u],n=d=>{let u=t(d,0),p=t(d,1);return a0(u.pageX,u.pageY,p.pageX,p.pageY)},o=d=>{let u=t(d,0),p=t(d,1);return{x:(u.pageX+p.pageX)/2,y:(u.pageY+p.pageY)/2}},s=!1,a=d=>{let u=e(d);u.length===2&&r.enableWheelZoom!==!1&&(this.center=o(u),this.radius=this.startRadius=n(u),s=!0,this.bind(document,o0,h),this.bind(document,s0,l),oe(d),this.jr(this.onPinchStart))},l=d=>{s=!1,oe(d),this.unbind(document,o0,h),this.unbind(document,s0,l),this.ap()},h=d=>{if(s){let u=e(d);u.length===2&&(oe(d),this.radius=n(u),this.center=o(u),this.jr(this.onPinch))}};this.bind(r.el,k1,a)}});this.eventManager=new ye,this.isPointerDevice="onpointerdown"in document.documentElement,this.isTouchDevice="ontouchstart"in document.documentElement,this.center={x:0,y:0},this.radius=0,this.startRadius=0,this.onPinch=r.onPinch,this.onPinchStart=r.onPinchStart,this.onPinchEnd=r.onPinchEnd,this.isPointerDevice?this.listenerTypes.pointer(r):this.isTouchDevice&&this.listenerTypes.touch(r)}jr(r){r(this.center,this.startRadius,this.radius,this.radius/this.startRadius)}ap(){this.onPinchEnd()}bind(r,e,t,n){this.eventManager.on(r,e,t)}unbind(r,e,t){this.eventManager.off(r,e,t)}destroy(){}};var xp=class{constructor(r,e){this.panZoom=r;this.elementPositionSetter=e;c(this,"fixedElements",{})}jy(r,e){if(e===ee){let t=r.pos[e];if(r.alignX===yt){let n=Ze(r.el);return t-n.width}return t}else{let t=r.pos[e];if(r.alignY===ht){let n=Ze(r.el);return t-n.height}return t}}wl(r){let e,t;for(let n in this.fixedElements)if(this.fixedElements.hasOwnProperty(n)){if(e=e||this.panZoom.getApparentCanvasLocation(),t=t==null?this.panZoom.getZoom():t,r!=null&&r!==n)continue;let o=this.fixedElements[n],s=(a,l,h)=>{if(o[a]){let d=this.jy(o,l);o.requestedPosition[l]=d,e[l]/t+d<0?h(o.el,-(e[l]/t)):h(o.el,d)}};s(We,"x",(a,l)=>{ZT(a,l),o.currentPosition.x=l}),s(Te,"y",(a,l)=>{JT(a,l),o.currentPosition.y=l})}}pan(){this.wl()}append(r,e,t,n,o){if(r==null)return;let s=r;if(Lt(this.panZoom.canvasElement)&&!Lt(r))return U("ERROR: cannot add non-svg element to fixed layer when container is an SVG element."),null;t=t||{};let a=this.panZoom.idFunction(r);return this.fixedElements[a]={el:s,left:t.left,top:t.top,pos:e,alignX:t.alignX||We,alignY:t.alignY||Te,currentPosition:Object.assign({},e),requestedPosition:Object.assign({},e),id:n},Lt(s)||(s.style.position="absolute"),this.elementPositionSetter(s,e),o?this.panZoom.canvasElement.appendChild(r):this.panZoom.canvasElement.insertBefore(r,this.panZoom.canvasElement.childNodes[0]),this.wl(a),this.fixedElements[a]}remove(r){let e=this.panZoom.idFunction(r);e&&this.fixedElements[e]&&(this.panZoom.canvasElement.removeChild(this.fixedElements[e].el),delete this.fixedElements[e],this.wl())}destroy(){this.panZoom=null,this.fixedElements=null}};var W1="transformOrigin",l0="transform",Z1="translateX",J1="translateY",K1="scale",h0="px",d0="vjs-pan-zoom",u0="vjs-pan-zoom-canvas";function fa(){}function c0(i){let r=i,e=0,t=0;for(;r!=null;)isNaN(r.scrollLeft)||(e+=r.scrollLeft),isNaN(r.scrollTop)||(t+=r.scrollTop),r=r.parentNode;return{x:e,y:t}}var ya=class{constructor(r){c(this,"canvasElement");c(this,"viewportElement");c(this,"lp");c(this,"Ut");c(this,"eventManager");c(this,"pinchListener");c(this,"position",{x:0,y:0});c(this,"zoom");c(this,"transformOrigin",{x:0,y:0});c(this,"Dl");c(this,"panning",!1);c(this,"aboutToPan",!1);c(this,"Nl");c(this,"pinchZooming",!1);c(this,"zooming",!1);c(this,"zoomingWithWheel",!1);c(this,"downAt");c(this,"Qr");c(this,"Vn");c(this,"zoomRange");c(this,"zoomAtZoomStart");c(this,"maximumZoomTravel",150);c(this,"distanceAtZoomStart");c(this,"lastDistance");c(this,"canvasAtPanStart");c(this,"lastMouseX",-1);c(this,"lastMouseY",-1);c(this,"fixedTransformOrigin",null);c(this,"lastMovedAt",null);c(this,"lastVelocity",0);c(this,"lastAcceleration",0);c(this,"onZoom");c(this,"onMaybeZoom");c(this,"onPan");c(this,"onPanStart");c(this,"onMouseDown");c(this,"onMouseUp");c(this,"onMouseMove");c(this,"onSetTransformOrigin");c(this,"clamp");c(this,"clampZoom");c(this,"enablePan");c(this,"panWithMetaKey");c(this,"enableWheelZoom");c(this,"enableAnimation");c(this,"wheelCssFilterSpec");c(this,"wheelFilter");c(this,"wheelCssFilter");c(this,"wheelZoomRequiresMetaKey");c(this,"wheelDirection");c(this,"wheelSensitivity");c(this,"wheelPan");c(this,"wheelPanAxis");c(this,"background");c(this,"fixedLayer");c(this,"Il");c(this,"Vl");c(this,"Hi");c(this,"Ml");c(this,"Gl");c(this,"viewport");c(this,"Os");c(this,"Ge");c(this,"consumeRightClick");c(this,"smartMinimumZoom");c(this,"idFunction");c(this,"enabled");c(this,"clampToBackground");c(this,"clampToBackgroundExtents");c(this,"filter");c(this,"Wi",{});c(this,"$l",!1);c(this,"handlers",{start:(r,e)=>{if(this.pinchZooming)return;(n=>{if(this.enabled){let o=n.srcElement||n.target;return o===this.canvasElement||o===this.viewportElement||o.$jtkDecoration||this.background&&this.background.owns(o)||this.filter(o,n)===!0||n.ex===!0}else return!1})(r)&&(this.$computeCompoundZoom(),this.zoomingWithWheel=!1,this.lastMouseX=-1,this.lastMouseY=-1,r.which===3&&this.enableWheelZoom!==!1&&(r.mozInputSource==null||r.mozInputSource===1)?(this.zooming=!0,this.downAt=me(r),this.Qr=this.$_getViewportSize(),this.gr(),this.gp(r),this.canvasAtPanStart=Object.assign({},this.position),this.zoomAtZoomStart=this.zoom):e.length<=1&&this.Qy(r)&&(this.Qr=this.$_getViewportSize(),this.gr(),this.panning=!0,this.aboutToPan=!0,this.downAt=me(r),this.canvasAtPanStart=Object.assign({},this.position),oe(r))),this.onMouseDown(r,this)},move:(r,e)=>{let t,n,o;if(this.zoomingWithWheel=!1,!this.pinchZooming){if(this.zooming)o=me(r),t=o.x-this.downAt.x,n=o.y-this.downAt.y,this.Yl(t,n,r);else if(this.panning&&this.enablePan&&this.downAt!=null){oe(r),this.aboutToPan&&(this.aboutToPan=!1,this.onPanStart()),o=me(r),t=(o.x-this.downAt.x)/this.Os,n=(o.y-this.downAt.y)/this.Os;let s=this.ot({x:this.canvasAtPanStart.x+t,y:this.canvasAtPanStart.y+n,animate:!1});this.onPan(s.x,s.y,this.zoom,this.zoom,r),this.background&&this.background.pan(),this.fixedLayer.pan(),oe(r)}this.onMouseMove(r,this)}},end:(r,e)=>{this.pinchZooming||this.yp(r,!0)},[At]:r=>{}});r.events=r.events||{},this.zoom=r.zoom||1,this.zoomRange=r.zoomRange||jS,this.Dl=r.zoomStep||.25,this.fixedLayer=new xp(this,r.elementPositionSetter),this.eventManager=new ye,this.viewport=r.viewport,this.canvasElement=r.canvasElement,this.Ge=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.gr()})}),this.Ge.observe(this.canvasElement),this.fixedTransformOrigin=r.fixedTransformOrigin,this.ot({x:0,y:0,animate:!1}),this.viewportElement=r.viewportElement,L(this.viewportElement,d0),L(this.canvasElement,u0),new ResizeObserver(()=>{window.requestAnimationFrame(()=>{this.$_getViewportSize()})}).observe(this.viewportElement),this.idFunction=r.idFunction,this.onZoom=r.events.zoom||fa,this.onMaybeZoom=r.events.maybeZoom||(()=>!0),this.onPan=r.events.pan||fa,this.onPanStart=r.events.panStart||fa,this.onMouseDown=r.events.mousedown||fa,this.onMouseUp=r.events.mouseup||fa,this.onMouseMove=r.events.mousemove||fa,this.onSetTransformOrigin=r.events.transformOrigin||fa,this.clamp=r.clamp!==!1,this.clampZoom=r.clampZoom!==!1,this.panWithMetaKey=r.panWithMetaKey===!0,this.enablePan=r.enablePan!==!1,this.Nl=r.panFilter&&typeof r.panFilter=="function"?r.panFilter:null,this.enableAnimation=r.enableAnimation!==!1;let t=r.wheel||{};this.enableWheelZoom=t.zoom!==!1,this.wheelFilter=t.filter||(()=>!0),this.wheelCssFilterSpec=t.cssFilter,this.wheelZoomRequiresMetaKey=t.useMetaKey===!0,this.wheelDirection=t.reverse===!0?-1:1,this.wheelSensitivity=this.wheelDirection*(t.sensitivity||10),this.wheelPan=t.pan===!0,this.wheelPanAxis=t.axis||"both",this.hp(),this.consumeRightClick=r.consumeRightClick!==!1,this.smartMinimumZoom=r.smartMinimumZoom,this.Il=function(n){this.Bl("move",n)}.bind(this),this.Vl=function(n){this.Bl("end",n)}.bind(this),this.Hi=function(n){this.zoomingWithWheel=!1}.bind(this),this.enabled=r.enabled!==!1,this.clampToBackground=r.clampToBackground,this.clampToBackgroundExtents=r.clampToBackgroundExtents,this.filter=r.filter||(()=>!1),(this.enableWheelZoom||this.wheelPan)&&(this.Ut=(n,o,s,a)=>this.wheelPanOrZoom(n,o,s,a),nh(this.viewportElement,this.Ut,!0,this.wheelZoomRequiresMetaKey)),this.pinchListener=new yp({el:this.viewportElement,enableWheelZoom:this.enableWheelZoom,onPinch:(n,o,s,a)=>{this.K(a*this.zoomAtZoomStart);let l=n.x-this.downAt.x,h=n.y-this.downAt.y;this.ot({x:this.canvasAtPanStart.x+l,y:this.canvasAtPanStart.y+h,animate:!1})},onPinchStart:(n,o)=>{this.pinchZooming=!0,this.downAt=n,this.distanceAtZoomStart=this.lastDistance=o,this.zoomAtZoomStart=this.zoom,this.Fl(this.downAt.x,this.downAt.y),this.canvasAtPanStart=Object.assign({},this.position)},onPinchEnd:()=>{this.pinchZooming=!1,this.downAt=null}}),this.K(this.zoom,null,!1,!1,!0),this.Ul(),this.background=new Gv,r.background&&this.background.addBackground(r.background),this.Ml=n=>{this.start(n)},this.eventManager.on(this.viewportElement,ge,this.Ml),this.eventManager.on(document,ae,this.Hi),this.Gl=n=>{this.Bl(At,n)},this.eventManager.on(this.viewportElement,At,this.Gl),this.gr(),this.$computeCompoundZoom()}getCompoundZoom(){return this.Os}$addWheelSelectorFilter(r){r!=null&&r.length>0&&(this.wheelCssFilterSpec=[r,this.wheelCssFilterSpec||""].join(" "),this.hp())}$computeCompoundZoom(r){r=r||this.$_getViewportSize();let e=this.viewportElement.getBoundingClientRect();this.Os=e.width/r.width}$_getViewportSize(){return this.Qr=Ze(this.viewportElement),this.Qr}gr(){return this.Vn=Ze(this.canvasElement),this.Vn}hp(){this.wheelCssFilterSpec!=null&&this.wheelCssFilterSpec.length>0&&(this.wheelCssFilter=r=>{let e=r.srcElement||r.target;return!$t(e,this.wheelCssFilterSpec)})}ky(r,e,t,n){n=n||150;let{x:o,y:s}=this.position,a=this.zoom,l=r-a,h=e-o,d=t-s,u=null,p=g=>{u||(u=g);let m=g-u,E=m/n,y=a+E*l,x=o+E*h,f=s+E*d;this.canvasElement.style.transform=`scale(${y}) translateX(${x/y}px) translateY(${f/y}px)`,m<n?requestAnimationFrame(p):(this.zoom=r,this.position={x:e,y:t},this.onPan(e,t,this.zoom,this.zoom))};requestAnimationFrame(p)}ot(r){let e=this.cp(r.x,r.y);if(this.enableAnimation&&r.animate)if(r.zoom!=null){let t=this.dp(r.zoom);this.ky(t,e.x,e.y,r.animationDuration)}else this.position=e,this.pp(null,r.onComplete);else this.position=e,this.zl(),r.onComplete&&r.onComplete(this.position);return this.position}mp(r,e,t,n,o){let s=this.position;return this.ot({x:s.x+r,y:s.y+e,animate:t,onComplete:n,animationDuration:o})}Hy(r,e,t,n){n||this.pan(-e*100,-t*100)}Wy(r,e,t,n){this.zoomAtZoomStart=this.zoom,this.zoomingWithWheel||(this.gp(r),this.zoomingWithWheel=!0),this.Yl(0,r.normalizedWheelDelta*this.wheelSensitivity,r,!0)}wheelPanOrZoom(r,e,t,n){this.wheelFilter(r)&&(this.wheelCssFilter==null||this.wheelCssFilter(r))&&(r.preventDefault&&r.preventDefault(),r.stopPropagation&&r.stopPropagation(),!this.wheelPan||n?this.Wy(r,e,t,n):(e=this.wheelPanAxis==="both"||this.wheelPanAxis===ee?e:0,t=this.wheelPanAxis==="both"||this.wheelPanAxis===fe?t:0,this.Hy(r,e,t,n)))}Zy(r,e,t){this.canvasElement.animate(r,{duration:e||250}).finished.then(()=>{for(let n in r)this.canvasElement.style[n]=r[n];t&&t(this.position)})}Ep(){return`${K1}(${this.zoom}) ${Z1}(${this.position.x/this.zoom}${h0}) ${J1}(${this.position.y/this.zoom}${h0})`}zl(){this.canvasElement.style[l0]=this.Ep()}pp(r,e){if(this.canvasElement.animate!=null){let t={[l0]:this.Ep()};this.Zy(t,r,e)}else this.zl()}Jy(){return this.fixedTransformOrigin==null?`${this.transformOrigin.x}% ${this.transformOrigin.y}%`:`${this.fixedTransformOrigin.x} ${this.fixedTransformOrigin.y}`}Ul(){this.canvasElement.style[W1]=this.Jy()}Ky(r,e){let t=this.fromPageLocation(r,e),n=this.Vn||this.gr();return{width:n.width,height:n.height,xy:t,xScale:t.x/n.width,yScale:t.y/n.height,o:{x:t.x/n.width*100,y:t.y/n.height*100}}}fp(r,e,t){let n,o,s,a,l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t;n=-(l*(1-this.zoom)),o=-(h*(1-this.zoom)),this.transformOrigin=r,this.Ul(),l=this.transformOrigin.x/100*e,h=this.transformOrigin.y/100*t,s=-(l*(1-this.zoom)),a=-(h*(1-this.zoom));let d=this.mp(s-n,a-o,!1);this.onSetTransformOrigin&&this.onSetTransformOrigin(this.transformOrigin,d)}Fl(r,e){if(this.fixedTransformOrigin==null){let t=this.Ky(r,e);this.fp(t.o,t.width,t.height)}}gp(r){if(this.fixedTransformOrigin==null){let e=me(r);this.Fl(e.x,e.y)}}$setTransformOriginToCanvasPoint(r,e){if(this.fixedTransformOrigin==null){let t=this.Vn||this.gr();this.fp({x:r/t.width*100,y:e/t.height*100},t.width,t.height)}}dp(r){let e=this.zoomRange[0];if(this.smartMinimumZoom){e=.5;let t=this.getBoundsInfo().minimumFill;r/t<e&&(r=t*e)}else r<e&&(r=e);return r>this.zoomRange[1]&&(r=this.zoomRange[1]),r}K(r,e,t,n,o){if(r==null||isNaN(r)||r<0)return;r=this.dp(r);let s=this.zoom,a=l=>{if(!this.$l&&(o||this.onZoom(0,0,r,s,e,t),this.background!=null&&this.background.setZoom(r),this.fixedLayer.pan(),this.clampZoom)){let h=this.position,d=this.cp(h.x,h.y);(d.x!=h.x||d.y!=h.y)&&this.ot({x:d.x,y:d.y,animate:!1})}};if(n){let l=this.getViewportCenter();this.$setTransformOriginToCanvasPoint(l.x,l.y),this.zoom=r,this.pp(null,a)}else this.zoom=r,this.zl(),a(this.position);return this.zoom}Yl(r,e,t,n){e<-this.maximumZoomTravel&&(e=-this.maximumZoomTravel),e>this.maximumZoomTravel&&(e=this.maximumZoomTravel),this.qy(this.zoomAtZoomStart,e,-this.maximumZoomTravel,this.maximumZoomTravel,t,n)}qy(r,e,t,n,o,s){let a=e/(e>=0?n:t),l=e>=0?1:0,h=r+a*(this.zoomRange[l]-r);this.K(h,o,s)}cp(r,e,t){if(!this.clamp&&!this.clampToBackground&&!this.clampToBackgroundExtents)return{x:r,y:e};{let n=this.Qr||this.$_getViewportSize(),o=this.st(),s=r,a=e,l=this.clamp?this.getBoundsInfo():{x:0,y:0,width:0,height:0,vw:n.width,vh:n.height,padding:t,minimumFill:1};if(t=0,(this.clampToBackground||this.clampToBackgroundExtents)&&this.background!=null){let m=this.background.getWidth(),E=this.background.getHeight(),y=Math.max(l.x+l.width,m),x=Math.max(l.y+l.height,E);l.width=y-l.width,l.height=x-l.height;let f=l.vw/l.width,b=l.vh/l.height;l.minimumFill=Math.min(f,b),this.clampToBackgroundExtents&&(t=Math.max(l.vw,l.vh))}let h=[l.x+l.width,l.y+l.height];this.background&&(h[0]=Math.max(h[0],this.background.getWidth()),h[1]=Math.max(h[1],this.background.getHeight()));let d=r+o.x+h[0]*this.zoom-t,u=e+o.y+h[1]*this.zoom-t,p=r+o.x+l.x*this.zoom+t,g=e+o.y+l.y*this.zoom+t;return d<0&&(s-=d),p>l.vw&&(s-=p-l.vw),u<0&&(a-=u),g>l.vh&&(a-=g-l.vh),{x:s,y:a}}}st(){let r=this.Vn||this.gr(),e=this.transformOrigin.x/100*r.width,t=this.transformOrigin.y/100*r.height;return{x:e*(1-this.zoom),y:t*(1-this.zoom)}}Qy(r){let e=r.srcElement||r.target;return this.panWithMetaKey&&!(r.metaKey||r.ctrlKey)?!1:this.Nl!=null?this.Nl(e)!==!1:!0}yp(r,e){this.zooming=!1,this.downAt=null,this.panning=!1,this.aboutToPan=!1,this.Qr=null,this.zoomingWithWheel=!1,this.eventManager.off(document,ae,this.Il),this.eventManager.off(document,le,this.Vl),this.eventManager.on(document,ae,this.Hi),e&&this.onMouseUp(r,this)}Bl(r,e){r===At&&this.consumeRightClick&&e.preventDefault&&e.preventDefault();let t=Zo(e);this.handlers[r](e,t)}start(r){this.enabled&&r!=null&&(this.eventManager.off(document,ae,this.Hi),this.eventManager.on(document,ae,this.Il),this.eventManager.on(document,le,this.Vl),this.handlers.start(r,Zo(r)))}getBoundsInfo(r,e){let t=this.Qr||this.$_getViewportSize();if(this.viewport.isEmpty())return{width:0,height:0,x:0,y:0,vw:t.width,vh:t.height,minimumFill:1,zoom:1};r=r||0,e=e||.9;let n=this.viewport.getTopLevelExtents(),o=n.xmax-n.xmin,s=n.ymax-n.ymin,a=t.width/((o+r*2)/e),l=t.height/((s+r*2)/e),h=Math.min(a,l);return{width:o,height:s,x:n.xmin,y:n.ymin,vw:t.width,vh:t.height,minimumFill:h,zoom:this.zoom}}add(r,e){e&&(r.$jtkDecoration=!0)}suspend(r){let e=typeof r=="string"?r:this.idFunction(r);this.Wi[e]=!0}isSuspended(r){let e=typeof r=="string"?r:r.id;return this.Wi[e]===!0}restore(r){let e=typeof r=="string"?r:r.id;delete this.Wi[e]}remove(r){let e=this.idFunction(r);delete this.Wi[e]}reset(){this.Wi={},this.ot({x:0,y:0,animate:!1})}zoomToFit(r){r=r||{};let e=this.getBoundsInfo(r.padding,r.fill);r.doNotZoomIfVisible&&e.minimumFill>this.zoom||this.K(e.minimumFill),this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToFitIfNecessary(r){let e=Object.assign(r||{},{});e.doNotZoomIfVisible=!0,this.zoomToFit(e)}zoomToElements(r){let e=this.$_getViewportSize(),t={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:e.width,vh:e.height};for(let o=0;o<r.elements.length;o++){let s=r.elements[o],a=this.viewport.getPosition(this.idFunction(s));a&&(t.x=Math.min(t.x,a.x),t.y=Math.min(t.y,a.y),t.xMax=Math.max(t.xMax,a.x2),t.yMax=Math.max(t.yMax,a.y2))}let n=r.fill||.9;t.width=t.xMax-t.x,t.height=t.yMax-t.y,t.z=n*Math.min(t.vw/t.width,t.vh/t.height),r.doNotZoomIfVisible&&t.z>this.zoom||this.K(t.z),this.centerContent({bounds:t,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}zoomToBackground(r){if(r=r||{},this.background!=null){let e=this.background.getWidth(),t=this.background.getHeight(),n=this.$_getViewportSize(),o=n.width/e,s=n.height/t,a=Math.min(o,s),l={width:e,height:t,x:0,y:0,vw:n.width,vh:n.height,padding:0,minimumFill:a,zoom:a};this.K(l.minimumFill),this.centerContent({bounds:l,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}}zoomToExtents(r){let e=Array.isArray(r.extents)?r.extents:[r.extents];if(e.length>0){let t=this.$_getViewportSize(),n={x:1/0,y:1/0,xMax:-1/0,yMax:-1/0,z:1,vw:t.width,vh:t.height};e.forEach(s=>{n.x=Math.min(n.x,s.x),n.y=Math.min(n.y,s.y),n.xMax=Math.max(n.xMax,s.x+s.width),n.yMax=Math.max(n.yMax,s.y+s.height)});let o=r.fill||.9;n.width=n.xMax-n.x,n.height=n.yMax-n.y,n.z=o*Math.min(n.vw/n.width,n.vh/n.height),r.doNotZoomIfVisible&&n.z>this.zoom||this.K(n.z),this.centerContent({bounds:n,doNotAnimate:r.doNotAnimate!==!1,onComplete:r.onComplete,doNotFirePanEvent:r.doNotFirePanEvent})}}setFilter(r){this.filter=r||(()=>!1)}centerBackground(r){if(this.background!=null){let e=Object.assign({},this.getBoundsInfo());e.x=this.background.getWidth()/2,e.y=this.background.getHeight()/2,e.width=1,e.height=1,this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,vertical:!0,horizontal:!0})}}alignBackground(r,e){if(this.background!=null){let t=r.split(" "),n=t[0]||We,o=t[1]||Te,s=this.getBoundsInfo(),a=n===We?0:s.vw-this.background.getWidth()*this.zoom,l=o===Te?0:s.vh-this.background.getHeight()*this.zoom,h=this.st();this.ot({x:a-h.x,y:l-h.y,animate:!0,animationDuration:e}),this.background.pan(),this.fixedLayer.pan()}}nudgeZoom(r,e){let t=Ki(this.viewportElement),n=this.$_getViewportSize(),o=t.x+n.width/2,s=t.y+n.height/2;return this.Fl(o,s),this.K(this.zoom+r,e)}nudgeWheelZoom(r,e){this.zoomAtZoomStart=this.zoom,this.Yl(0,r,e,!0)}alignContent(r){r=r||{};let e=r.bounds||this.getBoundsInfo(),t=this.position;r.zoom&&this.setZoom(r.zoom,!1);let n=this.Vn||this.gr(),o=(1-1/this.zoom)*n.height,s=(1-1/this.zoom)*n.width,a=this.st(),l=e.x*this.zoom+e.width*this.zoom/2,h=e.y*this.zoom+e.height*this.zoom/2,d=e.vw/2-l,u=e.vh/2-h,p=r.padding||10,g=this.position.x,m=this.position.y,E=o*this.transformOrigin.y/100-e.y+p/this.zoom,y=(E-e.height-2*p+e.vh/this.zoom)*this.zoom,x=r.alignY==null?m:r.alignY===ht?y:r.alignY===It?u-a.y:E*this.zoom,f=s*this.transformOrigin.x/100-e.x+p/this.zoom,b=(f-e.width-2*p+e.vw/this.zoom)*this.zoom,A=r.alignX==null?g:r.alignX===yt?b:r.alignX===It?d-a.x:f*this.zoom;this.ot({x:A,y:x,animate:!r.doNotAnimate,animationDuration:r.animationDuration,onComplete:()=>{this.$l||(r.doNotFirePanEvent||this.onPan(A-t.x,x-t.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan()),r.onComplete&&r.onComplete({x:A,y:x})}})}alignContentTop(r){r=r||{},r.alignY=Te,this.alignContent(r)}alignContentBottom(r){r=r||{},r.alignY=ht,this.alignContent(r)}alignContentLeft(r){r=r||{},r.alignX=We,this.alignContent(r)}alignContentRight(r){r=r||{},r.alignX=yt,this.alignContent(r)}centerContent(r){r=r||{},r.alignX=r.horizontal===!1?null:It,r.alignY=r.vertical===!1?null:It,this.alignContent(r)}centerContentHorizontally(r){this.centerContent(Object.assign({horizontal:!0,vertical:!1},r))}centerContentVertically(r){this.centerContent(Object.assign({vertical:!0,horizontal:!1},r))}centerOn(r){let e=Object.assign({},this.getBoundsInfo());Object.assign(e,r.bounds);let t=()=>{this.$setTransformOriginToCanvasPoint(e.x+e.width/2,e.y+e.height/2),r.onComplete&&r.onComplete(e)};this.centerContent({bounds:e,doNotAnimate:r.doNotAnimate,onComplete:t,vertical:r.vertical!==!1,horizontal:r.horizontal!==!1,zoom:r.zoom})}centerOnHorizontally(r){this.centerOn({vertical:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete,bounds:r.bounds})}centerOnVertically(r){this.centerOn({bounds:r.bounds,horizontal:!1,doNotAnimate:r.doNotAnimate,onComplete:r.onComplete})}centerOnAndZoom(r){let e=r.fillRatio||.6,t=r.bounds,n=this.getBoundsInfo(),o=n.vw<n.vh?[n.vw,"width"]:[n.vh,"height"],s=e*o[0],a=s/t[o[1]];a<this.zoomRange[0]&&(a=this.zoomRange[0]),a>this.zoomRange[1]&&(a=this.zoomRange[1]),this.$setTransformOriginToCanvasPoint(t.x+t.width/2,t.y+t.height/2),this.centerOn({bounds:t,zoom:a,doNotAnimate:r.doNotAnimate})}getViewportCenter(){let r=Object.assign({},this.getBoundsInfo()),e=this.st(),t=this.position,n={x:r.vw/2,y:r.vh/2};return{x:(n.x-(t.x+e.x))/this.zoom,y:(n.y-(t.y+e.y))/this.zoom}}setViewportCenter(r){let e=Object.assign({},this.getBoundsInfo()),t=this.st(),n={x:e.vw/2,y:e.vh/2},o={x:-(r.x*this.zoom-n.x+t.x),y:-(r.y*this.zoom-n.y+t.y)};this.ot({x:o.x,y:o.y,animate:!1})}setClamping(r){this.clamp=r}isClamping(){return this.clamp}setZoom(r,e){return this.K(r,null,null,e)}zoomIn(r,e){return this.setTransformOrigin(r.x,r.y),this.K(this.zoom+this.Dl,null,null,e)}zoomOut(r,e){return this.setTransformOrigin(r.x,r.y),this.K(this.zoom-this.Dl,null,null,e)}setZoomRange(r,e){return r!=null&&r.length===2&&r[0]<r[1]&&r[0]!=null&&r[1]!=null&&r[0]>0&&r[1]>0&&(this.zoomRange=r,e||(this.zoom<this.zoomRange[0]||this.zoom>this.zoomRange[1])&&this.K(this.zoom)),this.zoomRange}getZoomRange(){return this.zoomRange}getZoom(){return this.zoom}getPan(){return Object.assign({},this.position)}pan(r,e,t,n){this.mp(r,e,t,o=>{this.onPan(o.x,o.y,this.zoom,this.zoom),this.background&&this.background.pan(),this.fixedLayer.pan(),n&&n(o)})}setPan(r,e,t,n){let o=this.ot({x:r,y:e,animate:t,onComplete:n});return this.onPan(o.x,o.y,this.zoom,this.zoom),o}startPanRepeat(r,e,t,n,o,s){this.stopPanRepeat();let a=()=>{let l=r*t,h=e*n;s&&s({x:l,y:h}),this.pan(l,h,!1)};a(),this.lp=window.setInterval(()=>a(),o)}stopPanRepeat(){window.clearTimeout(this.lp)}setTransformOrigin(r,e){this.transformOrigin={x:r,y:e},this.Ul()}fromPageLocation(r,e,t){let n=this.st(),o=this.position,s=c0(this.viewportElement),a=this.viewportElement.getBoundingClientRect(),l=this.getCompoundZoom(),h={x:((r-(a.x+s.x))/l-(o.x+n.x))/this.zoom,y:((e-(a.y+s.y))/l-(o.y+n.y))/this.zoom};return t&&(h.x=Math.round(h.x),h.y=Math.round(h.y)),h}fromWindowLocation(r,e,t){let n=this.st(),o=this.position,s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l={x:((r-s.x)/a-(o.x+n.x))/this.zoom,y:((e-s.y)/a-(o.y+n.y))/this.zoom};return t&&(l.x=Math.round(l.x),l.y=Math.round(l.y)),l}toPageLocation(r,e){let t=this.st(),n=this.position,o=c0(this.viewportElement),s=this.viewportElement.getBoundingClientRect(),a=this.getCompoundZoom(),l=a*(this.zoom*r+(n.x+t.x))+(s.x+o.x),h=a*(this.zoom*e+(n.y+t.y))+(s.y+o.y);return{x:l,y:h}}toViewportLocation(r,e){let t=this.st(),n=this.position,o=this.getCompoundZoom(),s=o*(this.zoom*r+(n.x+t.x)),a=o*(this.zoom*e+(n.y+t.y));return{x:s,y:a}}mapEventLocation(r){let e=me(r);return this.fromPageLocation(e.x,e.y)}setEnabled(r){this.enabled=r,r===!1&&this.yp(null,!1)}getApparentCanvasLocation(){let r=this.st(),e=this.position;return{x:e.x+r.x,y:e.y+r.y}}setApparentCanvasLocation(r,e){let t=this.st(),n=this.ot({x:r-t.x,y:e-t.y,animate:!1});return this.background&&this.background.pan(),this.fixedLayer.pan(),n}getVisibleContentArea(){this.$_getViewportSize();let r=this.getApparentCanvasLocation(),e=this.getBoundsInfo(),t=-r.x/e.zoom,n=-r.y/e.zoom,o=e.vw/e.zoom,s=e.vh/e.zoom;return{x:t,y:n,width:o,height:s}}floatElement(r,e){if(r==null)return;let t=r;t.style.position="absolute",t.style.left=e.x+"px",t.style.top=e.y+"px",this.viewportElement.appendChild(r)}fixElement(r,e,t,n,o){return this.fixedLayer.append(r,e,t,n,o)}unfixElement(r){this.fixedLayer.remove(r)}isInViewport(r,e){let t=this.viewportElement.getBoundingClientRect();return t.x<=r&&r<=t.x+t.width&&t.y<=e&&e<=t.y+t.height}setWheelFilter(r){this.wheelFilter=r||(e=>!0)}addBackground(r){this.background.addBackground(r)}removeBackground(r){this.background.removeBackground(r)}destroy(){this.Ge!=null&&(this.Ge.disconnect(),this.Ge=null),this.Ut!=null&&ih(this.viewportElement,this.Ut),this.pinchListener.destroy(),this.fixedLayer.destroy(),this.background.destroy(),this.pinchListener=null,this.fixedLayer=null,this.background=null,this.eventManager.off(document,ae,this.Hi),this.eventManager.off(this.viewportElement,ge,this.Ml),this.eventManager.off(this.viewportElement,At,this.Gl),delete this.onMaybeZoom,delete this.onPan,delete this.onMouseDown,delete this.onMouseUp,delete this.onMouseMove,delete this.onSetTransformOrigin,this.$l=!0}isBackgroundElement(r){return this.background==null?!1:this.background.owns(r)}},Gv=class{constructor(){c(this,"backgrounds",[])}addBackground(r){this.backgrounds.push(r)}removeBackground(r){this.backgrounds=this.backgrounds.filter(e=>e!==r)}getWidth(){return Math.max(...this.backgrounds.map(r=>r.getWidth()))}getHeight(){return Math.max(...this.backgrounds.map(r=>r.getHeight()))}setZoom(r,e){this.backgrounds.forEach(t=>t.setZoom(r,e))}owns(r){return this.backgrounds.find(e=>e.owns(r))!=null}pan(){this.backgrounds.forEach(r=>r.pan())}destroy(){this.backgrounds.forEach(r=>r.destroy()),this.backgrounds.length=0}zt(r){this.backgrounds.forEach(e=>e.zt(r))}};function vve(i,r,e,t=500){let n=i.getPan(),o=i.getZoom(),s=performance.now(),a=h=>h<.5?4*h*h*h:1-Math.pow(-2*h+2,3)/2;function l(h){let d=h-s,u=Math.min(d/t,1),p=a(u),g=o+(e-o)*p;i.setZoom(g);let m={x:n.x+(r.x-n.x)*p,y:n.y+(r.y-n.y)*p};i.setPan(m.x,m.y,!0),u<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}var $v={},bp=class{constructor(r,e,t,n){this.adapter=e;this.container=t;this.id=n;c(this,"fixedElements",new Set);c(this,"floatedElements",new Set);c(this,"appendedElements",new Set)}getFixedElement(r){return Array.from(this.fixedElements).find(e=>e.id===r)}getBounds(){let r=1/0,e=-1/0,t=1/0,n=-1/0,o=s=>{let a=gn(s.el),l=Ze(s.el);r=Math.min(r,a.x),e=Math.max(e,a.x+l.width),t=Math.min(t,a.y),n=Math.max(n,a.y+l.height)};return this.fixedElements.forEach(o),this.floatedElements.forEach(o),this.appendedElements.forEach(o),{x:r,y:t,width:e-r,height:n-t}}clear(){this.appendedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.floatedElements.forEach(r=>this.adapter.$removeElement(r.el)),this.fixedElements.forEach(r=>this.adapter.unfixElement(r.el)),this.appendedElements.clear(),this.floatedElements.clear(),this.fixedElements.clear()}},Rh=class extends bp{constructor(e,t,n,o,s,a){super(t,n,o,s);this.methods=e;c(this,"incremental");this.incremental=a===!0}decorate(e){this.methods.decorate(e)}reset(e){this.methods.reset(e)}};function q1(i){return function(e,t,n,o){let s=new i(e,t,n,o);return new Rh(s,e,t,n,o,s.incremental)}}var Ap={get:(i,r,e,t,n)=>{let o=$v[i];if(o)return new o(r,e,t,n);throw{message:"VisuallyJs: unknown decorator type '"+i+"'"}},register:(i,r)=>{Ix(r,bp)?$v[i]=r:$v[i]=q1(r)}};function Bv(i,r,e){if(i==null)return[];let t=[],n=o=>{let s,a,l,h,d=o;if(typeof d=="string"?(s=d,a={},h=G()):d.type!=null&&(s=d.type,a=d.options||{},h=d.id||G()),s!=null&&a!=null)l=Ap.get(s,a,r,e,h);else{let u=o;h=u.id||G(),u.reset!=null&&typeof u.reset=="function"&&u.decorate!=null&&typeof u.decorate=="function"?l=new Rh(u,{},r,e,h,u.incremental):U('Cannot register decorator. Ensure both "reset" and "decorate" methods are provided.')}return l||(U("Decorator ["+s+"] nor registered VisuallyJs. Not fatal."),null)};for(let o=0;o<i.length;o++){let s=n(i[o]);s&&t.push(s)}return t}var kf=class{constructor(r,e){this.path=r;this.ui=e}getVertexCount(){return this.path.getVertexCount()}getEdgeCount(){return this.path.getEdgeCount()}setVisible(r){this.ui.setVisible(this.path,r)}addVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.addClass(t,r)})}removeVertexClass(r){this.path.eachVertex((e,t)=>{this.ui.removeClass(t,r)})}addEdgeClass(r){this.path.eachEdge((e,t)=>{Jr(this.ui.$_connMap[t.getId()],r)})}removeEdgeClass(r){this.path.eachEdge((e,t)=>{_r(this.ui.$_connMap[t.getId()],r)})}addClass(r){this.addVertexClass(r),this.addEdgeClass(r)}removeClass(r){this.removeVertexClass(r),this.removeEdgeClass(r)}};var Fv="default",Q1="center",p0="perimeter",Sp=di(NS,Ct),g0=di(Yo,Ct);function m0(i){return E0(i,g0)}function E0(i,r){let e=Array.from(i.getContainer().querySelectorAll(r)),t=Array.from(i.getContainer().querySelectorAll(".vjs-surface")),n=[];return t.forEach(o=>{let s=Array.from(o.querySelectorAll(r));n.push(...s)}),e.filter(o=>n.indexOf(o)===-1)}function Tp(i,r,e){return i.$getModelInfoForDragElement(r,e,!0)}function vp(i,r,e,t,n){let o=null,s=i.getEffectiveVisibleZoom(),a={x:e.x-s*((n==null?void 0:n.x)||0),y:e.y-s*((n==null?void 0:n.y)||0),width:e.width,height:e.height};for(let l=0;l<r.length;l++)if(rt(a,r[l].r)){o=r[l];let h=r[l].modelInfo.typeDef,d=r[l].modelInfo.objEl,u=Zu(t,d,s);r[l].positionOnElement=u,h.anchorPositionFinder!=null?r[l].anchor=h.anchorPositionFinder(d,u,o.modelInfo.vertex,h):r[l].anchor=null;break}return o}function eG(i,r,e,t,n,o){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections!==-1&&e.obj.getEdges().length>=e.typeDef.maxConnections)return!1;if(r){let s=o?e.obj:t,a=o?t:e.obj;if(i.model.beforeConnect(s,a,n,!0)===!1)return!1}return!0}function Lh(i,r,e,t,n,o){return Uv(i,r,e,!1,t,n,o)}function Yv(i,r,e,t,n,o){return Uv(i,r,e,!0,t,n,o)}function Uv(i,r,e,t,n,o,s){let a=[],l=[];return m0(i).forEach(d=>{if(d.getAttribute(Er)!==ct){if(s!=null&&d.getAttribute(Jo)!==s)return;let u=Tp(i,d,!1);if(!n&&u.obj===e)return;if(eG(i,r,u,e,o,t)){let p=d.getBoundingClientRect();a.push({modelInfo:u,isGroup:Y(u.obj),r:p,targetEl:d,targetPortType:d.getAttribute(Wr)||d.getAttribute(Hi),magnet:d.getAttribute(gu)===Ct}),L(d,fr)}else r&&(d.setAttribute(Er,ct),l.push(d))}}),a.sort((d,u)=>{if(d.isGroup&&!u.isGroup)return 1;if(!d.isGroup&&u.isGroup)return-1;if(d.isGroup&&u.isGroup){if(ke(d.modelInfo.vertex,u.modelInfo.obj))return-1;if(ke(u.modelInfo.vertex,d.modelInfo.obj))return-1}else return 0}),{dropTargets:a,disabledDropTargets:l}}var xa=class{constructor(r){c(this,"surface");c(this,"container");c(this,"edgeSnap");c(this,"edgeSnapRequiresMagnets");c(this,"edgeSnapSizeThreshold");c(this,"edgeSnapThreshold");c(this,"edgeSnapType");c(this,"allowLoopbackEdges");c(this,"activeFiltering");c(this,"$active",!1);c(this,"rtree");c(this,"disabledDropTargets",[]);c(this,"dropTargets",[]);c(this,"currentDropTarget");this.surface=r.instance,this.container=this.surface.getContainer(),this.activeFiltering=r.activeFiltering===!0,this.allowLoopbackEdges=r.allowLoopbackEdges===!0;let e=r.edgeSnap||{enabled:!1};this.edgeSnap=e.enabled===!0,this.edgeSnapThreshold=e.threshold||50,this.edgeSnapSizeThreshold=e.sizeThreshold||30,this.edgeSnapType=e.type||Fv,this.edgeSnapRequiresMagnets=e.requireMagnets===!0,this.surface.bind(Br,t=>{this.$active&&requestAnimationFrame(()=>this.$refreshTree(!0))}),this.surface.bind(xd,t=>{this.$active&&this.rtree.has(t.id)&&requestAnimationFrame(()=>this.$refreshTree(!0,t.id))}),this.rtree=new Do}$refreshTree(r,...e){this.rtree.clear(),this.dropTargets.forEach(t=>{(!this.edgeSnapRequiresMagnets||t.magnet)&&(r&&(e.length===0||e.indexOf(t.modelInfo.obj.id)!==-1)&&(t.r=t.targetEl.getBoundingClientRect()),this.rtree.insert({x:t.r.x,y:t.r.y,width:t.r.width,height:t.r.height,children:[],id:t.modelInfo.obj.id}))})}xp(r,e,t,n){let o=this.rtree.search({x:r.x-e,y:r.y-e,width:e*2,height:e*2});return o.length>0?(o.sort((s,a)=>{let l=Pe(r,{x:s.x+s.width/2,y:s.y+s.height/2}),h=Pe(r,{x:a.x+a.width/2,y:a.y+a.height/2});return Math.sign(l-h)}),Ss(o[0],r,!0)?r:n===p0||n===Fv&&(o[0].width>t||o[0].height>t)?Vx(r,o[0]):{x:o[0].x+o[0].width/2,y:o[0].y+o[0].height/2}):r}};function Cp(i){let r=[{x:.5,y:0,ox:0,oy:-1},{x:1,y:.5,ox:1,oy:0},{x:.5,y:1,ox:0,oy:1},{x:0,y:.5,ox:-1,oy:0}].map((e,t)=>[e,Pe(e,i)]);return r.sort((e,t)=>e[1]<t[1]?-1:e[1]>t[1]?1:0),{ox:r[0][0].ox,oy:r[0][0].oy}}var mi=class{constructor(r,e){this.draggableInstance=r;this.options=e;c(this,"Mn");c(this,"O",{x:0,y:0});c(this,"_s",{x:0,y:0});c(this,"Rs",!1);c(this,"ae",null);c(this,"bp");this.bp=e.boundsStrategy||"contained",typeof IntersectionObserver!="undefined"&&(this.Mn=new IntersectionObserver(t=>{this.options.shouldHandle()&&t.forEach(n=>{this.ae=n.rootBounds,n.isIntersecting?this.en():this.Rs||this.Ap(n.boundingClientRect)})},{root:this.draggableInstance.$getDragViewportContainer(),threshold:.99}))}updateDragElementPosition(r){this.options.shouldHandle()&&(this.ae&&!this.nx(r)?this.Ap(r):this.en())}$updateRootBounds(){this.ae=this.draggableInstance.$getDragViewportContainer().getBoundingClientRect()}ix(r){return this.ae?!(r.right<this.ae.left||r.left>this.ae.right||r.bottom<this.ae.top||r.top>this.ae.bottom):!0}lx(r){return this.ae?this.ae.left<r.left&&this.ae.right>r.right&&this.ae.top<r.top&&this.ae.bottom>r.bottom:!0}nx(r){return this.bp==="contained"?this.lx(r):this.ix(r)}Ap(r){if(!this.ae)return;let e=0,t=0;if(r.x<this.ae.x?e=1:r.x+r.width>this.ae.x+this.ae.width&&(e=-1),r.y<this.ae.y?t=1:r.y+r.height>this.ae.y+this.ae.height&&(t=-1),e===0&&t===0){this.en();return}(!this.Rs||this._s.x!==e||this._s.y!==t)&&(this.en(),this._s={x:e,y:t},this.Rs=!0,this.draggableInstance.$startPanRepeat(e,t,this.options.autoPanDelta,this.options.autoPanDelta,this.options.autoPanRepeat,n=>{let o=this.draggableInstance.getEffectiveVisibleZoom();this.O.x+=n.x/o,this.O.y+=n.y/o,this.options.onPan(this.O)}))}en(){this.draggableInstance.$stopPanRepeat(),this.Rs=!1,this._s={x:0,y:0}}reset(){this.O.x=0,this.O.y=0,this.en()}observe(r){this.Mn!=null&&this.Mn.observe(r)}unobserve(r){this.Mn!=null&&(this.Mn.unobserve(r),this.en())}disconnect(){var r;(r=this.Mn)==null||r.disconnect(),this.en()}};var Bn="keyup",$n="drag",wh="click",Dh="idle",vPe="dragging",Wf="awaitingClick",Zf="locked",Pp=class extends xa{constructor(e){super(e);c(this,"pageDownAt");c(this,"canvasPositionAtDown");c(this,"currentPagePosition");c(this,"scrollAtPageDown");c(this,"currentSource");c(this,"currentPoints",[]);c(this,"mousemoveHandler");c(this,"tapHandler");c(this,"canvasTapHandler");c(this,"documentKeypressHandler");c(this,"currentMethod",$n);c(this,"currentState",Dh);c(this,"Xl");c(this,"jl");c(this,"kl");c(this,"Hl");c(this,"transientInfo");c(this,"transientEdge");c(this,"transientConnection");c(this,"transientTargetAnchor");c(this,"u");c(this,"method");c(this,"R");c(this,"O",{x:0,y:0});this.currentMethod=e.method||$n,this.Xl=e.Xl,this.jl=e.jl,this.kl=e.kl,this.Hl=e.Hl,this.tapHandler=this.hx.bind(this),this.mousemoveHandler=this.Ui.bind(this),this.canvasTapHandler=this.ux.bind(this),this.documentKeypressHandler=this.Wl.bind(this),this.surface.addDragHandler({selector:Sp,start:t=>this.px(t),drag:t=>this.mx(t),stop:t=>{this.gx(t)},usesPageCoordinates:!0,constrainFunction:(t,n,o,s,a,l)=>{if(this.edgeSnap){let h=this.surface.getEffectiveVisibleZoom(),d=h*this.O.x,u=h*this.O.y,p={x:t.x-this.scrollAtPageDown.x-d,y:t.y-this.scrollAtPageDown.y-u},g=this.xp(p,this.edgeSnapThreshold*h,this.edgeSnapSizeThreshold*h,this.edgeSnapType);return{x:g.x+this.scrollAtPageDown.x+d,y:g.y+this.scrollAtPageDown.y+u}}else return t}}),this.surface.on(this.container,W,Sp,this.tapHandler),this.surface.addDragSelectorFilter(Sp),this.currentMethod===$n&&this.surface.dragOptions.autoPan!==!1&&(this.R=new mi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O.x=t.x,this.O.y=t.y,this.Sp()},shouldHandle:()=>!0}))}Q(){this.rtree.clear(),this.dropTargets.forEach(e=>{F(e.targetEl,fr),j(e.modelInfo.obj)&&e.modelInfo.obj.edges.length===0&&e.modelInfo.missingPortCreated&&e.modelInfo.obj.getParent().$removePort(e.modelInfo.obj.id)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(e=>{e.removeAttribute(Er)}),this.disabledDropTargets.length=0,F(document.body,mt),F(document.body,Ff),F(this.surface.rootElement,Gn),this.surface.off(document,ae,this.mousemoveHandler),this.surface.off(this.surface.getContainer(),W,this.canvasTapHandler),document.removeEventListener(Bn,this.documentKeypressHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.targetEl,yr),this.currentDropTarget=null),this.transientInfo!=null&&(this.O={x:0,y:0},this.R&&this.R.reset(),this.surface.$removeTransientVertex(this.transientInfo.el)),this.transientConnection=null,this.currentPoints.length=0,this.currentSource=null,this.currentState=Dh}Tp(e,t,n,o){var h;let s=n.getAttribute(uu)||((h=e.typeDef)==null?void 0:h.edgeType),a=me(t);this.canvasPositionAtDown=this.surface.fromPageLocation(a.x,a.y),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientInfo=this.surface.$addTransientVertex(this.canvasPositionAtDown,{width:10,height:10},{},{position:Qe,left:`${this.canvasPositionAtDown.x}px`,top:`${this.canvasPositionAtDown.y}px`},Av);let l=Object.assign({},o||{});if(s!=null&&(l.type=s),this.transientEdge=this.surface.$addTransientEdge(e.obj,this.transientInfo.vertex,l,{targetAnchor:{x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}}),L(this.surface.rootElement,Gn),this.R!=null){this.R.$updateRootBounds();let d=this.transientInfo.el.el.getBoundingClientRect();this.R.updateDragElementPosition(d)}}vp(e){return this.currentPagePosition={x:e.x,y:e.y},this.Sp()}Sp(){if(this.currentPagePosition!=null){let e=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),t=this.transientInfo.el.id;this.surface.viewport.$_updatePosition(t,e.x,e.y),this.surface.$repaintUIElement(this.surface.$getManagedElement(t));let n=this.transientInfo.el.el.getBoundingClientRect();return this.surface.fire(vb,this.transientEdge),{x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:n.width,height:n.height}}}Cp(e){if(e.typeDef.maxConnections!=null&&e.typeDef.maxConnections>=0&&e.obj.getEdges().length>=e.typeDef.maxConnections)return{canStart:!1,payload:null};let t=this.surface.model.beforeStartConnect(e.obj,e.obj.type);return t===!1?{canStart:!1,payload:null}:{canStart:!0,payload:mo(t)?{}:t}}px(e){if(e.e.which===3||e.e.button===2)return!1;if(this.currentMethod===$n){this.$active=!0;let t=e.el;if(t.getAttribute(Er)!==ct){this.pageDownAt=Object.assign({},e.pagePosition),this.scrollAtPageDown={x:window.scrollX,y:window.scrollY},this.u={};let n=Tp(this.surface,t,!0);if(n!=null){let o=this.Cp(n);if(o.canStart){this.currentSource=n.obj,this.u.sourcePortType=t.getAttribute(Wr)||t.getAttribute(ji),this.u.edgeType=t.getAttribute(uu)||"";let s=t.getAttribute(Jo);this.u.scope=s,this.Tp(n,e.e,t,o.payload),L(document.body,mt);let a=n.typeDef.allowLoopback===!0||t.getAttribute(IE)===Ct||this.allowLoopbackEdges,l=Lh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);return this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.$refreshTree(),this.surface.$startMotion(),this.surface.fire(Tb,this.transientEdge),!0}}}}return!1}Zl(){this.surface.$stopPanRepeat()}Jl(e){if(this.transientEdge!=null){oe(e);let t=this.transientEdge.source,n,o;if(this.currentDropTarget!=null)n=this.currentDropTarget.modelInfo.obj,o=Zu(e,this.currentDropTarget.targetEl,this.surface.currentZoom),this.u.targetPortType=this.currentDropTarget.targetPortType,this.u.targetAnchor=this.currentDropTarget.anchor,this.u.positionOnTarget=o,this.u.targetAnchor!=null&&this.u.targetAnchor.portId!=null?j(n)?this.u.targetAnchor.portId!==n.id&&(n=n.getParent().$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):(Y(n)||J(n))&&(n=n.$addPort({id:this.u.targetAnchor.portId,type:this.currentDropTarget.modelInfo.portType||be})):this.currentDropTarget.modelInfo.missingPortCreated=!1;else if(this.surface.$isUnattachedEdgeAllowed(this.transientEdge)){let s=me(e);n=this.surface.fromPageLocation(s.x,s.y)}else this.surface.fire(Pb);this.$_exitTapMode(),n!=null&&this.surface.model.edgeFactory(this.surface.model,this.transientEdge.type,this.transientEdge.data||{},s=>{let a=this.surface.model.$_addEdge({source:t,target:n,data:s,addedByMouse:!0,context:Object.assign({positionOnTarget:o},this.u)},yo,null);this.surface.fire(Cb,a)},()=>{})}}gx(e){this.Zl(),this.surface.$stopMotion(),this.Jl(e.e),this.$active=!1}Pp(e,t){this.Ex();let n=e();if(this.currentMethod===wh&&this.currentState==Wf){let s=me(t);this.vp(s)}let o=vp(this.surface,this.dropTargets,n,t,this.O);if(o!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,yr),o!=null){if(L(o.targetEl,yr),o.anchor!=null)this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0},o.anchor),this.transientConnection.anchors.target.isFixed=!0;else if(o.positionOnElement!=null){let s=Cp(o.positionOnElement);this.transientConnection.anchors.target.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},s),this.transientConnection.anchors.target.isFixed=!0}}else delete this.transientConnection.anchors.target.fixedLocation,this.transientConnection.anchors.target.isFixed=!1;this.currentDropTarget=o}Ui(e){let t=me(e);this.Pp(()=>({x:t.x,y:t.y,width:5,height:5}),e)}mx(e){this.Pp(()=>{let t=Object.assign({},e.pagePosition),n;if(this.transientInfo!=null)n=this.vp(t),this.R!=null&&this.transientInfo!=null&&this.R.updateDragElementPosition({left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height,width:n.width,height:n.height,x:n.x,y:n.y});else{let o=this.surface.mapEventLocation(e.e);n={x:o.x,y:o.y,width:5,height:5}}return n},e.e)}Ex(){this.transientEdge!=null&&(this.transientConnection=this.transientConnection||this.surface.getRenderedConnection(this.transientEdge.id),this.transientTargetAnchor=this.transientTargetAnchor||this.transientConnection.anchors.target)}hx(e){if(this.currentMethod===wh&&this.currentState!==Zf){let t=e.target||e.srcElement;if(t.getAttribute(Er)!==ct){let n=Tp(this.surface,t,!0);if(n!=null){if(this.currentState===Dh){oe(e),this.$active=!0,this.pageDownAt=me(e),this.u={};let o=this.Cp(n);if(o.canStart){this.u.sourcePortType=t.getAttribute(Wr)||t.getAttribute(ji),this.u.edgeType=t.getAttribute(uu);let s=t.getAttribute(Jo);this.u.scope=s,this.currentSource=n.obj,L(document.body,Ff),this.Tp(n,e,t,o.payload);let a=n.typeDef.allowLoopback===!0||t.getAttribute(IE)===Ct||this.allowLoopbackEdges,l=Lh(this.surface,this.activeFiltering,n.obj,a,o.payload,s);this.dropTargets=l.dropTargets,this.disabledDropTargets=l.disabledDropTargets,this.currentState=Wf,this.surface.on(this.surface.$getCanvasElement(),W,this.canvasTapHandler),this.surface.on(document,ae,this.mousemoveHandler),document.addEventListener(Bn,this.documentKeypressHandler),this.surface.$disableVertexDrag(),this.surface.$startMotion()}}else if(this.currentState===Wf){for(let o=0;o<this.dropTargets.length;o++)if(this.dropTargets[o].modelInfo.obj===n.obj){this.currentDropTarget=this.dropTargets[o];break}this.currentDropTarget!=null&&this.Jl(e),this.$active=!1}}}}}$_exitTapMode(){this.surface.$enableVertexDrag(),this.surface.$stopMotion(),this.Q()}ux(e){if(!e.defaultPrevented&&this.currentMethod===wh)if(e.which===3||e.button===2)this.$_exitTapMode();else{let t=me(e);for(let n=0;n<this.dropTargets.length;n++)Ss(this.dropTargets[n].r,t,!0)&&(this.currentDropTarget=this.dropTargets[n],this.Jl(e),this.$_exitTapMode())}}Wl(e){this.currentState===Wf&&(e.keyCode===27||e.key==="Escape")&&this.$_exitTapMode()}};var zv="primed",Xv="idle",jv="active",_p=class extends xa{constructor(e){super(e);c(this,"Kl");c(this,"Ls");c(this,"Yt");c(this,"transientVertex");c(this,"currentEdge");c(this,"currentConnection");c(this,"currentIndex");c(this,"R");c(this,"O",{x:0,y:0});c(this,"mouseMoveHandler");c(this,"mouseUpHandler");c(this,"documentKeypressHandler");c(this,"currentPosition");c(this,"currentPagePosition");c(this,"ws",!1);c(this,"rn");c(this,"Gn");this.Kl=e.inputHandler,this.Ls=e.method||$n,this.Yt=Xv,this.documentKeypressHandler=this.Wl.bind(this),this.mouseMoveHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex){if(this.Yt===zv){this.rn=St({x:.5,y:.5,ox:0,oy:0,offsetX:0,offsetY:0}),this.surface.$_proxyEdge(this.currentEdge,this.currentIndex,this.transientVertex.el,this.rn),this.Gn=this.currentEdge[this.currentIndex];let a=this.currentConnection.connector.canvas;L(this.surface.rootElement,Gn),Ut(a,[Nf],[ep]),this.ws=!0,this.Yt=jv,this.Kl.currentState=Zf}if(oe(n),this.currentPagePosition=me(n),this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y),this.edgeSnap){let a=this.surface.getEffectiveVisibleZoom(),l=a*this.O.x,h=a*this.O.y,d={x:this.currentPagePosition.x-l,y:this.currentPagePosition.y-h},u=this.xp(d,this.edgeSnapThreshold*a,this.edgeSnapSizeThreshold*a,this.edgeSnapType);this.currentPagePosition={x:u.x+l,y:u.y+h},this.currentPosition=this.surface.fromPageLocation(this.currentPagePosition.x,this.currentPagePosition.y,!0)}this.Op();let o={x:this.currentPagePosition.x-window.scrollX,y:this.currentPagePosition.y-window.scrollY,width:5,height:5},s=vp(this.surface,this.dropTargets,o,n,this.O);if(s!==this.currentDropTarget&&this.currentDropTarget!=null&&F(this.currentDropTarget.targetEl,yr),s!=null){if(L(s.targetEl,yr),s.anchor!=null)this.rn.fixedLocation=Object.assign({offsetX:0,offsetY:0},s.anchor),this.rn.isFixed=!0;else if(s.positionOnElement!=null){let a=Cp(s.positionOnElement);this.rn.fixedLocation=Object.assign({offsetX:0,offsetY:0,x:.5,y:.5},a),this.rn.isFixed=!0}}this.currentDropTarget=s,this.R!=null&&this.R.updateDragElementPosition(this.transientVertex.el.el.getBoundingClientRect())}},this.mouseUpHandler=n=>{if(this.currentEdge&&this.currentConnection&&this.transientVertex)if(oe(n),this.ws)if(this.currentPosition=this.surface.fromPageLocation(n.pageX,n.pageY,!0),this.currentDropTarget!=null){let o=this.currentEdge,s=this.currentDropTarget.modelInfo.obj,a=this.currentIndex;this.surface.model.beforeMoveConnection(a===it?s:o.source,a===it?o.target:s,o)===!1?this.ql():(this.Q(this.currentDropTarget.anchor),a===it?this.surface.model.setSource(o,s):this.surface.model.setTarget(o,s))}else this.Gn.dummy===!0?(this.surface.model.updateVertex(this.Gn,{[this.surface.$modelLeftAttribute]:this.currentPosition.x,[this.surface.$modelTopAttribute]:this.currentPosition.y}),this.Q()):this.ql();else(this.Ls===$n||this.Yt===jv)&&this.Q();else this.Q();this.$active=!1};let t=n=>o=>{if(!o.defaultPrevented){let s=Bt(o.target,Ae(et),this.container,!1);if(s!=null){if(this.currentEdge=this.surface.model.getEdge(s.getAttribute(et)),this.currentEdge.transient)this.$active=!1,this.currentEdge=null,this.Yt=Xv;else if(this.Gn=this.currentEdge[n],this.currentConnection=this.surface.getRenderedConnection(this.currentEdge.id),this.currentConnection.detachable||this.Gn.dummy===!0){if(this.$active=!0,this.ws=!1,this.currentIndex=n,oe(o),this.O={x:0,y:0},this.currentPagePosition=me(o),this.currentPosition=this.surface.fromPageLocation(o.pageX,o.pageY,!0),this.surface.on(document,ae,this.mouseMoveHandler),this.surface.on(document,le,this.mouseUpHandler),this.Yt=zv,this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex=this.surface.$addTransientVertex(this.currentPosition,{width:1,height:1},{},{},Ev),this.fx(),L(this.currentConnection.connector.canvas,ep),this.Ls===wh)document.addEventListener(Bn,this.documentKeypressHandler);else if(this.R!=null){this.R.$updateRootBounds();let a=this.transientVertex.el.el.getBoundingClientRect();this.R.updateDragElementPosition(a)}this.surface.$startMotion(),this.surface.fireUnchecked("edge:relocate:start",this.currentEdge)}}}};this.surface.on(this.container,ge,z(Qi),t(it)),this.surface.on(this.container,ge,z(eo),t(vn)),this.Ls===$n&&this.surface.dragOptions.autoPan!==!1&&(this.R=new mi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:n=>{this.O.x=n.x,this.O.y=n.y,this.Op()},shouldHandle:()=>!0}))}Op(){let e={x:this.currentPosition.x,y:this.currentPosition.y},t={[this.transientVertex.vertex.id]:e};this.surface.$_updateVertexPositions({positions:t,sizes:null,offset:{x:0,y:0},repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1}),this.surface.fire(_d,this.currentEdge)}ql(e){if(e===!0||this.surface.model.beforeDetach(this.currentEdge.source,this.currentEdge.target,this.currentEdge)===!1||this.currentConnection.reattach)this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex),this.surface.$repaintUIElementById(this.currentEdge.source.id),this.Q();else{let n=this.currentEdge.id;this.Q(),this.surface.$isUnattachedEdgeAllowed(this.currentEdge)?this.surface.model.$setEdgeDetached(this.currentEdge,{x:this.currentPosition.x+this.O.x,y:this.currentPosition.y+this.O.y},this.currentIndex):this.surface.model.removeEdge(n)}}Q(e){if(this.rtree.clear(),this.rn=null,this.dropTargets.forEach(t=>{F(t.targetEl,fr)}),this.dropTargets.length=0,this.disabledDropTargets.forEach(t=>{t.removeAttribute(Er)}),this.disabledDropTargets.length=0,F(document.body,mt),F(this.surface.rootElement,Gn),Ut(this.currentConnection.connector.canvas,[],[Nf,ep]),document.removeEventListener(Bn,this.documentKeypressHandler),this.surface.off(document,ae,this.mouseMoveHandler),this.surface.off(document,le,this.mouseUpHandler),this.currentDropTarget!=null&&(F(this.currentDropTarget.modelInfo.objEl,yr),this.currentDropTarget=null),this.O={x:0,y:0},this.R&&this.R.reset(),this.transientVertex!=null&&this.surface.$removeTransientVertex(this.transientVertex.el),this.surface.$stopMotion(),this.currentEdge!=null){let t=this.surface.$_unproxyEdge(this.currentEdge,this.currentIndex,e);t&&this.surface.$repaintUIElement(t),this.surface.fireUnchecked("edge:relocate:end",this.currentEdge)}this.ws=!1,this.Yt=Xv,this.Kl.currentState=Dh,this.Gn=null}fx(){if(this.currentIndex===it){let e=Yv(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}else{let e=Lh(this.surface,this.activeFiltering,this.currentEdge.source,!0);this.dropTargets=e.dropTargets,this.disabledDropTargets=e.disabledDropTargets}this.$refreshTree()}Wl(e){(this.Yt===jv||this.Yt===zv)&&(e.keyCode===27||e.key==="Escape")&&this.ql(!0)}};var br="pan",Ei="select",ns="disabled",Fn="vertexDrawing";var ba="vjs-anchor-placeholder",tG="vjs-anchor-candidate",Jf="vjs-connection-edit",Op="vjs-edge-guideline",Un="vjs-edge-handle";var Kf=z(ba),Hv=12,kv=15;function qf(i,r,e,t){let n=M(Q,e||{});L(n,r),t||(n.style.display=pt);let o=M(Be,Object.assign({cx:`${i/2}`,cy:`${i/2}`,r:`${i/2}`},e||{}));return n.appendChild(o),n}function f0(i,r,e,t,n,o,s){let a=M(Q);L(a,n),s||(a.style.display=pt);let l=M(Z,Object.assign({width:i,height:r,x:"0",y:"0",rx:e,ry:t},o||{}));return a.appendChild(l),a}function Wv(i,r,e,t,n,o,s){let a=qf(t,n,o,s);return i.$appendElementToToolsLayer(a),Ie(a,{x:r,y:e}),a}function Zv(i,r,e,t,n,o,s,a,l,h){let d=f0(t,n,o,s,a,l,h);return i.$appendElementToToolsLayer(d),Ie(d,{x:r,y:e}),d}function Jv(i,r,e){let t=i.faces,n=[{face:We,dist:Math.abs(r.x-e.x),midx:e.x,midy:e.y+e.height/2,x:0,y:.5,ox:-1,oy:0},{face:yt,dist:Math.abs(e.x+e.width-r.x),midx:e.x+e.width,midy:e.y+e.height/2,x:1,y:.5,ox:1,oy:0},{face:Te,dist:Math.abs(r.y-e.y),midx:e.x+e.width/2,midy:e.y,x:.5,y:0,ox:0,oy:-1},{face:ht,dist:Math.abs(e.y+e.height-r.y),midx:e.x+e.width/2,midy:e.y+e.height,x:.5,y:1,ox:0,oy:1}],o=new Map;o.set(Te,[0,-1]),o.set(ht,[0,1]),o.set(We,[-1,0]),o.set(yt,[1,0]),n.sort(function(l,h){return l.dist<h.dist?-1:1});let s=null,a=null;for(let l=0;l<n.length;l++)if(t.indexOf(n[l].face)!=-1){s=n[l].face,r={x:n[l].midx,y:n[l].midy},a={x:n[l].x,y:n[l].y,offsetX:0,offsetY:0,ox:n[l].ox,oy:n[l].oy};break}return[a,s]}function Kv(i,r,e){let t=Oc(r,e,i.locations);return y0(t.p,e)}function qv(i,r,e,t,n,o,s,a){let l=a.getVertexDefinition(n),h=r(e,t,n,l);if(h!=null){let d={x:h.x,y:h.y,ox:h.ox,oy:h.oy,offx:h.offsetX||0,offy:h.offsetY||0,cls:""};return y0(d,o)}}function y0(i,r){let e=i.offsetX==null?0:i.offsetX,t=i.offsetY==null?0:i.offsetY;return Object.assign({curX:r.x+i.x*r.width+e,curY:r.y+i.y*r.height+t,offsetX:e,offsetY:t},i)}var no=class{constructor(r,e){this.ui=r;c(this,"current");c(this,"currentConnector");c(this,"currentEdge");c(this,"_p");c(this,"yx");c(this,"$generatedGeometry");c(this,"$hasEdits",!1);c(this,"Rp",[]);c(this,"currentOverlays",[]);c(this,"sourceDimensions");c(this,"targetDimensions");c(this,"Er");c(this,"fr");c(this,"Ql");c(this,"yr");c(this,"Ds");c(this,"buttonSize");c(this,"Lp");c(this,"sourceAnchorPositionFinder");c(this,"targetAnchorPositionFinder");c(this,"eventManager");c(this,"eh");c(this,"xr");c(this,"xx",{});c(this,"Ar",{rotation:0,center:{x:0,y:0}});e=e||{},this.buttonSize=e.buttonSize||Hv,this.Lp=e.anchorPlaceholderSize||kv,this.yr=!1,this.ui.model.bind(Cn,()=>{this.deactivate()}),this.ui.bind(ti,l=>{l.edge==this.currentEdge&&this.Xt()}),this.eventManager=new ye,this.$addDragHandler({selector:Kf+" *",target:Kf,constrainFunction:(l,h,d,u,p,g)=>{let m=h.Ns.anchor,E={x:l.x,y:l.y},y=!1,x=this.xr.managedElement,f={x:x.x,y:x.y,width:x.width,height:x.height};this.Ar.rotation!==0&&(y=!0,E=Me(l,this.Ar.center,-this.Ar.rotation));let b={x:(E.x-f.x)/f.width,y:(E.y-f.y)/f.height},A;if(this.eh!=null)A=qv(m,this.eh,x.el,b,this.xr.obj,f,this.current,this.ui),this.$hasEdits=!0;else if(m.isContinuous){let[T,S]=Jv(m,E,f);A=T,S!=null&&(m.currentFace=S),this.$hasEdits=!0}else A=Kv(m,l,f),this.$hasEdits=!0;return m.fixedLocation=A,m.isFixed=!0,l={x:A.x*f.width,y:A.y*f.height},this.ui.$repaintUIElement(x,null,null,!0),y&&(l=Me(l,this.Ar.center,this.Ar.rotation)),l},start:l=>{let d=l.el.Ns.vertex;if(this.xr=this.ui.getObjectInfo(d,!1),this.Rp.length=0,this.xr.obj!=null)this.Ql=this.$cloneCurrentGeometry(),this.eh=this.currentEdge.source.id===this.xr.id?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder,this.Ar.rotation=this.ui.$getRotation(d.id),this.Ar.rotation!==0&&(this.Ar.center={x:this.xr.managedElement.t.c.x,y:this.xr.managedElement.t.c.y});else return!1},stop:l=>{this.Rp.forEach(d=>d.parentNode.removeChild(d));let h=this.$cloneCurrentGeometry();this.$updateModel(h,this.Ql),this.Ql=null,this.xr=null},drag:l=>{this.Xt()}});let t=(l,h)=>{this.bx(l)?h(l):Y(l)&&(ke(this.currentEdge.source,l)?h(this.currentEdge.source):ke(this.currentEdge.target,l)&&h(this.currentEdge.target))},n=l=>{this.yr&&this.currentEdge&&(l.dragGroup.forEach(h=>{t(h.vertex,d=>{this.Ax(d)})}),this.Xt())},o=l=>{this.yr&&this.currentEdge&&l.dragGroup.forEach(h=>{t(h.vertex,d=>this.Sx(d))})};this.ui.bind(Vt,l=>{o(l)}),this.ui.bind(Mt,l=>{n(l)}),this.ui.bind($r,l=>{o(l)}),this.ui.bind(To,l=>{n(l)});let s=l=>{this.yr&&this.currentEdge&&t(l.vertex,h=>this.Xt())};this.ui.model.bind(Re,s),this.ui.model.bind(ve,s);let a=l=>{this.yr&&this.currentEdge&&l.id===this.currentEdge.id&&this.Xt()};this.ui.bind(_d,l=>{a(l)}),this.ui.model.bind(an,l=>{a(l.edge)}),this.ui.model.bind(sn,l=>{a(l.edge)})}isBusy(){return this.Ds}$cloneCurrentGeometry(){return lt(this.currentConnector.geometry)}wp(r){return this.ui.view.getTypeDefinition(r).anchorPositions}Dp(r,e){let t={type:e.type,options:Object.assign(e.options,{id:G()})};this.currentOverlays.push(this.ui.$addOverlay(r,t)),this.$repaintConnection()}Tx(r,e){this.Np(),e.forEach(t=>{this.Dp(r,t)})}Np(){this.currentOverlays.forEach(r=>{ko(this.current,r.id)})}vx(r){let e=r.deleteButtonClass||ia,t=r.deleteButtonLocation||.1,n=()=>this.ui.model.removeEdge(this.currentEdge),o=()=>{r.onMaybeDelete?r.onMaybeDelete(this.currentEdge,this.current,n):n()};(Array.isArray(t)?t:[t]).forEach(a=>{this.Dp(this.current,{type:mr.type,options:{label:"\u2716",location:a,cssClass:e,events:{click:o}}})})}$repaintConnection(r){if(this.current){let e=Object.assign(r||{},{fireEvent:!0});this.ui.$paintConnection(this.current,e),this.Xt(r)}}$updateModel(r,e){this.ui.model.setEdgeGeometry(this.currentEdge,r,e,this.ui)}Xt(r){this.current&&(this.th(),this.$repaint(r))}th(){if(this.current){let r=(e,t)=>{let n=e===0?this.current.anchors.source:this.current.anchors.target,o=this.ui.getElement(e===0?this.current.sourceId:this.current.targetId);if((e===0?this.sourceAnchorPositionFinder:this.targetAnchorPositionFinder)!=null||n.isDynamic||n.isContinuous){let a=Object.assign({},n.computedPosition),[l,h]=[a.curX-o.x,a.curY-o.y],d;t!=null?d=t:(d=qf(this.Lp,ba,{[et]:this.currentEdge.id},!0),d.Ns={anchor:n,idx:e,edge:this.currentEdge,vertex:e===0?this.currentEdge.source:this.currentEdge.target}),this.ui.$appendElementToToolsLayer(d);let u=this.ui.$getSize(d),p={x:o.x+(l-u.width/2),y:o.y+(h-u.height/2)};return Ie(d,p),[[o.x,o.y],d]}else return[[0,0],null]};this.ui.$removeElement(this.Er),this.currentEdge.source.dummy||([this.sourceDimensions,this.Er]=r(0,this.Er)),this.ui.$removeElement(this.fr),this.currentEdge.target.dummy||([this.targetDimensions,this.fr]=r(1,this.fr))}}Cx(){this.current&&(this.Er&&(this.Er.parentNode.removeChild(this.Er),delete this.Er.Ns),this.fr&&(this.fr.parentNode.removeChild(this.fr),delete this.fr.Ns)),this.Er=null,this.fr=null,this.sourceDimensions=null,this.targetDimensions=null}Px(){this.current&&Yi(this.current)}reset(){this.$hasEdits=!1,this.$generatedGeometry=null,this.deactivate(),this.Px(),this.$clearHandles(),this.ui.$repaintUIElementById(this.current.sourceId),this.ui.$repaintUIElementById(this.current.targetId)}isActive(){return this.yr}$setElementPosition(r,e,t){let n=this.ui.$getSize(r),o=e-n.width/2,s=t-n.height/2;Ie(r,{x:o,y:s})}activate(r,e,t){if(!(this.current!=null&&this.current===e)){if(this.deactivate(),this.current=e,this.currentConnector=this.current.connector,this.currentEdge=r,this._p=this.ui.model.getEdgeType(r.data),this.yx=this.ui.view.getEdgeDefinition(this._p),r.geometry==null&&(this.$generatedGeometry=this.ui.$exportEdgeGeometry(r)),t=t||{},this.sourceAnchorPositionFinder=t.anchorPositionFinder,this.targetAnchorPositionFinder=t.anchorPositionFinder,t.anchorPositions!=null)this.sourceAnchorPositionFinder=oa(t.anchorPositions),this.targetAnchorPositionFinder=oa(t.anchorPositions);else{let n=this.wp(this.currentEdge.source);n!=null&&(this.sourceAnchorPositionFinder=oa(n));let o=this.wp(this.currentEdge.target);o!=null&&(this.targetAnchorPositionFinder=oa(o))}this.$activate(e,t),t.overlays&&this.Tx(e,t.overlays),t.deleteButton===!0&&this.vx(t),this.th(),Jr(this.current,Jf),this.yr=!0}}deactivate(r){this.current!=null&&(this.Np(),_r(this.current,Jf),this.Cx()),this.$clearHandles(),this.$hasEdits=!1,this.$generatedGeometry=null,this.yr=!1,this.current=null,this.currentEdge=null,this.sourceAnchorPositionFinder=null,this.targetAnchorPositionFinder=null,this.Ds=!1}$makeAndAppendCircularHandle(r,e,t,n,o,s){let a=Wv(this.ui,r,e,t,o,{[et]:this.currentEdge.id},s);return this.$setElementPosition(a,r,e),a}$makeAndAppendRectangularHandle(r,e,t,n,o,s,a,l){let h=Zv(this.ui,r,e,t,n,o,s,a,{[et]:this.currentEdge.id},l);return this.$setElementPosition(h,r,e),h}$makeAndAppendDeleteHandle(r,e,t,n,o,s){let a=this.$makeAndAppendCircularHandle(r,e,t,n,o,s),l=M(tt,{x:`${t/2}`,y:`${n/2}`,[et]:this.currentEdge.id});return l.innerHTML="\u2716",a.appendChild(l),a}$addDragHandler(r){this.ui.addDragHandler({selector:r.selector,target:r.target,start:e=>{let t=r.start(e);return t!==!1&&(this.Ds=!0),t},drag:e=>r.drag(e),stop:e=>{this.Ds=!1,r.stop(e)},constrainFunction:r.constrainFunction,usesPageCoordinates:r.usesPageCoordinates}),this.xx[r.selector]=r}Ax(r){this.th(),this.$elementDragging(r)}Sx(r){this.$elementDragged(r)}bx(r){return this.currentEdge==null?!1:r.id===ul(this.currentEdge.source)||r.id===ul(this.currentEdge.target)}};var Lr=new Map;function rG(i,r,e){let t=Lr.get(i);return new t(r,e)}function nG(i){return i.type===Hr&&i.constrain===on?zi:i.type}var Aa=class{constructor(r,e){this.ui=r;this.Is=e;c(this,"nh",new Map);c(this,"Ip");c(this,"Xe",!1);c(this,"$n");c(this,"at");r.bind(Ii,()=>(this.destroy(),!0)),this.Is=this.Is||{},this.Ip=this.Is.hoverMode===!0,this.ui.model.bind(bt,t=>{this.$n&&this.$n.id===t.edge.id&&this.stopEditing()}),this.Ip&&(this.ui.bindUnchecked("edge:relocate:start",t=>{this.$n&&this.$n.id===t.id&&(this.Xe=!0,this.stopEditing())}),this.ui.bindUnchecked("edge:relocate:end",t=>{this.Xe=!1}),ci()&&(this.ui.bind(Pd,t=>{t.obj.transient||(!this.at||!this.at.isBusy()&&this.at.$supportsHoverMode)&&this.startEditing(t.obj)}),this.ui.bind(Cd,t=>{}))),this.ui.$_attachEdgePathEditor(this)}startEditing(r,e){if(!this.Xe){let t=this.Vp(r);if(t!=null){let n=t.edge;e=Object.assign({},e||{});let o=nG(t.connector);if(Lr.has(o)){if(this.at=this.nh.get(o),this.at==null){let s=Object.assign({},this.Is||{});this.at=rG(o,this.ui,s),this.nh.set(o,this.at)}this.$n=n,this.at.activate(n,t,e)}else throw new Error("No editor available for connector type ["+o+"]")}}}stopEditing(){this.at&&this.at.deactivate(),this.$n=null,this.at=null}clearEdits(r){let e=this.Vp(r);return e!=null?(Yi(e),!0):!1}Vp(r){return r==null?null:typeof r=="string"?this.ui.getRenderedConnection(r):sa(r)?r:this.ui.getRenderedConnection(r.getId())}destroy(){this.stopEditing(),this.nh.clear()}};function Qv(){}function Rp(i,r){let e=document.createElement("div");return L(e,r.join(" ")),i.appendChild(e),e}var Sa=class{constructor(r){c(this,"visibleOrigin",{x:0,y:0});c(this,"size",{width:0,height:0});c(this,"Vs");c(this,"el");c(this,"lt");c(this,"masks",{});c(this,"origin",{x:0,y:0});c(this,"canvasOrigin",{x:0,y:0});c(this,"canvasExtent",{x:0,y:0});c(this,"O",{x:0,y:0});c(this,"jt");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"onClick");c(this,"hasMoved",!1);c(this,"down",!1);c(this,"moving",!1);c(this,"invert");c(this,"surface");c(this,"mt");c(this,"eventManager");c(this,"ih");c(this,"downListener");c(this,"upListener");c(this,"moveListener");c(this,"downEvent",ge);c(this,"upEvent",le);c(this,"moveEvent",ae);c(this,"enabled",!1);c(this,"oh");c(this,"Mp");c(this,"bt");c(this,"sh");c(this,"ah");c(this,"Sr");c(this,"sS",!1);c(this,"Rx",[".vjs-connector-path",".vjs-connector-outline"]);this.surface=r.surface,this.onStart=r.onStart||Qv,this.onEnd=r.onEnd||Qv,this.onSelect=r.onSelect||Qv,this.onClick=r.onClick||null,this.Vs=r.generateLassoContent,this.ih=r.mapToGrid,this.invert=r.invert===!0,this.downListener=this.nn.bind(this),this.upListener=this.Tr.bind(this),this.moveListener=this.sn.bind(this),this.eventManager=new ye,this.sh=r.autoArm===!0,this.ah=r.armTimeout==null?500:r.armTimeout,this.oh=r.enableInGroups===null?!0:r.enableInGroups,this.Ox(r.filter),this.invert?this._x():this.el=Rp(this.surface.getContainer(),[iv,r.cssClass||""]),this.lt=M(Z,{width:1,height:1,x:0,y:0,fill:"transparent"}),this.eventManager.on(this.surface.$getCanvasElement().parentNode,this.downEvent,this.downListener),this.surface.bind(_n,e=>{this.down&&this.onClick&&this.onClick(this.visibleOrigin,e)}),this.surface.addVertexDragFilter(e=>this.enabled&&this.oh!==!1?e.vertex.objectType===ce.objectType?!0:!(this.oh==="metaKey"?e.e.metaKey:!0):!0),r.autoPan!==!1&&(this.jt=new mi(this.surface,{autoPanDelta:this.surface.dragOptions.autoPanDelta||5,autoPanRepeat:this.surface.dragOptions.autoPanRepeat||15,boundsStrategy:this.surface.dragOptions.autoPanBoundsStrategy,onPan:e=>{this.O.x=e.x,this.O.y=e.y,this.Gp()},shouldHandle:()=>!0}))}Lx(r){let e=r.srcElement||r.target;return this.Rx.find(t=>$t(e,t))!=null}Ox(r){r==null?this.mt=function(){return!1}:X(r)?this.mt=e=>{let t=e.srcElement||e.target;return $t(t,r)}:this.mt=r}$p(r,e,t){this.visibleOrigin=r,this.size=e;let n=this.surface.fromPageLocation(r.x,r.y);if(this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+e.width,this.origin.y+e.height),this.invert){let o=window.innerWidth,s=window.innerHeight,a=window.pageXOffset,l=window.pageYOffset,h=s-r.y+l,d=s-h+e.height,u=o-r.x+a,p=o-u+e.width;this.masks.top.style.bottom=h+"px",this.masks.bottom.style.top=d+"px",this.masks.left.style.right=u+"px",this.masks.right.style.left=p+"px",this.masks.top.style.left=o-u+"px",this.masks.top.style.right=o-p+"px",this.masks.bottom.style.left=o-u+"px",this.masks.bottom.style.right=o-p+"px"}else{let o=this.surface.getEffectiveVisibleZoom();er(this.el,{x:n.x,y:n.y}),Rr(this.el,e.width/o,e.height/o)}if(this.lt.setAttribute("x",`${t.x}`),this.lt.setAttribute("y",`${t.y}`),this.jt!=null&&this.lt.parentElement!=null){let o=this.lt.getBoundingClientRect();this.jt.updateDragElementPosition(o)}}zt(r){let e=r?Pr:pt;this.invert?(this.masks.top.style.display=e,this.masks.left.style.display=e,this.masks.right.style.display=e,this.masks.bottom.style.display=e):this.el.style.display=e,r?this.surface.addClass(document.body,mt):this.surface.removeClass(document.body,mt)}Bp(r){return this.ih==null?r:this.ih(r)}nn(r){if((this.enabled||this.sh)&&!this.Lx(r)&&!this.mt(r)){let e=()=>{this.down=!0,this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener),this.O.x=0,this.O.y=0,this.hasMoved=!1;let t={width:1,height:1};this.origin=this.Bp(me(r)),this.canvasOrigin=this.surface.fromPageLocation(this.origin.x,this.origin.y),this.canvasExtent=this.surface.fromPageLocation(this.origin.x+t.width,this.origin.y+t.height);let n=this.surface.getElementFromEvent(r);if(!this.invert&&this.Vs){let o=this.Vs(this.origin,r);o!=null?(this.Mp=o,this.el.replaceChildren(o)):this.el.innerHTML=""}this.$p(this.origin,t,this.canvasOrigin),this.onStart(this.origin,this.canvasOrigin,r.shiftKey,r,n),this.jt!=null&&(this.jt.reset(),this.surface.$appendElementToToolsLayer(this.lt),this.jt.observe(this.lt))};this.enabled?e():this.sh&&(this.ah===0?(this.surface.setMode("select"),e()):(this.Sr=setTimeout(()=>{this.surface.setMode("select"),e(),this.Sr=null},this.ah),this.eventManager.on(document,this.upEvent,this.upListener),this.eventManager.on(document,this.moveEvent,this.moveListener))),oe(r)}}Gp(r){if(this.bt!=null){let e=this.surface.fromPageLocation(this.bt.x,this.bt.y),t={x:this.canvasOrigin.x+this.O.x,y:this.canvasOrigin.y+this.O.y},n=this.surface.toPageLocation(t.x,t.y),o={width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)},s={width:Math.abs(this.bt.x-n.x),height:Math.abs(this.bt.y-n.y)},a={x:Math.min(n.x,this.bt.x),y:Math.min(n.y,this.bt.y)},l={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)};o.width>0&&o.height>0&&(this.hasMoved=!0,this.$p(a,s,e),this.onSelect(a,s,l,o,[n.x<this.bt.x,n.y<this.bt.y],r,this.Mp))}}sn(r){if(this.Sr!=null){clearTimeout(this.Sr),this.Sr=null,this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener);return}this.down&&(this.moving||(this.zt(!0),this.moving=!0),oe(r),this.bt=this.Bp(me(r)),this.Gp(r.shiftKey))}Tr(r){if(this.Sr!=null){clearTimeout(this.Sr),this.Sr=null,this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener);return}if(this.down){this.lt.parentElement&&this.lt.parentElement.removeChild(this.lt),this.jt!=null&&(this.jt.unobserve(this.lt),this.jt.reset());let e=this.moving;this.down=!1,this.moving=!1,oe(r),this.eventManager.off(document,this.upEvent,this.upListener),this.eventManager.off(document,this.moveEvent,this.moveListener),this.zt(!1),e&&this.hasMoved&&this.onEnd(this.visibleOrigin,this.size),this.Vs&&(this.el.innerHTML="")}}_x(){this.masks.top=Rp(document.body,[uh,sv]),this.masks.bottom=Rp(document.body,[uh,lv]),this.masks.left=Rp(document.body,[uh,ov]),this.masks.right=Rp(document.body,[uh,av])}isActive(){return this.down}setEnabled(r){this.enabled=r}};var Se=class{constructor(){c(this,"tracksEdgeRedraws",!1)}$groupMemberAdded(r){}$groupMemberRemoved(r){}$nodeRemoved(r){}$groupRemoved(r){}$groupResized(r){}$groupCollapsed(r){}$groupExpanded(r){}$vertexRotated(r,e){}$vertexResized(r,e,t){}$vertexRerendered(r){}$vertexUpdated(r,e){}$vertexSynced(r){}$edgeRemoved(r){}$edgeUpdated(r){}$edgeRendered(r){}};var eC="logarithmic",tC="absolute";var x0={},io={get:i=>{let r=x0[i];if(r)return r;throw{message:`VisuallyJs: unknown background [${i}]`}},register:(i,r)=>{x0[i]=r}};var Qf=class Qf{constructor(r){c(this,"type",Qf.type);c(this,"canvas");c(this,"onBackgroundReady");c(this,"imagePlaceholder");c(this,"ui");c(this,"image");c(this,"url");this.ui=r.ui,this.canvas=r.canvas,this.onBackgroundReady=r.options.onBackgroundReady||((e,t)=>{}),this.image=r.options.img,this.url=r.options.url,this.imagePlaceholder=new Image,this.imagePlaceholder.onload=()=>{this.canvas.style.backgroundImage="url('"+this.imagePlaceholder.src+"')",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.width=this.imagePlaceholder.width+"px",this.canvas.style.height=this.imagePlaceholder.height+"px",this.onBackgroundReady(this,r.ui)},this.Bn(r.options)}Bn(r){this.imagePlaceholder.src=this.image?this.image.src:this.url}setUrl(r){this.imagePlaceholder&&(this.imagePlaceholder.src=r)}owns(r){return r===this.canvas}getWidth(){return this.imagePlaceholder&&this.imagePlaceholder.width||0}getHeight(){return this.imagePlaceholder&&this.imagePlaceholder.height||0}setZoom(r,e){}pan(){}destroy(){this.imagePlaceholder=null}zt(r){}};c(Qf,"type","simple");var Lp=Qf;io.register(Lp.type,Lp);var b0="vjs-background-tile",rC=class{constructor(r,e,t){c(this,"scaledImageSize");c(this,"scaledImageSizeH");c(this,"container");c(this,"zoom");c(this,"specs");c(this,"url");c(this,"urlGenerator");c(this,"apparentZoom");c(this,"xTiles");c(this,"yTiles");c(this,"kt",[]);let n=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.width,o=Math.pow(2,e.options.maxZoom-t)*e.options.tileSize.height;this.scaledImageSize=n,this.scaledImageSizeH=o,this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.height="100%",this.container.style.width="100%",this.container.style.display="none",e.canvas.insertBefore(this.container,e.canvas.firstElementChild),this.zoom=t,this.specs=r.getTileSpecs(t),this.url=e.options.url,this.urlGenerator=r.urlGenerator,this.apparentZoom=Math.min(this.specs.xSize,this.specs.ySize),this.xTiles=this.specs.xCount,this.yTiles=this.specs.yCount;for(let s=0;s<this.xTiles;s++){this.kt[s]=this.kt[s]||[];for(let a=0;a<this.yTiles;a++){let l=document.createElement("img");l.wx=!0,l.className=b0,l.ondragstart=function(){return!1},this.container.appendChild(l),l.style.position="absolute",l.style.opacity=0,this.kt[s][a]=[l,new Image,!1]}}}Dx(r,e,t){return this.url.replace("{z}",r+"").replace("{x}",e+"").replace("{y}",t+"")}Nx(r,e,t){return this.urlGenerator==null?this.Dx(r,e,t):this.urlGenerator(r,e,t)}setActive(r){this.container.style.display=r?"block":"none"}Ix(r,e,t,n){r.style.left=t*this.scaledImageSize+"px",r.style.top=n*this.scaledImageSizeH+"px",r.style.width=this.scaledImageSize+"px",r.style.height=this.scaledImageSizeH+"px",e.onload=function(){r.setAttribute("src",e.src),r.style.opacity=1},e.src=this.Nx(this.zoom,t,n)}ensureLoaded(r,e,t,n){for(let o=r;o<=t;o++)for(let s=e;s<=n;s++)this.kt[o]!=null&&this.kt[o][s]!=null&&(this.kt[o][s][2]||(this.Ix(this.kt[o][s][0],this.kt[o][s][1],o,s),this.kt[o][s][2]=!0))}},ey=class ey{constructor(r){c(this,"type",ey.type);c(this,"canvas");c(this,"viewport");c(this,"layers",[]);c(this,"currentLayer");c(this,"widgetZoom");c(this,"width");c(this,"height");c(this,"tileSize");c(this,"panDebounceTimeout");c(this,"zoomDebounceTimeout");c(this,"maxZoom");c(this,"ui");c(this,"tiling");c(this,"urlGenerator");c(this,"Fp");c(this,"Up");if(r.options.maxZoom==null)throw new Error("Parameter `maxZoom` not set; cannot initialize TiledBackground");if(!r.options.tileSize)throw new Error("Parameter `tileSize not set; cannot initialize TiledBackground. It should be in the form {w:width, h:height}.");if(!r.options.width||!r.options.height)throw new Error("Parameters `width` and `height` must be set");this.canvas=r.canvas,this.viewport=r.viewport,this.urlGenerator=r.options.urlGenerator,this.ui=r.ui,this.tiling=r.options.tiling||eC,this.width=r.options.width,this.height=r.options.height,this.maxZoom=r.options.maxZoom,this.tileSize=r.options.tileSize,this.panDebounceTimeout=r.options.panDebounceTimeout||50,this.zoomDebounceTimeout=r.options.zoomDebounceTimeout||120,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.Fp=this.debounce(this.zp,this.zoomDebounceTimeout),this.Up=this.debounce(this.Yp,this.panDebounceTimeout);for(let e=0;e<=r.options.maxZoom;e++)this.layers.push(new rC(this,r,e));this.setZoom(r.ui.getZoom(),!0),r.options.onBackgroundReady!=null&&setTimeout(r.options.onBackgroundReady,0)}Vx(){if(this.widgetZoom<=this.layers[0].apparentZoom)return 0;if(this.widgetZoom>=this.layers[this.layers.length-1].apparentZoom)return this.layers.length-1;for(let r=this.layers.length-1;r>0;r--)if(this.layers[r].apparentZoom>=this.widgetZoom&&this.widgetZoom>=this.layers[r-1].apparentZoom)return r}Mx(r){let e=this.layers[r];this.currentLayer!=null&&this.currentLayer!==e&&this.currentLayer.setActive(!1),e.setActive(!0),this.currentLayer=e}Yp(){let r=this.ui.getApparentCanvasLocation(),e=this.ui.$getSize(this.viewport),t=e.width,n=e.height,o=this.currentLayer.scaledImageSize*this.widgetZoom,s=this.currentLayer.scaledImageSizeH*this.widgetZoom,a=r.x<0?Math.floor(-r.x/o):r.x<t?0:null,l=r.y<0?Math.floor(-r.y/s):r.y<n?0:null,h=Math.min(this.currentLayer.xTiles,Math.floor((t-r.x)/o)),d=Math.min(this.currentLayer.yTiles,Math.floor((n-r.y)/s));a==null||l==null||this.currentLayer.ensureLoaded(a,l,h,d)}getCurrentLayer(){return this.currentLayer}debounce(r,e){e=e||150;let t=null;return()=>{window.clearTimeout(t),t=window.setTimeout(r.bind(this),e)}}zp(){this.Mx(this.Vx()),this.Yp()}setZoom(r,e){this.widgetZoom=r,e?this.zp():this.Fp()}pan(){this.Up()}owns(r){return r===this.canvas||r.wx===!0}getHeight(){return this.height}getWidth(){return this.width}destroy(){}setUrl(r){U("WARN: setUrl not implemented for Tiled backgrounds.")}getTileSpecs(r){return this.tiling===tC?this.Gx(r):this.$x(r)}Gx(r){let e=Math.pow(2,this.maxZoom-r),t=Math.ceil(this.width/e/this.tileSize.width),n=Math.ceil(this.height/e/this.tileSize.height),o=t*this.tileSize.width/this.width,s=n*this.tileSize.height/this.height;return{xCount:t,yCount:n,xSize:o,ySize:s}}$x(r){let e=this.width>this.height?1:this.width/this.height,t=this.height>this.width?1:this.height/this.width,n=Math.pow(2,r+1)*this.tileSize.width*e,o=Math.pow(2,r+1)*this.tileSize.height*t,s=Math.ceil(n/this.tileSize.width),a=Math.ceil(o/this.tileSize.height),l=n/this.width,h=o/this.height;return{xCount:s,yCount:a,xSize:l,ySize:h}}zt(r){}};c(ey,"type","tiled");var wp=ey;io.register(wp.type,wp);var A0=(e=>(e.dotted="dotted",e.lines="lines",e))(A0||{}),iG="dotted",oG="lines",S0={width:50,height:50},T0=2,nC="#ddd",Nh="#ddd",sG=2,aG=1,v0="vjs-background",C0="vjs-background-border",is="vjs-background-grid",P0="vjs-background-grid-minor",_0="vjs-background-grid-major",Dp="vjs-background-grid-dotted-major",O0="vjs-background-grid-dotted-minor",ty=class ty{constructor(r){c(this,"Xe",!1);c(this,"type",ty.type);c(this,"grid");c(this,"ui");c(this,"showBorder",!0);c(this,"minWidth");c(this,"minHeight");c(this,"maxWidth");c(this,"maxHeight");c(this,"showTickMarks");c(this,"tickMarksPerCell");c(this,"autoShrink",!0);c(this,"dotRadius");c(this,"tickDotRadius");c(this,"gridType");c(this,"currentBounds");c(this,"We",{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});c(this,"backgroundContainer");c(this,"Ms");c(this,"Zi");this.ui=r.ui,this.showBorder=r.options.showBorder===!0,this.Ms=`p${G().substring(0,8)}`,this.Zi=`p${G().substring(0,8)}`,this.gridType=r.options.gridType||"lines",this.backgroundContainer=M(Le),this.backgroundContainer.style.position=Qe,L(this.backgroundContainer,v0),this.zt(r.visible),r.canvas.insertBefore(this.backgroundContainer,r.canvas.firstElementChild),this.ui.bind(Vt,e=>{this.vr()}),this.ui.bind(Mt,e=>{this.vr()}),this.ui.bind(Sd,()=>{this.Xe=!0}),this.ui.bind(Fr,()=>{this.Xe=!1,this.vr()}),this.ui.bind(Yr,e=>{this.vr()}),this.ui.bind(Ur,e=>{this.vr()}),this.ui.model.bind(Ce,e=>{this.vr()}),this.ui.model.bind(Oe,e=>{this.vr()}),this.grid=r.options.grid||this.ui.getGrid()||S0,this.showTickMarks=r.options.showTickMarks===!0,this.tickMarksPerCell=r.options.tickMarksPerCell||T0,this.dotRadius=r.options.dotRadius||sG,this.tickDotRadius=r.options.tickDotRadius||aG,this.minWidth=r.options.minWidth||2e4,this.minHeight=r.options.minHeight||2e4,this.maxWidth=r.options.maxWidth,this.maxHeight=r.options.maxHeight,this.autoShrink=r.options.autoShrink!=!1,this.vr()}owns(r){return r===this.backgroundContainer||r.parentNode===this.backgroundContainer}getWidth(){return this.currentBounds!=null?this.currentBounds.width+(this.currentBounds.x<0?this.currentBounds.x:0):0}getHeight(){return this.currentBounds!=null?this.currentBounds.height+(this.currentBounds.y<0?this.currentBounds.y:0):0}setZoom(r,e){}pan(){}destroy(){this.backgroundContainer.parentNode&&this.backgroundContainer.parentNode.removeChild(this.backgroundContainer),this.backgroundContainer=null}vr(){this.Xe||requestAnimationFrame(()=>{this.currentBounds=Object.assign({},this.ui.getViewportBoundsInfo());let r=this.grid.width*(Math.floor(this.currentBounds.x/this.grid.width)-1),e=this.grid.height*(Math.floor(this.currentBounds.y/this.grid.height)-1),t=this.grid.width*(Math.floor(this.currentBounds.width/this.grid.width)+3),n=this.grid.height*(Math.floor(this.currentBounds.height/this.grid.height)+3);if(!isNaN(r)&&!isNaN(e)&&!isNaN(t)&&!isNaN(n)){if(this.minWidth!=null){let s=-this.minWidth/2;s<r&&(t+=r-s,r=s);let a=this.minWidth/2;a>r+t&&(t+=a-(r+t))}if(this.minHeight!=null){let s=-this.minHeight/2;s<e&&(n+=e-s,e=s);let a=this.minHeight/2;a>e+n&&(n+=a-(e+n))}if(this.maxWidth!=null){let s=-this.maxWidth/2;s>r&&(t-=s-r,r=s);let a=this.maxWidth/2;a<r+t&&(t-=r+t-a)}if(this.maxHeight!=null){let s=-this.maxHeight/2;s>e&&(n-=s-e,e=s);let a=this.maxHeight/2;a<e+n&&(n-=e+n-a)}this.autoShrink!==!0&&(r=Math.min(r,this.We.minX),e=Math.min(e,this.We.minY),t=Math.max(r+t,this.We.maxX)-r,n=Math.max(e+n,this.We.maxY)-e);let o=this.ui.$getFixedViewportBoundsInfo();o!=null&&(r=o.x,e=o.y,t=o.width,n=o.height),Ie(this.backgroundContainer,{x:r,y:e}),this.backgroundContainer.setAttribute("width",`${t}`),this.backgroundContainer.setAttribute("height",`${n}`),this.backgroundContainer.setAttribute("viewBox",`0 0 ${t} ${n}`),this.backgroundContainer.innerHTML=this.generateGrid(),this.We.minX=Math.min(this.We.minX,r),this.We.minY=Math.min(this.We.minY,e),this.We.maxX=Math.max(this.We.maxX,r+t),this.We.maxY=Math.max(this.We.maxY,e+n)}else this.backgroundContainer.innerHTML=""})}Bx(r,e){return`<pattern id="${this.Zi}" width="${r}" height="${e}" patternUnits="userSpaceOnUse">
|
|
44
|
+
<path d="M ${r} 0 L 0 0 0 ${e}" class="${is} ${P0}" fill="none" stroke="${nC}" stroke-width="1"/>
|
|
45
|
+
</pattern>`}Fx(){return`<pattern id="${this.Ms}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Zi})"/>`:"")+`<path d="M ${this.grid.width} 0 L 0 0 0 ${this.grid.height}" class="${is} ${_0}" fill="none" stroke="${Nh}" stroke-width="1.5"/></pattern>`}Ux(r,e){let t=`<pattern id="${this.Zi}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`;for(let n=0;n<this.tickMarksPerCell+2;n++){let o=n*r;for(let s=0;s<this.tickMarksPerCell+2;s++){let a=s*e;t+=`<circle cx="${o}" cy="${a}" r="${this.tickDotRadius}" class="${is} ${O0}" fill="${nC}" stroke="none"/>`}}return t+"</pattern>`"}zx(){return`<pattern id="${this.Ms}" width="${this.grid.width}" height="${this.grid.height}" patternUnits="userSpaceOnUse">`+(this.showTickMarks?`<rect width="${this.grid.width}" height="${this.grid.height}" fill="url(#${this.Zi})"/>`:"")+`<circle cx="0" cy="0" r="${this.dotRadius}" class="${is} ${Dp}" fill="${Nh}" stroke="none"/>
|
|
46
|
+
<circle cx="${this.grid.width}" cy="0" r="${this.dotRadius}" class="${is} ${Dp}" fill="${Nh}" stroke="none"/>
|
|
47
|
+
<circle cx="${this.grid.width}" cy="${this.grid.height}" r="${this.dotRadius}" class="${is} ${Dp}" fill="${Nh}" stroke="none"/>
|
|
48
|
+
<circle cx="0" cy="${this.grid.height}" r="${this.dotRadius}" class="${is} ${Dp}" fill="${Nh}" stroke="none"/></pattern>`}Yx(){let r=this.grid.width/(this.tickMarksPerCell+1),e=this.grid.height/(this.tickMarksPerCell+1),t=()=>this.gridType==="lines"?this.Bx(r,e):this.Ux(r,e),n=()=>this.gridType==="lines"?this.Fx():this.zx();return"<defs>"+(this.showTickMarks?t():"")+n()+"</defs>"}generateGrid(){let r=this.Yx(),e=this.showBorder?`<rect class="${C0}" x="0" y="0" width="100%" height="100%" fill="${pt}"/>`:"",t=`<rect x="0" y="0" width="100%" height="100%" fill="url(#${this.Ms})" stroke="${pt}"/>`;return r+e+t}zt(r){this.backgroundContainer.style.display=r?Pr:pt}};c(ty,"type","grid");var Ta=ty;io.register(Ta.type,Ta);var os=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"background");c(this,"Gs",!0);c(this,"ui")}initialise(e,t){this.ui=e;let n=t.type,o=io.get(n);return this.Gs=t.options!=null?t.visible!==!1:!0,this.background=new o({type:n,ui:this.ui,canvas:e.$getCanvasElement(),viewport:e.rootElement,options:t,visible:this.Gs}),e.addBackground(this.background),!0}destroy(){this.ui.removeBackground(this.background),this.background.destroy()}reset(){}setUrl(e){this.background.setUrl!=null?this.background.setUrl(e):U("The current background does not support the `setUrl` method")}show(){this.setVisible(!0)}hide(){this.setVisible(!1)}toggle(){this.setVisible(!this.Gs)}setVisible(e){this.Gs=e,this.background.zt(e)}};c(os,"type","background"),cn.register(os.type,os);var Ih="c-state",Np=class{constructor(r,e,t){this.id=r;this.state=e;this.ui=t;for(let n in e)if(e.hasOwnProperty(n)){let o=n===gr?`${Ih}-${r}`:`${Ih}-${r}-${n}`;t.$registerConnectionType(o,e[n])}}activate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Ih}-${this.id}-${a}`:null;l&&Ne.addType(s,l,o.data),this.state[gr]&&Ne.addType(s,`${Ih}-${this.id}`,o.data),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state["*"]&&L(l,this.state["*"].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&L(l,a.cssClass),this.state[gr]&&L(l,this.state[gr].cssClass)})}deactivate(r,e,t){r.eachEdge((n,o)=>{let s=e.getRenderedConnection(o.getId()),a=t.getEdgeType(o.data),l=a?`${Ih}-${this.id}-${a}`:null;l&&Ne.removeType(s,l,o.data),this.state[gr]&&Ne.removeType(s,`${Ih}-${this.id}`),this.ui.repaintEdge(o)}),r.eachNode((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state["*"]&&F(l,this.state[gr].cssClass)}),r.eachGroup((n,o)=>{let s=t.getNodeType(o.data),a=s?this.state[s]:null,l=e.getRenderedElement(o.id);a&&a.cssClass&&F(l,a.cssClass),this.state[gr]&&F(l,this.state[gr].cssClass)})}};var ry=class{constructor(r){this.ui=r;c(this,"Xp",{});c(this,"model");c(this,"currentStates",[]);c(this,"viewOptions");if(this.model=r.view,this.viewOptions=this.model.viewOptions,this.viewOptions.states)for(let e in this.viewOptions.states)this.Xp[e]=new Np(e,this.viewOptions.states[e],r)}getState(r){return this.Xp[r]}activateState(r,e){let t=this.getState(r);if(t){let n=this.jp(e);t.activate(n,this.ui,this.ui.dataSource),this.currentStates.push(t)}}deactivateState(r,e){let t=this.getState(r);t&&(e=this.jp(e),t.deactivate(e,this.ui,this.ui.dataSource),Nt(this.currentStates,function(n){return n==t}))}resetState(){for(let r=0;r<this.currentStates.length;r++)this.currentStates[r].deactivate(this.ui.dataSource,this.ui,this.ui.dataSource);this.currentStates.length=0}jp(r){if(r==null)return this.ui.dataSource;if(typeof r=="string")return this.ui.model.select(r,!0);if(r.jtk){let e=r.jtk;return this.ui.model.select(e.port||e.node,!0)}else return r}},Mh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"model")}destroy(){}initialise(e,t){return this.model=new ry(e),!0}reset(){}activateState(e,t){this.model.activateState(e,t)}deactivateState(e,t){this.model.deactivateState(e,t)}resetState(){this.model.resetState()}};c(Mh,"type","ui-states"),cn.register(Mh.type,Mh);var iC="direct",lG="orthogonal",Vh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"instance");c(this,"mode");c(this,"orthogonalMode");c(this,"orthogonalPadding");c(this,"layoutListener");c(this,"kp");c(this,"de");c(this,"Rt")}destroy(){}Xx(){let e=this.ui.getLayout();if(e.type!==Ao.type){U(`INFO: cannot run edge routing; layout is of type ${e.type}. You must use the HierarchyLayout with the edge routing plugin`);return}if(!this.ui.$_hasUnrenderedEdges()){let t=e.axis;this.kp.forEach(n=>{let o=this.mode===iC?YA(n):UA(n);for(let s in o){let a=this.ui.getRenderedConnection(s),l=a.connector,h=n.edgeMap[s],d=h.pathDirection;if(l.type!==Hr){U(`Cannot process edge routing for edge ${s} - connector must be Straight type`);continue}let u=o[s],p=this.instance.getEdge(s),g=this.de[p.source.id],m=this.de[p.target.id],E=this.Rt[p.source.id],y=this.Rt[p.target.id],x=[],f=u[0].x,b=u[0].y;for(let A=1;A<u.length-1;A++)x.push({x1:f,y1:b,x2:u[A].x,y2:u[A].y}),f=u[A].x,b=u[A].y;x.push({x1:f,y1:b,x2:u[u.length-1].x,y2:u[u.length-1].y}),ze.importGeometry(a,{source:{curX:u[0].x,curY:u[0].y,ox:t===0?d:0,oy:t===1?d:0,x:(u[0].x-g.x)/E.width,y:(u[0].y-g.y)/E.height},target:{curX:u[u.length-1].x,curY:u[u.length-1].y,ox:t===0?-d:0,oy:t===1?-d:0,x:(u[u.length-1].x-m.x)/y.width,y:(u[u.length-1].y-m.y)/y.height},segments:x})}}),this.ui.repaintEverything()}}initialise(e,t){return this.mode=t.mode||iC,this.ui=e,this.instance=e.model,this.orthogonalMode=t.orthogonalMode||Xd,this.orthogonalPadding=t.orthogonalPadding|10,this.layoutListener=(n,o)=>{try{let s=n.layout.getRoutingInformation();this.kp=s.map(a=>Object.assign({mode:this.orthogonalMode,pad:this.orthogonalPadding,axis:n.layout.axis},a)),this.de=Object.assign({},n.positions),this.Rt=Object.assign({},n.sizes),this.Xx()}catch(s){U("Cannot retrieve edge routing. Make sure you're using a Hierarchy layout and you have generateRouting:true in its options`")}},this.ui.bind(Pn,(n,o)=>this.layoutListener(n,o)),!0}reset(){this.ui.unbind(Pn,this.layoutListener)}};c(Vh,"type","edgeRouting"),cn.register(Vh.type,Vh);var R0="vjs-selected-edge-highlight",ny=class ny extends Se{constructor(){super(...arguments);c(this,"id",ny.type);c(this,"Cr",new Map);c(this,"Hp",R0);c(this,"Ji");c(this,"S");c(this,"Wp",e=>{nt(e.obj)&&(this.jx(e.obj),this.kx())});c(this,"Jp",e=>{nt(e.obj)&&(this.lh(e.obj.getId()),this.Zp())});c(this,"Kp",e=>{this.reset()});c(this,"$s",e=>{e.edge&&this.Ki(e.edge)});c(this,"qp",e=>{e.edge&&this.Ki(e.edge)});c(this,"Qp",e=>{e.dragGroup.forEach(t=>this.em(t.vertex))})}initialise(e,t){return this.S=e,this.Hp=t&&t.className||R0,this.Ji=t&&t.paintStyle||{fill:"none",stroke:"var(--vjs-color-edit)",strokeWidth:2},this.S.model.bind(Kt,this.Wp),!0}destroy(){this.reset(),this.S.model.unbind(Kt,this.Wp)}reset(){this.Cr.forEach(e=>{this.S.$removeElement(e)}),this.Cr.clear(),this.Zp()}kx(){this.S.model.bind(qt,this.Jp),this.S.model.bind(nr,this.Kp),this.S.model.bind(ti,this.$s),this.S.model.bind(ri,this.qp),this.S.bind(Mt,this.Qp),this.S.bind(ti,this.$s)}Zp(){this.S.model.unbind(qt,this.Jp),this.S.model.unbind(nr,this.Kp),this.S.model.unbind(ti,this.$s),this.S.model.unbind(ri,this.qp),this.S.unbind(Mt,this.Qp),this.S.unbind(ti,this.$s)}$edgeRemoved(e){this.lh(e.getId())}$edgeUpdated(e){this.Ki(e)}$vertexUpdated(e,t){this.em(e.modelObject)}em(e){this.Cr.forEach((t,n)=>{let o=this.S.model.getEdge(n);o&&(o.source===e||o.target===e)&&this.Ki(o)})}jx(e){var s;let t=e.getId();if(this.Cr.has(t)){this.Ki(e);return}let n=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!n)return;let o=M(Z,{fill:this.Ji.fill||"none",stroke:this.Ji.stroke||"var(--vjs-color-edit)","stroke-width":this.Ji.strokeWidth||2,"stroke-dasharray":this.Ji.dashArray,"pointer-events":"none",rx:2},{},this.Hp);this.tm(o,n),this.S.$appendElementToToolsLayer(o),this.Cr.set(t,o)}Ki(e){var s;let t=e.getId(),n=this.Cr.get(t);if(!n)return;let o=(s=this.S.getRenderedConnection(t))==null?void 0:s.connector;if(!o){this.lh(t);return}this.tm(n,o)}lh(e){let t=this.Cr.get(e);t&&(this.S.$removeElement(t),this.Cr.delete(e))}tm(e,t){let o=t.canvas.getBBox(),s=t.x+o.x,a=t.y+o.y;ie(e,{x:s,y:a,width:o.width,height:o.height})}};c(ny,"type","selected-edge-highlight");var va=ny;cn.register(va.type,va);var Yn=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surfaceMode",Ei);c(this,"surface");c(this,"lasso");c(this,"onStart");c(this,"onEnd");c(this,"onSelect");c(this,"selectionFilter");c(this,"autoExit");c(this,"lassoSelections",[]);c(this,"qi")}destroy(){}initialise(e,t){return e.bind(On,n=>{this.lasso.enabled=n===Ei}),this.autoExit=t.autoExit!==!1,this.selectionFilter=t.selectionFilter,this.onStart=t.onStart,this.onSelect=t.onSelect,this.onEnd=t.onEnd,this.lasso=new Sa({autoArm:t.autoArm,armTimeout:t.armTimeout,surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:t.cssClass,generateLassoContent:t.generateLassoContent,enableInGroups:t.enableInGroups,onStart:(n,o,s,a,l)=>{e.hoverSuspended=!0,this.lassoSelections.length=0,l!=null&&Y(l.modelObject)?this.qi=l:this.qi=null,this.onStart&&this.onStart(),e.fireUnchecked(Od,{canvasPosition:o})},onSelect:(n,o,s,a,l,h)=>{e.model.clearSelection(),h&&this.lassoSelections.length>0&&e.model.removeFromSelection(this.lassoSelections);let d=[],u,p=e.findIntersectingVertices({origin:s,dimensions:a,enclosed:!l[0],dontIncludeNodesInsideGroups:this.qi==null,filter:E=>this.qi==null||ke(E,this.qi.modelObject)}),g=p.length,m={};for(u=0;u<g;u++)(this.selectionFilter==null||this.selectionFilter(p[u].v)!==!1)&&(d.push(p[u].v),m[p[u].id]=!0,e.model.addToSelection(p[u].v));if(this.lassoSelections=d,g=d.length,t.includeEdges){let E={};for(u=0;u<g;u++){let y=[],x;Array.prototype.push.apply(y,d[u].getAllEdges());for(let f=0;f<y.length;f++)if(x=y[f].getId(),!E[x]){let b=y[f].source.objectType===de.objectType?y[f].source.getParent().id:y[f].source.id,A=y[f].target.objectType===de.objectType?y[f].target.getParent().id:y[f].target.id;m[b]&&m[A]&&d.push(y[f]),E[x]=!0}}}e.model.addToSelection(d),this.onSelect&&this.onSelect(d),e.fireUnchecked(Rd,{canvasPosition:s,canvasSize:a})},onEnd:(n,o)=>{e.hoverSuspended=!1,this.autoExit&&e.mode!==ns&&e.setMode(br),e.fireUnchecked(Ld),this.onEnd&&this.onEnd()},filter:t.filter}),!1}reset(){}};c(Yn,"type","lasso"),Yn=He([Xe("lasso")],Yn);var L0="vjs-surface-elastic-group-resize",iy="elasticGroupFrame:resize",oy="elasticGroupFrame:remove",Ca=class i{constructor(r,e,t,n){this.surface=r;this.focusVertex=e;this.group=t;this.groupDef=n;c(this,"groupEntry");c(this,"focusPosition");c(this,"siblingEntries",[]);c(this,"xMinEntries",[]);c(this,"xMaxEntries",[]);c(this,"yMinEntries",[]);c(this,"yMaxEntries",[]);c(this,"managedElement");c(this,"uiGroup");c(this,"frame");c(this,"layout");c(this,"uiGroupContentArea");c(this,"Hx");c(this,"layoutShiftX",0);c(this,"layoutShiftY",0);c(this,"width",0);c(this,"height",0);c(this,"minSize");c(this,"x",0);c(this,"y",0);c(this,"parent");this.managedElement=r.viewport.getGroupElement(t.id),this.uiGroup=r.getGroupElement(t.id),this.uiGroupContentArea=this.surface.$getGroupContentAreaElement(this.uiGroup.el),Lt(this.uiGroupContentArea)?this.frame=M(Z):(this.frame=M(Le),this.frame.appendChild(M(Z,{x:0,y:0,width:"100%",height:"100%"}))),this.layout=r.layoutMap.get(t.id),this.frame.style.visibility="hidden",r.$appendElement(this.frame,this.uiGroupContentArea,!0),L(this.frame,L0),this.groupEntry=r.viewport.getElementBounds(t.id),this.surface.$_useModelForSizes?this.minSize={width:t.data[this.surface.$modelWidthAttribute],height:t.data[this.surface.$modelHeightAttribute]}:this.minSize={width:this.groupEntry.width,height:this.groupEntry.height};let o=Object.assign({},r.viewport.getElement(e.id));if(this.focusPosition=rm(o,this.groupEntry,-1),t.members.filter(a=>a.id!==e.id).forEach(a=>{let l=r.viewport.getElement(a.id),h=rm(l,this.groupEntry,-1);this.siblingEntries.push(l),this.xMinEntries.push(h),this.xMaxEntries.push(h),this.yMinEntries.push(h),this.yMaxEntries.push(h)}),this.Wx(),this.Hx=this.getCurrentExtents(),t.group){let a=this.surface.getGroupElement(t.group.id);a.elastic&&(this.parent=new i(r,t,t.group,a))}}Wx(){this.xMinEntries.sort((r,e)=>r.x<e.x?-1:1),this.yMinEntries.sort((r,e)=>r.y<e.y?-1:1),this.xMaxEntries.sort((r,e)=>r.x+r.width>e.x+e.width?-1:1),this.yMaxEntries.sort((r,e)=>r.y+r.height>e.y+e.height?-1:1)}setFocusPosition(r,e,t,n,o){let s=(n==null?void 0:n.width)||this.focusPosition.width,a=(n==null?void 0:n.height)||this.focusPosition.height,l={x:r.x-(o?this.groupEntry.x:0),y:r.y-(o?this.groupEntry.y:0)};this.focusPosition.x=l.x,this.focusPosition.y=l.y,this.focusPosition.width=s,this.focusPosition.height=a,this.Zx(e,t)}Zx(r,e){let t=e==null?!1:e.metaKey||e.ctrlKey,n=this.getCurrentExtents(),o=Mu(n,this.groupDef,r,!0,!0,this.surface.gridProfile,t?null:this.minSize);this.width=o.width,this.height=o.height,this.layoutShiftX=o.layoutShiftX,this.layoutShiftY=o.layoutShiftY,Rr(this.frame,this.width,this.height),Ie(this.frame,{x:-this.layoutShiftX,y:-this.layoutShiftY}),this.parent&&this.parent.setFocusPosition({x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},!1,e,{width:this.width,height:this.height},!0),this.frame.style.visibility="visible",this.surface.fireUnchecked(iy,{groupId:this.group.id,width:this.width,height:this.height,x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY})}getCurrentExtents(){let r=this.xMaxEntries[0]||{x:-1/0,width:0},e=this.yMaxEntries[0]||{y:-1/0,height:0};return{xmin:Math.min(this.focusPosition.x,(this.xMinEntries[0]||{x:1/0}).x),ymin:Math.min(this.focusPosition.y,(this.yMinEntries[0]||{y:1/0}).y),xmax:Math.max(this.focusPosition.x+this.focusPosition.width,r.x+r.width),ymax:Math.max(this.focusPosition.y+this.focusPosition.height,e.y+e.height)}}cleanup(){this.frame&&this.frame.parentNode&&this.frame.parentNode.removeChild(this.frame),this.parent&&this.parent.cleanup(),this.surface.fireUnchecked(oy,{groupId:this.group.id})}getValues(r){return r==this.group.id?{layoutShiftX:this.layoutShiftX,layoutShiftY:this.layoutShiftY,width:this.width,height:this.height}:this.parent?this.parent.getValues(r):null}hh(r,e){r=r||{},e=e||{};let t=(s,a,l)=>{r[s]=r[s]||{original:a,current:l},r[s].current=l},n={x:this.groupEntry.x-this.layoutShiftX,y:this.groupEntry.y-this.layoutShiftY},o=Object.assign({},n);if(this.group.group){let s=this.surface.viewport.getElementPosition(this.group.group.id);o.x-=s.x,o.y-=s.y}return(this.layoutShiftX!==0||this.layoutShiftY!==0)&&(this.group.members.forEach(s=>{let a=this.surface.viewport.getElement(s.id),l={x:a.x+this.layoutShiftX-this.groupEntry.x,y:a.y+this.layoutShiftY-this.groupEntry.y};t(s.id,{x:a.x,y:a.y},l)}),t(this.group.id,{x:this.groupEntry.x,y:this.groupEntry.y},o)),(this.width!==this.groupEntry.width||this.height!==this.groupEntry.height)&&(e[this.group.id]={element:this.managedElement,originalGroupSize:{width:this.groupEntry.width,height:this.groupEntry.height},newGroupSize:{width:this.width,height:this.height}}),this.surface.viewport.updateElement(this.group.id,n.x,n.y,this.width,this.height,null,this.group,!1),this.surface.$setGroupElementSize(this.managedElement.modelObject,{width:this.width,height:this.height}),this.surface.$setViewportElementPosition(this.managedElement,o),this.surface.$repaintUIElement(this.managedElement),this.parent&&this.parent.hh(r,e),{movedElements:r,resizedGroups:e}}};var w0="resize";function Ip(i,r,e){let t={width:i.width,height:i.height,position:i.position||Qe},n=i.atts||{};i.display!=null&&(t.display=i.display),i.id!=null&&(n.id=i.id),i.top!=null&&(t.top=i.top+"px"),i.left!=null&&(t.left=i.left+"px"),i.right!=null&&(t.right=i.right+"px"),i.bottom!=null&&(t.bottom=i.bottom+"px");let o=la(i.ns,i.type||qe,t,i.clazz,n);return r!=null&&(e?r.insertBefore(o,r.lastChild):r.appendChild(o)),o}var sy="vjs-node-id",oC="vjs-miniview-type",D0="miniview",zn=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"ui");c(this,"panzoom");c(this,"containerElement");c(this,"canvasElement");c(this,"pannerElement");c(this,"lassoElement");c(this,"uiBounds");c(this,"suspended");c(this,"ch");c(this,"typeFunction");c(this,"Pr");c(this,"Bs");c(this,"wheelSensitivity");c(this,"wheelReverse");c(this,"panning",!1);c(this,"downAt",null);c(this,"pannerAtMouseDown",null);c(this,"zoomingWithWheel",!1);c(this,"elementFilter");c(this,"visible",!0);c(this,"pannerPos");c(this,"activeTracking");c(this,"rm");c(this,"nm");c(this,"im");c(this,"vertexMap",{});c(this,"enableWheelZoom");c(this,"eventManager");c(this,"dh");c(this,"uiBindings",[]);c(this,"uh");c(this,"viewport");c(this,"Ut");c(this,"nn");c(this,"sn");c(this,"Tr");c(this,"ph")}destroy(){this.panzoom.destroy(),this.eventManager.off(this.pannerElement,ge,this.nn),this.canvasElement.parentNode.removeChild(this.canvasElement),this.pannerElement.parentNode.removeChild(this.pannerElement),this.lassoElement.parentNode&&this.lassoElement.parentNode.removeChild(this.lassoElement),this.eventManager.off(window,w0,this.ph),F(this.containerElement,tp),F(this.containerElement,rp),this.ch&&(this.eventManager.off(this.Pr,Ye,this.uh),this.Pr.parentNode.removeChild(this.Pr)),this.uiBindings.forEach(e=>this.ui.unbind(e[0],e[1])),this.ui.model.unbind(Vr,this.dh),this.Ut&&ih(this.containerElement,this.Ut),this.panzoom=null}Jx(e){}Kx(e){}le(e,t){let n=t.bind(this);this.uiBindings.push([e,n]),this.ui.bindUnchecked(e,n)}initialise(e,t){this.ui=e,this.activeTracking=t.activeTracking!==!1,this.rm=t.clickToCenter!==!1,this.wheelReverse=this.wheelReverse||this.ui.$wheelReverse===!0,this.nm=t.showLasso!==!1,this.im=t.trackSelection!==!1,this.nn=this.downListener.bind(this),this.sn=this.moveListener.bind(this),this.Tr=this.upListener.bind(this),this.containerElement=t.container,this.pannerElement=Ip({position:Qe,width:kr,height:kr,left:0,top:0,clazz:cv},this.containerElement),this.canvasElement=Ip({position:LS,width:kr,height:kr,left:0,top:0,clazz:hv},this.containerElement),this.lassoElement=Ip({position:Qe,width:kr,height:kr,left:0,top:0,clazz:dv}),this.suspended=t.suspended===!0,this.ch=t.collapsible!==!1,this.typeFunction=t.typeFunction,this.Pr=null,this.Bs=!1,this.enableWheelZoom=t.enableWheelZoom!==!1,this.wheelSensitivity=t.wheelSensitivity||10,this.elementFilter=t.elementFilter||(o=>!0),this.visible=t.visible!==!1,this.eventManager=new ye,L(this.containerElement,tp),this.uh=this.toggleCollapsed.bind(this),this.ch&&(this.Pr=Ip({type:"div"}),this.Pr.className=gv,this.containerElement.appendChild(this.Pr),this.ui.on(this.Pr,Ye,this.uh)),this.viewport=this.ui.viewport,this.panzoom=new ya({viewport:this.viewport,viewportElement:this.containerElement,canvasElement:this.canvasElement,elementPositionSetter:(o,s)=>Ie(o,s),wheel:{zoom:!1},enablePan:!1,enableAnimation:!1,idFunction:o=>o.viewportEntry?o.viewportEntry.id:this.ui.W(o),events:{pan:()=>{this.om()},mousedown:()=>{L(this.pannerElement,If)},mouseup:()=>{F(this.pannerElement,If)}},zoomRange:[-1/0,1/0]}),this.ph=ha(()=>{this.$e()},100),this.eventManager.on(window,w0,this.ph),this.enableWheelZoom!==!1&&(this.Ut=this.wheelZoom.bind(this),nh(this.containerElement,this.Ut)),this.pannerElement.style.transformOrigin="0 0",L(this.containerElement,tp),this.eventManager.on(this.pannerElement,ge,this.nn),this.dh=()=>{this.$e(),this.ht(!0),setTimeout(()=>{this.$e(),this.ht(!0)},0)},this.le(Fr,this.dh),this.setVisible(this.visible),this.le(Gi,this.$e),this.le(Br,this.$e),this.le(Vt,this.Fs),this.le(Mt,o=>{this.activeTracking&&this.Fs(o)}),this.le(Yr,this.mh),this.le(Pl,this.qx),this.le(Pn,this.Qx),this.le(Ur,this.sm),this.le($r,this.Fs),this.le(To,o=>{this.activeTracking&&this.Fs(o)}),this.nm&&(this.le(Od,o=>{this.canvasElement.appendChild(this.lassoElement),this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width="1px",this.lassoElement.style.height="1px"}),this.le(Rd,o=>{this.lassoElement.style.left=`${o.canvasPosition.x}px`,this.lassoElement.style.top=`${o.canvasPosition.y}px`,this.lassoElement.style.width=`${o.canvasSize.width}px`,this.lassoElement.style.height=`${o.canvasSize.height}px`}),this.le(Ld,()=>{this.lassoElement.parentElement&&this.lassoElement.parentElement.removeChild(this.lassoElement)})),this.im&&(this.ui.model.bind(Kt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&L(s,ph)}),this.ui.model.bind(qt,o=>{let s=this.vertexMap[o.obj.getFullId()];s!=null&&F(s,ph)}),this.ui.model.bind(nr,o=>{Array.from(this.canvasElement.querySelectorAll(`.${ph}`)).forEach(s=>F(s,ph))}));let n=o=>{this.uiBounds=o.bounds;for(let s in o.positions){let a=o.positions[s],l=this.vertexMap[s];l&&er(l,a)}this.ht(!0)};return this.le(Pn,n),this.le(Ys,n),this.le(Yb,this.Fn),this.le(Td,this.eb),this.le(iy,this.Jx),this.le(oy,this.Kx),this.tb(),this.rm&&(L(this.containerElement,mv),this.eventManager.on(this.canvasElement,W,Ae(sy),o=>{let s=o.target.getAttribute(sy);s&&this.vertexMap[s]&&this.ui.centerOn(s)})),!0}reset(){this.rb(),this.panzoom.setZoom(1),this.panzoom.reset(),this.$e()}am(e){let t=this.ui.viewport.getElement(e.id);if(t!=null){let n=ft(t);if(e.group){let o=this.ui.viewport.getElement(e.group.id);o!=null&&(n.x-=o.x,n.y-=o.y)}return n}return{x:0,y:0}}tb(){let e=this.ui.model,t=e.getNodes(),n=e.getGroups();for(let o=0;o<n.length;o++){let s=this.ui.getRenderedElement(n[o]);s!=null&&this.sm({el:s,id:n[o].id,vertex:n[o],pos:this.am(n[o])})}for(let o=0;o<t.length;o++){let s=this.ui.getRenderedElement(t[o]);s!=null&&this.mh({el:s,id:t[o].id,vertex:t[o],pos:this.am(t[o])})}(n.length>0||t.length>0)&&this.ht(!0)}sm(e){this.mh(e,pv)}$groupCollapsed(e){this.lm(e.modelObject,!1),this.Fn({id:e.id})}$groupExpanded(e){this.lm(e.modelObject,!0),this.Fn({id:e.id})}$vertexRotated(e,t){let n=this.vertexMap[e.id];n!=null&&(n.style.transform="rotate("+t+"deg)",n.style.transformOrigin="50% 50%")}$vertexResized(e,t,n){let o=this.vertexMap[e.id];o!=null&&Rr(o,t,n)}$vertexUpdated(e,t){this.vertexMap[e.id]&&(this.Us(e),this.ht(!0))}downListener(e){this.panning=!0,this.downAt=me(e),this.pannerAtMouseDown=gn(this.pannerElement),this.eventManager.on(document,le,this.Tr),this.eventManager.on(document,ae,this.sn),oe(e)}moveListener(e){if(this.zoomingWithWheel=!1,this.panning){let t=me(e),n=t.x-this.downAt.x,o=t.y-this.downAt.y,s={x:this.pannerAtMouseDown.x+n,y:this.pannerAtMouseDown.y+o};this.om(s),er(this.pannerElement,s)}}upListener(e){this.panning=!1,this.downAt=null,this.eventManager.off(document,le,this.Tr),this.eventManager.off(document,ae,this.sn)}wheelZoom(e){oe(e);let t=this.panzoom.mapEventLocation(e);this.ui.panZoom.$setTransformOriginToCanvasPoint(t.x,t.y),this.ui.nudgeWheelZoom(e.normalizedWheelDelta*this.wheelSensitivity*(this.wheelReverse?-1:1),e)}toggleCollapsed(){this.Bs=!this.Bs,this.Bs?L(this.containerElement,rp):F(this.containerElement,rp),this.ht(!0)}ht(e){this.panzoom&&this.panzoom.zoomToFit({onComplete:this.$e,doNotFirePanEvent:e})}Fs(e){e.dragGroup.forEach(t=>{let n=t.vertex;n&&this.elementFilter(n)===!1||this.Us(t.element)}),this.ht(!0)}qx(e){let t=this.vertexMap[e.element.id];e.element.modelObject.members.forEach(o=>{let s=this.vertexMap[o.id];if(s!=null){let a=this.ui.getElement(o.id);er(s,{x:a.x-e.element.x,y:a.y-e.element.y}),Rr(s,a.width,a.height)}});let n=ft(e.element);if(e.element.modelObject.group){let o=this.ui.viewport.getGroupElement(e.element.modelObject.group.id);o&&(n.x-=o.x,n.y-=o.y)}er(t,n),Rr(t,e.element.width,e.element.height),this.$e()}Qx(e){this.uiBounds=this.ui.getViewportBoundsInfo();for(let t in e.positions){let n=e.positions[t],o=this.vertexMap[t];o&&er(o,n)}this.ht(!0)}nb(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++){let s=this.vertexMap[n[o].id];s&&t.appendChild(s)}}mh(e,t){if(this.elementFilter(e.vertex)===!1)return;let n=e.vertex,o=n.id;if(this.vertexMap[o]!=null)return;let s=e.pos||{x:0,y:0},a=e.size||this.$__getSize(e.id),l=Ip({position:Qe,width:a.width+Dn,height:a.height+Dn,left:s.x,top:s.y,clazz:uv+(t?" "+t:"")});if(l.vertex=n,l.viewportEntry=this.ui.getElement(o),this.typeFunction&&l.setAttribute(oC,this.typeFunction(e.vertex)),this.uiBounds=this.ui.getViewportBoundsInfo(),l.setAttribute(sy,o),this.canvasElement.appendChild(l),this.panzoom.add(l),this.vertexMap[o]=l,n.data.rotation!=null&&(l.style.transform="rotate("+n.data.rotation+"deg)",l.style.transformOrigin="50% 50%"),e.vertex.group){let h=this.vertexMap[e.vertex.group.id];h&&(h.appendChild(l),this.panzoom.suspend(e.el))}Y(e.vertex)&&this.nb(e.vertex,l),this.ui.$_dataLoading||(this.ht(!0),this.$e())}setVisible(e){this.visible=e,this.containerElement.style.display=e?Pr:pt}getPan(){return this.panzoom.getPan()}lm(e,t){let n=e.getMembers();for(let o=0;o<n.length;o++)this.vertexMap[n[o].id].style.display=t?"block":"none"}$__getSize(e){return this.ui.viewport.getElementSize(e)}Fn(e){let t=this.vertexMap[e.id];if(t){let n=e.size||this.$__getSize(e.id);if(t.style.width=n.width+Dn,t.style.height=n.height+Dn,this.$e(),this.typeFunction){let o=e.obj||this.ui.model.getVertex(e.id);o&&t.setAttribute(oC,this.typeFunction(o))}}}invalidate(e){if(e)this.Fn({id:e});else for(let t in this.vertexMap)this.Fn({id:t})}setSuspended(e,t){this.suspended=e,t&&this.$e()}hm(e,t){let n=this.vertexMap[e.id];n&&(this.panzoom.remove(n),delete this.vertexMap[e.id],n.parentNode.removeChild(n),t||this.ht(!0)),t||this.$e()}$nodeRemoved(e){this.hm(e,!1)}$groupRemoved(e){let t=e.id;this.vertexMap[t]&&this.hm(e,!1)}$groupResized(e){this.Fn({id:e.element.id,size:e.newGroupSize}),this.ht(!0)}Us(e){let t=this.vertexMap[e.id];if(t){let n=e.modelObject.group,o=n==null?{x:0,y:0}:this.ui.getGroupElement(n.id);er(t,{x:e.x-o.x,y:e.y-o.y})}}$groupMemberRemoved(e){let t=this.vertexMap[e.id];t&&(this.canvasElement.appendChild(t),this.Us(e))}$groupMemberAdded(e){let t=e.modelObject.group;if(t){let n=this.vertexMap[t.id],o=this.vertexMap[e.id];n&&o&&(n.appendChild(o),this.Us(e))}}rb(){let e;for(let t in this.vertexMap)e=this.vertexMap[t],this.panzoom.remove(e),delete this.vertexMap[t],e.parentNode.removeChild(e);this.$e()}eb(e){let t=(e.node||e.group).id,n=this.vertexMap[t];n&&(n.style.display=e.state?"block":"none")}$e(){if(this.ui&&this.panzoom&&!this.suspended){this.uiBounds=this.ui.getViewportBoundsInfo();let e=this.ui.panZoom.getApparentCanvasLocation(),t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom;this.pannerElement.style.width=this.uiBounds.vw+Dn,this.pannerElement.style.height=this.uiBounds.vh+Dn,this.pannerElement.style.transform="scale("+o+")";let s={x:e.x*o,y:e.y*o};this.pannerPos={x:t.x-s.x,y:t.y-s.y},er(this.pannerElement,this.pannerPos)}}om(e){if(this.panzoom!=null){this.uiBounds=this.ui.getViewportBoundsInfo(),e=e||gn(this.pannerElement);let t=this.panzoom.getApparentCanvasLocation(),n=this.panzoom.getZoom(),o=n/this.uiBounds.zoom,s=(t.x-e.x)/o,a=(t.y-e.y)/o,l=this.ui.setApparentCanvasLocation(s,a);return{x:t.x-l.x*o,y:t.y-l.y*o}}}getRenderedVertex(e){return this.getRenderedElement(e)}getRenderedElement(e){return this.vertexMap[e]}};c(zn,"type",D0),zn=He([Xe(D0)],zn);var sC="vjs-pan-mode",aC="vjs-zoom-to-fit",lC="vjs-zoom-in",hC="vjs-zoom-out",ay="vjs-select-mode",cC="vjs-undo",dC="vjs-redo",uC="vjs-clear-dataset",hG="vjs-selected-mode",Mp="vjs-controls",pC="vjs-export-controls",gC="vjs-controls-reset-selection",cG="vjs-copy-paste-controls";var mC=class{constructor(r){c(this,"ui");this.ui=r.ui}};var dG="Clear dataset?",EC="vjs-selected-mode",N0="vjs-controls-has-selection",I0="can-undo",M0="can-redo",V0="data-undo",G0="data-redo",Pa="data-mode",$0="data-reset",B0="data-clear",F0="data-zoom-in",U0="data-zoom-out",fC="data-reset-selection",Y0="data-vjs-orientation",z0="0 0 32 30",X0="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",j0="0 0 24 24",H0="M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z",k0="0 0 24 24",W0="M 3.88,20.08 L 3.58,15.46 M 3.58,15.46 L 14.48,0.78 M 14.48,0.78 L 18.25,3.76 M 18.25,3.76 L 7.78,18.2 M 7.7,18.2 L 3.88,20.08 M 3.58,15.46 L 7.76,18.20 M 2,5 V 20.6 M 22,5 V 20.6 M 22,20.6 H 3.94 M 2,5 H 11.2 M 17.6,5 H 22",Z0="0 0 24 24",J0="M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47",K0="0 0 24 24",q0="M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15",Q0="0 0 24 24",ew="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",yC="0 0 32 32",tw="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",rw="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0";function uG(){return`<i class="${sC}" ${EC} ${Pa}="${br}" title="Pan Mode">
|
|
49
|
+
<svg:svg viewBox="${Z0}" stroke="currentColor" fill="none"><svg:path d="${J0}"/></svg:svg>
|
|
50
|
+
</i>`}function pG(){return`<i class="${aC}" ${$0} title="Zoom To Fit">
|
|
51
|
+
<svg:svg viewBox="${z0}" stroke="currentColor" fill="currentColor"><svg:path d="${X0}"/></svg:svg>
|
|
52
|
+
</i>`}function gG(){return`<i class="${lC}" ${F0} title="Zoom In">
|
|
53
|
+
<svg:svg viewBox="${yC}" stroke="currentColor" fill="currentColor">
|
|
54
|
+
<svg:path d="${tw}" fill="none" stroke-width="2"/>
|
|
55
55
|
</svg:svg>
|
|
56
|
-
</i>`}function
|
|
57
|
-
<svg:svg viewBox="${
|
|
58
|
-
<svg:path d="${
|
|
56
|
+
</i>`}function mG(){return`<i class="${hC}" ${U0} title="Zoom Out">
|
|
57
|
+
<svg:svg viewBox="${yC}" stroke="currentColor" fill="currentColor">
|
|
58
|
+
<svg:path d="${rw}" fill="none" stroke-width="2"/>
|
|
59
59
|
</svg:svg>
|
|
60
|
-
</i>`}function
|
|
61
|
-
<svg:svg viewBox="${Z0}" stroke="currentColor" fill="currentColor"><svg:path d="${J0}"/></svg:svg>
|
|
62
|
-
</i>`}function EG(i){return`<i class="${cC}" ${G0} title="${i}">
|
|
60
|
+
</i>`}function EG(){return`<i class="${gC}" ${fC} title="Clear Selection">
|
|
63
61
|
<svg:svg viewBox="${K0}" stroke="currentColor" fill="currentColor"><svg:path d="${q0}"/></svg:svg>
|
|
64
|
-
</i>`}function fG(){return`<i class="${
|
|
65
|
-
<svg:svg
|
|
66
|
-
</i>`}function yG(){return`<i class="${
|
|
62
|
+
</i>`}function fG(i){return`<i class="${uC}" ${B0} title="${i}">
|
|
63
|
+
<svg:svg viewBox="${Q0}" stroke="currentColor" fill="currentColor"><svg:path d="${ew}"/></svg:svg>
|
|
64
|
+
</i>`}function yG(){return`<i class="${ay}" ${Pa}="${Ei}" title="Select Mode">
|
|
67
65
|
<svg:svg fill="currentColor" viewBox="${j0}" stroke="currentColor"><svg:path d="${H0}"/></svg:svg>
|
|
68
|
-
</i>`}
|
|
66
|
+
</i>`}function xG(){return`<i class="${ay}" ${Pa}="${Fn}" title="Vertex Drawing Mode">
|
|
67
|
+
<svg:svg fill="currentColor" viewBox="${k0}" stroke="currentColor"><svg:path d="${W0}"/></svg:svg>
|
|
68
|
+
</i>`}var bG=(i,r,e)=>{let t=`<div ${Y0}="${r.orientation}" class="${Mp}" ${I0}="false" ${M0}="false">`,n=e.filter(u=>u.mode!=null),o=n.map(u=>`<i data-mode="${u.mode}" class="${u.class}" title="${u.title}"></i>`).join(""),s=r.hasLasso||r.hasVertexDrawing||n.length>0?uG():"",a=(r.hasLasso?yG():"")+(r.hasVertexDrawing?xG():""),l=(r.showZoomToExtentsButton?pG():"")+(r.showZoomButtons?gG()+mG():"")+(r.showUndoRedoButtons?`<i class="${cC}" ${V0} title="Undo last action"></i><i class="${dC}" ${G0} title="Redo last action"></i>`:"")+EG()+(r.showClearButton?fG(i):""),h="</div>",d=e.filter(u=>u.mode==null).map(u=>`<i class="${u.class}" title="${u.title}"></i>`).join("");return t+s+a+o+l+d+h},Vp=class{constructor(r,e,t){this.container=r;c(this,"M");c(this,"Ze");c(this,"gh");c(this,"S");c(this,"Eh");c(this,"H");c(this,"cm");c(this,"dm");c(this,"um");c(this,"pm");this.S=e,this.Eh=(t==null?void 0:t.clearMessage)||dG,this.cm=(t==null?void 0:t.clear)!==!1,this.dm=(t==null?void 0:t.undoRedo)!==!1,this.um=(t==null?void 0:t.zoomToExtents)!==!1,this.pm=(t==null?void 0:t.zoom)===!0,this.H=(t==null?void 0:t.orientation)||"row",this.gh=(t==null?void 0:t.buttons)||[],this.M=xr({}),this.fh(),this.ib()}fh(){let r=this.S.getPlugin(Yn.type)!=null,e=this.S.getPlugin(fi.type)!=null,t=bG(this.Eh,{orientation:this.H,showClearButton:this.cm,showUndoRedoButtons:this.dm,hasLasso:r,hasVertexDrawing:e,showZoomToExtentsButton:this.um,showZoomButtons:this.pm},this.gh);this.Ze=this.M.template(G(),{},()=>t).childNodes[0],this.container.replaceChildren(this.Ze)}ib(){this.S.bind(vd,e=>{this.fh()}),this.S.bind(Ub,e=>{this.fh()}),this.S.model.bind(Gs,e=>{this.Ze.setAttribute(I0,e.undoCount>0?Ct:ct),this.Ze.setAttribute(M0,e.redoCount>0?Ct:ct)});let r=()=>{this.S.model.getSelection().isEmpty()?this.Ze.removeAttribute(N0):this.Ze.setAttribute(N0,"true")};this.S.model.bind(Kt,r),this.S.model.bind(qt,r),this.S.model.bind(nr,r),this.S.on(this.container,W,Ae(V0),()=>{this.S.model.undo()}),this.S.on(this.container,W,Ae(G0),()=>{this.S.model.redo()}),this.S.bind(On,e=>{Array.from(this.Ze.querySelectorAll(Ae(Pa))).forEach(t=>{this.S.removeClass(t,EC)}),this.S.addClass(this.S.$getSelector(this.Ze,`[${Pa}='${e}']`),EC)}),this.S.on(this.container,W,Ae(Pa),(e,t)=>{this.S.setMode(t.getAttribute(Pa))}),this.S.on(this.container,W,Ae($0),(e,t)=>{this.S.model.clearSelection(),this.S.zoomToFit()}),this.S.on(this.container,W,Ae(F0),(e,t)=>{this.S.zoomIn()}),this.S.on(this.container,W,Ae(U0),(e,t)=>{this.S.zoomOut()}),this.S.on(this.container,W,Ae(fC),()=>{this.S.model.clearSelection(),BT(this.S)&&this.S.stopEditingPath()}),this.S.on(this.container,W,Ae(B0),(e,t)=>{(this.S.model.getNodeCount()+this.S.model.getGroupCount()===0||confirm(this.Eh))&&this.S.model.clear()}),this.gh.forEach(e=>{this.S.on(this.container,W,z(e.class),(t,n)=>{e.handler&&e.handler(t,e.id)})})}};var Gp="vjs-export-underlay",$p="vjs-export-overlay",Bp="vjs-export-cancel",xC="vjs-export-dimensions",bC="vjs-export-download-tools",Fp="visuallyjs-export",Up="Download",_a={png:"image/png",svg:"image/svg+xml",jpeg:"image/jpeg"},ly="svg",Gh="png",ss="jpg";function AG(i){if(i!=null){if(X(i))return i;{let r=i,e="";for(let t in r){e+=`${t} {
|
|
69
69
|
`;for(let n in r[t])e+=`${n}:${r[t][n]};
|
|
70
70
|
`;e+=`}
|
|
71
|
-
`}return e}}else return null}function _a(i,r){r=r||{};let e=r.margins||{x:50,y:50},t=r.showGrid!==!1,o=i.getContainer().cloneNode(!0);Array.from(o.attributes).forEach(f=>o.removeAttribute(f.name)),o.setAttribute("xmlns",Gt),o.removeAttribute("class"),Array.from(o.querySelectorAll("[data-vjs-noexport]")).forEach(f=>f.parentNode.removeChild(f)),i.model.getGroups().map(f=>i.viewport.getGroupElement(f.id)).forEach(f=>{if(f.collapsed===!0){Ps(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(Ef);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(ju);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(Hu);b&&b.parentNode.removeChild(b)}});let a=o.querySelector(".vjs-vertex-group");Array.from(a.childNodes).forEach(f=>{o.appendChild(f)});let l=o.querySelector(".vjs-edge-group");Array.from(l.childNodes).forEach(f=>{let b=f.getAttribute(Qe);i.getRenderedConnection(b).visible!==!1?o.appendChild(f):f.parentNode.removeChild(f)});let h=i.viewport.getExtents(),d=h.xmax-h.xmin,u=h.ymax-h.ymin,p={x:h.xmin-e.x,width:d+2*e.x,y:h.ymin-e.y,height:u+2*e.y},g=o.querySelector(".vjs-background");if(g!=null)if(t===!1)g.parentNode.removeChild(g);else{let f=i.getGrid();if(f!=null){let b=he(p,f);p.x=b.x,p.y=b.y;let A=he({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}g.setAttribute(ee,`${p.x}`),g.setAttribute(fe,`${p.y}`),g.setAttribute(_e,`${p.width}`),g.setAttribute(Ve,`${p.height}`),g.removeAttribute("transform"),g.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let m=o.querySelector(".vjs-vertex-layer");o.removeChild(m);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([z(Qi),z(eo)].join(","))).forEach(f=>f.parentNode.removeChild(f)),Array.from(o.querySelectorAll("*")).forEach(f=>{Object.values(f.attributes).filter(b=>b.name.indexOf("data-vjs")===0).forEach(b=>f.removeAttribute(b.name)),f.removeAttribute("class"),f.removeAttribute("style"),f.removeAttribute("pointer-events")}),r.width&&o.setAttribute(_e,`${r.width}`),r.height&&o.setAttribute(Ve,`${r.height}`),r.style!=null){let f=M("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=bG(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function AG(i){let e=0,t="",n,o=i.length;for(;e<o;)n=i.subarray(e,Math.min(e+32768,o)),t+=String.fromCodePoint.apply(null,n),e+=32768;return btoa(t)}function tw(i){let r=new TextEncoder().encode(i);return AG(r)}function rw(i){return tw(i.outerHTML)}function xC(i){let r=rw(i);return nw(r)}function nw(i){return`data:image/svg+xml;base64,${i}`}function Up(i,r,e){let t=_a(i,r);ay(t,r,e)}function ay(i,r,e){r=r||{};let t=r.type||"image/png",n=r.quality,o=document.createElement("canvas");o.style.left="-50000px",o.style.top="-50000px",o.style.opacity="0",document.body.appendChild(o);let s=o.getContext("2d"),a=i.extents.width/i.extents.height,l=i.extents.width,h=i.extents.height;r.width?(l=r.width,h=l/a):r.height&&(h=r.height,l=h*a),o.width=l,o.height=h,s.fillStyle="white",s.fillRect(0,0,l,h);let d=new Image;d.onload=()=>{s.drawImage(d,0,0,l,h);let u=o.toDataURL(t,n);o.parentElement.removeChild(o),e({url:u,width:l,height:h,contentType:t,element:i.element})},d.onerror=u=>{U(`VisuallyJs: image export failed to load ${u}`)},i.element.setAttribute(_e,`${l}`),i.element.setAttribute(Ve,`${h}`),d.src=xC(i.element)}var Yp=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=Vp,this.underlay.addEventListener(Ye,e=>{e.target===this.underlay&&this.Ji()}),this.overlay=document.createElement("div"),this.overlay.className=Gp,this.closeButton=document.createElement("div"),this.closeButton.className=$p,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ye,()=>{this.Ji()})}Ji(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=_a(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:Pa.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||Bp,o.innerHTML=r.downloadButtonLabel||Fp,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var Vh=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(Ke),this.underlay.className=Vp,this.underlay.addEventListener(Ye,e=>{e.target===this.underlay&&this.Ji()}),this.overlay=document.createElement(Ke),this.overlay.className=Gp,this.closeButton=document.createElement(Ke),this.closeButton.className=$p,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ye,()=>{this.Ji()})}Ji(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}Jx(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.sm(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=yC,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||Bp,o.innerHTML=r.downloadButtonLabel||Fp,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=fC,r.dimensions.forEach(a=>{let l=document.createElement("option"),h=a.width?Math.floor(a.width/t):a.height,d=a.width?a.width:Math.floor(a.height*t);l.innerHTML=`${d}x${h}`,l.setAttribute(_e,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(_e),10);this.sm(r,h=>{r.onDimensionsChanged&&r.onDimensionsChanged(h.width,h.height,h.url),o.href=h.url},l)}),n.appendChild(s)}document.body.appendChild(this.underlay),document.body.appendChild(this.overlay),r.onShow&&r.onShow(this.overlay,e.width,e.height,e.url)})}export(r){this.Jx(r)}sm(r,e,t){t&&(r.width=t,delete r.height),Up(this.ui,r,e)}};var SG=(i,r,e,t,n)=>{let o=`<div class="${Ip} ${dC}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${sy}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${Mh}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${ss}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},Oa=class{constructor(r,e,t){this.ui=e;c(this,"M");c(this,"Ze");t=t||{};let n=t.showLabel!==!1,o=t.label||"Export :",s=t.allowSvgExport!==!1,a=t.allowPngExport!==!1,l=t.allowJpgExport!==!1,h=SG(n,o,s,a,l);this.M=yr({templates:{component:h}}),this.Ze=this.M.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,g,m,E,y,x;switch(u){case sy:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),g=new Yp(this.ui),g.export(p);break;case Mh:m=t.imageOptions||{},t.margins!=null&&m.margins==null&&Object.assign(m,t.margins),y=new Vh(this.ui),y.export(m);break;case ss:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new Vh(this.ui),x.export(E);break}})}};var Gh="recentColors";var ue={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",VJS_PORT:"vjs-port",DATATYPE:"vjs-datatype",TITLE:"title",FOCUS:"vjs-focus",TYPE:"type",CANCEL:"cancel",ID:"id"},Values:{BLOCK:"block",VISIBLE:"visible",HIDDEN:"hidden",FIXED:"fixed",ABSOLUTE:"absolute",TOP:Te,BOTTOM:ht,X:"x",Y:"y",TRUE:"true",FALSE:"false",NONE:"none",PX:"px"},Events:{RESIZE:"resize",CLICK:"click",KEYUP:"keyup",SCROLL:"scroll"},Elements:{BUTTON:"button",DIV:"div",TEXT:"TEXT",RADIO:"RADIO",CHECKBOX:"CHECKBOX",SELECT:"SELECT",TEXTAREA:"TEXTAREA",COLOR:"COLOR",HIDDEN:"HIDDEN",INPUT:"INPUT",NUMBER:"NUMBER",RANGE:"RANGE"}};var gn=ue.Attributes,iw=ue.Events,we=ue.Elements,TG={[we.TEXT]:i=>i.value,[we.NUMBER]:i=>i.value,[we.RADIO]:i=>{if(i.checked)return i.value},[we.CHECKBOX]:i=>{if(i.checked)return!0},[we.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(gn.MULTIPLE)){let t=[];for(let n=0;n<r.length;n++)t.push(r[n].value);return t}else return i.selectedIndex!==-1?i.options[i.selectedIndex].value:null},[we.TEXTAREA]:i=>i.value,[we.COLOR]:i=>i.value,[we.HIDDEN]:i=>i.value};function vG(i,r){let e=i.querySelectorAll(Ae(gn.VJS)),t={};for(let n=0;n<e.length;n++){let o=ow(e[n],r);if(o!=null){let s=e[n].getAttribute(gn.VJS),a=De(t,s);a!=null?(Array.isArray(a)||(a=[a],De(t,s,a)),a.push(o)):De(t,s,o)}}return t}var CG={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function zp(i,r){if(r==null)return i;try{return CG[r](i)}catch(e){return i}}function ow(i,r){let e=i.tagName.toUpperCase(),t=e===we.INPUT?(i.getAttribute(gn.TYPE)||we.TEXT).toUpperCase():e,n=TG[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(gn.DATATYPE);s!=null&&(o=zp(o,s))}}else r!=null&&(o=r(i));return o}function as(i,r,e){return e==null||e.length===0?i:`${e}${r}${i}`}function bC(i,r,e,t){let n=r.querySelectorAll(Ae(gn.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=n[o].getAttribute(gn.VJS_PORT),l=s===we.INPUT?(n[o].getAttribute(gn.TYPE)||we.TEXT).toUpperCase():s,h=n[o].getAttribute(gn.VJS),d=as(h,e,a),u=i[d],p=_G[l];if(p!=null)p(n[o],u);else continue;t!=null&&n[o].getAttribute(gn.VJS_COMMIT)&&(s===we.INPUT?n[o].addEventListener(iw.KEYUP,g=>{(g.keyCode===10||g.keyCode===13)&&t(n[o])}):s===we.TEXTAREA&&n[o].addEventListener(iw.KEYUP,g=>{g.ctrlKey&&(g.keyCode===10||g.keyCode===13)&&t(n[o])}))}}function PG(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===we.INPUT?(i[e].getAttribute(gn.TYPE)||we.TEXT).toUpperCase():t,o=OG[n];o&&o(i[e])}}var _G={[we.TEXT]:(i,r)=>{i.value=r||""},[we.NUMBER]:(i,r)=>{i.value=r||""},[we.RADIO]:(i,r)=>{i.checked=i.value==r},[we.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[we.SELECT]:(i,r)=>{if(r==null){i.selectedIndex=-1;for(let e=0;e<i.options.length;e++)i.options[e].selected=!1}else{let e=i.getAttribute(gn.MULTIPLE);for(let t=0;t<i.options.length;t++)if(e)r.indexOf(i.options[t].value)>-1&&(i.options[t].selected=!0);else if(i.options[t].value==r){i.selectedIndex=t;return}}},[we.TEXTAREA]:(i,r)=>{i.value=r||""},[we.COLOR]:(i,r)=>{i.value=r||""},[we.HIDDEN]:(i,r)=>{i.value=r||""}},OG={[we.TEXT]:i=>{i.value=""},[we.RADIO]:i=>{i.checked=!1},[we.CHECKBOX]:i=>{i.checked=!1},[we.SELECT]:i=>{i.selectedIndex=-1},[we.TEXTAREA]:i=>{i.value=""},[we.COLOR]:i=>{i.value=""},[we.HIDDEN]:i=>{i.value=""}};var sw="input",aw="blur",lw="keypress",AC="vjs-inspector-active",Xp="vjs-inspector-inactive",hw="vjs-inspector",SC="vjs-inspector-close",jp="change",Hp=class extends cu{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"am");c(this,"lm",[]);c(this,"Cr",[]);c(this,"ph");c(this,"mh");c(this,"hm");c(this,"Yt");c(this,"gh");c(this,"Pr",!1);c(this,"bt",new Map);c(this,"current",[]);c(this,"At",{});c(this,"mt");c(this,"$getDefaultValue");c(this,"Eh");c(this,"$eventManager");c(this,"um",()=>{this.$_recomputeCommonData(),bC(this.At,this.container,this.model.portSeparator);let e=this.container.querySelectorAll(Ae(ue.Attributes.FOCUS))[0];e!=null&&e.focus(),this.Eh&&this.dm(),this.fire(jp,this.At)});this.$eventManager=new ye,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new ye,this.am=e.multipleSelections!==!1,this.gh=e.afterUpdate,this.hm=e.renderEmptyContainer,this.Yt=e.refresh,this.ph=e.autoCommit!==!1,this.mh=e.doNotWriteBlankNewValues!==!1,this.mt=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.Eh=e.showCloseButton===!0,this.ensureContext(Gh,()=>[]),this.container.classList.add(hw),this.container.classList.add(Xp),this.Kx(),this.$ui.registerDataHook({load:t=>{let n=De(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Gh,n.recentColors.slice())},save:t=>{De(t,"inspectorContext",this.$context)}})}Kx(){this.model.bind(Kt,h=>{this.isSuspendEvents()||this.fh(h.obj)}),this.model.bind(qt,h=>{this.rt(h.obj)}),this.model.bind(Ce,h=>{this.rt(h.node)}),this.model.bind(Oe,h=>{this.rt(h.group)}),this.model.bind(Mr,h=>{this.rt(h.port)}),this.model.bind(bt,h=>{this.rt(h.edge)}),this.model.bind(nr,()=>{this.ph&&Array.from(this.bt.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue,d[1].portId),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Vs,h=>{this.isSuspendEvents()||(this.Pr=!0,this.fh(),this.Pr=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Re,e),this.model.bind(ve,e),this.model.bind(lr,t),this.model.bind(xt,n);let o=h=>{this.Pr||setTimeout(()=>{let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=as(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let m=this.bt.get(g);if(m!=null&&(!m.common||m.edited)){let E=d.value;this.setValue(u,E,p),m.edited=!1,delete m.editedValue}}},0)};this.container.addEventListener(aw,o,!0);let s=h=>{if(!this.Pr){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(ue.Attributes.VJS),g=d.getAttribute(ue.Attributes.VJS_PORT),m=as(p,this.model.portSeparator,g);if(p!=null)if(u===ue.Elements.CHECKBOX){let E=this.At[m],y=g==null?this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}']`):this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}'][${ue.Attributes.VJS_PORT}='${g}']`);if(Array.isArray(E)||E==null&&y.length>1){let f=[];y.forEach(b=>{b.checked&&f.push(b.value)}),this.setValue(p,f,g)}else this.setValue(p,d.checked===!0,g)}else if(u===ue.Elements.RADIO)d.checked&&this.setValue(p,zp(d.value,d.getAttribute(ue.Attributes.DATATYPE)),g);else if(u===ue.Elements.COLOR||u===ue.Elements.NUMBER||u===ue.Elements.RANGE)this.setValue(p,d.value,g);else if(u===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA){let E=this.bt.get(m);E.edited=!0,E.editedValue=d.value}else d.tagName.toUpperCase()===ue.Elements.SELECT&&this.setValue(p,zp(d.value,d.getAttribute(ue.Attributes.DATATYPE)),g)}};this.container.addEventListener(jp,s,!0);let a=h=>{if(!this.Pr){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=as(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let m=this.bt.get(g);m.edited=!0,m.editedValue=d.value}}};this.container.addEventListener(sw,a,!0);let l=h=>{if(!this.Pr){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=as(u,this.model.portSeparator,p);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let m=this.bt.get(g);m.edited=!0,this.setValue(u,d.value,p)}}};this.container.addEventListener(lw,l,!0),this.$ui.bind(Ii,()=>{this.container.removeEventListener(lw,l),this.container.removeEventListener(jp,s),this.container.removeEventListener(aw,o),this.container.removeEventListener(sw,a),this.model.unbind(Re,e),this.model.unbind(ve,e),this.model.unbind(lr,e),this.model.unbind(xt,n),this.qx()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.fh(e))}}$_recomputeCommonData(){this.At={};let e={},t=new Set;this.current.forEach(n=>{Object.keys(n.data).forEach(o=>t.add(o)),(Y(n)||J(n))&&n.getPorts().forEach(o=>{Object.keys(o.data).forEach(s=>t.add(`${o.id}${this.model.portSeparator}${s}`))})}),this.bt.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n],s=Y(o)||J(o);t.forEach(a=>{var l;if(!e[a]){let h=o.data,d=a;if(s){let p=a.split(this.model.portSeparator);d=p[p.length-1],p.length===2&&(h=((l=o.getPort(p[0]))==null?void 0:l.data)||{})}let u=h[d];u==null&&this.$getDefaultValue!=null&&(u=this.$getDefaultValue(h,d)),this.At[a]==null?this.At[a]=u:this.At[a]!==u&&(e[a]=!0,this.At[a]="")}})}for(let n in e){let o=this.bt.get(n);o!=null&&(o.common=!0,o.commonValue=this.At[n])}}Qx(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}cm(e){this.setSuspendEvents(!0);let t=0;try{this.model.openTransaction();try{e.forEach(n=>{let o=this.mh?new Map(Object.entries(n.updates).filter(s=>typeof s[1]=="string"&&s[1].length===0)):null;this.current.forEach((s,a)=>{let l=n.portId==null?s:s.getPort(n.portId);if(this.mh){let h=this.Qx(n.updates,l.data,o);Object.keys(h).length>0&&(this.model.update(l,h),t++)}else this.model.update(l,n.updates),t++})})}catch(n){U("WARN: error occurred updating item from inspector")}t>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.gh&&this.gh()}finally{this.setSuspendEvents(!1)}}eb(e){this.ph?this.cm([e]):this.Cr.push(e)}reset(e){try{this.Pr=!0,this.Cr.length=0,this.container.classList.remove(AC),this.container.classList.add(Xp),e||(this.hm(),this.current.length=0,this.Eh&&this.dm())}finally{this.Pr=!1}}qx(){this.current.length=0,this.Cr.length=0,this.bt.clear(),this.container.innerHTML=""}rt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(J(e)||Y(e))&&(t=this.current.findIndex(n=>j(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}dm(){if(!this.container.querySelector(z(SC))){let e=document.createElement(Ke);e.classList.add(SC),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}fh(e){if(e!=null&&!this.mt(e))return;let t=!this.am||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(Xp),this.container.classList.add(AC),this.Cr.length=0,this.current.push(e),t?this.Yt(e,()=>this.$refresh()):this.um()):this.container.classList.add(Xp)}$refresh(){this.bt.clear(),this.container.querySelectorAll(Ae(ue.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(ue.Attributes.VJS),o=t.getAttribute(ue.Attributes.VJS_PORT),s=as(n,this.model.portSeparator,o);this.bt.set(s,{field:t,edited:!1,common:!1,commonValue:null,attribute:n,portId:o})}),this.um()}addValueListener(e){this.lm.push(e)}setValue(e,t,n,o){this.eb({portId:n,updates:{[e]:t}}),this.lm.forEach(s=>s(e,t)),o&&this.redraw()}tb(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.At[e]}onChange(e){this.bind(jp,e)}persist(){let e=this.Cr.length;return e>0&&(this.cm(this.Cr),this.Cr.length=0),e}hasPendingChanges(){return this.Cr.length!==0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var cw="vjs-color-picker",TC="vjs-color-picker-swatches",vC="vjs-color-picker-swatch",dw="vjs-color",uw="vjs-max-colors";function CC(i,r=Gh){i.registerTag(dw,{template:`<div class="${cw}">
|
|
71
|
+
`}return e}}else return null}function Oa(i,r){r=r||{};let e=r.margins||{x:50,y:50},t=r.showGrid!==!1,o=i.getContainer().cloneNode(!0);Array.from(o.attributes).forEach(f=>o.removeAttribute(f.name)),o.setAttribute("xmlns",Gt),o.removeAttribute("class"),Array.from(o.querySelectorAll("[data-vjs-noexport]")).forEach(f=>f.parentNode.removeChild(f)),i.model.getGroups().map(f=>i.viewport.getGroupElement(f.id)).forEach(f=>{if(f.collapsed===!0){Ps(f.modelObject).forEach(T=>{let S=o.querySelector(`[data-vjs-vertex='${T.id}']`);S&&S.parentNode.removeChild(S)});let b=f.el.querySelector(yf);b&&b.parentNode.removeChild(b);let A=f.el.querySelector(Hu);A&&A.parentNode.removeChild(A)}else{let b=f.el.querySelector(ku);b&&b.parentNode.removeChild(b)}});let a=o.querySelector(".vjs-vertex-group");Array.from(a.childNodes).forEach(f=>{o.appendChild(f)});let l=o.querySelector(".vjs-edge-group");Array.from(l.childNodes).forEach(f=>{let b=f.getAttribute(et);i.getRenderedConnection(b).visible!==!1?o.appendChild(f):f.parentNode.removeChild(f)});let h=i.viewport.getExtents(),d=h.xmax-h.xmin,u=h.ymax-h.ymin,p={x:h.xmin-e.x,width:d+2*e.x,y:h.ymin-e.y,height:u+2*e.y},g=o.querySelector(".vjs-background");if(g!=null)if(t===!1)g.parentNode.removeChild(g);else{let f=i.getGrid();if(f!=null){let b=he(p,f);p.x=b.x,p.y=b.y;let A=he({x:p.x+p.width,y:p.y+p.height},f);p.width=A.x-p.x,p.height=A.y-p.y}g.setAttribute(ee,`${p.x}`),g.setAttribute(fe,`${p.y}`),g.setAttribute(_e,`${p.width}`),g.setAttribute(Ve,`${p.height}`),g.removeAttribute("transform"),g.removeAttribute("viewBox")}o.setAttribute("viewBox",`${p.x} ${p.y} ${p.width} ${p.height}`);let m=o.querySelector(".vjs-vertex-layer");o.removeChild(m);let E=o.querySelector(".vjs-tools-layer");if(E!=null&&o.removeChild(E),Array.from(o.querySelectorAll([z(Qi),z(eo)].join(","))).forEach(f=>f.parentNode.removeChild(f)),Array.from(o.querySelectorAll("*")).forEach(f=>{Object.values(f.attributes).filter(b=>b.name.indexOf("data-vjs")===0).forEach(b=>f.removeAttribute(b.name)),f.removeAttribute("class"),f.removeAttribute("style"),f.removeAttribute("pointer-events")}),r.width&&o.setAttribute(_e,`${r.width}`),r.height&&o.setAttribute(Ve,`${r.height}`),r.style!=null){let f=M("style");o.insertBefore(f,o.childNodes[0]),f.innerHTML=AG(r.style)}return{element:o,extents:p,svg:o.outerHTML.replace(/\n/g,"")}}function SG(i){let e=0,t="",n,o=i.length;for(;e<o;)n=i.subarray(e,Math.min(e+32768,o)),t+=String.fromCodePoint.apply(null,n),e+=32768;return btoa(t)}function nw(i){let r=new TextEncoder().encode(i);return SG(r)}function iw(i){return nw(i.outerHTML)}function AC(i){let r=iw(i);return ow(r)}function ow(i){return`data:image/svg+xml;base64,${i}`}function Yp(i,r,e){let t=Oa(i,r);hy(t,r,e)}function hy(i,r,e){r=r||{};let t=r.type||"image/png",n=r.quality,o=document.createElement("canvas");o.style.left="-50000px",o.style.top="-50000px",o.style.opacity="0",document.body.appendChild(o);let s=o.getContext("2d"),a=i.extents.width/i.extents.height,l=i.extents.width,h=i.extents.height;r.width?(l=r.width,h=l/a):r.height&&(h=r.height,l=h*a),o.width=l,o.height=h,s.fillStyle="white",s.fillRect(0,0,l,h);let d=new Image;d.onload=()=>{s.drawImage(d,0,0,l,h);let u=o.toDataURL(t,n);o.parentElement.removeChild(o),e({url:u,width:l,height:h,contentType:t,element:i.element})},d.onerror=u=>{U(`VisuallyJs: image export failed to load ${u}`)},i.element.setAttribute(_e,`${l}`),i.element.setAttribute(Ve,`${h}`),d.src=AC(i.element)}var zp=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement("div"),this.underlay.className=Gp,this.underlay.addEventListener(Ye,e=>{e.target===this.underlay&&this.Qi()}),this.overlay=document.createElement("div"),this.overlay.className=$p,this.closeButton=document.createElement("div"),this.closeButton.className=Bp,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ye,()=>{this.Qi()})}Qi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}export(r){r=r||{};let e=Oa(this.ui,r);this.overlay.appendChild(e.element);let t=new Blob([e.svg],{type:_a.svg}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download=r.filename||Fp,o.innerHTML=r.downloadButtonLabel||Up,this.overlay.appendChild(o),document.body.appendChild(this.underlay),document.body.appendChild(this.overlay)}};var $h=class{constructor(r){this.ui=r;c(this,"underlay");c(this,"overlay");c(this,"closeButton");this.underlay=document.createElement(qe),this.underlay.className=Gp,this.underlay.addEventListener(Ye,e=>{e.target===this.underlay&&this.Qi()}),this.overlay=document.createElement(qe),this.overlay.className=$p,this.closeButton=document.createElement(qe),this.closeButton.className=Bp,this.overlay.appendChild(this.closeButton),this.closeButton.addEventListener(Ye,()=>{this.Qi()})}Qi(){this.underlay.parentNode.removeChild(this.underlay),this.overlay.parentNode.removeChild(this.overlay)}ob(r){r=Object.assign({},r||{}),r.dimensions&&Object.assign(r,r.dimensions[0]),this.mm(r,e=>{this.overlay.appendChild(e.element);let t=e.width/e.height,n=document.createElement("div");n.className=bC,this.overlay.appendChild(n);let o=document.createElement("a");if(o.href=e.url,o.download=r.filename||Fp,o.innerHTML=r.downloadButtonLabel||Up,n.appendChild(o),r.dimensions){let s=document.createElement("select");s.className=xC,r.dimensions.forEach(a=>{let l=document.createElement("option"),h=a.width?Math.floor(a.width/t):a.height,d=a.width?a.width:Math.floor(a.height*t);l.innerHTML=`${d}x${h}`,l.setAttribute(_e,`${d}`),l.value=`${d}`,s.appendChild(l)}),s.addEventListener("change",()=>{let a=s.options[s.selectedIndex],l=parseInt(a.getAttribute(_e),10);this.mm(r,h=>{r.onDimensionsChanged&&r.onDimensionsChanged(h.width,h.height,h.url),o.href=h.url},l)}),n.appendChild(s)}document.body.appendChild(this.underlay),document.body.appendChild(this.overlay),r.onShow&&r.onShow(this.overlay,e.width,e.height,e.url)})}export(r){this.ob(r)}mm(r,e,t){t&&(r.width=t,delete r.height),Yp(this.ui,r,e)}};var TG=(i,r,e,t,n)=>{let o=`<div class="${Mp} ${pC}">`,s=i?`<span>${r}</span>`:"",a=e?`<i><a href="#" data-type="${ly}">SVG</a></i>`:"",l=t?`<i><a href="#" data-type="${Gh}">PNG</a></i>`:"",h=n?`<i><a href="#" data-type="${ss}">JPG</a></i>`:"";return o+s+a+l+h+"</div>"},Ra=class{constructor(r,e,t){this.ui=e;c(this,"M");c(this,"Ze");t=t||{};let n=t.showLabel!==!1,o=t.label||"Export :",s=t.allowSvgExport!==!1,a=t.allowPngExport!==!1,l=t.allowJpgExport!==!1,h=TG(n,o,s,a,l);this.M=xr({templates:{component:h}}),this.Ze=this.M.template("component",{}).childNodes[0],r.replaceChildren(this.Ze),this.ui.on(this.Ze,W,"a",d=>{let u=d.target.dataset.type,p,g,m,E,y,x;switch(u){case ly:p=t.svgOptions||{},t.margins!=null&&p.margins==null&&Object.assign(p,t.margins),g=new zp(this.ui),g.export(p);break;case Gh:m=t.imageOptions||{},t.margins!=null&&m.margins==null&&Object.assign(m,t.margins),y=new $h(this.ui),y.export(m);break;case ss:E=t.imageOptions||{},t.margins!=null&&E.margins==null&&Object.assign(E,t.margins),E.type="image/jpeg",x=new $h(this.ui),x.export(E);break}})}};var Bh="recentColors";var ue={Attributes:{POSITION:"data-position",AXIS:"data-axis",VJS_CANCEL:"vjs-cancel",VJS_COMMIT:"vjs-commit",MULTIPLE:"multiple",VJS:"vjs-att",VJS_PORT:"vjs-port",DATATYPE:"vjs-datatype",TITLE:"title",FOCUS:"vjs-focus",TYPE:"type",CANCEL:"cancel",ID:"id"},Values:{BLOCK:"block",VISIBLE:"visible",HIDDEN:"hidden",FIXED:"fixed",ABSOLUTE:"absolute",TOP:Te,BOTTOM:ht,X:"x",Y:"y",TRUE:"true",FALSE:"false",NONE:"none",PX:"px"},Events:{RESIZE:"resize",CLICK:"click",KEYUP:"keyup",SCROLL:"scroll"},Elements:{BUTTON:"button",DIV:"div",TEXT:"TEXT",RADIO:"RADIO",CHECKBOX:"CHECKBOX",SELECT:"SELECT",TEXTAREA:"TEXTAREA",COLOR:"COLOR",HIDDEN:"HIDDEN",INPUT:"INPUT",NUMBER:"NUMBER",RANGE:"RANGE"}};var En=ue.Attributes,sw=ue.Events,we=ue.Elements,vG={[we.TEXT]:i=>i.value,[we.NUMBER]:i=>i.value,[we.RADIO]:i=>{if(i.checked)return i.value},[we.CHECKBOX]:i=>{if(i.checked)return!0},[we.SELECT]:i=>{let r=i.selectedOptions;if(i.getAttribute(En.MULTIPLE)){let t=[];for(let n=0;n<r.length;n++)t.push(r[n].value);return t}else return i.selectedIndex!==-1?i.options[i.selectedIndex].value:null},[we.TEXTAREA]:i=>i.value,[we.COLOR]:i=>i.value,[we.HIDDEN]:i=>i.value};function CG(i,r){let e=i.querySelectorAll(Ae(En.VJS)),t={};for(let n=0;n<e.length;n++){let o=aw(e[n],r);if(o!=null){let s=e[n].getAttribute(En.VJS),a=De(t,s);a!=null?(Array.isArray(a)||(a=[a],De(t,s,a)),a.push(o)):De(t,s,o)}}return t}var PG={integer:i=>parseInt(i,10),float:i=>parseFloat(i)};function Xp(i,r){if(r==null)return i;try{return PG[r](i)}catch(e){return i}}function aw(i,r){let e=i.tagName.toUpperCase(),t=e===we.INPUT?(i.getAttribute(En.TYPE)||we.TEXT).toUpperCase():e,n=vG[t],o;if(n!=null){if(o=n(i),o!=null){let s=i.getAttribute(En.DATATYPE);s!=null&&(o=Xp(o,s))}}else r!=null&&(o=r(i));return o}function as(i,r,e){return e==null||e.length===0?i:`${e}${r}${i}`}function SC(i,r,e,t){let n=r.querySelectorAll(Ae(En.VJS));for(let o=0;o<n.length;o++){let s=n[o].tagName.toUpperCase(),a=n[o].getAttribute(En.VJS_PORT),l=s===we.INPUT?(n[o].getAttribute(En.TYPE)||we.TEXT).toUpperCase():s,h=n[o].getAttribute(En.VJS),d=as(h,e,a),u=i[d],p=OG[l];if(p!=null)p(n[o],u);else continue;t!=null&&n[o].getAttribute(En.VJS_COMMIT)&&(s===we.INPUT?n[o].addEventListener(sw.KEYUP,g=>{(g.keyCode===10||g.keyCode===13)&&t(n[o])}):s===we.TEXTAREA&&n[o].addEventListener(sw.KEYUP,g=>{g.ctrlKey&&(g.keyCode===10||g.keyCode===13)&&t(n[o])}))}}function _G(i,r){for(let e=0;e<i.length;e++){if(i[e]===r)continue;let t=i[e].tagName.toUpperCase(),n=t===we.INPUT?(i[e].getAttribute(En.TYPE)||we.TEXT).toUpperCase():t,o=RG[n];o&&o(i[e])}}var OG={[we.TEXT]:(i,r)=>{i.value=r||""},[we.NUMBER]:(i,r)=>{i.value=r||""},[we.RADIO]:(i,r)=>{i.checked=i.value==r},[we.CHECKBOX]:(i,r)=>{Array.isArray(r)?i.checked=r.indexOf(i.value)!==-1:i.checked=r===!0||r==="true"},[we.SELECT]:(i,r)=>{if(r==null){i.selectedIndex=-1;for(let e=0;e<i.options.length;e++)i.options[e].selected=!1}else{let e=i.getAttribute(En.MULTIPLE);for(let t=0;t<i.options.length;t++)if(e)r.indexOf(i.options[t].value)>-1&&(i.options[t].selected=!0);else if(i.options[t].value==r){i.selectedIndex=t;return}}},[we.TEXTAREA]:(i,r)=>{i.value=r||""},[we.COLOR]:(i,r)=>{i.value=r||""},[we.HIDDEN]:(i,r)=>{i.value=r||""}},RG={[we.TEXT]:i=>{i.value=""},[we.RADIO]:i=>{i.checked=!1},[we.CHECKBOX]:i=>{i.checked=!1},[we.SELECT]:i=>{i.selectedIndex=-1},[we.TEXTAREA]:i=>{i.value=""},[we.COLOR]:i=>{i.value=""},[we.HIDDEN]:i=>{i.value=""}};var lw="input",hw="blur",cw="keypress",TC="vjs-inspector-active",jp="vjs-inspector-inactive",dw="vjs-inspector",vC="vjs-inspector-close",Hp="change",kp=class extends du{constructor(e){super(e.context);c(this,"container");c(this,"$ui");c(this,"model");c(this,"eventManager");c(this,"gm");c(this,"Em",[]);c(this,"Or",[]);c(this,"yh");c(this,"xh");c(this,"fm");c(this,"Xt");c(this,"bh");c(this,"_r",!1);c(this,"At",new Map);c(this,"current",[]);c(this,"St",{});c(this,"mt");c(this,"$getDefaultValue");c(this,"Ah");c(this,"$eventManager");c(this,"bm",()=>{this.$_recomputeCommonData(),SC(this.St,this.container,this.model.portSeparator);let e=this.container.querySelectorAll(Ae(ue.Attributes.FOCUS))[0];e!=null&&e.focus(),this.Ah&&this.xm(),this.fire(Hp,this.St)});this.$eventManager=new ye,this.container=e.container,this.$ui=e.ui,this.model=this.$ui.model,this.eventManager=new ye,this.gm=e.multipleSelections!==!1,this.bh=e.afterUpdate,this.fm=e.renderEmptyContainer,this.Xt=e.refresh,this.yh=e.autoCommit!==!1,this.xh=e.doNotWriteBlankNewValues!==!1,this.mt=e.filter||(t=>!0),this.$getDefaultValue=e.getDefaultValue||((t,n)=>null),this.Ah=e.showCloseButton===!0,this.ensureContext(Bh,()=>[]),this.container.classList.add(dw),this.container.classList.add(jp),this.sb(),this.$ui.registerDataHook({load:t=>{let n=De(t,"inspectorContext");n!=null&&n.recentColors!=null&&this.updateContext(Bh,n.recentColors.slice())},save:t=>{De(t,"inspectorContext",this.$context)}})}sb(){this.model.bind(Kt,h=>{this.isSuspendEvents()||this.Sh(h.obj)}),this.model.bind(qt,h=>{this.rt(h.obj)}),this.model.bind(Ce,h=>{this.rt(h.node)}),this.model.bind(Oe,h=>{this.rt(h.group)}),this.model.bind(Gr,h=>{this.rt(h.port)}),this.model.bind(bt,h=>{this.rt(h.edge)}),this.model.bind(nr,()=>{this.yh&&Array.from(this.At.entries()).filter(d=>d[1].edited&&d[1].editedValue!=null).forEach(d=>{this.setValue(d[0],d[1].editedValue,d[1].portId),delete d[1].editedValue}),this.reset(!1)}),this.model.bind(Gs,h=>{this.isSuspendEvents()||(this._r=!0,this.Sh(),this._r=!1)});let e=h=>{this.$updateObject(h.vertex)},t=h=>{this.$updateObject(h.port)},n=h=>{this.$updateObject(h.edge)};this.model.bind(Re,e),this.model.bind(ve,e),this.model.bind(hr,t),this.model.bind(xt,n);let o=h=>{this._r||setTimeout(()=>{let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=as(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)&&(d.checkValidity==null||d.checkValidity())){let m=this.At.get(g);if(m!=null&&(!m.common||m.edited)){let E=d.value;this.setValue(u,E,p),m.edited=!1,delete m.editedValue}}},0)};this.container.addEventListener(hw,o,!0);let s=h=>{if(!this._r){let d=h.target,u=d.type.toUpperCase(),p=d.getAttribute(ue.Attributes.VJS),g=d.getAttribute(ue.Attributes.VJS_PORT),m=as(p,this.model.portSeparator,g);if(p!=null)if(u===ue.Elements.CHECKBOX){let E=this.St[m],y=g==null?this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}']`):this.container.querySelectorAll(`input[type='checkbox'][${ue.Attributes.VJS}='${p}'][${ue.Attributes.VJS_PORT}='${g}']`);if(Array.isArray(E)||E==null&&y.length>1){let f=[];y.forEach(b=>{b.checked&&f.push(b.value)}),this.setValue(p,f,g)}else this.setValue(p,d.checked===!0,g)}else if(u===ue.Elements.RADIO)d.checked&&this.setValue(p,Xp(d.value,d.getAttribute(ue.Attributes.DATATYPE)),g);else if(u===ue.Elements.COLOR||u===ue.Elements.NUMBER||u===ue.Elements.RANGE)this.setValue(p,d.value,g);else if(u===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA){let E=this.At.get(m);E.edited=!0,E.editedValue=d.value}else d.tagName.toUpperCase()===ue.Elements.SELECT&&this.setValue(p,Xp(d.value,d.getAttribute(ue.Attributes.DATATYPE)),g)}};this.container.addEventListener(Hp,s,!0);let a=h=>{if(!this._r){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=as(u,this.model.portSeparator,p);if(u!=null&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let m=this.At.get(g);m.edited=!0,m.editedValue=d.value}}};this.container.addEventListener(lw,a,!0);let l=h=>{if(!this._r){let d=h.target,u=d.getAttribute(ue.Attributes.VJS),p=d.getAttribute(ue.Attributes.VJS_PORT),g=as(u,this.model.portSeparator,p);if(u!=null&&(h.keyCode===13||h.key==="13")&&(d.type.toUpperCase()===ue.Elements.TEXT||d.tagName.toUpperCase()===ue.Elements.TEXTAREA)){let m=this.At.get(g);m.edited=!0,this.setValue(u,d.value,p)}}};this.container.addEventListener(cw,l,!0),this.$ui.bind(Ii,()=>{this.container.removeEventListener(cw,l),this.container.removeEventListener(Hp,s),this.container.removeEventListener(hw,o),this.container.removeEventListener(lw,a),this.model.unbind(Re,e),this.model.unbind(ve,e),this.model.unbind(hr,e),this.model.unbind(xt,n),this.ab()})}$updateObject(e){if(!this.isSuspendEvents()){let t=this.current.findIndex(n=>n===e);t!==-1&&(this.current.splice(t,1),this.Sh(e))}}$_recomputeCommonData(){this.St={};let e={},t=new Set;this.current.forEach(n=>{Object.keys(n.data).forEach(o=>t.add(o)),(Y(n)||J(n))&&n.getPorts().forEach(o=>{Object.keys(o.data).forEach(s=>t.add(`${o.id}${this.model.portSeparator}${s}`))})}),this.At.forEach((n,o)=>t.add(o));for(let n=0;n<this.current.length;n++){let o=this.current[n],s=Y(o)||J(o);t.forEach(a=>{var l;if(!e[a]){let h=o.data,d=a;if(s){let p=a.split(this.model.portSeparator);d=p[p.length-1],p.length===2&&(h=((l=o.getPort(p[0]))==null?void 0:l.data)||{})}let u=h[d];u==null&&this.$getDefaultValue!=null&&(u=this.$getDefaultValue(h,d)),this.St[a]==null?this.St[a]=u:this.St[a]!==u&&(e[a]=!0,this.St[a]="")}})}for(let n in e){let o=this.At.get(n);o!=null&&(o.common=!0,o.commonValue=this.St[n])}}lb(e,t,n){let o={};for(let s in e)n.has(s)?t[s]!=null&&(o[s]=""):o[s]=e[s];return o}ym(e){this.setSuspendEvents(!0);let t=0;try{this.model.openTransaction();try{e.forEach(n=>{let o=this.xh?new Map(Object.entries(n.updates).filter(s=>typeof s[1]=="string"&&s[1].length===0)):null;this.current.forEach((s,a)=>{let l=n.portId==null?s:s.getPort(n.portId);if(this.xh){let h=this.lb(n.updates,l.data,o);Object.keys(h).length>0&&(this.model.update(l,h),t++)}else this.model.update(l,n.updates),t++})})}catch(n){U("WARN: error occurred updating item from inspector")}t>0?this.model.commitTransaction():this.model.rollbackTransaction(),this.bh&&this.bh()}finally{this.setSuspendEvents(!1)}}hb(e){this.yh?this.ym([e]):this.Or.push(e)}reset(e){try{this._r=!0,this.Or.length=0,this.container.classList.remove(TC),this.container.classList.add(jp),e||(this.fm(),this.current.length=0,this.Ah&&this.xm())}finally{this._r=!1}}ab(){this.current.length=0,this.Or.length=0,this.At.clear(),this.container.innerHTML=""}rt(e){let t=this.current.indexOf(e);t!==-1?this.current.splice(t,1):(J(e)||Y(e))&&(t=this.current.findIndex(n=>j(n)&&n.getParent().id===e.id),t!==-1&&this.current.splice(t,1)),this.current.length===0?this.reset(!1):this.$_recomputeCommonData()}xm(){if(!this.container.querySelector(z(vC))){let e=document.createElement(qe);e.classList.add(vC),this.container.insertBefore(e,null),this.$eventManager.on(e,W,()=>this.model.clearSelection())}}Sh(e){if(e!=null&&!this.mt(e))return;let t=!this.gm||this.current.length===0;t&&this.reset(!0),e!=null?(this.container.classList.remove(jp),this.container.classList.add(TC),this.Or.length=0,this.current.push(e),t?this.Xt(e,()=>this.$refresh()):this.bm()):this.container.classList.add(jp)}$refresh(){this.At.clear(),this.container.querySelectorAll(Ae(ue.Attributes.VJS)).forEach(t=>{let n=t.getAttribute(ue.Attributes.VJS),o=t.getAttribute(ue.Attributes.VJS_PORT),s=as(n,this.model.portSeparator,o);this.At.set(s,{field:t,edited:!1,common:!1,commonValue:null,attribute:n,portId:o})}),this.bm()}addValueListener(e){this.Em.push(e)}setValue(e,t,n,o){this.hb({portId:n,updates:{[e]:t}}),this.Em.forEach(s=>s(e,t)),o&&this.redraw()}cb(e,t){return this.$getDefaultValue(e,t)}getValue(e){return this.St[e]}onChange(e){this.bind(Hp,e)}persist(){let e=this.Or.length;return e>0&&(this.ym(this.Or),this.Or.length=0),e}hasPendingChanges(){return this.Or.length!==0}redraw(){this.current.forEach(e=>this.$updateObject(e))}};var uw="vjs-color-picker",CC="vjs-color-picker-swatches",PC="vjs-color-picker-swatch",pw="vjs-color",gw="vjs-max-colors";function _C(i,r=Bh){i.registerTag(pw,{template:`<div class="${uw}">
|
|
72
72
|
<input type="color"/>
|
|
73
|
-
<div class="${
|
|
73
|
+
<div class="${CC}">
|
|
74
74
|
<r-each in="$context.${r}">
|
|
75
|
-
<div class="${
|
|
75
|
+
<div class="${PC}" style="background-color:{{$value}};" data-color="{{$value}}"/>
|
|
76
76
|
</r-each>
|
|
77
77
|
</div>
|
|
78
|
-
</div>`,rendered:(e,t,n,o,s)=>{function a(g){let m=s[r];if(m!=null&&m.find(E=>E===g)==null){let E=m.slice();return E.unshift(g),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(ue.Attributes.VJS),h=new ye,d=e.querySelector("[type='color']"),u=e.getAttribute(
|
|
78
|
+
</div>`,rendered:(e,t,n,o,s)=>{function a(g){let m=s[r];if(m!=null&&m.find(E=>E===g)==null){let E=m.slice();return E.unshift(g),E.length>=u&&(E.length=u),i.updateContext(r,E),!0}return!1}let l=e.getAttribute(ue.Attributes.VJS),h=new ye,d=e.querySelector("[type='color']"),u=e.getAttribute(gw)||10;i.bind(Cl,g=>{let m=e.querySelector(z(CC));m.innerHTML="",g.value.forEach(E=>{let y=document.createElement(qe);y.className=PC,y.style.backgroundColor=E,y.setAttribute("data-color",E),m.appendChild(y)})});let p=t[l];p==null&&(p=i.cb(t,l)),p&&(d.value=p,a(p)),d.onchange=g=>{let m=d.value;a(m),i.setValue(l,m,null,!0)},h.on(e,W,"[data-color]",g=>{let m=g.target.getAttribute("data-color");i.setValue(l,m,null),d.value=m}),i.addValueListener((g,m)=>{g===l&&(a(m),d.value=m)})}})}var mw="data-value",Ew="vjs-edge-type-picker",Wp="vjs-edge-type-picker-selected",Zp=class{constructor(r,e,t,n,o){this.ui=r;this.fe=e;this.db=t;this.Am=n;this.Sm=o;c(this,"entryMap",new Map);this.fe.classList.add(Ew)}render(r,e){this.fe.innerHTML="";let t=this.db.find(n=>n.property===r);if(t!=null)for(let n in t.mappings){let o=t.mappings[n],s=document.createElement(qe);s.setAttribute(mw,n),n===this.Am&&s.classList.add(Wp);let a=this.ui.$drawAdHocEdge(o,{x:0,y:0},{x:200,y:0},o.overlays||[],o.sourceMarker,o.targetMarker,e);s.appendChild(a),this.entryMap.set(n,s),this.fe.appendChild(s),this.ui.on(s,W,l=>{this.select(r,n)})}}select(r,e){let t=this.entryMap.get(e);if(t){this.Am=e,this.fe.setAttribute(mw,e);let n=this.fe.querySelector(z(Wp));n&&n.classList.remove(Wp),t.classList.add(Wp),this.Sm&&this.Sm(r,e)}}};var fw="vjs-edge-type",yw="edgeMappings";function LG(i){return i.getFromContext(yw)||i.$ui.$getEdgePropertyMappings()}function OC(i){i.registerTag(fw,{template:"<div/>",rendered:(r,e)=>{let t=r.getAttribute(ue.Attributes.VJS),n=e[t]||"";new Zp(i.$ui,r,LG(i),n,(o,s)=>{i.setValue(o,s,null)}).render(t,e)}})}var wG="<div/>",Jp=class extends kp{constructor(e){super(Object.assign(e,{refresh:(t,n)=>{this.container.replaceChildren(this.ub(t,this.$context)),n()},renderEmptyContainer:()=>{let t=this.M.render(this.eo).fragment;this.container.replaceChildren(t)}}));c(this,"T");c(this,"M",xr());c(this,"eo");c(this,"zs");c(this,"Tm",new Map);c(this,"vm",new Map);c(this,"Cm",new Map);c(this,"Ys");this.T=e.ui.model,this.Ys=e.cacheTemplates!==!1,this.zs=e.templateResolver,this.eo=this.M.parse(e.emptyTemplate||wG),_C(this),OC(this)}registerTag(e,t){this.M.registerTag(e,t)}pb(e){let t=this.T.getPortType(e.data),n=this.Cm.get(t);if(n==null){let o=this.zs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for port of type ${t}`),this.eo;n=this.M.parse(o),this.Ys&&this.Cm.set(t,n)}return n}Pm(e){let t=this.T.getNodeType(e.data),n=this.Tm.get(t);if(n==null){let o=this.zs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for vertex of type ${t}`),this.eo;n=this.M.parse(o),this.Ys&&this.Tm.set(t,n)}return n}mb(e){return this.Pm(e)}gb(e){let t=this.T.getEdgeType(e.data),n=this.vm.get(t);if(n==null){let o=this.zs(e);if(o==null)return U(`VisuallyJs WARN: Could not retrieve template for edge of type ${t}`),this.eo;n=this.M.parse(o),this.Ys&&this.vm.set(t,n)}return n}ub(e,t){let n;return J(e)?n=this.Pm(e):Y(e)?n=this.mb(e):j(e)?n=this.pb(e):nt(e)&&(n=this.gb(e)),this.M.render(n,e.data,null,t).fragment}};function xw(i,r){if(!i||i.length===0)return`<div class="vjs-inspector-controls">
|
|
79
79
|
<div>${r}</div>
|
|
80
80
|
</div>`;let e=`<div class="vjs-inspector-controls">
|
|
81
81
|
`;for(let t of i)e+=` <div class="vjs-inspector-control-group" style="margin-bottom: 10px;">
|
|
82
82
|
`,e+=` <label style="display:block; font-weight:bold;">${t.label}</label>
|
|
83
83
|
`,t.description&&(e+=` <small style="display:block; color:#666; margin-bottom:4px;">${t.description}</small>
|
|
84
|
-
`),e+=` ${
|
|
84
|
+
`),e+=` ${DG(t)}
|
|
85
85
|
`,e+=` </div>
|
|
86
|
-
`;return e+="</div>",e}function
|
|
86
|
+
`;return e+="</div>",e}function DG(i){switch(i.type){case"string":return`<input type="text" vjs-att="${i.id}" class="vjs-input"/>`;case"number":{let r=i.min!==void 0?` min="${i.min}"`:"",e=i.max!==void 0?` max="${i.max}"`:"";return`<input type="number" vjs-att="${i.id}"${r}${e} class="vjs-input"/>`}case"boolean":return`<input type="checkbox" vjs-att="${i.id}"/>`;case"color":return`<vjs-color vjs-att="${i.id}"></vjs-color>`;case"font":return`<div style="display:flex; gap:5px; margin-top:5px;">
|
|
87
87
|
<input type="number" placeholder="Size" style="width:60px;" vjs-att="${i.id}.size" class="vjs-input"/>
|
|
88
88
|
<input type="text" placeholder="Family" style="flex-grow:1;" vjs-att="${i.id}.family" class="vjs-input"/>
|
|
89
89
|
<select vjs-att="${i.id}.weight" class="vjs-select">
|
|
@@ -99,45 +99,45 @@ var Ac=Object.defineProperty,iN=Object.defineProperties,oO=Object.getOwnProperty
|
|
|
99
99
|
<option value="italic">Italic</option>
|
|
100
100
|
<option value="oblique">Oblique</option>
|
|
101
101
|
</select>
|
|
102
|
-
</div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var _C=class extends Zp{constructor(e){super(Object.assign(e,{templateResolver:t=>this.ab(t),getDefaultValue:(t,n)=>{let o=this.Am(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Bn");c(this,"Us");c(this,"xm");c(this,"bm");this.Bn=e.ui.getShapeLibrary(),this.Us=e.properties,this.xm=e.propertyMode||"override",this.bm=e.noPropertiesMessage||"No configurable properties for this shape."}Am(e){if(this.xm==="override"&&this.Us!=null)return this.Us;let t=this.Bn.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Bn.getShapeSet(e.category||this.Bn.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Bn.getShapeSet(e.category||this.Bn.defaultCategoryId);n=o?o.properties:null}return n==null?this.Us||[]:n}ab(e){if(J(e)||Y(e)){let t=this.Am(e.data);return t?fw(t,this.bm):null}else return null}};var ly="drag",OC="tap",hy="draw";var cy=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Gn(e)}Gn(r){this.templateRenderer=new es({templates:{tp:r}})}setData(r,e){e&&this.Gn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function yw(i){let r={type:null};for(let e=0;e<i.attributes.length;e++){let t=i.attributes.item(e);if(t.name.indexOf("data-vjs")===0){let n=t.name.split("-")[2];r[n]=t.value}}return r.type==null&&(r.type=be),r}var xw="[data-vjs-type]";function DG(i,r,e){let t=(e.x-r.x)/r.width,n=(e.y-r.y)/r.height,o=e.width/r.width,s=e.height/r.height;return{x:Math.round(i.x+t*i.width),y:Math.round(i.y+n*i.height),width:Math.round(o*i.width),height:Math.round(s*i.height)}}var Ra=class{constructor(r,e){this.ui=r;c(this,"qi");c(this,"source");c(this,"Fn");c(this,"Sm");c(this,"kt");c(this,"Ht");c(this,"Tm");c(this,"nn");c(this,"yh");c(this,"Qi");c(this,"xh");c(this,"bh");c(this,"Ah");c(this,"onDrag");c(this,"Or");c(this,"Sh");c(this,"lr");c(this,"Th");c(this,"zs");c(this,"Ch");c(this,"eo");c(this,"Ph");c(this,"Oh");c(this,"no");c(this,"Ys");c(this,"vm");c(this,"Je");c(this,"io",[]);c(this,"oo",[]);c(this,"Un",[]);c(this,"Be");c(this,"G");c(this,"zn");c(this,"_r");c(this,"J");c(this,"Yn");c(this,"Cm");c(this,"_h");c(this,"Pm");c(this,"Xs");c(this,"Om");c(this,"Rh");c(this,"_m");c(this,"sn");c(this,"Lh");c(this,"ve");c(this,"Dh");c(this,"Nh");c(this,"ao");this.qi=e.mode||ly,this.Je=new ye,this.Or=e.ignoreZoom===!0,this.Sm=e.ignoreGrid===!0,this.sn=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.Ah=e.canvasDropFilter||(t=>!0),this.Sh=e.elementGenerator,this.yh=e.dataGenerator||yw,this.xh=e.typeGenerator||(t=>t.type),this.bh=e.groupIdentifier||((t,n)=>n.getAttribute(Jl)===Ct),this.Qi=e.dragSizeGenerator,this.lr=e.enabled!==!1,this.source=e.source,this.Fn=e.selector||xw,this.Nh=new cy(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.Nh.setData(e.data),this.kt=e.dragActiveClass||mv,this.Ht=e.dragHoverClass||Ev,this.Tm=e.dragElementClass||yv,this.nn=e.dragHoverCannotDropClass||fv,this.Lh=e.dragSize,this.Xs=e.allowDropOnNode===!0,this.Om=e.ignoreDropOnNode===!0,this.Rh=e.allowDropOnGroup!==!1,this._m=e.allowDropOnEdge===!0,this.Pm=e.allowDropOnCanvas!==!1,this.Th=e.onVertexAdded,this.onDrag=e.onDrag,this.zs=e.selectAfterAdd===!0,this.ao=function(t){t.key==="Escape"&&(this.qi===hy?this.ve!=null&&this.ui.setMode(xr):(this.Ih(),this.un()))}.bind(this),this.ui.bind(On,t=>{t===Fn&&this.ve==null?this.Dh!=null&&this.Rm(this.Dh.el):t!==Fn&&this.ve!=null&&(F(this.ve.el,pn),F(this.ui.rootElement,uh),this.Dh=this.ve,this.ve=null,document.removeEventListener(Bn,this.ao))}),this.qi===ly?this.lb():this.qi===hy?this.hb(e):this.qi===OC&&this.cb()}setEnabled(r){this.lr=r}setData(r,e){this.Nh.setData(r,e)}Rm(r){let e=Bt(r,this.Fn,this.source,!0);if(this.ve!=null){if(F(this.ve.el,pn),this.ve.el===e){this.ui.setMode(xr);return}}else document.addEventListener(Bn,this.ao);let t=this.yh(e);this.Yn=this.Qi?this.Qi(this.Be,e):this.Lh,this.ve={el:e,data:t,objectType:e.getAttribute(Jl)===Ct?se.objectType:ce.objectType,type:this.xh(t)},L(this.ve.el,pn),L(this.ui.rootElement,uh),this.ui.setMode(Fn)}Lm(r,e,t){this.Ch=n=>{if(this.lr){let o=n.target,s=Bt(o,this.Fn,this.source,!0);if(!r(s)||(this._h=this.Or?1:this.ui.getEffectiveVisibleZoom(),this.Be=this.yh(s),this.Ah&&!this.Ah(this.Be)))return;if(this.Yn=this.Qi?this.Qi(this.Be,s):this.Lh,this.J=this.Sh?this.Sh(s,n,this.Be):e(s),this.J.removeAttribute("id"),L(this.J,this.Tm),this.J.style.position=qe,this.J.style.margin="0",this.Cm=this.bh(this.Be,s)?se.objectType:ce.objectType,this.zn=this.Cm===se.objectType?new se(this.ui.model.graph,this.Be):new ce(this.ui.model.graph,this.Be),er(this.J,{x:n.pageX,y:n.pageY}),!this.Or){let a=-50/this._h;this.J.style.transform=`scale(${this._h}) translate(${a}%,${a}%)`}t(s,this.J),document.body.appendChild(this.J),this.no=!1,this.Ys=this.Pm===!1?!1:this.sn!=null?this.sn(this.zn,null,!0):!0,this.vm=this.ui.getVisibleCanvasBounds(),this.Oh=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,mt),L(this.ui.rootElement,this.kt),this.Je.on(document,ae,this.Ph),this.io.length=0,this.Un.length=0,!this.Om&&this.Xs&&this.ui.$getNodesInViewport().forEach(a=>{let l=a.el.el;this.io.push({element:a.el.el,cssElement:l,r:a.el,managedElement:a.el,canDrop:this.sn?this.sn(this.zn,a.el.modelObject,!1):this.Xs,vertex:a.el.modelObject,id:a.el.id,objectType:ce.objectType,modelObject:a.el.modelObject}),this.Xs&&L(l,this.kt)}),this.ui.$getGroupsInViewport().forEach(a=>{let l=this.ui.getGroupDefinition(a.el.modelObject);if(l.canDrop==null||l.canDrop(this.zn)){let h=this.ui.$_getGroupContentAreaInfo(a.el.id),d=this.ui.containerType==="SVG"?a.el.el:h.contentArea;this.oo.push({element:h.contentArea,canDrop:this.Rh===!1?!1:this.sn?this.sn(this.zn,a.el.modelObject,!1):!0,vertex:a.el.modelObject,managedElement:a.el,cssElement:d,id:a.el.id,objectType:se.objectType,modelObject:a.el.modelObject,depth:Lc(a.el.modelObject),r:{x:a.el.x+h.internalOffset.x,y:a.el.y+h.internalOffset.y,width:a.el.width-h.internalOffset.x,height:a.el.height-h.internalOffset.y}}),this.Rh&&L(d,this.kt)}}),this.oo.sort((a,l)=>l.depth-a.depth),this._m&&this.ui.model.getAllEdges().forEach(a=>{let l=this.ui.getRenderedConnection(a.id),h=l.connector.canvas,d=h;this.Un.push({edge:a,connection:l,connector:l.connector,element:h,cssElement:d,id:a.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(h),objectType:Ue.objectType,modelObject:a}),L(d,this.kt)}),this.Je.on(document,Bn,this.ao)}}}Ih(){this.Je.off(document,ae,this.Ph),this.Je.off(document,W,this.eo),this.Je.off(document,le,this.eo),F(document.body,mt),F(this.ui.rootElement,this.nn),F(this.ui.rootElement,this.kt),F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,uh),this.Je.off(document,Bn,this.ao),this.io.forEach(r=>{F(r.cssElement,this.kt)}),this.oo.forEach(r=>{F(r.cssElement,this.kt)}),this.Un.forEach(r=>{F(r.cssElement,this.kt)}),this.G!=null&&(F(this.G.cssElement,this.Ht),F(this.G.cssElement,this.nn))}wm(r){this.eo=e=>{this.Ih(),this.no&&(this.G!=null?this.G.objectType===ce.objectType&&this.G.canDrop?this.Dm(e,this.G.vertex):this.G.objectType===se.objectType&&this.G.canDrop?this.db(e):this.G.objectType===Ue.objectType&&this.G.canDrop&&this.ub(e):this.Ys&&this.Dm(e,null)),this.un()}}Nm(){this.Ph=r=>{er(this.J,{x:r.pageX,y:r.pageY}),this.Yn&&Or(this.J,this.Yn.width,this.Yn.height);let e=this.ui.$getElementPositionInWindow(this.J);if(tt(this.Oh,e)){if(!this.Sm&&this.ui.gridProfile.grid!=null){let o=this.ui.gridProfile.grid,s=this.ui.snapPageLocationToGrid(e.x+window.scrollX,e.y+window.scrollY,o);this.J.style.left=`${s.x+e.width/2}px`,this.J.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.J)}this.G!=null&&(F(this.G.cssElement,this.Ht),F(this.G.cssElement,this.nn),this.G=null),this._r=DG(this.vm,this.Oh,e);let t=[],n=!1;if(this.io.forEach(o=>{tt(this._r,o.r)&&(t.push(o),n=o.canDrop)}),this.oo.forEach(o=>{tt(this._r,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(ke(o.vertex,s.vertex))return-1;if(ke(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.nn),this.G=t[0],this.G.canDrop&&L(this.G.cssElement,this.Ht)),!n){for(let o=0;o<this.Un.length;o++){let s=this.Un[o],a=s.r,l=s.connector;if(tt(e,a)){let h=this.ui.fromPageLocation(e.x+window.scrollX,e.y+window.scrollY),d=this.ui.fromPageLocation(e.x+e.width+window.scrollX,e.y+e.height+window.scrollY),u={x:h.x,y:h.y,width:d.x-h.x,height:d.y-h.y};if(aS(l,u).length>0){this.G=s,L(this.G.cssElement,this.Ht);break}}}this.G==null&&(this.Ys?L(this.ui.rootElement,this.Ht):L(this.ui.rootElement,this.nn))}this.no=!0}else F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.nn),this.no=!1;this.onDrag&&this.onDrag(this.Be,this.J,r)}}lb(){this.Nm(),this.wm(le),this.Lm(r=>!0,r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,le,this.eo)}),this.Je.on(this.source,ge,this.Fn,this.Ch)}cb(){this.Nm(),this.wm(W),this.Lm(r=>{let e=this.source.querySelector(`.${pn}`);return e===r?(F(e,pn),requestAnimationFrame(()=>{this.Ih(),this.un()}),!1):!0},r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.eo),e},(r,e)=>{let t=this.source.querySelector(`.${pn}`);t!=null&&F(t,pn),L(e,"vjs-palette-tap-mode-placeholder"),L(r,pn),L(this.ui.rootElement,uh)}),this.Je.on(this.source,W,this.Fn,this.Ch)}ub(r){if(this.G.objectType===Ue.objectType){let e=this.G.edge;this.ui.model.transaction(()=>{this.Vh(this.Be,this._r,this.J,r,this.G.vertex,(t,n,o)=>{let s=e.source,a=e.target,l=e.data||{};delete l.id,this.ui.model.removeEdge(e),this.ui.model.$_addEdge({source:s,target:t,data:l},yo,null),this.ui.model.$_addEdge({source:t,target:a,data:l},yo,null)})},ut)}}db(r){this.G.objectType===se.objectType&&(this._r.x-=this.G.r.x,this._r.y-=this.G.r.y,this.Vh(this.Be,this._r,this.J,r,this.G.vertex),this.ui.relayoutGroup(this.G.id))}Dm(r,e){this.Vh(this.Be,this._r,this.J,r,e)}pb(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===We?t[n.x]=r[o]:o===Te?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}Vh(r,e,t,n,o,s){let a=this.xh(r),l=this.bh(r,t),h=t.getAttribute("data-vjs-group-template"),d=this.pb({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(d.group=o.id);let u=null;if(o!=null){let g=this.ui.viewport.getElementBounds(o.id);g!=null&&(u={vertex:o,pos:{x:g.x,y:g.y},size:{width:g.width,height:g.height}})}let p=this.ui.getModelPositionAttributes();if(l){let g=m=>{let E=m.data[p.x]==null?e.x:m.data[p.x],y=m.data[p.y]==null?e.y:m.data[p.y];this.ui.setPosition(m,E,y),s&&s(m,E,y),this.Mh(this.ui.model.getGroup(m.id),u),this.zs&&this.ui.model.setSelection(this.ui.model.getGroup(m.id))};h==null?this.ui.model.addFactoryGroup(a,d,g,null,!1):this.ui.model.addFactoryGroupWithTemplate(a,h,d,g,null,!1)}else this.ui.model.addFactoryNode(a,d,g=>{let m=g.data[p.x]==null?e.x:g.data[p.x],E=g.data[p.y]==null?e.y:g.data[p.y];this.ui.setPosition(g,m,E),s&&s(g,m,E),this.Mh(this.ui.model.getNode(g.id),u),this.zs&&this.ui.model.setSelection(this.ui.model.getNode(g.id))},null,!1)}Mh(r,e){this.Th&&this.Th({vertex:r,dropTarget:e,doModelUpdate:(t,n)=>{setTimeout(()=>{this.ui.model.mergeTransaction(()=>{try{t(this.ui,this.ui.model,n)}catch(o){U("WARN: could not invoke model update callback after vertex added from palette")}})})}})}un(){Array.from(this.source.querySelectorAll(`.${pn}`)).forEach(r=>{F(r,pn)}),this.zn=null,this.Be=null,this.io.length=0,this.oo.length=0,this.Un.length=0,this.J&&this.J.parentElement.removeChild(this.J),this.J=null,this.Yn=null,this.no=!1,this.Ys=!1}hb(r){this.Je.on(this.source,W,this.Fn,n=>{let o=n.target;this.Rm(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.ve),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.Mh(n),this.zs&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.ve.objectType,this.ve.type,this.ve.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.ve.data)}),this.ui.addPlugin({type:fi.type,options:t})}};var $h=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new Mp(t.container,e,t),!0}destroy(){}reset(){}};c($h,"type","controls"),$h=He([Xe("controls")],$h);var Jp=class extends Se{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new Oa(t.container,e,t),!0}destroy(){}reset(){}};Jp=He([Xe("exportControls")],Jp);var ls=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lo",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.lo=[],this.dragGroupAssigner=t.assignDragGroup,e.bind(Fr,n=>{this.ho(n.el,n.vertex)}),e.bind(Br,n=>{this.ho(n.el,n.vertex)}),e.bind($r,n=>{this.mb()}),e.bind(Ys,n=>{this.ho(n.el,n.modelObject)}),!0}destroy(){}reset(){this.lo.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.ho(n.el,n.obj)})}removeFromDragGroup(...e){this.surface.removeFromDragGroup(...e.map(t=>this.surface.getObjectInfo(t,!1).el).filter(t=>t!=null))}addToDragGroup(e,...t){this.surface.addToDragGroup(e,...t.map(n=>this.surface.getObjectInfo(n,!1).el).filter(n=>n!=null))}ho(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.lo.push([e,t]);else{let n=this.dragGroupAssigner(t);if(n!=null){let o=typeof n=="string"?{id:n,active:!0}:n;this.surface.$addToDragGroup(Object.assign(o,{membership:RC}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}mb(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.lo.length;e++)this.ho.apply(this,this.lo[e])}};c(ls,"type","dragGroups"),ls=He([Xe("dragGroups")],ls);var Kp="vjs-snapline",LC="vjs-snapline-vertical",wC="vjs-snapline-horizontal",dy="vjs-snapline-exact",DC="vjs-snapline-active",NC="vjs-snapline-active-exact",hs=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"panZoom");c(this,"tolerance",5);c(this,"showCenters");c(this,"showEdges");c(this,"verticalRanges",[]);c(this,"horizontalRanges",[]);c(this,"selectedRanges",[]);c(this,"focus",null);c(this,"enabled",!0)}setEnabled(e){let t=this.enabled;this.enabled=e,t&&this.reset()}initialise(e,t){this.surface=e,this.panZoom=e.panZoom,this.tolerance=t.tolerance||5,this.showCenters=t.showCenters!==!1,this.showEdges=t.showEdges!==!1,this.enabled=t.enabled!==!1,this.surface.bind(Ms,o=>{if(this.enabled&&o.dragGroup.length>0){let s=o.dragGroup[0],a=this.surface.viewport.getElements();this.focus=s.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let l in a)if(l!==this.focus.id){let h=a[l].t,d=h.width,u=h.height;this.showEdges&&(this.horizontalRanges.push({position:We,start:h.x-this.tolerance,end:h.x+this.tolerance,objId:l,line:this.Gh(h.x),el:a[l].el,orientation:"v"}),this.horizontalRanges.push({position:yt,start:h.x+d-this.tolerance,end:h.x+d+this.tolerance,objId:l,line:this.Gh(h.x+d),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Te,start:h.y-this.tolerance,end:h.y+this.tolerance,objId:l,line:this.$h(h.y),el:a[l].el,orientation:"h"}),this.verticalRanges.push({position:ht,start:h.y+h.height-this.tolerance,end:h.y+h.height+this.tolerance,objId:l,line:this.$h(h.y+u),el:a[l].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:It,start:h.x+d/2-this.tolerance,end:h.x+d/2+this.tolerance,objId:l,line:this.Gh(h.x+d/2),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:It,start:h.y+u/2-this.tolerance,end:h.y+u/2+this.tolerance,objId:l,line:this.$h(h.y+u/2),el:a[l].el,orientation:"h"}))}}}),this.surface.bind(Mt,o=>{if(this.enabled&&o.dragGroup.length>0){this.js();let s=o.dragGroup[0],a=s.pos.x,l=a+this.focus.width/2,h=a+this.focus.width,d=s.pos.y,u=d+this.focus.height/2,p=d+this.focus.height,g={};for(let m=0;m<this.horizontalRanges.length;m++){let E=this.horizontalRanges[m];g[E.objId]||(E.start<=l&&E.end>=l?(g[E.objId]=!0,this.Xn(E,l)):E.start<=a&&E.end>=a?(g[E.objId]=!0,this.Xn(E,a)):E.start<=h&&E.end>=h&&(g[E.objId]=!0,this.Xn(E,h)))}for(let m=0;m<this.verticalRanges.length;m++){let E=this.verticalRanges[m];g[E.objId]||(E.start<=u&&E.end>=u?(g[E.objId]=!0,this.Xn(E,u)):E.start<=d&&E.end>=d?(g[E.objId]=!0,this.Xn(E,d)):E.start<=p&&E.end>=p&&(g[E.objId]=!0,this.Xn(E,p)))}}});let n=()=>{this.enabled&&(this.js(),this.verticalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.horizontalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.verticalRanges.length=0,this.horizontalRanges.length=0)};return this.surface.bind(Vt,o=>n()),this.surface.bind(od,o=>n()),!0}Xn(e,t){this.selectedRanges.push(e);let n=(e.start+e.end)/2,o=Math.round(t)===Math.round(n);o?e.line.classList.add(`${dy}`):e.line.classList.remove(`${dy}`);let s={x:e.orientation===Kx?-5e4:n,y:e.orientation===Ic?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${DC}`),o&&L(e.el,`${NC}`)}js(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${dy}`),this.surface.unfixElement(e.line),F(e.el,`${DC}`),F(e.el,`${NC}`)})}$h(e){if(this.surface.containerType==="SVG")return Kr(Gt,Z,{y:`${e}px`},`${Kp} ${wC}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(Ke);return t.className=`${Kp} ${wC}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}Gh(e){if(this.surface.containerType==="SVG")return Kr(Gt,Z,{x:`${e}px`},`${Kp} ${LC}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(Ke);return t.className=`${Kp} ${LC}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.js()}reset(){this.js()}};c(hs,"type","snaplines"),hs=He([Xe("snaplines")],hs);var Bh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new Ra(e,t),!0}reset(){}};c(Bh,"type","palette"),Bh=He([Xe("palette")],Bh);var cs=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"co",[]);c(this,"Im",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"Vm",!1);c(this,"Bh");c(this,"Mm")}initialise(e,t){return this.eventManager=new ye,this.surface=e,this.panZoom=e.panZoom,this.startPanTimeout=t.startPanTimeout||150,this.panRepeatInterval=t.panRepeatInterval||60,this.panRepeatDistance=t.panRepeatDistance||10,this.panDistance=t.panDistance||50,this.Bh=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.Im),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,Pf),this.currentPanButton=null,this.eventManager.off(document,le,this.Bh)},this.Mm=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Te,{left:"0px",top:"0px"},0,-1,"↑"),this.makePanButton(ht,{left:"0px",bottom:"0px"},0,1,"↓"),this.makePanButton(We,{left:"0px",top:"0px"},-1,0,"←"),this.makePanButton(yt,{right:"0px",top:"0px"},1,0,"→"),!0}curryPanButton(e,t){return n=>{this.Vm||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.Vm=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,Pf),this.eventManager.on(document,le,this.Bh),this.Im=window.setTimeout(()=>{this.eventManager.on(document,le,this.Mm),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(Ke);return a.innerHTML=s||"",a.style.position=qe,Object.assign(a.style,t),a.className=`${Cf} ${Cf}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Ye,this.curryPanButton(n,o)),this.eventManager.on(a,ge,this.startPanTimer(n,o,a)),this.co.push(a),a}destroy(){for(let e=0;e<this.co.length;e++)this.co[e].parentNode.removeChild(this.co[e]);this.co.length=0}reset(){}};c(cs,"type","panButtons"),cs=He([Xe("panButtons")],cs);var uy="[data-vjs-list='true']",NG="data-vjs-list-behavior",Fh=class extends Se{constructor(){super(...arguments);c(this,"id","list-manager");c(this,"surface");c(this,"options");c(this,"jn",null)}initialise(e,t){this.surface=e,this.options=t,e.addWheelSelectorFilter(`${uy}, ${uy} *`);let n=e.getContainer();return e.on(n,"wheel",uy,(o,s)=>{this.jn||(this.jn=window.requestAnimationFrame(()=>{this.wheelHandler(o,s),this.jn=null}))}),!0}Gm(e){[e.source,e.target].forEach(t=>{let n=this.surface.getRenderedElement(t);if(n){let o=n.closest(uy);o&&this.wheelHandler(null,o)}})}$edgeRendered(e){this.Gm(e.edge)}$edgeUpdated(e){this.Gm(e)}wheelHandler(e,t){let n=this.surface.$getAttribute(t,NG)||this.options.behavior||"proxy",o=this.surface.getObjectInfo(t,!1);if(o.obj){let{vertices:s,contentEl:a}=Y(o.obj)?{vertices:o.obj.members,contentEl:this.surface.$getGroupContentAreaElement(o.el)}:{vertices:o.obj.getPorts(),contentEl:o.el},l=a.getBoundingClientRect(),h=o.el.getBoundingClientRect(),d=Math.max(l.top,h.top),u=Math.min(l.bottom,h.bottom);s.forEach(p=>{this.surface.$revalidateElementById(p.id);let g=this.surface.getElement(p.id),E=g.el.getBoundingClientRect(),y=E.bottom<=d||E.top>=u||E.right<=l.left||E.left>=l.right;p.getAllEdges().forEach(f=>{let b=f.source.id===p.id?"source":"target";if(n==="proxy"){let A=this.surface.getRenderedConnection(f.id);if(A!=null)if(y){let T=A.anchors[b],O=T.locations[T.currentLocation].x<.5?"Left":"Right",_=`${E.bottom<=d?"Top":"Bottom"}${O}`,P=St(_);this.surface.$_proxyEdge(f,b,this.surface.getElement(o.id),P)}else this.surface.$_unproxyEdge(f,b)}else f.ks=f.ks||new Set,y?f.ks.add(b):f.ks.delete(b),this.surface.setVisible(f,f.ks.size===0)}),this.surface.$repaintUIElement(g,null,!1,!0)})}}destroy(){this.jn&&(window.cancelAnimationFrame(this.jn),this.jn=null)}reset(){}};c(Fh,"type","listManager"),Fh=He([Xe("listManager")],Fh);var IC="vjs-vertex-drawing-lasso",py="vjs-group-candidate-child";var fi=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lasso");c(this,"autoExit");c(this,"typeGenerator");c(this,"groupType");c(this,"nodeType");c(this,"defaultGroupSize");c(this,"defaultNodeSize");c(this,"$m");c(this,"Fh");c(this,"kn");c(this,"Hn");c(this,"Hs");c(this,"Ws");c(this,"$onVertexAdded");c(this,"Uh");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}gb(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Hn=o.objectType,this.Hs=o.type,this.Ws=o.data||{}}else this.nodeType!=null?(this.Hn=ce.objectType,this.Hs=this.nodeType,this.Ws={}):(this.Hn=se.objectType,this.Hs=this.groupType||be,this.Ws={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.kn=n.obj:this.kn=null}initialise(e,t){this.surface=e,this.Uh=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.Fh=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.$m=this.Fh||t.allowClickToAdd===!0,this.defaultGroupSize=t.defaultGroupSize||{width:250,height:250},this.defaultNodeSize=t.defaultNodeSize||{width:80,height:80},this.$onVertexAdded=t.onVertexAdded||(s=>{});let n=`${IC} ${t.lassoClass||""}`;e.bind(On,s=>{this.lasso.enabled=s===Fn}),this.vertexSelection=new cr(e.model),this.autoExit=t.autoExit===!0;let o={surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:n,mapToGrid:s=>{if(this.surface.gridProfile.grid){let a=this.surface.fromPageLocation(s.x,s.y),l=he(a,this.surface.gridProfile.grid);return this.surface.toPageLocation(l.x,l.y)}else return s},onStart:(s,a,l,h)=>{e.hoverSuspended=!0,this.gb(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Hn===se.objectType){this.vertexSelection.clear(),this.Bm();let g=[],m,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(m=0;m<y;m++)g.push(E[m].v),x[E[m].id]=!0,this.vertexSelection.append(E[m].v),L(E[m].el,py),this.selectedElements.push(E[m].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.Bm(),this.autoExit&&e.mode!==ns&&e.setMode(xr);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.Fm(s,h)},filter:s=>{let a=s.srcElement||s.target;return a===e.vertexLayer||a===e.$getCanvasElement()},onClick:(s,a)=>{if(this.autoExit&&e.mode!==ns&&e.setMode(xr),this.$m){let l=this.Hn===se.objectType?this.defaultGroupSize:this.defaultNodeSize;this.Fm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new Aa(o),this.Fh&&this.lasso.setEnabled(!1),!0}Fm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.Uh.width||t.height>=this.Uh.height)&&(this.Hn===se.objectType?this.Eb(this.surface,n,t):this.fb(this.surface,n,t))}Um(e,t){return Object.assign(this.Ws,{id:G(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Hs})}yb(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>ke(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>ke(o,s))==null&&n.groups.push(o)}),n}Eb(e,t,n){let o;e.model.transaction(()=>{let s=this.Um(t,n),a=s[this.surface.$modelLeftAttribute],l=s[this.surface.$modelTopAttribute];o=e.model.addGroup(s);let h=[{v:o,x:a,y:l}];e.setSuspendRendering(!0);let d=this.yb();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.kn!=null&&e.model.addToGroup(o,this.kn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}fb(e,t,n){let o;e.setSuspendRendering(!0);let s=this.Um(t,n);e.model.transaction(()=>{o=e.model.addNode(s);let a={x:s[this.surface.$modelLeftAttribute],y:s[this.surface.$modelTopAttribute]};e.setPosition(o,a.x,a.y),this.kn!=null&&e.model.addToGroup(o,this.kn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Bm(){this.selectedElements.forEach(e=>F(e,py)),this.selectedElements.length=0}reset(){}};c(fi,"type","vertexDrawing"),fi=He([Xe("vertexDrawing")],fi);var qp=12,MC=40,VC=16,GC=6,$C=30,BC=30,FC=5,UC="borders",Uh="handles",YC="vjs-resize-skeleton",zC="vjs-resize-skeleton-borders",XC="vjs-resize-skeleton-borders-visible",jC="vjs-resize-frame",Tt="vjs-resize-handle",gy="vjs-resize-handle-active",my="vjs-resize-handle-tl",Ey="vjs-resize-handle-bl",fy="vjs-resize-handle-tr",yy="vjs-resize-handle-br",xy="vjs-resize-handle-t",by="vjs-resize-handle-b",Ay="vjs-resize-handle-l",Sy="vjs-resize-handle-r",ds="vjs-resize-border",HC="vjs-resize-border-b",kC="vjs-resize-border-t",WC="vjs-resize-border-l",ZC="vjs-resize-border-r",Yh="vjs-rotate-handle",Qp="vjs-rotate-leader",Ty="data-vjs-x-resize",vy="data-vjs-y-resize",Cy="data-vjs-resizable",Py="data-vjs-rotatable",La="data-dir";function Ge(i,r,e,t){let n=M(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function _y(i,r){Ie(i,r.ro),r.r!=null&&pi(i,r.r)}var us=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function JC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ge(Z,[Tt,my],n,{"data-dir":"tl",[te]:e.id,width:i,height:i,x:l-o,y:h-o,transform:us(i,t)}),p.tr=Ge(Z,[Tt,fy],n,{"data-dir":"tr",[te]:e.id,width:i,height:i,x:d+o,y:h-o,transform:us(i,t)}),p.bl=Ge(Z,[Tt,Ey],n,{"data-dir":"bl",[te]:e.id,width:i,height:i,x:l-o,y:u+o,transform:us(i,t)}),p.br=Ge(Z,[Tt,yy],n,{"data-dir":"br",[te]:e.id,width:i,height:i,x:d+o,y:u+o,transform:us(i,t)})),a&&(p.t=Ge(Z,[Tt,xy],n,{"data-dir":"t",[te]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:us(i,t)}),p.b=Ge(Z,[Tt,by],n,{"data-dir":"b",[te]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:us(i,t)})),s&&(p.l=Ge(Z,[Tt,Ay],n,{"data-dir":"l",[te]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:us(i,t)}),p.r=Ge(Z,[Tt,Sy],n,{"data-dir":"r",[te]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:us(i,t)})),p}function KC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ge(Be,[Tt,my],n,{"data-dir":"tl",[te]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ge(Be,[Tt,fy],n,{"data-dir":"tr",[te]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ge(Be,[Tt,Ey],n,{"data-dir":"bl",[te]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ge(Be,[Tt,yy],n,{"data-dir":"br",[te]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ge(Be,[Tt,xy],n,{"data-dir":"t",[te]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ge(Be,[Tt,by],n,{"data-dir":"b",[te]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ge(Be,[Tt,Ay],n,{"data-dir":"l",[te]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ge(Be,[Tt,Sy],n,{"data-dir":"r",[te]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function bw(i){return{tl:{anchor:[1,1],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:t,y:n},i.grid);t=h.x,n=h.y;let d=he({x:i.$x2,y:i.$y2},i.grid);o=d.x-t,s=d.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),n>i.$y2-l&&(n=i.$y2-l,s=l),{x:t,y:n,width:o,height:s}},id:"tl"},tr:{anchor:[0,1],id:"tr",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1+e,o=i.$y2-n,s=i.$x1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=he({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),n>i.$y2-l&&(n=i.$y2-l,o=l),{x:s,y:n,width:t,height:o}}},bl:{anchor:[1,0],id:"bl",resize:(r,e)=>{let t=i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x2-t,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=he({x:i.$x2,y:h.y},i.grid).x-t}return t>i.$x2-a&&(t=i.$x2-a,o=a),n<l&&(n=l),{x:t,y:s,width:o,height:n}}},br:{anchor:[0,0],id:"br",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:o+t,y:s+n},i.grid);t=h.x-o,n=h.y-s}return t<a&&(t=a),n<l&&(n=l),{x:o,y:s,width:t,height:n}}},t:{anchor:[.5,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(n=he({x:t,y:n},i.grid).y,s=he({x:i.$x2,y:i.$y2},i.grid).y-n),n>i.$y2-a&&(n=i.$y2-a,s=a),{x:t,y:n,width:o,height:s}},id:"t"},b:{anchor:[.5,0],resize:(r,e)=>{let t=i.$x1,n=i.$y1,o=i.$x2-i.$x1,s=i.$y2-i.$y1+e,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(s=he({x:t,y:n+s},i.grid).y-n),s<a&&(s=a),{x:t,y:n,width:o,height:s}},id:"b"},l:{anchor:[1,.5],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=he({x:t,y:n},i.grid).x,o=he({x:i.$x2,y:i.$y2},i.grid).x-t),t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}},id:"l"},r:{anchor:[0,.5],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1,o=i.$x1,s=i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=he({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function Aw(i){return{l:{anchor:[1,0],id:"l",resize:(r,e)=>{let t=i.$x1+r,n=i.$y1,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=he({x:t,y:n},i.grid);t=l.x,n=l.y;let h=he({x:i.$x2,y:i.$y2},i.grid);o=h.x-t,s=h.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}}},r:{anchor:[0,1],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1,o=i.$y2-n,s=i.$x1,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=he({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=he({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),{x:s,y:n,width:t,height:o}}},t:{id:"t",anchor:[0,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$y2-n,s=i.$x2-t,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=he({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=he({x:i.$x2,y:l.y},i.grid).x-t}return n>i.$y2-a&&(n=i.$y2-a,o=a),{x:t,y:n,width:s,height:o}}},b:{id:"b",anchor:[0,0],resize:(r,e)=>{let t=i.$x2-i.$x1,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=he({x:o+t,y:s+n},i.grid);t=l.x-o,n=l.y-s}return n<a&&(n=a),{x:o,y:s,width:t,height:n}}}}}function qC(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)-o*Math.sin(e),y:n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}function QC(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)+o*Math.sin(e),y:-n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}var ps=class extends Se{constructor(){super(...arguments);c(this,"id","resizingTools");c(this,"surface");c(this,"instance");c(this,"widthAtt");c(this,"heightAtt");c(this,"leftAtt");c(this,"topAtt");c(this,"xAxis");c(this,"yAxis");c(this,"resizeX");c(this,"resizeY");c(this,"canResizeFilter");c(this,"canRotateFilter");c(this,"onEdit");c(this,"onDemand");c(this,"an");c(this,"Rr");c(this,"uo");c(this,"zh");c(this,"Yh");c(this,"zm");c(this,"Xh");c(this,"skeletons");c(this,"ct");c(this,"Lr");c(this,"Zs");c(this,"po");c(this,"Js");c(this,"he");c(this,"wr");c(this,"downAt");c(this,"jh");c(this,"handler");c(this,"toolkitDragObject");c(this,"Ks");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"kh");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"Ym");c(this,"Xm");c(this,"Hh");c(this,"St",!1);c(this,"Wh",!1);c(this,"qs",!1);c(this,"$handleOffset");c(this,"Zh");c(this,"Jh");c(this,"Tt");c(this,"Kh");c(this,"ln");c(this,"Ce");c(this,"dt");c(this,"km");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"Hm");c(this,"Wm")}jm(e){this.toolkitDragObject&&this.skeletons[this.toolkitDragObject.id]&&(e?L(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"):F(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"))}set $moving(e){this.St=e,this.jm(e)}set $rotating(e){this.Wh=e,this.jm(e)}get $busy(){return this.St||this.Wh}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||FC,this.Zh=t.modelUpdater,this.Jh=t.handlerFactory,this.Hm=bw(this),this.Wm=Aw(this),e.$addTransferrableVertexAttributes([Cy,vy,Ty,Py]),this.instance=e.model,this.skeletons={},this.widthAtt=t.widthAttribute||this.instance.modelWidthAttribute,this.heightAtt=t.heightAttribute||this.instance.modelHeightAttribute,this.leftAtt=t.leftAttribute||this.instance.modelLeftAttribute,this.topAtt=t.topAttribute||this.instance.modelTopAttribute,this.onEdit=t.onEdit||function(){},this.onDemand=t.onDemand===!0,this.minimumWidth=t.minimumWidth!=null&&t.minimumWidth>0?t.minimumWidth:$C,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:BC,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.Xm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.Tt=t.handleSize||qp,this.Kh=t.handleShape||"circle",this.ln=t.rotateLeaderLength||MC,this.Ce=t.rotateHandleSize||VC,this.dt=t.borderHandleSize||GC,this.resizeMethod=t.resizeMethod||Uh,this.bordersVisible=this.resizeMethod===UC&&t.bordersVisible!==!1,this.Ym=t.rotatable===!0,this.Hh=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[Tt,Yh,Qp,ds].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.km=t.payloadGenerator||((a,l)=>l),this.instance.bind(nr,()=>{this.reset()}),this.instance.bind(Kt,a=>{this.onDemand!==!0&&this.qh(a.obj)}),this.instance.bind(qt,a=>{this.onDemand!==!0&&this.Wn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(Mt,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Re,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(ve,a=>{n(a.vertex)}),this.instance.bind(Ce,a=>{this.Wn(a.node)}),this.instance.bind(Oe,a=>{this.Wn(a.group),a.group.getMembers().forEach(l=>this.Wn(l))});let o=a=>{this.St||this.instance.openTransaction(),this.$moving=!0,oe(a);let l=this.surface.mapEventLocation(a);this.Wh?this.xb(l):this.Ab(l)},s=a=>{if(this.$busy){if(oe(a),this.qs&&this.ct!=null){let l=new Set;if(this.he!=null){let h={},d={},u={},{movedElements:p,resizedGroups:g}=this.he.ih();Object.assign(u,g);for(let m in p)h[m]=p[m].current,d[m]=p[m].current;for(let m in h){let E={[this.surface.$modelLeftAttribute]:h[m].x,[this.surface.$modelTopAttribute]:h[m].y};u[m]!=null&&(E[this.surface.$modelWidthAttribute]=u[m].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[m].newGroupSize.height),this.surface.model.$_updateVertex(m,E,js,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let m in u){let E=u[m].newGroupSize;this.surface.viewport.updateElement(m,null,null,E.width,E.height,null,null,!1)}}else l.add(this.ct);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.Ks&&F(this.Ks,gy),this.surface.$removeClassFromElement(document.body,mt),this.surface.off(document,ae,o),this.surface.off(document,le,s),this.he&&this.he.cleanup(),this.he=null,this.ct=null,this.Zs=!1,this.po=null,this.Js=null,this.Lr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.qs=!1}};return this.surface.on(this.surface.getContainer(),ge,z(Tt),a=>{this.Zm(a,this.Hm,o,s)}),this.surface.on(this.surface.getContainer(),ge,z(ds),a=>{this.Zm(a,this.Wm,o,s)}),this.surface.on(this.surface.getContainer(),ge,z(Yh),a=>{oe(a),this.Rr=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(te)),this.toolkitDragObject!=null&&(this.wr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Rr=this.wr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this.kh={x:this.wr.c.x,y:this.wr.c.y},this.Jm(a),this.surface.$addClassToElement(document.body,mt),this.surface.on(document,ae,o),this.surface.on(document,le,s))}),!1}Jm(e){this.toolkitDragObject!=null&&(this.ct=this.toolkitDragObject.group,this.Zs=!1,this.ct!=null&&(this.po=this.surface.getGroupDefinition(this.ct),this.Js=this.surface.$_getGroupContentAreaInfo(this.ct.id),this.Lr=this.surface.viewport.getGroupElement(this.ct.id),this.Zs=this.po.elastic===!0&&e.shiftKey!==!0,this.Zs&&(this.he=new va(this.surface,this.toolkitDragObject,this.ct,this.po))))}Zm(e,t,n,o){oe(e);let s=e.target,a=s.getAttribute(te);this.an=s.getAttribute(La),this.Ks=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.wr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.Jm(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.Sb(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.Rr=this.Km(),this.uo={x:l.x,y:l.y},this.Xh={width:l.width,height:l.height},this.zh=this.$x2-this.$x1,this.Yh=this.$y2-this.$y1,this.zm={x:this.$x1+this.zh/2,y:this.$y1+this.Yh/2},this.jh=QC(this.downAt.x,this.downAt.y,this.Rr,{x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2}),Y(this.toolkitDragObject)){if(this.surface.getGroupElement(this.toolkitDragObject.id).collapsed)return;{let d=this.surface.getGroupDefinition(this.toolkitDragObject);if(this.Xm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),g=p.xmax+u.internalOffset.x,m=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,g),this.currentMinimumHeight=Math.max(this.minimumHeight,m)}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight}}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight;if(this.grid&&!this.ignoreGrid){let h=he({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.an]),this.Jh!=null){let h=this.Jh(this.surface,this.toolkitDragObject,this.an,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.Ks,gy),this.surface.$addClassToElement(document.body,mt),this.surface.on(document,ae,n),this.surface.on(document,le,o)}Km(){if(this.wr==null)return 0;{let t=(this.wr.r==null?0:this.wr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Tb(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.Km();return t?qC(e.x,e.y,o,n):QC(e.x,e.y,o,n)}Sb(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.vb();return{x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}reset(){for(let e in this.skeletons){let t=this.skeletons[e];t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}}$minWidth(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumWidth,this.grid.width):this.currentMinimumWidth}$minHeight(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumHeight,this.grid.height):this.currentMinimumHeight}Qs(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}Wn(e){this.Qs(e.id)}qh(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.Wn(e),Y(t.modelObject)&&t.collapsed||An(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(Ty)!==ct&&this.resizeX!==!1,s=t.el.getAttribute(vy)!==ct&&this.resizeY!==!1;if(t.el.getAttribute(Cy)===ct||!o&&!s)return;this.Qh(t,e,o,s)}}Qh(e,t,n,o){let s=e,a=this.resizeMethod==Uh?[YC]:[zC];this.bordersVisible&&a.push(XC);let l=Ge(Q,a,null,{transform:`translate(${e.x}, ${e.y})`,[te]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ge(Z,[jC],l,{x:-this.$handleOffset,y:-this.$handleOffset,width:e.width+2*this.$handleOffset,height:e.height+2*this.$handleOffset}),d=parseInt(window.getComputedStyle(e.el).strokeWidth,10),u=this.canResizeFilter?this.canResizeFilter(e.modelObject,e.el):n||o,p=e.el.getAttribute(Py)===ct?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.Ym,g=this.skeletons[t.id]={mel:e,el:l,canResizeX:n,canResizeY:o,handles:null,borders:null,rh:null,rl:null,rotatable:p,resizable:u,frame:h};if(this.resizeMethod===Uh){if(p){g.rl=Ge(q,[Qp],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.ln+this.$handleOffset}`,"stroke-width":2}),g.rh=M(Q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.ln-this.$handleOffset-this.Ce/2})`}),l.appendChild(g.rh),Ge(Be,[Yh],g.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let m=M(et,{x:`${this.Ce/2}`,y:`${this.Ce/2}`,"font-size":Math.floor(this.Ce*.75)});m.innerHTML="\u21BA",g.rh.appendChild(m)}u&&(g.handles=this.Kh==="rectangle"?JC(this.Tt,s,t,d,l,this.$handleOffset,n,o):KC(this.Tt,s,t,d,l,this.$handleOffset,n,o))}else p&&(g.rl=Ge(q,[Qp],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.ln+this.$handleOffset}`,"stroke-width":2}),g.rh=M(Q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.ln-this.$handleOffset-this.Ce/2})`}),l.appendChild(g.rh),Ge(Be,[Yh],g.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),g.borders={t:null,b:null,l:null,r:null},u&&(o&&(g.borders.t=Ge(Z,[ds,kC],l,{[La]:"t",[te]:t.id,width:s.width,height:this.dt,x:0,y:-this.dt/2}),g.borders.b=Ge(Z,[ds,HC],l,{[La]:"b",[te]:t.id,width:s.width,height:this.dt,x:0,y:s.height-this.dt/2})),n&&(g.borders.r=Ge(Z,[ds,ZC],l,{[La]:"r",[te]:t.id,width:this.dt,height:s.height,x:s.width-this.dt/2,y:0}),g.borders.l=Ge(Z,[ds,WC],l,{[La]:"l",[te]:t.id,width:this.dt,height:s.height,x:-(this.dt/2),y:0})));return _y(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return _y(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Ce/2}, ${-this.ln-this.$handleOffset-this.Ce/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.ln+this.$handleOffset}`),!0}return!1}Cb(e,t,n,o){let s={},a=this.xAxis&&this.resizeX,l=this.yAxis&&this.resizeY;return s[this.widthAtt]=a?n:this.$x2-this.$x1,s[this.heightAtt]=l?o:this.$y2-this.$y1,s[this.leftAtt]=a?e:this.$x1,s[this.topAtt]=l?t:this.$y1,s[this.widthAtt]<0&&(s[this.widthAtt]=this.$minWidth()),s[this.heightAtt]<0&&(s[this.heightAtt]=this.$minHeight()),s}xb(e){let t=e.x-this.kh.x,n=e.y-this.kh.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.Hh!=null){let s=360/this.Hh;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},zs,!1),this.Rr=o}Ab(e){let t,n,o=this.Tb(e);if(t=o.x-this.jh.x,n=o.y-this.jh.y,this.grid&&!this.ignoreGrid&&(t=(t<0?Math.ceil(t/this.grid.width):Math.floor(t/this.grid.width))*this.grid.width,n=(n<0?Math.ceil(n/this.grid.height):Math.floor(n/this.grid.height))*this.grid.height),(this.resizeY===!1||this.yAxis===!1||this.an==="l"||this.an==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.an==="t"||this.an==="b")&&(t=0),this.qs||t!=0||n!=0){this.qs=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.ct!=null&&(this.he!=null?this.he.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.po.constrain&&(s+l>this.Lr.width&&(l=this.Lr.width-s),a+h>this.Lr.height&&(h=this.Lr.height-a)))),this.qm(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.zh,y:this.$y1+this.handler.anchor[1]*this.Yh},p=qC(u.x,u.y,this.Rr,this.zm),g={x:s+l/2,y:a+h/2},m={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=qC(m.x,m.y,this.Rr,g),y=E.x-p.x,x=E.y-p.y,f={x:g.x-y,y:g.y-x},b=QC(p.x,p.y,this.Rr,f);this.uo={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Xh={width:l,height:h};let A=this.Cb(this.uo.x,this.uo.y,l,h),T=this.km(this.toolkitDragObject,A)||{},S=Object.assign(T,A),O;if(this.Zh!=null&&(O=this.Zh(this.toolkitDragObject,this.uo,this.Xh)),this.instance.$_updateVertex(this.toolkitDragObject,S,_l,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],_l,!1);if(O!=null)for(let v in O)this.instance.$_updateVertex(v,O[v],_l,!1)}}vb(){return this.ct==null?{x:0,y:0}:{x:this.Lr.x+this.Js.internalOffset.x,y:this.Lr.y+this.Js.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.Qs(e.id),setTimeout(()=>{this.qh(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==_l&&this.skeletons[e.id]!=null&&(this.Qs(e.id),setTimeout(()=>{this.qh(e.modelObject)}))}qm(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(ie(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===Uh?this.Kh==="rectangle"?(o.handles.tr&&ie(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&ie(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&ie(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&ie(o.handles.t,{x:e/2}),o.handles.b&&ie(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&ie(o.handles.l,{y:t/2}),o.handles.r&&ie(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&ie(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&ie(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&ie(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&ie(o.handles.t,{cx:e/2}),o.handles.b&&ie(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&ie(o.handles.l,{cy:t/2}),o.handles.r&&ie(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&ie(o.borders.t,{width:e}),o.borders.b&&ie(o.borders.b,{width:e,y:t-this.dt/2}),o.borders.r&&ie(o.borders.r,{height:t,x:e-this.dt/2}),o.borders.l&&ie(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.qm(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.Wn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{ke(n.mel.modelObject,e.modelObject)&&this.Qs(n.mel.id)})}};c(ps,"type","resizingTools"),ps=He([Xe("resizingTools")],ps);var eg="lineCrossings",eP="vjs-bridge",tP="vjs-bridge-vertical",rP="vjs-bridge-horizontal",nP="vjs-bridge-dot",iP="vjs-bridge-arch",IG="vjs-bridge-gap";function oP(i,r){let e=i.strokeWidth.other,t=i.stroke.other,n=e*5,o=r==="h"?i.point.x-n/2:i.point.x,s=r==="h"?i.point.x+n/2:i.point.x,a=r==="v"?i.point.y-n/2:i.point.y,l=r==="v"?i.point.y+n/2:i.point.y,h=M(q,{d:`M ${o} ${a} L ${s} ${l}`,stroke:"#000000","stroke-width":i.strokeWidth.ref+2}),d=M(q);d.setAttribute(pT,"none"),d.setAttribute("stroke-width",e),d.setAttribute("stroke",t),d.setAttribute("stroke-linecap","round"),d.classList.add(iP);let u=r==="h"?`M ${o} ${a} A ${n/2} ${n/2} 0 0 1 ${s} ${l}`:`M ${o} ${a} A ${n/2} ${n/2} 0 0 0 ${s} ${l} `;return d.setAttribute("d",u),[[d],n,[h]]}function sP(i,r,e,t){let n=e*2,o=M(Be);return t=t||i.stroke.ref,o.setAttribute("fill",t),o.setAttribute("stroke","none"),o.setAttribute("cx",`${i.point.x}`),o.setAttribute("cy",`${i.point.y}`),o.setAttribute("r",`${e}`),o.classList.add(nP),[[o],n,[]]}function aP(i,r){let e=i.strokeWidth.other*5,t=r==="h"?i.point.x-e/2:i.point.x,n=r==="h"?i.point.x+e/2:i.point.x,o=r==="v"?i.point.y-e/2:i.point.y,s=r==="v"?i.point.y+e/2:i.point.y,a=M(q,{d:`M ${t} ${o} L ${n} ${s}`,stroke:"#000000","stroke-width":i.strokeWidth.ref+2});return[[],e,[a]]}var tg=class extends Se{constructor(){super(...arguments);c(this,"Zn");c(this,"H");c(this,"Qm");c(this,"eg");c(this,"ec");c(this,"tg");c(this,"Pb");c(this,"ea",new Map);c(this,"ta");c(this,"rg");c(this,"tracksEdgeRedraws",!0);c(this,"Ke",new Map);c(this,"tc",new Map)}initialise(e,t){return this.rg=Eo(),this.Zn=e,this.H=t.orientation||"h",this.Qm=this.H==="h"?"v":"h",this.ta=t.bridgeType||"arch",this.ec=t.dotRadius||5,this.tg=t.dotColor,this.Pb=t.onTap,this.eg=this.H==="h"?rP:tP,e.bind($r,()=>{this.Ob()}),!0}$edgeRedraw(e){this.Zn.$_dataLoading||requestAnimationFrame(()=>{this.Ke.get(e.edge.id)!=null&&(this.ng(e.edge),this.ra(e.edge.id),this.ig(e.edge,!0))})}_b(e){let t=this.Zn.getRenderedConnection(e);if(t!=null)if(t.connector.type===zi||t.connector.type===Xr&&t.connector.constrain==="orthogonal"){let n=t.connector.internalSegments.map((d,u)=>({o:d.o,index:u,line:[{x:d.x1,y:d.y1},{x:d.x2,y:d.y2}],strokeWidth:t.paintStyle.strokeWidth||2})),o=t.connector.canvas,s=o.querySelector(".vjs-connector-path"),a=window.getComputedStyle(s),l=a.stroke,h=parseInt(a.strokeWidth,10);return{segments:n,connection:t,connector:t.connector,intersectingPoints:[],stroke:l,strokeWidth:h,canvasElement:o,pathElement:s,id:e}}else U(`WARN: unsupported connector type ${t.connector.type} in LineCrossingsPlugin`)}Rb(){this.ea.clear(),this.Zn.model.getAllEdges().forEach(t=>{this.ra(t.id)})}ra(e){let t=this._b(e);return t!=null?(this.ea.set(e,t),t):null}na(e){let t=this.ea.get(e);return t!=null?t:this.ra(e)}Lb(e){return e.filter(t=>t.o===this.H)}wb(e){return e.filter(t=>t.o===this.Qm)}Db(e){switch(this.ta){case"dot":return this.ec;case"arch":case"gap":return e.strokeWidth.other*5;default:return 0}}ng(e){this.Nb(this.Ke.get(e.id)||[]);let t=this.na(e.id);t!=null&&this.og(t,e.id)}Nb(e){e.forEach(t=>{t.canvasElements.forEach(s=>{s.parentElement&&s.parentElement.removeChild(s)}),t.masks.forEach(s=>{s.parentElement&&s.parentElement.removeChild(s)});let n=this.Ke.get(t.edge.id)||[],o=this.Ke.get(t.otherEdge.id)||[];this.Ke.set(t.edge.id,n.filter(s=>s.id!==t.id)),this.Ke.set(t.otherEdge.id,o.filter(s=>s.id!==t.id)),this.tc.delete(t.id)})}ig(e,t){var o;let n=this.na(e.id);if(n!=null){let s=this.Zn.viewport.findConnectorBoundsIntersectingWithRect(n.connector,0,!1,[],!0).filter(h=>h.id!==n.id),a=(h,d)=>{let u=this.Lb(h.segments),p=[];for(let g=0;g<d.length;g++)if(d[g].id!==h.id){let m=t?this.ra(d[g].id):this.na(d[g].id),E=this.wb(m.segments);for(let y=0;y<u.length;y++)for(let x=0;x<E.length;x++){let f=il(u[y].line,E[x].line);if(f!=null){let b=this.Db({strokeWidth:{other:m.strokeWidth}}),A=Pe(f,u[y].line[0]),T=Pe(f,u[y].line[1]),S=!1;if(A<b){let O=h.segments[u[y].index-1];(O==null||O.o!==u[y].o)&&(S=!0)}if(!S&&T<b){let O=h.segments[u[y].index+1];(O==null||O.o!==u[y].o)&&(S=!0)}if(!S){let O=Pe(f,E[x].line[0]),v=Pe(f,E[x].line[1]);if(O<b){let _=m.segments[E[x].index-1];(_==null||_.o!==E[x].o)&&(S=!0)}if(!S&&v<b){let _=m.segments[E[x].index+1];(_==null||_.o!==E[x].o)&&(S=!0)}}if(S)continue;p.push({index:u[y].index,point:f,o:{ref:u[y].o,other:E[x].o},strokeWidth:{ref:h.strokeWidth,other:m.strokeWidth},stroke:{ref:h.stroke,other:m.stroke},refConnector:h,otherConnector:m})}}}p.forEach(g=>{let m=this.Ib(g,h.connection.edge,h,g.otherConnector);this.Ke.get(h.connection.edge.id).push(m),this.Ke.get(g.otherConnector.connection.edge.id).push(m),this.tc.set(m.id,m)})};if(a(n,s),t)for(let h=0;h<s.length;h++){let d=this.na(s[h].id),u=s.slice();u.splice(h,1,n),a(d,u)}((o=this.Ke.get(e.id))==null?void 0:o.length)>0||this.og(n,e.id)}}Ob(){this.Rb();let e=this.Zn.model.getAllEdges();for(let t=0;t<e.length;t++)this.ig(e[t],!1)}Ib(e,t,n,o){let[s,a,l]=this.ta==="dot"?sP(e,this.H,this.ec,this.tg):this.ta==="arch"?oP(e,this.H):aP(e,this.H);if(s.forEach(h=>{h.classList.add(this.eg),h.classList.add(eP),h.classList.add(mu),h.setAttribute("transform",`translate(${-n.connector.x}, ${-n.connector.y})`),h.setAttribute("data-vjs-edge",n.connection.edge.id),h.setAttribute("data-vjs-other-edge",o.connection.edge.id),h.setAttribute("data-x",e.point.x),h.setAttribute("data-y",e.point.y),h.setAttribute("x",`${e.point.x-a/2}`),h.setAttribute("y",`${e.point.y-a/2}`),n.canvasElement.appendChild(h)}),l!=null&&l.length>0){let h=this.Vb(n,t.id),d=h.getAttribute("id");n.pathElement.setAttribute("mask",`url(#${d})`),l.forEach(u=>h.appendChild(u))}return{canvasElements:s,bgSize:a,masks:l,edge:t,otherEdge:o.connection.edge,id:G()}}destroy(){this.ea.clear(),this.tc.clear(),this.Ke.clear()}reset(){}Mb(e){return`vjs-lcp-${this.rg}-${e}`.replace(/\s/g,"_")}Vb(e,t){let n=e.connector.bounds.xmin,o=e.connector.bounds.ymin,s=e.connector.bounds.xmax-n,a=e.connector.bounds.ymax-o,l=50,h=e.canvasElement.querySelector("defs");h==null&&(h=M("defs"),e.canvasElement.appendChild(h));let d=h.querySelector("mask[data-type='vjs-lcp']");if(d==null){let p=this.Mb(t);d=M("mask",{id:p,"data-type":"vjs-lcp","data-vjs-edge-id":t,maskContentUnits:"userSpaceOnUse",maskUnits:"userSpaceOnUse",x:n-l,y:o-l,width:s+2*l,height:a+2*l}),h.appendChild(d)}else ie(d,{x:n-l,y:o-l,width:s+2*l,height:a+2*l});let u=d.querySelector("[vjs-lcp-white-mask]");return u==null?(u=M("rect",{x:n-l,y:o-l,width:s+2*l,height:a+2*l,fill:"#FFFFFF","vjs-lcp-white-mask":"true"}),d.appendChild(u)):ie(u,{x:n-l,y:o-l,width:s+2*l,height:a+2*l}),d}og(e,t){let n=e.canvasElement.querySelector("mask[data-type='vjs-lcp']");n&&(e.pathElement.removeAttribute("mask"),n.parentElement&&n.parentElement.removeChild(n))}$edgeRemoved(e){this.ng(e),this.Ke.delete(e.id)}$edgeRendered(e){this.Ke.set(e.edge.id,[])}};tg=He([Xe(eg)],tg);var lP=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(lP||{}),ng="state",rg=class extends Ft{constructor(e,t){super();this.components=e;this.params=t;c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===Ct?"paused":"playing"}setState(e){this.state=e,this.fire(ng,e)}pause(){this.state!=="paused"&&(this.currentlyAnimatingConnection?(this.currentlyAnimatingConnection.pause(),this.setState("paused")):this.setState("stopped"))}play(){this.state!=="playing"&&(this.currentlyAnimatingConnection?this.currentlyAnimatingConnection.play():this.components[0].handler.play(),this.setState("playing"))}cancel(){this.state!=="stopped"&&(this.currentlyAnimatingConnection&&this.currentlyAnimatingConnection.cancel(),this.params.cleanup(),this.setState("stopped"))}};var zh="startOverlayAnimation",oo="endOverlayAnimation",Oy="startNodeTraversal",hP="endNodeTraversal",Ry="vjs-animate-source",Ly="vjs-animate-target",Xn="vjs-animate-node-traversing",Xh="vjs-animate-edge-traversing",MG="vjs-animate-node-traversable",ig="vjs-animate-edge-traversable",VG="vjs-animate-node-traversed",wy="vjs-animate-edge-traversed";var cP="INITIALIZED",Dy="TRAVERSING_START",dP="TRAVERSING_EDGE",Ny="TRAVERSING_END",wa="CANCELLED",Da="FINISHED";function Sw(i,r,e,t){let n=new Ft,o=r.connector.totalLength;t=t||{};let s=G(),a=t.events||{};for(let $ in a)n.bind($,a[$]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,g=o/p*1e3,m=g/d,E=1/m*(h?1:-1),y=t.isFinal!==!1,x=h?0:1,f=x,b,A,T=()=>h?f>=1:f<=0,S=h?r.sourceElement:r.targetElement,O=h?r.targetElement:r.sourceElement,v,_=t.paused===!0,P=!1,I=!1,C=cP;typeof e=="string"?v={type:e,options:{location:x,id:s}}:(v={type:e.type,options:Object.assign({},e.options)},v.options.location=x,v.options.id=s);let R=$=>{I=!1,ko(r,s),window.clearInterval(b),y?$?(C=wa,i.surface.removeClass(S,Xn),i.surface.removeClass(O,Xn),Pr(r,Xh)):(C=Ny,i.surface.addClass(O,Xn),window.setTimeout(function(){V()},u)):(i.surface.removeClass(S,Xn),i.surface.removeClass(O,Xn),Pr(r,Xh),$?C=wa:(C=Da,Wr(r,wy),n.fire(oo,{connection:r,harness:l})))},w=()=>{f+=E,T()?R(!1):(A.location=f,r.instance.$repaintUIElementById(r.sourceId))},B=()=>{C=dP,n.fire(zh,{connection:r,harness:l}),A=Hl(r,v),b=window.setInterval(w,d)},N=()=>{!I&&C!==Da&&C!==wa&&(i.surface.removeClass(S,Xn),n.fire(hP,{connection:r,element:S,harness:l}),B())},V=()=>{!I&&C!==Da&&C!==wa&&(C=Da,i.surface.removeClass(S,Xn),i.surface.removeClass(O,Xn),Pr(r,Xh),n.fire(oo,{connection:r,harness:l}))},D=()=>{P=!0,I=!1,n.fire(Oy,{connection:r,element:S,harness:l}),i.surface.addClass(S,Xn),Wr(r,Xh),C=Dy,window.setTimeout(()=>{N()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===Dy?N():C===Ny?V():b=window.setInterval(w,d)):D()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==Da&&C!==wa&&(window.clearInterval(b),R(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(oo,D):_||D(),l}var og=class extends Ft{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=cd(o.start,()=>{this.surface.model.openTransaction(ut)}),o.step=cd(o.step,()=>{}),o.complete=cd(o.complete,()=>{this.surface.model.commitTransaction()}),o.start();let a=s.el.getBoundingClientRect(),l=t-a.x,h=n-a.y,d=o.duration||250,u=15,p=d/u,g=u/d*l,m=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+g*(E+1),a.y+m*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=X(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Wr(n,ig),Sw(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[oo]:()=>e.complete&&e.complete(),[zh]:()=>e.start&&e.start()}}))}tracePath(e){let t=e.path||this.surface.model.getPath({source:e.source,target:e.target});if(t.exists()){let n=(g,m)=>{this.fire(g,{edge:m.edge,connection:m,options:e.options})},o=[],s=null,a=null,l=t.result.path.length,h,d=this.surface.getRenderedElement(t.result.path[0].vertex),u=this.surface.getRenderedElement(t.result.path[t.result.path.length-1].vertex);this.surface.addClass(d,Ry),this.surface.addClass(u,Ly),t.eachEdge((g,m)=>{Wr(this.surface.$_connMap[m.id],ig)});for(let g=1;g<l;g++){let m=t.result.path[g].vertex.id,E=t.result.previous[m],y=!0,x=t.result.path[g].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=Sw(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:g===l-1,forwards:y,paused:!0,events:{[Oy]:f=>{h.currentlyAnimatingConnection=f.harness},[oo]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((g,m)=>{let E=this.surface.$_connMap[m.id];Pr(E,[wy,ig].join(" "))}),this.surface.removeClass(d,Ry),this.surface.removeClass(u,Ly),n(oo,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(zh,()=>{n(zh,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(oo,p),h=new rg(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(ng,e.listener),h.fire(ng,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var sg="vjs-shape-library-palette-set",Iy="vjs-shape-library-palette",jh="vjs-shape-library-palette-filter",Hh="vjs-shape-library-palette-shape",My="vjs-shape-library-palette-label",uP="vjs-shape-library-palette-set-title",Vy="vjs-shape-library-palette-set-shapes",pP="vjs-shape-library-palette-lasso";var GG=150,$G=100,BG="data-visible",so="data-category",ag="data-shape-id",gP="data-show-all",mP="data-vjs-type",FG="shape-icon",Tw="mainTemplate",vw="preparedTemplate",EP="setTemplate",Na="__vjsALL";function UG(i="Show all"){return{[EP]:`<div class="${sg}" data-category="{{id}}">
|
|
103
|
-
<div class="${
|
|
104
|
-
<div class="${
|
|
102
|
+
</div>`;default:return`<span>Unsupported type: ${i.type}</span>`}}var RC=class extends Jp{constructor(e){super(Object.assign(e,{templateResolver:t=>this.Eb(t),getDefaultValue:(t,n)=>{let o=this.Rm(t);if(o){let s=o.find(a=>a.id===n);return s?s.defaultValue:null}return null},cacheTemplates:!1}));c(this,"Un");c(this,"Xs");c(this,"Om");c(this,"_m");this.Un=e.ui.getShapeLibrary(),this.Xs=e.properties,this.Om=e.propertyMode||"override",this._m=e.noPropertiesMessage||"No configurable properties for this shape."}Rm(e){if(this.Om==="override"&&this.Xs!=null)return this.Xs;let t=this.Un.getShapeDefinition(e.type,e.category);if(t==null)return null;let n=t.properties;if(t.mergeProperties){let o=this.Un.getShapeSet(e.category||this.Un.defaultCategoryId);o&&o.properties&&(n=[...n||[],...o.properties])}else if(n==null||n.length===0){let o=this.Un.getShapeSet(e.category||this.Un.defaultCategoryId);n=o?o.properties:null}return n==null?this.Xs||[]:n}Eb(e){if(J(e)||Y(e)){let t=this.Rm(e.data);return t?xw(t,this._m):null}else return null}};var cy="drag",LC="tap",dy="draw";var uy=class{constructor(r,e){this.container=r;c(this,"templateRenderer");this.Bn(e)}Bn(r){this.templateRenderer=new es({templates:{tp:r}})}setData(r,e){e&&this.Bn(e);let t=this.templateRenderer.template("tp",r).childNodes;this.container.replaceChildren(...t)}};function bw(i){let r={type:null};for(let e=0;e<i.attributes.length;e++){let t=i.attributes.item(e);if(t.name.indexOf("data-vjs")===0){let n=t.name.split("-")[2];r[n]=t.value}}return r.type==null&&(r.type=be),r}var Aw="[data-vjs-type]";function NG(i,r,e){let t=(e.x-r.x)/r.width,n=(e.y-r.y)/r.height,o=e.width/r.width,s=e.height/r.height;return{x:Math.round(i.x+t*i.width),y:Math.round(i.y+n*i.height),width:Math.round(o*i.width),height:Math.round(s*i.height)}}var La=class{constructor(r,e){this.ui=r;c(this,"no");c(this,"source");c(this,"zn");c(this,"Lm");c(this,"Ht");c(this,"Wt");c(this,"wm");c(this,"an");c(this,"Th");c(this,"io");c(this,"Ch");c(this,"Ph");c(this,"Oh");c(this,"onDrag");c(this,"Rr");c(this,"_h");c(this,"hr");c(this,"Rh");c(this,"js");c(this,"Lh");c(this,"oo");c(this,"Dh");c(this,"Nh");c(this,"ao");c(this,"ks");c(this,"Dm");c(this,"Je");c(this,"lo",[]);c(this,"ho",[]);c(this,"Yn",[]);c(this,"Be");c(this,"G");c(this,"Xn");c(this,"Lr");c(this,"J");c(this,"jn");c(this,"Nm");c(this,"Ih");c(this,"Im");c(this,"Hs");c(this,"Vm");c(this,"Vh");c(this,"Mm");c(this,"ln");c(this,"Mh");c(this,"ve");c(this,"Gh");c(this,"$h");c(this,"co");this.no=e.mode||cy,this.Je=new ye,this.Rr=e.ignoreZoom===!0,this.Lm=e.ignoreGrid===!0,this.ln=e.canDrop||((t,n,o)=>this.ui.$canDrop(t,n,o)),this.Oh=e.canvasDropFilter||(t=>!0),this._h=e.elementGenerator,this.Th=e.dataGenerator||bw,this.Ch=e.typeGenerator||(t=>t.type),this.Ph=e.groupIdentifier||((t,n)=>n.getAttribute(ql)===Ct),this.io=e.dragSizeGenerator,this.hr=e.enabled!==!1,this.source=e.source,this.zn=e.selector||Aw,this.$h=new uy(this.source,e.contentTemplate||"<div/>"),e.data!=null&&this.$h.setData(e.data),this.Ht=e.dragActiveClass||fv,this.Wt=e.dragHoverClass||yv,this.wm=e.dragElementClass||bv,this.an=e.dragHoverCannotDropClass||xv,this.Mh=e.dragSize,this.Hs=e.allowDropOnNode===!0,this.Vm=e.ignoreDropOnNode===!0,this.Vh=e.allowDropOnGroup!==!1,this.Mm=e.allowDropOnEdge===!0,this.Im=e.allowDropOnCanvas!==!1,this.Rh=e.onVertexAdded,this.onDrag=e.onDrag,this.js=e.selectAfterAdd===!0,this.co=function(t){t.key==="Escape"&&(this.no===dy?this.ve!=null&&this.ui.setMode(br):(this.Bh(),this.mn()))}.bind(this),this.ui.bind(On,t=>{t===Fn&&this.ve==null?this.Gh!=null&&this.Gm(this.Gh.el):t!==Fn&&this.ve!=null&&(F(this.ve.el,mn),F(this.ui.rootElement,gh),this.Gh=this.ve,this.ve=null,document.removeEventListener(Bn,this.co))}),this.no===cy?this.fb():this.no===dy?this.yb(e):this.no===LC&&this.xb()}setEnabled(r){this.hr=r}setData(r,e){this.$h.setData(r,e)}Gm(r){let e=Bt(r,this.zn,this.source,!0);if(this.ve!=null){if(F(this.ve.el,mn),this.ve.el===e){this.ui.setMode(br);return}}else document.addEventListener(Bn,this.co);let t=this.Th(e);this.jn=this.io?this.io(this.Be,e):this.Mh,this.ve={el:e,data:t,objectType:e.getAttribute(ql)===Ct?se.objectType:ce.objectType,type:this.Ch(t)},L(this.ve.el,mn),L(this.ui.rootElement,gh),this.ui.setMode(Fn)}$m(r,e,t){this.Lh=n=>{if(this.hr){let o=n.target,s=Bt(o,this.zn,this.source,!0);if(!r(s)||(this.Ih=this.Rr?1:this.ui.getEffectiveVisibleZoom(),this.Be=this.Th(s),this.Oh&&!this.Oh(this.Be)))return;if(this.jn=this.io?this.io(this.Be,s):this.Mh,this.J=this._h?this._h(s,n,this.Be):e(s),this.J.removeAttribute("id"),L(this.J,this.wm),this.J.style.position=Qe,this.J.style.margin="0",this.Nm=this.Ph(this.Be,s)?se.objectType:ce.objectType,this.Xn=this.Nm===se.objectType?new se(this.ui.model.graph,this.Be):new ce(this.ui.model.graph,this.Be),er(this.J,{x:n.pageX,y:n.pageY}),!this.Rr){let a=-50/this.Ih;this.J.style.transform=`scale(${this.Ih}) translate(${a}%,${a}%)`}t(s,this.J),document.body.appendChild(this.J),this.ao=!1,this.ks=this.Im===!1?!1:this.ln!=null?this.ln(this.Xn,null,!0):!0,this.Dm=this.ui.getVisibleCanvasBounds(),this.Nh=this.ui.$getElementPositionInWindow(this.ui.rootElement),L(document.body,mt),L(this.ui.rootElement,this.Ht),this.Je.on(document,ae,this.Dh),this.lo.length=0,this.Yn.length=0,!this.Vm&&this.Hs&&this.ui.$getNodesInViewport().forEach(a=>{let l=a.el.el;this.lo.push({element:a.el.el,cssElement:l,r:a.el,managedElement:a.el,canDrop:this.ln?this.ln(this.Xn,a.el.modelObject,!1):this.Hs,vertex:a.el.modelObject,id:a.el.id,objectType:ce.objectType,modelObject:a.el.modelObject}),this.Hs&&L(l,this.Ht)}),this.ui.$getGroupsInViewport().forEach(a=>{let l=this.ui.getGroupDefinition(a.el.modelObject);if(l.canDrop==null||l.canDrop(this.Xn)){let h=this.ui.$_getGroupContentAreaInfo(a.el.id),d=this.ui.containerType==="SVG"?a.el.el:h.contentArea;this.ho.push({element:h.contentArea,canDrop:this.Vh===!1?!1:this.ln?this.ln(this.Xn,a.el.modelObject,!1):!0,vertex:a.el.modelObject,managedElement:a.el,cssElement:d,id:a.el.id,objectType:se.objectType,modelObject:a.el.modelObject,depth:Dc(a.el.modelObject),r:{x:a.el.x+h.internalOffset.x,y:a.el.y+h.internalOffset.y,width:a.el.width-h.internalOffset.x,height:a.el.height-h.internalOffset.y}}),this.Vh&&L(d,this.Ht)}}),this.ho.sort((a,l)=>l.depth-a.depth),this.Mm&&this.ui.model.getAllEdges().forEach(a=>{let l=this.ui.getRenderedConnection(a.id),h=l.connector.canvas,d=h;this.Yn.push({edge:a,connection:l,connector:l.connector,element:h,cssElement:d,id:a.id,canDrop:!0,r:this.ui.$getElementPositionInWindow(h),objectType:Ue.objectType,modelObject:a}),L(d,this.Ht)}),this.Je.on(document,Bn,this.co)}}}Bh(){this.Je.off(document,ae,this.Dh),this.Je.off(document,W,this.oo),this.Je.off(document,le,this.oo),F(document.body,mt),F(this.ui.rootElement,this.an),F(this.ui.rootElement,this.Ht),F(this.ui.rootElement,this.Wt),F(this.ui.rootElement,gh),this.Je.off(document,Bn,this.co),this.lo.forEach(r=>{F(r.cssElement,this.Ht)}),this.ho.forEach(r=>{F(r.cssElement,this.Ht)}),this.Yn.forEach(r=>{F(r.cssElement,this.Ht)}),this.G!=null&&(F(this.G.cssElement,this.Wt),F(this.G.cssElement,this.an))}Bm(r){this.oo=e=>{this.Bh(),this.ao&&(this.G!=null?this.G.objectType===ce.objectType&&this.G.canDrop?this.Fm(e,this.G.vertex):this.G.objectType===se.objectType&&this.G.canDrop?this.Ab(e):this.G.objectType===Ue.objectType&&this.G.canDrop&&this.Sb(e):this.ks&&this.Fm(e,null)),this.mn()}}Um(){this.Dh=r=>{er(this.J,{x:r.pageX,y:r.pageY}),this.jn&&Rr(this.J,this.jn.width,this.jn.height);let e=this.ui.$getElementPositionInWindow(this.J);if(rt(this.Nh,e)){if(!this.Lm&&this.ui.gridProfile.grid!=null){let o=this.ui.gridProfile.grid,s=this.ui.snapPageLocationToGrid(e.x+window.scrollX,e.y+window.scrollY,o);this.J.style.left=`${s.x+e.width/2}px`,this.J.style.top=`${s.y+e.height/2}px`,e=this.ui.$getElementPositionInWindow(this.J)}this.G!=null&&(F(this.G.cssElement,this.Wt),F(this.G.cssElement,this.an),this.G=null),this.Lr=NG(this.Dm,this.Nh,e);let t=[],n=!1;if(this.lo.forEach(o=>{rt(this.Lr,o.r)&&(t.push(o),n=o.canDrop)}),this.ho.forEach(o=>{rt(this.Lr,o.r)&&(t.push(o),n=o.canDrop)}),t.sort((o,s)=>{if(Y(o.vertex)&&Y(s.vertex)){if(ke(o.vertex,s.vertex))return-1;if(ke(s.vertex,o.vertex))return 1}return 0}),t.length>0&&(F(this.ui.rootElement,this.Wt),F(this.ui.rootElement,this.an),this.G=t[0],this.G.canDrop&&L(this.G.cssElement,this.Wt)),!n){for(let o=0;o<this.Yn.length;o++){let s=this.Yn[o],a=s.r,l=s.connector;if(rt(e,a)){let h=this.ui.fromPageLocation(e.x+window.scrollX,e.y+window.scrollY),d=this.ui.fromPageLocation(e.x+e.width+window.scrollX,e.y+e.height+window.scrollY),u={x:h.x,y:h.y,width:d.x-h.x,height:d.y-h.y};if(hS(l,u).length>0){this.G=s,L(this.G.cssElement,this.Wt);break}}}this.G==null&&(this.ks?L(this.ui.rootElement,this.Wt):L(this.ui.rootElement,this.an))}this.ao=!0}else F(this.ui.rootElement,this.Wt),F(this.ui.rootElement,this.an),this.ao=!1;this.onDrag&&this.onDrag(this.Be,this.J,r)}}fb(){this.Um(),this.Bm(le),this.$m(r=>!0,r=>r.cloneNode(!0),(r,e)=>{this.Je.on(document,le,this.oo)}),this.Je.on(this.source,ge,this.zn,this.Lh)}xb(){this.Um(),this.Bm(W),this.$m(r=>{let e=this.source.querySelector(`.${mn}`);return e===r?(F(e,mn),requestAnimationFrame(()=>{this.Bh(),this.mn()}),!1):!0},r=>{let e=r.cloneNode(!0);return this.Je.on(e,W,this.oo),e},(r,e)=>{let t=this.source.querySelector(`.${mn}`);t!=null&&F(t,mn),L(e,"vjs-palette-tap-mode-placeholder"),L(r,mn),L(this.ui.rootElement,gh)}),this.Je.on(this.source,W,this.zn,this.Lh)}Sb(r){if(this.G.objectType===Ue.objectType){let e=this.G.edge;this.ui.model.transaction(()=>{this.Fh(this.Be,this.Lr,this.J,r,this.G.vertex,(t,n,o)=>{let s=e.source,a=e.target,l=e.data||{};delete l.id,this.ui.model.removeEdge(e),this.ui.model.$_addEdge({source:s,target:t,data:l},yo,null),this.ui.model.$_addEdge({source:t,target:a,data:l},yo,null)})},ut)}}Ab(r){this.G.objectType===se.objectType&&(this.Lr.x-=this.G.r.x,this.Lr.y-=this.G.r.y,this.Fh(this.Be,this.Lr,this.J,r,this.G.vertex),this.ui.relayoutGroup(this.G.id))}Fm(r,e){this.Fh(this.Be,this.Lr,this.J,r,e)}Tb(r,e){let t={},n=this.ui.getModelPositionAttributes();for(let o in r)o===We?t[n.x]=r[o]:o===Te?t[n.y]=r[o]:t[o]=r[o];return Object.assign(t,e),t}Fh(r,e,t,n,o,s){let a=this.Ch(r),l=this.Ph(r,t),h=t.getAttribute("data-vjs-group-template"),d=this.Tb({left:e.x,top:e.y,type:a},r);o&&Y(o)&&(d.group=o.id);let u=null;if(o!=null){let g=this.ui.viewport.getElementBounds(o.id);g!=null&&(u={vertex:o,pos:{x:g.x,y:g.y},size:{width:g.width,height:g.height}})}let p=this.ui.getModelPositionAttributes();if(l){let g=m=>{let E=m.data[p.x]==null?e.x:m.data[p.x],y=m.data[p.y]==null?e.y:m.data[p.y];this.ui.setPosition(m,E,y),s&&s(m,E,y),this.Uh(this.ui.model.getGroup(m.id),u),this.js&&this.ui.model.setSelection(this.ui.model.getGroup(m.id))};h==null?this.ui.model.addFactoryGroup(a,d,g,null,!1):this.ui.model.addFactoryGroupWithTemplate(a,h,d,g,null,!1)}else this.ui.model.addFactoryNode(a,d,g=>{let m=g.data[p.x]==null?e.x:g.data[p.x],E=g.data[p.y]==null?e.y:g.data[p.y];this.ui.setPosition(g,m,E),s&&s(g,m,E),this.Uh(this.ui.model.getNode(g.id),u),this.js&&this.ui.model.setSelection(this.ui.model.getNode(g.id))},null,!1)}Uh(r,e){this.Rh&&this.Rh({vertex:r,dropTarget:e,doModelUpdate:(t,n)=>{setTimeout(()=>{this.ui.model.mergeTransaction(()=>{try{t(this.ui,this.ui.model,n)}catch(o){U("WARN: could not invoke model update callback after vertex added from palette")}})})}})}mn(){Array.from(this.source.querySelectorAll(`.${mn}`)).forEach(r=>{F(r,mn)}),this.Xn=null,this.Be=null,this.lo.length=0,this.ho.length=0,this.Yn.length=0,this.J&&this.J.parentElement.removeChild(this.J),this.J=null,this.jn=null,this.ao=!1,this.ks=!1}yb(r){this.Je.on(this.source,W,this.zn,n=>{let o=n.target;this.Gm(o)});let e=this.ui.$_useModelForSizes,t={allowClickToAdd:r.allowClickToAdd,clickToAddOnly:e===!1||r.clickToAddOnly===!0,typeGenerator:(n,o)=>Object.assign({},this.ve),autoExit:!0,lassoClass:r.lassoClass,onVertexAdded:n=>{this.Uh(n),this.js&&this.ui.model.setSelection(n)}};r.vertexPreviewGenerator!=null&&(t.vertexPreviewGenerator=(n,o)=>r.vertexPreviewGenerator(this.ve.objectType,this.ve.type,this.ve.data,n,o)),r.vertexPreviewUpdater!=null&&(t.vertexPreviewUpdater=(n,o,s)=>{r.vertexPreviewUpdater(s,n,o,this.ve.data)}),this.ui.addPlugin({type:fi.type,options:t})}};var Fh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"$component")}initialise(e,t){return this.$component=new Vp(t.container,e,t),!0}destroy(){}reset(){}};c(Fh,"type","controls"),Fh=He([Xe("controls")],Fh);var Kp=class extends Se{constructor(){super(...arguments);c(this,"$component");c(this,"id")}initialise(e,t){return this.$component=new Ra(t.container,e,t),!0}destroy(){}reset(){}};Kp=He([Xe("exportControls")],Kp);var ls=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"uo",[]);c(this,"dragGroupAssigner")}initialise(e,t){return this.surface=e,this.uo=[],this.dragGroupAssigner=t.assignDragGroup,e.bind(Yr,n=>{this.po(n.el,n.vertex)}),e.bind(Ur,n=>{this.po(n.el,n.vertex)}),e.bind(Fr,n=>{this.vb()}),e.bind(zs,n=>{this.po(n.el,n.modelObject)}),!0}destroy(){}reset(){this.uo.length=0}assignToDragGroup(...e){e.forEach(t=>{let n=this.surface.getObjectInfo(t,!1);n.el&&this.po(n.el,n.obj)})}removeFromDragGroup(...e){this.surface.removeFromDragGroup(...e.map(t=>this.surface.getObjectInfo(t,!1).el).filter(t=>t!=null))}addToDragGroup(e,...t){this.surface.addToDragGroup(e,...t.map(n=>this.surface.getObjectInfo(n,!1).el).filter(n=>n!=null))}po(e,t){if(this.dragGroupAssigner!=null)if(this.surface.isSuspendRendering())this.uo.push([e,t]);else{let n=this.dragGroupAssigner(t);if(n!=null){let o=typeof n=="string"?{id:n,active:!0}:n;this.surface.$addToDragGroup(Object.assign(o,{membership:wC}),e)}else this.surface.$_assignRemoveFromDragGroup(e)}}vb(){if(this.dragGroupAssigner!=null)for(let e=0;e<this.uo.length;e++)this.po.apply(this,this.uo[e])}};c(ls,"type","dragGroups"),ls=He([Xe("dragGroups")],ls);var qp="vjs-snapline",DC="vjs-snapline-vertical",NC="vjs-snapline-horizontal",py="vjs-snapline-exact",IC="vjs-snapline-active",MC="vjs-snapline-active-exact",hs=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"panZoom");c(this,"tolerance",5);c(this,"showCenters");c(this,"showEdges");c(this,"verticalRanges",[]);c(this,"horizontalRanges",[]);c(this,"selectedRanges",[]);c(this,"focus",null);c(this,"enabled",!0)}setEnabled(e){let t=this.enabled;this.enabled=e,t&&this.reset()}initialise(e,t){this.surface=e,this.panZoom=e.panZoom,this.tolerance=t.tolerance||5,this.showCenters=t.showCenters!==!1,this.showEdges=t.showEdges!==!1,this.enabled=t.enabled!==!1,this.surface.bind(Vs,o=>{if(this.enabled&&o.dragGroup.length>0){let s=o.dragGroup[0],a=this.surface.viewport.getElements();this.focus=s.element,this.verticalRanges.length=0,this.horizontalRanges.length=0,this.selectedRanges.length=0;for(let l in a)if(l!==this.focus.id){let h=a[l].t,d=h.width,u=h.height;this.showEdges&&(this.horizontalRanges.push({position:We,start:h.x-this.tolerance,end:h.x+this.tolerance,objId:l,line:this.zh(h.x),el:a[l].el,orientation:"v"}),this.horizontalRanges.push({position:yt,start:h.x+d-this.tolerance,end:h.x+d+this.tolerance,objId:l,line:this.zh(h.x+d),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:Te,start:h.y-this.tolerance,end:h.y+this.tolerance,objId:l,line:this.Yh(h.y),el:a[l].el,orientation:"h"}),this.verticalRanges.push({position:ht,start:h.y+h.height-this.tolerance,end:h.y+h.height+this.tolerance,objId:l,line:this.Yh(h.y+u),el:a[l].el,orientation:"h"})),this.showCenters&&(this.horizontalRanges.push({position:It,start:h.x+d/2-this.tolerance,end:h.x+d/2+this.tolerance,objId:l,line:this.zh(h.x+d/2),el:a[l].el,orientation:"v"}),this.verticalRanges.push({position:It,start:h.y+u/2-this.tolerance,end:h.y+u/2+this.tolerance,objId:l,line:this.Yh(h.y+u/2),el:a[l].el,orientation:"h"}))}}}),this.surface.bind(Mt,o=>{if(this.enabled&&o.dragGroup.length>0){this.Ws();let s=o.dragGroup[0],a=s.pos.x,l=a+this.focus.width/2,h=a+this.focus.width,d=s.pos.y,u=d+this.focus.height/2,p=d+this.focus.height,g={};for(let m=0;m<this.horizontalRanges.length;m++){let E=this.horizontalRanges[m];g[E.objId]||(E.start<=l&&E.end>=l?(g[E.objId]=!0,this.kn(E,l)):E.start<=a&&E.end>=a?(g[E.objId]=!0,this.kn(E,a)):E.start<=h&&E.end>=h&&(g[E.objId]=!0,this.kn(E,h)))}for(let m=0;m<this.verticalRanges.length;m++){let E=this.verticalRanges[m];g[E.objId]||(E.start<=u&&E.end>=u?(g[E.objId]=!0,this.kn(E,u)):E.start<=d&&E.end>=d?(g[E.objId]=!0,this.kn(E,d)):E.start<=p&&E.end>=p&&(g[E.objId]=!0,this.kn(E,p)))}}});let n=()=>{this.enabled&&(this.Ws(),this.verticalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.horizontalRanges.forEach(o=>{this.surface.unfixElement(o.line)}),this.verticalRanges.length=0,this.horizontalRanges.length=0)};return this.surface.bind(Vt,o=>n()),this.surface.bind(sd,o=>n()),!0}kn(e,t){this.selectedRanges.push(e);let n=(e.start+e.end)/2,o=Math.round(t)===Math.round(n);o?e.line.classList.add(`${py}`):e.line.classList.remove(`${py}`);let s={x:e.orientation===qx?-5e4:n,y:e.orientation===Vc?-5e4:n};this.surface.fixElement(e.line,s,null,null,!0),L(e.el,`${IC}`),o&&L(e.el,`${MC}`)}Ws(){this.selectedRanges.forEach(e=>{e.line.classList.remove(`${py}`),this.surface.unfixElement(e.line),F(e.el,`${IC}`),F(e.el,`${MC}`)})}Yh(e){if(this.surface.containerType==="SVG")return Qr(Gt,Z,{y:`${e}px`},`${qp} ${NC}`,{x:"-50000",width:"100000",height:"1"});{let t=document.createElement(qe);return t.className=`${qp} ${NC}`,t.style.left="-50000px",t.style.right="-50000px",t.style.top=`${e}px`,t}}zh(e){if(this.surface.containerType==="SVG")return Qr(Gt,Z,{x:`${e}px`},`${qp} ${DC}`,{y:"-50000",height:"100000",width:"1"});{let t=document.createElement(qe);return t.className=`${qp} ${DC}`,t.style.top="-50000px",t.style.bottom="-50000px",t.style.left=`${e}px`,t}}destroy(){this.Ws()}reset(){this.Ws()}};c(hs,"type","snaplines"),hs=He([Xe("snaplines")],hs);var Uh=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"$palette")}destroy(){}initialise(e,t){return this.$palette=new La(e,t),!0}reset(){}};c(Uh,"type","palette"),Uh=He([Xe("palette")],Uh);var cs=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"startPanTimeout");c(this,"panRepeatInterval");c(this,"panRepeatDistance");c(this,"mo",[]);c(this,"zm",null);c(this,"currentPanButton",null);c(this,"surface");c(this,"panZoom");c(this,"panDistance");c(this,"eventManager");c(this,"Ym",!1);c(this,"Xh");c(this,"Xm")}initialise(e,t){return this.eventManager=new ye,this.surface=e,this.panZoom=e.panZoom,this.startPanTimeout=t.startPanTimeout||150,this.panRepeatInterval=t.panRepeatInterval||60,this.panRepeatDistance=t.panRepeatDistance||10,this.panDistance=t.panDistance||50,this.Xh=()=>{this.panZoom.stopPanRepeat(),window.clearTimeout(this.zm),this.currentPanButton&&this.surface.removeClass(this.currentPanButton,Of),this.currentPanButton=null,this.eventManager.off(document,le,this.Xh)},this.Xm=()=>{this.panZoom.stopPanRepeat()},this.makePanButton(Te,{left:"0px",top:"0px"},0,-1,"↑"),this.makePanButton(ht,{left:"0px",bottom:"0px"},0,1,"↓"),this.makePanButton(We,{left:"0px",top:"0px"},-1,0,"←"),this.makePanButton(yt,{right:"0px",top:"0px"},1,0,"→"),!0}curryPanButton(e,t){return n=>{this.Ym||this.panZoom.pan(e*this.panDistance,t*this.panDistance,!0),this.Ym=!1}}startPanTimer(e,t,n){return()=>{this.currentPanButton=n,this.surface.addClass(this.currentPanButton,Of),this.eventManager.on(document,le,this.Xh),this.zm=window.setTimeout(()=>{this.eventManager.on(document,le,this.Xm),this.panZoom.startPanRepeat(e,t,this.panRepeatDistance,this.panRepeatDistance,this.panRepeatInterval)},this.startPanTimeout)}}makePanButton(e,t,n,o,s){let a=document.createElement(qe);return a.innerHTML=s||"",a.style.position=Qe,Object.assign(a.style,t),a.className=`${_f} ${_f}-${e}`,this.panZoom.viewportElement.appendChild(a),this.eventManager.on(a,Ye,this.curryPanButton(n,o)),this.eventManager.on(a,ge,this.startPanTimer(n,o,a)),this.mo.push(a),a}destroy(){for(let e=0;e<this.mo.length;e++)this.mo[e].parentNode.removeChild(this.mo[e]);this.mo.length=0}reset(){}};c(cs,"type","panButtons"),cs=He([Xe("panButtons")],cs);var gy="[data-vjs-list='true']",IG="data-vjs-list-behavior",Yh=class extends Se{constructor(){super(...arguments);c(this,"id","list-manager");c(this,"surface");c(this,"options");c(this,"Hn",null)}initialise(e,t){this.surface=e,this.options=t,e.addWheelSelectorFilter(`${gy}, ${gy} *`);let n=e.getContainer();return e.on(n,"wheel",gy,(o,s)=>{this.Hn||(this.Hn=window.requestAnimationFrame(()=>{this.wheelHandler(o,s),this.Hn=null}))}),!0}jm(e){[e.source,e.target].forEach(t=>{let n=this.surface.getRenderedElement(t);if(n){let o=n.closest(gy);o&&this.wheelHandler(null,o)}})}$edgeRendered(e){this.jm(e.edge)}$edgeUpdated(e){this.jm(e)}wheelHandler(e,t){let n=this.surface.$getAttribute(t,IG)||this.options.behavior||"proxy",o=this.surface.getObjectInfo(t,!1);if(o.obj){let{vertices:s,contentEl:a}=Y(o.obj)?{vertices:o.obj.members,contentEl:this.surface.$getGroupContentAreaElement(o.el)}:{vertices:o.obj.getPorts(),contentEl:o.el},l=a.getBoundingClientRect(),h=o.el.getBoundingClientRect(),d=Math.max(l.top,h.top),u=Math.min(l.bottom,h.bottom);s.forEach(p=>{this.surface.$revalidateElementById(p.id);let g=this.surface.getElement(p.id),E=g.el.getBoundingClientRect(),y=E.bottom<=d||E.top>=u||E.right<=l.left||E.left>=l.right;p.getAllEdges().forEach(f=>{let b=f.source.id===p.id?"source":"target";if(n==="proxy"){let A=this.surface.getRenderedConnection(f.id);if(A!=null)if(y){let T=A.anchors[b],O=T.locations[T.currentLocation].x<.5?"Left":"Right",_=`${E.bottom<=d?"Top":"Bottom"}${O}`,P=St(_);this.surface.$_proxyEdge(f,b,this.surface.getElement(o.id),P)}else this.surface.$_unproxyEdge(f,b)}else f.Zs=f.Zs||new Set,y?f.Zs.add(b):f.Zs.delete(b),this.surface.setVisible(f,f.Zs.size===0)}),this.surface.$repaintUIElement(g,null,!1,!0)})}}destroy(){this.Hn&&(window.cancelAnimationFrame(this.Hn),this.Hn=null)}reset(){}};c(Yh,"type","listManager"),Yh=He([Xe("listManager")],Yh);var VC="vjs-vertex-drawing-lasso",my="vjs-group-candidate-child";var fi=class extends Se{constructor(){super(...arguments);c(this,"id");c(this,"surface");c(this,"lasso");c(this,"autoExit");c(this,"typeGenerator");c(this,"groupType");c(this,"nodeType");c(this,"defaultGroupSize");c(this,"defaultNodeSize");c(this,"km");c(this,"jh");c(this,"Wn");c(this,"Zn");c(this,"Js");c(this,"Ks");c(this,"$onVertexAdded");c(this,"kh");c(this,"vertexSelection");c(this,"selectedElements",[])}destroy(){}Cb(e,t){if(this.typeGenerator!=null){let o=this.typeGenerator(e,t);this.Zn=o.objectType,this.Js=o.type,this.Ks=o.data||{}}else this.nodeType!=null?(this.Zn=ce.objectType,this.Js=this.nodeType,this.Ks={}):(this.Zn=se.objectType,this.Js=this.groupType||be,this.Ks={});let n=this.surface.getModelObjectFromElement(t.target,!0,!1);n!=null&&Y(n.obj)?this.Wn=n.obj:this.Wn=null}initialise(e,t){this.surface=e,this.kh=t.minSize||{width:50,height:50},this.nodeType=t.nodeType,this.groupType=t.groupType,this.typeGenerator=t.typeGenerator,this.jh=e.$_useModelForSizes===!1||t.clickToAddOnly===!0,this.km=this.jh||t.allowClickToAdd===!0,this.defaultGroupSize=t.defaultGroupSize||{width:250,height:250},this.defaultNodeSize=t.defaultNodeSize||{width:80,height:80},this.$onVertexAdded=t.onVertexAdded||(s=>{});let n=`${VC} ${t.lassoClass||""}`;e.bind(On,s=>{this.lasso.enabled=s===Fn}),this.vertexSelection=new dr(e.model),this.autoExit=t.autoExit===!0;let o={surface:e,invert:t.invert,canvas:e.getContainer(),cssClass:n,mapToGrid:s=>{if(this.surface.gridProfile.grid){let a=this.surface.fromPageLocation(s.x,s.y),l=he(a,this.surface.gridProfile.grid);return this.surface.toPageLocation(l.x,l.y)}else return s},onStart:(s,a,l,h)=>{e.hoverSuspended=!0,this.Cb(a,h)},onSelect:(s,a,l,h,d,u,p)=>{if(p!=null&&t.vertexPreviewUpdater&&t.vertexPreviewUpdater(s,a,p),this.Zn===se.objectType){this.vertexSelection.clear(),this.Hm();let g=[],m,E=e.findIntersectingVertices({origin:l,dimensions:h,dontIncludeGroups:!1,dontIncludeNodes:!1,dontIncludeNodesInsideGroups:!1,enclosed:!0,dontIncludeNestedGroups:!1}),y=E.length,x={};for(m=0;m<y;m++)g.push(E[m].v),x[E[m].id]=!0,this.vertexSelection.append(E[m].v),L(E[m].el,my),this.selectedElements.push(E[m].el)}},onEnd:(s,a)=>{e.hoverSuspended=!1,this.Hm(),this.autoExit&&e.mode!==ns&&e.setMode(br);let l=e.getEffectiveVisibleZoom(),h={width:Math.round(a.width/l),height:Math.round(a.height/l)};this.Wm(s,h)},filter:s=>{let a=s.srcElement||s.target;return a===e.vertexLayer||a===e.$getCanvasElement()},onClick:(s,a)=>{if(this.autoExit&&e.mode!==ns&&e.setMode(br),this.km){let l=this.Zn===se.objectType?this.defaultGroupSize:this.defaultNodeSize;this.Wm(s,l)}}};return t.vertexPreviewGenerator!=null&&(o.generateLassoContent=(s,a)=>t.vertexPreviewGenerator(s,a)),this.lasso=new Sa(o),this.jh&&this.lasso.setEnabled(!1),!0}Wm(e,t){let n=this.surface.fromPageLocation(e.x,e.y);(t.width>=this.kh.width||t.height>=this.kh.height)&&(this.Zn===se.objectType?this.Pb(this.surface,n,t):this.Ob(this.surface,n,t))}Zm(e,t){return Object.assign(this.Ks,{id:G(),[this.surface.$modelLeftAttribute]:e.x,[this.surface.$modelTopAttribute]:e.y,width:t.width,height:t.height,type:this.Js})}_b(){let e=this.vertexSelection.getNodes(),t=this.vertexSelection.getGroups(),n={nodes:[],groups:[]};return e.forEach(o=>{t.find(s=>ke(o,s))==null&&n.nodes.push(o)}),t.forEach(o=>{t.find(s=>ke(o,s))==null&&n.groups.push(o)}),n}Pb(e,t,n){let o;e.model.transaction(()=>{let s=this.Zm(t,n),a=s[this.surface.$modelLeftAttribute],l=s[this.surface.$modelTopAttribute];o=e.model.addGroup(s);let h=[{v:o,x:a,y:l}];e.setSuspendRendering(!0);let d=this._b();d.nodes.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateNode(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),d.groups.forEach(u=>{let p=e.viewport.getPosition(u.id),g=p.x-t.x,m=p.y-t.y;e.model.addToGroup(u,o),e.model.updateGroup(u,{[e.$modelLeftAttribute]:g,[e.$modelTopAttribute]:m}),h.push({v:u,x:g,y:m})}),h.forEach(u=>{e.setPosition(u.v,u.x,u.y)}),this.Wn!=null&&e.model.addToGroup(o,this.Wn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Ob(e,t,n){let o;e.setSuspendRendering(!0);let s=this.Zm(t,n);e.model.transaction(()=>{o=e.model.addNode(s);let a={x:s[this.surface.$modelLeftAttribute],y:s[this.surface.$modelTopAttribute]};e.setPosition(o,a.x,a.y),this.Wn!=null&&e.model.addToGroup(o,this.Wn)}),e.setSuspendRendering(!1),this.$onVertexAdded(o)}Hm(){this.selectedElements.forEach(e=>F(e,my)),this.selectedElements.length=0}reset(){}};c(fi,"type","vertexDrawing"),fi=He([Xe("vertexDrawing")],fi);var Qp=12,GC=40,$C=16,BC=6,FC=30,UC=30,YC=5,zC="borders",zh="handles",XC="vjs-resize-skeleton",jC="vjs-resize-skeleton-borders",HC="vjs-resize-skeleton-borders-visible",kC="vjs-resize-frame",Tt="vjs-resize-handle",Ey="vjs-resize-handle-active",fy="vjs-resize-handle-tl",yy="vjs-resize-handle-bl",xy="vjs-resize-handle-tr",by="vjs-resize-handle-br",Ay="vjs-resize-handle-t",Sy="vjs-resize-handle-b",Ty="vjs-resize-handle-l",vy="vjs-resize-handle-r",ds="vjs-resize-border",WC="vjs-resize-border-b",ZC="vjs-resize-border-t",JC="vjs-resize-border-l",KC="vjs-resize-border-r",Xh="vjs-rotate-handle",eg="vjs-rotate-leader",Cy="data-vjs-x-resize",Py="data-vjs-y-resize",_y="data-vjs-resizable",Oy="data-vjs-rotatable",wa="data-dir";function Ge(i,r,e,t){let n=M(i,t),o=r.join(" ");return L(n,o),e&&e.appendChild(n),n}function Ry(i,r){Ie(i,r.ro),r.r!=null&&pi(i,r.r)}var us=(i,r)=>`translate(${-(i/2)-r/2}, ${-(i/2)-r/2})`;function qC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ge(Z,[Tt,fy],n,{"data-dir":"tl",[te]:e.id,width:i,height:i,x:l-o,y:h-o,transform:us(i,t)}),p.tr=Ge(Z,[Tt,xy],n,{"data-dir":"tr",[te]:e.id,width:i,height:i,x:d+o,y:h-o,transform:us(i,t)}),p.bl=Ge(Z,[Tt,yy],n,{"data-dir":"bl",[te]:e.id,width:i,height:i,x:l-o,y:u+o,transform:us(i,t)}),p.br=Ge(Z,[Tt,by],n,{"data-dir":"br",[te]:e.id,width:i,height:i,x:d+o,y:u+o,transform:us(i,t)})),a&&(p.t=Ge(Z,[Tt,Ay],n,{"data-dir":"t",[te]:e.id,x:(l+d)/2,y:h-o,width:i,height:i,transform:us(i,t)}),p.b=Ge(Z,[Tt,Sy],n,{"data-dir":"b",[te]:e.id,x:(l+d)/2,y:u+o,width:i,height:i,transform:us(i,t)})),s&&(p.l=Ge(Z,[Tt,Ty],n,{"data-dir":"l",[te]:e.id,x:l-o,y:(h+u)/2,width:i,height:i,transform:us(i,t)}),p.r=Ge(Z,[Tt,vy],n,{"data-dir":"r",[te]:e.id,x:d+o,y:(h+u)/2,width:i,height:i,transform:us(i,t)})),p}function QC(i,r,e,t,n,o,s,a){let l=0,h=0,d=r.width,u=r.height,p={tr:null,t:null,tl:null,l:null,bl:null,b:null,br:null};return s&&a&&(p.tl=Ge(Be,[Tt,fy],n,{"data-dir":"tl",[te]:e.id,cx:l-o,cy:h-o,r:i/2}),p.tr=Ge(Be,[Tt,xy],n,{"data-dir":"tr",[te]:e.id,r:i/2,cx:d+o,cy:h-o}),p.bl=Ge(Be,[Tt,yy],n,{"data-dir":"bl",[te]:e.id,r:i/2,cx:l-o,cy:u+o}),p.br=Ge(Be,[Tt,by],n,{"data-dir":"br",[te]:e.id,r:i/2,cx:d+o,cy:u+o})),a&&(p.t=Ge(Be,[Tt,Ay],n,{"data-dir":"t",[te]:e.id,cx:(l+d)/2,cy:h-o,r:i/2}),p.b=Ge(Be,[Tt,Sy],n,{"data-dir":"b",[te]:e.id,cx:(l+d)/2,cy:u+o,r:i/2})),s&&(p.l=Ge(Be,[Tt,Ty],n,{"data-dir":"l",[te]:e.id,cx:l-o,cy:(h+u)/2,r:i/2}),p.r=Ge(Be,[Tt,vy],n,{"data-dir":"r",[te]:e.id,cx:d+o,cy:(h+u)/2,r:i/2})),p}function Sw(i){return{tl:{anchor:[1,1],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:t,y:n},i.grid);t=h.x,n=h.y;let d=he({x:i.$x2,y:i.$y2},i.grid);o=d.x-t,s=d.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),n>i.$y2-l&&(n=i.$y2-l,s=l),{x:t,y:n,width:o,height:s}},id:"tl"},tr:{anchor:[0,1],id:"tr",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1+e,o=i.$y2-n,s=i.$x1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:s+t,y:n},i.grid);t=h.x-s,n=h.y,o=he({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),n>i.$y2-l&&(n=i.$y2-l,o=l),{x:s,y:n,width:t,height:o}}},bl:{anchor:[1,0],id:"bl",resize:(r,e)=>{let t=i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x2-t,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:t,y:s+n},i.grid);t=h.x,n=h.y-s,o=he({x:i.$x2,y:h.y},i.grid).x-t}return t>i.$x2-a&&(t=i.$x2-a,o=a),n<l&&(n=l),{x:t,y:s,width:o,height:n}}},br:{anchor:[0,0],id:"br",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minWidth(),l=i.$minHeight();if(i.grid&&!i.ignoreGrid){let h=he({x:o+t,y:s+n},i.grid);t=h.x-o,n=h.y-s}return t<a&&(t=a),n<l&&(n=l),{x:o,y:s,width:t,height:n}}},t:{anchor:[.5,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$x2-t,s=i.$y2-n,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(n=he({x:t,y:n},i.grid).y,s=he({x:i.$x2,y:i.$y2},i.grid).y-n),n>i.$y2-a&&(n=i.$y2-a,s=a),{x:t,y:n,width:o,height:s}},id:"t"},b:{anchor:[.5,0],resize:(r,e)=>{let t=i.$x1,n=i.$y1,o=i.$x2-i.$x1,s=i.$y2-i.$y1+e,a=i.$minHeight();return i.grid&&!i.ignoreGrid&&(s=he({x:t,y:n+s},i.grid).y-n),s<a&&(s=a),{x:t,y:n,width:o,height:s}},id:"b"},l:{anchor:[1,.5],resize:(r,e)=>{let t=i.$x1+r,n=i.$y1+e,o=i.$x2-t,s=i.$y2-i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=he({x:t,y:n},i.grid).x,o=he({x:i.$x2,y:i.$y2},i.grid).x-t),t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}},id:"l"},r:{anchor:[0,.5],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y2-i.$y1,o=i.$x1,s=i.$y1,a=i.$minWidth();return i.grid&&!i.ignoreGrid&&(t=he({x:o+t,y:s+n},i.grid).x-o),t<a&&(t=a),{x:o,y:s,width:t,height:n}}}}}function Tw(i){return{l:{anchor:[1,0],id:"l",resize:(r,e)=>{let t=i.$x1+r,n=i.$y1,o=i.$x2-t,s=i.$y2-n,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=he({x:t,y:n},i.grid);t=l.x,n=l.y;let h=he({x:i.$x2,y:i.$y2},i.grid);o=h.x-t,s=h.y-n}return t>i.$x2-a&&(t=i.$x2-a,o=a),{x:t,y:n,width:o,height:s}}},r:{anchor:[0,1],id:"r",resize:(r,e)=>{let t=i.$x2-i.$x1+r,n=i.$y1,o=i.$y2-n,s=i.$x1,a=i.$minWidth();if(i.grid&&!i.ignoreGrid){let l=he({x:s+t,y:n},i.grid);t=l.x-s,n=l.y,o=he({x:i.$x2,y:i.$y2},i.grid).y-n}return t<a&&(t=a),{x:s,y:n,width:t,height:o}}},t:{id:"t",anchor:[0,1],resize:(r,e)=>{let t=i.$x1,n=i.$y1+e,o=i.$y2-n,s=i.$x2-t,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=he({x:t,y:n+o},i.grid);t=l.x,o=l.y-n,s=he({x:i.$x2,y:l.y},i.grid).x-t}return n>i.$y2-a&&(n=i.$y2-a,o=a),{x:t,y:n,width:s,height:o}}},b:{id:"b",anchor:[0,0],resize:(r,e)=>{let t=i.$x2-i.$x1,n=i.$y2-i.$y1+e,o=i.$x1,s=i.$y1,a=i.$minHeight();if(i.grid&&!i.ignoreGrid){let l=he({x:o+t,y:s+n},i.grid);t=l.x-o,n=l.y-s}return n<a&&(n=a),{x:o,y:s,width:t,height:n}}}}}function eP(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)-o*Math.sin(e),y:n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}function tP(i,r,e,t){t=t||{x:0,y:0};let n=i-t.x,o=r-t.y,s={x:n*Math.cos(e)+o*Math.sin(e),y:-n*Math.sin(e)+o*Math.cos(e)};return{x:s.x+t.x,y:s.y+t.y}}var ps=class extends Se{constructor(){super(...arguments);c(this,"id","resizingTools");c(this,"surface");c(this,"instance");c(this,"widthAtt");c(this,"heightAtt");c(this,"leftAtt");c(this,"topAtt");c(this,"xAxis");c(this,"yAxis");c(this,"resizeX");c(this,"resizeY");c(this,"canResizeFilter");c(this,"canRotateFilter");c(this,"onEdit");c(this,"onDemand");c(this,"hn");c(this,"wr");c(this,"go");c(this,"Hh");c(this,"Wh");c(this,"Jm");c(this,"Zh");c(this,"skeletons");c(this,"ct");c(this,"Dr");c(this,"qs");c(this,"Eo");c(this,"Qs");c(this,"he");c(this,"Nr");c(this,"downAt");c(this,"Jh");c(this,"handler");c(this,"toolkitDragObject");c(this,"ea");c(this,"$x1");c(this,"$x2");c(this,"$y1");c(this,"$y2");c(this,"Kh");c(this,"minimumHeight");c(this,"minimumWidth");c(this,"currentMinimumWidth");c(this,"currentMinimumHeight");c(this,"ignoreGrid");c(this,"grid");c(this,"Km");c(this,"qm");c(this,"qh");c(this,"Tt",!1);c(this,"Qh",!1);c(this,"ta",!1);c(this,"$handleOffset");c(this,"ec");c(this,"tc");c(this,"vt");c(this,"rc");c(this,"cn");c(this,"Ce");c(this,"dt");c(this,"eg");c(this,"resizeMethod");c(this,"bordersVisible");c(this,"tg");c(this,"rg")}Qm(e){this.toolkitDragObject&&this.skeletons[this.toolkitDragObject.id]&&(e?L(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"):F(this.skeletons[this.toolkitDragObject.id].el,"vjs-resize-active"))}set $moving(e){this.Tt=e,this.Qm(e)}set $rotating(e){this.Qh=e,this.Qm(e)}get $busy(){return this.Tt||this.Qh}destroy(){}initialise(e,t){this.surface=e,this.$handleOffset=t.handleOffset||YC,this.ec=t.modelUpdater,this.tc=t.handlerFactory,this.tg=Sw(this),this.rg=Tw(this),e.$addTransferrableVertexAttributes([_y,Py,Cy,Oy]),this.instance=e.model,this.skeletons={},this.widthAtt=t.widthAttribute||this.instance.modelWidthAttribute,this.heightAtt=t.heightAttribute||this.instance.modelHeightAttribute,this.leftAtt=t.leftAttribute||this.instance.modelLeftAttribute,this.topAtt=t.topAttribute||this.instance.modelTopAttribute,this.onEdit=t.onEdit||function(){},this.onDemand=t.onDemand===!0,this.minimumWidth=t.minimumWidth!=null&&t.minimumWidth>0?t.minimumWidth:FC,this.minimumHeight=t.minimumHeight!=null&&t.minimumHeight>0?t.minimumHeight:UC,this.grid=this.surface.getGrid(),this.ignoreGrid=t.ignoreGrid===!0,this.qm=t.constrainGroups!==!1,this.canResizeFilter=t.canResizeFilter,this.canRotateFilter=t.canRotateFilter,this.vt=t.handleSize||Qp,this.rc=t.handleShape||"circle",this.cn=t.rotateLeaderLength||GC,this.Ce=t.rotateHandleSize||$C,this.dt=t.borderHandleSize||BC,this.resizeMethod=t.resizeMethod||zh,this.bordersVisible=this.resizeMethod===zC&&t.bordersVisible!==!1,this.Km=t.rotatable===!0,this.qh=t.rotationStops,this.resizeX=t.resizeX!==!1,this.resizeY=t.resizeY!==!1,[Tt,Xh,eg,ds].forEach(a=>{this.surface.addDragClassnameFilter(a)}),this.eg=t.payloadGenerator||((a,l)=>l),this.instance.bind(nr,()=>{this.reset()}),this.instance.bind(Kt,a=>{this.onDemand!==!0&&this.nc(a.obj)}),this.instance.bind(qt,a=>{this.onDemand!==!0&&this.Jn(a.obj)});let n=a=>{this.$_setSkeletonPositionById(a.id),Y(a)&&a.getMembers().forEach(l=>n(l))};this.surface.bind(Mt,a=>{a.dragGroup.forEach(l=>{n(l.vertex)})}),this.instance.bind(Re,a=>{this.$_setSkeletonPositionById(a.vertex.id)}),this.instance.bind(ve,a=>{n(a.vertex)}),this.instance.bind(Ce,a=>{this.Jn(a.node)}),this.instance.bind(Oe,a=>{this.Jn(a.group),a.group.getMembers().forEach(l=>this.Jn(l))});let o=a=>{this.Tt||this.instance.openTransaction(),this.$moving=!0,oe(a);let l=this.surface.mapEventLocation(a);this.Qh?this.Rb(l):this.Lb(l)},s=a=>{if(this.$busy){if(oe(a),this.ta&&this.ct!=null){let l=new Set;if(this.he!=null){let h={},d={},u={},{movedElements:p,resizedGroups:g}=this.he.hh();Object.assign(u,g);for(let m in p)h[m]=p[m].current,d[m]=p[m].current;for(let m in h){let E={[this.surface.$modelLeftAttribute]:h[m].x,[this.surface.$modelTopAttribute]:h[m].y};u[m]!=null&&(E[this.surface.$modelWidthAttribute]=u[m].newGroupSize.width,E[this.surface.$modelHeightAttribute]=u[m].newGroupSize.height),this.surface.model.$_updateVertex(m,E,Hs,!1)}this.surface.$_sizeGroupsToFit(l,null,null,!1),this.surface.$trackGroupSizeChanges(u);for(let m in u){let E=u[m].newGroupSize;this.surface.viewport.updateElement(m,null,null,E.width,E.height,null,null,!1)}}else l.add(this.ct);this.surface.$_sizeGroupsToFit(l,null,null,!1)}this.ea&&F(this.ea,Ey),this.surface.$removeClassFromElement(document.body,mt),this.surface.off(document,ae,o),this.surface.off(document,le,s),this.he&&this.he.cleanup(),this.he=null,this.ct=null,this.qs=!1,this.Eo=null,this.Qs=null,this.Dr=null,this.onEdit(this.toolkitDragObject,this.surface,this.instance),this.instance.commitTransaction(),this.$moving=!1,this.$rotating=!1,this.ta=!1}};return this.surface.on(this.surface.getContainer(),ge,z(Tt),a=>{this.ng(a,this.tg,o,s)}),this.surface.on(this.surface.getContainer(),ge,z(ds),a=>{this.ng(a,this.rg,o,s)}),this.surface.on(this.surface.getContainer(),ge,z(Xh),a=>{oe(a),this.wr=0,this.toolkitDragObject=this.surface.model.getVertex(a.target.getAttribute(te)),this.toolkitDragObject!=null&&(this.Nr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.wr=this.Nr.r,this.downAt=this.surface.mapEventLocation(a),this.$rotating=!0,this.Kh={x:this.Nr.c.x,y:this.Nr.c.y},this.ig(a),this.surface.$addClassToElement(document.body,mt),this.surface.on(document,ae,o),this.surface.on(document,le,s))}),!1}ig(e){this.toolkitDragObject!=null&&(this.ct=this.toolkitDragObject.group,this.qs=!1,this.ct!=null&&(this.Eo=this.surface.getGroupDefinition(this.ct),this.Qs=this.surface.$_getGroupContentAreaInfo(this.ct.id),this.Dr=this.surface.viewport.getGroupElement(this.ct.id),this.qs=this.Eo.elastic===!0&&e.shiftKey!==!0,this.qs&&(this.he=new Ca(this.surface,this.toolkitDragObject,this.ct,this.Eo))))}ng(e,t,n,o){oe(e);let s=e.target,a=s.getAttribute(te);this.hn=s.getAttribute(wa),this.ea=s,this.toolkitDragObject=this.instance.getNode(a)||this.instance.getGroup(a),this.Nr=this.surface.viewport.getPosition(this.toolkitDragObject.id),this.ig(e),this.xAxis=this.skeletons[a].canResizeX,this.yAxis=this.skeletons[a].canResizeY,this.downAt=this.surface.mapEventLocation(e);let l=this.wb(this.toolkitDragObject);if(this.$x1=l.x,this.$y1=l.y,this.$x2=this.$x1+l.width,this.$y2=this.$y1+l.height,this.wr=this.og(),this.go={x:l.x,y:l.y},this.Zh={width:l.width,height:l.height},this.Hh=this.$x2-this.$x1,this.Wh=this.$y2-this.$y1,this.Jm={x:this.$x1+this.Hh/2,y:this.$y1+this.Wh/2},this.Jh=tP(this.downAt.x,this.downAt.y,this.wr,{x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2}),Y(this.toolkitDragObject)){if(this.surface.getGroupElement(this.toolkitDragObject.id).collapsed)return;{let d=this.surface.getGroupDefinition(this.toolkitDragObject);if(this.qm&&d.constrain!==!1){let u=this.surface.$_getGroupContentAreaInfo(this.toolkitDragObject.id),p=this.surface.viewport.$computeGroupContentExtents(this.toolkitDragObject,!1,null,null,u),g=p.xmax+u.internalOffset.x,m=p.ymax+u.internalOffset.y;this.currentMinimumWidth=Math.max(this.minimumWidth,g),this.currentMinimumHeight=Math.max(this.minimumHeight,m)}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight}}else this.currentMinimumWidth=this.minimumWidth,this.currentMinimumHeight=this.minimumHeight;if(this.grid&&!this.ignoreGrid){let h=he({x:this.currentMinimumWidth,y:this.currentMinimumHeight},this.grid);this.currentMinimumWidth=h.x,this.currentMinimumHeight=h.y}if(this.handler=Object.assign({},t[this.hn]),this.tc!=null){let h=this.tc(this.surface,this.toolkitDragObject,this.hn,this.handler.resize);h!=null&&(this.handler.resize=h)}L(this.ea,Ey),this.surface.$addClassToElement(document.body,mt),this.surface.on(document,ae,n),this.surface.on(document,le,o)}og(){if(this.Nr==null)return 0;{let t=(this.Nr.r==null?0:this.Nr.r)%360;return t<0&&(t+=360),2*Math.PI/360*t}}Db(e,t){let n={x:(this.$x1+this.$x2)/2,y:(this.$y1+this.$y2)/2},o=this.og();return t?eP(e.x,e.y,o,n):tP(e.x,e.y,o,n)}wb(e){let t=this.surface.viewport.getElementBounds(e.id),n=this.Nb();return{x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}reset(){for(let e in this.skeletons){let t=this.skeletons[e];t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}}$minWidth(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumWidth,this.grid.width):this.currentMinimumWidth}$minHeight(){return this.grid!=null&&!this.ignoreGrid?Math.max(this.currentMinimumHeight,this.grid.height):this.currentMinimumHeight}ra(e){let t=this.skeletons[e];t&&t.el&&t.el.parentNode&&t.el.parentNode.removeChild(t.el),delete this.skeletons[e]}Jn(e){this.ra(e.id)}nc(e){let t=this.surface.$getManagedElement(e.id);if(t!=null){if(this.Jn(e),Y(t.modelObject)&&t.collapsed||Sn(t.modelObject).find(l=>this.surface.viewport.getGroupElement(l.id).collapsed===!0))return;let o=t.el.getAttribute(Cy)!==ct&&this.resizeX!==!1,s=t.el.getAttribute(Py)!==ct&&this.resizeY!==!1;if(t.el.getAttribute(_y)===ct||!o&&!s)return;this.ic(t,e,o,s)}}ic(e,t,n,o){let s=e,a=this.resizeMethod==zh?[XC]:[jC];this.bordersVisible&&a.push(HC);let l=Ge(Q,a,null,{transform:`translate(${e.x}, ${e.y})`,[te]:e.id});this.surface.$appendElementToToolsLayer(l);let h=Ge(Z,[kC],l,{x:-this.$handleOffset,y:-this.$handleOffset,width:e.width+2*this.$handleOffset,height:e.height+2*this.$handleOffset}),d=parseInt(window.getComputedStyle(e.el).strokeWidth,10),u=this.canResizeFilter?this.canResizeFilter(e.modelObject,e.el):n||o,p=e.el.getAttribute(Oy)===ct?!1:this.canRotateFilter?this.canRotateFilter(e.modelObject,e.el):this.Km,g=this.skeletons[t.id]={mel:e,el:l,canResizeX:n,canResizeY:o,handles:null,borders:null,rh:null,rl:null,rotatable:p,resizable:u,frame:h};if(this.resizeMethod===zh){if(p){g.rl=Ge(q,[eg],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.cn+this.$handleOffset}`,"stroke-width":2}),g.rh=M(Q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.cn-this.$handleOffset-this.Ce/2})`}),l.appendChild(g.rh),Ge(Be,[Xh],g.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"});let m=M(tt,{x:`${this.Ce/2}`,y:`${this.Ce/2}`,"font-size":Math.floor(this.Ce*.75)});m.innerHTML="\u21BA",g.rh.appendChild(m)}u&&(g.handles=this.rc==="rectangle"?qC(this.vt,s,t,d,l,this.$handleOffset,n,o):QC(this.vt,s,t,d,l,this.$handleOffset,n,o))}else p&&(g.rl=Ge(q,[eg],l,{[te]:t.id,d:`M ${s.width/2}, ${-this.$handleOffset} L ${s.width/2}, -${this.cn+this.$handleOffset}`,"stroke-width":2}),g.rh=M(Q,{transform:`translate(${s.width/2-this.Ce/2}, ${-this.cn-this.$handleOffset-this.Ce/2})`}),l.appendChild(g.rh),Ge(Be,[Xh],g.rh,{[te]:t.id,cx:this.Ce/2,cy:this.Ce/2,r:this.Ce/2,"aria-label":"Drag to rotate element",title:"Drag to rotate element"})),g.borders={t:null,b:null,l:null,r:null},u&&(o&&(g.borders.t=Ge(Z,[ds,ZC],l,{[wa]:"t",[te]:t.id,width:s.width,height:this.dt,x:0,y:-this.dt/2}),g.borders.b=Ge(Z,[ds,WC],l,{[wa]:"b",[te]:t.id,width:s.width,height:this.dt,x:0,y:s.height-this.dt/2})),n&&(g.borders.r=Ge(Z,[ds,KC],l,{[wa]:"r",[te]:t.id,width:this.dt,height:s.height,x:s.width-this.dt/2,y:0}),g.borders.l=Ge(Z,[ds,JC],l,{[wa]:"l",[te]:t.id,width:this.dt,height:s.height,x:-(this.dt/2),y:0})));return Ry(l,e),l}$_setSkeletonPositionById(e){if(this.skeletons[e]){let t=this.surface.$getManagedElement(e);return Ry(this.skeletons[e].el,t),this.skeletons[e].rh&&this.skeletons[e].rh.setAttribute("transform",`translate(${t.width/2-this.Ce/2}, ${-this.cn-this.$handleOffset-this.Ce/2})`),this.skeletons[e].rl&&this.skeletons[e].rl.setAttribute("d",`M ${t.width/2}, ${-this.$handleOffset} L ${t.width/2}, -${this.cn+this.$handleOffset}`),!0}return!1}Ib(e,t,n,o){let s={},a=this.xAxis&&this.resizeX,l=this.yAxis&&this.resizeY;return s[this.widthAtt]=a?n:this.$x2-this.$x1,s[this.heightAtt]=l?o:this.$y2-this.$y1,s[this.leftAtt]=a?e:this.$x1,s[this.topAtt]=l?t:this.$y1,s[this.widthAtt]<0&&(s[this.widthAtt]=this.$minWidth()),s[this.heightAtt]<0&&(s[this.heightAtt]=this.$minHeight()),s}Rb(e){let t=e.x-this.Kh.x,n=e.y-this.Kh.y,o=90+Math.atan2(n,t)*180/Math.PI;if(this.qh!=null){let s=360/this.qh;o=Math.floor(o/s)*s}this.instance.$_updateVertex(this.toolkitDragObject,{[this.surface.$modelRotationAttribute]:o},Xs,!1),this.wr=o}Lb(e){let t,n,o=this.Db(e);if(t=o.x-this.Jh.x,n=o.y-this.Jh.y,this.grid&&!this.ignoreGrid&&(t=(t<0?Math.ceil(t/this.grid.width):Math.floor(t/this.grid.width))*this.grid.width,n=(n<0?Math.ceil(n/this.grid.height):Math.floor(n/this.grid.height))*this.grid.height),(this.resizeY===!1||this.yAxis===!1||this.hn==="l"||this.hn==="r")&&(n=0),(this.resizeX===!1||this.xAxis===!1||this.hn==="t"||this.hn==="b")&&(t=0),this.ta||t!=0||n!=0){this.ta=!0;let{x:s,y:a,width:l,height:h,updates:d}=this.handler.resize(t,n);this.ct!=null&&(this.he!=null?this.he.setFocusPosition({x:s,y:a},!0,null,{width:l,height:h}):(a<0&&(h+=a,a=0),s<0&&(l+=s,s=0),this.Eo.constrain&&(s+l>this.Dr.width&&(l=this.Dr.width-s),a+h>this.Dr.height&&(h=this.Dr.height-a)))),this.sg(l,h);let u={x:this.$x1+this.handler.anchor[0]*this.Hh,y:this.$y1+this.handler.anchor[1]*this.Wh},p=eP(u.x,u.y,this.wr,this.Jm),g={x:s+l/2,y:a+h/2},m={x:s+this.handler.anchor[0]*l,y:a+this.handler.anchor[1]*h},E=eP(m.x,m.y,this.wr,g),y=E.x-p.x,x=E.y-p.y,f={x:g.x-y,y:g.y-x},b=tP(p.x,p.y,this.wr,f);this.go={x:b.x-this.handler.anchor[0]*l,y:b.y-this.handler.anchor[1]*h},this.Zh={width:l,height:h};let A=this.Ib(this.go.x,this.go.y,l,h),T=this.eg(this.toolkitDragObject,A)||{},S=Object.assign(T,A),O;if(this.ec!=null&&(O=this.ec(this.toolkitDragObject,this.go,this.Zh)),this.instance.$_updateVertex(this.toolkitDragObject,S,Rl,!1),d!=null)for(let v in d)this.instance.$_updateVertex(v,d[v],Rl,!1);if(O!=null)for(let v in O)this.instance.$_updateVertex(v,O[v],Rl,!1)}}Nb(){return this.ct==null?{x:0,y:0}:{x:this.Dr.x+this.Qs.internalOffset.x,y:this.Dr.y+this.Qs.internalOffset.y}}$vertexRerendered(e){this.skeletons[e.id]!=null&&(this.ra(e.id),setTimeout(()=>{this.nc(e.vertex)}))}$vertexRotated(e,t){this.skeletons[e.id]&&this.$_setSkeletonPositionById(e.id)}$vertexUpdated(e,t){!this.$busy&&t==Rl&&this.skeletons[e.id]!=null&&(this.ra(e.id),setTimeout(()=>{this.nc(e.modelObject)}))}sg(e,t,n){n=n||this.toolkitDragObject.id;let o=this.skeletons[n];o&&(ie(o.frame,{width:e+2*this.$handleOffset,height:t+2*this.$handleOffset}),this.resizeMethod===zh?this.rc==="rectangle"?(o.handles.tr&&ie(o.handles.tr,{x:e+this.$handleOffset}),o.handles.bl&&ie(o.handles.bl,{y:t+this.$handleOffset}),o.handles.br&&ie(o.handles.br,{x:e+this.$handleOffset,y:t+this.$handleOffset}),o.handles.t&&ie(o.handles.t,{x:e/2}),o.handles.b&&ie(o.handles.b,{x:e/2,y:t+this.$handleOffset}),o.handles.l&&ie(o.handles.l,{y:t/2}),o.handles.r&&ie(o.handles.r,{x:e+this.$handleOffset,y:t/2})):(o.handles.tr&&ie(o.handles.tr,{cx:e+this.$handleOffset}),o.handles.bl&&ie(o.handles.bl,{cy:t+this.$handleOffset}),o.handles.br&&ie(o.handles.br,{cx:e+this.$handleOffset,cy:t+this.$handleOffset}),o.handles.t&&ie(o.handles.t,{cx:e/2}),o.handles.b&&ie(o.handles.b,{cx:e/2,cy:t+this.$handleOffset}),o.handles.l&&ie(o.handles.l,{cy:t/2}),o.handles.r&&ie(o.handles.r,{cx:e+this.$handleOffset,cy:t/2})):(o.borders.t&&ie(o.borders.t,{width:e}),o.borders.b&&ie(o.borders.b,{width:e,y:t-this.dt/2}),o.borders.r&&ie(o.borders.r,{height:t,x:e-this.dt/2}),o.borders.l&&ie(o.borders.l,{height:t})))}$vertexSynced(e){this.$_setSkeletonPositionById(e.id)}$groupResized(e){this.$_setSkeletonPositionById(e.element.id),this.sg(e.newGroupSize.width,e.newGroupSize.height,e.element.id)}$groupCollapsed(e){this.Jn(e.modelObject),Object.values(this.skeletons).slice().forEach(n=>{ke(n.mel.modelObject,e.modelObject)&&this.ra(n.mel.id)})}};c(ps,"type","resizingTools"),ps=He([Xe("resizingTools")],ps);var tg="lineCrossings",rP="vjs-bridge",nP="vjs-bridge-vertical",iP="vjs-bridge-horizontal",oP="vjs-bridge-dot",sP="vjs-bridge-arch",MG="vjs-bridge-gap";function aP(i,r){let e=i.strokeWidth.other,t=i.stroke.other,n=e*5,o=r==="h"?i.point.x-n/2:i.point.x,s=r==="h"?i.point.x+n/2:i.point.x,a=r==="v"?i.point.y-n/2:i.point.y,l=r==="v"?i.point.y+n/2:i.point.y,h=M(q,{d:`M ${o} ${a} L ${s} ${l}`,stroke:"#000000","stroke-width":i.strokeWidth.ref+2}),d=M(q);d.setAttribute(mT,"none"),d.setAttribute("stroke-width",e),d.setAttribute("stroke",t),d.setAttribute("stroke-linecap","round"),d.classList.add(sP);let u=r==="h"?`M ${o} ${a} A ${n/2} ${n/2} 0 0 1 ${s} ${l}`:`M ${o} ${a} A ${n/2} ${n/2} 0 0 0 ${s} ${l} `;return d.setAttribute("d",u),[[d],n,[h]]}function lP(i,r,e,t){let n=e*2,o=M(Be);return t=t||i.stroke.ref,o.setAttribute("fill",t),o.setAttribute("stroke","none"),o.setAttribute("cx",`${i.point.x}`),o.setAttribute("cy",`${i.point.y}`),o.setAttribute("r",`${e}`),o.classList.add(oP),[[o],n,[]]}function hP(i,r){let e=i.strokeWidth.other*5,t=r==="h"?i.point.x-e/2:i.point.x,n=r==="h"?i.point.x+e/2:i.point.x,o=r==="v"?i.point.y-e/2:i.point.y,s=r==="v"?i.point.y+e/2:i.point.y,a=M(q,{d:`M ${t} ${o} L ${n} ${s}`,stroke:"#000000","stroke-width":i.strokeWidth.ref+2});return[[],e,[a]]}var rg=class extends Se{constructor(){super(...arguments);c(this,"Kn");c(this,"H");c(this,"ag");c(this,"lg");c(this,"oc");c(this,"hg");c(this,"Vb");c(this,"na",new Map);c(this,"ia");c(this,"cg");c(this,"tracksEdgeRedraws",!0);c(this,"Ke",new Map);c(this,"sc",new Map)}initialise(e,t){return this.cg=Eo(),this.Kn=e,this.H=t.orientation||"h",this.ag=this.H==="h"?"v":"h",this.ia=t.bridgeType||"arch",this.oc=t.dotRadius||5,this.hg=t.dotColor,this.Vb=t.onTap,this.lg=this.H==="h"?iP:nP,e.bind(Fr,()=>{this.Mb()}),!0}$edgeRedraw(e){this.Kn.$_dataLoading||requestAnimationFrame(()=>{this.Ke.get(e.edge.id)!=null&&(this.dg(e.edge),this.oa(e.edge.id),this.ug(e.edge,!0))})}Gb(e){let t=this.Kn.getRenderedConnection(e);if(t!=null)if(t.connector.type===zi||t.connector.type===Hr&&t.connector.constrain==="orthogonal"){let n=t.connector.internalSegments.map((d,u)=>({o:d.o,index:u,line:[{x:d.x1,y:d.y1},{x:d.x2,y:d.y2}],strokeWidth:t.paintStyle.strokeWidth||2})),o=t.connector.canvas,s=o.querySelector(".vjs-connector-path"),a=window.getComputedStyle(s),l=a.stroke,h=parseInt(a.strokeWidth,10);return{segments:n,connection:t,connector:t.connector,intersectingPoints:[],stroke:l,strokeWidth:h,canvasElement:o,pathElement:s,id:e}}else U(`WARN: unsupported connector type ${t.connector.type} in LineCrossingsPlugin`)}$b(){this.na.clear(),this.Kn.model.getAllEdges().forEach(t=>{this.oa(t.id)})}oa(e){let t=this.Gb(e);return t!=null?(this.na.set(e,t),t):null}sa(e){let t=this.na.get(e);return t!=null?t:this.oa(e)}Bb(e){return e.filter(t=>t.o===this.H)}Fb(e){return e.filter(t=>t.o===this.ag)}Ub(e){switch(this.ia){case"dot":return this.oc;case"arch":case"gap":return e.strokeWidth.other*5;default:return 0}}dg(e){this.zb(this.Ke.get(e.id)||[]);let t=this.sa(e.id);t!=null&&this.pg(t,e.id)}zb(e){e.forEach(t=>{t.canvasElements.forEach(s=>{s.parentElement&&s.parentElement.removeChild(s)}),t.masks.forEach(s=>{s.parentElement&&s.parentElement.removeChild(s)});let n=this.Ke.get(t.edge.id)||[],o=this.Ke.get(t.otherEdge.id)||[];this.Ke.set(t.edge.id,n.filter(s=>s.id!==t.id)),this.Ke.set(t.otherEdge.id,o.filter(s=>s.id!==t.id)),this.sc.delete(t.id)})}ug(e,t){var o;let n=this.sa(e.id);if(n!=null){let s=this.Kn.viewport.findConnectorBoundsIntersectingWithRect(n.connector,0,!1,[],!0).filter(h=>h.id!==n.id),a=(h,d)=>{let u=this.Bb(h.segments),p=[];for(let g=0;g<d.length;g++)if(d[g].id!==h.id){let m=t?this.oa(d[g].id):this.sa(d[g].id),E=this.Fb(m.segments);for(let y=0;y<u.length;y++)for(let x=0;x<E.length;x++){let f=ol(u[y].line,E[x].line);if(f!=null){let b=this.Ub({strokeWidth:{other:m.strokeWidth}}),A=Pe(f,u[y].line[0]),T=Pe(f,u[y].line[1]),S=!1;if(A<b){let O=h.segments[u[y].index-1];(O==null||O.o!==u[y].o)&&(S=!0)}if(!S&&T<b){let O=h.segments[u[y].index+1];(O==null||O.o!==u[y].o)&&(S=!0)}if(!S){let O=Pe(f,E[x].line[0]),v=Pe(f,E[x].line[1]);if(O<b){let _=m.segments[E[x].index-1];(_==null||_.o!==E[x].o)&&(S=!0)}if(!S&&v<b){let _=m.segments[E[x].index+1];(_==null||_.o!==E[x].o)&&(S=!0)}}if(S)continue;p.push({index:u[y].index,point:f,o:{ref:u[y].o,other:E[x].o},strokeWidth:{ref:h.strokeWidth,other:m.strokeWidth},stroke:{ref:h.stroke,other:m.stroke},refConnector:h,otherConnector:m})}}}p.forEach(g=>{let m=this.Yb(g,h.connection.edge,h,g.otherConnector);this.Ke.get(h.connection.edge.id).push(m),this.Ke.get(g.otherConnector.connection.edge.id).push(m),this.sc.set(m.id,m)})};if(a(n,s),t)for(let h=0;h<s.length;h++){let d=this.sa(s[h].id),u=s.slice();u.splice(h,1,n),a(d,u)}((o=this.Ke.get(e.id))==null?void 0:o.length)>0||this.pg(n,e.id)}}Mb(){this.$b();let e=this.Kn.model.getAllEdges();for(let t=0;t<e.length;t++)this.ug(e[t],!1)}Yb(e,t,n,o){let[s,a,l]=this.ia==="dot"?lP(e,this.H,this.oc,this.hg):this.ia==="arch"?aP(e,this.H):hP(e,this.H);if(s.forEach(h=>{h.classList.add(this.lg),h.classList.add(rP),h.classList.add(Eu),h.setAttribute("transform",`translate(${-n.connector.x}, ${-n.connector.y})`),h.setAttribute("data-vjs-edge",n.connection.edge.id),h.setAttribute("data-vjs-other-edge",o.connection.edge.id),h.setAttribute("data-x",e.point.x),h.setAttribute("data-y",e.point.y),h.setAttribute("x",`${e.point.x-a/2}`),h.setAttribute("y",`${e.point.y-a/2}`),n.canvasElement.appendChild(h)}),l!=null&&l.length>0){let h=this.Xb(n,t.id),d=h.getAttribute("id");n.pathElement.setAttribute("mask",`url(#${d})`),l.forEach(u=>h.appendChild(u))}return{canvasElements:s,bgSize:a,masks:l,edge:t,otherEdge:o.connection.edge,id:G()}}destroy(){this.na.clear(),this.sc.clear(),this.Ke.clear()}reset(){}jb(e){return`vjs-lcp-${this.cg}-${e}`.replace(/\s/g,"_")}Xb(e,t){let n=e.connector.bounds.xmin,o=e.connector.bounds.ymin,s=e.connector.bounds.xmax-n,a=e.connector.bounds.ymax-o,l=50,h=e.canvasElement.querySelector("defs");h==null&&(h=M("defs"),e.canvasElement.appendChild(h));let d=h.querySelector("mask[data-type='vjs-lcp']");if(d==null){let p=this.jb(t);d=M("mask",{id:p,"data-type":"vjs-lcp","data-vjs-edge-id":t,maskContentUnits:"userSpaceOnUse",maskUnits:"userSpaceOnUse",x:n-l,y:o-l,width:s+2*l,height:a+2*l}),h.appendChild(d)}else ie(d,{x:n-l,y:o-l,width:s+2*l,height:a+2*l});let u=d.querySelector("[vjs-lcp-white-mask]");return u==null?(u=M("rect",{x:n-l,y:o-l,width:s+2*l,height:a+2*l,fill:"#FFFFFF","vjs-lcp-white-mask":"true"}),d.appendChild(u)):ie(u,{x:n-l,y:o-l,width:s+2*l,height:a+2*l}),d}pg(e,t){let n=e.canvasElement.querySelector("mask[data-type='vjs-lcp']");n&&(e.pathElement.removeAttribute("mask"),n.parentElement&&n.parentElement.removeChild(n))}$edgeRemoved(e){this.dg(e),this.Ke.delete(e.id)}$edgeRendered(e){this.Ke.set(e.edge.id,[])}};rg=He([Xe(tg)],rg);var cP=(n=>(n.STOPPED="stopped",n.FINISHED="finished",n.PAUSED="paused",n.PLAYING="playing",n))(cP||{}),ig="state",ng=class extends Ft{constructor(e,t){super();this.components=e;this.params=t;c(this,"state");c(this,"currentlyAnimatingConnection");this.state=t.paused===Ct?"paused":"playing"}setState(e){this.state=e,this.fire(ig,e)}pause(){this.state!=="paused"&&(this.currentlyAnimatingConnection?(this.currentlyAnimatingConnection.pause(),this.setState("paused")):this.setState("stopped"))}play(){this.state!=="playing"&&(this.currentlyAnimatingConnection?this.currentlyAnimatingConnection.play():this.components[0].handler.play(),this.setState("playing"))}cancel(){this.state!=="stopped"&&(this.currentlyAnimatingConnection&&this.currentlyAnimatingConnection.cancel(),this.params.cleanup(),this.setState("stopped"))}};var jh="startOverlayAnimation",oo="endOverlayAnimation",Ly="startNodeTraversal",dP="endNodeTraversal",wy="vjs-animate-source",Dy="vjs-animate-target",Xn="vjs-animate-node-traversing",Hh="vjs-animate-edge-traversing",VG="vjs-animate-node-traversable",og="vjs-animate-edge-traversable",GG="vjs-animate-node-traversed",Ny="vjs-animate-edge-traversed";var uP="INITIALIZED",Iy="TRAVERSING_START",pP="TRAVERSING_EDGE",My="TRAVERSING_END",Da="CANCELLED",Na="FINISHED";function vw(i,r,e,t){let n=new Ft,o=r.connector.totalLength;t=t||{};let s=G(),a=t.events||{};for(let $ in a)n.bind($,a[$]);let l=null,h=t.forwards!==!1,d=t.rate||30,u=t.dwell||350,p=t.speed||100,g=o/p*1e3,m=g/d,E=1/m*(h?1:-1),y=t.isFinal!==!1,x=h?0:1,f=x,b,A,T=()=>h?f>=1:f<=0,S=h?r.sourceElement:r.targetElement,O=h?r.targetElement:r.sourceElement,v,_=t.paused===!0,P=!1,I=!1,C=uP;typeof e=="string"?v={type:e,options:{location:x,id:s}}:(v={type:e.type,options:Object.assign({},e.options)},v.options.location=x,v.options.id=s);let R=$=>{I=!1,ko(r,s),window.clearInterval(b),y?$?(C=Da,i.surface.removeClass(S,Xn),i.surface.removeClass(O,Xn),_r(r,Hh)):(C=My,i.surface.addClass(O,Xn),window.setTimeout(function(){V()},u)):(i.surface.removeClass(S,Xn),i.surface.removeClass(O,Xn),_r(r,Hh),$?C=Da:(C=Na,Jr(r,Ny),n.fire(oo,{connection:r,harness:l})))},w=()=>{f+=E,T()?R(!1):(A.location=f,r.instance.$repaintUIElementById(r.sourceId))},B=()=>{C=pP,n.fire(jh,{connection:r,harness:l}),A=Wl(r,v),b=window.setInterval(w,d)},N=()=>{!I&&C!==Na&&C!==Da&&(i.surface.removeClass(S,Xn),n.fire(dP,{connection:r,element:S,harness:l}),B())},V=()=>{!I&&C!==Na&&C!==Da&&(C=Na,i.surface.removeClass(S,Xn),i.surface.removeClass(O,Xn),_r(r,Hh),n.fire(oo,{connection:r,harness:l}))},D=()=>{P=!0,I=!1,n.fire(Ly,{connection:r,element:S,harness:l}),i.surface.addClass(S,Xn),Jr(r,Hh),C=Iy,window.setTimeout(()=>{N()},u)};return l={eventGenerator:n,play:()=>{P?I&&(I=!1,C===Iy?N():C===My?V():b=window.setInterval(w,d)):D()},pause:()=>{I=!0,window.clearInterval(b)},cancel:()=>{C!==Na&&C!==Da&&(window.clearInterval(b),R(!0))},connection:r},t.previous?t.previous.eventGenerator.bind(oo,D):_||D(),l}var sg=class extends Ft{constructor(e){super();this.surface=e}animateToPosition(e,t,n,o){let s=this.surface.getObjectInfo(e,!1);if(s){o=o||{},o.start=dd(o.start,()=>{this.surface.model.openTransaction(ut)}),o.step=dd(o.step,()=>{}),o.complete=dd(o.complete,()=>{this.surface.model.commitTransaction()}),o.start();let a=s.el.getBoundingClientRect(),l=t-a.x,h=n-a.y,d=o.duration||250,u=15,p=d/u,g=u/d*l,m=u/d*h,E=0,y=window.setInterval(()=>{this.surface.setPosition(s.obj,a.x+g*(E+1),a.y+m*(E+1)),o.step(E,Math.ceil(p)),E++,E>=p&&(window.clearInterval(y),o.complete())},u)}}traceEdge(e){let t=X(e.edge)?this.surface.model.getEdge(e.edge):e.edge,n=this.surface.$_connMap[t.id];Jr(n,og),vw(this,n,e.overlay,Object.assign(e.options||{},{isFinal:!0,forwards:!0,events:{[oo]:()=>e.complete&&e.complete(),[jh]:()=>e.start&&e.start()}}))}tracePath(e){let t=e.path||this.surface.model.getPath({source:e.source,target:e.target});if(t.exists()){let n=(g,m)=>{this.fire(g,{edge:m.edge,connection:m,options:e.options})},o=[],s=null,a=null,l=t.result.path.length,h,d=this.surface.getRenderedElement(t.result.path[0].vertex),u=this.surface.getRenderedElement(t.result.path[t.result.path.length-1].vertex);this.surface.addClass(d,wy),this.surface.addClass(u,Dy),t.eachEdge((g,m)=>{Jr(this.surface.$_connMap[m.id],og)});for(let g=1;g<l;g++){let m=t.result.path[g].vertex.id,E=t.result.previous[m],y=!0,x=t.result.path[g].edge;E!=null&&(y=E===x.source),s=this.surface.$_connMap[x.id],a=vw(this,s,e.overlay,Object.assign(e.options||{},{previous:a,isFinal:g===l-1,forwards:y,paused:!0,events:{[Ly]:f=>{h.currentlyAnimatingConnection=f.harness},[oo]:f=>{h.currentlyAnimatingConnection=null}}})),o.push({handler:a,connection:s})}let p=()=>{t.eachEdge((g,m)=>{let E=this.surface.$_connMap[m.id];_r(E,[Ny,og].join(" "))}),this.surface.removeClass(d,wy),this.surface.removeClass(u,Dy),n(oo,o[o.length-1].connection),h.setState("stopped"),h&&h.setState("finished")};return o.length>0?(o[0].handler.eventGenerator.bind(jh,()=>{n(jh,o[0].connection)}),o[o.length-1].handler.eventGenerator.bind(oo,p),h=new ng(o,{paused:e.paused,cleanup:p}),e.paused!==!0&&o[0].handler.play(),e.listener&&(h.bind(ig,e.listener),h.fire(ig,h.state)),h):null}else return U("Cannot trace non existent path"),null}};var ag="vjs-shape-library-palette-set",Vy="vjs-shape-library-palette",kh="vjs-shape-library-palette-filter",Wh="vjs-shape-library-palette-shape",Gy="vjs-shape-library-palette-label",gP="vjs-shape-library-palette-set-title",$y="vjs-shape-library-palette-set-shapes",mP="vjs-shape-library-palette-lasso";var $G=150,BG=100,FG="data-visible",so="data-category",lg="data-shape-id",EP="data-show-all",fP="data-vjs-type",UG="shape-icon",Cw="mainTemplate",Pw="preparedTemplate",yP="setTemplate",Ia="__vjsALL";function YG(i="Show all"){return{[yP]:`<div class="${ag}" data-category="{{id}}">
|
|
103
|
+
<div class="${gP}" data-category="{{id}}">{{name}}</div>
|
|
104
|
+
<div class="${$y}" data-category="{{id}}">
|
|
105
105
|
<r-each in="shapes"><shape-icon/></r-each>
|
|
106
106
|
</div>
|
|
107
107
|
<r-if test="children.length > 0">
|
|
108
|
-
<select class="${
|
|
109
|
-
<option value="${
|
|
108
|
+
<select class="${kh}" data-category="{{id}}" data-show-all="true">
|
|
109
|
+
<option value="${Ia}">${i}</option>
|
|
110
110
|
<r-each in="children">
|
|
111
111
|
<option value="{{id}}">{{name}}</option>
|
|
112
112
|
</r-each>
|
|
113
113
|
</select>
|
|
114
114
|
<r-each in="children">
|
|
115
|
-
<r-tmpl id="${
|
|
115
|
+
<r-tmpl id="${yP}"/>
|
|
116
116
|
</r-each>
|
|
117
117
|
</r-if>
|
|
118
|
-
</div>`,[
|
|
119
|
-
<div class="${
|
|
118
|
+
</div>`,[Pw]:`<div class="${Vy}">
|
|
119
|
+
<div class="${$y}">
|
|
120
120
|
<r-each in="shapes"><shape-icon/></r-each>
|
|
121
121
|
</div>
|
|
122
|
-
</div>`,[
|
|
122
|
+
</div>`,[Cw]:`<div class="${Vy}" data-show-all="{{showAll}}">
|
|
123
123
|
<r-if test="sets.length > 1">
|
|
124
|
-
<select class="${
|
|
125
|
-
<option value="${
|
|
124
|
+
<select class="${kh}" data-category="${ro}" data-show-all="{{showAll}}">
|
|
125
|
+
<option value="${Ia}">${i}</option>
|
|
126
126
|
<r-each in="sets">
|
|
127
127
|
<option value="{{id}}">{{name}}</option>
|
|
128
128
|
</r-each>
|
|
129
129
|
</select>
|
|
130
130
|
</r-if>
|
|
131
131
|
<r-each in="sets">
|
|
132
|
-
<r-tmpl id="${
|
|
132
|
+
<r-tmpl id="${yP}"/>
|
|
133
133
|
</r-each>
|
|
134
|
-
</div>`}}var YG=1.25,lg=class{constructor(r,e){this.ui=r;c(this,"Jn");c(this,"Gb");c(this,"rc");c(this,"$preparedShapes");c(this,"onVertexAdded");c(this,"palette");c(this,"$shapeLibrary");if(this.$shapeLibrary=r.getShapeLibrary()||e.shapeLibrary,this.$shapeLibrary==null){U("WARN: no ShapeLibrary set : ShapePalette cannot initialize.");return}let t=e.container,n=e.paletteStrokeWidth||YG,o=e.iconSize||{width:GG,height:$G};this.onVertexAdded=e.onVertexAdded,this.rc=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||np.FILL,a=e.outline||np.STROKE,l=e.outlineWidth||np.STROKE_WIDTH;this.Jn=yr({templates:UG(e.showAllMessage)});let h=`<div class="${Hh}" data-vjs-type="{{type}}"><svg:svg viewBox="0 0 ${o.width} ${o.height}" stroke-width="${n}"/>`+(e.showLabels?`<div class="${My}">{{label}}</div>`:"")+"</div>";this.Jn.registerTag(FG,{template:h,rendered:(p,g,m,E)=>{var T,S,O;let y=g.type,x=null,f=E.getAttribute(so)||g.category;f!=null&&p.setAttribute(so,f);let b=g.shapeId;b!=null&&(p.setAttribute(ag,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",g.label||""),g.objectType===se.objectType&&p.setAttribute(Jl,Ct);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){A.members&&A.objectType===se.objectType&&p.setAttribute("data-vjs-group-template",`${f}:${y}`);let v=A.previewData||{},_=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((O=A.initialSize)==null?void 0:O.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${_} ${P}`),A.icon){let C=this.Jn.parse(A.icon),R=this.Jn.render(C,v).fragment;I.appendChild(R)}else{let C=Hg(xn({},v),{type:y,category:f,width:_,height:P}),R=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let N=Math.min(_,P),V=(_-N)/2,D=(P-N)/2;R.setAttribute("transform",`translate(${V}, ${D})`)}I.appendChild(R);let B={fill:s,stroke:a,"stroke-width":n};if(x!=null){let N=x.properties||{};for(let V in N){let D=V===Ah?"stroke":V===Sh?"stroke-width":V;I.setAttribute(D,N[V]),delete B[D]}}for(let N in B)I.setAttribute(N,B[N])}}},updated:(p,g,m)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(g=>Object.assign({},this.$shapeLibrary.getShapeDefinition(g.type,g.category),{shapeId:g.shapeId,properties:g.properties,category:g.category,label:g.label,size:g.size}));this.$preparedShapes=p,d=this.Jn.template(vw,{shapes:p})}else d=this.Jn.template(Tw,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.Gb=new Ra(r,{source:this.palette,selector:z(Hh),dragSize:e.dragSize,dragSizeGenerator:(p,g)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:pP,elementGenerator:(p,g)=>{let m=p.cloneNode(!0),E=m.querySelector(z(My));return E&&E.parentNode.removeChild(E),m},vertexPreviewGenerator:(p,g,m,E,y)=>{let x=Object.assign(m,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:m.outlineWidth||1}),f=M(Le,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(yh);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,g,m,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:m.width,[r.$modelHeightAttribute]:m.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`)},dataGenerator:p=>{var C,R,w,B,N;let g=this.rc?this.rc(p)||{}:{},m=p.getAttribute(mP),E=p.getAttribute(so),y=p.getAttribute(ag),x=this.$shapeLibrary.getShapeDefinition(m,E),f=g.fill,b=g.outline,A=g.outlineWidth,T=g.color,S=(C=this.$preparedShapes)==null?void 0:C.find(V=>V.shapeId===y),O=(S==null?void 0:S.properties)||{},v=(R=S==null?void 0:S.size)==null?void 0:R.width,_=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||g.width||((B=x.initialSize)==null?void 0:B.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=_||g.height||((N=x.initialSize)==null?void 0:N.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(g,{type:m,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},O),f!=null&&(g.fill=f),b!=null&&(g.outline=b),A!=null&&(g.outlineWidth=A),T!=null&&(g.color=T),x.payload&&Object.assign(g,x.payload),g},allowDropOnEdge:!1,allowDropOnNode:!1,onVertexAdded:p=>{e.selectAfterDrop!==!1&&setTimeout(()=>r.model.setSelection(p.vertex)),this.onVertexAdded&&this.onVertexAdded(p)}}),Array.from(this.palette.querySelectorAll(z(jh))).forEach(p=>{p.addEventListener("change",g=>{let m=p.options[p.selectedIndex].value,E=p.getAttribute(so);p.setAttribute(gP,`${m===Na}`),this.sg(m,E)})}),e.inspector!==!1){r.model.bind(Kt,m=>{g()}),r.model.bind(qt,m=>{g()});let p=()=>{Array.from(this.palette.querySelectorAll(z(rp))).forEach(E=>{F(E,rp)})},g=()=>{p();let m=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>m.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),m.size===1){let[E,y]=Array.from(m)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${so}='${y}'][${mP}='${E}']`);f!=null&&L(f,rp)}}};r.model.bind(nr,()=>{p()}),r.on(this.palette,W,z(Hh),m=>{let E=m.target.closest(z(Hh)),y=E.getAttribute(so),x=E.getAttribute(mP),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||ce.objectType,A=this.ag();A.isEmpty()||r.model.transaction(()=>{A.eachVertex((T,S)=>{S.objectType===b&&r.model.updateVertex(S,{[this.$shapeLibrary.categoryParameter]:y,[this.$shapeLibrary.typeParameter]:x})})})}),r.model.bindAll([Re,ve],m=>{this.ag().containsVertex(m.vertex.id)&&g()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}ag(){return this.ui.model.getSelection().filter(r=>J(r)||Y(r))}$b(r){return this.palette.querySelector(`${z(jh)}[${so}='${r}']`)}sg(r,e){let t=e==ro?this.palette:this.palette.querySelector(`${z(sg)}[${so}='${e}']`);t.setAttribute(gP,`${r==Na}`),Array.from(t.querySelectorAll(z(sg))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(BG,`${r===Na||r===o.getAttribute(so)}`)})}lg(r,e){this.sg(r,e);let t=this.$b(e);t!=null&&(t.value=r,t.setAttribute(gP,`${r===Na}`))}setCurrentSet(r){if(r!=null){let e=this.$shapeLibrary.getShapeSet(r);if(e!=null){let t=[[e.id,e.parent]],n=e.parent;for(;n!=null&&n!==ro;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.lg(o[0],o[1])})}}else this.lg(Na,ro)}};var Gy="vjs-diagram-node",$y="vjs-diagram-group",fP=100,yP=80,xP=[Nv];var jn=class{constructor(r,e){this.diagram=r;this.vertex=e;c(this,"el");c(this,"$destroyed",!1)}get id(){return this.vertex.getFullId()}get zIndex(){return this.vertex.data.z==null?0:this.vertex.data.z}update(r){this.diagram.model.updateVertex(this.vertex,r)}setSize(r){this.diagram.$ui.setSize(this.vertex,r.width,r.height)}setPosition(r){this.diagram.$ui.setPosition(this.vertex,r.x,r.y)}setLabel(r){this.diagram.model.updateVertex(this.vertex,{[this.diagram.labelAttribute]:r})}setFill(r){this.diagram.model.updateVertex(this.vertex,{[zf]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[Ah]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[Sh]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Xf]:r})}get label(){return this.vertex.data[to]}get fill(){return this.vertex.data[zf]||Th}get outline(){return this.vertex.data[Ah]||ts}get outlineWidth(){return this.vertex.data[Sh]||vh}get color(){return this.vertex.data[Xf]||Dv}get size(){return{width:this.vertex.data[this.diagram.cellWidthAttribute],height:this.vertex.data[this.diagram.cellHeightAttribute]}}get width(){var r;return((r=this.size)==null?void 0:r.width)||0}get height(){var r;return((r=this.size)==null?void 0:r.height)||0}get position(){return{x:this.vertex.data[this.diagram.cellLeftAttribute],y:this.vertex.data[this.diagram.cellTopAttribute]}}remove(){this.diagram.removeCell(this)}destroy(){this.diagram=null,this.vertex=null,this.$destroyed=!0}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}};var yi=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return this.edge.id}get connection(){return this.diagram.$ui.getRenderedConnection(this.edge.id)}update(r){this.diagram.model.updateEdge(this.edge,r)}remove(){this.diagram.model.remove(this.edge)}setLabel(r){this.update({label:r})}get label(){return this.edge.data.label}setColor(r){this.update({color:r})}get color(){return this.edge.data.color}setLineWidth(r){this.update({lineWidth:r})}get lineWidth(){return this.edge.data.lineWidth}setOutlineColor(r){this.update({outlineColor:r})}get outlineColor(){return this.edge.data.outlineColor}setOutlineWidth(r){this.update({outlineWidth:r})}get outlineWidth(){return this.edge.data.outlineWidth}setDashArray(r){this.update({dashArray:r})}get dashArray(){return this.edge.data.dashArray}setLabelLocation(r){this.update({labelLocation:r})}get labelLocation(){return this.edge.data.labelLocation}setSource(r){this.diagram.model.setSource(this.edge,r instanceof jn?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof jn?r.id:r)}get target(){return this.edge.target}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}destroy(){this.diagram=null,this.edge=null,this.$destroyed=!0}};function bP(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Sa.type}}var Cw=15,By="vjs-cell-tool",AP="vjs-clone-cell",SP="vjs-delete-cell",Pw="vjs-link-cell",gs=class extends ps{constructor(){super(...arguments);c(this,"id","diagramTools");c(this,"$buttonSize");c(this,"$allowClone");c(this,"$allowDelete");c(this,"$allowLink");c(this,"$canShowLinkButton");c(this,"$canDelete");c(this,"$canClone");c(this,"$shouldDeleteGroupMembers");c(this,"$buttonY")}initialise(e,t){return super.initialise(e,t),this.$buttonSize=t.buttonSize||Cw,this.$allowClone=t.allowClone!==!1,this.$allowDelete=t.allowDelete!==!1,this.$allowLink=t.allowLink!==!1,this.$canShowLinkButton=t.canShowLinkButton,this.$canDelete=t.canDelete,this.$canClone=t.canClone,this.$shouldDeleteGroupMembers=t.shouldDeleteGroupMembers,this.$buttonY=-1*(this.Tt/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,z(AP),n=>{let s=n.target.closest(`[${te}]`).getAttribute(te);s!=null&&(oe(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,z(SP),n=>{let o=n.target.closest(`[${te}]`),s=o.getAttribute(te);if(s!=null){oe(n);let a=this.surface.model.getVertex(s);Y(a)?this.surface.model.removeGroup(s,this.$shouldDeleteGroupMembers==null?!1:this.$shouldDeleteGroupMembers(a,o)===!0):this.surface.model.removeNode(a)}}),!1}Qh(e,t,n,o){let s=super.Qh(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=M(Q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),hp(sp,this.$buttonSize,this.$buttonSize,[AP,By],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=M(Q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),hp(ap,this.$buttonSize,this.$buttonSize,[SP,By],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=M(Q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),hp(op,this.$buttonSize,this.$buttonSize,[Pw,By],{title:"Click and drag to link","data-vjs-source":!0,[te]:e.id},d,{"data-vjs-source":!0}),this.skeletons[e.id].linkButton=d}return s}$getCloneButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getCloneButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getDeleteButtonX(e){return-(this.$buttonSize/2+this.$handleOffset)}$getDeleteButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getLinkButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getLinkButtonY(e){return e.height+this.$buttonSize/2+this.$handleOffset}$_setSkeletonPositionById(e){if(this.skeletons[e]&&super.$_setSkeletonPositionById(e)){let t=this.surface.$getManagedElement(e),n=this.skeletons[t.id].cloneButton;n&&n.setAttribute(ui,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(ui,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(ui,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(gs,"type","diagramTools"),gs=He([Xe("diagramTools")],gs);var kh=class extends lg{constructor(r,e,t){let n=t==null?void 0:t.onVertexAdded,o=t==null?void 0:t.onCellAdded;super(e.$ui,Object.assign(t||{},{container:r,inspector:(t==null?void 0:t.inspector)!==!1,selectAfterDrop:t==null?void 0:t.selectAfterAdd,onVertexAdded:s=>{o&&o(e.getCell(s.vertex.id)),n&&n(s)},dataGenerator:s=>{let a=Object.assign({},e.$propertyTracker.getValues()),l=s.getAttribute(ag);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function TP(i){return i.startEditingPath!==void 0}function _w(i){return i.isEmpty()?0:i.head().zIndex}function zG(i){return i.isEmpty()?0:i.peek().zIndex}var hg=class{constructor(r,e,t){this.model=r;c(this,"$shapeLibrary");c(this,"$ui");c(this,"defaultCellWidth");c(this,"defaultCellHeight");c(this,"labelAttribute");c(this,"$_cellMap");c(this,"$editable");c(this,"$_cellList");c(this,"$propertyTracker");c(this,"F");var a,l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,O,v,_,P,I,C,R,w,B,N,V,D,$,K,xe,H,Ee,Fe,Je,Xt,or,rr,wr,go,qa,Qa,el,tl,rl,zg,Xg,xc,jg,bc,bs;t=t||{},this.F=t.mediator,this.$_cellList=new Ts((re,je)=>re.zIndex<je.zIndex?-1:re.zIndex>je.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||to,this.$shapeLibrary=new ca(t.shapes||xP,{labelFillRatio:(l=t.cells)==null?void 0:l.labelFillRatio,multilineLabels:(h=t.cells)==null?void 0:h.multilineLabels,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,labelPosition:(d=t.cells)==null?void 0:d.labelPosition}),this.$propertyTracker=new Du(this.model,{fill:t.defaultFillColor||Th,outline:t.defaultOutlineColor||ts,outlineWidth:t.defaultOutlineWidth||vh,color:t.defaultColor||ts}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||fP,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||yP,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:gs.type,options:{rotationStops:(g=t.cells)==null?void 0:g.rotationStops,canResizeFilter:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.resizable)!==!1&&this.Bb(re,je)!==!1},canRotateFilter:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.rotatable)!==!1&&this.Fb(re,je)!==!1},canShowLinkButton:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.linkable)!==!1&&this.Ub(re,je)!==!1},canDelete:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.deletable)!==!1&&this.zb(re,je)!==!1},canClone:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.clonable)!==!1&&this.Yb(re,je)!==!1},handleShape:(E=(m=t.cells)==null?void 0:m.resize)==null?void 0:E.handleShape,handleSize:(x=(y=t.cells)==null?void 0:y.resize)==null?void 0:x.handleSize,modelUpdater:(b=(f=t.cells)==null?void 0:f.resize)==null?void 0:b.modelUpdater,shouldDeleteGroupMembers:(A=t.cells)==null?void 0:A.shouldDeleteGroupMembers,handlerFactory:(S=(T=t.cells)==null?void 0:T.resize)==null?void 0:S.handlerFactory,resizeMethod:(v=(O=t.cells)==null?void 0:O.resize)==null?void 0:v.method,bordersVisible:(P=(_=t.cells)==null?void 0:_.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(R=t.cells)==null?void 0:R.resize)==null?void 0:w.resizeX,resizeY:(N=(B=t.cells)==null?void 0:B.resize)==null?void 0:N.resizeY}}),t.snapLines!=null){let re=t.snapLines===!0?{}:t.snapLines;n.push({type:hs.type,options:re})}if(t.panButtons!=null){let re=t.panButtons===!0?{}:t.panButtons;n.push({type:cs.type,options:re})}if(t.lineCrossings!=null){let re=t.lineCrossings===!0?{}:t.lineCrossings;n.push({type:eg,options:re})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:os.type,options:bP()}),t.lasso!=null&&(mo(t.lasso)?n.push(Yn.type):n.push({type:Yn.type,options:t.lasso})),t.miniview!=null&&n.push({type:zn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:ls.type,options:t.dragGroups}),((V=t.edges)==null?void 0:V.highlightSelected)===!0&&n.push({type:Ta.type,options:{paintStyle:(D=t.edges)==null?void 0:D.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,activeFiltering:($=t.edges)==null?void 0:$.activeFiltering,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(K=t.cells)==null?void 0:K.magnetizer,getCollapsedGroupSize:(xe=t.cells)==null?void 0:xe.getCollapsedGroupSize,canCollapseGroup:(re,je)=>this.F!=null&&this.F.canCollapse!=null?this.F.canCollapse(re,je):!0,canExpandGroup:(re,je)=>this.F!=null&&this.F.canExpand!=null?this.F.canExpand(re,je):!0,elementsDraggable:this.$editable!==!1&&((H=t.cells)==null?void 0:H.draggable)!==!1,defaults:o,view:this.Xb(t),shapes:{library:this.$shapeLibrary,showLabels:((Ee=t.cells)==null?void 0:Ee.showLabels)!==!1,strokeWidth:(Fe=t.cells)==null?void 0:Fe.outlineWidth,labelAttribute:(Je=t.cells)==null?void 0:Je.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Xt=t.cells)==null?void 0:Xt.font},edges:{editable:t.editable!==!1&&((or=t.edges)==null?void 0:or.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(rr=t.edges)==null?void 0:rr.propertyMappings,avoidVertices:(wr=t.edges)==null?void 0:wr.avoidVertices,allowUnattached:((go=t.edges)==null?void 0:go.allowUnattached)!==!1,connector:(qa=t.edges)==null?void 0:qa.connector,layerIndex:(Qa=t.edges)==null?void 0:Qa.layerIndex,sourceMarker:(el=t.edges)==null?void 0:el.sourceMarker,targetMarker:(tl=t.edges)==null?void 0:tl.targetMarker,overlays:(rl=t.edges)==null?void 0:rl.overlays,anchor:(zg=t.edges)==null?void 0:zg.anchor,anchors:(Xg=t.edges)==null?void 0:Xg.anchors,inputMethod:(xc=t.edges)==null?void 0:xc.inputMethod,reattach:((jg=t.edges)==null?void 0:jg.reattach)===!0,detachable:(bc=t.edges)==null?void 0:bc.detachable},edgeSnap:(bs=t.edges)==null?void 0:bs.snap,plugins:n,events:{[_n]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Ms]:re=>{if(this.$editable){let je=this.$_cellMap.get(re.dragGroup[0].vertex.id);je!=null&&this.toFront(je)}},[Cb]:re=>{if(this.$editable){let je=this.$_cellMap.get(re.dragGroup[0].vertex.id);je!=null&&this.toFront(je)}}},dragOptions:{filter:re=>this.F&&this.F.canDrag?this.F.canDrag(re.vertex,this.Dr(re.vertex),re.el):!0,canDrop:(re,je,wt)=>this.F&&this.F.canDrop?this.F.canDrop(re,je,wt):!0,autoPan:t.autoPan!==!1},templates:{nodeDefault:`<svg:g ${Yo}="${this.$editable}" class="${Gy}"><vjs-shape/></svg:g>`,groupDefault:`<svg:g ${Yo}="${this.$editable}" class="${$y}"><vjs-shape/></svg:g>`,groupNoTarget:`<svg:g class="${$y}"><vjs-shape/></svg:g>`,nodeNoTarget:`<svg:g class="${Gy}"><vjs-shape/></svg:g>`}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind(Fr,re=>{this.hg(re.vertex,re.el)}),this.$ui.bind(Br,re=>{this.hg(re.vertex,re.el)}),this.model.bind(Ce,re=>{this.cg(re.node)}),this.model.bind(Oe,re=>{this.cg(re.group)}),this.model.bind(Zt,()=>{this.$_cellMap.clear(),this.$_cellList.clear()})}get cellWidthAttribute(){return this.model.modelWidthAttribute}get cellHeightAttribute(){return this.model.modelHeightAttribute}get cellLeftAttribute(){return this.model.modelLeftAttribute}get cellTopAttribute(){return this.model.modelTopAttribute}Xb(r){var h,d,u,p,g,m,E,y,x,f,b,A,T,S,O;let e=(h=r.edges)!=null&&h.events?r.edges.events[Ye]:null,t={events:{[Ye]:v=>{let _=v.e.srcElement||v.e.target;if(cn(_,na)){oe(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().ne.length<1||v.e.shiftKey!==!0?v.model.setSelection(v.obj):v.model.addToSelection(v.obj)),e&&e(v)}},overlays:((d=r.edges)==null?void 0:d.overlays)||[],sourceMarker:(u=r.edges)==null?void 0:u.sourceMarker,targetMarker:(p=r.edges)==null?void 0:p.targetMarker,label:null,labelLocation:.5,labelLocationAttribute:null,deleteButton:(g=r.edges)==null?void 0:g.deleteButton,deleteButtonClass:(m=r.edges)==null?void 0:m.deleteButtonClass,deleteButtonLocation:(E=r.edges)==null?void 0:E.deleteButtonLocation,deleteConfirm:(y=r.edges)==null?void 0:y.deleteConfirm};if(r.edges){if(r.edges.showLabels){let v=r.edges.labelProperty||"label";t.label=`{{${v}}}`,r.edges.labelLocation!=null&&(t.labelLocation=r.edges.labelLocation),r.edges.labelLocationProperty!=null&&(t.labelLocationAttribute=r.edges.labelLocationProperty),r.edges.labelFont!=null&&(t.labelFont=r.edges.labelFont),r.edges.labelsRotatable!=null&&(t.labelsRotatable=r.edges.labelsRotatable)}if(r.edges.events)for(let v in r.edges.events)v!==Ye&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>_=>{this.$editable&&this.toFront(this.$_cellMap.get(_.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||_.model.getSelection().pe.length<1||_.e.shiftKey!==!0?_.model.setSelection(_.obj):_.model.addToSelection(_.obj)),v&&v(_)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Dr(I);return C!=null&&C.defaultTarget===!1?"groupNoTarget":"groupDefault"}};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(s,v)}let a={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Dr(I);return C!=null&&C.defaultTarget===!1?"nodeNoTarget":"nodeDefault"}};if((S=r.cells)!=null&&S.nodes){let v=(O=r.cells)==null?void 0:O.nodes,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}hg(r,e){r.data.z==null&&(r.data.z=_w(this.$_cellList)+1);let t=new jn(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}cg(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}Fb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canRotate?this.F.canRotate(r,t,e):!0}Ub(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canLink?this.F.canLink(r,t,e):!0}Yb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canClone?this.F.canClone(r,t,e):!0}Bb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canResize?this.F.canResize(r,t,e):!0}zb(r,e){let t=this.Dr(r);return t==null?!0:this.F&&this.F.canDelete?this.F.canDelete(r,t,e):!0}Dr(r){let e=r.data.type,t=r.data.category;return this.$shapeLibrary.getShapeDefinition(e,t)}destroy(){this.$ui.destroy()}jb(r){return X(r)?r:r.id}nc(r){return X(r)?this.$_cellMap.get(r):r}getCell(r){let e=this.$_cellMap.get(r);return e&&e.el==null&&(e.el=this.$ui.getRenderedElement(r)),e}addCell(r){if(r.type==null)return U("WARN: cannot add a cell with no `type` to the diagram"),null;let e=this.$shapeLibrary.getShapeDefinition(r.type,r.category);if(e==null)return U(`WARN: cannot add cell with type ${r.type} and category ${r.category}; not found in shape library`),null;Object.assign(r,e.payload||{}),r[this.cellWidthAttribute]==null&&(r[this.cellWidthAttribute]=this.defaultCellWidth),r[this.cellHeightAttribute]==null&&(r[this.cellHeightAttribute]=this.defaultCellHeight),r[this.cellLeftAttribute]==null&&(r[this.cellLeftAttribute]=0),r[this.cellTopAttribute]==null&&(r[this.cellTopAttribute]=0);let t=this.$ui.model.addNode(r),n=new jn(this,t);return this.$_cellMap.set(t.id,n),n.el=this.$ui.getRenderedElement(t),n}getLink(r){let e=this.model.getEdge(r);return e==null?null:new yi(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof jn&&(e.source=e.source.id),e.target instanceof jn&&(e.target=e.target.id);let t=this.model.addEdge(e);return new yi(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return _a(this.$ui,r).svg}exportImage(r,e){Up(this.$ui,r,e)}save(r){return this.$ui.save(r)}saveToUrl(r){this.model.save(Object.assign(r,{data:this.save(r)}))}getCellCount(){return this.model.getNodeCount()}getLinkCount(){return this.model.getEdgeCount()}clear(){this.model.clear()}removeCell(r){this.model.remove(this.jb(r))}toFront(r){if(!(r instanceof yi)){let e=this.nc(r);if(e!=null){let t=_w(this.$_cellList);e.vertex.data.z<t&&(e.vertex.data.z=t+1,this.$_cellList.update(e),this.$ui.toFront(e.vertex))}}}toBack(r){if(!(r instanceof yi)){let e=this.nc(r);if(e!=null){let t=zG(this.$_cellList);e.vertex.data.z>t&&(e.vertex.data.z=t-1,this.$_cellList.update(e),this.$ui.toBack(e.vertex))}}}selectCell(r){let e=this.nc(r);e!=null&&this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(X(r)?r:r.id);e!=null&&this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof yi?r.edge:r;TP(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){TP(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(TP(this.$ui)){let e=r instanceof yi?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:zn.type,options:r})}attachPalette(r,e){return new kh(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function XG(i,r,e){return new kh(r,i,e)}function jG(i,r,e,t){var s,a,l,h;r=r||{},e=e||{},e.beforeStartConnect==null&&(e.beforeStartConnect=r.beforeStartConnect),e.beforeConnect==null&&(e.beforeConnect=r.beforeConnect),Object.assign(e,{modelWidthAttribute:((s=r==null?void 0:r.cells)==null?void 0:s.widthProperty)||_e,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||Ve,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||ee,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||fe,selectionMode:ad});let o=mn(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var vP=class extends Oa{constructor(r,e,t){super(r,e.$ui,t)}};var CP="data-vjs-popup-position",HG="vjs-surface-popup";function PP(i,r,e,t){let n=ft(r),o=t.getEffectiveVisibleZoom(),s=e.width/o,a=e.height/o;switch(i){case"bottom":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height;break}case"top":{n.x=r.x+r.width/2-s/2,n.y=r.y-a;break}case"left":{n.x=r.x-s,n.y=r.y+r.height/2-a/2;break}case"right":{n.x=r.x+r.width,n.y=r.y+r.height/2-a/2;break}case"center":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height/2-a/2;break}}return t.toViewportLocation(n.x,n.y)}var _P=class{constructor(r,e,t,n,o){c(this,"ut",null);c(this,"dg","bottom");c(this,"ug","bottom");c(this,"setCurrent");c(this,"container");c(this,"surface");c(this,"Q");this.container=e,this.surface=t,this.setCurrent=n,this.ug=o||"bottom",this.surface.addDragSelectorFilter(r),this.surface.addElementEventFilter(r);let s=p=>{let g=t.getElementFromEvent(p);if(g!=null){oe(p);let m=p.target.getAttribute(CP)||this.ug;this.mo(g.modelObject,m)}else this.mo(null)},a=p=>{this.mo(null)},l=p=>{this.ut&&this.ut.modelObject===p.vertex&&(this.$positionPopup(),this.setCurrent(this.ut.modelObject))},h=p=>{this.ut&&this.ut.modelObject===p.vertex&&this.mo(null)},d=p=>{this.ut!=null&&p.dragGroup.forEach(g=>{var m;g.vertex===((m=this.ut)==null?void 0:m.modelObject)&&this.$positionPopup()})},u=()=>this.$positionPopup();t.on(t.getContainer(),W,r,s),t.bind(_n,a),t.model.bind(Re,l),t.model.bind(ve,l),t.model.bind(Ce,h),t.model.bind(Oe,h),t.bind(Mt,d),t.bind(To,d),t.bind(Gr,u),t.bind(Gi,u),this.Q=()=>{t.off(t.getContainer(),W,s),t.unbind(_n,a),t.model.unbind(Re,l),t.model.unbind(ve,l),t.model.unbind(Ce,h),t.model.unbind(Oe,h),t.unbind(Mt,d),t.unbind(To,d),t.unbind(Gr,u),t.unbind(Gi,u)}}mo(r,e){var t;r==null?this.ut=null:(this.ut=(t=this.surface)==null?void 0:t.getElement(r.getFullId()),this.dg=e||"bottom"),this.setCurrent(r),r!=null&&requestAnimationFrame(()=>this.$positionPopup())}$destroy(){this.Q()}$hide(){this.mo(null)}$positionPopup(){if(this.ut!=null&&this.container!=null){let r=Ze(this.container),e=PP(this.dg,this.ut,r,this.surface);this.surface.floatElement(this.container,e)}}};function kG(i,r){bp.register(i,r)}function WG(i,r,e){return mn(e||{}).render(i,r)}var ZG=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e||Ow,r)},JG=(e=>(e.idle="idle",e.dragging="dragging",e))(JG||{}),RC="assigned",Ia="added";function Rw(i){return X(i)?{id:i,active:!0,membership:Ia}:{id:i.id,active:i.active,membership:i.membership}}var KG=z(hh);function qG(i,r){let e=qg(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var QG=["input","textarea","select","button","option"],Ow=QG.join(","),cg=class{constructor(r){c(this,"inputFilterSelector");c(this,"Nr",{});c(this,"ic",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"oc");c(this,"O");c(this,"sc");c(this,"go");c(this,"u");c(this,"_");c(this,"xe");c(this,"Ir");c(this,"ia");c(this,"lc");c(this,"he");c(this,"oa",[]);c(this,"hc");c(this,"Eo");c(this,"sa",null);c(this,"vt",[]);c(this,"currentState","idle");c(this,"R");c(this,"hn",{});c(this,"dc",{});c(this,"Wt",null);c(this,"be",new Map);c(this,"fo",new Map);c(this,"ui");c(this,"draggableInstance");c(this,"resolveGrid");this.ui=r.ui,this.draggableInstance=r.draggableInstance,this.resolveGrid=r.resolveGrid,this.inputFilterSelector=r.inputFilterSelector||Ow;let e=`${Ae(te)}, ${Ae(te)} *`;this.draggableInstance.addDragHandler({selector:e,start:t=>this.kb(t),drag:t=>this.Hb(t),stop:t=>{this.Wb(t)},constrainFunction:(t,n,o,s,a,l)=>t,destroy:()=>this.$destroy()}),this.ui.bind(Gr,t=>{this.currentState==="dragging"&&(this.go=this.go*(t.zoom/this.sc),this.sc=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&(this.R=new mi(this.draggableInstance,{autoPanDelta:this.draggableInstance.dragOptions.autoPanDelta||5,autoPanRepeat:this.draggableInstance.dragOptions.autoPanRepeat||15,boundsStrategy:this.draggableInstance.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O=Object.assign({},t),this.pg(!1)},shouldHandle:()=>this.oc!==!0}))}uc(r){for(let e in this.Nr){let t=this.Nr[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&en(r)){r.yo=e||G();let n=r.yo;this.Nr[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.yo:r;delete this.Nr[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return $t(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(vt).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return cn(l,o)};s.Zb=o,this.addDragFilter(s,t,e)})}))}Jb(r){for(let e in this.Nr)if(this.Nr[e].Zb===r){delete this.Nr[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(vt).forEach(n=>{this.Jb(n)})}))}clearAllFilters(){this.Nr={}}Q(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.he&&this.he.cleanup(),this.he=null,this.lc=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,mt),F(this.ui.rootElement,Rf),this.Eo||(F(this.ui.rootElement,ph),F(this.ui.rootElement,Er),F(this.ui.rootElement,fr)),this._!=null&&F(this._.el,Lf),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll(KG)).forEach(r=>{F(r,hh)}),L(this.u.el,hh),F(this.u.el,lh),this.be.forEach(r=>{F(r.managedElement.el,lh),L(r.managedElement.el,hh)})),this.currentState="idle",this.u=null,this._=null,this.mg(),this.oa.forEach(r=>{this.gg(r.managedElement,Er,Mf,ph)}),this.oa.length=0,this.fo.clear(),this.be.clear(),this.Wt=null}mg(){this.vt.forEach(r=>{this.gg(r.managedElement,fr)}),this.vt.length=0}Kb(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Eg(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}qb(r){r=r||0;let e=-r*Math.PI/180;return{cos:Math.cos(e),sin:Math.sin(e)}}kb(r){if(r.e.Qb==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(this.R&&this.R.reset(),this.sa=null,!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(mr)!==ct)if(this.uc(r.e)&&ZG(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Bt(r.el,Ae(gt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!rt(t.obj)&&!j(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.be.clear(),this.hc=!0,r.e.Qb=!0,this.u=this.Kb(t.obj,r.e),this.u==null)return r.e.jy=!0,!1;this.ia=!1,this.xe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.O={x:0,y:0},this.oc=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this._=null,this.Ir=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Ir=this.ui.getGroupDefinition(this._.modelObject),this.Ir.elementsDraggable===!1)return!1;s=this.Ir.elastic===!0&&r.e.shiftKey!==!0,this.lc=r.e.shiftKey===!0,this.xe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,Lf),this.hc=this.ui.$canDrop(this.u.modelObject,null,!0),s||(F(this.ui.rootElement,Er),L(this.ui.rootElement,ph)),this.sa=this.qb(this._.r)}this.Eo=o||s,this.Eo||L(this.ui.rootElement,Er),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!ke(l,this.u.modelObject)){let h=this.ui.getGroupDefinition(l),d=l===this.u.modelObject.group,u=d||(this.ui.$canDrop(this.u.modelObject,l,!1)==!1?!1:h.canDrop?h.canDrop(this.u.modelObject):!0),p=this.ui.viewport.getGroupElement(l.id),g=this.ui.$_getGroupContentAreaInfo(l.id),E=-(p.r||0)*Math.PI/180,y={droppable:u,managedElement:p,depth:Lc(l),contentAreaInfo:g,contentArea:p.contentArea,contentBox:{x:p.x+g.internalOffset.x,y:p.y+g.internalOffset.y,width:p.width-g.internalOffset.x,height:p.height-g.internalOffset.y,r:p.r},isCurrentGroup:d,group:l,id:l.id,rotation:p.r||0,rotationMatrix:{cos:Math.cos(E),sin:Math.sin(E)}};this.oa.push(y),u?(d||this.Kn(p,Er),d&&this.Kn(p,Mf)):this.Kn(p,ph)}}):s&&(this.he=new va(this.ui,this.u.modelObject,this.u.modelObject.group,this.Ir)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.eA(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.sc=this.draggableInstance.getZoom(),this.go=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,mt),L(this.ui.rootElement,Rf),L(this.u.el,lh),this.currentState="dragging",this.R&&this.R.observe(this.u.el),this.Wt=this.hn[this.u.modelObject.id],this.Wt&&!qG(this.Wt,this.u.modelObject.id)&&(this.Wt=null);let a={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,pos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},element:this.u}],ui:this.ui};if(this.fo.clear(),this.be.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:Jn(this.u),originalPosition:ft(this.u),position:ft(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.Wt!=null){let l=(Y(this.u.modelObject)?Ps(this.u.modelObject):[]).map(d=>d.id),h=An(this.u.modelObject).map(d=>d.id);Array.from(this.Wt.members).filter(d=>l.indexOf(d.el.id)===-1&&h.indexOf(d.el.id)===-1).forEach(d=>{let u={x:d.el.x,y:d.el.y},p=d.el.modelObject;this.be.set(d.el.id,{modelObject:p,managedElement:d.el,offset:{x:d.el.x-this.u.x,y:d.el.y-this.u.y},size:Jn(d.el),originalPosition:ft(d.el),position:ft(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.R&&this.R.observe(d.el.el),a.dragGroup.push({el:d.el.el,vertex:d.el.modelObject,pos:{x:u.x,y:u.y},element:d.el}),L(d.el.el,lh),this.ui.toFront(d.el.el,!0)})}return this.ui.toFront(this.u.el,!0),this.ui.magnetizerProfile.constant&&this.ui.$startMagnetizer(),this.ui.$startMotion(),this.ui.fire(Ms,a),!0}else return!1;else return!1}else return!1;else return!1}}kl(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.R!=null&&(this.R.unobserve(this.u.el),this.be&&this.be.forEach(r=>{this.R.unobserve(r.managedElement.el)}))}Kn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}gg(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}Wb(r){var e;if(this.kl(),this.u!=null&&this.newPosition!=null){this.tA(),this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer();let t=new Set,n={},o=null,s=this._!=null,a=!1,l=[],h={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y},d=Object.assign({},h);if(this.vt.length>0&&(o=this.vt[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.lc&&t.delete(o.group))),o==null){if(!this.hc)return this.fg();this._!=null&&this.he==null&&(d.x+=this._.x+this.xe.internalOffset.x,d.y+=this._.y+this.xe.internalOffset.y,d=Me(d,this._.c,this._.r)),n[this.u.id]={x:d.x,y:d.y},Array.from(this.be.values()).forEach(p=>{n[p.managedElement.id]={x:p.offset.x+d.x,y:p.offset.y+d.y}})}else{if(!o.droppable)return this.fg();let p=this.ui.$_getGroupContentAreaInfo(o.id);if(this._!=null)if(this._.id===o.id)n[this.u.id]={x:d.x,y:d.y};else{let g=d.x+(this._.x+this.xe.internalOffset.x),m=d.y+(this._.y+this.xe.internalOffset.y);d.x=g-(o.managedElement.x+p.internalOffset.x),d.y=m-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d=this.rA(this.u,o.managedElement,p),n[this.u.id]={x:d.x,y:d.y};if(l.push({vertex:this.u.modelObject,originalParent:(e=this._)==null?void 0:e.modelObject,originalPosition:this.relativePositionAtDown,positionInGroup:d}),this.Wt!=null){let g=this.nA(d,o.managedElement,p);for(let m in g.current){let E={x:Math.floor(g.current[m].x),y:Math.floor(g.current[m].y)};n[m]=E;let y=this.be.get(m),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.fo.forEach((p,g)=>{n[g]=p.current}),this.ui.magnetizerProfile.afterDrag&&!a){let p=this.ui.$provisionallyMagnetize(this.u.modelObject,this.ui.magnetizerProfile.repositionDraggedElement===!0,n,null,!1,!1);for(let g in p.current)n[g]=p.current[g]}this.ui.model.transaction(()=>{if(a)this.be.forEach((p,g)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},g={};if(o==null)if(this.he==null)Array.from(this.be.values()).forEach(m=>{m.parentGroup!=null&&(t.add(m.parentGroup.modelObject),this.ui.model.$removeFromGroup(m.modelObject,null,{x:this.relativePositionAtDown.x+m.offset.x,y:this.relativePositionAtDown.y+m.offset.y},m.position,this.ui))});else{let{movedElements:m,resizedGroups:E}=this.he.ih();Object.assign(g,E);for(let y in m)n[y]=m[y].current,p[y]=m[y].current}else l.forEach(m=>{this.ui.model.$addToGroup(m.vertex,o.group,m.originalParent,m.originalPosition,m.positionInGroup,this.ui)});for(let m in n){let E={[this.ui.$modelLeftAttribute]:n[m].x,[this.ui.$modelTopAttribute]:n[m].y};g[m]!=null&&(E[this.ui.$modelWidthAttribute]=g[m].newGroupSize.width,E[this.ui.$modelHeightAttribute]=g[m].newGroupSize.height),this.ui.model.$_updateVertex(m,E,js,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(g)}});let u={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:d.x,y:d.y},element:this.u}],ui:this.ui};Array.from(this.be.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let g=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:g.el,vertex:p.modelObject,element:g})}}),this.ui.$stopMotion(),this.ui.fire(Vt,u)}this.Q()}rA(r,e,t){let n=Me(Me(r,r.c,r.r+e.r),e.c,-e.r);return{x:n.x-(e.x+t.internalOffset.x),y:n.y-(e.y+t.internalOffset.y)}}nA(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.Wt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.be.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.be.get(h.id).size;return new Li({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}fg(){this.ui.$stopMotion(),Array.from(this.be.values()).forEach(r=>{this.ui.viewport.updateElement(r.managedElement.id,r.originalPosition.x,r.originalPosition.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(r.managedElement,!0)}),this.fo.forEach((r,e)=>{let t=this.ui.$getManagedElement(e);this.ui.viewport.updateElement(e,r.original.x,r.original.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(t,!0)}),this.ui.fire(od),this.Q()}iA(r){return this._==null||r.id===this._.id}pg(r){if(this.newPosition!=null){let e={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y};this.mg();let t={x:e.x+this.xe.pageOrigin.x,y:e.y+this.xe.pageOrigin.y,width:this.u.width,height:this.u.height,r:this.u.r};if(this.oa.forEach(l=>{Dx(l.contentBox,t)&&this.vt.push(l)}),this.vt.length>0){this.vt.sort((h,d)=>h.depth>d.depth?-1:1),this.pc(this.vt[0].managedElement,!0);let l=!this.iA(this.vt[0].managedElement);(this._==null||this.ia||l)&&this.Kn(this.vt[0].managedElement,fr),this._!=null&&!l&&(this.ia=!0,this.Kn(this._,Er)),this.Eo||F(this.ui.rootElement,fr)}else this.pc(this._,!1),this._!=null&&!this.Ir.elastic&&(this.ia=!0,this.Kn(this._,Er)),this.Eo||L(this.ui.rootElement,fr);let n={},o=[{id:this.u.id,x:e.x,y:e.y}];n[this.u.id]=e;let s={dragGroup:[{vertex:this.u.modelObject,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:e.x,y:e.y},element:this.u}],positions:n,ui:this.ui};if(Array.from(this.be.values()).forEach(l=>{if(l.managedElement.id!==this.u.id){let h=l.originalPosition,d={x:e.x+l.offset.x,y:e.y+l.offset.y};this.activeGrid!=null&&(d=he(d,this.activeGrid)),l.position=d,o.push({id:l.managedElement.id,x:d.x,y:d.y}),n[l.managedElement.id]=d,s.dragGroup.push({pos:{x:d.x,y:d.y},originalPos:{x:h.x,y:h.y},vertex:l.managedElement.modelObject,element:l.managedElement})}else l.position={x:e.x,y:e.y}}),this.ui.magnetizerProfile.constant){let l=this.ui.$provisionallyMagnetize(this.u.modelObject,!1,{[this.u.id]:{x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.fo.set(h,{current:l.current[h],original:l.original[h]}),s.dragGroup.push({vertex:this.ui.model.getVertex(h),originalPos:l.original[h],pos:l.current[h],element:this.ui.getElement(h)})}let a=this.ui.$_updateVertexPositions({positions:n,sizes:null,offset:this.xe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(Mt,s),{redrawResult:a,positions:n}}}yg(r,e,t){if(e==null)this.ui.$setVisibleElementRotation(r,r.r);else{let n=0;t?n=r.modelObject.group===e.modelObject?0:e.r:n=r.modelObject.group===e.modelObject?-e.r:0,this.ui.$setVisibleElementRotation(r,r.r+n)}}pc(r,e){this.u!=null&&(this.yg(this.u,r,e),Array.from(this.be.values()).forEach(t=>{t.managedElement.id!==this.u.id&&this.yg(t.managedElement,r,e)}))}tA(){this.pc(null,!0)}oA(r,e){if(this.sa==null)return{x:r,y:e};let{cos:t,sin:n}=this.sa;return{x:r*t-e*n,y:r*n+e*t}}Hb(r){if(this.currentState==="dragging"){oe(r.e),this.oc=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.go,n=(e.y-this.downAt.y)/this.go,o=this.oA(t,n);t=o.x,n=o.y;let s={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(s.x-=this.xe.pageOrigin.x,s.y-=this.xe.pageOrigin.y,!this.Ir.elastic&&this.Ir.constrain&&(s.x+this.u.width>this._.width-this.xe.internalOffset.x&&(s.x=this._.width-this.u.width-this.xe.internalOffset.x),s.y+this.u.height>this._.height-this.xe.internalOffset.y&&(s.y=this._.height-this.u.height-this.xe.internalOffset.y),s.x<0&&(s.x=0),s.y<0&&(s.y=0))),this.activeGrid!=null&&(s=he(s,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(s=this.draggableInstance.dragOptions.constrainFunction(s,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=s;let a=this.pg(r.e.shiftKey);if(this.R!=null&&this.u!=null){let l=this.u.el.getBoundingClientRect();this.R.updateDragElementPosition(l)}return this.he!=null&&this.he.focusVertex.id===this.u.id&&this.sA(r.e,a.positions[this.u.id]),a.redrawResult}else return null}eA(){let r=this._?this._.x+this.xe.internalOffset.x:0,e=this._?this._.y+this.xe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}xg(r,...e){let t=[],n=Rw(r),o=this.dc[n.id];if(o==null)o={id:n.id,members:new Set},this.dc[n.id]=o,t.push(...e);else{let s=Array.from(o.members.values());e.forEach(a=>{let l=s.find(h=>h.el.id===a.id);(l==null||l.membership!==Ia)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Eg(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.hn[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.hn[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.hn[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.hn[t.id];if(n!=null){let o=qg(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.dc[r];e!=null&&(e.members.forEach(t=>{delete this.hn[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.hn[r]}sA(r,e){this.he!=null&&e!=null&&this.he.setFocusPosition(e,!0,r)}Eg(r,e){for(let t=0;t<this.ic.length;t++)if(!this.ic[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.ic.push(r)}$destroy(){this.R&&this.R.disconnect()}};var br=i=>i.map(r=>String.fromCharCode(r)).join(""),e$=new Date().getFullYear(),t$=br([67,111,112,121,114,105,103,104,116,32])+e$+br([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),OP=br([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),Lw=new Array(50).fill("-").join(""),r$=br([86,105,115,117,97,108,108,121,74,115,32])+Xm,n$=br([86,105,115,117,97,108,108,121,74,115,32,105,115,32,102,114,101,101,32,116,111,32,117,115,101,32,102,111,114,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,112,117,114,112,111,115,101,115,46,32,65,108,108,32,99,111,109,109,101,114,99,105,97,108,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,32,114,101,113,117,105,114,101,32,116,104,101,32,112,117,114,99,104,97,115,101,32,111,102,32,97,32,108,105,99,101,110,115,101,46]),i$=br([70,111,114,32,97,32,100,101,102,105,110,105,116,105,111,110,32,111,102,32,34,99,111,109,109,101,114,99,105,97,108,34,44,32,34,110,111,110,45,99,111,109,109,101,114,99,105,97,108,34,32,97,110,100,32,34,101,118,97,108,117,97,116,105,111,110,34,32,112,108,101,97,115,101,32,115,101,101,32,116,104,101,32,108,105,99,101,110,115,101,32,97,103,114,101,101,109,101,110,116,32,111,110,32,111,117,114,32,115,105,116,101,46]),o$=br([84,104,105,115,32,99,111,110,115,111,108,101,32,98,97,110,110,101,114,32,97,110,100,32,116,104,101,32,86,105,115,117,97,108,108,121,74,115,32,119,97,116,101,114,109,97,114,107,32,97,114,101,32,114,101,113,117,105,114,101,100,32,116,111,32,98,101,32,105,110,99,108,117,100,101,100,32,111,110,32,97,108,108,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,46]),Ma=br([10,10]),ww=Lw+Ma+r$+Ma+t$+Ma+OP+Ma+n$+Ma+i$+Ma+o$+Ma+Lw,Dw=br([86,105,115,117,97,108,108,121,74,115,32,45,32,98,117,105,108,100,32,112,114,111,102,101,115,115,105,111,110,97,108,32,102,108,111,119,99,104,97,114,116,115,44,32,100,105,97,103,114,97,109,115,44,32,99,104,97,114,116,115,32,97,110,100,32,114,105,99,104,32,110,111,100,101,32,98,97,115,101,100,32,85,73,115,32,119,105,116,104,32,65,110,103,117,108,97,114,44,32,82,101,97,99,116,44,32,86,117,101,44,32,83,118,101,108,116,101,44,32,74,97,118,97,115,99,114,105,112,116,32,97,110,100,32,84,121,112,101,115,99,114,105,112,116,32,105,110,32,114,101,99,111,114,100,32,116,105,109,101,46]),s$=br([60,115,118,103,32,118,105,101,119,66,111,120,61,34,51,48,32,50,48,32,49,53,48,32,52,53,34,32,119,105,100,116,104,61,34,56,48,34,32,104,101,105,103,104,116,61,34,51,48,34,62]),Nw=br([60,103,32,102,105,108,108,61,34,35,98,55,98,55,98,55,34,62]),a$=["m 43.96,33.76 q 0.12,-0.32 0.48,-0.32 h 2.24 q 0.44,0 0.32,0.44 l -5.88,17.8 Q 41,52 40.6,52 H 37.52 Q 37.12,52 37,51.68 l -5.88,-17.8 -0.04,-0.16 q 0,-0.28 0.36,-0.28 h 2.24 q 0.36,0 0.48,0.32 l 4.76,14.76 q 0.04,0.12 0.12,0.12 0.12,0 0.16,-0.12 z","m 52.606875,29.12 q -0.88,0 -1.56,-0.64 -0.64,-0.68 -0.64,-1.56 0,-0.88 0.64,-1.52 0.68,-0.64 1.56,-0.64 0.84,0 1.48,0.64 0.64,0.64 0.64,1.52 0,0.88 -0.64,1.56 -0.64,0.64 -1.48,0.64 z m -1.12,22.88 q -0.4,0 -0.4,-0.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 z","m 65.03125,52.44 q -2.36,0 -4,-1.2 -1.6,-1.2 -2.24,-3.2 l -0.04,-0.16 q 0,-0.24 0.28,-0.32 l 1.92,-0.68 0.16,-0.04 q 0.24,0 0.36,0.32 0.36,1.28 1.36,2 1.04,0.72 2.2,0.72 1.68,0 2.56,-0.8 0.88,-0.84 0.88,-2.12 0,-1.28 -0.88,-2 -0.84,-0.72 -2.36,-1 l -1.6,-0.32 q -2.04,-0.4 -3.24,-1.8 -1.2,-1.44 -1.2,-3.44 0,-1.48 0.76,-2.72 0.76,-1.24 2.12,-1.92 1.4,-0.72 3.12,-0.72 2.2,0 3.72,1.16 1.56,1.12 2.16,3.24 l 0.04,0.16 q 0,0.24 -0.32,0.36 l -1.88,0.48 -0.16,0.04 q -0.24,0 -0.32,-0.32 -0.32,-1.2 -1.16,-1.88 -0.8,-0.68 -2.08,-0.68 -1.4,0 -2.28,0.76 -0.84,0.76 -0.84,1.92 0,1.2 0.68,1.84 0.68,0.64 2.04,0.92 l 1.56,0.32 q 2.24,0.44 3.6,1.88 1.4,1.4 1.4,3.72 0,2.4 -1.72,3.96 -1.68,1.52 -4.6,1.52 z","m 87.125,33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 h -1.92 q -0.4,0 -0.4,-0.4 v -1.32 q 0,-0.16 -0.12,-0.2 -0.08,-0.04 -0.24,0.12 -1.88,2.2 -4.84,2.2 -2.96,0 -4.6,-1.72 -1.6,-1.72 -1.6,-4.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 45.8 q 0,1.96 1,3 1,1 2.88,1 1.32,0 2.4,-0.68 1.08,-0.68 1.8,-1.96 0.2,-0.4 0.2,-0.84 z","m 103.88688,52.4 q -2.56,0 -4.640005,-1.2 -2.08,-1.24 -3.28,-3.44 -1.2,-2.2 -1.2,-5.04 0,-2.84 1.2,-5.04 1.2,-2.2 3.28,-3.4 2.080005,-1.24 4.640005,-1.24 3.92,0 6.03999,2.48 0.08,0.08 0.16,0.04 0.08,-0.04 0.08,-0.16 v -1.56 q 0,-0.4 0.39999,-0.4 h 1.96001 q 0.39999,0 0.39999,0.4 V 51.6 q 0,0.4 -0.39999,0.4 h -1.96001 q -0.39999,0 -0.39999,-0.4 v -1.56 q 0,-0.12 -0.08,-0.16 -0.08,-0.04 -0.16,0.04 -2.47999,2.48 -6.03999,2.48 z m 0.44,-2.64 q 1.87999,0 3.36,-0.8 1.48,-0.8 2.15999,-2.16 0.16001,-0.32 0.16001,-0.72 v -6.72 q 0,-0.4 -0.16001,-0.72 -0.76,-1.36 -2.23999,-2.16 -1.44,-0.8 -3.28,-0.8 -2.96001,0 -4.800005,1.96 -1.8,1.92 -1.8,5.08 0,3.16 1.8,5.12 1.839995,1.92 4.800005,1.92 z","m 123.61562,49.56 q 0.40001,0 0.40001,0.4 v 1.8 q 0,0.4 -0.40001,0.4 h -0.72 q -1.87999,0 -2.92,-0.88 -1.03999,-0.92 -1.03999,-2.8 V 23.44 q 0,-0.4 0.39999,-0.4 h 2.12 q 0.40001,0 0.40001,0.4 v 24.68 q 0,1.44 1.19999,1.44 z","m 133.14687,49.56 q 0.4,0 0.4,0.4 v 1.8 q 0,0.4 -0.4,0.4 h -0.72 q -1.88,0 -2.92,-0.88 -1.04,-0.92 -1.04,-2.8 V 23.44 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 v 24.68 q 0,1.44 1.2,1.44 z","m 148.72562,33.76 q 0.12,-0.32 0.52,-0.32 h 2.2 q 0.48,0 0.36,0.44 l -9.32,25.68 q -0.12,0.32 -0.48,0.32 h -2.16 q -0.52,0 -0.36,-0.52 l 2.64001,-7.32 q 0.08,-0.16 0.08,-0.44 0,-0.24 -0.08,-0.4 l -6.40001,-17.28 -0.04,-0.16 q 0,-0.32 0.36,-0.32 h 2.28 q 0.36,0 0.48,0.32 l 4.72,13.56 q 0.12,0.24 0.24,0.24 0.2,0 0.24,-0.24 z"],l$=Nw+'<path d="'+a$.join('"/><path d="')+'"/></g>',h$=["m 159.312,61.368 c -0.448,0 -0.88533,-0.04267 -1.312,-0.128 -0.29867,-0.064 -0.43733,-0.213333 -0.416,-0.448 l 0.192,-1.44 c 0.0213,-0.213333 0.13867,-0.288 0.352,-0.224 0.384,0.106667 0.69333,0.16 0.928,0.16 0.46933,0 0.81067,-0.16 1.024,-0.48 0.23467,-0.32 0.352,-0.736 0.352,-1.248 V 40.472 c 0,-0.213333 0.10667,-0.32 0.32,-0.32 h 1.696 c 0.21333,0 0.32,0.106667 0.32,0.32 v 17.056 c 0,1.216 -0.32,2.154667 -0.96,2.816 -0.61867,0.682667 -1.45067,1.024 -2.496,1.024 z","m 171.5875,55.352 q -1.888,0 -3.2,-0.96 -1.28,-0.96 -1.792,-2.56 l -0.032,-0.128 q 0,-0.192 0.224,-0.256 l 1.536,-0.544 0.128,-0.032 q 0.192,0 0.288,0.256 0.288,1.024 1.088,1.6 0.832,0.576 1.76,0.576 1.344,0 2.048,-0.64 0.704,-0.672 0.704,-1.696 0,-1.024 -0.704,-1.6 -0.672,-0.576 -1.888,-0.8 l -1.28,-0.256 q -1.632,-0.32 -2.592,-1.44 -0.96,-1.152 -0.96,-2.752 0,-1.184 0.608,-2.176 0.608,-0.992 1.696,-1.536 1.12,-0.576 2.496,-0.576 1.76,0 2.976,0.928 1.248,0.896 1.728,2.592 l 0.032,0.128 q 0,0.192 -0.256,0.288 l -1.504,0.384 -0.128,0.032 q -0.192,0 -0.256,-0.256 -0.256,-0.96 -0.928,-1.504 -0.64,-0.544 -1.664,-0.544 -1.12,0 -1.824,0.608 -0.672,0.608 -0.672,1.536 0,0.96 0.544,1.472 0.544,0.512 1.632,0.736 l 1.248,0.256 q 1.792,0.352 2.88,1.504 1.12,1.12 1.12,2.976 0,1.92 -1.376,3.168 -1.344,1.216 -3.68,1.216 z"],c$=Nw+'<path d="'+h$.join('"/><path d="')+'"/></g>',Iw=s$+l$+"<g>"+br([60,99,105,114,99,108,101,32,99,120,61,34,49,53,52,34,32,99,121,61,34,54,48,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,114,61,34,49,46,53,34,32,102,105,108,108,61,34,119,104,105,116,101,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,47,62])+c$+br([60,99,105,114,99,108,101,32,99,120,61,34,49,54,49,46,53,48,49,53,55,34,32,99,121,61,34,51,54,46,50,53,56,53,52,57,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,102,105,108,108,61,34,35,102,102,102,102,102,102,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,32,114,61,34,49,46,53,34,32,47,62,60,47,103,62,60,47,115,118,103,62]),d$=br([60,97,32,104,114,101,102,61,34])+OP+br([34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,116,105,116,108,101,61,34])+Dw+'">'+Iw+"</a>",RP=null;function dg(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),dg(i,!0,s)};r||console.log(ww),RP&&window.clearInterval(RP),e&&e.parentNode&&e.parentNode.removeChild(e);let t=["right","left"][Math.floor(Math.random()*2)],n=["top","bottom"][Math.floor(Math.random()*2)],s=new DOMParser().parseFromString(d$,"text/html").body.childNodes[0];s.style.position="absolute",s.style[t]="1rem",s.style[n]="1rem",s.style.zIndex="0",s.style.opacity="0.8",s.setAttribute("href",OP),s.setAttribute("target","_blank"),s.setAttribute("title",Dw),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),RP=window.setInterval(()=>a(),25e3)}}var LP=null;function wP(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),wP(i,!0,n)};r||console.log(ww),LP&&window.clearInterval(LP),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(Iw,"text/html").body.childNodes[0];i.appendChild(n);let o=parseInt(i.getAttribute("width"),10),s=parseInt(i.getAttribute("height"),10),a=n.getBBox(),l=a.height/a.width,h=parseInt(n.getAttribute("width"),10),d=l*h;n.setAttribute("transform",`translate(${o-h-10}, ${s-d-10})`);let p=new MutationObserver((g,m)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),LP=window.setInterval(()=>u(),25e3)}}var DP="vjs-orthogonal-handle",ug="vjs-orthogonal-segment-drag",NP="vjs-orthogonal-segment-drag-ns",IP="vjs-orthogonal-segment-drag-ew";var u$=10,p$=20,ao=class extends no{constructor(e,t){super(e,t);c(this,"segments");c(this,"segmentHandles");c(this,"geometry");c(this,"$supportsHoverMode",!0);this.segments=[],this.segmentHandles=[],this.$addDragHandler({selector:"."+ug+" *",target:"."+ug,drag:n=>{let o=n.el.Zt,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=CS(this.current,this.currentConnector,o.segment,s);a!=null&&(o.connection.connector.geometry.segments=a.segments,o.connection.connector.edited=!0,this.$hasEdits=!0,this.segments.length=0,this.geometry.segments=a.segments,Array.prototype.push.apply(this.segments,this.geometry.segments),o.segment=this.geometry.segments[a.index],this.$repaintConnection({segmentInfo:o,segmentIndex:a.index}))},constrainFunction:function(n,o,s,a,l,h){let d=o.Zt,u=d.segment.x1===d.segment.x2,p={x:n.x,y:n.y};return u?p.y=(d.segment.y1+d.segment.y2)/2-a.height/2:p.x=(d.segment.x1+d.segment.x2)/2-a.width/2,p},stop:n=>{this.Ag(!0),this.$updateModel(sn(n.el.Zt.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=sn(n.el.Zt.connection.connector)}})}Sg(e,t){e.el.style.visibility="visible";let n=this.ui.$getSize(e.el.childNodes[0]),o=t[0]-n.width/2,s=t[1]-n.height/2;Ie(e.el,{x:o,y:s})}$repaint(e){this.An(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],Qs(this.segmentHandles[t].segment)>0){let n=[(this.segmentHandles[t].segment.x1+this.segmentHandles[t].segment.x2)/2,(this.segmentHandles[t].segment.y1+this.segmentHandles[t].segment.y2)/2];this.Sg(this.segmentHandles[t],n)}else this.segmentHandles[t].el.style.visibility="hidden"}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].el!==e&&this.ui.$removeElement(this.segmentHandles[t].el)}$activate(e,t){this.$hasEdits=!1,this.An(),this.currentConnector.edited=!0}$elementDragged(e){this.Ag(!0)}$elementDragging(e){this.$repaint()}An(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=lt(this.current.connector.geometry),this.geometry&&this.geometry.segments){this.$clearHandles(t?t.el:null),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let o=1;o<this.segments.length-1;o++)if(t==null||o!==n){let s=[(this.segments[o].x1+this.segments[o].x2)/2,(this.segments[o].y1+this.segments[o].y2)/2],a=s[0],l=s[1],h=this.segments[o].o===Ic,d=this.$makeOrthogonalHandle(h,a,l,p$,u$,[Un,DP,ug,h?IP:NP].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Zt=u,this.segmentHandles.push(u),this.Sg(u,s)}else o===n&&this.segmentHandles.push(t)}}Ag(e){this.current&&this.$hasEdits&&(PS(this.currentConnector),e&&this.$repaintConnection())}$makeOrthogonalHandle(e,t,n,o,s,a,l){let h=e?s:o,d=e?o:s;return this.$makeAndAppendRectangularHandle(t,n,h,d,3,3,a,l)}};c(ao,"type",zi);Rr.set(ao.type,ao);function MP(){Rr.set(ao.type,ao)}var Wh="vjs-straight-handle",ms="vjs-straight-segment-drag",pg="vjs-straight-segment-split",gg="vjs-straight-segment-delete",VP="vjs-straight-editor-guideline";var mg=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(z(pg)).Zt;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(z(gg)).Zt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,z(pg),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,z(gg),this.deleteListener)}$deactivate(r){this.editor.ui.off(this.editor.ui.getContainer(),W,this.splitListener),this.editor.ui.off(this.editor.ui.getContainer(),W,this.deleteListener)}$appendHandles(r){let e=r.segment,t={x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2},n={x:(e.x2+t.x)/2,y:(e.y2+t.y)/2},o=t,s=this.editor.$makeAndAppendCircularHandle(o.x,o.y,this.editor.buttonSize,this.editor.buttonSize,[Un,Wh,pg].join(" "),!0);s!=null&&r.buttons.push(s);let a=this.editor.segments.length>1?this.editor.$makeAndAppendDeleteHandle(n.x,n.y,this.editor.buttonSize,this.editor.buttonSize,[Un,Wh,gg].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var Fy="vjs-straight-connector-edit",GP="click",g$="auto";var Uy=class{constructor(r){this.editor=r;c(this,"mc");c(this,"gc");c(this,"$segmentToDrag");c(this,"$pageEvent");this.mc=(e=>{if(this.editor.current&&this.editor.current.id===e.obj.id){this.$pageEvent=e.e;let t=me(e.e),n=this.editor.ui.fromPageLocation(t.x,t.y);oe(e.e);let o=sS(e.connection.connector,n.x,n.y);this.$segmentToDrag=o.index+1,this.editor.$split(o.index,{x:o.x,y:o.y})}}).bind(this),this.gc=(e=>{let t=e.target.closest(z(ms)).Zt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Wr(r,Fy),this.editor.ui.bind(Cl,this.mc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${z(ms)} *`,this.gc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(Cl,this.mc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.gc),this.editor.current!=null&&Pr(this.editor.current,Fy)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],ge,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var lo=class extends no{constructor(e,t){super(e,t);c(this,"$mode");c(this,"$showGuidelines");c(this,"geometry");c(this,"segments",[]);c(this,"segmentHandles",[]);c(this,"guideLine");c(this,"$supportsHoverMode",!0);this.segments=[],this.$mode=t.splitMode===GP?new mg(this):new Uy(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+ms+" *",target:"."+ms,drag:n=>{let o=n.el.Zt,s=n.translatedPosition.x-n.originalTranslatedPosition.x,a=n.translatedPosition.y-n.originalTranslatedPosition.y;o.focus.x1=o.originalLocation.x+s,o.focus.y1=o.originalLocation.y+a,this.currentConnector.geometry.segments[o.index]=o.focus,o.previous&&(o.previous.x2=o.focus.x1,o.previous.y2=o.focus.y1,this.currentConnector.geometry.segments[o.index-1]=o.previous),this.currentConnector.edited=!0,this.$repaintConnection()},constrainFunction:function(n,o,s,a,l,h){return n},stop:n=>{this.$updateModel(sn(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=sn(this.currentConnector),!0)})}$split(e,t){let n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments,s=o[e],a={x1:s.x1,y1:s.y1,x2:t.x,y2:t.y};o[e].x1=t.x,o[e].y1=t.y,o.splice(e,0,a),this.currentConnector.edited=!0,this.$updateModel(sn(this.currentConnector),n)}$deleteSegment(e){let t=e.index,n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments;t===0?(o[1].x1=e.focus.x1,o[1].y1=e.focus.y1):t<o.length-1?(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2,o[t+1].x1=e.focus.x2,o[t+1].y1=e.focus.y2):t===o.length-1&&(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2),o.splice(t,1),this.currentConnector.edited=!0,this.$updateModel(sn(this.currentConnector),n)}$activate(e,t){this.$mode.$activate(e,t),this.$repaint()}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].index!==e&&this.segmentHandles[t].buttons.forEach(n=>this.ui.$removeElement(n));this.guideLine&&this.guideLine.parentNode&&this.guideLine.parentNode.removeChild(this.guideLine)}$elementDragged(e){}$elementDragging(e){this.$repaint()}$repaint(e){e=e||{};let t=e.segmentInfo;if(this.$mode.$repaintStarted(),this.geometry=this.current.connector.geometry,this.geometry&&this.geometry.segments){this.$clearHandles(),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let n=0;n<this.segments.length;n++)if(t==null||n!==t.index){let o=this.segments[n],s={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=null;n>0&&(a=this.$makeAndAppendCircularHandle(this.segments[n].x1,this.segments[n].y1,this.buttonSize,this.buttonSize,[Un,Wh,ms].join(" "),!0));let l={buttons:[],focus:o,previous:n>=0?this.segments[n-1]:null,index:n,originalLocation:{x:o.x1,y:o.y1},midPoint:s,el:a,edge:this.currentEdge,segment:this.segments[n],connection:this.current};this.$mode.$appendHandles(l),a!=null&&l.buttons.push(a),l.buttons.forEach(h=>h.Zt=l),this.segmentHandles.push(l)}this.aA()}this.$mode.$repaintEnded()}aA(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=M(Le,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[VP,_p].join(" "));let e=this.segments[this.segments.length-1],t=`M ${this.segments[0].x1}, ${this.segments[0].y1} `;for(let o=0;o<this.segments.length;o++)t+=`L ${this.segments[o].x2}, ${this.segments[o].y2} `;t+=`L ${e.x2}, ${e.y2}`;let n=M(q,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(lo,"type",Xr);Rr.set(lo.type,lo);function $P(){Rr.set(lo.type,lo)}var Zh="vjs-bezier-handle",Yy="vjs-bezier-handle-control-point",BP="vjs-bezier-handle-control-point-1",FP="vjs-bezier-handle-control-point-2",UP="vjs-bezier-guideline";var xi=class extends no{constructor(e,t){super(e,t);c(this,"$supportsHoverMode",!1);c(this,"h1");c(this,"h2");c(this,"l1");c(this,"l2");c(this,"lockHandles");c(this,"Tt");c(this,"Fe");c(this,"Jt");c(this,"Ec");c(this,"fc");c(this,"Tg",{x:0,y:0});c(this,"vg",{x:0,y:0});this.Tt=t.handleSize||qp,this.$addDragHandler({selector:"."+Zh+" *",target:"."+Zh,constrainFunction:function(n,o,s,a,l,h){return n},drag:n=>{let o=n.translatedPosition.x-n.originalTranslatedPosition.x,s=n.translatedPosition.y-n.originalTranslatedPosition.y,a=n.el.idx;if(o!==0||s!==0){this.$hasEdits=!0;let l=a===0?this.Fe:this.Jt,h=a===0?this.Tg:this.vg;l.x=h.x+o,l.y=h.y+s,this.$repaint(),this.$repaintConnection()}},stop:n=>{this.$hasEdits&&this.$updateModel(this.$cloneCurrentGeometry(),this.$generatedGeometry)},start:n=>(this.$hasEdits=!1,this.$generatedGeometry=this.$cloneCurrentGeometry(),this.Tg=Object.assign({},this.Fe),this.vg=Object.assign({},this.Jt),!0)})}$activate(e,t){this.Cg(),this.Pg(),this.lA((t==null?void 0:t.guidelines)!==!1),this.$hasEdits=!1,this.currentConnector.edited=!0}$clearHandles(){this.h1&&this.h1.parentNode.removeChild(this.h1),this.h2&&this.h2.parentNode.removeChild(this.h2),this.l1&&this.l1.parentNode.removeChild(this.l1),this.l2&&this.l2.parentNode.removeChild(this.l2),this.h1=null,this.h2=null,this.l1=null,this.l2=null}$elementDragged(e){this.$repaint()}$elementDragging(e){this.$repaint()}$repaint(e){this.Cg(),this.Pg(),this.Og(),this.hA()}lA(e){this.h1=this.$makeAndAppendCircularHandle(this.Fe.x,this.Fe.y,this.Tt,this.Tt,[Un,Zh,Yy,BP].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Jt.x,this.Jt.y,this.Tt,this.Tt,[Un,Zh,Yy,FP].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Cr,this.lockHandles||(this.h2.style.display=Cr),this.l1=this._g(this.Ec,this.Fe.x,this.Fe.y),this.l2=this._g(this.fc,this.Jt.x,this.Jt.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Cr:pt,this.l2.style.display=e?Cr:pt,this.Og()}Og(){this.$setElementPosition(this.h1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Jt;this.$setElementPosition(this.h2,e.x,e.y)}_g(e,t,n){let o=M(Le,{width:5,height:5}),s=M(q,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,UP),this.ui.$addClassToElement(o,_p),this.yc(e,o,t,n),o}hA(){this.yc(this.Ec,this.l1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Jt;this.yc(this.fc,this.l2,e.x,e.y)}yc(e,t,n,o){dn(t,e);let s=n-e.x,a=o-e.y;ie(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}Pg(){this.currentConnector&&(this.Fe=this.currentConnector.geometry.segments[0].cp1,this.Jt=this.currentConnector.geometry.segments[0].cp2)}Cg(){this.current&&(this.Ec={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.fc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(xi,"type",Mo);var ho=class extends xi{constructor(r,e){super(r,e),this.lockHandles=!0}};c(ho,"type",tu);Rr.set(xi.type,xi),Rr.set(ho.type,ho);function YP(){Rr.set(xi.type,xi),Rr.set(ho.type,ho)}var Mw="selected-vertices",Jh=class extends pa{constructor(e,t,n,o,s){var h,d,u,p,g,m,E,y,x;super(e,t,n,o,s,bn(o.defaults||{},{managedElementsSelector:Ae(gt,an)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"qn");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"xc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"Rg");c(this,"mode",xr);if(this.qn=Gv(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.KA=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Kr(Gt,Le,{position:"absolute",left:"0",top:"0"},vf,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Kr(Gt,Le,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Kr(Gt,Q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Kr(Gt,Q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Kr(Gt,Q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Kr(null,Ke,{position:"relative",width:jr,height:jr},vf,{},this.rootElement,!0),this.vertexLayer=Kr(null,Ke,{left:0,top:0,position:"absolute",width:jr,height:jr},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Kr(Gt,Le,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),dg(this.rootElement,!1),this.xc=o.elementsDraggable!==!1,this.xc===!1&&this.canvasElement.setAttribute(LS,ct),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new cg({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new ba(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(xa),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||$n),this.Rg=new Cp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,Ul:f=>{L(this.rootElement,Gn)},Xl:f=>{F(this.rootElement,Gn)},zl:f=>{},Yl:f=>{F(this.rootElement,Gn)}}),new Pp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.Rg}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(Eu),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,Sf),In()&&L(this.rootElement,QT),ci()&&L(this.rootElement,ev),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,Tf);let a=(f,b,A)=>{let T=S=>{let O=S.srcElement||S.target;if(O===this.rootElement||O===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(O)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===_n&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,_n,At),a(Ur,sA),this.panZoom=new fa({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,elementPositionSetter:(f,b)=>Ie(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.W(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(g=o.pan)==null?void 0:g.useMetaKey,wheel:this.cA(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(m=o.pan)==null?void 0:m.filter,events:{panStart:()=>{L(this.rootElement,Of),L(document.body,mt)},[Gi]:(f,b,A,T,S)=>{this.fire(Gi,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[Gr]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire(Gr,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[le]:()=>{F(this.rootElement,Of),F(document.body,mt)}},zoom:(E=o.zoom)==null?void 0:E.initialValue,zoomRange:(y=o.zoom)==null?void 0:y.range,zoomStep:(x=o.zoom)==null?void 0:x.step}),o.modelEvents&&o.modelEvents.forEach(f=>{this.bindModelEvent(f.event,f.selector,b=>{setTimeout(()=>f.callback(b),0)})}),this.bindModelEvent(W,z(fu),f=>{if(!f.event.defaultPrevented){let b=f.objectInfo.obj;if(b!=null){let A=this.view.getEdgeDefinition(this.model.getEdgeType(b));A.deleteConfirm?A.deleteConfirm({edge:f.objectInfo.obj,e:f.event},()=>this.model.removeEdge(b)):this.model.removeEdge(b)}}}),this.Vu(o),this.$dataLoadStart();let l=this.xu();this.$dataLoadEnd(!l)}$getCanvasElement(){return this.canvasElement}$getDragViewportContainer(){return this.rootElement}$isDraggingSupported(){return!0}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el)),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el),e.removeChildren===!1))for(let n=0;n<e.children.length;n++){let o=this.$getManagedElement(e.children[n].id);o&&this.panZoom.restore(o)}return t}$afterRefresh(e){this.$afterRelayout(e)}dA(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{Ie(n,o)},model:this.model,bounds:t.bounds,positions:t.positions,fixElement:(n,o,s,a)=>{if(a!=null){let h=Array.from(e.fixedElements).find(d=>d.id===a);h!=null&&this.unfixElement(h.el)}let l=Array.from(e.fixedElements).find(h=>h.el===n);return l==null&&(l=this.fixElement(n,o,s,a),e.fixedElements.add(l)),l},floatElement:(n,o)=>{let s=Array.from(e.floatedElements).find(a=>a.el===n);return s==null&&(s={el:n,pos:o,constraints:{}},this.floatElement(n,o),e.floatedElements.add(s)),s},appendElement:(n,o,s)=>{let a=Array.from(e.appendedElements).find(l=>l.el===n);if(a==null){a={el:n,pos:o,constraints:s};let l=o.x,h=o.y,d=null;this.canvasElement.appendChild(n),this.panZoom.add(n,!0),s&&s.alignX&&s.alignX===yt&&(d=d||Ze(n),l-=d.width),s&&s.alignY&&s.alignY===ht&&(d=d||Ze(n),h-=d.height),Ie(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.qn.length;t++)this.dA(this.qn[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}Ku(e){this.panZoom.$computeCompoundZoom()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.xc!==!1&&(this.mode===xr||this.mode===Ei)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.Ts(ce.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.Ts(se.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}cA(e){var a,l,h,d,u;let t=((a=e.zoom)==null?void 0:a.wheel)!==!1,n=((l=e.pan)==null?void 0:l.wheel)===!0,o=((h=e.pan)==null?void 0:h.axis)||"both",s=(d=e.wheel)==null?void 0:d.cssFilter;return{filter:(u=e.wheel)==null?void 0:u.filter,cssFilter:s,reverse:e.wheel!=null?e.wheel.reverse===!0:!1,pan:n,zoom:t,useMetaKey:e.wheel!=null?e.wheel.useMetaKey===!0:!1,axis:o}}$graphClearStart(){super.$graphClearStart();for(let e=0;e<this.qn.length;e++)this.qn[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.se(e=>e.reset())}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.toolsLayer,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.vertexLayer,t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.vertexGroup:this.vertexLayer,t)}$appendEdgeElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.edgeGroup:this.vertexLayer,t)}$_attachEdgePathEditor(e){this.$edgePathEditor=e,MP(),$P(),YP()}$addToDragGroup(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.xg(e,...n)}$_assignRemoveFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}$select(e){if(super.$select(e),J(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler.xg({id:Mw,active:!0,membership:Ia},t)}}$deselect(e){if(super.$deselect(e),J(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(Mw)}save(e){let t=super.save(e);return Object.assign(t,{pan:Object.assign({},this.getPan()),transformOrigin:Object.assign({},this.panZoom.transformOrigin)})}load(e,t){let n=()=>{e.pan&&this.setPan(e.pan.x,e.pan.y),e.transformOrigin&&this.panZoom.setTransformOrigin(e.transformOrigin.x,e.transformOrigin.y),t&&t()};super.load(e,n)}startEditingPath(e,t){this.$edgePathEditor!=null?this.$edgePathEditor.startEditing(e,t):U("ERROR: cannot start path edit - surface not created with 'edges:{editable:true}'")}stopEditingPath(){this.$edgePathEditor!=null?this.$edgePathEditor.stopEditing():U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'")}clearPathEdits(e){return this.$edgePathEditor!=null?this.$edgePathEditor.clearEdits(e):(U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'"),!1)}getVisibleCanvasBounds(){return this.panZoom.getVisibleContentArea()}addDragFilter(e,t){this.elementDragHandler.addDragFilter(e,null,t)}addDragClassnameFilter(e){this.elementDragHandler.addClassnameFilter(e)}addDragSelectorFilter(e){this.elementDragHandler.addSelectorFilter(e)}addVertexDragFilter(e){this.elementDragHandler.$addVertexDragFilter(e)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addWheelSelectorFilter(e){this.panZoom.$addWheelSelectorFilter(e)}addToDragGroup(e,...t){let n=X(e)?{id:e,active:!0,membership:Ia}:Object.assign(e,{membership:Ia});this.$addToDragGroup(n,...t)}removeFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}setDragGroupState(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.$setDragGroupState(e,...n)}clearDragGroup(e){this.elementDragHandler.$clearDragGroup(e)}attachMiniview(e){this.addPlugin({type:zn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}destroy(){let e;for(let t=0;t<this.sl.length;t++)try{e=this.sl[t],this.dataSource.unbind(e.event,e.fn)}catch(n){U("WARN: Could not unbind event "+e.event+" during destroy operation.")}this.canvasElement.parentNode.removeChild(this.canvasElement),F(this.rootElement,Sf),F(this.rootElement,qT),F(this.rootElement,Tf),this.se(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire(Ii,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=X(e.decorator)?this.getDecorator(e.decorator):e.decorator;if(t!=null){let n=this.getViewportBoundsInfo(),o=t.getBounds();this.panZoom.zoomToExtents(Object.assign(e,{extents:[n,o]}))}}zoomToExtents(e){this.panZoom.zoomToExtents(e)}mapEventLocation(e){return this.panZoom.mapEventLocation(e)}centerContent(e){this.panZoom.centerContent(e)}centerContentHorizontally(e){this.panZoom.centerContentHorizontally(e)}centerContentVertically(e){this.panZoom.centerContentVertically(e)}centerBackground(e){this.panZoom.centerBackground(e)}alignBackground(e,t){this.panZoom.alignBackground(e,t)}zoomToSelection(e){e=e||{};let t=()=>e.filter?this.model.filter(e.filter):this.model.getSelection(),n=e.selection||t(),o=[];n.eachNode((s,a)=>{o.push(this.getRenderedElement(a.id))}),n.eachGroup((s,a)=>{o.push(this.getRenderedElement(a.id))}),o.length>0&&this.panZoom.zoomToElements({elements:o,fill:e.fill,doNotZoomIfVisible:e.doNotZoomIfVisible,doNotAnimate:e.doNotAnimate})}getPath(e){return new jf(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}$getFixedViewportBoundsInfo(){return null}getApparentCanvasLocation(){return this.panZoom.getApparentCanvasLocation()}addBackground(e){this.panZoom.addBackground(e)}removeBackground(e){this.panZoom.removeBackground(e)}setZoom(e,t){let n=this.panZoom.setZoom(e,t);return super.setZoom(n,t)}getDecorator(e){return this.qn.find(t=>t.id===e)}setZoomRange(e,t){return this.panZoom.setZoomRange(e,t)}getZoomRange(){return this.panZoom.getZoomRange()}getZoom(){return this.panZoom.getZoom()}nudgeZoom(e,t){return this.panZoom.nudgeZoom(e,t)}nudgeWheelZoom(e,t){this.panZoom.nudgeWheelZoom(e,t)}zoomOut(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomOut(e)}zoomIn(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomIn(e)}getPan(){return this.panZoom.getPan()}pan(e,t,n){this.panZoom.pan(e,t,!n)}setPan(e,t,n,o){this.panZoom.setPan(e,t,n,o)}setPanAndZoom(e,t,n,o){this.setPan(e,t,o),this.setZoom(n,o)}Lg(e){let t=null;return(Array.isArray(e)?e:[e]).forEach(o=>{let s=this.getObjectInfo(o,!1);if(s.el!=null){let a=this.viewport.getElementBounds(s.id);t=t==null?a:Rx(t,a)}}),t}centerOnAndZoom(e,t,n){let o=this.Lg(e);o!=null&&this.panZoom.centerOnAndZoom({bounds:o,fillRatio:t,doNotAnimate:n})}centerOn(e,t){let n=this.Lg(e);n!=null&&this.panZoom.centerOn({bounds:n,doNotAnimate:t})}centerOnHorizontally(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnHorizontally({bounds:this.viewport.getElementBounds(t.id)})}centerOnVertically(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnVertically({bounds:this.viewport.getElementBounds(t.id)})}setClamping(e){this.panZoom.setClamping(e)}setViewportCenter(e){this.panZoom.setViewportCenter(e)}isPageLocationInViewport(e,t){return this.panZoom.isInViewport(e,t)}fromPageLocation(e,t,n){return this.panZoom.fromPageLocation(e,t,n)}fromWindowLocation(e,t,n){return this.panZoom.fromWindowLocation(e,t,n)}toPageLocation(e,t){return this.panZoom.toPageLocation(e,t)}toViewportLocation(e,t){return this.panZoom.toViewportLocation(e,t)}bindModelEvent(e,t,n){let o=(s,a)=>{let l=this.getObjectInfo(a,!0);l.obj!=null&&setTimeout(()=>n({event:s,eventTarget:a,objectInfo:l,model:this.model,ui:this}),0)};n.wg=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.wg!=null&&this.off(this.vertexLayer,e,t.wg)}cloneVertex(e,t){let n=super.cloneVertex(e,t);return n!=null&&(t==null?void 0:t.flash)===!0&&setTimeout(()=>{this.flashVertex(n)}),n}getEffectiveVisibleZoom(){let e=this.panZoom.getCompoundZoom();return this.currentZoom*e}isInViewport(e,t){return this.panZoom.isInViewport(e,t)}fixElement(e,t,n,o,s){return e.style.position=qe,this.panZoom.fixElement(e,t,n,o,s)}unfixElement(e){this.panZoom.unfixElement(e)}floatElement(e,t){this.panZoom.floatElement(e,t)}setMode(e,t){let n={[xr]:()=>{this.panZoom.setEnabled(!0)},[Ei]:()=>{this.panZoom.setEnabled(!1)},[ns]:()=>{this.panZoom.setEnabled(!1)},[Fn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===Ei&&!t&&this.model.clearSelection(),this.fire(On,e)):U("Surface: unknown mode '"+e+"'")}alignContent(e){this.panZoom.alignContent(e)}alignContentTop(e){this.panZoom.alignContentTop(e)}alignContentBottom(e){this.panZoom.alignContentBottom(e)}alignContentLeft(e){this.panZoom.alignContentLeft(e)}alignContentRight(e){this.panZoom.alignContentRight(e)}};c(Jh,"type","Surface");var zy=class extends Dd{fetchUrl(r){ha(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?ma:ga,o=t||Ph(n,e==null?void 0:e.useSvgContainer,e);return Gw(this,r,o,e)}renderDiagram(r,e){return new hg(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?ma:ga,s=n||Ph(o,e==null?void 0:e.useSvgContainer,{});return $w(this,r,s,e,t)}};function mn(i){return i=i||{},new zy(i)}function m$(i,r){i.bind(Jt,e=>{r.$nodeAdded(e)}),i.bind(Wt,e=>{r.$groupAdded(e)}),i.bind(Ce,e=>{r.$nodeRemoved(e)}),i.bind(Oe,e=>{r.$groupRemoved(e)}),i.bind(hr,e=>{r.$edgeAdded(e)}),i.bind(bt,e=>{r.$edgeRemoved(e)}),i.bind(Cn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function Gw(i,r,e,t){return Vw(i,r,e,(n,o,s,a,l)=>new Jh(n,s||n,a,o,l),t)}function Vw(i,r,e,t,n){let o,s=Object.assign({dataSource:i},n||{});s.selection!=null&&(typeof s.selection!="function"?o=s.selection:o=new cr(i,{generator:s.selection}));let a=s.id||G(),l=t(i,s,o,r,e);return o!=null&&m$(o,l),i.$addRenderer(l,a),l}function $w(i,r,e,t,n){return Vw(i,r,e,(o,s,a,l,h)=>new Kh(o,a||o,l,s,h,n),t)}var E$=i=>i.map(r=>String.fromCodePoint(r)).join(""),f$=[99,114,101,97,116,101,69,108,101,109,101,110,116];function y$(){return document}var Bw=i=>y$()[E$(f$)](i);var Kh=class extends pa{constructor(e,t,n,o,s,a){super(e,t,n,o,s,a);this.model=e;c(this,"$canvas");c(this,"$margin");c(this,"$horizontalAlign");c(this,"$verticalAlign");c(this,"$scale");this.id=o.id||G(),this.$margin=o.margin||UT,this.$horizontalAlign=o.horizontalAlign||o.align||qo,this.$verticalAlign=o.verticalAlign||o.align||qo,this.$scale=o.scale!==!1,o.useSvgContainer?this.$canvas=M(Le,{width:"100%",height:"100%"}):(this.$canvas=Bw("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,$T),L(this.$canvas,FT),n.appendChild(this.$canvas),this.$scale||L(this.rootElement,BT),this.setContainer(this.$canvas),dg(this.rootElement,!1),this.bindAll([$r,Ys,Vt,Vr,Ce,Oe,Fr,Br,Pn,$b,Us],()=>{this.syncView()}),this.Vu(o),this.$dataLoadStart();let h=this.xu();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.je,t=Ze(this.rootElement),n=e.xmax-e.xmin,o=e.ymax-e.ymin,s=t.width-2*this.$margin,a=t.height-2*this.$margin,l=s/n,h=a/o,d=Math.min(l,h),u=n*d,p=o*d;if(Lt(this.$canvas))if(this.$scale){let g=0,m=0;switch(this.$horizontalAlign){case qo:break;case nh:g-=(s-d*n)/2;break;case ih:g+=(s-d*n)/2;break}switch(this.$verticalAlign){case qo:break;case nh:m-=(a-d*o)/2;break;case ih:m+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${g}, ${m})`),this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`)}else{let g=e.xmax-e.xmin,m=e.ymax-e.ymin;this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`),this.$canvas.style.width=`${g}px`,this.$canvas.style.height=`${m}px`}else if(this.$scale){let g=(-e.xmin+this.$margin)*d,m=(-e.ymin+this.$margin)*d;switch(this.$horizontalAlign){case nh:break;case qo:g+=(s-u)/2;break;case ih:g+=s-u;break}switch(this.$verticalAlign){case nh:break;case qo:m+=(a-p)/2;break;case ih:m+=a-p;break}this.$canvas.style.transform=`translateX(${g}px) translateY(${m}px) scale(${d})`}else{let g=-e.xmin+this.$margin,m=-e.ymin+this.$margin,E=e.xmax-e.xmin+2*this.$margin,y=e.ymax-e.ymin+2*this.$margin;this.$canvas.style.transform=`translateX(${g}px) translateY(${m}px) scale(1)`,this.$canvas.style.width=`${E}px`,this.$canvas.style.height=`${y}px`}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return{x:e,y:t}}fromPageLocation(e,t,n){return{x:e,y:t}}fromWindowLocation(e,t,n){return{x:e,y:t}}mapEventLocation(e){return this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=Ze(this.getContainer()),t=this.viewport.getBoundsWidth(),n=this.viewport.getBoundsHeight(),o=e.width/t,s=e.height/n,a=Math.min(o,s);return{width:t,height:n,x:this.viewport.getX(),y:this.viewport.getY(),vw:e.width,vh:e.height,minimumFill:a,zoom:1}}$getFixedViewportBoundsInfo(){if(this.$scale)return null;{let e=this.getViewportBoundsInfo();return{x:e.x-this.$margin,y:e.y-this.$margin,width:e.width+2*this.$margin,height:e.height+2*this.$margin,vw:e.vw,vh:e.vh,zoom:e.zoom,minimumFill:e.minimumFill}}}getApparentCanvasLocation(){return{x:0,y:0}}addBackground(e){console.log("add background to paper - not implemented")}removeBackground(e){console.log("remove background from paper - not implemented")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function x$(i,r,e,t){let n=mn(e||{}),o=r!=null&&r.useSvgContainer?ma:ga,s=Ph(o,r==null?void 0:r.useSvgContainer,{}),a=new Kh(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function b$(i,r,e){if($t(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if($t(t,e,i))return t;t=t.parentNode}}}function A$(i){return typeof i=="function"?(i.yo=G(),i.yo):i}function S$(i,r,e){let t=null,n=r.getAttribute("katavorio-draggable"),o=n!=null?"[katavorio-draggable='"+n+"'] ":"";for(let s=0;s<i.length;s++)if(i[s].selector==="."?t=r:t=b$(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=$t(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var HP="start",kP="beforeStart",WP="drag",Yw="drop",zw="over",Xw="out",ZP="stop",Fw="katavorio-draggable",T$=Fw,v$=10,C$=10,zP=function(){return!0},P$=function(){return!1},XP={delegatedDraggable:"katavorio-delegated-draggable",draggable:T$,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},Uw=[ZP,HP,WP,Yw,zw,Xw,kP],_$=function(){},qh=function(i,r){if(i!=null){i=!X(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},O$=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e.getInputFilterSelector(),r)},jP=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",G());c(this,"enabled",!0);c(this,"scopes",[]);c(this,"eventManager");this.eventManager=e.eventManager}setEnabled(r){this.enabled=r}isEnabled(){return this.enabled}toggleEnabled(){this.enabled=!this.enabled}addScope(r){let e={};qh(this.scopes,t=>{e[t]=!0}),qh(r?r.split(/\s+/):[],t=>{e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}removeScope(r){let e={};qh(this.scopes,t=>{e[t]=!0}),qh(r?r.split(/\s+/):[],t=>{delete e[t]}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}toggleScope(r){let e={};qh(this.scopes,t=>{e[t]=!0}),qh(r?r.split(/\s+/):[],t=>{e[t]?delete e[t]:e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}},jw="notNegative",Hw="parent",kw="parentEnclosed";function JP(i,r){let e=null;switch(i){case jw:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case Hw:{let t=r||5;e=(n,o,s,a)=>{let l=n.x<0?0:n.x>s.width-t?s.width-t:n.x,h=n.y<0?0:n.y>s.height-t?s.height-t:n.y;return{x:l,y:h}};break}case kw:{e=(t,n,o,s)=>{let a=t.x<0?0:t.x+s.width>o.width?o.width-s.width:t.x,l=t.y<0?0:t.y+s.height>o.height?o.height-s.height:t.y;return{x:a,y:l}};break}}return e}var Xy=class extends jP{constructor(e,t,n){super(e,n);c(this,"Dg");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"q");c(this,"_e");c(this,"St");c(this,"aa");c(this,"la",{x:0,y:0});c(this,"xo",{x:0,y:0});c(this,"qe");c(this,"ha");c(this,"ca");c(this,"E");c(this,"bc");c(this,"bo");c(this,"Ao");c(this,"Qn",!1);c(this,"da");c(this,"ei");c(this,"Ac");c(this,"$");c(this,"So",[]);c(this,"Ng");c(this,"Ig");c(this,"Rn");c(this,"Or");c(this,"Sc");c(this,"To",{});c(this,"ua");c(this,"Ae");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.Dg=this.manager.css.draggable,L(this.el,this.Dg),this.downListener=this.en.bind(this),this.upListener=this.Ar.bind(this),this.moveListener=this.rn.bind(this),this.rightButtonCanDrag=t.rightButtonCanDrag===!0,this.consumeStartEvent=t.consumeStartEvent!==!1,this.E=this.el,this.clone=t.clone===!0,this.cloneSize=t.cloneSize,this.scroll=t.scroll===!0,this.trackScroll=t.trackScroll!==!1,this.Ng=t.canDrag||zP,this.Ig=t.consumeFilteredEvents,this.Rn=t.parent,this.Or=t.ignoreZoom===!0,this.da=t.ghostProxyParent,this.Sc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.uA.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.ei=zP:t.ghostProxy&&typeof t.ghostProxy=="function"?this.ei=t.ghostProxy:this.ei=(o,s)=>this.$&&this.$.useGhostProxy?this.$.useGhostProxy(o,s):!1,t.makeGhostProxy?this.Ac=t.makeGhostProxy:this.Ac=o=>this.$&&this.$.makeGhostProxy?this.$.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(Fw);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.So.push(t)}this.eventManager.on(this.el,ge,this.downListener)}uA(e){if(this.St){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.la.x,o=t.y-this.la.y,s={x:n+this.aa.x,y:o+this.aa.y},a=s.x-this.q.x,l=s.y-this.q.y,h=this.Or?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.xo.x,l+=this.E.parentNode.scrollTop-this.xo.y),a/=h,l/=h,this.moveBy(a,l,e),this.aa=s,this.la=t}}on(e,t){this.listeners[e]&&this.listeners[e].push(t)}off(e,t){if(this.listeners[e]){let n=[];for(let o=0;o<this.listeners[e].length;o++)this.listeners[e][o]!==t&&n.push(this.listeners[e][o]);this.listeners[e]=n}}Ar(e){this.q&&(this.q=null,this.eventManager.off(document,ae,this.moveListener),this.eventManager.off(document,le,this.upListener),this.unmark(e),this.stop(e),this.St=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.$&&this.$.revertFunction&&this.$.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this._e))}en(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Ng())if(this.uc(e)&&O$(e,this.el,this.manager)){this.$=null,this.Ae=null,this.So.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=S$(this.So,this.el,o);if(s!=null&&(this.$=s[0],this.Ae=s[1]),this.$==null||this.Ae==null)return;let a=this.$.dragInit?this.$.dragInit(this.Ae,e):null;a!=null&&(this.Ae=a);let l=1;if(this.clone)if(this.E=this.Ae.cloneNode(!0),L(this.E,XP.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.Rn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.Rn.appendChild(this.E)}else{let h=Ki(this.Ae,!0),d=this.Ae.getBoundingClientRect();this.E.style.left=`${h.x}px`,this.E.style.top=`${h.y}px`;let u=this.cloneSize==null?d.width:this.cloneSize.width,p=this.cloneSize==null?d.height:this.cloneSize.height;this.E.style.width=`${u}px`,this.E.style.height=`${p}px`,document.body.appendChild(this.E),this.Sc&&!this.Or&&(l=this.Sc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.Ae;this.consumeStartEvent&&oe(e),this.q=me(e),this.E&&this.E.parentNode&&(this.xo={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this._e=this.manager.positionGetter(this.E),this.qe=this.manager.getSize(this.E),this.qe.width=this.qe.width*l,this.qe.height=this.qe.height*l,this.eventManager.on(document,ae,this.moveListener),this.eventManager.on(document,le,this.upListener),this.pa(kP,{el:this.el,pos:this._e,e,drag:this,size:this.qe})}else this.Ig&&oe(e)}rn(e){if(this.q){if(!this.St){let t=this.pa(HP,{el:this.el,pos:this._e,e,drag:this,size:this.qe});if(t!==!1){if(!this.q)return;this.mark(t),this.St=!0}else this.abort()}if(this.q){let t=me(e),n=t.x-this.q.x,o=t.y-this.q.y,s=this.Or?1:this.manager.zoom;this.aa={x:t.x,y:t.y},this.la={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.xo.x,o+=this.E.parentNode.scrollTop-this.xo.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this._e!=null&&this.q!=null?{x:this.q.x-this._e.x,y:this.q.y-this._e.y}:{x:0,y:0}}mark(e){this._e=this.manager.positionGetter(this.E),this.qe=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.ua=this.manager.getParentConstrainingRectangle(this.E),this.bo=0,this.Ao=0}unmark(e){this.Qn&&this.ei(this.Ae,this.E)?(this.bc={x:this.E.offsetLeft-this.bo,y:this.E.offsetTop-this.Ao},this.E.parentNode.removeChild(this.E),this.E=this.Ae):this.bc=null,F(this.E,this.manager.css.drag),this.Qn=!1}moveBy(e,t,n){let o=this.toGrid({x:this._e.x+e,y:this._e.y+t}),s=this.pA(o,this.E,this.ua,this.qe,{x:this._e.x,y:this._e.y},n);if(s!=null){if(this.ei(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.Qn){let a=this.Ac(this.Ae);L(a,XP.ghostProxy),this.da?(this.da.appendChild(a),this.ha=Ki(this.Ae.parentNode),this.ca=Ki(this.da),this.bo=this.ha.x-this.ca.x,this.Ao=this.ha.y-this.ca.y):this.Ae.parentNode.appendChild(a),this.E=a,this.Qn=!0}s=o}else this.Qn&&(this.E.parentNode.removeChild(this.E),this.E=this.Ae,this.Qn=!1,this.ha=null,this.ca=null,this.bo=0,this.Ao=0);this.manager.positionSetter(this.E,{x:s.x+this.bo,y:s.y+this.Ao}),this.pa(WP,{el:this.el,pos:s,e:n,drag:this,size:this.qe,originalPos:this._e,viewport:this.ua})}}abort(){this.q!=null&&this.Ar()}getDragElement(e){return e?this.Ae||this.el:this.E||this.el}stop(e,t){if(t||this.St){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.qe]),this.pa(ZP,{el:this.E,pos:this.bc||o,finalPos:o,e,drag:this,selection:n,size:this.qe,originalPos:{x:this._e.x,y:this._e.y},viewport:this.ua})}else this.St||this.$.dragAbort&&this.$.dragAbort(this.Ae)}pa(e,t){let n=null;if(this.$&&this.$[e])n=this.$[e](t);else if(this.listeners[e])for(let o=0;o<this.listeners[e].length;o++)try{let s=this.listeners[e][o](t);s!=null&&(n=s)}catch(s){}return n}resolveGrid(){let e={grid:null,thresholdX:v$/2,thresholdY:C$/2};return this.$!=null&&this.$.grid!=null&&(e.grid=this.$.grid,this.$.snapThreshold!=null&&(e.thresholdX=this.$.snapThreshold,e.thresholdY=this.$.snapThreshold)),e}toGrid(e){let{grid:t,thresholdX:n,thresholdY:o}=this.resolveGrid();if(t==null)return e;{let s=t?t.width/2:n,a=t?t.height/2:o;return he(e,t,s,a)}}setUseGhostProxy(e){this.ei=e?zP:P$}pA(e,t,n,o,s,a){return this.$!=null&&this.$.constrainFunction&&typeof this.$.constrainFunction=="function"?this.$.constrainFunction(e,t,n,o,s,a):e}uc(e){for(let t in this.To){let n=this.To[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=A$(e);this.To[n]=[o=>{let s=o.srcElement||o.target,a;return X(e)?a=$t(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.yo:e;delete this.To[t]}clearAllFilters(){this.To={}}addSelector(e,t){e.selector&&(t?this.So.unshift(e):this.So.push(e))}destroy(){this.eventManager.off(this.el,ge,this.downListener),this.eventManager.off(document,ae,this.moveListener),this.eventManager.off(document,le,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,this.scrollTracker!=null&&document.removeEventListener("scroll",this.scrollTracker)}},R$=["input","textarea","select","button","option"],L$=R$.join(","),Eg=class{constructor(r){c(this,"eventManager");c(this,"zoom",1);c(this,"css",{});c(this,"inputFilterSelector");c(this,"positionGetter");c(this,"getSize");c(this,"positionSetter");this.inputFilterSelector=r.inputFilterSelector||L$,this.eventManager=new ye,this.zoom=r.zoom||1,this.positionGetter=r.positionGetter,this.getSize=r.getSize,this.positionSetter=r.positionSetter;let e=r.css||{};Object.assign(this.css,e)}getParentConstrainingRectangle(r){let e=r.parentNode;if(e==null)return{width:0,height:0};{let t=e.scrollLeft!=null?e.scrollLeft:0,n=e.scrollTop!=null?e.scrollTop:0,o=this.getSize(e);return{width:o.width+t,height:o.height+n}}}mA(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<Uw.length;t++){let n=Uw[t];e.events[n]=r[n]||_$}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.vo==null){let t=this.mA(e),n=new Xy(r,t,this);return L(r,XP.delegatedDraggable),r.vo=n,n}else return r.vo}destroyDraggable(r){r.vo&&(r.vo.destroy(),delete r.vo)}};var Ww=15,Zw=10,Jw="markers",Kw="lineStyle",qw="sourceArrow",Qw="targetArrow",eD="bothArrows",tD="plain",rD="dashed";function w$(i){let r=(i==null?void 0:i.arrowWidth)||Ww,e=(i==null?void 0:i.arrowLength)||Zw,t=(i==null?void 0:i.lineStyleProperty)||Kw,n=(i==null?void 0:i.markersProperty)||Jw;return[{property:t,mappings:{[tD]:{},[rD]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[qw]:{overlays:[{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]},[Qw]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}}]},[eD]:{overlays:[{type:_r.type,options:{location:1,width:r,length:e}},{type:_r.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var KP={set:function(i,r){localStorage.setItem(i,r)},get:function(i){return localStorage.getItem(i)},clear:function(i){localStorage.removeItem(i)},clearAll:function(){for(;localStorage.length>0;){let i=localStorage.key(0);localStorage.removeItem(i)}},setJSON:function(i,r){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot store value.");KP.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(KP.get(i))}};var qP=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new Eg({positionGetter:o=>un(o),positionSetter:(o,s)=>er(o,s),getSize:o=>Ze(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=JP(e.containment,e.containmentPadding)),(Array.isArray(r)?r:[r]).forEach(o=>{let s=this.collicat.draggable(o,{});s.addSelector(t),this.drags.push([s,o])})}destroy(){this.drags.forEach(r=>this.collicat.destroyDraggable(r[1])),this.collicat=null,this.drags.length=0}};function D$(i){nD?i():QP.push(i)}var QP=[],nD=!1,jy=()=>{nD=!0;for(let i=0;i<QP.length;i++)QP[i]()},e_=class{constructor(r){this.templateHolder=r;c(this,"c",0)}Vg(){this.c--,this.c<=0&&jy()}add(r){this.c++,ha({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.Vg()},error:e=>{this.Vg()}})}ensureNotEmpty(){this.c<=0&&jy()}},iD="_vjs_templates",N$=()=>{let i=function(){if(typeof document!="undefined")if(/complete|loaded|interactive/.test(document.readyState)&&typeof document.body!="undefined"&&document.body!=null){let r=document.getElementById(iD);if(r)jy();else{r=document.createElement("div"),r.style.display="none",r.id=iD,document.body.appendChild(r);let e=new e_(r),t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n].getAttribute("type"),s=t[n].getAttribute("src");o=="text/x-vjs-templates"&&e.add(s)}e.ensureNotEmpty()}}else setTimeout(i,9);else jy()};i()};N$();var oD="vjs-test-support-container",I$=1e-11;function sD(){let i=document.getElementById(oD);return i==null&&(i=document.createElement("div"),i.id=oD,document.body.appendChild(i)),i}var fg=[],M$=[];function Hy(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):sD().appendChild(n),n.setAttribute("id",i),e&&(n.className=e),n.style.left=Math.floor(Math.random()*1e3)+"px",n.style.top=Math.floor(Math.random()*1e3)+"px",fg.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function V$(i,r){for(let e=0;e<i.length;e++)Hy(i[e],r)}function G$(i){i=i.length==null&&typeof i!="string"?[i]:i;for(let r=0;r<i.length;r++){let e=typeof i[r]=="string"?document.getElementById(i[r]):i[r];e.parentNode&&e.parentNode.removeChild(e)}}function yg(i){G$(document.querySelectorAll(i))}function $$(){for(let i=0;i<fg.length;i++)fg[i].el.parentNode.removeChild(fg[i].el);fg.length=0,yg("circle"),yg(".vjs-node"),yg(".vjs-surface-canvas"),yg("svg"),yg(".vjs-lasso"),sD().innerHTML=""}function B$(i,r,e){return i=typeof i=="string"?parseFloat(i.substring(0,i.length-2)):i,r=typeof r=="string"?parseFloat(r.substring(0,r.length-2)):r,Math.abs(r-i)<(e||5e-4)}function Es(i){return i.connector.canvas}function Yt(i,r,e){let t=e==null?.5:e.x,n=e==null?.5:e.y,o=i===document?i.documentElement.getBoundingClientRect():i.getBoundingClientRect(),s=o.x+o.width*t,a=o.y+o.height*n;return Ar(s,a,r)}function t_(i,r,e,t){let n=i===document?{x:0,y:0,width:document.body.clientWidth,height:document.body.clientHeight}:i.getBoundingClientRect();return Ar(n.x+r,n.y+e,t)}function aD(i,r,e,t){let n={clientX:i.clientX+r,clientY:i.clientY+e,screenX:i.screenX+r,screenY:i.screenY+e,pageX:i.pageX+r,pageY:i.pageY+e};return Object.assign(n,t||{}),n}var ky={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function F$(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return Ar(i,r)}function lD(i,r,e){let t=i;e=e||{},e.start&&e.start(),qr(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=F$();r.style.left=s.screenX+"px",r.style.top=s.screenY+"px",t.trigger(document,"mousemove",s)}e.move&&e.move(),t.trigger(document,"mouseup",ky),e.up&&e.up()}function hD(i,r,e=!0,t){let n=i.getRenderedConnection(r.id),o=e?".vjs-connector-source-drag":".vjs-connector-target-drag",s=n.connector.canvas.querySelector(o);qr(i,s);let a=ky;if(t!=null){let l=i.toPageLocation(t.x,t.y);a=Ar(l.x,l.y)}return i.trigger(document,"mousemove",a),i.trigger(document,"mouseup",a),i.fromPageLocation(a.pageX,a.pageY)}function cD(i,r,e,t){let n=Hy("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=(e&&e.width?e.width:1500)+"px",n.style.height=(e&&e.height?e.height:1500)+"px",{surface:i.render(n,r,t),container:n}}function U$(i,r,e,t){let n=mn(i),o,s;if(r!=null){let l=cD(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return M$.push(a),a}function Y$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);i.surface.trigger(t.querySelector("path"),"click",n)}function z$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function X$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);var o=t.querySelector("path");i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n)}function j$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);var o=t.querySelector("path");i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n)}function xg(i,r,e){let t=i.surface.getRenderedConnection(r),n=Es(t),o=Yt(n);i.surface.trigger(n.querySelector("path"),e,o)}function r_(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Qh(i.surface,t,1,1)}function bg(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);qr(i.surface,t,1),ec(i.surface,t,1)}function H$(i,r,e){Wy(i,r,En,1,e)}function k$(i,r,e){Wy(i,r,"mouseover",1,e)}function W$(i,r,e){Wy(i,r,"mouseout",1,e)}function Wy(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);tc(i.surface,s,e,t,n)}function Qh(i,r,e=1,t=1){let n=Yt(r),o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,t,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(o)}function dD(i,r,e=1){let t=Yt(r),n=document.createEvent("MouseEvents");n.initMouseEvent("dblclick",!0,!0,window,2,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(n)}function qr(i,r,e=1,t){tc(i,r,fs,e,t)}function ec(i,r,e=1,t){tc(i,r,Hn,e,t)}function tc(i,r,e,t=1,n){let o=Yt(r,null,n),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,t||1,null),r.dispatchEvent(s)}function Zy(i,r,e,t,n,o=1){let s=Ar(t.x,t.y);n=n||{};let a=document.createEvent("MouseEvents");a.initMouseEvent(e,!0,!0,window,1,s.screenX,s.screenY,s.clientX,s.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,o||1,null),r.dispatchEvent(a)}function Z$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);Qh(i.surface,t,2,1)}function J$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);dD(i.surface,t,1)}function K$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");Qh(i.surface,o,1,1)}function q$(i,r){Qh(i.surface,r,1,1)}function Q$(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");dD(i.surface,o,1)}function uD(i,r){qr(i.surface,r),ec(i.surface,r)}function eB(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");uD(i,o)}function tB(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");qr(i.surface,o),ec(i.surface,o),qr(i.surface,o),ec(i.surface,o)}function rB(i,r,e){let t=i.surface.getRenderedConnection(r),n=kE(t,e||"lbl");Qh(i.surface,n.contentElements[0],1,1)}function nB(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(di(an,e));o&&Qh(i.surface,o,1,1)}function n_(i,r,e,t,n,o){t=t||{};let s=i,a;qi(e)?a=Yt(e,null,n):a=t_(i.$getCanvasElement(),e.x,e.y);let l=i.model.getAllEdges().length;t.start&&t.start(),qr(i,r),t.down&&t.down();let h=Object.values(i.$_connMap).find(u=>u.edge.transient);if(h!=null&&s.trigger(Es(h).childNodes[0],st,a),s.trigger(document,En,a),t.move){let u=i.model.getAllEdges().filter(g=>g.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}let d=()=>{s.trigger(document,Hn,a);let u=i.model.getAllEdges()[l],p=u?i.getRenderedConnection(u.id):null;return t.up&&t.up(p),p};if(o)o(d);else return d()}function iB(i,r,e){e=e||{};let t=i;e.start&&e.start(),qr(i,r),e.down&&e.down(),t.trigger(document,En,ky),t.trigger(document,Hn,ky)}function pD(i,r,e,t,n,o,s){let a=i.getObjectInfo(t,!1);if(a.el){n=n||{};let l=i.getRenderedConnection(r.id),h=e?".vjs-connector-source-drag":".vjs-connector-target-drag",d=l.connector.canvas.querySelector(h);n.start&&n.start(),qr(i,d),n.down&&n.down();let u=Yt(a.el,null,o);i.trigger(document,"mousemove",u),n.move&&n.move(),s!=null?s(()=>{i.trigger(document,"mouseup",u),n.up&&n.up(l)}):(i.trigger(document,"mouseup",u),n.up&&n.up(l))}else throw`Cannot resolve drag element ${t}`}function i_(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Yt(r);o.trigger(r,fs,s),n.afterDown&&n.afterDown();let a=r.getBoundingClientRect(),l=Ar(e+a.width/2,t+a.height/2);o.trigger(document,En,l),n.afterMove&&n.afterMove(),o.trigger(document,le,l),n.afterUp&&n.afterUp()}function o_(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Yt(r,o);s.trigger(r,fs,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,En,aD(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,Hn,null),n&&n.afterUp&&n.afterUp()}function gD(i,r,e,t,n,o,s){let a=i;r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild),n=n||3;let l=e/n,h=t/n,d=l,u=h,p=Yt(r,s);a.trigger(r,fs,p),o&&o.afterDown&&o.afterDown();for(let g=0;g<n;g++)a.trigger(document,En,aD(p,d,u,s)),o&&o.afterMove&&o.afterMove(g),d+=l,u+=h;a.trigger(document,Hn),o&&o.afterUp&&o.afterUp()}var oB=typeof document!="undefined",Jy=oB?"ontouchstart"in document.documentElement:!1,fs=Jy?"touchstart":"mousedown",En=Jy?"touchmove":"mousemove",Hn=Jy?"touchend":"mouseup";function Ar(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function mD(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function ED(i,r,e,t,n,o,s){let l=i.vertexLayer.parentElement.parentElement;n!=null&&(l=i.getRenderedElement(n)),s_(i,l,r,e,t,o,s)}function s_(i,r,e,t,n,o,s){n&&n.start&&n.start();let a=i.toPageLocation(e.x,e.y),l=i.toPageLocation(t.x,t.y);a.x-=window.scrollX,l.x-=window.scrollX,a.y-=window.scrollY,l.y-=window.scrollY,Zy(i,r,fs,a,o),n&&n.down&&n.down(),Zy(i,document,En,l,o),n&&n.move&&n.move(),s?s(()=>{Zy(i,document,Hn,l,o),n&&n.up&&n.up()}):(Zy(i,document,Hn,l,o),n&&n.up&&n.up())}var bi={addDiv:Hy,addDivs:V$,cleanup:$$,delta:B$,DOWN_EVENT:fs,UP_EVENT:Hn,MOVE_EVENT:En,isTouchDevice:Jy,makeEvent:Yt,makeEventAt:Ar,nudgeEvent:mD,getEdgeCanvas:Es,defaultEventManager:new ye,dragElementBy:(i,r,e,t)=>{o_(bi.defaultEventManager,i,r,e,t)},attachToSurface:i=>new Ag(i.model,i),create:(i,r,e,t)=>{let n=U$(i,r,e,t);return new Ag(n.model,n.surface)},trigger:(i,r,e,t,n)=>{i.trigger(r,e,{pageX:t,pageY:n,screenX:t,screenY:n,clientX:t,clientY:n})},getTransform:i=>{let r=parseFloat(i.style.transform.match(/translateX\(([0-9\.]+)px/)[1]),e=parseFloat(i.style.transform.match(/translateY\(([0-9\.]+)px/)[1]),t=parseFloat(i.style.transform.match(/scale\(([0-9\.]+)/)[1]);return{translateX:r,translateY:e,scale:t}},lasso:ED,lassoOnElement:s_,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=bi);function fD(i,r,e,t,n,o){let s=i.getEffectiveVisibleZoom();o=o||{};let a=e.getBoundingClientRect(),l=Ar(a.x+a.width+s*t,a.y+a.height+s*n),h=i.model.getAllEdges().length;o.start&&o.start(),qr(i,r),o.down&&o.down(),i.trigger(document,En,l),o.move&&o.move(),i.trigger(document,Hn,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var Ag=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"Tc");c(this,"consoleOutput","");this.eventManager=new ye,this.surface=e}get container(){return this.surface!=null?this.surface.getContainer():null}get canvas(){return this.surface!=null?this.surface.$getCanvasElement():null}get edgePathEditor(){return this.Tc==null&&(this.Tc=new ba(this.surface)),this.Tc}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=cD(this.model,r,e);return this.surface=t.surface,this.surface}querySelectorAll(r){return this.container.querySelectorAll(r)}querySelector(r){return this.container.querySelector(r)}dragANodeAround(r,e){lD(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){lD(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return Es(e)}withConsole(r){let e=console.log;console.log=function(t){this.consoleOutput=t}.bind(this);try{r()}catch(t){e("An exception was thrown while running a function with the console log captured",t)}console.log=e}clear(){return this.model.clear()}getRenderedElement(r){return this.surface.getObjectInfo(r,!1).el}getRenderedConnection(r){return this.surface.getRenderedConnection(r)}dragVertexIntoGroup(r,e){let t=this.surface.getObjectInfo(r,!1),n=this.surface.getObjectInfo(e,!1);if(t.el&&n.el){let o=this.surface.$getGroupContentAreaElement(n.el).getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x+o.width/2-s.width/2,l=o.y+o.height/2-s.height/2;i_(this.surface,t.el,a,l)}}dragVertexOutOfGroup(r,e){let t=this.surface.getObjectInfo(r,!1);if(t.el&&t.managedElement.modelObject.group!=null){let n=this.surface.getObjectInfo(t.managedElement.modelObject.group,!1);if(n.el){let o=n.el.getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x-50-s.width,l=o.y-50-s.height;i_(this.surface,t.el,a,l)}}}getGroup(r){return this.getModelObject(r)}getNode(r){return this.getModelObject(r)}getModelObject(r){return this.surface.getObjectInfo(r,!1).obj}dragVertexTo(r,e,t,n){let o=this.surface.toPageLocation(e,t);this.dragVertexToPageLocation(r,o.x,o.y,n)}dragVertexToPageLocation(r,e,t,n){let o=this.surface.getObjectInfo(r,!1);if(o.el)i_(this.surface,o.el,e,t,n);else throw new Error("Cannot drag node: cannot resolve "+r)}dragVertexBy(r,e,t,n,o){let s=this.surface.panZoom.getCompoundZoom();this.dragVertexByPageDelta(r,e*s,t*s,n,o)}dragVertexByPageDelta(r,e,t,n,o){let s=this.surface.getObjectInfo(r,!1);if(s.el)o_(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){o_(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){gD(this.surface,r,e,t,n,o,s)}dragVertexByInStages(r,e,t,n,o,s){let a=this.surface.getObjectInfo(r,!1);if(a.el)gD(this.surface,a.el,e,t,n,o,s);else throw new Error("Cannot drag vertex: cannot resolve "+r)}connect(r,e,t,n){let o=this.surface.getObjectInfo(r,!1),s=this.surface.getObjectInfo(e,!1);return this.model.$_addEdge({source:o.obj,target:s.obj,data:t||{}},n||yo,null)}ti(r){let e;if(LT(r))e=r;else{let t=Array.isArray(r)?r[0]:r;e=this.surface.getRenderedElement(t),Array.isArray(r)&&(e=e.querySelector(r[1]))}return e}Mg(r,e){return{sourceEl:this.ti(r),targetEl:this.ti(e)}}dragConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.Mg(r,e);return n_(this.surface,s,a,t,n,o)}dragAndAbortConnection(r){iB(this.surface,this.ti(r))}dragSnapConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.Mg(r,e);return fD(this.surface,s,a,t,n,o)}dragDetachedConnection(r,e,t){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let n=this.ti(r);return n_(this.surface,n,e,t)}dragDiagramConnection(r,e,t){this.surface.model.setSelection(r);let n=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),o=this.ti(e);return n_(this.surface,n,o,t,null)}dragDiagramSnapConnection(r,e,t,n,o){this.surface.model.setSelection(r);let s=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),a=this.ti(e);return fD(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return hD(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return hD(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n,o){pD(this.surface,r,!1,e,t,n,o)}relocateEdgeSource(r,e,t,n,o){pD(this.surface,r,!0,e,t,n,o)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Yt(n.el),this.surface.trigger(n.el,e,t);else throw new Error("Trigger: Cannot resolve "+r)}triggerEventOnElement(r,e,t,n,o){this.triggerEvent(r,e,t,n,o)}triggerEvent(r,e,t,n,o){let s=n!=null&&o!=null?t_(r,n,o,t):Yt(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=t_(r,t,n,o);this.surface.trigger(r,e,s)}makeEvent(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el){let o=Yt(n.el);return e||t?mD(o,e==null?0:e,t==null?0:t):o}else throw new Error("Trigger: Cannot resolve "+r)}makeEventAt(r,e){return Ar(r,e)}getEdge(r){return this.model.getEdge(r)}updateEdge(r,e){this.model.updateEdge(r,e)}getAllEdges(){return this.model.getAllEdges()}getRenderedPort(r){return this.surface.getRenderedPort(r)}addNode(r){return this.model.addNode(r)}updateNode(r,e){return this.model.updateNode(r,e)}addGroup(r){return this.model.addGroup(r)}updateGroup(r,e){this.model.updateGroup(r,e)}updateVertex(r,e){this.model.updateVertex(r,e)}clickOnGroup(r){r_(this,r)}clickOnNode(r){r_(this,r)}clickOnVertex(r){r_(this,r)}dblClickOnVertex(r){J$(this,r)}rightClickOnVertex(r){Z$(this,r)}tapOnVertex(r){bg(this,r)}tapOnNode(r){bg(this,r)}tapOnGroup(r){bg(this,r)}dblTapOnVertex(r){bg(this,r),bg(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){H$(this,r,e)}mouseoverOnVertex(r,e){k$(this,r,e)}mouseoutOnVertex(r,e){W$(this,r,e)}contextmenuOnVertex(r,e){Wy(this,r,At,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)qr(this.surface,this.canvas,e),ec(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){qr(this.surface,this.canvas,t,{x:r,y:e}),ec(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){tc(this.surface,this.canvas,En,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){tc(this.surface,this.canvas.parentNode,fs,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){tc(this.surface,this.canvas,Hn,1,{x:r,y:e})}lasso(r,e,t){ED(this.surface,r,e,t)}lassoOnElement(r,e,t,n){s_(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){q$(this,r)}clickOnElementInsideVertex(r,e){K$(this,r,e)}dblClickOnElementInsideVertex(r,e){Q$(this,r,e)}tapOnElement(r){uD(this,r)}tapOnElementInsideVertex(r,e){eB(this,r,e)}dblTapOnElementInsideVertex(r,e){tB(this,r,e)}mousedownOnElement(r){qr(this.surface,r)}clickOnEdge(r){Y$(this,r)}dblClickOnEdge(r){z$(this,r)}tapOnEdge(r){let e=rt(r)?r.id:r;X$(this,e)}dblTapOnEdge(r){let e=rt(r)?r.id:r;j$(this,e)}Gg(r,e,t,n){n=n||{};let o=n.events||{},s=n.zoom==null?1:n.zoom,a=n.x||90,l=n.y||90,h=r.source.querySelector(e),d=n.targetElement||this.surface.getContainer();var u=h.getBoundingClientRect(),p=d.getBoundingClientRect(),g=p.x,m=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(g+13)*s,f=(m+13)*s,b=g+a*s+u.width/2,A=m+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=Ar(E,y);this.surface.trigger(h,bi.DOWN_EVENT,T),t&&this.surface.trigger(h,bi.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,bi.MOVE_EVENT,Ar(x,f));let S=Ar(b,A);if(this.surface.trigger(d,bi.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let O=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(O,bi.DOWN_EVENT,S),this.surface.trigger(O,bi.UP_EVENT,S)}else this.surface.trigger(d,bi.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.Gg(r,e,!1,t)}tapFromPalette(r,e,t){this.Gg(r,e,!0,t)}mousedownOnEdge(r){xg(this,r,ge)}mouseupOnEdge(r){xg(this,r,le)}mouseoverOnEdge(r){xg(this,r,st)}mouseoutOnEdge(r){xg(this,r,ot)}contextmenuOnEdge(r){xg(this,r,At)}clickOnOverlay(r,e){rB(this,r,e)}clickOnPort(r,e){nB(this,r,e)}getEdgeCount(){return this.model.getEdgeCount()}dragElementToCanvas(r,e,t){e=e||250,t=t||250;let n=this.surface.panZoom.getApparentCanvasLocation(),o=this.surface.getContainer().parentNode.getBoundingClientRect(),s=o.x+n.x,a=o.y+n.y,l=Yt(r);this.eventManager.trigger(r,fs,l);let h=this.surface.$getSize(r),d=this.surface.getContainer().parentNode,u=r.getBoundingClientRect();this.eventManager.trigger(d,En,Ar(u.x+1,u.y+1)),this.eventManager.trigger(d,En,Ar(e+s+h.width/2,t+a+h.height/2)),this.eventManager.trigger(d,Hn,Ar(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=Hy("div");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=(e.width?e.width:250)+"px",t.style.height=(e.height?e.height:250)+"px",e.container=t,this.surface.addPlugin({type:"miniview",options:e})}getDOMPosition(r){let e=this.surface.getRenderedElement(r);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10)}}isAtPosition(r,e,t){let n=this.surface.getRenderedElement(r),o={x:parseInt(n.style.left,10),y:parseInt(n.style.top,10)};return e===o.x&&t===o.y}attachAnimator(){return new og(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<I$,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var a_="vjs-chart-background",Va="vjs-chart-plot-background",rc="vjs-chart-body",l_="vjs-chart-series",h_="vjs-chart-legend",Sg="vjs-chart-legend-item",c_="vjs-chart-legend-label",d_="vjs-chart-legend-dot",Ga="vjs-chart-axis",Tg="vjs-chart-x-axis",vg="vjs-chart-y-axis",Ky="vjs-chart-axis-labels",qy="vjs-chart-axis-line",Qy="vjs-chart-axis-title",u_="vjs-chart-y-axis-title",p_="vjs-chart-x-axis-title",g_="vjs-column-chart",m_="vjs-column-chart-column",E_="vjs-bar-chart",f_="vjs-bar-chart-bar",fn="vjs-chart-point",Cg="vjs-chart-point-hit-area",y_="vjs-bubble-chart",x_="vjs-bubble-chart-point",b_="vjs-scatter-chart",A_="vjs-scatter-chart-point",Pg="vjs-area-chart-area",S_="vjs-chart-title",T_="vjs-chart-subtitle",nc="vjs-chart-crosshair",ic="vjs-chart-crosshair-label",v_="vjs-chart-crosshair-value-axis",C_="vjs-chart-crosshair-category-axis",ex="vjs-chart-empty",P_="vjs-chart-axis-scale-label",tx="vjs-chart-gridlines",rx="vjs-chart-gridline",__="vjs-line-chart",O_="vjs-area-chart";var sB=6;function nx(i,r,e,t,n){let o=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),s=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);o<r&&(o+=e),s>i&&(s-=e),n!=null&&o>n&&(o=n),t!=null&&s<t&&(s=t);let a=(o-s)/e;return{maxScale:o,minScale:s,stepCount:a,step:e}}function aB(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function lB(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function xD(i,r,e,t,n,o){let s=nx(i,r,e,n,o),a=s.stepCount-t,l=Math.abs(a);if(a>0){let d=aB(s.step),u=nx(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}else if(a<0){let d=lB(s.step),u=nx(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}let h=[];for(let d=s.minScale;d<=s.maxScale;d+=s.step)h.push(d);return Object.assign(s,{steps:h,range:s.maxScale-s.minScale,dataMin:i,dataMax:r})}function oc(i,r,e=sB,t,n){let o=r-i,s=bD(o);return xD(i,r,s,e,t,n)}function R_(i,r,e){let t=[],n=r-i,o=n/e;for(let s=i;s<=r;s+=o)t.push(s);return{dataMin:i,dataMax:r,range:n,steps:t,step:o,stepCount:e,minScale:i,maxScale:r}}function sc(i,r,e){let t=[];for(let n=i;n<=r;n+=e)t.push(n);return{dataMin:i,dataMax:r,range:r-i,steps:t,step:e,stepCount:t.length-1,minScale:i,maxScale:t[t.length-1]}}function bD(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function Ai(i,r,e,t,n){return{size:(n==null?void 0:n.size)||i,style:(n==null?void 0:n.style)||r,weight:(n==null?void 0:n.weight)||e,family:(n==null?void 0:n.family)||t}}function k(i,r,e,t){let n=M(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function ys(i,r,e,t){let n=k(et,r,e,t);return n.innerHTML=i,n}function hB(i,r){let e=ah(i);zt(i,r,e.y)}function ac(i,r){let e=ah(i);zt(i,e.x,r)}function zt(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function yn(i){return i.type==="value"}function L_(i){return i.type==="category"}function lc(){return{x:0,y:0,width:0,height:0}}function ix(i,r){return r==null||r==="int"?Math.round(i).toString():typeof r=="number"?i.toFixed(r):i.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})}function w_(i,r,e,t){let n=()=>{if(i.length===0)return!1;let s=i[0].getBBox();for(let a=1;a<i.length;a++){let l=i[a].getBBox();if(tt(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end"),a.setAttribute("dominant-baseline","middle");let l=a.getBBox(),h={x:l.x+l.width,y:l.y-l.height};a.setAttribute("transform",`rotate(${s}, ${h.x}, ${h.y})`);let d=a.getBBox();if(d[t]>r){let u=r/d[t];a.textContent=a.textContent.substring(0,Math.floor(u*a.textContent.length))+"..."}})};if(n())return o(-45),!0}function yD(i){return`color(from color(from ${i} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1)) srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`}function _g(i,r,e,t,n,o){let s=M(et,{x:r,y:e,"text-anchor":"middle","dominant-baseline":"central","font-size":n.size||"0.7rem","font-weight":n.weight||"bold","font-style":n.style||"normal"},{fill:`color(from ${t} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`},"vjs-text-outline");o&&o.appendChild(s);let a=M("tspan",{fill:yD(t),stroke:yD(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=M("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="​",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function ox(i,r,e){let t=i.container.querySelector("svg"),n=window.getComputedStyle(t),o=Array.from(t.querySelectorAll(".vjs-text-outline"));o.forEach(E=>{let y=window.getComputedStyle(E),x=E.querySelector("tspan"),f=window.getComputedStyle(x);E.setAttribute("data-vjs-export-fill",y.fill),E.setAttribute("data-vjs-export-stroke",y.stroke),x.setAttribute("data-vjs-export-fill",f.fill),x.setAttribute("data-vjs-export-stroke",f.stroke)});let s=t.cloneNode(!0),a=s.getAttribute("viewBox"),l;if(a){let E=a.split(" ").map(y=>parseFloat(y));l={x:E[0],y:E[1],width:E[2],height:E[3]}}else l={x:0,y:0,width:parseFloat(s.getAttribute("width")||"0"),height:parseFloat(s.getAttribute("height")||"0")};Array.from(s.attributes).forEach(E=>s.removeAttribute(E.name)),s.setAttribute("xmlns",Gt),s.removeAttribute("class"),s.setAttribute("font-family",n.fontFamily||"sans-serif"),s.setAttribute("font-size",n.fontSize||"12"),r&&s.setAttribute("width",`${r}`),e&&s.setAttribute("height",`${e}`),cB(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${nc}, .${ic}`).forEach(E=>E.parentNode.removeChild(E));let d=s.querySelector("filter#vjs-tooltip-shadow");if(d){let E=d.parentElement;E.removeChild(d),E.tagName.toLowerCase()==="defs"&&E.children.length===0&&E.parentElement.removeChild(E)}Array.from(s.querySelectorAll(".vjs-text-outline")).forEach(E=>{let y=E.querySelector("tspan");E.setAttribute("fill",E.getAttribute("data-vjs-export-fill")),E.setAttribute("stroke",E.getAttribute("data-vjs-export-stroke")),y.setAttribute("fill",y.getAttribute("data-vjs-export-fill")),y.setAttribute("stroke",y.getAttribute("data-vjs-export-stroke"))}),o.forEach(E=>{E.removeAttribute("data-vjs-export-fill"),E.removeAttribute("data-vjs-export-stroke");let y=E.querySelector("tspan");y.removeAttribute("data-vjs-export-fill"),y.removeAttribute("data-vjs-export-stroke")});let p=Array.from(s.querySelectorAll("*")),g=E=>{Array.from(E.attributes).forEach(x=>{x.name.indexOf("data-vjs-")===0&&E.removeAttribute(x.name)}),E.removeAttribute("class"),E.removeAttribute("style"),E.removeAttribute("pointer-events")};return p.forEach(g),Array.from(s.querySelectorAll("g")).forEach(E=>{E.children.length===0&&E.parentNode.removeChild(E)}),{element:s,extents:l,svg:s.outerHTML.replace(/\n/g,"")}}function cB(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var dB="vertical",sx="horizontal",AD=10,ax="left",lx="center",D_="right",hc="top",cc="middle",hx="bottom",Og=class{constructor(r){c(this,"floating");c(this,"visible");c(this,"hover");c(this,"padding");c(this,"orientation");c(this,"align");c(this,"valign");c(this,"font");c(this,"$hideForSingleSeries");r=r||{},this.floating=r.floating===!0,this.visible=r.hide!==!0,this.hover=r.hover!==!1,this.padding=r.padding||AD,this.orientation=r.orientation||sx,this.align=r.align||lx,this.valign=r.valign||hx,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=Ai(12,"normal","normal","sans-serif",r.font)}};var Rg="chart:load",N_="No data",I_="Could not draw chart";var SD="vjs-chart-exporter-hamburger",uB="vjs-chart-exporter-menu",pB="vjs-chart-exporter-menu-item",TD="vjs-chart-exporter-hamburger-open",Lg=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"Co",!1);this.eventManager=new ye,this.eventManager.on(r.container,W,z(SD),t=>{t.stopPropagation(),this.Co?this.vc():this.gA()})}EA(r){let e=this.chart.container;getComputedStyle(e).position==="static"&&(e.style.position="relative"),this.hamburger=Jr("div",{width:"30px",height:"30px",cursor:"pointer",display:"flex",flexDirection:"column",justifyContent:"space-around",padding:"5px",boxSizing:"border-box",background:"rgba(255,255,255,0.8)",borderRadius:"4px"},SD),r==null&&(this.hamburger.style.position="absolute",this.hamburger.style.right=this.options.right||"1rem",this.hamburger.style.top=this.options.top||"1rem",this.hamburger.style.zIndex="100");for(let s=0;s<3;s++){let a=Jr("div",{width:"100%",height:"2px",backgroundColor:"#333"});this.hamburger.appendChild(a)}this.menu=Jr("div",{position:"absolute",display:"none",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",zIndex:"101",minWidth:"120px",borderRadius:"4px",padding:"5px 0"},uB),[{label:"Download JPG",type:ss},{label:"Download PNG",type:Mh},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=Jr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},pB);a.innerText=s.label,this.eventManager.on(a,Ye,()=>{this.fA(s.type),this.vc()}),this.eventManager.on(a,"mouseenter",()=>{a.style.backgroundColor="#f0f0f0"}),this.eventManager.on(a,"mouseleave",()=>{a.style.backgroundColor="transparent"}),this.menu.appendChild(a)}),r!=null?r.appendChild(this.hamburger):e.appendChild(this.hamburger),e.appendChild(this.menu);let n=()=>{this.Co&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this.Co&&(n(),this.hideTimeout=setTimeout(()=>{this.vc(),this.hideTimeout=null},500))};this.eventManager.on(this.hamburger,"mouseenter",()=>{n()}),this.eventManager.on(this.hamburger,"mouseleave",()=>{o()}),this.eventManager.on(this.menu,"mouseenter",()=>{n()}),this.eventManager.on(this.menu,"mouseleave",()=>{o()})}gA(){this.menu.style.display="block",this.Co=!0,L(this.hamburger,TD);let r=this.chart.container.getBoundingClientRect(),e=this.hamburger.getBoundingClientRect(),t=e.left-r.left+e.width-this.menu.offsetWidth,n=e.top-r.top+e.height+5;t<0&&(t=0),t+this.menu.offsetWidth>r.width&&(t=r.width-this.menu.offsetWidth),n+this.menu.offsetHeight>r.height&&(n=e.top-r.top-this.menu.offsetHeight-5,n<0&&(n=Math.max(0,r.height-this.menu.offsetHeight))),this.menu.style.left=`${t}px`,this.menu.style.top=`${n}px`}vc(){this.menu.style.display="none",this.Co=!1,F(this.hamburger,TD)}fA(r,e){if(e==null&&(e=(this.chart.getTitle()||"chart-export").toString().toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,30)),r==="svg"){let t=this.chart.exportSVG(),n=new Blob([t],{type:Pa.svg});this.$g(n,`${e}.svg`)}else{let t=r===ss?Pa.jpeg:Pa.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===ss?"jpg":"png";this.$g(n.url,`${e}.${o}`,!0)})}}$g(r,e,t=!1){let n=document.createElement("a");n.download=e,t?n.href=r:n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n),t||URL.revokeObjectURL(n.href)}destroy(){this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.hamburger.parentElement&&this.hamburger.parentElement.removeChild(this.hamburger),this.menu.parentElement&&this.menu.parentElement.removeChild(this.menu)}};var gB="0 0 32 30",mB="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",vD="0 0 32 32",EB="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",fB="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",yB="vjs-chart-zoom-controls",xB="vjs-chart-zoom-button",cx=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new ye}render(r,e){let t=this.chart.container;getComputedStyle(t).position==="static"&&(t.style.position="relative"),e=e||"row",this.container=Jr("div",{display:"flex",flexDirection:e},yB),r==null&&(this.container.style.position="absolute",this.container.style.left="1rem",this.container.style.top="1rem",this.container.style.zIndex="100"),[{title:"Zoom In",path:EB,viewBox:vD,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:fB,viewBox:vD,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:mB,viewBox:gB,onClick:()=>{this.chart.setZoom(1),this.chart.container.scrollLeft=0,this.chart.container.scrollTop=0}}].forEach(o=>{let s=Jr("div",{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"3px",boxSizing:"border-box"},xB);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
|
|
134
|
+
</div>`}}var zG=1.25,hg=class{constructor(r,e){this.ui=r;c(this,"qn");c(this,"kb");c(this,"lc");c(this,"$preparedShapes");c(this,"onVertexAdded");c(this,"palette");c(this,"$shapeLibrary");if(this.$shapeLibrary=r.getShapeLibrary()||e.shapeLibrary,this.$shapeLibrary==null){U("WARN: no ShapeLibrary set : ShapePalette cannot initialize.");return}let t=e.container,n=e.paletteStrokeWidth||zG,o=e.iconSize||{width:$G,height:BG};this.onVertexAdded=e.onVertexAdded,this.lc=e.dataGenerator,e.dragSize=e.dragSize||Object.assign({},o);let s=e.fill||ip.FILL,a=e.outline||ip.STROKE,l=e.outlineWidth||ip.STROKE_WIDTH;this.qn=xr({templates:YG(e.showAllMessage)});let h=`<div class="${Wh}" data-vjs-type="{{type}}"><svg:svg viewBox="0 0 ${o.width} ${o.height}" stroke-width="${n}"/>`+(e.showLabels?`<div class="${Gy}">{{label}}</div>`:"")+"</div>";this.qn.registerTag(UG,{template:h,rendered:(p,g,m,E)=>{var T,S,O;let y=g.type,x=null,f=E.getAttribute(so)||g.category;f!=null&&p.setAttribute(so,f);let b=g.shapeId;b!=null&&(p.setAttribute(lg,b),x=(T=this.$preparedShapes)==null?void 0:T.find(v=>v.shapeId===b)),p.setAttribute("title",g.label||""),g.objectType===se.objectType&&p.setAttribute(ql,Ct);let A=this.$shapeLibrary.getShapeDefinition(y,f);if(A!=null){A.members&&A.objectType===se.objectType&&p.setAttribute("data-vjs-group-template",`${f}:${y}`);let v=A.previewData||{},_=((S=A.initialSize)==null?void 0:S.width)||o.width,P=((O=A.initialSize)==null?void 0:O.height)||o.height,I=p.querySelector("svg");if(I.setAttribute("viewBox",`0 0 ${_} ${P}`),A.icon){let C=this.qn.parse(A.icon),R=this.qn.render(C,v).fragment;I.appendChild(R)}else{let C=Wg(vr({},v),{type:y,category:f,width:_,height:P}),R=this.$shapeLibrary.renderCompiledShape(C,n);if(this.$shapeLibrary.$getShapeDefinitionForObject(C).square){let N=Math.min(_,P),V=(_-N)/2,D=(P-N)/2;R.setAttribute("transform",`translate(${V}, ${D})`)}I.appendChild(R);let B={fill:s,stroke:a,"stroke-width":n};if(x!=null){let N=x.properties||{};for(let V in N){let D=V===Th?"stroke":V===vh?"stroke-width":V;I.setAttribute(D,N[V]),delete B[D]}}for(let N in B)I.setAttribute(N,B[N])}}},updated:(p,g,m)=>{}});let d;if(e.preparedShapes!=null){let p=e.preparedShapes.map(g=>Object.assign({},this.$shapeLibrary.getShapeDefinition(g.type,g.category),{shapeId:g.shapeId,properties:g.properties,category:g.category,label:g.label,size:g.size}));this.$preparedShapes=p,d=this.qn.template(Pw,{shapes:p})}else d=this.qn.template(Cw,{sets:this.$shapeLibrary.rootSet.children,showAll:e.initialSet==null});if(this.palette=d.childNodes[0],t.appendChild(this.palette),this.kb=new La(r,{source:this.palette,selector:z(Wh),dragSize:e.dragSize,dragSizeGenerator:(p,g)=>p&&p.width&&p.height?{width:p.width,height:p.height}:e.dragSize,canDrop:e.canDrop,mode:e.mode,allowClickToAdd:e.allowClickToAdd,lassoClass:mP,elementGenerator:(p,g)=>{let m=p.cloneNode(!0),E=m.querySelector(z(Gy));return E&&E.parentNode.removeChild(E),m},vertexPreviewGenerator:(p,g,m,E,y)=>{let x=Object.assign(m,{[r.$modelWidthAttribute]:5,[r.$modelHeightAttribute]:5,outlineWidth:m.outlineWidth||1}),f=M(Le,{preserveAspectRatio:"none",viewBox:"0 0 5 5"});f.classList.add(bh);let b=this.$shapeLibrary.renderCompiledShape(x);return f.appendChild(b),f},vertexPreviewUpdater:(p,g,m,E)=>{let y=this.$shapeLibrary.renderCompiledShape(Object.assign(E,{[r.$modelWidthAttribute]:m.width,[r.$modelHeightAttribute]:m.height}));p.replaceChildren(y),p.setAttribute("viewBox",`0 0 ${m.width} ${m.height}`)},dataGenerator:p=>{var C,R,w,B,N;let g=this.lc?this.lc(p)||{}:{},m=p.getAttribute(fP),E=p.getAttribute(so),y=p.getAttribute(lg),x=this.$shapeLibrary.getShapeDefinition(m,E),f=g.fill,b=g.outline,A=g.outlineWidth,T=g.color,S=(C=this.$preparedShapes)==null?void 0:C.find(V=>V.shapeId===y),O=(S==null?void 0:S.properties)||{},v=(R=S==null?void 0:S.size)==null?void 0:R.width,_=(w=S==null?void 0:S.size)==null?void 0:w.height,P=v||g.width||((B=x.initialSize)==null?void 0:B.width)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.width),I=_||g.height||((N=x.initialSize)==null?void 0:N.height)||(x.square?Math.min(e.dragSize.width,e.dragSize.height):e.dragSize.height);return Object.assign(g,{type:m,category:E,width:P,height:I,fill:s,outline:a,outlineWidth:l},O),f!=null&&(g.fill=f),b!=null&&(g.outline=b),A!=null&&(g.outlineWidth=A),T!=null&&(g.color=T),x.payload&&Object.assign(g,x.payload),g},allowDropOnEdge:!1,allowDropOnNode:!1,onVertexAdded:p=>{e.selectAfterDrop!==!1&&setTimeout(()=>r.model.setSelection(p.vertex)),this.onVertexAdded&&this.onVertexAdded(p)}}),Array.from(this.palette.querySelectorAll(z(kh))).forEach(p=>{p.addEventListener("change",g=>{let m=p.options[p.selectedIndex].value,E=p.getAttribute(so);p.setAttribute(EP,`${m===Ia}`),this.mg(m,E)})}),e.inspector!==!1){r.model.bind(Kt,m=>{g()}),r.model.bind(qt,m=>{g()});let p=()=>{Array.from(this.palette.querySelectorAll(z(np))).forEach(E=>{F(E,np)})},g=()=>{p();let m=new Set;if(this.ui.model.getSelection().eachVertex((E,y)=>m.add(`${y.type}|${y.data.category||this.$shapeLibrary.defaultCategoryId}`)),m.size===1){let[E,y]=Array.from(m)[0].split("|");if(this.$shapeLibrary.getShapeDefinition(E,y)!=null){let f=this.palette.querySelector(`[${so}='${y}'][${fP}='${E}']`);f!=null&&L(f,np)}}};r.model.bind(nr,()=>{p()}),r.on(this.palette,W,z(Wh),m=>{let E=m.target.closest(z(Wh)),y=E.getAttribute(so),x=E.getAttribute(fP),b=this.$shapeLibrary.getShapeDefinition(x,y).objectType||ce.objectType,A=this.gg();A.isEmpty()||r.model.transaction(()=>{A.eachVertex((T,S)=>{S.objectType===b&&r.model.updateVertex(S,{[this.$shapeLibrary.categoryParameter]:y,[this.$shapeLibrary.typeParameter]:x})})})}),r.model.bindAll([Re,ve],m=>{this.gg().containsVertex(m.vertex.id)&&g()})}e.initialSet!=null&&this.setCurrentSet(e.initialSet)}gg(){return this.ui.model.getSelection().filter(r=>J(r)||Y(r))}Hb(r){return this.palette.querySelector(`${z(kh)}[${so}='${r}']`)}mg(r,e){let t=e==ro?this.palette:this.palette.querySelector(`${z(ag)}[${so}='${e}']`);t.setAttribute(EP,`${r==Ia}`),Array.from(t.querySelectorAll(z(ag))).filter(o=>o.parentElement===t).forEach(o=>{o.setAttribute(FG,`${r===Ia||r===o.getAttribute(so)}`)})}Eg(r,e){this.mg(r,e);let t=this.Hb(e);t!=null&&(t.value=r,t.setAttribute(EP,`${r===Ia}`))}setCurrentSet(r){if(r!=null){let e=this.$shapeLibrary.getShapeSet(r);if(e!=null){let t=[[e.id,e.parent]],n=e.parent;for(;n!=null&&n!==ro;){let o=this.$shapeLibrary.getShapeSet(n);t.unshift([n,o.parent]),n=o.parent}t.forEach(o=>{this.Eg(o[0],o[1])})}}else this.Eg(Ia,ro)}};var By="vjs-diagram-node",Fy="vjs-diagram-group",xP=100,bP=80,AP=[Mv];var jn=class{constructor(r,e){this.diagram=r;this.vertex=e;c(this,"el");c(this,"$destroyed",!1)}get id(){return this.vertex.getFullId()}get zIndex(){return this.vertex.data.z==null?0:this.vertex.data.z}update(r){this.diagram.model.updateVertex(this.vertex,r)}setSize(r){this.diagram.$ui.setSize(this.vertex,r.width,r.height)}setPosition(r){this.diagram.$ui.setPosition(this.vertex,r.x,r.y)}setLabel(r){this.diagram.model.updateVertex(this.vertex,{[this.diagram.labelAttribute]:r})}setFill(r){this.diagram.model.updateVertex(this.vertex,{[jf]:r})}setOutline(r){this.diagram.model.updateVertex(this.vertex,{[Th]:r})}setOutlineWidth(r){this.diagram.model.updateVertex(this.vertex,{[vh]:r})}setColor(r){this.diagram.model.updateVertex(this.vertex,{[Hf]:r})}get label(){return this.vertex.data[to]}get fill(){return this.vertex.data[jf]||Ch}get outline(){return this.vertex.data[Th]||ts}get outlineWidth(){return this.vertex.data[vh]||Ph}get color(){return this.vertex.data[Hf]||Iv}get size(){return{width:this.vertex.data[this.diagram.cellWidthAttribute],height:this.vertex.data[this.diagram.cellHeightAttribute]}}get width(){var r;return((r=this.size)==null?void 0:r.width)||0}get height(){var r;return((r=this.size)==null?void 0:r.height)||0}get position(){return{x:this.vertex.data[this.diagram.cellLeftAttribute],y:this.vertex.data[this.diagram.cellTopAttribute]}}remove(){this.diagram.removeCell(this)}destroy(){this.diagram=null,this.vertex=null,this.$destroyed=!0}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}};var yi=class{constructor(r,e){this.diagram=r;this.edge=e;c(this,"$destroyed",!1)}get id(){return this.edge.id}get connection(){return this.diagram.$ui.getRenderedConnection(this.edge.id)}update(r){this.diagram.model.updateEdge(this.edge,r)}remove(){this.diagram.model.remove(this.edge)}setLabel(r){this.update({label:r})}get label(){return this.edge.data.label}setColor(r){this.update({color:r})}get color(){return this.edge.data.color}setLineWidth(r){this.update({lineWidth:r})}get lineWidth(){return this.edge.data.lineWidth}setOutlineColor(r){this.update({outlineColor:r})}get outlineColor(){return this.edge.data.outlineColor}setOutlineWidth(r){this.update({outlineWidth:r})}get outlineWidth(){return this.edge.data.outlineWidth}setDashArray(r){this.update({dashArray:r})}get dashArray(){return this.edge.data.dashArray}setLabelLocation(r){this.update({labelLocation:r})}get labelLocation(){return this.edge.data.labelLocation}setSource(r){this.diagram.model.setSource(this.edge,r instanceof jn?r.id:r)}get source(){return this.edge.source}setTarget(r){this.diagram.model.setTarget(this.edge,r instanceof jn?r.id:r)}get target(){return this.edge.target}toFront(){this.diagram.toFront(this)}toBack(){this.diagram.toBack(this)}destroy(){this.diagram=null,this.edge=null,this.$destroyed=!0}};function SP(){return{dragOnGrid:!0,showGrid:!0,showBorder:!1,autoShrink:!0,minWidth:1e4,maxWidth:null,minHeight:1e4,maxHeight:null,showTickMarks:!1,type:Ta.type}}var _w=15,Uy="vjs-cell-tool",TP="vjs-clone-cell",vP="vjs-delete-cell",Ow="vjs-link-cell",gs=class extends ps{constructor(){super(...arguments);c(this,"id","diagramTools");c(this,"$buttonSize");c(this,"$allowClone");c(this,"$allowDelete");c(this,"$allowLink");c(this,"$canShowLinkButton");c(this,"$canDelete");c(this,"$canClone");c(this,"$shouldDeleteGroupMembers");c(this,"$buttonY")}initialise(e,t){return super.initialise(e,t),this.$buttonSize=t.buttonSize||_w,this.$allowClone=t.allowClone!==!1,this.$allowDelete=t.allowDelete!==!1,this.$allowLink=t.allowLink!==!1,this.$canShowLinkButton=t.canShowLinkButton,this.$canDelete=t.canDelete,this.$canClone=t.canClone,this.$shouldDeleteGroupMembers=t.shouldDeleteGroupMembers,this.$buttonY=-1*(this.vt/2+this.$buttonSize),this.surface.on(this.surface.getContainer(),W,z(TP),n=>{let s=n.target.closest(`[${te}]`).getAttribute(te);s!=null&&(oe(n),this.surface.cloneVertex(s,{selectAfterCreate:!0}))}),this.surface.on(this.surface.getContainer(),W,z(vP),n=>{let o=n.target.closest(`[${te}]`),s=o.getAttribute(te);if(s!=null){oe(n);let a=this.surface.model.getVertex(s);Y(a)?this.surface.model.removeGroup(s,this.$shouldDeleteGroupMembers==null?!1:this.$shouldDeleteGroupMembers(a,o)===!0):this.surface.model.removeNode(a)}}),!1}ic(e,t,n,o){let s=super.ic(e,t,n,o);if(this.$canClone?this.$canClone(e.modelObject,e.el):this.$allowClone){let d=M(Q,{transform:`translate(${this.$getCloneButtonX(e)}, ${this.$getCloneButtonY(e)})`});s.appendChild(d),cp(ap,this.$buttonSize,this.$buttonSize,[TP,Uy],{title:"Click to clone"},d),this.skeletons[e.id].cloneButton=d}if(this.$canDelete?this.$canDelete(e.modelObject,e.el):this.$allowDelete){let d=M(Q,{transform:`translate(${this.$getDeleteButtonX(e)}, ${this.$getDeleteButtonY(e)})`});s.appendChild(d),cp(lp,this.$buttonSize,this.$buttonSize,[vP,Uy],{title:"Click to delete"},d),this.skeletons[e.id].deleteButton=d}if(this.$canShowLinkButton?this.$canShowLinkButton(e.modelObject,e.el):this.$allowLink){let d=M(Q,{transform:`translate(${this.$getLinkButtonX(e)}, ${this.$getLinkButtonY(e)})`});s.appendChild(d),cp(sp,this.$buttonSize,this.$buttonSize,[Ow,Uy],{title:"Click and drag to link","data-vjs-source":!0,[te]:e.id},d,{"data-vjs-source":!0}),this.skeletons[e.id].linkButton=d}return s}$getCloneButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getCloneButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getDeleteButtonX(e){return-(this.$buttonSize/2+this.$handleOffset)}$getDeleteButtonY(e){return this.$buttonY-this.$buttonSize/2-this.$handleOffset}$getLinkButtonX(e){return e.width-this.$buttonSize/2+this.$handleOffset}$getLinkButtonY(e){return e.height+this.$buttonSize/2+this.$handleOffset}$_setSkeletonPositionById(e){if(this.skeletons[e]&&super.$_setSkeletonPositionById(e)){let t=this.surface.$getManagedElement(e),n=this.skeletons[t.id].cloneButton;n&&n.setAttribute(ui,`translate(${this.$getCloneButtonX(t)}, ${this.$getCloneButtonY(t)})`);let o=this.skeletons[t.id].deleteButton;o&&o.setAttribute(ui,`translate(${this.$getDeleteButtonX(t)}, ${this.$getDeleteButtonY(t)})`);let s=this.skeletons[t.id].linkButton;return s&&s.setAttribute(ui,`translate(${this.$getLinkButtonX(t)}, ${this.$getLinkButtonY(t)})`),!0}return!1}};c(gs,"type","diagramTools"),gs=He([Xe("diagramTools")],gs);var Zh=class extends hg{constructor(r,e,t){let n=t==null?void 0:t.onVertexAdded,o=t==null?void 0:t.onCellAdded;super(e.$ui,Object.assign(t||{},{container:r,inspector:(t==null?void 0:t.inspector)!==!1,selectAfterDrop:t==null?void 0:t.selectAfterAdd,onVertexAdded:s=>{o&&o(e.getCell(s.vertex.id)),n&&n(s)},dataGenerator:s=>{let a=Object.assign({},e.$propertyTracker.getValues()),l=s.getAttribute(lg);if(l){let h=this.$preparedShapes.find(d=>d.shapeId===l);h&&Object.assign(a,h.properties||{})}return a}}))}};function CP(i){return i.startEditingPath!==void 0}function Rw(i){return i.isEmpty()?0:i.head().zIndex}function XG(i){return i.isEmpty()?0:i.peek().zIndex}var cg=class{constructor(r,e,t){this.model=r;c(this,"$shapeLibrary");c(this,"$ui");c(this,"defaultCellWidth");c(this,"defaultCellHeight");c(this,"labelAttribute");c(this,"$_cellMap");c(this,"$editable");c(this,"$_cellList");c(this,"$propertyTracker");c(this,"F");var a,l,h,d,u,p,g,m,E,y,x,f,b,A,T,S,O,v,_,P,I,C,R,w,B,N,V,D,$,K,xe,H,Ee,Fe,Je,Xt,sr,rr,Dr,go,Qa,el,tl,rl,nl,jg,Hg,Ac,kg,Sc,bs;t=t||{},this.F=t.mediator,this.$_cellList=new Ts((re,je)=>re.zIndex<je.zIndex?-1:re.zIndex>je.zIndex?1:0),this.$_cellMap=new Map,this.labelAttribute=((a=t.cells)==null?void 0:a.labelProperty)||to,this.$shapeLibrary=new da(t.shapes||AP,{labelFillRatio:(l=t.cells)==null?void 0:l.labelFillRatio,multilineLabels:(h=t.cells)==null?void 0:h.multilineLabels,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,labelPosition:(d=t.cells)==null?void 0:d.labelPosition}),this.$propertyTracker=new Nu(this.model,{fill:t.defaultFillColor||Ch,outline:t.defaultOutlineColor||ts,outlineWidth:t.defaultOutlineWidth||Ph,color:t.defaultColor||ts}),this.defaultCellWidth=((u=t.cells)==null?void 0:u.defaultWidth)||xP,this.defaultCellHeight=((p=t.cells)==null?void 0:p.defaultHeight)||bP,this.$editable=t.editable!==!1;let n=[];if(t.editable!==!1){if(n.push({type:gs.type,options:{rotationStops:(g=t.cells)==null?void 0:g.rotationStops,canResizeFilter:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.resizable)!==!1&&this.Wb(re,je)!==!1},canRotateFilter:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.rotatable)!==!1&&this.Zb(re,je)!==!1},canShowLinkButton:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.linkable)!==!1&&this.Jb(re,je)!==!1},canDelete:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.deletable)!==!1&&this.Kb(re,je)!==!1},canClone:(re,je)=>{var wt,Tr;return((wt=t.cells)==null?void 0:wt.editable)!==!1&&((Tr=t.cells)==null?void 0:Tr.clonable)!==!1&&this.qb(re,je)!==!1},handleShape:(E=(m=t.cells)==null?void 0:m.resize)==null?void 0:E.handleShape,handleSize:(x=(y=t.cells)==null?void 0:y.resize)==null?void 0:x.handleSize,modelUpdater:(b=(f=t.cells)==null?void 0:f.resize)==null?void 0:b.modelUpdater,shouldDeleteGroupMembers:(A=t.cells)==null?void 0:A.shouldDeleteGroupMembers,handlerFactory:(S=(T=t.cells)==null?void 0:T.resize)==null?void 0:S.handlerFactory,resizeMethod:(v=(O=t.cells)==null?void 0:O.resize)==null?void 0:v.method,bordersVisible:(P=(_=t.cells)==null?void 0:_.resize)==null?void 0:P.bordersVisible,ignoreGrid:((C=(I=t.cells)==null?void 0:I.resize)==null?void 0:C.ignoreGrid)===!0,resizeX:(w=(R=t.cells)==null?void 0:R.resize)==null?void 0:w.resizeX,resizeY:(N=(B=t.cells)==null?void 0:B.resize)==null?void 0:N.resizeY}}),t.snapLines!=null){let re=t.snapLines===!0?{}:t.snapLines;n.push({type:hs.type,options:re})}if(t.panButtons!=null){let re=t.panButtons===!0?{}:t.panButtons;n.push({type:cs.type,options:re})}if(t.lineCrossings!=null){let re=t.lineCrossings===!0?{}:t.lineCrossings;n.push({type:tg,options:re})}}t.grid!=null&&t.grid.visible!==!1&&n.push({type:os.type,options:SP()}),t.lasso!=null&&(mo(t.lasso)?n.push(Yn.type):n.push({type:Yn.type,options:t.lasso})),t.miniview!=null&&n.push({type:zn.type,options:t.miniview}),t.dragGroups!=null&&n.push({type:ls.type,options:t.dragGroups}),((V=t.edges)==null?void 0:V.highlightSelected)===!0&&n.push({type:va.type,options:{paintStyle:(D=t.edges)==null?void 0:D.highlightStyle}});let o=t.defaults||{},s={zoom:t.zoom,pan:t.pan,activeFiltering:($=t.edges)==null?void 0:$.activeFiltering,grid:t.grid,zoomToFit:t.zoomToFit,zoomToFitIfNecessary:t.zoomToFitIfNecessary,useModelForSizes:!0,writeSizeToElements:!1,useSvgContainer:!0,wheel:t.wheel,magnetizer:(K=t.cells)==null?void 0:K.magnetizer,getCollapsedGroupSize:(xe=t.cells)==null?void 0:xe.getCollapsedGroupSize,canCollapseGroup:(re,je)=>this.F!=null&&this.F.canCollapse!=null?this.F.canCollapse(re,je):!0,canExpandGroup:(re,je)=>this.F!=null&&this.F.canExpand!=null?this.F.canExpand(re,je):!0,elementsDraggable:this.$editable!==!1&&((H=t.cells)==null?void 0:H.draggable)!==!1,defaults:o,view:this.Qb(t),shapes:{library:this.$shapeLibrary,showLabels:((Ee=t.cells)==null?void 0:Ee.showLabels)!==!1,strokeWidth:(Fe=t.cells)==null?void 0:Fe.outlineWidth,labelAttribute:(Je=t.cells)==null?void 0:Je.labelProperty,defaultFillColor:t.defaultFillColor,defaultOutlineColor:t.defaultOutlineColor,font:(Xt=t.cells)==null?void 0:Xt.font},edges:{editable:t.editable!==!1&&((sr=t.edges)==null?void 0:sr.editable)!==!1,editOnTap:t.editable!==!1,propertyMappings:(rr=t.edges)==null?void 0:rr.propertyMappings,avoidVertices:(Dr=t.edges)==null?void 0:Dr.avoidVertices,allowUnattached:((go=t.edges)==null?void 0:go.allowUnattached)!==!1,connector:(Qa=t.edges)==null?void 0:Qa.connector,layerIndex:(el=t.edges)==null?void 0:el.layerIndex,sourceMarker:(tl=t.edges)==null?void 0:tl.sourceMarker,targetMarker:(rl=t.edges)==null?void 0:rl.targetMarker,overlays:(nl=t.edges)==null?void 0:nl.overlays,anchor:(jg=t.edges)==null?void 0:jg.anchor,anchors:(Hg=t.edges)==null?void 0:Hg.anchors,inputMethod:(Ac=t.edges)==null?void 0:Ac.inputMethod,reattach:((kg=t.edges)==null?void 0:kg.reattach)===!0,detachable:(Sc=t.edges)==null?void 0:Sc.detachable},edgeSnap:(bs=t.edges)==null?void 0:bs.snap,plugins:n,events:{[_n]:()=>{t.deselectOnCanvasTap!==!1&&this.model.clearSelection()},[Vs]:re=>{if(this.$editable){let je=this.$_cellMap.get(re.dragGroup[0].vertex.id);je!=null&&this.toFront(je)}},[_b]:re=>{if(this.$editable){let je=this.$_cellMap.get(re.dragGroup[0].vertex.id);je!=null&&this.toFront(je)}}},dragOptions:{filter:re=>this.F&&this.F.canDrag?this.F.canDrag(re.vertex,this.Ir(re.vertex),re.el):!0,canDrop:(re,je,wt)=>this.F&&this.F.canDrop?this.F.canDrop(re,je,wt):!0,autoPan:t.autoPan!==!1},templates:{nodeDefault:`<svg:g ${Yo}="${this.$editable}" class="${By}"><vjs-shape/></svg:g>`,groupDefault:`<svg:g ${Yo}="${this.$editable}" class="${Fy}"><vjs-shape/></svg:g>`,groupNoTarget:`<svg:g class="${Fy}"><vjs-shape/></svg:g>`,nodeNoTarget:`<svg:g class="${By}"><vjs-shape/></svg:g>`}};this.$editable?this.$ui=this.model.render(e,s):this.$ui=this.model.renderPaper(e,s),this.$ui.bind(Yr,re=>{this.fg(re.vertex,re.el)}),this.$ui.bind(Ur,re=>{this.fg(re.vertex,re.el)}),this.model.bind(Ce,re=>{this.yg(re.node)}),this.model.bind(Oe,re=>{this.yg(re.group)}),this.model.bind(Zt,()=>{this.$_cellMap.clear(),this.$_cellList.clear()})}get cellWidthAttribute(){return this.model.modelWidthAttribute}get cellHeightAttribute(){return this.model.modelHeightAttribute}get cellLeftAttribute(){return this.model.modelLeftAttribute}get cellTopAttribute(){return this.model.modelTopAttribute}Qb(r){var h,d,u,p,g,m,E,y,x,f,b,A,T,S,O;let e=(h=r.edges)!=null&&h.events?r.edges.events[Ye]:null,t={events:{[Ye]:v=>{let _=v.e.srcElement||v.e.target;if(un(_,ia)){oe(v.e),v.model.removeEdge(v.connection.edge);return}r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||v.model.getSelection().ne.length<1||v.e.shiftKey!==!0?v.model.setSelection(v.obj):v.model.addToSelection(v.obj)),e&&e(v)}},overlays:((d=r.edges)==null?void 0:d.overlays)||[],sourceMarker:(u=r.edges)==null?void 0:u.sourceMarker,targetMarker:(p=r.edges)==null?void 0:p.targetMarker,label:null,labelLocation:.5,labelLocationAttribute:null,deleteButton:(g=r.edges)==null?void 0:g.deleteButton,deleteButtonClass:(m=r.edges)==null?void 0:m.deleteButtonClass,deleteButtonLocation:(E=r.edges)==null?void 0:E.deleteButtonLocation,deleteConfirm:(y=r.edges)==null?void 0:y.deleteConfirm};if(r.edges){if(r.edges.showLabels){let v=r.edges.labelProperty||"label";t.label=`{{${v}}}`,r.edges.labelLocation!=null&&(t.labelLocation=r.edges.labelLocation),r.edges.labelLocationProperty!=null&&(t.labelLocationAttribute=r.edges.labelLocationProperty),r.edges.labelFont!=null&&(t.labelFont=r.edges.labelFont),r.edges.labelsRotatable!=null&&(t.labelsRotatable=r.edges.labelsRotatable)}if(r.edges.events)for(let v in r.edges.events)v!==Ye&&(t.events[v]=r.edges.events[v])}let n=Object.assign({},((x=r.cells)==null?void 0:x.events)||{}),o=v=>_=>{this.$editable&&this.toFront(this.$_cellMap.get(_.obj.id)),r.selectShapeOnTap!==!1&&(r.allowMultipleSelections===!1||_.model.getSelection().pe.length<1||_.e.shiftKey!==!0?_.model.setSelection(_.obj):_.model.addToSelection(_.obj)),v&&v(_)};n.tap=o((b=(f=r.cells)==null?void 0:f.events)==null?void 0:b.tap);let s={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Ir(I);return C!=null&&C.defaultTarget===!1?"groupNoTarget":"groupDefault"}};if((A=r.cells)!=null&&A.groups){let v=(T=r.cells)==null?void 0:T.groups,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(s,v)}let a={events:n,templateIdResolver:(v,_,P,I)=>{let C=this.Ir(I);return C!=null&&C.defaultTarget===!1?"nodeNoTarget":"nodeDefault"}};if((S=r.cells)!=null&&S.nodes){let v=(O=r.cells)==null?void 0:O.nodes,_=v.events||{};_.tap&&(_.tap=o(_.tap)),delete v.template,Object.assign(a,v)}return{nodes:{default:a},edges:{default:t},groups:{default:s}}}fg(r,e){r.data.z==null&&(r.data.z=Rw(this.$_cellList)+1);let t=new jn(this,r);t.el=e,this.$_cellMap.set(r.id,t),this.$_cellList.add(t)}yg(r){let e=this.$_cellMap.get(r.id);e!=null&&(this.$_cellList.delete(e),e.destroy(),this.$_cellMap.delete(r.id))}Zb(r,e){let t=this.Ir(r);return t==null?!0:this.F&&this.F.canRotate?this.F.canRotate(r,t,e):!0}Jb(r,e){let t=this.Ir(r);return t==null?!0:this.F&&this.F.canLink?this.F.canLink(r,t,e):!0}qb(r,e){let t=this.Ir(r);return t==null?!0:this.F&&this.F.canClone?this.F.canClone(r,t,e):!0}Wb(r,e){let t=this.Ir(r);return t==null?!0:this.F&&this.F.canResize?this.F.canResize(r,t,e):!0}Kb(r,e){let t=this.Ir(r);return t==null?!0:this.F&&this.F.canDelete?this.F.canDelete(r,t,e):!0}Ir(r){let e=r.data.type,t=r.data.category;return this.$shapeLibrary.getShapeDefinition(e,t)}destroy(){this.$ui.destroy()}eA(r){return X(r)?r:r.id}hc(r){return X(r)?this.$_cellMap.get(r):r}getCell(r){let e=this.$_cellMap.get(r);return e&&e.el==null&&(e.el=this.$ui.getRenderedElement(r)),e}addCell(r){if(r.type==null)return U("WARN: cannot add a cell with no `type` to the diagram"),null;let e=this.$shapeLibrary.getShapeDefinition(r.type,r.category);if(e==null)return U(`WARN: cannot add cell with type ${r.type} and category ${r.category}; not found in shape library`),null;Object.assign(r,e.payload||{}),r[this.cellWidthAttribute]==null&&(r[this.cellWidthAttribute]=this.defaultCellWidth),r[this.cellHeightAttribute]==null&&(r[this.cellHeightAttribute]=this.defaultCellHeight),r[this.cellLeftAttribute]==null&&(r[this.cellLeftAttribute]=0),r[this.cellTopAttribute]==null&&(r[this.cellTopAttribute]=0);let t=this.$ui.model.addNode(r),n=new jn(this,t);return this.$_cellMap.set(t.id,n),n.el=this.$ui.getRenderedElement(t),n}getLink(r){let e=this.model.getEdge(r);return e==null?null:new yi(this,e)}addLink(r){let e=Object.assign({},r);e.source instanceof jn&&(e.source=e.source.id),e.target instanceof jn&&(e.target=e.target.id);let t=this.model.addEdge(e);return new yi(this,t)}load(r){this.clear(),this.model.load(r)}exportData(){return this.model.exportData()}exportSvg(r){return Oa(this.$ui,r).svg}exportImage(r,e){Yp(this.$ui,r,e)}save(r){return this.$ui.save(r)}saveToUrl(r){this.model.save(Object.assign(r,{data:this.save(r)}))}getCellCount(){return this.model.getNodeCount()}getLinkCount(){return this.model.getEdgeCount()}clear(){this.model.clear()}removeCell(r){this.model.remove(this.eA(r))}toFront(r){if(!(r instanceof yi)){let e=this.hc(r);if(e!=null){let t=Rw(this.$_cellList);e.vertex.data.z<t&&(e.vertex.data.z=t+1,this.$_cellList.update(e),this.$ui.toFront(e.vertex))}}}toBack(r){if(!(r instanceof yi)){let e=this.hc(r);if(e!=null){let t=XG(this.$_cellList);e.vertex.data.z>t&&(e.vertex.data.z=t-1,this.$_cellList.update(e),this.$ui.toBack(e.vertex))}}}selectCell(r){let e=this.hc(r);e!=null&&this.model.setSelection(e.vertex.id)}selectLink(r){let e=this.model.getEdge(X(r)?r:r.id);e!=null&&this.model.setSelection(e)}selectEdge(r){this.selectLink(r)}startEditingPath(r,e){let t=r instanceof yi?r.edge:r;CP(this.$ui)&&this.$ui.startEditingPath(t,e)}stopEditingPath(){CP(this.$ui)&&this.$ui.stopEditingPath()}clearPathEdits(r){if(CP(this.$ui)){let e=r instanceof yi?r.edge:r;this.$ui.clearPathEdits(e)}}getZoom(){return this.$ui.getZoom()}attachMiniview(r){this.$ui.addPlugin({type:zn.type,options:r})}attachPalette(r,e){return new Zh(r,this,e)}setZoom(r){this.$ui.setZoom(r)}zoomToFit(r){this.$ui.zoomToFit(r)}zoomToFitIfNecessary(r){this.$ui.zoomToFitIfNecessary(r)}};function jG(i,r,e){return new Zh(r,i,e)}function HG(i,r,e,t){var s,a,l,h;r=r||{},e=e||{},e.beforeStartConnect==null&&(e.beforeStartConnect=r.beforeStartConnect),e.beforeConnect==null&&(e.beforeConnect=r.beforeConnect),Object.assign(e,{modelWidthAttribute:((s=r==null?void 0:r.cells)==null?void 0:s.widthProperty)||_e,modelHeightAttribute:((a=r==null?void 0:r.cells)==null?void 0:a.heightProperty)||Ve,modelLeftAttribute:((l=r==null?void 0:r.cells)==null?void 0:l.leftProperty)||ee,modelTopAttribute:((h=r==null?void 0:r.cells)==null?void 0:h.topProperty)||fe,selectionMode:ld});let o=fn(e).renderDiagram(i,r);return t&&o.load({data:t}),o}var PP=class extends Ra{constructor(r,e,t){super(r,e.$ui,t)}};var _P="data-vjs-popup-position",kG="vjs-surface-popup";function OP(i,r,e,t){let n=ft(r),o=t.getEffectiveVisibleZoom(),s=e.width/o,a=e.height/o;switch(i){case"bottom":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height;break}case"top":{n.x=r.x+r.width/2-s/2,n.y=r.y-a;break}case"left":{n.x=r.x-s,n.y=r.y+r.height/2-a/2;break}case"right":{n.x=r.x+r.width,n.y=r.y+r.height/2-a/2;break}case"center":{n.x=r.x+r.width/2-s/2,n.y=r.y+r.height/2-a/2;break}}return t.toViewportLocation(n.x,n.y)}var RP=class{constructor(r,e,t,n,o){c(this,"ut",null);c(this,"xg","bottom");c(this,"Ag","bottom");c(this,"setCurrent");c(this,"container");c(this,"surface");c(this,"Q");this.container=e,this.surface=t,this.setCurrent=n,this.Ag=o||"bottom",this.surface.addDragSelectorFilter(r),this.surface.addElementEventFilter(r);let s=p=>{let g=t.getElementFromEvent(p);if(g!=null){oe(p);let m=p.target.getAttribute(_P)||this.Ag;this.fo(g.modelObject,m)}else this.fo(null)},a=p=>{this.fo(null)},l=p=>{this.ut&&this.ut.modelObject===p.vertex&&(this.$positionPopup(),this.setCurrent(this.ut.modelObject))},h=p=>{this.ut&&this.ut.modelObject===p.vertex&&this.fo(null)},d=p=>{this.ut!=null&&p.dragGroup.forEach(g=>{var m;g.vertex===((m=this.ut)==null?void 0:m.modelObject)&&this.$positionPopup()})},u=()=>this.$positionPopup();t.on(t.getContainer(),W,r,s),t.bind(_n,a),t.model.bind(Re,l),t.model.bind(ve,l),t.model.bind(Ce,h),t.model.bind(Oe,h),t.bind(Mt,d),t.bind(To,d),t.bind(Br,u),t.bind(Gi,u),this.Q=()=>{t.off(t.getContainer(),W,s),t.unbind(_n,a),t.model.unbind(Re,l),t.model.unbind(ve,l),t.model.unbind(Ce,h),t.model.unbind(Oe,h),t.unbind(Mt,d),t.unbind(To,d),t.unbind(Br,u),t.unbind(Gi,u)}}fo(r,e){var t;r==null?this.ut=null:(this.ut=(t=this.surface)==null?void 0:t.getElement(r.getFullId()),this.xg=e||"bottom"),this.setCurrent(r),r!=null&&requestAnimationFrame(()=>this.$positionPopup())}$destroy(){this.Q()}$hide(){this.fo(null)}$positionPopup(){if(this.ut!=null&&this.container!=null){let r=Ze(this.container),e=OP(this.xg,this.ut,r,this.surface);this.surface.floatElement(this.container,e)}}};function WG(i,r){Ap.register(i,r)}function ZG(i,r,e){return fn(e||{}).render(i,r)}var JG=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e||Lw,r)},KG=(e=>(e.idle="idle",e.dragging="dragging",e))(KG||{}),wC="assigned",Ma="added";function ww(i){return X(i)?{id:i,active:!0,membership:Ma}:{id:i.id,active:i.active,membership:i.membership}}var qG=z(dh);function QG(i,r){let e=em(i.members,t=>t.el.id===r);return e!==null?e.active===!0:!1}var e$=["input","textarea","select","button","option"],Lw=e$.join(","),dg=class{constructor(r){c(this,"inputFilterSelector");c(this,"Vr",{});c(this,"dc",[]);c(this,"activeGrid");c(this,"downAt");c(this,"viewportPositionAtDown");c(this,"relativePositionAtDown");c(this,"newPosition");c(this,"uc");c(this,"O");c(this,"pc");c(this,"yo");c(this,"u");c(this,"_");c(this,"xe");c(this,"Mr");c(this,"aa");c(this,"mc");c(this,"he");c(this,"la",[]);c(this,"gc");c(this,"xo");c(this,"ha",null);c(this,"Ct",[]);c(this,"currentState","idle");c(this,"R");c(this,"dn",{});c(this,"Ec",{});c(this,"Zt",null);c(this,"be",new Map);c(this,"bo",new Map);c(this,"ui");c(this,"draggableInstance");c(this,"resolveGrid");this.ui=r.ui,this.draggableInstance=r.draggableInstance,this.resolveGrid=r.resolveGrid,this.inputFilterSelector=r.inputFilterSelector||Lw;let e=`${Ae(te)}, ${Ae(te)} *`;this.draggableInstance.addDragHandler({selector:e,start:t=>this.tA(t),drag:t=>this.rA(t),stop:t=>{this.nA(t)},constrainFunction:(t,n,o,s,a,l)=>t,destroy:()=>this.$destroy()}),this.ui.bind(Br,t=>{this.currentState==="dragging"&&(this.yo=this.yo*(t.zoom/this.pc),this.pc=t.zoom)}),this.draggableInstance.dragOptions.autoPan!==!1&&(this.R=new mi(this.draggableInstance,{autoPanDelta:this.draggableInstance.dragOptions.autoPanDelta||5,autoPanRepeat:this.draggableInstance.dragOptions.autoPanRepeat||15,boundsStrategy:this.draggableInstance.dragOptions.autoPanBoundsStrategy,onPan:t=>{this.O=Object.assign({},t),this.Sg(!1)},shouldHandle:()=>this.uc!==!0}))}fc(r){for(let e in this.Vr){let t=this.Vr[e],n=t[0](r);if(t[1]&&(n=!n),!n)return!1}return!0}addDragFilter(r,e,t){if(r&&rn(r)){r.Ao=e||G();let n=r.Ao;this.Vr[n]=[r,t!==!1]}}removeFilter(r){let e=typeof r=="function"?r.Ao:r;delete this.Vr[e]}addSelectorFilter(r,e){this.addDragFilter(t=>{let n=t.srcElement||t.target;return $t(n,r,this.ui.getContainer())},r,e)}addClassnameFilter(r,e){r&&(r=Array.isArray(r)?r:[r],r.forEach(t=>{t.split(",").map(vt).forEach(o=>{let s=a=>{let l=a.srcElement||a.target;return un(l,o)};s.iA=o,this.addDragFilter(s,t,e)})}))}oA(r){for(let e in this.Vr)if(this.Vr[e].iA===r){delete this.Vr[r];return}}removeClassnameFilter(r){r&&(r=Array.isArray(r)?r:[r],r.forEach(e=>{e.split(",").map(vt).forEach(n=>{this.oA(n)})}))}clearAllFilters(){this.Vr={}}Q(){this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer(),this.he&&this.he.cleanup(),this.he=null,this.mc=!1,this.activeGrid=null,this.downAt=null,this.newPosition=null,this.viewportPositionAtDown=null,F(document.body,mt),F(this.ui.rootElement,wf),this.xo||(F(this.ui.rootElement,mh),F(this.ui.rootElement,fr),F(this.ui.rootElement,yr)),this._!=null&&F(this._.el,Df),this.u!=null&&(Array.from(this.draggableInstance.getContainer().querySelectorAll(qG)).forEach(r=>{F(r,dh)}),L(this.u.el,dh),F(this.u.el,ch),this.be.forEach(r=>{F(r.managedElement.el,ch),L(r.managedElement.el,dh)})),this.currentState="idle",this.u=null,this._=null,this.Tg(),this.la.forEach(r=>{this.vg(r.managedElement,fr,Gf,mh)}),this.la.length=0,this.bo.clear(),this.be.clear(),this.Zt=null}Tg(){this.Ct.forEach(r=>{this.vg(r.managedElement,yr)}),this.Ct.length=0}sA(r,e){let t=this.ui.$getManagedElement(r.id);for(;t!=null;){if(this.Cg(t,e))return t;t.modelObject.group?t=this.ui.$getManagedElement(r.group.id):t=null}return null}aA(r){r=r||0;let e=-r*Math.PI/180;return{cos:Math.cos(e),sin:Math.sin(e)}}tA(r){if(r.e.lA==!0||r.e.which===3||r.e.button===2)return!1;if(this.currentState==="idle"){if(this.R&&this.R.reset(),this.ha=null,!this.draggableInstance.$canStartElementDrag())return!1;if(r.el.getAttribute(Er)!==ct)if(this.fc(r.e)&&JG(r.e,this.ui.getContainer(),this.inputFilterSelector)){let t=null,n=Bt(r.el,Ae(gt),this.ui.getContainer(),!0);if(n!=null&&(t=this.ui.getModelObjectFromElement(n,!1,!1)),t!=null&&!nt(t.obj)&&!j(t.obj))if(this.draggableInstance.isDraggable(n)){if(this.be.clear(),this.gc=!0,r.e.lA=!0,this.u=this.sA(t.obj,r.e),this.u==null)return r.e.ex=!0,!1;this.aa=!1,this.xe={isGroupElement:!1,contentArea:null,pageOrigin:{x:0,y:0},internalOffset:{x:0,y:0}},this.O={x:0,y:0},this.uc=r.e.shiftKey;let o=this.u.modelObject.group==null,s=!1;if(o)this._=null,this.Mr=null;else{if(this._=this.ui.$getManagedElement(this.u.modelObject.group.id),this.Mr=this.ui.getGroupDefinition(this._.modelObject),this.Mr.elementsDraggable===!1)return!1;s=this.Mr.elastic===!0&&r.e.shiftKey!==!0,this.mc=r.e.shiftKey===!0,this.xe=this.ui.$_getGroupContentAreaInfo(this._.id),L(this._.el,Df),this.gc=this.ui.$canDrop(this.u.modelObject,null,!0),s||(F(this.ui.rootElement,fr),L(this.ui.rootElement,mh)),this.ha=this.aA(this._.r)}this.xo=o||s,this.xo||L(this.ui.rootElement,fr),o||!s?this.ui.model.getGroups().forEach(l=>{if(l.id!==this.u.id&&!ke(l,this.u.modelObject)){let h=this.ui.getGroupDefinition(l),d=l===this.u.modelObject.group,u=d||(this.ui.$canDrop(this.u.modelObject,l,!1)==!1?!1:h.canDrop?h.canDrop(this.u.modelObject):!0),p=this.ui.viewport.getGroupElement(l.id),g=this.ui.$_getGroupContentAreaInfo(l.id),E=-(p.r||0)*Math.PI/180,y={droppable:u,managedElement:p,depth:Dc(l),contentAreaInfo:g,contentArea:p.contentArea,contentBox:{x:p.x+g.internalOffset.x,y:p.y+g.internalOffset.y,width:p.width-g.internalOffset.x,height:p.height-g.internalOffset.y,r:p.r},isCurrentGroup:d,group:l,id:l.id,rotation:p.r||0,rotationMatrix:{cos:Math.cos(E),sin:Math.sin(E)}};this.la.push(y),u?(d||this.Qn(p,fr),d&&this.Qn(p,Gf)):this.Qn(p,mh)}}):s&&(this.he=new Ca(this.ui,this.u.modelObject,this.u.modelObject.group,this.Mr)),this.viewportPositionAtDown={x:Math.floor(this.u.x*100)/100,y:Math.floor(this.u.y*100)/100},this.hA(),this.activeGrid=this.resolveGrid(),this.downAt=Object.assign({},r.pagePosition),this.pc=this.draggableInstance.getZoom(),this.yo=this.draggableInstance.getEffectiveVisibleZoom(),L(document.body,mt),L(this.ui.rootElement,wf),L(this.u.el,ch),this.currentState="dragging",this.R&&this.R.observe(this.u.el),this.Zt=this.dn[this.u.modelObject.id],this.Zt&&!QG(this.Zt,this.u.modelObject.id)&&(this.Zt=null);let a={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,pos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},element:this.u}],ui:this.ui};if(this.bo.clear(),this.be.set(this.u.modelObject.id,{modelObject:this.u.modelObject,managedElement:this.u,offset:{x:0,y:0},size:Jn(this.u),originalPosition:ft(this.u),position:ft(this.u),parentGroup:this.u.modelObject.group?this.ui.viewport.getGroupElement(this.u.modelObject.group.id):null}),this.Zt!=null){let l=(Y(this.u.modelObject)?Ps(this.u.modelObject):[]).map(d=>d.id),h=Sn(this.u.modelObject).map(d=>d.id);Array.from(this.Zt.members).filter(d=>l.indexOf(d.el.id)===-1&&h.indexOf(d.el.id)===-1).forEach(d=>{let u={x:d.el.x,y:d.el.y},p=d.el.modelObject;this.be.set(d.el.id,{modelObject:p,managedElement:d.el,offset:{x:d.el.x-this.u.x,y:d.el.y-this.u.y},size:Jn(d.el),originalPosition:ft(d.el),position:ft(d.el),parentGroup:p.group?this.ui.viewport.getGroupElement(p.group.id):null}),this.R&&this.R.observe(d.el.el),a.dragGroup.push({el:d.el.el,vertex:d.el.modelObject,pos:{x:u.x,y:u.y},element:d.el}),L(d.el.el,ch),this.ui.toFront(d.el.el,!0)})}return this.ui.toFront(this.u.el,!0),this.ui.magnetizerProfile.constant&&this.ui.$startMagnetizer(),this.ui.$startMotion(),this.ui.fire(Vs,a),!0}else return!1;else return!1}else return!1;else return!1}}Zl(){this.draggableInstance.$stopPanRepeat(),this.u!=null&&this.R!=null&&(this.R.unobserve(this.u.el),this.be&&this.be.forEach(r=>{this.R.unobserve(r.managedElement.el)}))}Qn(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>L(t,n))}vg(r,...e){let t=this.ui.containerType==="SVG"?r.el:r.contentArea;e.forEach(n=>F(t,n))}nA(r){var e;if(this.Zl(),this.u!=null&&this.newPosition!=null){this.cA(),this.ui.magnetizerProfile.constant&&this.ui.$stopMagnetizer();let t=new Set,n={},o=null,s=this._!=null,a=!1,l=[],h={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y},d=Object.assign({},h);if(this.Ct.length>0&&(o=this.Ct[0],t.add(o.group),s&&(this._.id!==o.id?t.add(this._.modelObject):this.mc&&t.delete(o.group))),o==null){if(!this.gc)return this.Pg();this._!=null&&this.he==null&&(d.x+=this._.x+this.xe.internalOffset.x,d.y+=this._.y+this.xe.internalOffset.y,d=Me(d,this._.c,this._.r)),n[this.u.id]={x:d.x,y:d.y},Array.from(this.be.values()).forEach(p=>{n[p.managedElement.id]={x:p.offset.x+d.x,y:p.offset.y+d.y}})}else{if(!o.droppable)return this.Pg();let p=this.ui.$_getGroupContentAreaInfo(o.id);if(this._!=null)if(this._.id===o.id)n[this.u.id]={x:d.x,y:d.y};else{let g=d.x+(this._.x+this.xe.internalOffset.x),m=d.y+(this._.y+this.xe.internalOffset.y);d.x=g-(o.managedElement.x+p.internalOffset.x),d.y=m-(o.managedElement.y+p.internalOffset.y),n[this.u.id]={x:d.x,y:d.y}}else d=this.dA(this.u,o.managedElement,p),n[this.u.id]={x:d.x,y:d.y};if(l.push({vertex:this.u.modelObject,originalParent:(e=this._)==null?void 0:e.modelObject,originalPosition:this.relativePositionAtDown,positionInGroup:d}),this.Zt!=null){let g=this.uA(d,o.managedElement,p);for(let m in g.current){let E={x:Math.floor(g.current[m].x),y:Math.floor(g.current[m].y)};n[m]=E;let y=this.be.get(m),x=y.managedElement.modelObject;l.push({vertex:x,originalPosition:y.originalPosition,positionInGroup:E,originalParent:x.group})}}}if(a||this.bo.forEach((p,g)=>{n[g]=p.current}),this.ui.magnetizerProfile.afterDrag&&!a){let p=this.ui.$provisionallyMagnetize(this.u.modelObject,this.ui.magnetizerProfile.repositionDraggedElement===!0,n,null,!1,!1);for(let g in p.current)n[g]=p.current[g]}this.ui.model.transaction(()=>{if(a)this.be.forEach((p,g)=>{this.ui.$setViewportElementPosition(p.managedElement,p.originalPosition)});else{let p={},g={};if(o==null)if(this.he==null)Array.from(this.be.values()).forEach(m=>{m.parentGroup!=null&&(t.add(m.parentGroup.modelObject),this.ui.model.$removeFromGroup(m.modelObject,null,{x:this.relativePositionAtDown.x+m.offset.x,y:this.relativePositionAtDown.y+m.offset.y},m.position,this.ui))});else{let{movedElements:m,resizedGroups:E}=this.he.hh();Object.assign(g,E);for(let y in m)n[y]=m[y].current,p[y]=m[y].current}else l.forEach(m=>{this.ui.model.$addToGroup(m.vertex,o.group,m.originalParent,m.originalPosition,m.positionInGroup,this.ui)});for(let m in n){let E={[this.ui.$modelLeftAttribute]:n[m].x,[this.ui.$modelTopAttribute]:n[m].y};g[m]!=null&&(E[this.ui.$modelWidthAttribute]=g[m].newGroupSize.width,E[this.ui.$modelHeightAttribute]=g[m].newGroupSize.height),this.ui.model.$_updateVertex(m,E,Hs,!1)}this.ui.$_sizeGroupsToFit(t,null,null,!1),this.ui.$trackGroupSizeChanges(g)}});let u={dragGroup:[{vertex:this.u.modelObject,el:this.u.el,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:d.x,y:d.y},element:this.u}],ui:this.ui};Array.from(this.be.values()).forEach(p=>{if(p.managedElement.id!==this.u.id){let g=p.managedElement;u.dragGroup.push({pos:p.position,originalPos:p.originalPosition,el:g.el,vertex:p.modelObject,element:g})}}),this.ui.$stopMotion(),this.ui.fire(Vt,u)}this.Q()}dA(r,e,t){let n=Me(Me(r,r.c,r.r+e.r),e.c,-e.r);return{x:n.x-(e.x+t.internalOffset.x),y:n.y-(e.y+t.internalOffset.y)}}uA(r,e,t){let n=[this.u.modelObject],o={[this.u.id]:r};this.Zt.members.forEach(h=>{h.el.id!==this.u.id&&(o[h.el.id]=this.be.get(h.el.id).position,n.push(h.el.modelObject))});let s=h=>o[h.id],a=h=>this.be.get(h.id).size;return new Li({positionSetter:(h,d)=>o[h.id]=d,positionGetter:s,getId:h=>h.id,elements:n,getSize:a}).executeWithFocus(this.u.id,{gather:!0})}Pg(){this.ui.$stopMotion(),Array.from(this.be.values()).forEach(r=>{this.ui.viewport.updateElement(r.managedElement.id,r.originalPosition.x,r.originalPosition.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(r.managedElement,!0)}),this.bo.forEach((r,e)=>{let t=this.ui.$getManagedElement(e);this.ui.viewport.updateElement(e,r.original.x,r.original.y,null,null,null,null,null),this.ui.$syncManagedElementWithView(t,!0)}),this.ui.fire(sd),this.Q()}pA(r){return this._==null||r.id===this._.id}Sg(r){if(this.newPosition!=null){let e={x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y};this.Tg();let t={x:e.x+this.xe.pageOrigin.x,y:e.y+this.xe.pageOrigin.y,width:this.u.width,height:this.u.height,r:this.u.r};if(this.la.forEach(l=>{Nx(l.contentBox,t)&&this.Ct.push(l)}),this.Ct.length>0){this.Ct.sort((h,d)=>h.depth>d.depth?-1:1),this.yc(this.Ct[0].managedElement,!0);let l=!this.pA(this.Ct[0].managedElement);(this._==null||this.aa||l)&&this.Qn(this.Ct[0].managedElement,yr),this._!=null&&!l&&(this.aa=!0,this.Qn(this._,fr)),this.xo||F(this.ui.rootElement,yr)}else this.yc(this._,!1),this._!=null&&!this.Mr.elastic&&(this.aa=!0,this.Qn(this._,fr)),this.xo||L(this.ui.rootElement,yr);let n={},o=[{id:this.u.id,x:e.x,y:e.y}];n[this.u.id]=e;let s={dragGroup:[{vertex:this.u.modelObject,originalPos:{x:this.viewportPositionAtDown.x,y:this.viewportPositionAtDown.y},pos:{x:e.x,y:e.y},element:this.u}],positions:n,ui:this.ui};if(Array.from(this.be.values()).forEach(l=>{if(l.managedElement.id!==this.u.id){let h=l.originalPosition,d={x:e.x+l.offset.x,y:e.y+l.offset.y};this.activeGrid!=null&&(d=he(d,this.activeGrid)),l.position=d,o.push({id:l.managedElement.id,x:d.x,y:d.y}),n[l.managedElement.id]=d,s.dragGroup.push({pos:{x:d.x,y:d.y},originalPos:{x:h.x,y:h.y},vertex:l.managedElement.modelObject,element:l.managedElement})}else l.position={x:e.x,y:e.y}}),this.ui.magnetizerProfile.constant){let l=this.ui.$provisionallyMagnetize(this.u.modelObject,!1,{[this.u.id]:{x:this.newPosition.x-this.O.x,y:this.newPosition.y-this.O.y}},null,!0,r);for(let h in l.current)n[h]=l.current[h],this.bo.set(h,{current:l.current[h],original:l.original[h]}),s.dragGroup.push({vertex:this.ui.model.getVertex(h),originalPos:l.original[h],pos:l.current[h],element:this.ui.getElement(h)})}let a=this.ui.$_updateVertexPositions({positions:n,sizes:null,offset:this.xe.pageOrigin,repaintConnections:!0,storePositionsInModel:!1,resizedGroups:null,writeSizesToElements:!1,rotations:null,writeRotationsToElements:!1});return this.ui.fire(Mt,s),{redrawResult:a,positions:n}}}Og(r,e,t){if(e==null)this.ui.$setVisibleElementRotation(r,r.r);else{let n=0;t?n=r.modelObject.group===e.modelObject?0:e.r:n=r.modelObject.group===e.modelObject?-e.r:0,this.ui.$setVisibleElementRotation(r,r.r+n)}}yc(r,e){this.u!=null&&(this.Og(this.u,r,e),Array.from(this.be.values()).forEach(t=>{t.managedElement.id!==this.u.id&&this.Og(t.managedElement,r,e)}))}cA(){this.yc(null,!0)}mA(r,e){if(this.ha==null)return{x:r,y:e};let{cos:t,sin:n}=this.ha;return{x:r*t-e*n,y:r*n+e*t}}rA(r){if(this.currentState==="dragging"){oe(r.e),this.uc=r.e.shiftKey;let e=Object.assign({},r.pagePosition),t=(e.x-this.downAt.x)/this.yo,n=(e.y-this.downAt.y)/this.yo,o=this.mA(t,n);t=o.x,n=o.y;let s={x:this.viewportPositionAtDown.x+t,y:this.viewportPositionAtDown.y+n};this._!=null&&(s.x-=this.xe.pageOrigin.x,s.y-=this.xe.pageOrigin.y,!this.Mr.elastic&&this.Mr.constrain&&(s.x+this.u.width>this._.width-this.xe.internalOffset.x&&(s.x=this._.width-this.u.width-this.xe.internalOffset.x),s.y+this.u.height>this._.height-this.xe.internalOffset.y&&(s.y=this._.height-this.u.height-this.xe.internalOffset.y),s.x<0&&(s.x=0),s.y<0&&(s.y=0))),this.activeGrid!=null&&(s=he(s,this.activeGrid)),this.draggableInstance.dragOptions.constrainFunction&&(s=this.draggableInstance.dragOptions.constrainFunction(s,r.el,this.u.modelObject,r.size,this.newPosition||this.viewportPositionAtDown,r.e)),this.newPosition=s;let a=this.Sg(r.e.shiftKey);if(this.R!=null&&this.u!=null){let l=this.u.el.getBoundingClientRect();this.R.updateDragElementPosition(l)}return this.he!=null&&this.he.focusVertex.id===this.u.id&&this.gA(r.e,a.positions[this.u.id]),a.redrawResult}else return null}hA(){let r=this._?this._.x+this.xe.internalOffset.x:0,e=this._?this._.y+this.xe.internalOffset.y:0;this.relativePositionAtDown={x:this.viewportPositionAtDown.x-r,y:this.viewportPositionAtDown.y-e}}_g(r,...e){let t=[],n=ww(r),o=this.Ec[n.id];if(o==null)o={id:n.id,members:new Set},this.Ec[n.id]=o,t.push(...e);else{let s=Array.from(o.members.values());e.forEach(a=>{let l=s.find(h=>h.el.id===a.id);(l==null||l.membership!==Ma)&&t.push(a)})}this.removeFromDragGroup(...t),t.forEach(s=>{this.Cg(s,null)&&(o.members.add({el:s,active:n.active!==!1,membership:n.membership}),this.dn[s.id]=o)})}removeFromDragGroup(...r){r.forEach(e=>{let t=this.dn[e.id];if(t!=null){let n=new Set;t.members.forEach(o=>{o.el!==e&&n.add(o)}),t.members=n,delete this.dn[e.id]}})}$setDragGroupState(r,...e){e.forEach(t=>{let n=this.dn[t.id];if(n!=null){let o=em(n.members,s=>s.el.id===t.id);o!=null&&(o.active=r)}})}$clearDragGroup(r){let e=this.Ec[r];e!=null&&(e.members.forEach(t=>{delete this.dn[t.el.id]}),e.members.clear())}$resolveDragGroup(r){return this.dn[r]}gA(r,e){this.he!=null&&e!=null&&this.he.setFocusPosition(e,!0,r)}Cg(r,e){for(let t=0;t<this.dc.length;t++)if(!this.dc[t]({el:r.el,vertex:r.modelObject,e}))return!1;return!0}$addVertexDragFilter(r){this.dc.push(r)}$destroy(){this.R&&this.R.disconnect()}};var ir=i=>i.map(r=>String.fromCharCode(r)).join(""),t$=new Date().getFullYear(),r$=ir([67,111,112,121,114,105,103,104,116,32])+t$+ir([32,74,83,80,76,85,77,66,32,80,84,89,32,76,84,68]),LP=ir([104,116,116,112,115,58,47,47,118,105,115,117,97,108,108,121,106,115,46,99,111,109]),Dw=new Array(50).fill("-").join(""),n$=ir([86,105,115,117,97,108,108,121,74,115,32])+Hm,i$=ir([86,105,115,117,97,108,108,121,74,115,32,105,115,32,102,114,101,101,32,116,111,32,117,115,101,32,102,111,114,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,112,117,114,112,111,115,101,115,46,32,65,108,108,32,99,111,109,109,101,114,99,105,97,108,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,32,114,101,113,117,105,114,101,32,116,104,101,32,112,117,114,99,104,97,115,101,32,111,102,32,97,32,108,105,99,101,110,115,101,46]),o$=ir([70,111,114,32,97,32,100,101,102,105,110,105,116,105,111,110,32,111,102,32,34,99,111,109,109,101,114,99,105,97,108,34,44,32,34,110,111,110,45,99,111,109,109,101,114,99,105,97,108,34,32,97,110,100,32,34,101,118,97,108,117,97,116,105,111,110,34,32,112,108,101,97,115,101,32,115,101,101,32,116,104,101,32,108,105,99,101,110,115,101,32,97,103,114,101,101,109,101,110,116,32,111,110,32,111,117,114,32,115,105,116,101,46]),s$=ir([84,104,105,115,32,99,111,110,115,111,108,101,32,98,97,110,110,101,114,32,97,110,100,32,116,104,101,32,86,105,115,117,97,108,108,121,74,115,32,119,97,116,101,114,109,97,114,107,32,97,114,101,32,114,101,113,117,105,114,101,100,32,116,111,32,98,101,32,105,110,99,108,117,100,101,100,32,111,110,32,97,108,108,32,110,111,110,45,99,111,109,109,101,114,99,105,97,108,32,97,110,100,32,101,118,97,108,117,97,116,105,111,110,32,117,115,97,103,101,115,32,111,102,32,86,105,115,117,97,108,108,121,74,115,46]),Va=ir([10,10]),Nw=Dw+Va+n$+Va+r$+Va+LP+Va+i$+Va+o$+Va+s$+Va+Dw,Iw=ir([86,105,115,117,97,108,108,121,74,115,32,45,32,98,117,105,108,100,32,112,114,111,102,101,115,115,105,111,110,97,108,32,102,108,111,119,99,104,97,114,116,115,44,32,100,105,97,103,114,97,109,115,44,32,99,104,97,114,116,115,32,97,110,100,32,114,105,99,104,32,110,111,100,101,32,98,97,115,101,100,32,85,73,115,32,119,105,116,104,32,65,110,103,117,108,97,114,44,32,82,101,97,99,116,44,32,86,117,101,44,32,83,118,101,108,116,101,44,32,74,97,118,97,115,99,114,105,112,116,32,97,110,100,32,84,121,112,101,115,99,114,105,112,116,32,105,110,32,114,101,99,111,114,100,32,116,105,109,101,46]),a$=ir([60,115,118,103,32,118,105,101,119,66,111,120,61,34,51,48,32,50,48,32,49,53,48,32,52,53,34,32,119,105,100,116,104,61,34,49,48,48,34,32,104,101,105,103,104,116,61,34,51,55,46,53,34,62]),l$=ir([60,103,32,102,105,108,108,61,34,35,51,48,55,53,57,49,34,62]),h$=["m 43.96,33.76 q 0.12,-0.32 0.48,-0.32 h 2.24 q 0.44,0 0.32,0.44 l -5.88,17.8 Q 41,52 40.6,52 H 37.52 Q 37.12,52 37,51.68 l -5.88,-17.8 -0.04,-0.16 q 0,-0.28 0.36,-0.28 h 2.24 q 0.36,0 0.48,0.32 l 4.76,14.76 q 0.04,0.12 0.12,0.12 0.12,0 0.16,-0.12 z","m 52.606875,29.12 q -0.88,0 -1.56,-0.64 -0.64,-0.68 -0.64,-1.56 0,-0.88 0.64,-1.52 0.68,-0.64 1.56,-0.64 0.84,0 1.48,0.64 0.64,0.64 0.64,1.52 0,0.88 -0.64,1.56 -0.64,0.64 -1.48,0.64 z m -1.12,22.88 q -0.4,0 -0.4,-0.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 z","m 65.03125,52.44 q -2.36,0 -4,-1.2 -1.6,-1.2 -2.24,-3.2 l -0.04,-0.16 q 0,-0.24 0.28,-0.32 l 1.92,-0.68 0.16,-0.04 q 0.24,0 0.36,0.32 0.36,1.28 1.36,2 1.04,0.72 2.2,0.72 1.68,0 2.56,-0.8 0.88,-0.84 0.88,-2.12 0,-1.28 -0.88,-2 -0.84,-0.72 -2.36,-1 l -1.6,-0.32 q -2.04,-0.4 -3.24,-1.8 -1.2,-1.44 -1.2,-3.44 0,-1.48 0.76,-2.72 0.76,-1.24 2.12,-1.92 1.4,-0.72 3.12,-0.72 2.2,0 3.72,1.16 1.56,1.12 2.16,3.24 l 0.04,0.16 q 0,0.24 -0.32,0.36 l -1.88,0.48 -0.16,0.04 q -0.24,0 -0.32,-0.32 -0.32,-1.2 -1.16,-1.88 -0.8,-0.68 -2.08,-0.68 -1.4,0 -2.28,0.76 -0.84,0.76 -0.84,1.92 0,1.2 0.68,1.84 0.68,0.64 2.04,0.92 l 1.56,0.32 q 2.24,0.44 3.6,1.88 1.4,1.4 1.4,3.72 0,2.4 -1.72,3.96 -1.68,1.52 -4.6,1.52 z","m 87.125,33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 51.6 q 0,0.4 -0.4,0.4 h -1.92 q -0.4,0 -0.4,-0.4 v -1.32 q 0,-0.16 -0.12,-0.2 -0.08,-0.04 -0.24,0.12 -1.88,2.2 -4.84,2.2 -2.96,0 -4.6,-1.72 -1.6,-1.72 -1.6,-4.4 V 33.84 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 V 45.8 q 0,1.96 1,3 1,1 2.88,1 1.32,0 2.4,-0.68 1.08,-0.68 1.8,-1.96 0.2,-0.4 0.2,-0.84 z","m 103.88688,52.4 q -2.56,0 -4.640005,-1.2 -2.08,-1.24 -3.28,-3.44 -1.2,-2.2 -1.2,-5.04 0,-2.84 1.2,-5.04 1.2,-2.2 3.28,-3.4 2.080005,-1.24 4.640005,-1.24 3.92,0 6.03999,2.48 0.08,0.08 0.16,0.04 0.08,-0.04 0.08,-0.16 v -1.56 q 0,-0.4 0.39999,-0.4 h 1.96001 q 0.39999,0 0.39999,0.4 V 51.6 q 0,0.4 -0.39999,0.4 h -1.96001 q -0.39999,0 -0.39999,-0.4 v -1.56 q 0,-0.12 -0.08,-0.16 -0.08,-0.04 -0.16,0.04 -2.47999,2.48 -6.03999,2.48 z m 0.44,-2.64 q 1.87999,0 3.36,-0.8 1.48,-0.8 2.15999,-2.16 0.16001,-0.32 0.16001,-0.72 v -6.72 q 0,-0.4 -0.16001,-0.72 -0.76,-1.36 -2.23999,-2.16 -1.44,-0.8 -3.28,-0.8 -2.96001,0 -4.800005,1.96 -1.8,1.92 -1.8,5.08 0,3.16 1.8,5.12 1.839995,1.92 4.800005,1.92 z","m 123.61562,49.56 q 0.40001,0 0.40001,0.4 v 1.8 q 0,0.4 -0.40001,0.4 h -0.72 q -1.87999,0 -2.92,-0.88 -1.03999,-0.92 -1.03999,-2.8 V 23.44 q 0,-0.4 0.39999,-0.4 h 2.12 q 0.40001,0 0.40001,0.4 v 24.68 q 0,1.44 1.19999,1.44 z","m 133.14687,49.56 q 0.4,0 0.4,0.4 v 1.8 q 0,0.4 -0.4,0.4 h -0.72 q -1.88,0 -2.92,-0.88 -1.04,-0.92 -1.04,-2.8 V 23.44 q 0,-0.4 0.4,-0.4 h 2.12 q 0.4,0 0.4,0.4 v 24.68 q 0,1.44 1.2,1.44 z","m 148.72562,33.76 q 0.12,-0.32 0.52,-0.32 h 2.2 q 0.48,0 0.36,0.44 l -9.32,25.68 q -0.12,0.32 -0.48,0.32 h -2.16 q -0.52,0 -0.36,-0.52 l 2.64001,-7.32 q 0.08,-0.16 0.08,-0.44 0,-0.24 -0.08,-0.4 l -6.40001,-17.28 -0.04,-0.16 q 0,-0.32 0.36,-0.32 h 2.28 q 0.36,0 0.48,0.32 l 4.72,13.56 q 0.12,0.24 0.24,0.24 0.2,0 0.24,-0.24 z"],c$=l$+'<path d="'+h$.join('"/><path d="')+'"/></g>',d$=ir([60,103,32,102,105,108,108,61,34,35,97,52,52,48,52,102,34,62]),u$=["m 159.312,61.368 c -0.448,0 -0.88533,-0.04267 -1.312,-0.128 -0.29867,-0.064 -0.43733,-0.213333 -0.416,-0.448 l 0.192,-1.44 c 0.0213,-0.213333 0.13867,-0.288 0.352,-0.224 0.384,0.106667 0.69333,0.16 0.928,0.16 0.46933,0 0.81067,-0.16 1.024,-0.48 0.23467,-0.32 0.352,-0.736 0.352,-1.248 V 40.472 c 0,-0.213333 0.10667,-0.32 0.32,-0.32 h 1.696 c 0.21333,0 0.32,0.106667 0.32,0.32 v 17.056 c 0,1.216 -0.32,2.154667 -0.96,2.816 -0.61867,0.682667 -1.45067,1.024 -2.496,1.024 z","m 171.5875,55.352 q -1.888,0 -3.2,-0.96 -1.28,-0.96 -1.792,-2.56 l -0.032,-0.128 q 0,-0.192 0.224,-0.256 l 1.536,-0.544 0.128,-0.032 q 0.192,0 0.288,0.256 0.288,1.024 1.088,1.6 0.832,0.576 1.76,0.576 1.344,0 2.048,-0.64 0.704,-0.672 0.704,-1.696 0,-1.024 -0.704,-1.6 -0.672,-0.576 -1.888,-0.8 l -1.28,-0.256 q -1.632,-0.32 -2.592,-1.44 -0.96,-1.152 -0.96,-2.752 0,-1.184 0.608,-2.176 0.608,-0.992 1.696,-1.536 1.12,-0.576 2.496,-0.576 1.76,0 2.976,0.928 1.248,0.896 1.728,2.592 l 0.032,0.128 q 0,0.192 -0.256,0.288 l -1.504,0.384 -0.128,0.032 q -0.192,0 -0.256,-0.256 -0.256,-0.96 -0.928,-1.504 -0.64,-0.544 -1.664,-0.544 -1.12,0 -1.824,0.608 -0.672,0.608 -0.672,1.536 0,0.96 0.544,1.472 0.544,0.512 1.632,0.736 l 1.248,0.256 q 1.792,0.352 2.88,1.504 1.12,1.12 1.12,2.976 0,1.92 -1.376,3.168 -1.344,1.216 -3.68,1.216 z"],p$=d$+'<path d="'+u$.join('"/><path d="')+'"/></g>',Mw=a$+c$+"<g>"+ir([60,99,105,114,99,108,101,32,99,120,61,34,49,53,52,34,32,99,121,61,34,54,48,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,114,61,34,49,46,53,34,32,102,105,108,108,61,34,119,104,105,116,101,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,47,62])+p$+ir([60,99,105,114,99,108,101,32,99,120,61,34,49,54,49,46,53,48,49,53,55,34,32,99,121,61,34,51,54,46,50,53,56,53,52,57,34,32,115,116,114,111,107,101,61,34,35,98,55,98,55,98,55,34,32,102,105,108,108,61,34,35,102,102,102,102,102,102,34,32,115,116,114,111,107,101,45,119,105,100,116,104,61,34,49,34,32,114,61,34,49,46,53,34,32,47,62,60,47,103,62,60,47,115,118,103,62]),g$=ir([60,97,32,104,114,101,102,61,34])+LP+ir([34,32,116,97,114,103,101,116,61,34,95,98,108,97,110,107,34,32,116,105,116,108,101,61,34])+Iw+'">'+Mw+"</a>",wP=null;function ug(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let a=function(){l.disconnect(),ug(i,!0,s)};r||console.log(Nw),wP&&window.clearInterval(wP),e&&e.parentNode&&e.parentNode.removeChild(e);let t=["right","left"][Math.floor(Math.random()*2)],n=["top","bottom"][Math.floor(Math.random()*2)],s=new DOMParser().parseFromString(g$,"text/html").body.childNodes[0];s.style.position="absolute",s.style[t]="1rem",s.style[n]="1rem",s.style.zIndex="0",s.style.opacity="0.8",s.setAttribute("href",LP),s.setAttribute("target","_blank"),s.setAttribute("title",Iw),i.appendChild(s);let l=new MutationObserver((h,d)=>{a()});l.observe(s,{attributes:!0,subtree:!0,childList:!0}),wP=window.setInterval(()=>a(),25e3)}}var DP=null;function NP(i,r,e){if(typeof console!="undefined"&&typeof window!="undefined"){let u=function(){p.disconnect(),NP(i,!0,n)};r||console.log(Nw),DP&&window.clearInterval(DP),e&&e.parentNode&&e.parentNode.removeChild(e);let n=new DOMParser().parseFromString(Mw,"text/html").body.childNodes[0];i.appendChild(n);let o=parseInt(i.getAttribute("width"),10),s=parseInt(i.getAttribute("height"),10),a=n.getBBox(),l=a.height/a.width,h=parseInt(n.getAttribute("width"),10),d=l*h;n.setAttribute("transform",`translate(${o-h-10}, ${s-d-10})`);let p=new MutationObserver((g,m)=>{u()});p.observe(n,{attributes:!0,subtree:!0,childList:!0}),DP=window.setInterval(()=>u(),25e3)}}var IP="vjs-orthogonal-handle",pg="vjs-orthogonal-segment-drag",MP="vjs-orthogonal-segment-drag-ns",VP="vjs-orthogonal-segment-drag-ew";var m$=10,E$=20,ao=class extends no{constructor(e,t){super(e,t);c(this,"segments");c(this,"segmentHandles");c(this,"geometry");c(this,"$supportsHoverMode",!0);this.segments=[],this.segmentHandles=[],this.$addDragHandler({selector:"."+pg+" *",target:"."+pg,drag:n=>{let o=n.el.Jt,s={x:Math.floor(n.translatedPosition.x),y:Math.floor(n.translatedPosition.y)},a=_S(this.current,this.currentConnector,o.segment,s);a!=null&&(o.connection.connector.geometry.segments=a.segments,o.connection.connector.edited=!0,this.$hasEdits=!0,this.segments.length=0,this.geometry.segments=a.segments,Array.prototype.push.apply(this.segments,this.geometry.segments),o.segment=this.geometry.segments[a.index],this.$repaintConnection({segmentInfo:o,segmentIndex:a.index}))},constrainFunction:function(n,o,s,a,l,h){let d=o.Jt,u=d.segment.x1===d.segment.x2,p={x:n.x,y:n.y};return u?p.y=(d.segment.y1+d.segment.y2)/2-a.height/2:p.x=(d.segment.x1+d.segment.x2)/2-a.width/2,p},stop:n=>{this.Rg(!0),this.$updateModel(ln(n.el.Jt.connection.connector),this.$generatedGeometry)},start:n=>{this.$generatedGeometry=ln(n.el.Jt.connection.connector)}})}Lg(e,t){e.el.style.visibility="visible";let n=this.ui.$getSize(e.el.childNodes[0]),o=t[0]-n.width/2,s=t[1]-n.height/2;Ie(e.el,{x:o,y:s})}$repaint(e){this.Tn(e);for(let t=0;t<this.segmentHandles.length;t++)if(this.segmentHandles[t].segment=this.geometry.segments[t+1],ea(this.segmentHandles[t].segment)>0){let n=[(this.segmentHandles[t].segment.x1+this.segmentHandles[t].segment.x2)/2,(this.segmentHandles[t].segment.y1+this.segmentHandles[t].segment.y2)/2];this.Lg(this.segmentHandles[t],n)}else this.segmentHandles[t].el.style.visibility="hidden"}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].el!==e&&this.ui.$removeElement(this.segmentHandles[t].el)}$activate(e,t){this.$hasEdits=!1,this.Tn(),this.currentConnector.edited=!0}$elementDragged(e){this.Rg(!0)}$elementDragging(e){this.$repaint()}Tn(e){e=e||{};let t=e.segmentInfo,n=e.segmentIndex;if(this.geometry=lt(this.current.connector.geometry),this.geometry&&this.geometry.segments){this.$clearHandles(t?t.el:null),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let o=1;o<this.segments.length-1;o++)if(t==null||o!==n){let s=[(this.segments[o].x1+this.segments[o].x2)/2,(this.segments[o].y1+this.segments[o].y2)/2],a=s[0],l=s[1],h=this.segments[o].o===Vc,d=this.$makeOrthogonalHandle(h,a,l,E$,m$,[Un,IP,pg,h?VP:MP].join(" "),!0),u={el:d,segment:this.segments[o],vertical:h,edge:this.currentEdge,connection:this.current};d.Jt=u,this.segmentHandles.push(u),this.Lg(u,s)}else o===n&&this.segmentHandles.push(t)}}Rg(e){this.current&&this.$hasEdits&&(OS(this.currentConnector),e&&this.$repaintConnection())}$makeOrthogonalHandle(e,t,n,o,s,a,l){let h=e?s:o,d=e?o:s;return this.$makeAndAppendRectangularHandle(t,n,h,d,3,3,a,l)}};c(ao,"type",zi);Lr.set(ao.type,ao);function GP(){Lr.set(ao.type,ao)}var Jh="vjs-straight-handle",ms="vjs-straight-segment-drag",gg="vjs-straight-segment-split",mg="vjs-straight-segment-delete",$P="vjs-straight-editor-guideline";var Eg=class{constructor(r){this.editor=r;c(this,"splitListener");c(this,"deleteListener");this.splitListener=(e=>{let t=e.target.closest(z(gg)).Jt;this.editor.$split(t.index,t.midPoint)}).bind(this),this.deleteListener=(e=>{let t=e.target.closest(z(mg)).Jt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){this.editor.ui.on(this.editor.ui.getContainer(),W,z(gg),this.splitListener),this.editor.ui.on(this.editor.ui.getContainer(),W,z(mg),this.deleteListener)}$deactivate(r){this.editor.ui.off(this.editor.ui.getContainer(),W,this.splitListener),this.editor.ui.off(this.editor.ui.getContainer(),W,this.deleteListener)}$appendHandles(r){let e=r.segment,t={x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2},n={x:(e.x2+t.x)/2,y:(e.y2+t.y)/2},o=t,s=this.editor.$makeAndAppendCircularHandle(o.x,o.y,this.editor.buttonSize,this.editor.buttonSize,[Un,Jh,gg].join(" "),!0);s!=null&&r.buttons.push(s);let a=this.editor.segments.length>1?this.editor.$makeAndAppendDeleteHandle(n.x,n.y,this.editor.buttonSize,this.editor.buttonSize,[Un,Jh,mg].join(" "),!0):null;a!=null&&r.buttons.push(a)}$repaintEnded(){}$repaintStarted(){}};var Yy="vjs-straight-connector-edit",BP="click",f$="auto";var zy=class{constructor(r){this.editor=r;c(this,"xc");c(this,"bc");c(this,"$segmentToDrag");c(this,"$pageEvent");this.xc=(e=>{if(this.editor.current&&this.editor.current.id===e.obj.id){this.$pageEvent=e.e;let t=me(e.e),n=this.editor.ui.fromPageLocation(t.x,t.y);oe(e.e);let o=lS(e.connection.connector,n.x,n.y);this.$segmentToDrag=o.index+1,this.editor.$split(o.index,{x:o.x,y:o.y})}}).bind(this),this.bc=(e=>{let t=e.target.closest(z(ms)).Jt;t&&this.editor.$deleteSegment(t)}).bind(this)}$activate(r,e){Jr(r,Yy),this.editor.ui.bind(_l,this.xc),this.editor.ui.on(this.editor.ui.getContainer(),W,`${z(ms)} *`,this.bc)}$appendHandles(r){}$deactivate(r){this.editor.ui.unbind(_l,this.xc),this.editor.ui.off(this.editor.ui.getContainer(),W,this.bc),this.editor.current!=null&&_r(this.editor.current,Yy)}$repaintEnded(){if(this.$segmentToDrag!=null){let r=this.editor.segmentHandles[this.$segmentToDrag];this.editor.ui.trigger(r.el.childNodes[0],ge,this.$pageEvent)}this.$segmentToDrag=null,this.$pageEvent=null}$repaintStarted(){}};var lo=class extends no{constructor(e,t){super(e,t);c(this,"$mode");c(this,"$showGuidelines");c(this,"geometry");c(this,"segments",[]);c(this,"segmentHandles",[]);c(this,"guideLine");c(this,"$supportsHoverMode",!0);this.segments=[],this.$mode=t.splitMode===BP?new Eg(this):new zy(this),this.$showGuidelines=t.showGuidelines!==!1,this.$addDragHandler({selector:"."+ms+" *",target:"."+ms,drag:n=>{let o=n.el.Jt,s=n.translatedPosition.x-n.originalTranslatedPosition.x,a=n.translatedPosition.y-n.originalTranslatedPosition.y;o.focus.x1=o.originalLocation.x+s,o.focus.y1=o.originalLocation.y+a,this.currentConnector.geometry.segments[o.index]=o.focus,o.previous&&(o.previous.x2=o.focus.x1,o.previous.y2=o.focus.y1,this.currentConnector.geometry.segments[o.index-1]=o.previous),this.currentConnector.edited=!0,this.$repaintConnection()},constrainFunction:function(n,o,s,a,l,h){return n},stop:n=>{this.$updateModel(ln(this.currentConnector),this.$generatedGeometry)},start:n=>(this.$generatedGeometry=ln(this.currentConnector),!0)})}$split(e,t){let n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments,s=o[e],a={x1:s.x1,y1:s.y1,x2:t.x,y2:t.y};o[e].x1=t.x,o[e].y1=t.y,o.splice(e,0,a),this.currentConnector.edited=!0,this.$updateModel(ln(this.currentConnector),n)}$deleteSegment(e){let t=e.index,n=this.$cloneCurrentGeometry(),o=this.current.connector.geometry.segments;t===0?(o[1].x1=e.focus.x1,o[1].y1=e.focus.y1):t<o.length-1?(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2,o[t+1].x1=e.focus.x2,o[t+1].y1=e.focus.y2):t===o.length-1&&(o[t-1].x2=e.focus.x2,o[t-1].y2=e.focus.y2),o.splice(t,1),this.currentConnector.edited=!0,this.$updateModel(ln(this.currentConnector),n)}$activate(e,t){this.$mode.$activate(e,t),this.$repaint()}$clearHandles(e){for(let t=0;t<this.segmentHandles.length;t++)this.segmentHandles[t].index!==e&&this.segmentHandles[t].buttons.forEach(n=>this.ui.$removeElement(n));this.guideLine&&this.guideLine.parentNode&&this.guideLine.parentNode.removeChild(this.guideLine)}$elementDragged(e){}$elementDragging(e){this.$repaint()}$repaint(e){e=e||{};let t=e.segmentInfo;if(this.$mode.$repaintStarted(),this.geometry=this.current.connector.geometry,this.geometry&&this.geometry.segments){this.$clearHandles(),this.segmentHandles.length=0,this.segments.length=0,Array.prototype.push.apply(this.segments,this.geometry.segments);for(let n=0;n<this.segments.length;n++)if(t==null||n!==t.index){let o=this.segments[n],s={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=null;n>0&&(a=this.$makeAndAppendCircularHandle(this.segments[n].x1,this.segments[n].y1,this.buttonSize,this.buttonSize,[Un,Jh,ms].join(" "),!0));let l={buttons:[],focus:o,previous:n>=0?this.segments[n-1]:null,index:n,originalLocation:{x:o.x1,y:o.y1},midPoint:s,el:a,edge:this.currentEdge,segment:this.segments[n],connection:this.current};this.$mode.$appendHandles(l),a!=null&&l.buttons.push(a),l.buttons.forEach(h=>h.Jt=l),this.segmentHandles.push(l)}this.EA()}this.$mode.$repaintEnded()}EA(){if(this.$showGuidelines&&this.currentConnector.smooth&&this.segments.length>1){this.guideLine=M(Le,{width:10,height:10}),this.guideLine.style.overflow="visible",this.ui.$addClassToElement(this.guideLine,[$P,Op].join(" "));let e=this.segments[this.segments.length-1],t=`M ${this.segments[0].x1}, ${this.segments[0].y1} `;for(let o=0;o<this.segments.length;o++)t+=`L ${this.segments[o].x2}, ${this.segments[o].y2} `;t+=`L ${e.x2}, ${e.y2}`;let n=M(q,{d:t});this.guideLine.appendChild(n),this.ui.$appendElementToToolsLayer(this.guideLine,!0)}}deactivate(e){this.$mode.$deactivate(e),super.deactivate(e)}};c(lo,"type",Hr);Lr.set(lo.type,lo);function FP(){Lr.set(lo.type,lo)}var Kh="vjs-bezier-handle",Xy="vjs-bezier-handle-control-point",UP="vjs-bezier-handle-control-point-1",YP="vjs-bezier-handle-control-point-2",zP="vjs-bezier-guideline";var xi=class extends no{constructor(e,t){super(e,t);c(this,"$supportsHoverMode",!1);c(this,"h1");c(this,"h2");c(this,"l1");c(this,"l2");c(this,"lockHandles");c(this,"vt");c(this,"Fe");c(this,"Kt");c(this,"Ac");c(this,"Sc");c(this,"wg",{x:0,y:0});c(this,"Dg",{x:0,y:0});this.vt=t.handleSize||Qp,this.$addDragHandler({selector:"."+Kh+" *",target:"."+Kh,constrainFunction:function(n,o,s,a,l,h){return n},drag:n=>{let o=n.translatedPosition.x-n.originalTranslatedPosition.x,s=n.translatedPosition.y-n.originalTranslatedPosition.y,a=n.el.idx;if(o!==0||s!==0){this.$hasEdits=!0;let l=a===0?this.Fe:this.Kt,h=a===0?this.wg:this.Dg;l.x=h.x+o,l.y=h.y+s,this.$repaint(),this.$repaintConnection()}},stop:n=>{this.$hasEdits&&this.$updateModel(this.$cloneCurrentGeometry(),this.$generatedGeometry)},start:n=>(this.$hasEdits=!1,this.$generatedGeometry=this.$cloneCurrentGeometry(),this.wg=Object.assign({},this.Fe),this.Dg=Object.assign({},this.Kt),!0)})}$activate(e,t){this.Ng(),this.Ig(),this.fA((t==null?void 0:t.guidelines)!==!1),this.$hasEdits=!1,this.currentConnector.edited=!0}$clearHandles(){this.h1&&this.h1.parentNode.removeChild(this.h1),this.h2&&this.h2.parentNode.removeChild(this.h2),this.l1&&this.l1.parentNode.removeChild(this.l1),this.l2&&this.l2.parentNode.removeChild(this.l2),this.h1=null,this.h2=null,this.l1=null,this.l2=null}$elementDragged(e){this.$repaint()}$elementDragging(e){this.$repaint()}$repaint(e){this.Ng(),this.Ig(),this.Vg(),this.yA()}fA(e){this.h1=this.$makeAndAppendCircularHandle(this.Fe.x,this.Fe.y,this.vt,this.vt,[Un,Kh,Xy,UP].join(" ")),this.h2=this.$makeAndAppendCircularHandle(this.Kt.x,this.Kt.y,this.vt,this.vt,[Un,Kh,Xy,YP].join(" ")),this.h1.idx=0,this.h2.idx=1,this.h1.style.display=Pr,this.lockHandles||(this.h2.style.display=Pr),this.l1=this.Mg(this.Ac,this.Fe.x,this.Fe.y),this.l2=this.Mg(this.Sc,this.Kt.x,this.Kt.y),this.ui.$appendElementToToolsLayer(this.l1,!0),this.ui.$appendElementToToolsLayer(this.l2,!0),this.l1.style.display=e?Pr:pt,this.l2.style.display=e?Pr:pt,this.Vg()}Vg(){this.$setElementPosition(this.h1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Kt;this.$setElementPosition(this.h2,e.x,e.y)}Mg(e,t,n){let o=M(Le,{width:5,height:5}),s=M(q,{d:"M 0 0 L 1 1"});return o.appendChild(s),this.ui.$addClassToElement(o,zP),this.ui.$addClassToElement(o,Op),this.Tc(e,o,t,n),o}yA(){this.Tc(this.Ac,this.l1,this.Fe.x,this.Fe.y);let e=this.lockHandles?this.Fe:this.Kt;this.Tc(this.Sc,this.l2,e.x,e.y)}Tc(e,t,n,o){pn(t,e);let s=n-e.x,a=o-e.y;ie(t.childNodes[0],{d:`M 0 0 L ${s} ${a}`})}Ig(){this.currentConnector&&(this.Fe=this.currentConnector.geometry.segments[0].cp1,this.Kt=this.currentConnector.geometry.segments[0].cp2)}Ng(){this.current&&(this.Ac={x:this.current.anchors.source.computedPosition.curX,y:this.current.anchors.source.computedPosition.curY},this.Sc={x:this.current.anchors.target.computedPosition.curX,y:this.current.anchors.target.computedPosition.curY})}};c(xi,"type",Mo);var ho=class extends xi{constructor(r,e){super(r,e),this.lockHandles=!0}};c(ho,"type",ru);Lr.set(xi.type,xi),Lr.set(ho.type,ho);function XP(){Lr.set(xi.type,xi),Lr.set(ho.type,ho)}var Vw="selected-vertices",qh=class extends ga{constructor(e,t,n,o,s){var h,d,u,p,g,m,E,y,x;super(e,t,n,o,s,An(o.defaults||{},{managedElementsSelector:Ae(gt,hn)}));this.model=e;c(this,"canvasElement");c(this,"vertexLayer");c(this,"toolsLayer");c(this,"vertexGroup");c(this,"edgeGroup");c(this,"labelGroup");c(this,"ei");c(this,"zoomOptions");c(this,"panOptions");c(this,"panZoom");c(this,"$wheelReverse");c(this,"$edgePathEditor");c(this,"$edgeInputMethod");c(this,"$editEdgesOnTap");c(this,"vc");c(this,"dragOptions");c(this,"elementDragHandler");c(this,"Gg");c(this,"mode",br);if(this.ei=Bv(o.decorators,this,n),this.$suspendRendering=!1,this.zoomOptions=o.zoom,this.panOptions=o.pan,n.aS=this,o.events)for(let f in o.events)this.bindUnchecked(f,o.events[f]);o.useSvgContainer?(this.canvasElement=Qr(Gt,Le,{position:"absolute",left:"0",top:"0"},Pf,{width:5,height:5,x:0,y:0},this.rootElement,!0),this.vertexLayer=Qr(Gt,Le,{overflow:"visible"},"vjs-vertex-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.vertexGroup=Qr(Gt,Q,{},"vjs-vertex-group",{},this.vertexLayer),this.edgeGroup=Qr(Gt,Q,{},"vjs-edge-group",{},this.vertexLayer,((h=o.edges)==null?void 0:h.layerIndex)===0),this.labelGroup=Qr(Gt,Q,{},"vjs-label-group",{},this.vertexLayer)):(this.canvasElement=Qr(null,qe,{position:"relative",width:kr,height:kr},Pf,{},this.rootElement,!0),this.vertexLayer=Qr(null,qe,{left:0,top:0,position:"absolute",width:kr,height:kr},"vjs-vertex-layer",{},this.canvasElement)),this.toolsLayer=Qr(Gt,Le,{overflow:"visible",left:0,top:0},"vjs-tools-layer",{width:5,height:5,transform:"translate(0,0)"},this.canvasElement),this.setContainer(this.canvasElement),ug(this.rootElement,!1),this.vc=o.elementsDraggable!==!1,this.vc===!1&&this.canvasElement.setAttribute(DS,ct),this.dragOptions=o.dragOptions||{},this.elementDragHandler=new dg({ui:this,draggableInstance:this,resolveGrid:()=>this.getGrid()}),o.edges!=null&&(o.edges.editable===!0&&(this.$edgePathEditor=new Aa(this,{activeMode:o.edges.activeEdit!==!1}),this.addDragClassnameFilter(ba),this.$editEdgesOnTap=o.edges.editOnTap!==!1),this.$edgeInputMethod=o.edges.inputMethod||$n),this.Gg=new Pp({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,method:this.$edgeInputMethod,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,Xl:f=>{L(this.rootElement,Gn)},Hl:f=>{F(this.rootElement,Gn)},jl:f=>{},kl:f=>{F(this.rootElement,Gn)}}),new _p({instance:this,allowLoopbackEdges:o.allowLoopbackEdges,activeFiltering:o.activeFiltering!==!1,edgeSnap:o.edgeSnap,method:this.$edgeInputMethod,inputHandler:this.Gg}),this.dragOptions.filter!=null&&this.elementDragHandler.$addVertexDragFilter(this.dragOptions.filter),this.dragOptions.cssFilter!=null&&this.elementDragHandler.addSelectorFilter(this.dragOptions.cssFilter),this.elementDragHandler.addClassnameFilter(fu),this.$wheelReverse=o.wheel&&o.wheel.reverse===!0,L(this.rootElement,vf),In()&&L(this.rootElement,tv),ci()&&L(this.rootElement,rv),((d=o.pan)==null?void 0:d.enabled)===!1&&L(this.rootElement,Cf);let a=(f,b,A)=>{let T=S=>{let O=S.srcElement||S.target;if(O===this.rootElement||O===this.canvasElement||this.panZoom!=null&&this.panZoom.isBackgroundElement(O)){let v=S.button===2&&A!=null?A:b;this.fireUnchecked(v,this,S),b===_n&&this.$editEdgesOnTap&&this.stopEditingPath()}};this.on(this.rootElement,f,T)};a(W,_n,At),a(zr,lA),this.panZoom=new ya({viewport:this.viewport,viewportElement:this.rootElement,canvasElement:this.canvasElement,elementPositionSetter:(f,b)=>Ie(f,b),consumeRightClick:o.consumeRightClick,idFunction:f=>this.W(f),fixedTransformOrigin:(u=this.zoomOptions)==null?void 0:u.fixedTransformOrigin,enablePan:((p=o.pan)==null?void 0:p.enabled)!==!1,panWithMetaKey:(g=o.pan)==null?void 0:g.useMetaKey,wheel:this.xA(o),enableAnimation:o.enableAnimation,clamp:o.clamp,clampToBackground:o.clampToBackground,clampToBackgroundExtents:o.clampToBackgroundExtents,panFilter:(m=o.pan)==null?void 0:m.filter,events:{panStart:()=>{L(this.rootElement,Lf),L(document.body,mt)},[Gi]:(f,b,A,T,S)=>{this.fire(Gi,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[Br]:(f,b,A,T,S)=>{A=super.setZoom(A),this.fire(Br,{x:f,y:b,zoom:A,oldZoom:T,event:S})},[le]:()=>{F(this.rootElement,Lf),F(document.body,mt)}},zoom:(E=o.zoom)==null?void 0:E.initialValue,zoomRange:(y=o.zoom)==null?void 0:y.range,zoomStep:(x=o.zoom)==null?void 0:x.step}),o.modelEvents&&o.modelEvents.forEach(f=>{this.bindModelEvent(f.event,f.selector,b=>{setTimeout(()=>f.callback(b),0)})}),this.bindModelEvent(W,z(yu),f=>{if(!f.event.defaultPrevented){let b=f.objectInfo.obj;if(b!=null){let A=this.view.getEdgeDefinition(this.model.getEdgeType(b));A.deleteConfirm?A.deleteConfirm({edge:f.objectInfo.obj,e:f.event},()=>this.model.removeEdge(b)):this.model.removeEdge(b)}}}),this.zu(o),this.$dataLoadStart();let l=this.Pu();this.$dataLoadEnd(!l)}$getCanvasElement(){return this.canvasElement}$getDragViewportContainer(){return this.rootElement}$isDraggingSupported(){return!0}$nodeRemoved(e){let t=super.$nodeRemoved(e);return t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el)),t}$groupRemoved(e){let t=super.$groupRemoved(e);if(t&&(this.removeFromDragGroup(t.el),this.panZoom.remove(t.el),e.removeChildren===!1))for(let n=0;n<e.children.length;n++){let o=this.$getManagedElement(e.children[n].id);o&&this.panZoom.restore(o)}return t}$afterRefresh(e){this.$afterRelayout(e)}bA(e,t){e.decorate({surface:this,adapter:this.$_layout.adapter,layout:this.$_layout,setAbsolutePosition:(n,o)=>{Ie(n,o)},model:this.model,bounds:t.bounds,positions:t.positions,fixElement:(n,o,s,a)=>{if(a!=null){let h=Array.from(e.fixedElements).find(d=>d.id===a);h!=null&&this.unfixElement(h.el)}let l=Array.from(e.fixedElements).find(h=>h.el===n);return l==null&&(l=this.fixElement(n,o,s,a),e.fixedElements.add(l)),l},floatElement:(n,o)=>{let s=Array.from(e.floatedElements).find(a=>a.el===n);return s==null&&(s={el:n,pos:o,constraints:{}},this.floatElement(n,o),e.floatedElements.add(s)),s},appendElement:(n,o,s)=>{let a=Array.from(e.appendedElements).find(l=>l.el===n);if(a==null){a={el:n,pos:o,constraints:s};let l=o.x,h=o.y,d=null;this.canvasElement.appendChild(n),this.panZoom.add(n,!0),s&&s.alignX&&s.alignX===yt&&(d=d||Ze(n),l-=d.width),s&&s.alignY&&s.alignY===ht&&(d=d||Ze(n),h-=d.height),Ie(n,{x:l,y:h}),e.appendedElements.add(a)}return a}})}$afterRelayout(e){for(let t=0;t<this.ei.length;t++)this.bA(this.ei[t],e);super.$afterRelayout(e)}$zoomToFit(e){this.panZoom.zoomToFit(e)}$zoomToFitIfNecessary(e){this.panZoom.zoomToFitIfNecessary(e)}op(e){this.panZoom.$computeCompoundZoom()}$startPanRepeat(e,t,n,o,s,a){this.panZoom.startPanRepeat(e,t,n,o,s,a)}$stopPanRepeat(){this.panZoom.stopPanRepeat()}$canStartElementDrag(){return this.vc!==!1&&(this.mode===br||this.mode===Ei)}$zoomToElements(e){this.panZoom.zoomToElements(e)}$getNodesInViewport(){return this.Ps(ce.objectType,this.panZoom.viewportElement)}$getGroupsInViewport(){return this.Ps(se.objectType,this.panZoom.viewportElement,e=>this.$getGroupContentAreaElement(e))}$edgeTap(e){this.$editEdgesOnTap===!0&&this.startEditingPath(e.obj)}xA(e){var a,l,h,d,u;let t=((a=e.zoom)==null?void 0:a.wheel)!==!1,n=((l=e.pan)==null?void 0:l.wheel)===!0,o=((h=e.pan)==null?void 0:h.axis)||"both",s=(d=e.wheel)==null?void 0:d.cssFilter;return{filter:(u=e.wheel)==null?void 0:u.filter,cssFilter:s,reverse:e.wheel!=null?e.wheel.reverse===!0:!1,pan:n,zoom:t,useMetaKey:e.wheel!=null?e.wheel.useMetaKey===!0:!1,axis:o}}$graphClearStart(){super.$graphClearStart();for(let e=0;e<this.ei.length;e++)this.ei[e].reset({remove:t=>t.parentNode&&t.parentNode.removeChild(t)});this.panZoom.reset(),this.se(e=>e.reset())}$appendElementToToolsLayer(e,t){this.$appendElement(e,this.toolsLayer,t)}$appendElementToVertexLayer(e,t){this.$appendElement(e,this.vertexLayer,t)}$appendOverlayElement(e,t){this.$appendElementToVertexLayer(e,t)}$appendVertexElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.vertexGroup:this.vertexLayer,t)}$appendEdgeElement(e,t){this.$appendElement(e,this.containerType==="SVG"?this.edgeGroup:this.vertexLayer,t)}$_attachEdgePathEditor(e){this.$edgePathEditor=e,GP(),FP(),XP()}$addToDragGroup(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler._g(e,...n)}$_assignRemoveFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}$select(e){if(super.$select(e),J(e.obj)||Y(e.obj)){let t=this.$getManagedElement(e.obj.id);t&&this.elementDragHandler._g({id:Vw,active:!0,membership:Ma},t)}}$deselect(e){if(super.$deselect(e),J(e.obj)||Y(e.obj)){let t=this.getRenderedElement(e.obj.id);t&&this.removeFromDragGroup(t)}}$selectionCleared(e){super.$selectionCleared(e),this.clearDragGroup(Vw)}save(e){let t=super.save(e);return Object.assign(t,{pan:Object.assign({},this.getPan()),transformOrigin:Object.assign({},this.panZoom.transformOrigin)})}load(e,t){let n=()=>{e.pan&&this.setPan(e.pan.x,e.pan.y),e.transformOrigin&&this.panZoom.setTransformOrigin(e.transformOrigin.x,e.transformOrigin.y),t&&t()};super.load(e,n)}startEditingPath(e,t){this.$edgePathEditor!=null?this.$edgePathEditor.startEditing(e,t):U("ERROR: cannot start path edit - surface not created with 'edges:{editable:true}'")}stopEditingPath(){this.$edgePathEditor!=null?this.$edgePathEditor.stopEditing():U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'")}clearPathEdits(e){return this.$edgePathEditor!=null?this.$edgePathEditor.clearEdits(e):(U("ERROR: cannot edit paths - surface not created with 'edges:{editable:true}'"),!1)}getVisibleCanvasBounds(){return this.panZoom.getVisibleContentArea()}addDragFilter(e,t){this.elementDragHandler.addDragFilter(e,null,t)}addDragClassnameFilter(e){this.elementDragHandler.addClassnameFilter(e)}addDragSelectorFilter(e){this.elementDragHandler.addSelectorFilter(e)}addVertexDragFilter(e){this.elementDragHandler.$addVertexDragFilter(e)}removeDragClassnameFilter(e){this.elementDragHandler.removeClassnameFilter(e)}addWheelSelectorFilter(e){this.panZoom.$addWheelSelectorFilter(e)}addToDragGroup(e,...t){let n=X(e)?{id:e,active:!0,membership:Ma}:Object.assign(e,{membership:Ma});this.$addToDragGroup(n,...t)}removeFromDragGroup(...e){let t=e.map(n=>{var o;return(o=this.getObjectInfo(n,!1))==null?void 0:o.managedElement}).filter(n=>n!=null);this.elementDragHandler.removeFromDragGroup(...t)}setDragGroupState(e,...t){let n=t.map(o=>{var s;return(s=this.getObjectInfo(o,!1))==null?void 0:s.managedElement}).filter(o=>o!=null);this.elementDragHandler.$setDragGroupState(e,...n)}clearDragGroup(e){this.elementDragHandler.$clearDragGroup(e)}attachMiniview(e){this.addPlugin({type:zn.type,options:e})}magnetizeAtEvent(e){let t=this.fromPageLocation(e.pageX,e.pageY);this.magnetizeAtPoint(t)}destroy(){let e;for(let t=0;t<this.hl.length;t++)try{e=this.hl[t],this.dataSource.unbind(e.event,e.fn)}catch(n){U("WARN: Could not unbind event "+e.event+" during destroy operation.")}this.canvasElement.parentNode.removeChild(this.canvasElement),F(this.rootElement,vf),F(this.rootElement,ev),F(this.rootElement,Cf),this.se(t=>{t.destroy()}),this.panZoom.destroy(),this.panZoom=null,this.$edgePathEditor!=null&&this.$edgePathEditor.destroy(),this.fire(Ii,this),super.destroy()}zoomToBackground(e){this.panZoom.zoomToBackground(e)}zoomToDecorator(e){let t=X(e.decorator)?this.getDecorator(e.decorator):e.decorator;if(t!=null){let n=this.getViewportBoundsInfo(),o=t.getBounds();this.panZoom.zoomToExtents(Object.assign(e,{extents:[n,o]}))}}zoomToExtents(e){this.panZoom.zoomToExtents(e)}mapEventLocation(e){return this.panZoom.mapEventLocation(e)}centerContent(e){this.panZoom.centerContent(e)}centerContentHorizontally(e){this.panZoom.centerContentHorizontally(e)}centerContentVertically(e){this.panZoom.centerContentVertically(e)}centerBackground(e){this.panZoom.centerBackground(e)}alignBackground(e,t){this.panZoom.alignBackground(e,t)}zoomToSelection(e){e=e||{};let t=()=>e.filter?this.model.filter(e.filter):this.model.getSelection(),n=e.selection||t(),o=[];n.eachNode((s,a)=>{o.push(this.getRenderedElement(a.id))}),n.eachGroup((s,a)=>{o.push(this.getRenderedElement(a.id))}),o.length>0&&this.panZoom.zoomToElements({elements:o,fill:e.fill,doNotZoomIfVisible:e.doNotZoomIfVisible,doNotAnimate:e.doNotAnimate})}getPath(e){return new kf(this.model.getPath(e),this)}setApparentCanvasLocation(e,t){return this.panZoom.setApparentCanvasLocation(e,t)}getViewportBoundsInfo(){return this.panZoom.getBoundsInfo()}$getFixedViewportBoundsInfo(){return null}getApparentCanvasLocation(){return this.panZoom.getApparentCanvasLocation()}addBackground(e){this.panZoom.addBackground(e)}removeBackground(e){this.panZoom.removeBackground(e)}setZoom(e,t){let n=this.panZoom.setZoom(e,t);return super.setZoom(n,t)}getDecorator(e){return this.ei.find(t=>t.id===e)}setZoomRange(e,t){return this.panZoom.setZoomRange(e,t)}getZoomRange(){return this.panZoom.getZoomRange()}getZoom(){return this.panZoom.getZoom()}nudgeZoom(e,t){return this.panZoom.nudgeZoom(e,t)}nudgeWheelZoom(e,t){this.panZoom.nudgeWheelZoom(e,t)}zoomOut(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomOut(e)}zoomIn(e){if(e==null){let t=this.panZoom.getBoundsInfo();e={x:t.x+t.width/2,y:t.y+t.height/2}}this.panZoom.zoomIn(e)}getPan(){return this.panZoom.getPan()}pan(e,t,n){this.panZoom.pan(e,t,!n)}setPan(e,t,n,o){this.panZoom.setPan(e,t,n,o)}setPanAndZoom(e,t,n,o){this.setPan(e,t,o),this.setZoom(n,o)}$g(e){let t=null;return(Array.isArray(e)?e:[e]).forEach(o=>{let s=this.getObjectInfo(o,!1);if(s.el!=null){let a=this.viewport.getElementBounds(s.id);t=t==null?a:Lx(t,a)}}),t}centerOnAndZoom(e,t,n){let o=this.$g(e);o!=null&&this.panZoom.centerOnAndZoom({bounds:o,fillRatio:t,doNotAnimate:n})}centerOn(e,t){let n=this.$g(e);n!=null&&this.panZoom.centerOn({bounds:n,doNotAnimate:t})}centerOnHorizontally(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnHorizontally({bounds:this.viewport.getElementBounds(t.id)})}centerOnVertically(e){let t=this.getObjectInfo(e,!1);t.el!=null&&this.panZoom.centerOnVertically({bounds:this.viewport.getElementBounds(t.id)})}setClamping(e){this.panZoom.setClamping(e)}setViewportCenter(e){this.panZoom.setViewportCenter(e)}isPageLocationInViewport(e,t){return this.panZoom.isInViewport(e,t)}fromPageLocation(e,t,n){return this.panZoom.fromPageLocation(e,t,n)}fromWindowLocation(e,t,n){return this.panZoom.fromWindowLocation(e,t,n)}toPageLocation(e,t){return this.panZoom.toPageLocation(e,t)}toViewportLocation(e,t){return this.panZoom.toViewportLocation(e,t)}bindModelEvent(e,t,n){let o=(s,a)=>{let l=this.getObjectInfo(a,!0);l.obj!=null&&setTimeout(()=>n({event:s,eventTarget:a,objectInfo:l,model:this.model,ui:this}),0)};n.Bg=o,this.on(this.vertexLayer,e,t,o)}unbindModelEvent(e,t){t.Bg!=null&&this.off(this.vertexLayer,e,t.Bg)}cloneVertex(e,t){let n=super.cloneVertex(e,t);return n!=null&&(t==null?void 0:t.flash)===!0&&setTimeout(()=>{this.flashVertex(n)}),n}getEffectiveVisibleZoom(){let e=this.panZoom.getCompoundZoom();return this.currentZoom*e}isInViewport(e,t){return this.panZoom.isInViewport(e,t)}fixElement(e,t,n,o,s){return e.style.position=Qe,this.panZoom.fixElement(e,t,n,o,s)}unfixElement(e){this.panZoom.unfixElement(e)}floatElement(e,t){this.panZoom.floatElement(e,t)}setMode(e,t){let n={[br]:()=>{this.panZoom.setEnabled(!0)},[Ei]:()=>{this.panZoom.setEnabled(!1)},[ns]:()=>{this.panZoom.setEnabled(!1)},[Fn]:()=>{this.panZoom.setEnabled(!1)}};n[e]?(this.mode=e,n[e](),e===Ei&&!t&&this.model.clearSelection(),this.fire(On,e)):U("Surface: unknown mode '"+e+"'")}alignContent(e){this.panZoom.alignContent(e)}alignContentTop(e){this.panZoom.alignContentTop(e)}alignContentBottom(e){this.panZoom.alignContentBottom(e)}alignContentLeft(e){this.panZoom.alignContentLeft(e)}alignContentRight(e){this.panZoom.alignContentRight(e)}};c(qh,"type","Surface");var jy=class extends Nd{fetchUrl(r){ca(r)}render(r,e,t){let n=e!=null&&e.useSvgContainer?Ea:ma,o=t||Oh(n,e==null?void 0:e.useSvgContainer,e);return $w(this,r,o,e)}renderDiagram(r,e){return new cg(this,r,e)}renderPaper(r,e,t,n){let o=e!=null&&e.useSvgContainer?Ea:ma,s=n||Oh(o,e==null?void 0:e.useSvgContainer,{});return Bw(this,r,s,e,t)}};function fn(i){return i=i||{},new jy(i)}function y$(i,r){i.bind(Jt,e=>{r.$nodeAdded(e)}),i.bind(Wt,e=>{r.$groupAdded(e)}),i.bind(Ce,e=>{r.$nodeRemoved(e)}),i.bind(Oe,e=>{r.$groupRemoved(e)}),i.bind(cr,e=>{r.$edgeAdded(e)}),i.bind(bt,e=>{r.$edgeRemoved(e)}),i.bind(Cn,()=>{r.$graphClearStart(),r.$graphClearEnd()})}function $w(i,r,e,t){return Gw(i,r,e,(n,o,s,a,l)=>new qh(n,s||n,a,o,l),t)}function Gw(i,r,e,t,n){let o,s=Object.assign({dataSource:i},n||{});s.selection!=null&&(typeof s.selection!="function"?o=s.selection:o=new dr(i,{generator:s.selection}));let a=s.id||G(),l=t(i,s,o,r,e);return o!=null&&y$(o,l),i.$addRenderer(l,a),l}function Bw(i,r,e,t,n){return Gw(i,r,e,(o,s,a,l,h)=>new Qh(o,a||o,l,s,h,n),t)}var x$=i=>i.map(r=>String.fromCodePoint(r)).join(""),b$=[99,114,101,97,116,101,69,108,101,109,101,110,116];function A$(){return document}var Fw=i=>A$()[x$(b$)](i);var Qh=class extends ga{constructor(e,t,n,o,s,a){super(e,t,n,o,s,a);this.model=e;c(this,"$canvas");c(this,"$margin");c(this,"$horizontalAlign");c(this,"$verticalAlign");c(this,"$scale");this.id=o.id||G(),this.$margin=o.margin||zT,this.$horizontalAlign=o.horizontalAlign||o.align||qo,this.$verticalAlign=o.verticalAlign||o.align||qo,this.$scale=o.scale!==!1,o.useSvgContainer?this.$canvas=M(Le,{width:"100%",height:"100%"}):(this.$canvas=Fw("div"),this.$canvas.style.transformOrigin="0 0"),new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.syncView()})}).observe(this.rootElement),L(this.rootElement,FT),L(this.$canvas,YT),n.appendChild(this.$canvas),this.$scale||L(this.rootElement,UT),this.setContainer(this.$canvas),ug(this.rootElement,!1),this.bindAll([Fr,zs,Vt,$r,Ce,Oe,Yr,Ur,Pn,Fb,Ys],()=>{this.syncView()}),this.zu(o),this.$dataLoadStart();let h=this.Pu();this.$dataLoadEnd(!h)}$getCanvasElement(){return this.$canvas}syncView(){let e=this.viewport.je,t=Ze(this.rootElement),n=e.xmax-e.xmin,o=e.ymax-e.ymin,s=t.width-2*this.$margin,a=t.height-2*this.$margin,l=s/n,h=a/o,d=Math.min(l,h);if(!isFinite(d))return;let u=n*d,p=o*d;if(Lt(this.$canvas))if(this.$scale){let g=0,m=0;switch(this.$horizontalAlign){case qo:break;case oh:g-=(s-d*n)/2;break;case sh:g+=(s-d*n)/2;break}switch(this.$verticalAlign){case qo:break;case oh:m-=(a-d*o)/2;break;case sh:m+=(a-d*o)/2;break}this.$canvas.setAttribute("transform",`translate(${g}, ${m})`),this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`)}else{let g=e.xmax-e.xmin,m=e.ymax-e.ymin;this.$canvas.setAttribute("viewBox",`${e.xmin-this.$margin} ${e.ymin-this.$margin} ${e.xmax+2*this.$margin-e.xmin} ${e.ymax+2*this.$margin-e.ymin}`),this.$canvas.style.width=`${g}px`,this.$canvas.style.height=`${m}px`}else if(this.$scale){let g=-e.xmin*d+this.$margin,m=-e.ymin*d+this.$margin;switch(this.$horizontalAlign){case oh:break;case qo:g+=(s-u)/2;break;case sh:g+=s-u;break}switch(this.$verticalAlign){case oh:break;case qo:m+=(a-p)/2;break;case sh:m+=a-p;break}this.$canvas.style.transform=`translateX(${g}px) translateY(${m}px) scale(${d})`}else{let g=-e.xmin+this.$margin,m=-e.ymin+this.$margin,E=e.xmax-e.xmin+2*this.$margin,y=e.ymax-e.ymin+2*this.$margin;this.$canvas.style.transform=`translateX(${g}px) translateY(${m}px) scale(1)`,this.$canvas.style.width=`${E}px`,this.$canvas.style.height=`${y}px`}}setMargin(e){this.$margin=e,this.syncView()}toPageLocation(e,t){return{x:e,y:t}}fromPageLocation(e,t,n){return{x:e,y:t}}fromWindowLocation(e,t,n){return{x:e,y:t}}mapEventLocation(e){return this.fromPageLocation(e.pageX,e.pageY)}getViewportBoundsInfo(){let e=Ze(this.getContainer()),t=this.viewport.getBoundsWidth(),n=this.viewport.getBoundsHeight(),o=e.width/t,s=e.height/n,a=Math.min(o,s);return{width:t,height:n,x:this.viewport.getX(),y:this.viewport.getY(),vw:e.width,vh:e.height,minimumFill:a,zoom:1}}$getFixedViewportBoundsInfo(){if(this.$scale)return null;{let e=this.getViewportBoundsInfo();return{x:e.x-this.$margin,y:e.y-this.$margin,width:e.width+2*this.$margin,height:e.height+2*this.$margin,vw:e.vw,vh:e.vh,zoom:e.zoom,minimumFill:e.minimumFill}}}getApparentCanvasLocation(){return{x:0,y:0}}addBackground(e){console.log("add background to paper - not implemented")}removeBackground(e){console.log("remove background from paper - not implemented")}zoomOut(e){}zoomIn(e){}getVisibleCanvasBounds(){return{x:0,y:0,width:100,height:100}}};function S$(i,r,e,t){let n=fn(e||{}),o=r!=null&&r.useSvgContainer?Ea:ma,s=Oh(o,r==null?void 0:r.useSvgContainer,{}),a=new Qh(n,n,i,r,s,null);return n.$addRenderer(a,a.id),t&&a.model.load({data:t}),a}function T$(i,r,e){if($t(r,e,i))return r;{let t=r.parentNode;for(;t!=null&&t!==i;){if($t(t,e,i))return t;t=t.parentNode}}}function v$(i){return typeof i=="function"?(i.Ao=G(),i.Ao):i}function C$(i,r,e){let t=null,n=r.getAttribute("katavorio-draggable"),o=n!=null?"[katavorio-draggable='"+n+"'] ":"";for(let s=0;s<i.length;s++)if(i[s].selector==="."?t=r:t=T$(r,e,o+i[s].selector),t!=null){if(i[s].filter){let a=$t(e,i[s].filter,t);if(i[s].filterExclude===!0&&!a||a)return null}return[i[s],t]}return null}var WP="start",ZP="beforeStart",JP="drag",zw="drop",Xw="over",jw="out",KP="stop",Uw="katavorio-draggable",P$=Uw,_$=10,O$=10,jP=function(){return!0},R$=function(){return!1},HP={delegatedDraggable:"katavorio-delegated-draggable",draggable:P$,drag:"katavorio-drag",selected:"katavorio-drag-selected",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},Yw=[KP,WP,JP,zw,Xw,jw,ZP],L$=function(){},ec=function(i,r){if(i!=null){i=!X(i)&&i.tagName==null&&i.length!=null?i:[i];for(let e=0;e<i.length;e++)r.apply(i[e],[i[e]])}},w$=function(i,r,e){let t=i.srcElement||i.target;return!$t(t,e.getInputFilterSelector(),r)},kP=class{constructor(r,e){this.el=r;this.manager=e;c(this,"uuid",G());c(this,"enabled",!0);c(this,"scopes",[]);c(this,"eventManager");this.eventManager=e.eventManager}setEnabled(r){this.enabled=r}isEnabled(){return this.enabled}toggleEnabled(){this.enabled=!this.enabled}addScope(r){let e={};ec(this.scopes,t=>{e[t]=!0}),ec(r?r.split(/\s+/):[],t=>{e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}removeScope(r){let e={};ec(this.scopes,t=>{e[t]=!0}),ec(r?r.split(/\s+/):[],t=>{delete e[t]}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}toggleScope(r){let e={};ec(this.scopes,t=>{e[t]=!0}),ec(r?r.split(/\s+/):[],t=>{e[t]?delete e[t]:e[t]=!0}),this.scopes.length=0;for(let t in e)this.scopes.push(t)}},Hw="notNegative",kw="parent",Ww="parentEnclosed";function qP(i,r){let e=null;switch(i){case Hw:{e=(t,n,o,s)=>({x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))});break}case kw:{let t=r||5;e=(n,o,s,a)=>{let l=n.x<0?0:n.x>s.width-t?s.width-t:n.x,h=n.y<0?0:n.y>s.height-t?s.height-t:n.y;return{x:l,y:h}};break}case Ww:{e=(t,n,o,s)=>{let a=t.x<0?0:t.x+s.width>o.width?o.width-s.width:t.x,l=t.y<0?0:t.y+s.height>o.height?o.height-s.height:t.y;return{x:a,y:l}};break}}return e}var Hy=class extends kP{constructor(e,t,n){super(e,n);c(this,"Fg");c(this,"rightButtonCanDrag");c(this,"consumeStartEvent");c(this,"clone");c(this,"scroll");c(this,"trackScroll");c(this,"cloneSize");c(this,"q");c(this,"_e");c(this,"Tt");c(this,"ca");c(this,"da",{x:0,y:0});c(this,"So",{x:0,y:0});c(this,"qe");c(this,"ua");c(this,"pa");c(this,"E");c(this,"Cc");c(this,"To");c(this,"vo");c(this,"ti",!1);c(this,"ma");c(this,"ri");c(this,"Pc");c(this,"$");c(this,"Co",[]);c(this,"Ug");c(this,"zg");c(this,"wn");c(this,"Rr");c(this,"Oc");c(this,"Po",{});c(this,"ga");c(this,"Ae");c(this,"downListener");c(this,"moveListener");c(this,"upListener");c(this,"scrollTracker");c(this,"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]});if(this.Fg=this.manager.css.draggable,L(this.el,this.Fg),this.downListener=this.nn.bind(this),this.upListener=this.Tr.bind(this),this.moveListener=this.sn.bind(this),this.rightButtonCanDrag=t.rightButtonCanDrag===!0,this.consumeStartEvent=t.consumeStartEvent!==!1,this.E=this.el,this.clone=t.clone===!0,this.cloneSize=t.cloneSize,this.scroll=t.scroll===!0,this.trackScroll=t.trackScroll!==!1,this.Ug=t.canDrag||jP,this.zg=t.consumeFilteredEvents,this.wn=t.parent,this.Rr=t.ignoreZoom===!0,this.ma=t.ghostProxyParent,this.Oc=t.getTargetScale,this.trackScroll&&(this.scrollTracker=this.AA.bind(this),document.addEventListener("scroll",this.scrollTracker)),t.ghostProxy===!0?this.ri=jP:t.ghostProxy&&typeof t.ghostProxy=="function"?this.ri=t.ghostProxy:this.ri=(o,s)=>this.$&&this.$.useGhostProxy?this.$.useGhostProxy(o,s):!1,t.makeGhostProxy?this.Pc=t.makeGhostProxy:this.Pc=o=>this.$&&this.$.makeGhostProxy?this.$.makeGhostProxy(o):o.cloneNode(!0),t.selector){let o=this.el.getAttribute(Uw);o==null&&(o=""+new Date().getTime(),this.el.setAttribute("katavorio-draggable",o)),this.Co.push(t)}this.eventManager.on(this.el,ge,this.downListener)}AA(e){if(this.Tt){let t={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},n=t.x-this.da.x,o=t.y-this.da.y,s={x:n+this.ca.x,y:o+this.ca.y},a=s.x-this.q.x,l=s.y-this.q.y,h=this.Rr?1:this.manager.zoom;this.E&&this.E.parentNode&&(a+=this.E.parentNode.scrollLeft-this.So.x,l+=this.E.parentNode.scrollTop-this.So.y),a/=h,l/=h,this.moveBy(a,l,e),this.ca=s,this.da=t}}on(e,t){this.listeners[e]&&this.listeners[e].push(t)}off(e,t){if(this.listeners[e]){let n=[];for(let o=0;o<this.listeners[e].length;o++)this.listeners[e][o]!==t&&n.push(this.listeners[e][o]);this.listeners[e]=n}}Tr(e){this.q&&(this.q=null,this.eventManager.off(document,ae,this.moveListener),this.eventManager.off(document,le,this.upListener),this.unmark(e),this.stop(e),this.Tt=!1,this.clone?(this.E&&this.E.parentNode&&this.E.parentNode.removeChild(this.E),this.E=null):this.$&&this.$.revertFunction&&this.$.revertFunction(this.E,this.manager.positionGetter(this.E))===!0&&this.manager.positionSetter(this.E,this._e))}nn(e){if(e.defaultPrevented)return;if((this.rightButtonCanDrag||e.which!==3&&e.button!==2)&&this.isEnabled()&&this.Ug())if(this.fc(e)&&w$(e,this.el,this.manager)){this.$=null,this.Ae=null,this.Co.length===0&&U("VisuallyJs - WARN: no available drag selectors");let o=e.target||e.srcElement,s=C$(this.Co,this.el,o);if(s!=null&&(this.$=s[0],this.Ae=s[1]),this.$==null||this.Ae==null)return;let a=this.$.dragInit?this.$.dragInit(this.Ae,e):null;a!=null&&(this.Ae=a);let l=1;if(this.clone)if(this.E=this.Ae.cloneNode(!0),L(this.E,HP.clonedDrag),this.E.setAttribute("id",null),this.E.style.position="absolute",this.wn!=null){let h=this.manager.positionGetter(this.el);this.E.style.left=h.x+"px",this.E.style.top=h.y+"px",this.wn.appendChild(this.E)}else{let h=Ki(this.Ae,!0),d=this.Ae.getBoundingClientRect();this.E.style.left=`${h.x}px`,this.E.style.top=`${h.y}px`;let u=this.cloneSize==null?d.width:this.cloneSize.width,p=this.cloneSize==null?d.height:this.cloneSize.height;this.E.style.width=`${u}px`,this.E.style.height=`${p}px`,document.body.appendChild(this.E),this.Oc&&!this.Rr&&(l=this.Oc(),l!==1&&(this.E.style.transform=`scale(${l})`,this.E.style.transformOrigin="0 0"))}else this.E=this.Ae;this.consumeStartEvent&&oe(e),this.q=me(e),this.E&&this.E.parentNode&&(this.So={x:this.E.parentNode.scrollLeft,y:this.E.parentNode.scrollTop}),this._e=this.manager.positionGetter(this.E),this.qe=this.manager.getSize(this.E),this.qe.width=this.qe.width*l,this.qe.height=this.qe.height*l,this.eventManager.on(document,ae,this.moveListener),this.eventManager.on(document,le,this.upListener),this.Ea(ZP,{el:this.el,pos:this._e,e,drag:this,size:this.qe})}else this.zg&&oe(e)}sn(e){if(this.q){if(!this.Tt){let t=this.Ea(WP,{el:this.el,pos:this._e,e,drag:this,size:this.qe});if(t!==!1){if(!this.q)return;this.mark(t),this.Tt=!0}else this.abort()}if(this.q){let t=me(e),n=t.x-this.q.x,o=t.y-this.q.y,s=this.Rr?1:this.manager.zoom;this.ca={x:t.x,y:t.y},this.da={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this.E&&this.E.parentNode&&(n+=this.E.parentNode.scrollLeft-this.So.x,o+=this.E.parentNode.scrollTop-this.So.y),n/=s,o/=s,this.moveBy(n,o,e)}}}getDragDelta(){return this._e!=null&&this.q!=null?{x:this.q.x-this._e.x,y:this.q.y-this._e.y}:{x:0,y:0}}mark(e){this._e=this.manager.positionGetter(this.E),this.qe=this.manager.getSize(this.E),L(this.E,this.manager.css.drag),this.ga=this.manager.getParentConstrainingRectangle(this.E),this.To=0,this.vo=0}unmark(e){this.ti&&this.ri(this.Ae,this.E)?(this.Cc={x:this.E.offsetLeft-this.To,y:this.E.offsetTop-this.vo},this.E.parentNode.removeChild(this.E),this.E=this.Ae):this.Cc=null,F(this.E,this.manager.css.drag),this.ti=!1}moveBy(e,t,n){let o=this.toGrid({x:this._e.x+e,y:this._e.y+t}),s=this.SA(o,this.E,this.ga,this.qe,{x:this._e.x,y:this._e.y},n);if(s!=null){if(this.ri(this.el,this.E))if(o.x!==s.x||o.y!==s.y){if(!this.ti){let a=this.Pc(this.Ae);L(a,HP.ghostProxy),this.ma?(this.ma.appendChild(a),this.ua=Ki(this.Ae.parentNode),this.pa=Ki(this.ma),this.To=this.ua.x-this.pa.x,this.vo=this.ua.y-this.pa.y):this.Ae.parentNode.appendChild(a),this.E=a,this.ti=!0}s=o}else this.ti&&(this.E.parentNode.removeChild(this.E),this.E=this.Ae,this.ti=!1,this.ua=null,this.pa=null,this.To=0,this.vo=0);this.manager.positionSetter(this.E,{x:s.x+this.To,y:s.y+this.vo}),this.Ea(JP,{el:this.el,pos:s,e:n,drag:this,size:this.qe,originalPos:this._e,viewport:this.ga})}}abort(){this.q!=null&&this.Tr()}getDragElement(e){return e?this.Ae||this.el:this.E||this.el}stop(e,t){if(t||this.Tt){let n=[],o=this.manager.positionGetter(this.E);n.push([this.E,o,this,this.qe]),this.Ea(KP,{el:this.E,pos:this.Cc||o,finalPos:o,e,drag:this,selection:n,size:this.qe,originalPos:{x:this._e.x,y:this._e.y},viewport:this.ga})}else this.Tt||this.$.dragAbort&&this.$.dragAbort(this.Ae)}Ea(e,t){let n=null;if(this.$&&this.$[e])n=this.$[e](t);else if(this.listeners[e])for(let o=0;o<this.listeners[e].length;o++)try{let s=this.listeners[e][o](t);s!=null&&(n=s)}catch(s){}return n}resolveGrid(){let e={grid:null,thresholdX:_$/2,thresholdY:O$/2};return this.$!=null&&this.$.grid!=null&&(e.grid=this.$.grid,this.$.snapThreshold!=null&&(e.thresholdX=this.$.snapThreshold,e.thresholdY=this.$.snapThreshold)),e}toGrid(e){let{grid:t,thresholdX:n,thresholdY:o}=this.resolveGrid();if(t==null)return e;{let s=t?t.width/2:n,a=t?t.height/2:o;return he(e,t,s,a)}}setUseGhostProxy(e){this.ri=e?jP:R$}SA(e,t,n,o,s,a){return this.$!=null&&this.$.constrainFunction&&typeof this.$.constrainFunction=="function"?this.$.constrainFunction(e,t,n,o,s,a):e}fc(e){for(let t in this.Po){let n=this.Po[t],o=n[0](e);if(n[1]&&(o=!o),!o)return!1}return!0}addFilter(e,t){if(e){let n=v$(e);this.Po[n]=[o=>{let s=o.srcElement||o.target,a;return X(e)?a=$t(s,e,this.el):typeof e=="function"&&(a=e(o,this.el)),a},t!==!1]}}removeFilter(e){let t=typeof e=="function"?e.Ao:e;delete this.Po[t]}clearAllFilters(){this.Po={}}addSelector(e,t){e.selector&&(t?this.Co.unshift(e):this.Co.push(e))}destroy(){this.eventManager.off(this.el,ge,this.downListener),this.eventManager.off(document,ae,this.moveListener),this.eventManager.off(document,le,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,this.scrollTracker!=null&&document.removeEventListener("scroll",this.scrollTracker)}},D$=["input","textarea","select","button","option"],N$=D$.join(","),fg=class{constructor(r){c(this,"eventManager");c(this,"zoom",1);c(this,"css",{});c(this,"inputFilterSelector");c(this,"positionGetter");c(this,"getSize");c(this,"positionSetter");this.inputFilterSelector=r.inputFilterSelector||N$,this.eventManager=new ye,this.zoom=r.zoom||1,this.positionGetter=r.positionGetter,this.getSize=r.getSize,this.positionSetter=r.positionSetter;let e=r.css||{};Object.assign(this.css,e)}getParentConstrainingRectangle(r){let e=r.parentNode;if(e==null)return{width:0,height:0};{let t=e.scrollLeft!=null?e.scrollLeft:0,n=e.scrollTop!=null?e.scrollTop:0,o=this.getSize(e);return{width:o.width+t,height:o.height+n}}}TA(r){r=r||{};let e={events:{}},t;for(Object.assign(e,r),t=0;t<Yw.length;t++){let n=Yw[t];e.events[n]=r[n]||L$}return e}getInputFilterSelector(){return this.inputFilterSelector}setInputFilterSelector(r){return this.inputFilterSelector=r,this}draggable(r,e){if(r.Oo==null){let t=this.TA(e),n=new Hy(r,t,this);return L(r,HP.delegatedDraggable),r.Oo=n,n}else return r.Oo}destroyDraggable(r){r.Oo&&(r.Oo.destroy(),delete r.Oo)}};var Zw=15,Jw=10,Kw="markers",qw="lineStyle",Qw="sourceArrow",eD="targetArrow",tD="bothArrows",rD="plain",nD="dashed";function I$(i){let r=(i==null?void 0:i.arrowWidth)||Zw,e=(i==null?void 0:i.arrowLength)||Jw,t=(i==null?void 0:i.lineStyleProperty)||qw,n=(i==null?void 0:i.markersProperty)||Kw;return[{property:t,mappings:{[rD]:{},[nD]:{dashArray:"2"}}},{property:n,mappings:{noArrows:{overlays:[]},[Qw]:{overlays:[{type:Or.type,options:{location:0,direction:-1,width:r,length:e}}]},[eD]:{overlays:[{type:Or.type,options:{location:1,width:r,length:e}}]},[tD]:{overlays:[{type:Or.type,options:{location:1,width:r,length:e}},{type:Or.type,options:{location:0,direction:-1,width:r,length:e}}]}}}]}var QP={set:function(i,r){localStorage.setItem(i,r)},get:function(i){return localStorage.getItem(i)},clear:function(i){localStorage.removeItem(i)},clearAll:function(){for(;localStorage.length>0;){let i=localStorage.key(0);localStorage.removeItem(i)}},setJSON:function(i,r){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot store value.");QP.set(i,JSON.stringify(r))},getJSON:function(i){if(typeof JSON=="undefined")throw new TypeError("JSON undefined. Cannot retrieve value.");return JSON.parse(QP.get(i))}};var e_=class{constructor(r,e){c(this,"collicat");c(this,"drags",[]);this.collicat=new fg({positionGetter:o=>gn(o),positionSetter:(o,s)=>er(o,s),getSize:o=>Ze(o)}),e=e||{};let t={selector:"."};t.filter=e.filter,t.constrainFunction=e.constrain,t.constrainFunction==null&&e.containment!=null&&(t.constrainFunction=qP(e.containment,e.containmentPadding)),(Array.isArray(r)?r:[r]).forEach(o=>{let s=this.collicat.draggable(o,{});s.addSelector(t),this.drags.push([s,o])})}destroy(){this.drags.forEach(r=>this.collicat.destroyDraggable(r[1])),this.collicat=null,this.drags.length=0}};function M$(i){iD?i():t_.push(i)}var t_=[],iD=!1,ky=()=>{iD=!0;for(let i=0;i<t_.length;i++)t_[i]()},r_=class{constructor(r){this.templateHolder=r;c(this,"c",0)}Yg(){this.c--,this.c<=0&&ky()}add(r){this.c++,ca({url:r,success:e=>{let t=this.templateHolder.innerHTML;t+=e,this.templateHolder.innerHTML=t,this.Yg()},error:e=>{this.Yg()}})}ensureNotEmpty(){this.c<=0&&ky()}},oD="_vjs_templates",V$=()=>{let i=function(){if(typeof document!="undefined")if(/complete|loaded|interactive/.test(document.readyState)&&typeof document.body!="undefined"&&document.body!=null){let r=document.getElementById(oD);if(r)ky();else{r=document.createElement("div"),r.style.display="none",r.id=oD,document.body.appendChild(r);let e=new r_(r),t=document.getElementsByTagName("script");for(let n=0;n<t.length;n++){let o=t[n].getAttribute("type"),s=t[n].getAttribute("src");o=="text/x-vjs-templates"&&e.add(s)}e.ensureNotEmpty()}}else setTimeout(i,9);else ky()};i()};V$();var sD="vjs-test-support-container",G$=1e-11;function aD(){let i=document.getElementById(sD);return i==null&&(i=document.createElement("div"),i.id=sD,document.body.appendChild(i)),i}var yg=[],$$=[];function Wy(i,r,e,t){let n=document.createElement("div");n.style.position="absolute",r?r.appendChild(n):aD().appendChild(n),n.setAttribute("id",i),e&&(n.className=e),n.style.left=Math.floor(Math.random()*1e3)+"px",n.style.top=Math.floor(Math.random()*1e3)+"px",yg.push({id:i,el:n}),t=t||{};for(let o in t)n.style[o]=t[o];return n}function B$(i,r){for(let e=0;e<i.length;e++)Wy(i[e],r)}function F$(i){i=i.length==null&&typeof i!="string"?[i]:i;for(let r=0;r<i.length;r++){let e=typeof i[r]=="string"?document.getElementById(i[r]):i[r];e.parentNode&&e.parentNode.removeChild(e)}}function xg(i){F$(document.querySelectorAll(i))}function U$(){for(let i=0;i<yg.length;i++)yg[i].el.parentNode.removeChild(yg[i].el);yg.length=0,xg("circle"),xg(".vjs-node"),xg(".vjs-surface-canvas"),xg("svg"),xg(".vjs-lasso"),aD().innerHTML=""}function Y$(i,r,e){return i=typeof i=="string"?parseFloat(i.substring(0,i.length-2)):i,r=typeof r=="string"?parseFloat(r.substring(0,r.length-2)):r,Math.abs(r-i)<(e||5e-4)}function Es(i){return i.connector.canvas}function Yt(i,r,e){let t=e==null?.5:e.x,n=e==null?.5:e.y,o=i===document?i.documentElement.getBoundingClientRect():i.getBoundingClientRect(),s=o.x+o.width*t,a=o.y+o.height*n;return Ar(s,a,r)}function n_(i,r,e,t){let n=i===document?{x:0,y:0,width:document.body.clientWidth,height:document.body.clientHeight}:i.getBoundingClientRect();return Ar(n.x+r,n.y+e,t)}function lD(i,r,e,t){let n={clientX:i.clientX+r,clientY:i.clientY+e,screenX:i.screenX+r,screenY:i.screenY+e,pageX:i.pageX+r,pageY:i.pageY+e};return Object.assign(n,t||{}),n}var Zy={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4};function z$(){let i=parseInt(""+Math.random()*2e3),r=parseInt(""+Math.random()*2e3);return Ar(i,r)}function hD(i,r,e){let t=i;e=e||{},e.start&&e.start(),en(i,r),e.down&&e.down();let n=Math.random()*50;for(let o=0;o<n;o++){let s=z$();r.style.left=s.screenX+"px",r.style.top=s.screenY+"px",t.trigger(document,"mousemove",s)}e.move&&e.move(),t.trigger(document,"mouseup",Zy),e.up&&e.up()}function cD(i,r,e=!0,t){let n=i.getRenderedConnection(r.id),o=e?".vjs-connector-source-drag":".vjs-connector-target-drag",s=n.connector.canvas.querySelector(o);en(i,s);let a=Zy;if(t!=null){let l=i.toPageLocation(t.x,t.y);a=Ar(l.x,l.y)}return i.trigger(document,"mousemove",a),i.trigger(document,"mouseup",a),i.fromPageLocation(a.pageX,a.pageY)}function dD(i,r,e,t){let n=Wy("div");return n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width=(e&&e.width?e.width:1500)+"px",n.style.height=(e&&e.height?e.height:1500)+"px",{surface:i.render(n,r,t),container:n}}function X$(i,r,e,t){let n=fn(i),o,s;if(r!=null){let l=dD(n,r,e,t);s=l.container,o=l.surface}let a={model:n,surface:o,container:s};return $$.push(a),a}function j$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);i.surface.trigger(t.querySelector("path"),"click",n)}function H$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);i.surface.trigger(t.querySelector("path"),"dblclick",n)}function k$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);var o=t.querySelector("path");i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n)}function W$(i,r){let e=i.surface.getRenderedConnection(r),t=Es(e),n=Yt(t);var o=t.querySelector("path");i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n),i.surface.trigger(o,ge,n),i.surface.trigger(o,"mouseup",n)}function bg(i,r,e){let t=i.surface.getRenderedConnection(r),n=Es(t),o=Yt(n);i.surface.trigger(n.querySelector("path"),e,o)}function i_(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);tc(i.surface,t,1,1)}function Ag(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);en(i.surface,t,1),rc(i.surface,t,1)}function Z$(i,r,e){Jy(i,r,yn,1,e)}function J$(i,r,e){Jy(i,r,"mouseover",1,e)}function K$(i,r,e){Jy(i,r,"mouseout",1,e)}function Jy(i,r,e,t=1,n){let o=i.model.getVertex(r),s=i.surface.getRenderedElement(o);nc(i.surface,s,e,t,n)}function tc(i,r,e=1,t=1){let n=Yt(r),o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,t,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(o)}function uD(i,r,e=1){let t=Yt(r),n=document.createEvent("MouseEvents");n.initMouseEvent("dblclick",!0,!0,window,2,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,e,null),r.dispatchEvent(n)}function en(i,r,e=1,t){nc(i,r,fs,e,t)}function rc(i,r,e=1,t){nc(i,r,Hn,e,t)}function nc(i,r,e,t=1,n){let o=Yt(r,null,n),s=document.createEvent("MouseEvents");s.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,t||1,null),r.dispatchEvent(s)}function Sg(i,r,e,t,n=1){let o=Ar(e.x,e.y);t=t||{};let s=document.createEvent("MouseEvents");s.initMouseEvent(r,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,n||1,null),i.dispatchEvent(s)}function q$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);tc(i.surface,t,2,1)}function Q$(i,r){let e=i.model.getVertex(r),t=i.surface.getRenderedElement(e);uD(i.surface,t,1)}function eB(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");tc(i.surface,o,1,1)}function tB(i,r){tc(i.surface,r,1,1)}function rB(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");uD(i.surface,o,1)}function pD(i,r){en(i.surface,r),rc(i.surface,r)}function nB(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");pD(i,o)}function iB(i,r,e){let t=i.model.getVertex(r),o=i.surface.getRenderedElement(t).querySelector(e);if(!o)throw new Error("could not find element inside node with selector ["+e+"]");en(i.surface,o),rc(i.surface,o),en(i.surface,o),rc(i.surface,o)}function oB(i,r,e){let t=i.surface.getRenderedConnection(r),n=ZE(t,e||"lbl");tc(i.surface,n.contentElements[0],1,1)}function sB(i,r,e){let t=i.model.getNode(r),o=i.surface.getRenderedElement(t).querySelector(di(hn,e));o&&tc(i.surface,o,1,1)}function o_(i,r,e,t,n,o){t=t||{};let s=i,a;qi(e)?a=Yt(e,null,n):a=n_(i.$getCanvasElement(),e.x,e.y);let l=i.model.getAllEdges().length;t.start&&t.start(),en(i,r),t.down&&t.down();let h=Object.values(i.$_connMap).find(u=>u.edge.transient);if(h!=null&&s.trigger(Es(h).childNodes[0],st,a),s.trigger(document,yn,a),t.move){let u=i.model.getAllEdges().filter(g=>g.transient)[0],p=u?i.getRenderedConnection(u.id):null;t.move(p)}let d=()=>{s.trigger(document,Hn,a);let u=i.model.getAllEdges()[l],p=u?i.getRenderedConnection(u.id):null;return t.up&&t.up(p),p};if(o)o(d);else return d()}function aB(i,r,e){e=e||{};let t=i;e.start&&e.start(),en(i,r),e.down&&e.down(),t.trigger(document,yn,Zy),t.trigger(document,Hn,Zy)}function gD(i,r,e,t,n,o,s){let a=i.getObjectInfo(t,!1);if(a.el){n=n||{};let l=i.getRenderedConnection(r.id),h=e?".vjs-connector-source-drag":".vjs-connector-target-drag",d=l.connector.canvas.querySelector(h);n.start&&n.start(),en(i,d),n.down&&n.down();let u=Yt(a.el,null,o);i.trigger(document,"mousemove",u),n.move&&n.move(),s!=null?s(()=>{i.trigger(document,"mouseup",u),n.up&&n.up(l)}):(i.trigger(document,"mouseup",u),n.up&&n.up(l))}else throw`Cannot resolve drag element ${t}`}function s_(i,r,e,t,n){n=n||{},r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let o=i,s=Yt(r);o.trigger(r,fs,s),n.afterDown&&n.afterDown();let a=r.getBoundingClientRect(),l=Ar(e+a.width/2,t+a.height/2);o.trigger(document,yn,l),n.afterMove&&n.afterMove(),o.trigger(document,le,l),n.afterUp&&n.afterUp()}function a_(i,r,e,t,n,o){r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild);let s=i.jsplumb?i.jsplumb:i,a=Yt(r,o);s.trigger(r,fs,a),n&&n.afterDown&&n.afterDown(),s.trigger(document,yn,lD(a,e,t,o)),n&&n.afterMove&&n.afterMove(),s.trigger(document,Hn,null),n&&n.afterUp&&n.afterUp()}function mD(i,r,e,t,n,o,s){let a=i;r.tagName.toUpperCase()==="G"&&(r=r.firstElementChild),n=n||3;let l=e/n,h=t/n,d=l,u=h,p=Yt(r,s);a.trigger(r,fs,p),o&&o.afterDown&&o.afterDown();for(let g=0;g<n;g++)a.trigger(document,yn,lD(p,d,u,s)),o&&o.afterMove&&o.afterMove(g),d+=l,u+=h;a.trigger(document,Hn),o&&o.afterUp&&o.afterUp()}var lB=typeof document!="undefined",Ky=lB?"ontouchstart"in document.documentElement:!1,fs=Ky?"touchstart":"mousedown",yn=Ky?"touchmove":"mousemove",Hn=Ky?"touchend":"mouseup";function Ar(i,r,e){return Object.assign({clientX:i,clientY:r,screenX:i,screenY:r,pageX:i,pageY:r},e||{})}function ED(i,r,e){return i.clientX+=r,i.clientY+=e,i.screenX+=r,i.screenY+=e,i.pageX+=r,i.pageY+=e,i}function fD(i,r,e,t,n,o,s){let l=i.vertexLayer.parentElement.parentElement;n!=null&&(l=i.getRenderedElement(n)),l_(i,l,r,e,t,o,s)}function l_(i,r,e,t,n,o,s){n&&n.start&&n.start();let a=i.toPageLocation(e.x,e.y),l=i.toPageLocation(t.x,t.y);a.x-=window.scrollX,l.x-=window.scrollX,a.y-=window.scrollY,l.y-=window.scrollY,Sg(r,fs,a,o),n&&n.down&&n.down(),Sg(document,yn,l,o),n&&n.move&&n.move(),s?s(()=>{Sg(document,Hn,l,o),n&&n.up&&n.up()}):(Sg(document,Hn,l,o),n&&n.up&&n.up())}var bi={addDiv:Wy,addDivs:B$,cleanup:U$,delta:Y$,DOWN_EVENT:fs,UP_EVENT:Hn,MOVE_EVENT:yn,isTouchDevice:Ky,makeEvent:Yt,makeEventAt:Ar,nudgeEvent:ED,getEdgeCanvas:Es,defaultEventManager:new ye,createMouseEventWithPageLoc:Sg,dragElementBy:(i,r,e,t)=>{a_(bi.defaultEventManager,i,r,e,t)},attachToSurface:i=>new Tg(i.model,i),create:(i,r,e,t)=>{let n=X$(i,r,e,t);return new Tg(n.model,n.surface)},trigger:(i,r,e,t,n)=>{i.trigger(r,e,{pageX:t,pageY:n,screenX:t,screenY:n,clientX:t,clientY:n})},getTransform:i=>{let r=parseFloat(i.style.transform.match(/translateX\(([0-9\.]+)px/)[1]),e=parseFloat(i.style.transform.match(/translateY\(([0-9\.]+)px/)[1]),t=parseFloat(i.style.transform.match(/scale\(([0-9\.]+)/)[1]);return{translateX:r,translateY:e,scale:t}},lasso:fD,lassoOnElement:l_,withinTolerance:(i,r,e)=>Math.abs(i-r)<=e};typeof window!="undefined"&&(window.VisuallyJsTestSupport=bi);function yD(i,r,e,t,n,o){let s=i.getEffectiveVisibleZoom();o=o||{};let a=e.getBoundingClientRect(),l=Ar(a.x+a.width+s*t,a.y+a.height+s*n),h=i.model.getAllEdges().length;o.start&&o.start(),en(i,r),o.down&&o.down(),i.trigger(document,yn,l),o.move&&o.move(),i.trigger(document,Hn,l),o.up&&o.up();let d=i.model.getAllEdges()[h];return d?i.getRenderedConnection(d.id):null}var Tg=class{constructor(r,e){this.model=r;c(this,"eventManager");c(this,"surface");c(this,"undoManager");c(this,"_c");c(this,"consoleOutput","");this.eventManager=new ye,this.surface=e}get container(){return this.surface!=null?this.surface.getContainer():null}get canvas(){return this.surface!=null?this.surface.$getCanvasElement():null}get edgePathEditor(){return this._c==null&&(this._c=new Aa(this.surface)),this._c}destroy(){this.surface.destroy()}startEditing(r,e){this.edgePathEditor.startEditing(r,e)}stopEditing(){this.edgePathEditor.stopEditing()}render(r,e){let t=dD(this.model,r,e);return this.surface=t.surface,this.surface}querySelectorAll(r){return this.container.querySelectorAll(r)}querySelector(r){return this.container.querySelector(r)}dragANodeAround(r,e){hD(this.surface,this.surface.getObjectInfo(r,!1).el,e)}dragAnElementAround(r){hD(this.surface,r)}load(r){return this.model.load(r)}getEdgeCanvas(r){let e=this.surface.getRenderedConnection(r.id);return Es(e)}withConsole(r){let e=console.log;console.log=function(t){this.consoleOutput=t}.bind(this);try{r()}catch(t){e("An exception was thrown while running a function with the console log captured",t)}console.log=e}clear(){return this.model.clear()}getRenderedElement(r){return this.surface.getObjectInfo(r,!1).el}getRenderedConnection(r){return this.surface.getRenderedConnection(r)}dragVertexIntoGroup(r,e){let t=this.surface.getObjectInfo(r,!1),n=this.surface.getObjectInfo(e,!1);if(t.el&&n.el){let o=this.surface.$getGroupContentAreaElement(n.el).getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x+o.width/2-s.width/2,l=o.y+o.height/2-s.height/2;s_(this.surface,t.el,a,l)}}dragVertexOutOfGroup(r,e){let t=this.surface.getObjectInfo(r,!1);if(t.el&&t.managedElement.modelObject.group!=null){let n=this.surface.getObjectInfo(t.managedElement.modelObject.group,!1);if(n.el){let o=n.el.getBoundingClientRect(),s=t.el.getBoundingClientRect(),a=o.x-50-s.width,l=o.y-50-s.height;s_(this.surface,t.el,a,l)}}}getGroup(r){return this.getModelObject(r)}getNode(r){return this.getModelObject(r)}getModelObject(r){return this.surface.getObjectInfo(r,!1).obj}dragVertexTo(r,e,t,n){let o=this.surface.toPageLocation(e,t);this.dragVertexToPageLocation(r,o.x,o.y,n)}dragVertexToPageLocation(r,e,t,n){let o=this.surface.getObjectInfo(r,!1);if(o.el)s_(this.surface,o.el,e,t,n);else throw new Error("Cannot drag node: cannot resolve "+r)}dragVertexBy(r,e,t,n,o){let s=this.surface.panZoom.getCompoundZoom();this.dragVertexByPageDelta(r,e*s,t*s,n,o)}dragVertexByPageDelta(r,e,t,n,o){let s=this.surface.getObjectInfo(r,!1);if(s.el)a_(this.surface,s.el,e,t,n,o);else throw new Error("Cannot drag vertex: cannot resolve "+r)}dragElementBy(r,e,t,n,o){a_(this.surface,r,e,t,n,o)}dragElementByInStages(r,e,t,n,o,s){mD(this.surface,r,e,t,n,o,s)}dragVertexByInStages(r,e,t,n,o,s){let a=this.surface.getObjectInfo(r,!1);if(a.el)mD(this.surface,a.el,e,t,n,o,s);else throw new Error("Cannot drag vertex: cannot resolve "+r)}connect(r,e,t,n){let o=this.surface.getObjectInfo(r,!1),s=this.surface.getObjectInfo(e,!1);return this.model.$_addEdge({source:o.obj,target:s.obj,data:t||{}},n||yo,null)}ni(r){let e;if(DT(r))e=r;else{let t=Array.isArray(r)?r[0]:r;e=this.surface.getRenderedElement(t),Array.isArray(r)&&(e=e.querySelector(r[1]))}return e}Xg(r,e){return{sourceEl:this.ni(r),targetEl:this.ni(e)}}dragConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.Xg(r,e);return o_(this.surface,s,a,t,n,o)}dragAndAbortConnection(r){aB(this.surface,this.ni(r))}dragSnapConnection(r,e,t,n,o){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let{sourceEl:s,targetEl:a}=this.Xg(r,e);return yD(this.surface,s,a,t,n,o)}dragDetachedConnection(r,e,t){if(r==null)throw"Source for connection drag is null";if(e==null)throw"Target for connection drag is null";let n=this.ni(r);return o_(this.surface,n,e,t)}dragDiagramConnection(r,e,t){this.surface.model.setSelection(r);let n=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),o=this.ni(e);return o_(this.surface,n,o,t,null)}dragDiagramSnapConnection(r,e,t,n,o){this.surface.model.setSelection(r);let s=this.surface.getContainer().querySelector(`.vjs-resize-skeleton[data-vjs-vertex='${r}'] .vjs-link-cell`),a=this.ni(e);return yD(this.surface,s,a,t,n,o)}detachEdge(r,e){return this.detachEdgeBySource(r,e)}detachEdgeBySource(r,e){return cD(this.surface,r,!0,e)}detachEdgeByTarget(r,e){return cD(this.surface,r,!1,e)}relocateEdgeTarget(r,e,t,n,o){gD(this.surface,r,!1,e,t,n,o)}relocateEdgeSource(r,e,t,n,o){gD(this.surface,r,!0,e,t,n,o)}trigger(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el)t=t||Yt(n.el),this.surface.trigger(n.el,e,t);else throw new Error("Trigger: Cannot resolve "+r)}triggerEventOnElement(r,e,t,n,o){this.triggerEvent(r,e,t,n,o)}triggerEvent(r,e,t,n,o){let s=n!=null&&o!=null?n_(r,n,o,t):Yt(r,t);this.surface.trigger(r,e,s)}triggerEventAt(r,e,t,n,o){let s=n_(r,t,n,o);this.surface.trigger(r,e,s)}makeEvent(r,e,t){let n=this.surface.getObjectInfo(r,!1);if(n.el){let o=Yt(n.el);return e||t?ED(o,e==null?0:e,t==null?0:t):o}else throw new Error("Trigger: Cannot resolve "+r)}makeEventAt(r,e){return Ar(r,e)}getEdge(r){return this.model.getEdge(r)}updateEdge(r,e){this.model.updateEdge(r,e)}getAllEdges(){return this.model.getAllEdges()}getRenderedPort(r){return this.surface.getRenderedPort(r)}addNode(r){return this.model.addNode(r)}updateNode(r,e){return this.model.updateNode(r,e)}addGroup(r){return this.model.addGroup(r)}updateGroup(r,e){this.model.updateGroup(r,e)}updateVertex(r,e){this.model.updateVertex(r,e)}clickOnGroup(r){i_(this,r)}clickOnNode(r){i_(this,r)}clickOnVertex(r){i_(this,r)}dblClickOnVertex(r){Q$(this,r)}rightClickOnVertex(r){q$(this,r)}tapOnVertex(r){Ag(this,r)}tapOnNode(r){Ag(this,r)}tapOnGroup(r){Ag(this,r)}dblTapOnVertex(r){Ag(this,r),Ag(this,r)}dblTapOnNode(r){this.dblTapOnVertex(r)}dblTapOnGroup(r){this.dblTapOnVertex(r)}mousemoveOnVertex(r,e){Z$(this,r,e)}mouseoverOnVertex(r,e){J$(this,r,e)}mouseoutOnVertex(r,e){K$(this,r,e)}contextmenuOnVertex(r,e){Jy(this,r,At,3,e)}clickOnCanvas(r=1,e=1){for(let t=0;t<r;t++)en(this.surface,this.canvas,e),rc(this.surface,this.canvas,e)}clickOnCanvasAt(r,e,t=1){en(this.surface,this.canvas,t,{x:r,y:e}),rc(this.surface,this.canvas,t,{x:r,y:e})}mousemoveOnCanvasAt(r,e){nc(this.surface,this.canvas,yn,1,{x:r,y:e})}mousedownOnCanvasAt(r,e){nc(this.surface,this.canvas.parentNode,fs,1,{x:r,y:e})}mouseupOnCanvasAt(r,e){nc(this.surface,this.canvas,Hn,1,{x:r,y:e})}lasso(r,e,t){fD(this.surface,r,e,t)}lassoOnElement(r,e,t,n){l_(this.surface,r,e,t,n)}rightClickOnCanvas(r=1){this.clickOnCanvas(r,2)}clickOnElement(r){tB(this,r)}clickOnElementInsideVertex(r,e){eB(this,r,e)}dblClickOnElementInsideVertex(r,e){rB(this,r,e)}tapOnElement(r){pD(this,r)}tapOnElementInsideVertex(r,e){nB(this,r,e)}dblTapOnElementInsideVertex(r,e){iB(this,r,e)}mousedownOnElement(r){en(this.surface,r)}clickOnEdge(r){j$(this,r)}dblClickOnEdge(r){H$(this,r)}tapOnEdge(r){let e=nt(r)?r.id:r;k$(this,e)}dblTapOnEdge(r){let e=nt(r)?r.id:r;W$(this,e)}jg(r,e,t,n){n=n||{};let o=n.events||{},s=n.zoom==null?1:n.zoom,a=n.x||90,l=n.y||90,h=r.source.querySelector(e),d=n.targetElement||this.surface.getContainer();var u=h.getBoundingClientRect(),p=d.getBoundingClientRect(),g=p.x,m=p.y,E=u.x+u.width/2,y=u.y+u.height/2,x=(g+13)*s,f=(m+13)*s,b=g+a*s+u.width/2,A=m+l*s+u.height/2;o.beforeDown&&o.beforeDown();let T=Ar(E,y);this.surface.trigger(h,bi.DOWN_EVENT,T),t&&this.surface.trigger(h,bi.UP_EVENT,T),o.beforeMove&&o.beforeMove(),this.surface.trigger(d,bi.MOVE_EVENT,Ar(x,f));let S=Ar(b,A);if(this.surface.trigger(d,bi.MOVE_EVENT,S),o.beforeUp&&o.beforeUp(),t){let O=document.querySelector(".vjs-palette-tap-mode-placeholder");this.surface.trigger(O,bi.DOWN_EVENT,S),this.surface.trigger(O,bi.UP_EVENT,S)}else this.surface.trigger(d,bi.UP_EVENT,S);o.after&&o.after()}dragFromPalette(r,e,t){this.jg(r,e,!1,t)}tapFromPalette(r,e,t){this.jg(r,e,!0,t)}mousedownOnEdge(r){bg(this,r,ge)}mouseupOnEdge(r){bg(this,r,le)}mouseoverOnEdge(r){bg(this,r,st)}mouseoutOnEdge(r){bg(this,r,ot)}contextmenuOnEdge(r){bg(this,r,At)}clickOnOverlay(r,e){oB(this,r,e)}clickOnPort(r,e){sB(this,r,e)}getEdgeCount(){return this.model.getEdgeCount()}dragElementToCanvas(r,e,t){e=e||250,t=t||250;let n=this.surface.panZoom.getApparentCanvasLocation(),o=this.surface.getContainer().parentNode.getBoundingClientRect(),s=o.x+n.x,a=o.y+n.y,l=Yt(r);this.eventManager.trigger(r,fs,l);let h=this.surface.$getSize(r),d=this.surface.getContainer().parentNode,u=r.getBoundingClientRect();this.eventManager.trigger(d,yn,Ar(u.x+1,u.y+1)),this.eventManager.trigger(d,yn,Ar(e+s+h.width/2,t+a+h.height/2)),this.eventManager.trigger(d,Hn,Ar(e+s+h.width/2,t+a+h.height/2))}addMiniview(r){let e=r||{},t=Wy("div");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=(e.width?e.width:250)+"px",t.style.height=(e.height?e.height:250)+"px",e.container=t,this.surface.addPlugin({type:"miniview",options:e})}getDOMPosition(r){let e=this.surface.getRenderedElement(r);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10)}}isAtPosition(r,e,t){let n=this.surface.getRenderedElement(r),o={x:parseInt(n.style.left,10),y:parseInt(n.style.top,10)};return e===o.x&&t===o.y}attachAnimator(){return new sg(this.surface)}within(r,e,t,n){t(Math.abs(r-e)<G$,n+"[expected: "+e+" got "+r+"] [diff:"+Math.abs(r-e)+"]")}};var h_="vjs-chart-background",Ga="vjs-chart-plot-background",ic="vjs-chart-body",c_="vjs-chart-series",d_="vjs-chart-legend",vg="vjs-chart-legend-item",u_="vjs-chart-legend-label",p_="vjs-chart-legend-dot",$a="vjs-chart-axis",Cg="vjs-chart-x-axis",Pg="vjs-chart-y-axis",qy="vjs-chart-axis-labels",Qy="vjs-chart-axis-line",ex="vjs-chart-axis-title",g_="vjs-chart-y-axis-title",m_="vjs-chart-x-axis-title",E_="vjs-column-chart",f_="vjs-column-chart-column",y_="vjs-bar-chart",x_="vjs-bar-chart-bar",xn="vjs-chart-point",_g="vjs-chart-point-hit-area",b_="vjs-bubble-chart",A_="vjs-bubble-chart-point",S_="vjs-scatter-chart",T_="vjs-scatter-chart-point",Og="vjs-area-chart-area",v_="vjs-chart-title",C_="vjs-chart-subtitle",oc="vjs-chart-crosshair",sc="vjs-chart-crosshair-label",P_="vjs-chart-crosshair-value-axis",__="vjs-chart-crosshair-category-axis",tx="vjs-chart-empty",O_="vjs-chart-axis-scale-label",rx="vjs-chart-gridlines",nx="vjs-chart-gridline",R_="vjs-line-chart",L_="vjs-area-chart";var hB=6;function ix(i,r,e,t,n){let o=(Math.floor(Math.abs(r)/e)*e+e)*Math.sign(r),s=i===0?0:(Math.floor(Math.abs(i)/e)*e+e)*Math.sign(i);o<r&&(o+=e),s>i&&(s-=e),n!=null&&o>n&&(o=n),t!=null&&s<t&&(s=t);let a=(o-s)/e;return{maxScale:o,minScale:s,stepCount:a,step:e}}function cB(i){return Math.log10(i)%1===0||i.toExponential().split("e")[0]==="5"?i*2:i*2.5}function dB(i){return Math.log10(i)%1===0?i/2:i.toExponential().split("e")[0]==="5"?i/2.5:i/2}function bD(i,r,e,t,n,o){let s=ix(i,r,e,n,o),a=s.stepCount-t,l=Math.abs(a);if(a>0){let d=cB(s.step),u=ix(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}else if(a<0){let d=dB(s.step),u=ix(i,r,d,n,o);Math.abs(u.stepCount-t)<l&&(s=u)}let h=[];for(let d=s.minScale;d<=s.maxScale;d+=s.step)h.push(d);return Object.assign(s,{steps:h,range:s.maxScale-s.minScale,dataMin:i,dataMax:r})}function ac(i,r,e=hB,t,n){let o=r-i,s=AD(o);return bD(i,r,s,e,t,n)}function w_(i,r,e){let t=[],n=r-i,o=n/e;for(let s=i;s<=r;s+=o)t.push(s);return{dataMin:i,dataMax:r,range:n,steps:t,step:o,stepCount:e,minScale:i,maxScale:r}}function lc(i,r,e){let t=[];for(let n=i;n<=r;n+=e)t.push(n);return{dataMin:i,dataMax:r,range:r-i,steps:t,step:e,stepCount:t.length-1,minScale:i,maxScale:t[t.length-1]}}function AD(i){return Math.pow(10,parseInt(i.toExponential().split("e")[1],10))}function Ai(i,r,e,t,n){return{size:(n==null?void 0:n.size)||i,style:(n==null?void 0:n.style)||r,weight:(n==null?void 0:n.weight)||e,family:(n==null?void 0:n.family)||t}}function k(i,r,e,t){let n=M(i,r||{});return e&&L(n,e),t&&t.appendChild(n),n}function ys(i,r,e,t){let n=k(tt,r,e,t);return n.innerHTML=i,n}function uB(i,r){let e=hh(i);zt(i,r,e.y)}function hc(i,r){let e=hh(i);zt(i,e.x,r)}function zt(i,r,e){i.setAttribute("transform",`translate(${r}, ${e})`)}function bn(i){return i.type==="value"}function D_(i){return i.type==="category"}function cc(){return{x:0,y:0,width:0,height:0}}function ox(i,r){return r==null||r==="int"?Math.round(i).toString():typeof r=="number"?i.toFixed(r):i.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})}function N_(i,r,e,t){let n=()=>{if(i.length===0)return!1;let s=i[0].getBBox();for(let a=1;a<i.length;a++){let l=i[a].getBBox();if(rt(s,l))return!0;s=l}},o=s=>{i.forEach(a=>{a.setAttribute("text-anchor","end"),a.setAttribute("dominant-baseline","middle");let l=a.getBBox(),h={x:l.x+l.width,y:l.y-l.height};a.setAttribute("transform",`rotate(${s}, ${h.x}, ${h.y})`);let d=a.getBBox();if(d[t]>r){let u=r/d[t];a.textContent=a.textContent.substring(0,Math.floor(u*a.textContent.length))+"..."}})};if(n())return o(-45),!0}function xD(i){return`color(from color(from ${i} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1)) srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`}function Rg(i,r,e,t,n,o){let s=M(tt,{x:r,y:e,"text-anchor":"middle","dominant-baseline":"central","font-size":n.size||"0.7rem","font-weight":n.weight||"bold","font-style":n.style||"normal"},{fill:`color(from ${t} srgb clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1) clamp(0, calc(9e9 * (0.5 - (0.2126 * r + 0.7152 * g + 0.0722 * b))), 1))`},"vjs-text-outline");o&&o.appendChild(s);let a=M("tspan",{fill:xD(t),stroke:xD(t),"stroke-width":2,"stroke-linejoin":"round"},{});a.innerHTML=i;let l=M("tspan",{x:`${r}`,dy:"0"});return l.innerHTML="​",a.appendChild(l),s.appendChild(a),s.insertAdjacentText("beforeend",i),s}function sx(i,r,e){let t=i.container.querySelector("svg"),n=window.getComputedStyle(t),o=Array.from(t.querySelectorAll(".vjs-text-outline"));o.forEach(E=>{let y=window.getComputedStyle(E),x=E.querySelector("tspan"),f=window.getComputedStyle(x);E.setAttribute("data-vjs-export-fill",y.fill),E.setAttribute("data-vjs-export-stroke",y.stroke),x.setAttribute("data-vjs-export-fill",f.fill),x.setAttribute("data-vjs-export-stroke",f.stroke)});let s=t.cloneNode(!0),a=s.getAttribute("viewBox"),l;if(a){let E=a.split(" ").map(y=>parseFloat(y));l={x:E[0],y:E[1],width:E[2],height:E[3]}}else l={x:0,y:0,width:parseFloat(s.getAttribute("width")||"0"),height:parseFloat(s.getAttribute("height")||"0")};Array.from(s.attributes).forEach(E=>s.removeAttribute(E.name)),s.setAttribute("xmlns",Gt),s.removeAttribute("class"),s.setAttribute("font-family",n.fontFamily||"sans-serif"),s.setAttribute("font-size",n.fontSize||"12"),r&&s.setAttribute("width",`${r}`),e&&s.setAttribute("height",`${e}`),pB(s,i.dim.viewBox||{x:0,y:0,width:i.dim.width,height:i.dim.height}),s.querySelectorAll(`.${oc}, .${sc}`).forEach(E=>E.parentNode.removeChild(E));let d=s.querySelector("filter#vjs-tooltip-shadow");if(d){let E=d.parentElement;E.removeChild(d),E.tagName.toLowerCase()==="defs"&&E.children.length===0&&E.parentElement.removeChild(E)}Array.from(s.querySelectorAll(".vjs-text-outline")).forEach(E=>{let y=E.querySelector("tspan");E.setAttribute("fill",E.getAttribute("data-vjs-export-fill")),E.setAttribute("stroke",E.getAttribute("data-vjs-export-stroke")),y.setAttribute("fill",y.getAttribute("data-vjs-export-fill")),y.setAttribute("stroke",y.getAttribute("data-vjs-export-stroke"))}),o.forEach(E=>{E.removeAttribute("data-vjs-export-fill"),E.removeAttribute("data-vjs-export-stroke");let y=E.querySelector("tspan");y.removeAttribute("data-vjs-export-fill"),y.removeAttribute("data-vjs-export-stroke")});let p=Array.from(s.querySelectorAll("*")),g=E=>{Array.from(E.attributes).forEach(x=>{x.name.indexOf("data-vjs-")===0&&E.removeAttribute(x.name)}),E.removeAttribute("class"),E.removeAttribute("style"),E.removeAttribute("pointer-events")};return p.forEach(g),Array.from(s.querySelectorAll("g")).forEach(E=>{E.children.length===0&&E.parentNode.removeChild(E)}),{element:s,extents:l,svg:s.outerHTML.replace(/\n/g,"")}}function pB(i,r){i.setAttribute("viewBox",`${r.x}, ${r.y} ${r.width} ${r.height}`)}var gB="vertical",ax="horizontal",SD=10,lx="left",hx="center",I_="right",dc="top",uc="middle",cx="bottom",Lg=class{constructor(r){c(this,"floating");c(this,"visible");c(this,"hover");c(this,"padding");c(this,"orientation");c(this,"align");c(this,"valign");c(this,"font");c(this,"$hideForSingleSeries");r=r||{},this.floating=r.floating===!0,this.visible=r.hide!==!0,this.hover=r.hover!==!1,this.padding=r.padding||SD,this.orientation=r.orientation||ax,this.align=r.align||hx,this.valign=r.valign||cx,this.$hideForSingleSeries=r.hideForSingleSeries!==!1,this.font=Ai(12,"normal","normal","sans-serif",r.font)}};var wg="chart:load",M_="No data",V_="Could not draw chart";var TD="vjs-chart-exporter-hamburger",mB="vjs-chart-exporter-menu",EB="vjs-chart-exporter-menu-item",vD="vjs-chart-exporter-hamburger-open",Dg=class{constructor(r,e={}){this.chart=r;this.options=e;c(this,"hamburger");c(this,"menu");c(this,"eventManager");c(this,"hideTimeout");c(this,"_o",!1);this.eventManager=new ye,this.eventManager.on(r.container,W,z(TD),t=>{t.stopPropagation(),this._o?this.Rc():this.vA()})}CA(r){let e=this.chart.container;getComputedStyle(e).position==="static"&&(e.style.position="relative"),this.hamburger=qr("div",{width:"30px",height:"30px",cursor:"pointer",display:"flex",flexDirection:"column",justifyContent:"space-around",padding:"5px",boxSizing:"border-box",background:"rgba(255,255,255,0.8)",borderRadius:"4px"},TD),r==null&&(this.hamburger.style.position="absolute",this.hamburger.style.right=this.options.right||"1rem",this.hamburger.style.top=this.options.top||"1rem",this.hamburger.style.zIndex="100");for(let s=0;s<3;s++){let a=qr("div",{width:"100%",height:"2px",backgroundColor:"#333"});this.hamburger.appendChild(a)}this.menu=qr("div",{position:"absolute",display:"none",backgroundColor:"white",border:"1px solid #ccc",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",zIndex:"101",minWidth:"120px",borderRadius:"4px",padding:"5px 0"},mB),[{label:"Download JPG",type:ss},{label:"Download PNG",type:Gh},{label:"Download SVG",type:"svg"}].forEach(s=>{let a=qr("div",{padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#333"},EB);a.innerText=s.label,this.eventManager.on(a,Ye,()=>{this.PA(s.type),this.Rc()}),this.eventManager.on(a,"mouseenter",()=>{a.style.backgroundColor="#f0f0f0"}),this.eventManager.on(a,"mouseleave",()=>{a.style.backgroundColor="transparent"}),this.menu.appendChild(a)}),r!=null?r.appendChild(this.hamburger):e.appendChild(this.hamburger),e.appendChild(this.menu);let n=()=>{this._o&&this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)},o=()=>{this._o&&(n(),this.hideTimeout=setTimeout(()=>{this.Rc(),this.hideTimeout=null},500))};this.eventManager.on(this.hamburger,"mouseenter",()=>{n()}),this.eventManager.on(this.hamburger,"mouseleave",()=>{o()}),this.eventManager.on(this.menu,"mouseenter",()=>{n()}),this.eventManager.on(this.menu,"mouseleave",()=>{o()})}vA(){this.menu.style.display="block",this._o=!0,L(this.hamburger,vD);let r=this.chart.container.getBoundingClientRect(),e=this.hamburger.getBoundingClientRect(),t=e.left-r.left+e.width-this.menu.offsetWidth,n=e.top-r.top+e.height+5;t<0&&(t=0),t+this.menu.offsetWidth>r.width&&(t=r.width-this.menu.offsetWidth),n+this.menu.offsetHeight>r.height&&(n=e.top-r.top-this.menu.offsetHeight-5,n<0&&(n=Math.max(0,r.height-this.menu.offsetHeight))),this.menu.style.left=`${t}px`,this.menu.style.top=`${n}px`}Rc(){this.menu.style.display="none",this._o=!1,F(this.hamburger,vD)}PA(r,e){if(e==null&&(e=(this.chart.getTitle()||"chart-export").toString().toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,30)),r==="svg"){let t=this.chart.exportSVG(),n=new Blob([t],{type:_a.svg});this.kg(n,`${e}.svg`)}else{let t=r===ss?_a.jpeg:_a.png;this.chart.exportImage({type:t,width:1200},n=>{let o=r===ss?"jpg":"png";this.kg(n.url,`${e}.${o}`,!0)})}}kg(r,e,t=!1){let n=document.createElement("a");n.download=e,t?n.href=r:n.href=URL.createObjectURL(r),document.body.appendChild(n),n.click(),document.body.removeChild(n),t||URL.revokeObjectURL(n.href)}destroy(){this.hideTimeout!=null&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.hamburger.parentElement&&this.hamburger.parentElement.removeChild(this.hamburger),this.menu.parentElement&&this.menu.parentElement.removeChild(this.menu)}};var fB="0 0 32 30",yB="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z",CD="0 0 32 32",xB="M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",bB="M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0",AB="vjs-chart-zoom-controls",SB="vjs-chart-zoom-button",dx=class{constructor(r){this.chart=r;c(this,"container");c(this,"eventManager");this.eventManager=new ye}render(r,e){let t=this.chart.container;getComputedStyle(t).position==="static"&&(t.style.position="relative"),e=e||"row",this.container=qr("div",{display:"flex",flexDirection:e},AB),r==null&&(this.container.style.position="absolute",this.container.style.left="1rem",this.container.style.top="1rem",this.container.style.zIndex="100"),[{title:"Zoom In",path:xB,viewBox:CD,onClick:()=>this.chart.setZoom(this.chart.getZoom()+.1)},{title:"Zoom Out",path:bB,viewBox:CD,onClick:()=>this.chart.setZoom(this.chart.getZoom()-.1)},{title:"Zoom to Extents",path:yB,viewBox:fB,onClick:()=>{this.chart.setZoom(1),this.chart.container.scrollLeft=0,this.chart.container.scrollTop=0}}].forEach(o=>{let s=qr("div",{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"3px",boxSizing:"border-box"},SB);s.title=o.title,s.innerHTML=`<svg viewBox="${o.viewBox}" width="100%" height="100%" stroke="currentColor" fill="currentColor">
|
|
135
135
|
<path d="${o.path}" ${o.title!=="Zoom to Extents"?'fill="none" stroke-width="2"':""}/>
|
|
136
|
-
</svg>`,this.eventManager.on(s,Ye,a=>{a.stopPropagation(),o.onClick()}),this.eventManager.on(s,"mouseenter",()=>{s.style.backgroundColor="#f0f0f0"}),this.eventManager.on(s,"mouseleave",()=>{s.style.backgroundColor="transparent"}),this.container.appendChild(s)}),r!=null?r.appendChild(this.container):t.appendChild(this.container)}destroy(){this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container)}};var CD="#FFFFFF",PD="#000000",bB=15,_D=15,AB="middle",SB="left",TB="right",OD="top",dc="bottom",$a="middle",V_="start",G_="end",M_="#AAAAAA",RD=1,LD="#FFFFFFCC";function vB(i){i=i||{};let r=i.backgroundColor||CD;return{gridLineColor:i.gridLineColor||M_,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||M_,legendOutlineWidth:i.legendOutlineWidth||RD,legendBackgroundColor:i.legendBackgroundColor||LD,backgroundColor:r,plotBackgroundColor:i.plotBackgroundColor||r,labelColor:i.labelColor||PD,labelColorGenerator:i.labelColorGenerator}}var co=class extends Ft{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"K",1);c(this,"Cc",[.5,3]);c(this,"Bg",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"$defaultColor");c(this,"$emptyMessage");c(this,"$errorMessage");c(this,"$showTitle");c(this,"$title");c(this,"$showSubtitle");c(this,"$subtitle");c(this,"$titleAlign");c(this,"$subtitleAlign");c(this,"$subtitleFontSize");c(this,"$titlePlacement");c(this,"$titleFillRatio");c(this,"$titleWrap");c(this,"$titleFontSize");c(this,"titlePadding");c(this,"margin");c(this,"legend");c(this,"Pc");c(this,"Oc");c(this,"Fg",!1);c(this,"ma");c(this,"ri");c(this,"Ct");t=t||{},this.Pc=t.width,this.Oc=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new ws:new Zc(this.$defaultColor),this.style=vB(t.style);let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=ar(n)?n:{};this.ma=new Lg(this,d)}if(this.dim={chartX:0,chartY:0,chartWidth:0,chartHeight:0,width:0,height:0,chartEndX:0,chartEndY:0},this.$emptyMessage=t.emptyMessage||N_,this.$errorMessage=I_,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Fg&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||_D,this.$eventManager=new ye,t.title&&t.title.text!=null?(this.$showTitle=!0,this.$title=t.title.text||"",this.$titleAlign=t.title.align||"middle",this.$titleWrap=t.title.wrap!==!1,this.$titleFillRatio=t.title.fillRatio||.9,this.$titleFontSize=((a=t.title.font)==null?void 0:a.size)||20,this.$titlePlacement=t.title.placement||OD):this.$showTitle=!1,t.subtitle&&t.subtitle.text!=null?(this.$showSubtitle=!0,this.$subtitle=t.subtitle.text||"",this.$subtitleAlign=t.subtitle.align||"middle",this.$subtitleFontSize=((l=t.subtitle.font)==null?void 0:l.size)||16):this.$showSubtitle=!1,this.titlePadding=t.titlePadding||bB;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new Og(o),t.zoom&&t.zoom.enabled!==!1&&(this.Bg=!0,this.Cc=t.zoom.range||[.05,3],this.K=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.ri=new cx(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return ox(this,e,t).svg}exportImage(e,t){let n=ox(this,e.width,e.height);ay(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.ri&&this.ri.destroy(),this.Ct&&this.Ct.parentElement&&this.Ct.parentElement.removeChild(this.Ct)}$draw(){this.Fg=!0,this.container.innerHTML="";let e=this.Pc,t=this.Oc;if(e==null||t==null){let n=window.getComputedStyle(this.container);e=e||parseInt(n.width,10),t=t||parseInt(n.height,10)}if(!isNaN(e)&&!isNaN(t)){let n=M(Le,{height:t,width:e,viewBox:`0 0 ${e} ${t}`});this.container.appendChild(n);let o=k(Z,{x:0,y:0,width:e,height:t,"aria-hidden":!0,fill:this.$getBackgroundColor(),"data-z-index":"0"},a_,n);try{this.$drawChart(n,e,t,o)}catch(a){this.$drawErrorMessage(n,e,t,o)}this.hasData()||this.$drawEmptyMessage(n,e,t,o);let s=Array.from(n.childNodes);s.sort((a,l)=>{let h=a.getAttribute("data-z-index")||0,d=l.getAttribute("data-z-index")||0;return h>d?1:h<d?-1:0}),s.forEach(a=>{n.insertBefore(a,n.childNodes[n.childNodes.length])}),wP(n,!0),this.yA()}}yA(){if(this.ma||this.ri){let e="row";this.Ct==null?this.Ct=Jr("div",{position:"absolute",right:"1rem",top:"1rem",display:"flex",flexDirection:e,alignItems:"flex-end",zIndex:"100",background:"rgba(255,255,255,0.8)",borderRadius:"4px",padding:"2px",border:"1px solid #ccc"},"vjs-chart-controls-group"):this.Ct.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.Ct),this.ri&&this.ri.render(this.Ct,e),this.ma&&this.ma.EA(this.Ct)}}$drawEmptyMessage(e,t,n,o){let s=k(et,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},ex,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(et,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},ex,e);s.innerHTML=this.$errorMessage}$precomputeTitle(e,t){let n=k(Q,{},null,e);if(this.$showTitle&&(this.$title!=null||this.$subtitle!=null)){let o=k(et,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},S_,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=Xu(o,this.$title,u),s=o.getBBox(),s.y<0&&o.setAttribute("y",`${-s.y}`),a=!0}let l=this.$titleAlign==="left"?this.margin:this.$titleAlign==="middle"?(t-s.width)/2:t-s.width-this.margin;if(zt(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(m=>m.getBBox().width),g=Math.max(...p);u.forEach((m,E)=>{m.setAttribute("x",`${(g-p[E])/2}`)})}if(this.$showSubtitle){let u=k(et,{y:s.height+10,x:0,"dominant-baseline":"hanging"},T_,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),g=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;zt(u,g,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);zt(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.style.backgroundColor}$getPlotBackgroundColor(){return this.style.plotBackgroundColor}$getLabelColor(){return this.style.labelColor}$fromPageLocation(e){let t=this.container.getBoundingClientRect(),n=e.x-window.scrollX-t.x,o=e.y-window.scrollY-t.y;return{x:n-this.dim.chartX,y:o-this.dim.chartY}}$fromEventLocation(e){let t=me(e);return this.$fromPageLocation(t)}getZoom(){return this.K}setZoom(e){return this.Bg&&(this.K=Math.max(this.Cc[0],Math.min(this.Cc[1],e)),this.xA()),this.K}xA(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.K})`))}};var Ba=class{load(r){r()}hasData(){return!1}},uc=class{constructor(r){this.chart=r;c(this,"data")}hasData(){return this.data!=null&&this.data.length>0}load(r){this.data.forEach(e=>{this.chart.$__series.forEach(t=>{t.addValue(e)})}),r()}},wg=class extends uc{constructor(e,t){super(e);this.chart=e;this.data=t}},Dg=class extends uc{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){ha({url:this.url,dataType:kt,success:t=>{this.data=t,super.load(e)}})}},pc=class extends uc{constructor(e,t,n){super(e);this.chart=e;this.dataSource=t;this.filter=n;this.filter=n||(s=>!0),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data));let o=la(()=>{t.reload&&t.reload(),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data)),this.chart.reload()},150);t.bind(Re,o),t.bind(Ce,o),t.bind(Jt,o),t.bind(ve,o),t.bind(Oe,o),t.bind(Wt,o),t.bind(xt,o),t.bind(bt,o),t.bind(hr,o),t.bind(Zt,o)}$setFilter(e){this.filter=e||(t=>!0),this.data=this.dataSource.getNodes().filter(this.filter).map(function(t){return t.data})}};var Sr=class{};var tr=class extends Sr{constructor(e,t,n){super();c(this,"color");c(this,"min");c(this,"max");c(this,"total");c(this,"label");c(this,"id");c(this,"visible");c(this,"categories",[]);c(this,"values",[]);c(this,"valueField");c(this,"minValueField");c(this,"maxValueField");c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"Ug");c(this,"te");this.id=e.id||e.valueField,this.label=e.label,this.valueField=e.valueField,this.minValueField=e.minValueField,this.maxValueField=e.maxValueField,this.color=t,this.visible=!0,this.marker=e.marker,this.markerType=e.markerType,this.markerSize=e.markerSize,this.Ug=n,this.te=new Map,this.reset()}isRangeSeries(){return this.minValueField!=null&&this.maxValueField!=null}reset(){this.min=0,this.max=0,this.total=0,this.values.length=0,this.categories.length=0}toggleVisible(){this.visible=!this.visible}addValue(e){let t=e[this.Ug];t!=null&&vs(this.te,t,()=>[]).push(e);let n,o;if(this.maxValueField!=null&&this.minValueField!=null)o=e[this.maxValueField],n=e[this.minValueField];else{let s=e[this.valueField],a=0;o=s<a?a:s,n=s<a?s:a}this.values.push({min:n,max:o}),n!=null&&(this.min=Math.min(this.min,n)),o!=null&&(this.max=Math.max(this.max,o)),this.total+=o,this.categories.push(e)}getCategories(){return this.categories}expand(){return[this]}};c(tr,"type","record");var wD=1,DD="rangeStart",ND="values",ID="minValues",MD="maxValues",VD="label",GD="id",Fa=class extends Sr{constructor(e,t){super();this.chart=t;c(this,"startPoint");c(this,"step");c(this,"rangeStartField");c(this,"$valuesField");c(this,"$minValuesField");c(this,"$maxValuesField");c(this,"$labelField");c(this,"$idField");c(this,"$labels");c(this,"$labelGenerator");c(this,"$series",[]);c(this,"values");this.startPoint=e.startPoint==null?0:e.startPoint,this.step=e.step==null?wD:e.step,this.rangeStartField=e.rangeStartField||DD,this.$valuesField=e.valuesField||ND,this.$minValuesField=e.minValuesField||ID,this.$maxValuesField=e.maxValuesField||MD,this.$labelField=e.labelField||VD,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||GD,this.$labels=e.labels||[]}addValue(e){let t=e[this.$minValuesField],n=e[this.$maxValuesField],o=t!=null&&n!=null,s={id:e[this.$idField]||G(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new tr(s,this.chart.colorGenerator.generate(s));if(a.reset(),o){let l=Math.max(t.length,n.length);for(let h=0;h<l;h++){let d=this.zg(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.bA(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}bA(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.zg(e)}zg(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(Fa,"type","array");var Ua=class extends Sr{constructor(e){super();c(this,"counts",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"valueField");this.valueField=e.valueField||"value",this.color=e.color,this.label=e.label}addValue(e){let t=e[this.valueField];if(t!=null){let n=this.counts.get(t)||0;this.counts.set(t,n+1)}}reset(){this.counts.clear()}expand(){let e=new tr({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Ua,"type","collation");var Ya=class extends Sr{constructor(e){super();c(this,"fields");c(this,"sums",new Map);c(this,"labels");c(this,"colors");this.fields=e.fields,this.labels=e.labels||[],this.colors=new Map,(e.colors||[]).forEach((t,n)=>{this.colors.set(this.fields[n],t)})}addValue(e){this.fields.forEach(t=>{let n=parseFloat(e[t]);if(!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}})}reset(){this.sums.clear()}expand(){let e=new tr({valueField:"value",id:G(),label:"Sum"},"#556623");return this.sums.forEach((t,n)=>{e.addValue({id:n,label:n,value:t,color:this.colors.get(n)||"#556623"})}),[e]}};c(Ya,"type","summing");var gc=class extends Sr{constructor(e){super();c(this,"sums",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"categoryField");c(this,"sumField");this.categoryField=e.categoryField||"category",this.sumField=e.sumField||"value"}addValue(e){let t=e[this.categoryField],n=parseFloat(e[this.sumField]);if(t!=null&&!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}}reset(){this.sums.clear()}expand(){let e=new tr({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(gc,"type","summing-collation");var za=class extends co{constructor(e,t){super(e,t);c(this,"dataSource");c(this,"$__series",[]);c(this,"$focusedSeries");c(this,"seriesElements");c(this,"$model");c(this,"$modelFilter");c(this,"$grouped");c(this,"$groupField");c(this,"Yg");this.dataSource=new Ba,this.Yg=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.Yg.forEach(e=>{if(e.type==null||e.type===tr.type){let t=new tr(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===Fa.type){let t=new Fa(e,this);this.$__series.push(t)}else if(e.type===Ua.type){let t=new Ua(e);this.$__series.push(t)}else if(e.type===gc.type){let t=new gc(e);this.$__series.push(t)}else if(e.type===Ya.type){let t=new Ya(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new wg(this,e.data):e.dataSource?this.dataSource=new pc(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new Dg(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof pc&&(this.dataSource.$setFilter(e),this.$load())}reload(){this.$load()}$reset(){this.$doReset()}$load(e){this.$reset(),this.dataSource.load(()=>{this.$doLoad(),this.$draw(),this.fire(Rg,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var kn="data-vjs-chart-category",Et="data-vjs-chart-series",Ng="data-vjs-chart-stack",Ig="data-vjs-chart-stack-total",Mg="data-vjs-chart-value",CB="data-vjs-filter",ir="start",Si="end",Ti=2,Vg=5,$_=10,dx=20,Gg=14,B_=14,$g="normal",F_="normal";var $D=["b","br","em","strong"],BD="vjs-tooltip",ja=class extends es{constructor(e){super({formatter:(t,n)=>Cc(t)?GA(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Yr.type&&$D.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${$D.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==ks.type).forEach(t),this.$adt=n}catch(t){U(`VisuallyJs - WARN: Cannot parse tooltip format ${e}`)}}ce(e){switch(e){case"b":case"strong":let t=M("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=M("tspan");return n.style.fontStyle="italic",n;case"br":let o=M("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},Xa=class{constructor(r,e){this.parentElement=r;c(this,"root");c(this,"g");c(this,"bg");c(this,"text");c(this,"$parser");c(this,"$paddingX",8);c(this,"$paddingY",10);c(this,"$valueSuffix");c(this,"_c");c(this,"Xg");var n,o,s,a;if(this.$parser=new ja(e),this.$valueSuffix=e.valueSuffix,this._c=e.timeout==null?2500:e.timeout,this.g=M(Q,{"pointer-events":"none"},{},BD),Lt(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=M("defs"),l.insertBefore(h,l.childNodes[0]));let d=M("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=M("feDropShadow",{dx:2,dy:2,stdDeviation:3,"flood-color":"rgba(0,0,0,0.5)"});d.appendChild(u),h.appendChild(d),this.g.setAttribute("filter","url(#vjs-tooltip-shadow)")}else this.root=M(Le),this.root.appendChild(this.g);this.bg=M(Z,{fill:e.fill||"#FFFFFF",stroke:e.outline||"#999999","stroke-width":e.outlineWidth||1,"data-z-index":"1000",rx:e.cornerRadius==null?3:e.cornerRadius}),this.g.appendChild(this.bg);let t={"font-size":((n=e.font)==null?void 0:n.size)||"0.8rem","dominant-baseline":"hanging",x:`${this.$paddingX}`,y:`${this.$paddingY}`};(o=e.font)!=null&&o.family&&(t["font-family"]=e.font.family),(s=e.font)!=null&&s.style&&(t["font-style"]=e.font.style),(a=e.font)!=null&&a.weight&&(t["font-weight"]=e.font.weight),e.textColor&&(t.fill=e.textColor),this.text=M(et,t),this.g.appendChild(this.text),r.appendChild(this.root)}AA(){this._c!==-1&&(clearTimeout(this.Xg),this.Xg=setTimeout(()=>this.hide(),this._c))}$renderTooltip(r){this.text.innerHTML="",this.parentElement.insertBefore(this.root,null);let e=this.$parser.renderTooltip(r),t=2;this.text.appendChild(e.fragment);let n=this.text.getBBox().height+t,o=n;Array.from(this.text.querySelectorAll("tspan.vjs-br")).forEach(h=>{h.setAttribute("dy",`${n}`),h.setAttribute("x",`${this.$paddingX}`),h.getBBox().height===0?n=o:n=h.getBBox().height+t});let s=this.text.getBBox(),a=s.width+2*this.$paddingX,l=s.height+2*this.$paddingY;this.bg.setAttribute("x","0"),this.bg.setAttribute("width",`${a}`),this.bg.setAttribute("y","0"),this.bg.setAttribute("height",`${l}`)}formatValue(r){return r==null?null:this.$valueSuffix==null?`${r}`:`${r} ${this.$valueSuffix}`}show(r,e,t){if(this.$parser.$adt!=null){this.$renderTooltip(t);let n=this.g.getBBox(),o=Ze(this.parentElement),s=r.x-n.width*e.x,a=r.y-n.height*e.y,l=5;s=Math.max(l,Math.min(s,o.width-n.width)-l),a=Math.max(l,Math.min(a,o.height-n.height)-l);let h={x:s,y:a};Ie(this.root,h),this.AA()}}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},Ha=class extends Xa{showTooltip(r,e,t,n,o){let s={series:t,category:n,point:{value:this.formatValue(o.value),rawValue:o.value,minValue:this.formatValue(o.minValue),rawMinValue:o.minValue,maxValue:this.formatValue(o.maxValue),rawMaxValue:o.maxValue,stackTotal:o.stackTotal},stack:o.stackId?{id:o.stackId,total:o.stackTotal}:null};super.show(r,e,s)}},Bg=class extends Xa{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var mc=class{constructor(){c(this,"dataMax",0);c(this,"dataMin",0);c(this,"maxScale",0);c(this,"minScale",0);c(this,"range",0);c(this,"step",0);c(this,"stepCount",0);c(this,"steps",[])}},ka=class extends za{constructor(e,t){super(e,t);c(this,"axisLineSize");c(this,"yAxisPadding");c(this,"yAxes");c(this,"xAxes");c(this,"$crosshairElements",{x:[],y:[]});c(this,"$roundCorners");c(this,"$cornerRadius");c(this,"$realisedSeries",[]);c(this,"cn");c(this,"$tooltip");c(this,"$maxLabelSize");this.cn=t.tooltip,this.axisLineSize=t.axisLineSize||Ti,this.yAxisPadding=t.yAxisPadding||$_,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||Vg,this.dataSource=new Ba,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(st,z(fn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(ot,z(fn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(st,z(Sg),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s)}),this.$bind(ot,z(Sg),n=>{this.setFocusedSeries(null)}))}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{e.expand().forEach(n=>{this.$realisedSeries.push(n)})})}getSeries(){return this.$realisedSeries}SA(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},qy,t)),e.titleElement=k(Q,{},"",t),e.title!=null&&(zt(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),ys(e.title,{"text-anchor":this.jg(e),"dominant-baseline":"hanging",y:this.legend.padding},[Qy,p_].join(" "),e.titleElement))}jg(e){return e.titleAlign===V_?"start":e.titleAlign===G_?"end":"middle"}TA(e,t){e.titleElement=k(et,{y:0,x:0,"text-anchor":this.jg(e)},[Qy,u_].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(ee,`${o}`);let s=[],a=0;if(e.labels.forEach(u=>{let p=u.getBBox().width;a=Math.max(a,p),s.push([u,p])}),e.position===ir)s.forEach(u=>u[0].setAttribute(ee,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(ee,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(ee,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(fe,`${l}`);let h=e.position===ir?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(ee)}, ${l})`),e.showLine!==!1&&(e.lineElement=k(Z,{width:this.axisLineSize,height:t.height+this.axisLineSize/2,y:0,x:n.height+a+10+10},qy,e.element))}$computeScaleLabel(e,t){if(t.labelFormatter)return t.labelFormatter(e);let n=`${e}`;return t.labelPrefix&&(n=t.labelPrefix+n),t.labelSuffix&&(n=n+t.labelSuffix),n}$precomputeLegend(e,t,n,o){let s=k(Q,{"data-z-index":100},h_,e);if(this.legend.visible&&(this.$realisedSeries.length>1||this.legend.$hideForSingleSeries===!1)){let a=k(Z,{height:1,rx:2,fill:this.style.legendBackgroundColor,stroke:this.style.legendOutlineColor,"stroke-width":this.style.legendOutlineWidth,width:1},"",s),l=2,h=[],d=0;this.$realisedSeries.forEach((g,m)=>{let E=k(Q,{[Et]:m},Sg,s),y=k(et,{y:d,"text-anchor":"start",x:l+19,"dominant-baseline":"hanging","font-size":this.legend.font.size,"font-weight":this.legend.font.weight||"normal","font-style":this.legend.font.style||"normal"},c_,E);y.innerHTML=g.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:g.color,x:l,y:d},d_,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===sx?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(_e,`${u.width+2*p}`),a.setAttribute(Ve,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let g=this.legend.align===lx?t/2-u.width/2:this.legend.align===ax?this.margin:t-u.width-this.margin,m=this.legend.valign===hx?n-u.height-this.margin:this.legend.valign===hc?o:(n-u.height)/2;zt(s,g,m)}}return s}$getScaleGrid(e,t){let n=t.useSeriesTotal?t.stackedScale:t.scale,o=n.step/n.range;return n.steps.map((s,a)=>{let l=o*e*a;return e-l})}$getAxisLabels(e,t){return yn(e)?this.vA(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.cn&&(this.$tooltip=this.$createTooltip(e,this.cn)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Va,e);e.insertBefore(s,o.nextElementSibling);let a=`vjs-plot-clip-${Eo()}`,l=k("defs",{},null,e),h=k("clipPath",{id:a},null,l);k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight},null,h);let d=k(Q,{"clip-path":`url(#${a})`},rc,e),u=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:"transparent","data-z-index":"0"},null,d);u.addEventListener(ae,p=>{let g=this.$fromEventLocation(p);this.$onMouseMove(g)}),u.addEventListener(Yb,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(d,!0,C_,p=>!yn(p)),this.seriesElements=this.$realisedSeries.map((p,g)=>k(Q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[Et]:`${g}`},l_,d)),this.$drawCrosshairs(d,!1,v_,p=>yn(p))}$drawCrosshairs(e,t,n,o){t&&(this.$crosshairElements={x:[],y:[]}),this.xAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:l.width||1,height:this.dim.chartHeight,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${nc} ${n}`,e),p;if(l.showLabel!==!1&&yn(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=ys("",g,ic,e)}this.$crosshairElements.x.push({line:u,label:p,options:l})}}),this.yAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:this.dim.chartWidth,height:l.width||1,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${nc} ${n}`,e),p;if(l.showLabel!==!1&&yn(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=ys("",g,ic,e)}this.$crosshairElements.y.push({line:u,label:p,options:l})}})}$drawDecoration(e,t,n){let o=k(Q,{},null,e),s=k(Q,{},null,e),a=k(Q,{},null,e),l=k(Q,{},null,e),{yAxes:h,yAxesAtStart:d,yAxesAtEnd:u}=this.$_generateYAxes(),{xAxes:p,xAxesAtStart:g,xAxesAtEnd:m}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===dc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?lc():b.getBBox(),T=(D,$)=>{let K=0;for(let xe=0;xe<D.length;xe++){let H=D[xe];H.element=k(Q,{"font-size":H.font.size,"font-face":H.font.style,fill:H.labelColor},[Ga,Tg].join(" "),$),H.labelsElement=k(Q,{},Ky,H.element),H.labels=this.$getAxisLabels(H,!0),this.SA(H,H.element);let Ee=H.element.getBBox();H.dim=Ee,K+=Ee.height+this.yAxisPadding}};T(g,a),T(m,l);let S=this.$titlePlacement===dc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===hc?A.height:0):x+y.height+this.titlePadding,O=()=>{let D=a.getBBox(),$=l.getBBox(),K=n-this.margin-y.height-this.titlePadding-D.height-this.yAxisPadding-this.yAxisPadding-$.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===cc?0:A.height)-this.margin,xe=(this.$titlePlacement===dc?this.margin:S)+D.height+this.yAxisPadding+(this.legend.valign===hc?A.height:0);return{chartHeight:K,chartY:xe}},{chartHeight:v,chartY:_}=O(),P=(D,$)=>{let K=0;for(let xe=0;xe<D.length;xe++){let H=D[xe];H.element=k(Q,{"font-size":H.font.size,"font-face":H.font.style,fill:H.labelColor},[Ga,vg].join(" "),$),H.labelsElement=k(Q,{},Ky,H.element),H.labels=this.$getAxisLabels(H,!1),this.TA(H,{y:_,height:v});let Ee=H.element.getBBox();zt(H.element,K-Ee.x,0),H.dim=Ee,K+=Ee.width+this.yAxisPadding}};P(d,o),P(u,s);let I=o.getBBox(),C=this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===cc&&this.legend.align===ax?this.legend.padding+A.width:0);zt(o,C,0);let R=C+I.width+this.yAxisPadding,w=t-R-(this.legend.visible&&!this.legend.floating&&this.legend.valign===cc&&this.legend.align===D_?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let D=s.getBBox();zt(s,R+w+this.yAxisPadding-D.width,0),w-=this.margin+this.yAxisPadding+D.width}p.forEach(D=>{D.lineElement!=null&&D.lineElement.setAttribute(_e,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let B=R+w,N=_+v,V={chartWidth:w,chartHeight:v,chartX:R,chartY:_,chartEndX:B,chartEndY:N,width:t,height:n};if(this.$titlePlacement===dc){let D=l.getBBox(),$=this.legend.visible&&!this.legend.floating&&this.legend.valign!==hc&&this.legend.valign!==cc?A.height+this.legend.padding:0;if($>0){let xe=V.chartY+V.chartHeight+this.yAxisPadding+D.height+this.legend.padding;ac(b,xe)}let K=V.chartY+V.chartHeight+this.yAxisPadding+D.height+$+this.titlePadding-this.margin;zt(E,0,K)}for(let D=0;D<p.length;D++){let $=p[D].titleAlign==="start"?0:p[D].titleAlign==="end"?w:w/2;zt(p[D].titleElement,$,p[D].title!=null?p[D].titlePadding:0),yn(p[D])?this.CA(V,p[D]):this.PA(V,p[D].labels);let K=this.$maxLabelSize*V.height;if(w_(p[D].labels,K,"height","width")){let H=p[D].labelsElement.getBBox();p[D].titleElement&&ac(p[D].titleElement,H.y+H.height+this.yAxisPadding);let{chartHeight:Ee,chartY:Fe}=O();V.chartHeight=Ee,V.chartY=Fe,V.chartEndY=Fe+Ee}}zt(a,V.chartX,S),zt(l,V.chartX,V.chartY+V.chartHeight+this.yAxisPadding),ac(o,V.chartY),ac(s,V.chartY);for(let D=0;D<h.length;D++)h[D].lineElement&&h[D].lineElement.setAttribute(Ve,`${V.chartHeight}`),yn(h[D])?this.OA(V,h[D].labels,h[D]):this._A(V,h[D].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let D=0;D<p.length;D++){let $=p[D];$.showGrid&&this.RA(e,V,$)}if(this.$getYAxisType()==="value")for(let D=0;D<h.length;D++){let $=h[D];$.showGrid&&this.LA(e,V,$)}}if(this.legend.visible&&this.legend.floating){let D=V.chartX+V.chartWidth-b.getBBox().width,$=V.chartY;zt(b,D,$)}return V}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}PA(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(ee,`${o*n+n/2}`)}CA(e,t){let n=this.$getScaleGrid(e.chartWidth,t).reverse();t.inverted&&(n=n.reverse());for(let o=0;o<t.labels.length;o++)t.labels[o].setAttribute(ee,`${n[o]}`)}_A(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(fe,`${o*n+n/2}`)}vA(e,t){let n=[],o=e.useSeriesTotal?e.stackedScale:e.scale;return o.steps.forEach((s,a)=>{let l=t?{"text-anchor":a===o.stepCount?"end":"middle","dominant-baseline":"hanging",x:0,y:0}:{x:0,y:0,"dominant-baseline":"middle"},h=this.$computeScaleLabel(s,e),d=ys(h,l,P_,e.labelsElement);if(e.labelColorGenerator){let u=e.labelColorGenerator(s,a);u!=null&&d.setAttribute("fill",u)}n.push(d)}),n}OA(e,t,n){let o=this.$getScaleGrid(e.chartHeight,n);n.inverted&&(o=o.reverse());for(let s=0;s<t.length;s++)t[s].setAttribute(fe,`${o[s]}`)}RA(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(Q,{transform:`translate(${t.chartX}, ${t.chartY})`},tx,e);for(let a=0;a<o.length;a++)k(Z,{height:t.chartHeight,x:o[a],y:0,width:1,fill:this.style.gridLineColor},rx,s)}LA(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(Q,{transform:`translate(${t.chartX}, ${t.chartY})`},tx,e);for(let a=0;a<o.length;a++)k(Z,{width:t.chartWidth,y:o[a],x:0,height:1,fill:this.style.gridLineColor},rx,s)}$onMouseMove(e){this.xAxes.forEach((t,n)=>{let o=this.$crosshairElements.x[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.x,this.dim.chartWidth);if(h!=null){if(yn(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(ee,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?ix(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new ja({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d+m.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-m.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+m.height/2:y=this.dim.chartY+this.dim.chartHeight-5-m.height/2,a.setAttribute(ee,`${E}`),a.setAttribute(fe,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(_e,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(ee,`${this.dim.chartX+u*d}`)}s.setAttribute(fe,`${this.dim.chartY}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}}),this.yAxes.forEach((t,n)=>{let o=this.$crosshairElements.y[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.y,this.dim.chartHeight,!0);if(h!=null){if(yn(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(fe,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?ix(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new ja({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d-m.height-5>this.dim.chartY?d-5:d+m.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-m.width/2:y=this.dim.chartX+5+m.width/2,a.setAttribute(ee,`${y}`),a.setAttribute(fe,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(Ve,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(fe,`${this.dim.chartY+u*d}`)}s.setAttribute(ee,`${this.dim.chartX}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}})}$onMouseLeave(){this.$crosshairElements.x.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")}),this.$crosshairElements.y.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")})}$getProportionalPos(e,t,n,o=!1){if(t<0||t>n)return null;if(yn(e))return t/n;{let s=e.labels.length;if(s===0)return null;let a=1/s;return Math.floor(t/(n/s))*a+a/2}}$hideTooltip(){this.$tooltip&&this.$tooltip.hide()}};function Fg(i){return typeof i=="number"&&Number.isFinite(i)}function FD(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Fg(e)||!Fg(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function UD(i){var e,t,n;let r={};for(let o of i)if(o!=null)for(let[s,a]of Object.entries(o)){let l=FD(s,a);if(l==null)continue;let h=r[s];h==null?r[s]={min:l.min,max:l.max,step:a.step,stepCount:a.stepCount,minLimit:a.minLimit,maxLimit:a.maxLimit}:r[s]={min:Math.min(h.min,l.min),max:Math.max(h.max,l.max),step:(e=h.step)!=null?e:a.step,stepCount:h.stepCount,minLimit:(t=h.minLimit)!=null?t:a.minLimit,maxLimit:(n=h.maxLimit)!=null?n:a.maxLimit}}return r}function YD(i,r){if(r==null)return i;let e=xn({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Fg(n.min),a=Fg(n.max),l=Fg(n.step);if(!s&&!a&&!l)continue;let h=o!=null?xn({},o):{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(h.min=n.min,h.minLimit=n.min),a&&(h.max=n.max,h.maxLimit=n.max),l&&(h.step=n.step),e[t]=h.min<=h.max?h:Hg(xn({},h),{min:h.max,max:h.min,minLimit:h.maxLimit,maxLimit:h.minLimit})}return e}function zD(i){let r={};for(let[e,t]of Object.entries(i)){let n=FD(e,t);n!=null&&(t.step!=null?r[e]=sc(n.min,n.max,t.step):t.stepCount!=null?r[e]=R_(n.min,n.max,t.stepCount):r[e]=oc(n.min,n.max,6,t.minLimit,t.maxLimit))}return r}function U_(i){let r=UD(i.extentsList),e=YD(r,i.overrides),t=zD(e);return{extents:e,scales:t}}var ux=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||be}getDomainExtents(){return{}}},uo=class extends ux{get $inverted(){return this.chart.$getXAxisType()!=="value"}},Y_=new Map;function Wa(i,r){Y_.set(i,r)}function z_(i,r,e){if(Y_.has(i))return Y_.get(i)(r,e)}function Za(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var Ja=class extends Sr{constructor(e,t,n,o,s,a,l,h,d,u){super();this.xAxisField=e;this.yAxisField=t;c(this,"$data",[]);c(this,"$xAxis",{min:1/0,max:-1/0});c(this,"$yAxis",{min:1/0,max:-1/0});c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"color");c(this,"outline");c(this,"outlineWidth");c(this,"outlineColor");c(this,"resolveMarker");this.marker=n,this.markerType=o,this.markerSize=s,this.color=a,this.outline=l!==!1,this.outlineWidth=h||1,this.outlineColor=d,this.resolveMarker=u}reset(){this.$data=[],this.$xAxis={min:1/0,max:-1/0},this.$yAxis={min:1/0,max:-1/0}}addValue(e){let t=e[this.xAxisField],n=e[this.yAxisField];t!=null&&n!=null&&(this.$data.push(e),this.$xAxis.min=Math.min(this.$xAxis.min,t),this.$xAxis.max=Math.max(this.$xAxis.max,t),this.$yAxis.min=Math.min(this.$yAxis.min,n),this.$yAxis.max=Math.max(this.$yAxis.max,n))}expand(){return[]}};function PB(i){return{position:i,showLine:!1,showGrid:!0,id:be}}function _B(i){return{position:i,id:be}}var Wn=class extends ka{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"Po");c(this,"Oo");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"kg");this.Po=t.valueAxis,this.Oo=t.categoryAxis,this.$inverted=t.inverted===!0,this.kg=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=z_(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}wA(e,t,n){let o=[];return this.$categories.forEach((s,a)=>{let l=n?{x:0,y:0,"text-anchor":"middle","dominant-baseline":"hanging"}:{"dominant-baseline":"middle","text-anchor":"start",x:0,y:0},h=ys(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return L_(e)?this.wA(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}DA(){var t,n,o;this.$categoryAxes=[];let e=this.Oo==null?[_B(this.$inverted?Si:ir)]:Array.isArray(this.Oo)?this.Oo:[this.Oo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:G(),h={showLine:a.showLine===!0,lineSize:a.lineSize||Ti,labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||$a,titlePadding:((o=a.title)==null?void 0:o.padding)||dx,position:a.position||(this.$inverted?Si:ir),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:Ai(B_,F_,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}NA(){if(this.$realisedSeries.length>0){let e=new ws,t=this.$realisedSeries.map(l=>[l.label,l.valueField,l.minValueField,l.maxValueField]),n=this.$realisedSeries[0],o=n.getCategories(),s=n.isRangeSeries(),a=[];o.forEach(l=>{let h=s?{id:l.id,label:l.id,minValueField:"min",maxValueField:"max"}:{id:l.id,label:l.id,valueField:"value"},d=new tr(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.te.has(u);t.forEach(m=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:m[0],min:E[m[2]],max:E[m[3]]}):d.addValue({id:m[0],value:E[m[1]]}))});let g=d;p&&(g.stack=u),a.push(g)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.kg)&&this.NA(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){this.DA(),this.IA();let e=this.$plots.map(o=>o.getDomainExtents()),t={};this.$valueAxes.forEach(o=>{t[o.domain]={min:o.min,max:o.max,step:o.step},o.stackedDomain&&(t[o.stackedDomain]={min:o.min,max:o.max,step:o.step})});let{scales:n}=U_({extentsList:e,overrides:t});this.$valueAxes.forEach(o=>{o.scale=n[o.domain],o.stackedScale=o.stackedDomain!=null&&n[o.stackedDomain]!=null?n[o.stackedDomain]:o.scale})}IA(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.Po==null?[PB(this.$inverted?ir:Si)]:Array.isArray(this.Po)?this.Po:[this.Po];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:G(),h=this.$plots.find(p=>p.$valueAxis===l&&Za(p))!=null,d=this.$plots.find(p=>p.$valueAxis===l&&p.stacked==="percent")!=null,u={domain:this.$inverted?"y":"x",stackedDomain:this.$inverted?"yStacked":"xStacked",labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||Ti,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||Ti,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||$a,titlePadding:((o=a.title)==null?void 0:o.padding)||dx,position:a.position||(this.$inverted?ir:Si),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:Ai(Gg,$g,"normal","sans-serif",a.font),scale:new mc,stackedScale:new mc,crosshair:a.crosshair,isPercent:d,step:a.step,labelPrefix:a.labelPrefix,labelSuffix:d&&a.labelSuffix==null&&a.labelFormatter==null?"%":a.labelSuffix,labelFormatter:a.labelFormatter};this.$valueAxes.push(u),a.min!=null&&(this.$valueAxesMin=this.$valueAxesMin==null?a.min:Math.min(a.min,this.$valueAxesMin)),a.max!=null&&(this.$valueAxesMax=this.$valueAxesMax==null?a.max:Math.max(a.max,this.$valueAxesMax))}}$_generateYAxes(){return this.$inverted?{yAxes:this.$valueAxes,yAxesAtStart:this.$valueAxes.filter(e=>e.position===ir),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===Si)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===ir),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===Si)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===ir),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===Si)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===ir),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===Si)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}VA(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.VA(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(kn),10),a=e.getAttribute(Ng),l=e.getAttribute(Ig),h=e.getAttribute(Mg);this.$maybeShowTooltip(t,s,{x:o.x+this.dim.chartX,y:o.y+this.dim.chartY},{x:.5,y:1},a,l!=null?parseFloat(l):null,h!=null?parseFloat(h):null)}$mouseOutChartPoint(){}$maybeShowTooltip(e,t,n,o,s,a,l){if(this.$tooltip!=null){let h=this.$realisedSeries[e],d=this.$categories[t],u=d[h.valueField];l!=null&&(u=l);let p=d[h.minValueField],g=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:g,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new Ha(e,t)}};var OB=yr(),XD={square:(i,r,e)=>M(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>M(Be,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>M(q,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function Ug(i,r,e,t,n,o){let s=i.markerType||"circle",l=(XD[s]||XD.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function Ec(i,r,e,t){let o=OB.template(G(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var Ka=class extends ka{constructor(e,t){super(e,t);this.options=t;c(this,"$xAxisDimensions",{min:1/0,max:-1/0});c(this,"$yAxisDimensions",{min:1/0,max:-1/0});c(this,"xAxis");c(this,"yAxis");c(this,"axisFont");c(this,"U");c(this,"j");c(this,"Hg");c(this,"Wg");this.axisFont=Ai(Gg,$g,"normal","sans-serif",t.axisFont),this.U=t.xAxis||{},this.j=t.yAxis||{},this.Hg=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.Wg=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(st,z(Cg),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(Et)),a=this.$__series[s],l=parseInt(o.getAttribute("data-idx"),10),h=a.$data[l],d=o.getBBox(),u={x:d.x,y:d.y,width:d.width,height:d.height},p={x:.5,y:.5},g={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(g,{x:.5,y:1.1},a,h)}}),this.$bind(ot,z(Cg),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new Bg(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new Ja(t.xAxisField,t.yAxisField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$doLoad(){this.$xAxisDimensions={min:this.U.min!==void 0?this.U.min:1/0,max:this.U.max!==void 0?this.U.max:-1/0},this.$yAxisDimensions={min:this.j.min!==void 0?this.j.min:1/0,max:this.j.max!==void 0?this.j.max:-1/0},this.$__series.forEach(e=>{this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,e.$xAxis.min),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,e.$xAxis.max),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,e.$yAxis.min),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,e.$yAxis.max)}),this.$adjustDimensionsForMarkers()}$adjustDimensionsForMarkers(){let e=this.$xAxisDimensions.max-this.$xAxisDimensions.min,t=this.$yAxisDimensions.max-this.$yAxisDimensions.min,n=this.Pc||500,o=this.Oc||500,s=3;this.$__series.forEach(a=>{a.$data.forEach(l=>{let h=l[a.xAxisField],d=l[a.yAxisField];if(h!=null&&d!=null){let p=this.$getMarkerSize(a,l)/2+s,g=p/n*e,m=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-g),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+g),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-m),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+m)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.j.inverted===!0,labelColor:this.j.labelColor||this.style.labelColor,labelColorGenerator:this.j.labelColorGenerator||this.style.labelColorGenerator,min:this.j.min,max:this.j.max,showLine:this.j.showLine===!0,lineSize:this.j.lineSize||Ti,dim:lc(),element:k(Q,{},[Ga,vg].join(" "),e),id:this.j.id||G(),position:this.j.position||ir,titleAlign:((t=this.j.title)==null?void 0:t.align)||$a,title:(n=this.j.title)==null?void 0:n.text,titlePadding:((o=this.j.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.j.showGrid!==!1,gridLineSize:this.j.lineSize||2,useSeriesTotal:!1,font:((s=this.j)==null?void 0:s.font)||this.axisFont,scale:this.j.step!=null?sc(this.$yAxisDimensions.min,this.$yAxisDimensions.max,this.j.step):oc(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.j.crosshair,step:this.j.step,labelPrefix:this.j.labelPrefix,labelSuffix:this.j.labelSuffix,labelFormatter:this.j.labelFormatter},this.xAxis={domain:"x",inverted:this.U.inverted===!0,labelColor:this.U.labelColor||this.style.labelColor,labelColorGenerator:this.U.labelColorGenerator||this.style.labelColorGenerator,min:this.U.min,max:this.U.max,showLine:this.U.showLine===!0,lineSize:this.U.lineSize||Ti,dim:lc(),element:k(Q,{},[Ga,Tg].join(" "),e),id:this.U.id||G(),position:this.U.position||ir,titleAlign:((a=this.U.title)==null?void 0:a.align)||$a,title:((l=this.U.title)==null?void 0:l.text)||"",titlePadding:((h=this.U.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.U.showGrid!==!1,gridLineSize:this.U.lineSize||2,useSeriesTotal:!1,font:((d=this.U)==null?void 0:d.font)||this.axisFont,scale:this.U.step!=null?sc(this.$xAxisDimensions.min,this.$xAxisDimensions.max,this.U.step):oc(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.U.crosshair,step:this.U.step,labelPrefix:this.U.labelPrefix,labelSuffix:this.U.labelSuffix,labelFormatter:this.U.labelFormatter}}$drawChart(e,t,n,o){this.$setupValueAxes(e),super.$drawChart(e,t,n,o),this.$plotPoints(e)}$doReset(){super.$doReset(),this.$xAxisDimensions.min=1/0,this.$yAxisDimensions.min=1/0,this.$xAxisDimensions.max=-1/0,this.$yAxisDimensions.max=-1/0}$plotPoints(e){let t=this.$getDataPointCssClass();this.$__series.forEach((n,o)=>{let s=[];n.$data.forEach((a,l)=>{let h=a[n.xAxisField],d=a[n.yAxisField],u;if(h&&d){let p=(h-this.xAxis.scale.minScale)/this.xAxis.scale.range,g=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(g=1-g);let m=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=g*this.dim.chartHeight,x;if(n.marker)x=Ec(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:m});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=Ec(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:m,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=Ug(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:m});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Jc(m).toString();x.setAttribute("stroke",b),x.setAttribute("stroke-width",(n.outlineWidth||1).toString())}x.setAttribute("data-x",h.toString()),x.setAttribute("data-y",d.toString()),x.setAttribute(Et,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(fn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push(M(Be,{cx:E,cy:y,r:f,fill:"transparent",stroke:"none",transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,"data-x":h.toString(),"data-y":d.toString(),[Et]:o.toString(),"data-idx":l.toString()},null,Cg))}}),s.forEach(a=>e.appendChild(a))})}$getBaseMarkerSize(){let e=0;this.$__series.forEach(l=>e+=l.$data.length);let t=10,n=this.dim.chartWidth*this.dim.chartHeight,o=Math.sqrt(n)/500,s=Math.max(1,Math.sqrt(e/100)),a=t*o/s;return Math.min(this.Wg,Math.max(this.Hg,a))}$getXAxisType(){return"value"}$getYAxisType(){return"value"}$mouseOutChartPoint(){}$mouseOverChartPoint(e,t){}$_generateYAxes(){return{yAxes:[this.yAxis],yAxesAtStart:[this.yAxis],yAxesAtEnd:[]}}$_generateXAxes(){return{xAxes:[this.xAxis],xAxesAtEnd:[this.xAxis],xAxesAtStart:[]}}$recalc(){}};var jD=.8,HD=50,kD=10;function RB(i){return i.type===Lr.type}var px=class px extends uo{constructor(e,t){super(e,t,px.type);this.chart=e;this.options=t;c(this,"stacked");c(this,"$distinctStacks",[]);this.stacked=t==null?void 0:t.stacked}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(h=>{typeof h.min=="number"&&Number.isFinite(h.min)&&(s=Math.min(s,h.min)),typeof h.max=="number"&&Number.isFinite(h.max)&&(a=Math.max(a,h.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),Za(this)&&this.chart.$categories.length>0)if(this.$distinctStacks=Array.from(new Set(o.map(h=>h.stack||"default"))),this.stacked==="percent")n[t]={min:0,max:100,stepCount:4};else{let h=0;for(let d=0;d<this.chart.$categories.length;d++){let u={};this.$distinctStacks.forEach(p=>u[p]=0),o.forEach(p=>{var E,y;let g=p.stack||"default",m=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof m=="number"&&Number.isFinite(m)&&(u[g]+=m)}),this.$distinctStacks.forEach(p=>{h=Math.max(h,u[p])})}n[t]={min:0,max:h}}return n}computeBarSize(e){let t=Za(this)?Math.max(1,this.$distinctStacks.length):this.chart.seriesElements.length,n=this.options.barGap==null?kD:this.options.barGap,o=n*(t-1),s=e/this.chart.$categories.length,a=this.options.barSize!=null?this.options.barSize:(()=>{let h=(this.options.fillRatio==null?jD:this.options.fillRatio)*s,d=this.options.maxBarSize==null?HD:this.options.maxBarSize;return Math.min(d,(h-o)/t)})();return{barSize:a,gapBetweenBars:n,spaceUsedPerCategory:a*t+o,spacePerCategory:s,barsPerCategory:t}}$getBarCenter(e,t,n){let o=this.computeBarSize(this.$inverted?n.chartWidth:n.chartHeight);return this.chart.$getCategoryCenter(e,n,!this.$inverted)-o.spaceUsedPerCategory/2+o.barSize/2+t*(o.barSize+o.gapBetweenBars)}$computeBarPlacements(e,t,n,o){return Za(this)?this.stacked==="percent"?this.$computeBarPlacementsStackedPercent(e,t):this.$computeBarPlacementsStacked(e,t):this.$computeBarPlacementsDefault(e,t,n,o)}$computeBarPlacementsStackedPercent(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(E=>(E.stack||"default")===h),p=[],g=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),g+=y});let m=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+m)/g,f=m/g,b=Math.abs((x-f)*e.chartHeight);f=e.chartHeight-f*e.chartHeight-b,n.push({x:l,y:f,height:b,width:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}else{let x=(E[1]+m)/g,f=m/g,b=(x-f)*e.chartWidth;f*=e.chartWidth,n.push({x:f,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,width:b,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}m+=E[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsStacked(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(y=>(y.stack||"default")===h),p=[],g=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),g+=x});let m=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+m)/E.range,b=m/E.range,A=Math.abs((f-b)*e.chartHeight);b=e.chartHeight-b*e.chartHeight-A,n.push({x:l,y:b,height:A,width:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}else{let f=(y[1]+m)/E.range,b=m/E.range,A=(f-b)*e.chartWidth;b*=e.chartWidth,n.push({x:b,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,width:A,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}m+=y[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsDefault(e,t,n,o){let s=this.chart.getSeries(),a=[],l=this.chart.$valueAxes[0].scale;for(let h=0;h<this.chart.$categories.length;h++){let u=this.chart.$getCategoryCenter(h,e,!this.$inverted)-t.spaceUsedPerCategory/2;for(let p=0;p<s.length;p++){let g=s[p],m=n==null?g.values[h].min:Math.max(n,g.values[h].min),E=o==null?g.values[h].max:Math.min(g.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=x!==0,b=Math.abs((y-x)*e.chartHeight);x=e.chartHeight-x*e.chartHeight-b,a.push({x:u,y:x,canRoundStart:f,canRoundEnd:!0,height:b,width:t.barSize,category:h,series:p,rounded:!0,value:g.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=Math.abs((y-x)*e.chartWidth);x*=e.chartWidth,a.push({x,canRoundStart:x!==0,canRoundEnd:!0,y:u,height:t.barSize,width:f,category:h,series:p,rounded:!0,value:g.values[h].max})}u+=t.barSize+t.gapBetweenBars}}return a}$draw(e,t,n,o){let s=this.computeBarSize(this.$inverted?t.chartWidth:t.chartHeight),a=this.$computeBarPlacements(t,s,n,o),l=this.$inverted?[m_,fn].join(" "):[f_,fn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[kn]:`${d.category}`,[Et]:`${d.series}`};d.stackId!=null&&(u[Ng]=d.stackId),d.stackTotal!=null&&(u[Ig]=`${d.stackTotal}`),d.value!=null&&(u[Mg]=`${d.value}`),LB(d,!this.$inverted,u,l,this.chart.seriesElements[d.series],this.chart.$roundCorners&&d.canRoundStart,this.chart.$roundCorners&&d.canRoundEnd,this.chart.$cornerRadius),this.options.dataLabels&&this.$drawDataLabel(d,e)})}$drawDataLabel(e,t){let n=this.chart.getSeries()[e.series],o=this.chart.$categories[e.category],s=e.value,a="";if(this.options.dataLabels===!0?a=this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`:typeof this.options.dataLabels=="string"&&(a=this.options.dataLabels.replace("{series}",n.id).replace("{category}",o.id).replace("{value}",this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`),e.stackId!=null&&(a=a.replace("{stack}",e.stackId))),a.length>0){let l=this.chart.dim.chartX+e.x+e.width/2,h=this.chart.dim.chartY+e.y+e.height/2;_g(a,l,h,n.color,{size:11},t)}}};c(px,"type","bar");var Lr=px;Wa(Lr.type,(i,r)=>new Lr(i,r));function LB(i,r,e,t,n,o,s,a){let l,h=a||Vg;return r?o&&s&&i.width>h?l=`M ${i.x}, ${i.y+h} q0,-${h}, ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-2*h} q-${h},0 -${h},-${h} z`:s&&i.width>h?l=`M ${i.x},${i.y} h${i.width-h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-h} z`:o&&i.width>h?l=`M ${i.x},${i.y+h} q0, -${h} ${h},-${h} h${i.width-h} v${i.height} h${-(i.width-h)} q-${h},0 -${h},-${h} z`:l=`M ${i.x},${i.y} h${i.width} v${i.height} h-${i.width} Z`:o&&s&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-2*h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} z`:s&&i.height>h?l=`M ${i.x},${i.y+i.height} v-${i.height-h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-h} z`:o&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-h} h${i.width} v${i.height-h} q0,${h} -${h},${h} z`:l=`M ${i.x},${i.y+i.height} v-${i.height} h${i.width} v${i.height} Z`,k(q,Object.assign({d:l},e),t,n)}var X_=class extends Wn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:fc.type,options:e.plotOptions||{}}})),L(r,O_),this.$bind(ae,z(rc),t=>{let{x:n,y:o}=this.$fromEventLocation(t),s=null;if(this.$getXAxisType()==="category"){let a=this.dim.chartWidth/this.$categories.length;s=Math.floor(n/a)}else{let a=this.dim.chartHeight/this.$categories.length;s=Math.floor(o/a)}if(s!=null){let a=this.$plots[0],{loc:l,seriesIndex:h}=a.showMarker(s,this.dim,this.$focusedSeries);l!=null&&this.$tooltip!=null&&this.$maybeShowTooltip(h,s,{x:l.x+this.dim.chartX,y:l.y+this.dim.chartY},{x:.5,y:1.1})}}),this.$bind(ae,z(Pg),t=>{let n=t.target,o=parseInt(n.getAttribute(Et),10);this.setFocusedSeries(o)}),this.$bind(ot,z(Pg,rc),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},gx=class gx extends uo{constructor(e,t){var n,o;super(e,t,gx.type);this.chart=e;c(this,"stacked");c(this,"Rc");c(this,"Zg");c(this,"Lc");c(this,"Pt",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.Rc=((n=t.marker)==null?void 0:n.enabled)!==!1,this.Zg=((o=t.marker)==null?void 0:o.size)||10}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.stacked&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Lr.type);return s==null?o:s.$getBarCenter(e,t,n)}}$draw(e,t,n,o){this.Pt.length=0;let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale;for(let l=0;l<this.chart.$categories.length;l++)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.Pt[h]=this.Pt[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.Pt[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.Pt[h].push({x:p*t.chartWidth,y:d})}}for(let l=this.chart.$categories.length-1;l>-1;l--)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.$inverted){let p=t.chartHeight-(u.values[l].min-a.minScale)/a.range*t.chartHeight;this.Pt[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.Pt[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.Pt.length;l++){let h=s[l].color,d=`M ${this.Pt[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(q,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[Et]:`${l}`},Pg,this.chart.seriesElements[l])}this.Lc=k(Be,{cx:"0",cy:"0",r:this.Zg/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.Rc!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.Pt[s][e];return ie(this.Lc,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Jc(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.Rc!==!1&&ie(this.Lc,{visibility:"hidden"})}};c(gx,"type","area");var fc=gx;Wa(fc.type,(i,r)=>new fc(i,r));var j_=class extends Wn{constructor(r,e){super(r,Object.assign({},e,{inverted:!0,plots:{type:Lr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,g_)}};var H_=class extends Wn{constructor(r,e){super(r,Object.assign({},e,{inverted:!1,plots:{type:Lr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,E_)}};var mx=class extends Ja{constructor(e,t,n,o,s,a,l,h,d,u,p){super(e,t,o,s,a,l,h,d,u,p);this.xAxisField=e;this.yAxisField=t;this.valueField=n;c(this,"$valueAxis",{min:1/0,max:-1/0})}addValue(e){super.addValue(e);let t=e[this.valueField];t!=null&&(this.$valueAxis.min=Math.min(this.$valueAxis.min,t),this.$valueAxis.max=Math.max(this.$valueAxis.max,t))}},k_=class extends Ka{constructor(e,t){super(e,t);this.options=t;L(e,y_)}$dualValueInit(e){e.series.forEach(t=>{let n=new mx(t.xAxisField,t.yAxisField,t.valueField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$getMarkerSize(e,t){let n=this.options.minPointSize||10,o=this.options.maxPointSize,s=t[e.valueField];if(s==null)return null;let a=this.$getBaseMarkerSize(),l=Math.min(this.dim.chartWidth,this.dim.chartHeight),h=Math.min(a*7,l*.2),d=o||h,u=e.$valueAxis.max-e.$valueAxis.min,p=u===0?.5:(s-e.$valueAxis.min)/u,g=n+Math.sqrt(p)*(d-n);return Math.max(n,g)}$getDataPointCssClass(){return x_}};var WD="vjs-gauge-chart",ZD="vjs-gauge-track",W_="vjs-gauge-zone",JD="vjs-gauge-tick",KD="vjs-gauge-label",qD="vjs-gauge-needle",QD="vjs-gauge-needle-pivot",Z_=class extends co{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"Ot");c(this,"_o");c(this,"Re");c(this,"Te");c(this,"Vt");c(this,"wc");this.Ot=(n=t.startAngle)!=null?n:-135,this._o=(o=t.endAngle)!=null?o:135,this.Re=(s=t.innerRadius)!=null?s:.8,this.Te=(a=t.min)!=null?a:0,this.Vt=(l=t.max)!=null?l:100,this.wc=(h=t.value)!=null?h:this.Te,L(e,WD),this.$draw()}getValue(){return this.wc}setValue(e){this.wc=e,this.$draw()}hasData(){return this.getValue()!=null}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){var xe;this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Va,e);e.insertBefore(s,o.nextElementSibling);let a=H=>(H-90)*Math.PI/180,l=a(this.Ot),h=a(this._o),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),g=Math.sin(l),m=[h];for(let H=-180;H<=270;H+=90){let Ee=a(H);H>=this.Ot&&H<=this._o&&m.push(Ee)}m.forEach(H=>{d=Math.min(d,Math.cos(H)),u=Math.max(u,Math.cos(H)),p=Math.min(p,Math.sin(H)),g=Math.max(g,Math.sin(H))});let E=.9,y=u-d,x=g-p,f=Math.min(this.dim.chartWidth*E/y,this.dim.chartHeight*E/x),b=this.dim.chartX+this.dim.chartWidth/2-f*(u+d)/2,A=this.dim.chartY+this.dim.chartHeight/2-f*(g+p)/2,T=f*this.Re,S=b+f*Math.cos(l),O=A+f*Math.sin(l),v=b+f*Math.cos(h),_=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),R=A+T*Math.sin(l),w=this._o-this.Ot<=180?0:1,B=[`M ${S} ${O}`,`A ${f} ${f} 0 ${w} 1 ${v} ${_}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${R}`,"Z"].join(" ");k(q,{d:B,fill:"#EEE",stroke:"#CCC","stroke-width":1},ZD,e);let N=(xe=this.getValue())!=null?xe:this.Te,V=Math.max(this.Te,Math.min(this.Vt,N)),D=this.Vt-this.Te,$=this._o-this.Ot,K=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((H,Ee)=>{let Fe=H.from,Je=H.to;if(!K){if(V<=Fe)return;Je=Math.min(Je,V)}let Xt=this.Ot+(Fe-this.Te)/D*$,or=this.Ot+(Je-this.Te)/D*$,rr=a(Xt),wr=a(or),go=b+f*Math.cos(rr),qa=A+f*Math.sin(rr),Qa=b+f*Math.cos(wr),el=A+f*Math.sin(wr),tl=b+T*Math.cos(wr),rl=A+T*Math.sin(wr),zg=b+T*Math.cos(rr),Xg=A+T*Math.sin(rr),xc=or-Xt<=180?0:1,jg=[`M ${go} ${qa}`,`A ${f} ${f} 0 ${xc} 1 ${Qa} ${el}`,`L ${tl} ${rl}`,`A ${T} ${T} 0 ${xc} 0 ${zg} ${Xg}`,"Z"].join(" "),bc=H.color;if(H.gradient){let bs=e.querySelector("defs");bs||(bs=k("defs",{},"",e),e.insertBefore(bs,e.firstChild));let re=`vjs-gauge-gradient-${Ee}-${Math.round(Math.random()*1e6)}`,je=k("linearGradient",{id:re,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",bs);H.gradient.stops.forEach(wt=>{k("stop",{offset:`${wt.offset}%`,"stop-color":wt.color},"",je)}),bc=`url(#${re})`}k(q,{d:jg,fill:bc,stroke:"none"},`${W_} ${W_}-${Ee}`,e)}),this.options.ticks){let H=[];if(this.options.ticks.values)H=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let Ee=this.Te;Ee<=this.Vt;Ee+=this.options.ticks.interval)H.push(Ee);H.forEach(Ee=>{let Fe=this.Ot+(Ee-this.Te)/D*$,Je=a(Fe),Xt=f*.95,or=b+f*Math.cos(Je),rr=A+f*Math.sin(Je),wr=b+Xt*Math.cos(Je),go=A+Xt*Math.sin(Je);k(q,{d:`M ${or} ${rr} L ${wr} ${go}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},JD,e)})}if(this.options.labels){let H=[];if(this.options.labels.values)H=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Fe=this.Te;Fe<=this.Vt;Fe+=this.options.labels.interval)H.push(Fe);let Ee=f+(this.options.labels.distance||0);H.forEach(Fe=>{let Je=this.Ot+(Fe-this.Te)/D*$,Xt=a(Je),or=b+Ee*Math.cos(Xt),rr=A+Ee*Math.sin(Xt);k("text",{x:or,y:rr,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},KD,e).textContent=Fe.toString()})}if(K){let H=this.Ot+(V-this.Te)/D*$,Ee=a(H),Fe=f*.9,Je=f*.05,Xt=Ee-Math.PI/2,or=Ee+Math.PI/2,rr=b+Fe*Math.cos(Ee),wr=A+Fe*Math.sin(Ee),go=b+Je*Math.cos(Xt),qa=A+Je*Math.sin(Xt),Qa=b+Je*Math.cos(or),el=A+Je*Math.sin(or),tl=`M ${go} ${qa} L ${rr} ${wr} L ${Qa} ${el} Z`;k(q,{d:tl,fill:"#333",stroke:"#000","stroke-width":1},qD,e);let rl=Je*1.5;k("circle",{cx:b,cy:A,r:rl,fill:"#333",stroke:"#666","stroke-width":1},QD,e)}}};var J_=class extends Wn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:yc.type,options:t.plotOptions||{}}}));this.options=t;L(e,__)}},Ex=class Ex extends uo{constructor(e,t){super(e,t,Ex.type);this.chart=e;c(this,"Jg");c(this,"Kg");this.Jg=t.stacked===!0,this.Kg=t.spline===!0}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.Jg&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===Lr.type);return s==null?o:s.$getBarCenter(e,t,n)}}MA(e,t){function n(a){return`C ${a.cp1.x} ${a.cp1.y}, ${a.cp2.x} ${a.cp2.y}, ${a.x2} ${a.y2} `}let o=_E(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}GA(e,t){return`M ${e.slice(t).map(n=>`${n.x} ${n.y}`).join(" L ")}`}$draw(e,t,n,o){let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale,l=[],h=[],d=(u,p)=>{let g,m;return this.$inverted?(m=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,g=u):(g=t.chartWidth*((p-a.minScale)/a.range),m=u),{cx:g,cy:m}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let g=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let m=s[p],E=m.values[u].max,{cx:y,cy:x}=d(g,E);if(E!=null&&this.qg(s[p],y,x,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),m.isRangeSeries()){let{cx:f,cy:b}=d(g,m.values[u].min);m.values[u].min!=null&&this.qg(s[p],f,b,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:m.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,g=l[u].findIndex(E=>E.hasValue),m=this.Kg?this.MA(l[u],g):this.GA(l[u],g);k(q,{stroke:p,"stroke-width":"1",d:m,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}for(let u=0;u<h.length;u++){let p=s[u].color;if(h[u].length>0){let g=h[u].findIndex(E=>E.hasValue),m=`M ${h[u].slice(g).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(q,{stroke:p,"stroke-width":"1",d:m,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}qg(e,t,n,o,s,a,l,h,d){if(e.marker){let u=Ec(e.marker,null,{[kn]:`${l}`,[Et]:`${h}`},[fn].join(" "));d.appendChild(u);let p=u.getBBox();return u.setAttribute("transform",`translate(${t-p.width/2}, ${n-p.height/2})`),u}else{let u=Ug(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[kn]:`${l}`,[Et]:`${h}`},[fn].join(" "));return d.appendChild(u),u}}};c(Ex,"type","line");var yc=Ex;Wa(yc.type,(i,r)=>new yc(i,r));var eN="vjs-pie-chart",Yg="vjs-pie-slice",K_="vjs-pie-slice-selected",q_=class extends za{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"Ro");c(this,"Lo");c(this,"Dc");c(this,"ni");c(this,"Re");c(this,"$realisedSeries",[]);c(this,"cn");this.Ro=t.selectedCategory,this.Dc=t.selectedSliceOffset||10,this.ni=t.interactive===!0,this.Re=t.innerRadius,this.cn=t.tooltip,this.$init(),this.load(t),this.$bind(st,z(Yg),n=>{if(this.$tooltip){let o=n.target,s=o.getBBox(),a={x:s.x,y:s.y,width:s.width,height:s.height},l={x:.5,y:.5},h={x:a.x+a.width*l.x,y:a.y+a.height*l.y},{category:d,series:u}=this.Qg(o),p=this.$dataPoints[d],g=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},g,p.label,{value:p.value})}}),this.$bind(ot,z(Yg),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,z(Yg),n=>{if(this.ni){let o=n.target,{category:s,series:a}=this.Qg(o);this.$A(s,a,o)}}),L(e,eN)}Qg(e){let t=parseInt(e.getAttribute(kn),10),n=parseInt(e.parentNode.getAttribute(Et),10);return{category:t,series:n}}$recalc(){if(this.$realisedSeries.length>0){this.$dataPoints.length=0;let e=0,t=this.$realisedSeries[0],n=t.getCategories();t.values.forEach((o,s)=>{let a=o.max/t.total,l=a*2*Math.PI,h={p:a,arc:l,arcStart:e,data:n[s],label:n[s].id,value:o.max};this.$dataPoints.push(h),e+=l})}}hasData(){return this.dataSource.hasData()}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{let t=e.expand();this.$realisedSeries.push(...t)}),this.$recalc()}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){this.cn&&(this.$tooltip=new Ha(e,this.cn)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Va,e);e.insertBefore(s,o.nextElementSibling);let a={x:this.dim.chartX+this.dim.chartWidth/2,y:this.dim.chartY+this.dim.chartHeight/2},h=.35*Math.min(this.dim.chartWidth,this.dim.chartHeight),d=this.options.colors,u=this.options.color;this.$dataPoints.forEach((p,g)=>{let m=M(Q,{"data-name":p.label,"data-category":g});e.appendChild(m);let E=p.arcStart,y=p.arc+p.arcStart,x=p.arcStart+p.arc/2,f=a.x+h*Math.cos(E),b=a.y+h*Math.sin(E),A=a.x+h*Math.cos(y),T=a.y+h*Math.sin(y),S=p.p>.5?1:0,O="";if(p.p>=1)if(this.Re!=null){let $=this.Re*h;O=`M ${a.x+h} ${a.y}
|
|
136
|
+
</svg>`,this.eventManager.on(s,Ye,a=>{a.stopPropagation(),o.onClick()}),this.eventManager.on(s,"mouseenter",()=>{s.style.backgroundColor="#f0f0f0"}),this.eventManager.on(s,"mouseleave",()=>{s.style.backgroundColor="transparent"}),this.container.appendChild(s)}),r!=null?r.appendChild(this.container):t.appendChild(this.container)}destroy(){this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container)}};var PD="#FFFFFF",_D="#000000",TB=15,OD=15,vB="middle",CB="left",PB="right",RD="top",pc="bottom",Ba="middle",$_="start",B_="end",G_="#AAAAAA",LD=1,wD="#FFFFFFCC";function _B(i){i=i||{};let r=i.backgroundColor||PD;return{gridLineColor:i.gridLineColor||G_,legendOutlineColor:i.legendOutlineColor||i.gridLineColor||G_,legendOutlineWidth:i.legendOutlineWidth||LD,legendBackgroundColor:i.legendBackgroundColor||wD,backgroundColor:r,plotBackgroundColor:i.plotBackgroundColor||r,labelColor:i.labelColor||_D,labelColorGenerator:i.labelColorGenerator}}var co=class extends Ft{constructor(e,t){var s,a,l,h;super();this.container=e;c(this,"style");c(this,"dim");c(this,"K",1);c(this,"Lc",[.5,3]);c(this,"Hg",!1);c(this,"$resizeObserver");c(this,"$eventManager");c(this,"colorGenerator");c(this,"$defaultColor");c(this,"$emptyMessage");c(this,"$errorMessage");c(this,"$showTitle");c(this,"$title");c(this,"$showSubtitle");c(this,"$subtitle");c(this,"$titleAlign");c(this,"$subtitleAlign");c(this,"$subtitleFontSize");c(this,"$titlePlacement");c(this,"$titleFillRatio");c(this,"$titleWrap");c(this,"$titleFontSize");c(this,"titlePadding");c(this,"margin");c(this,"legend");c(this,"wc");c(this,"Dc");c(this,"Wg",!1);c(this,"fa");c(this,"ii");c(this,"Pt");t=t||{},this.wc=t.width,this.Dc=t.height,this.$defaultColor=t.defaultColor,this.colorGenerator=this.$defaultColor==null?t.colorGenerator||new Ds:new Jc(this.$defaultColor),this.style=_B(t.style);let n=(s=t.controls)==null?void 0:s.exporter;if(n!=null&&n!==!1){let d=lr(n)?n:{};this.fa=new Dg(this,d)}if(this.dim={chartX:0,chartY:0,chartWidth:0,chartHeight:0,width:0,height:0,chartEndX:0,chartEndY:0},this.$emptyMessage=t.emptyMessage||M_,this.$errorMessage=V_,t.resizeObserver!==!1)try{this.$resizeObserver=new ResizeObserver(d=>{window.requestAnimationFrame(()=>{this.Wg&&this.$draw()})}),this.$resizeObserver.observe(e)}catch(d){U("WARN: ResizeObserver could not be attached.")}this.margin=t.margin||OD,this.$eventManager=new ye,t.title&&t.title.text!=null?(this.$showTitle=!0,this.$title=t.title.text||"",this.$titleAlign=t.title.align||"middle",this.$titleWrap=t.title.wrap!==!1,this.$titleFillRatio=t.title.fillRatio||.9,this.$titleFontSize=((a=t.title.font)==null?void 0:a.size)||20,this.$titlePlacement=t.title.placement||RD):this.$showTitle=!1,t.subtitle&&t.subtitle.text!=null?(this.$showSubtitle=!0,this.$subtitle=t.subtitle.text||"",this.$subtitleAlign=t.subtitle.align||"middle",this.$subtitleFontSize=((l=t.subtitle.font)==null?void 0:l.size)||16):this.$showSubtitle=!1,this.titlePadding=t.titlePadding||TB;let o=t.legend==null||t.legend===!0?{}:t.legend===!1?{hide:!0}:t.legend;this.legend=new Lg(o),t.zoom&&t.zoom.enabled!==!1&&(this.Hg=!0,this.Lc=t.zoom.range||[.05,3],this.K=t.zoom.initialValue||1,this.container.style.overflow="auto",((h=t.controls)==null?void 0:h.zoom)!==!1&&(this.ii=new dx(this)))}$bind(e,t,n){this.$eventManager.on(this.container,e,t,n)}getTitle(){return this.$title}exportSVG(e,t){return sx(this,e,t).svg}exportImage(e,t){let n=sx(this,e.width,e.height);hy(n,e,t)}destroy(){this.$resizeObserver&&(this.$resizeObserver.unobserve(this.container),this.$resizeObserver.disconnect()),this.container.innerHTML="",this.ii&&this.ii.destroy(),this.Pt&&this.Pt.parentElement&&this.Pt.parentElement.removeChild(this.Pt)}$draw(){this.Wg=!0,this.container.innerHTML="";let e=this.wc,t=this.Dc;if(e==null||t==null){let n=window.getComputedStyle(this.container);e=e||parseInt(n.width,10),t=t||parseInt(n.height,10)}if(!isNaN(e)&&!isNaN(t)){let n=M(Le,{height:t,width:e,viewBox:`0 0 ${e} ${t}`});this.container.appendChild(n);let o=k(Z,{x:0,y:0,width:e,height:t,"aria-hidden":!0,fill:this.$getBackgroundColor(),"data-z-index":"0"},h_,n);try{this.$drawChart(n,e,t,o)}catch(a){this.$drawErrorMessage(n,e,t,o)}this.hasData()||this.$drawEmptyMessage(n,e,t,o);let s=Array.from(n.childNodes);s.sort((a,l)=>{let h=a.getAttribute("data-z-index")||0,d=l.getAttribute("data-z-index")||0;return h>d?1:h<d?-1:0}),s.forEach(a=>{n.insertBefore(a,n.childNodes[n.childNodes.length])}),NP(n,!0),this.OA()}}OA(){if(this.fa||this.ii){let e="row";this.Pt==null?this.Pt=qr("div",{position:"absolute",right:"1rem",top:"1rem",display:"flex",flexDirection:e,alignItems:"flex-end",zIndex:"100",background:"rgba(255,255,255,0.8)",borderRadius:"4px",padding:"2px",border:"1px solid #ccc"},"vjs-chart-controls-group"):this.Pt.innerHTML="",getComputedStyle(this.container).position==="static"&&(this.container.style.position="relative"),this.container.appendChild(this.Pt),this.ii&&this.ii.render(this.Pt,e),this.fa&&this.fa.CA(this.Pt)}}$drawEmptyMessage(e,t,n,o){let s=k(tt,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},tx,e);s.innerHTML=this.$emptyMessage}$drawErrorMessage(e,t,n,o){let s=k(tt,{"dominant-baseline":"central","text-anchor":"middle",x:t/2,y:n/2},tx,e);s.innerHTML=this.$errorMessage}$precomputeTitle(e,t){let n=k(Q,{},null,e);if(this.$showTitle&&(this.$title!=null||this.$subtitle!=null)){let o=k(tt,{y:0,x:0,"font-size":this.$titleFontSize,"font-weight":"bold","dominant-baseline":"hanging"},v_,n);o.innerHTML=this.$title;let s=o.getBBox(),a=!1;if(s.width>t&&this.$titleWrap){let u=this.$titleFillRatio*t;o=ju(o,this.$title,u),s=o.getBBox(),s.y<0&&o.setAttribute("y",`${-s.y}`),a=!0}let l=this.$titleAlign==="left"?this.margin:this.$titleAlign==="middle"?(t-s.width)/2:t-s.width-this.margin;if(zt(o,l,this.margin),a){let u=Array.from(o.querySelectorAll("tspan")),p=u.map(m=>m.getBBox().width),g=Math.max(...p);u.forEach((m,E)=>{m.setAttribute("x",`${(g-p[E])/2}`)})}if(this.$showSubtitle){let u=k(tt,{y:s.height+10,x:0,"dominant-baseline":"hanging"},C_,n);u.innerHTML=this.$subtitle;let p=u.getBBox(),g=this.$subtitleAlign==="left"?this.margin:this.$subtitleAlign==="middle"?(t-p.width)/2:t-p.width-this.margin;zt(u,g,this.margin)}let h=n.getBBox().height,d=k(Z,{fill:"transparent",height:10,width:t,y:h,x:0},"",n);zt(d,0,this.margin)}else k(Z,{fill:"transparent",width:t,height:0},"",n),this.titlePadding=0;return n}$getBackgroundColor(){return this.style.backgroundColor}$getPlotBackgroundColor(){return this.style.plotBackgroundColor}$getLabelColor(){return this.style.labelColor}$fromPageLocation(e){let t=this.container.getBoundingClientRect(),n=e.x-window.scrollX-t.x,o=e.y-window.scrollY-t.y;return{x:n-this.dim.chartX,y:o-this.dim.chartY}}$fromEventLocation(e){let t=me(e);return this.$fromPageLocation(t)}getZoom(){return this.K}setZoom(e){return this.Hg&&(this.K=Math.max(this.Lc[0],Math.min(this.Lc[1],e)),this._A()),this.K}_A(){let e=this.container.firstElementChild;e!=null&&(e.setAttribute("transform-origin","0 0"),e.setAttribute("transform",`scale(${this.K})`))}};var Fa=class{load(r){r()}hasData(){return!1}},gc=class{constructor(r){this.chart=r;c(this,"data")}hasData(){return this.data!=null&&this.data.length>0}load(r){this.data.forEach(e=>{this.chart.$__series.forEach(t=>{t.addValue(e)})}),r()}},Ng=class extends gc{constructor(e,t){super(e);this.chart=e;this.data=t}},Ig=class extends gc{constructor(e,t){super(e);this.chart=e;this.url=t}load(e){ca({url:this.url,dataType:kt,success:t=>{this.data=t,super.load(e)}})}},mc=class extends gc{constructor(e,t,n){super(e);this.chart=e;this.dataSource=t;this.filter=n;this.filter=n||(s=>!0),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data));let o=ha(()=>{t.reload&&t.reload(),this.data=t.getNodes().filter(this.filter).map(s=>s.data),this.data.push(...t.getGroups().filter(this.filter).map(s=>s.data)),this.chart.reload()},150);t.bind(Re,o),t.bind(Ce,o),t.bind(Jt,o),t.bind(ve,o),t.bind(Oe,o),t.bind(Wt,o),t.bind(xt,o),t.bind(bt,o),t.bind(cr,o),t.bind(Zt,o)}$setFilter(e){this.filter=e||(t=>!0),this.data=this.dataSource.getNodes().filter(this.filter).map(function(t){return t.data})}};var Sr=class{};var tr=class extends Sr{constructor(e,t,n){super();c(this,"color");c(this,"min");c(this,"max");c(this,"total");c(this,"label");c(this,"id");c(this,"visible");c(this,"categories",[]);c(this,"values",[]);c(this,"valueField");c(this,"minValueField");c(this,"maxValueField");c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"Zg");c(this,"te");this.id=e.id||e.valueField,this.label=e.label,this.valueField=e.valueField,this.minValueField=e.minValueField,this.maxValueField=e.maxValueField,this.color=t,this.visible=!0,this.marker=e.marker,this.markerType=e.markerType,this.markerSize=e.markerSize,this.Zg=n,this.te=new Map,this.reset()}isRangeSeries(){return this.minValueField!=null&&this.maxValueField!=null}reset(){this.min=0,this.max=0,this.total=0,this.values.length=0,this.categories.length=0}toggleVisible(){this.visible=!this.visible}addValue(e){let t=e[this.Zg];t!=null&&vs(this.te,t,()=>[]).push(e);let n,o;if(this.maxValueField!=null&&this.minValueField!=null)o=e[this.maxValueField],n=e[this.minValueField];else{let s=e[this.valueField],a=0;o=s<a?a:s,n=s<a?s:a}this.values.push({min:n,max:o}),n!=null&&(this.min=Math.min(this.min,n)),o!=null&&(this.max=Math.max(this.max,o)),this.total+=o,this.categories.push(e)}getCategories(){return this.categories}expand(){return[this]}};c(tr,"type","record");var DD=1,ND="rangeStart",ID="values",MD="minValues",VD="maxValues",GD="label",$D="id",Ua=class extends Sr{constructor(e,t){super();this.chart=t;c(this,"startPoint");c(this,"step");c(this,"rangeStartField");c(this,"$valuesField");c(this,"$minValuesField");c(this,"$maxValuesField");c(this,"$labelField");c(this,"$idField");c(this,"$labels");c(this,"$labelGenerator");c(this,"$series",[]);c(this,"values");this.startPoint=e.startPoint==null?0:e.startPoint,this.step=e.step==null?DD:e.step,this.rangeStartField=e.rangeStartField||ND,this.$valuesField=e.valuesField||ID,this.$minValuesField=e.minValuesField||MD,this.$maxValuesField=e.maxValuesField||VD,this.$labelField=e.labelField||GD,this.$labelGenerator=e.labelGenerator,this.$idField=e.idField||$D,this.$labels=e.labels||[]}addValue(e){let t=e[this.$minValuesField],n=e[this.$maxValuesField],o=t!=null&&n!=null,s={id:e[this.$idField]||G(),valueField:"v",minValueField:o?"minV":null,maxValueField:o?"maxV":null,label:e[this.$labelField||""]},a=new tr(s,this.chart.colorGenerator.generate(s));if(a.reset(),o){let l=Math.max(t.length,n.length);for(let h=0;h<l;h++){let d=this.Jg(h);a.addValue({minV:t,maxV:n,id:d})}}else{let l=e[this.$valuesField];l!=null&&l.forEach((h,d)=>{let u=this.RA(d,e);a.addValue({v:h,id:u})})}a.values.length>0&&this.$series.push(a)}RA(e,t){return this.$labelGenerator!=null?this.$labelGenerator(e,t):this.$labels[e]!=null?this.$labels[e]:this.Jg(e)}Jg(e){return`${this.startPoint+e*this.step}`}expand(){return this.$series}reset(){this.$series.length=0}};c(Ua,"type","array");var Ya=class extends Sr{constructor(e){super();c(this,"counts",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"valueField");this.valueField=e.valueField||"value",this.color=e.color,this.label=e.label}addValue(e){let t=e[this.valueField];if(t!=null){let n=this.counts.get(t)||0;this.counts.set(t,n+1)}}reset(){this.counts.clear()}expand(){let e=new tr({valueField:"value",id:this.id,label:this.label},this.color);return this.counts.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Ya,"type","collation");var za=class extends Sr{constructor(e){super();c(this,"fields");c(this,"sums",new Map);c(this,"labels");c(this,"colors");this.fields=e.fields,this.labels=e.labels||[],this.colors=new Map,(e.colors||[]).forEach((t,n)=>{this.colors.set(this.fields[n],t)})}addValue(e){this.fields.forEach(t=>{let n=parseFloat(e[t]);if(!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}})}reset(){this.sums.clear()}expand(){let e=new tr({valueField:"value",id:G(),label:"Sum"},"#556623");return this.sums.forEach((t,n)=>{e.addValue({id:n,label:n,value:t,color:this.colors.get(n)||"#556623"})}),[e]}};c(za,"type","summing");var Ec=class extends Sr{constructor(e){super();c(this,"sums",new Map);c(this,"id");c(this,"color");c(this,"label");c(this,"categoryField");c(this,"sumField");this.categoryField=e.categoryField||"category",this.sumField=e.sumField||"value"}addValue(e){let t=e[this.categoryField],n=parseFloat(e[this.sumField]);if(t!=null&&!isNaN(n)){let o=this.sums.get(t)||0;this.sums.set(t,o+n)}}reset(){this.sums.clear()}expand(){let e=new tr({valueField:"value",id:this.id,label:this.label},this.color);return this.sums.forEach((t,n)=>{e.addValue({id:n,value:t})}),[e]}};c(Ec,"type","summing-collation");var Xa=class extends co{constructor(e,t){super(e,t);c(this,"dataSource");c(this,"$__series",[]);c(this,"$focusedSeries");c(this,"seriesElements");c(this,"$model");c(this,"$modelFilter");c(this,"$grouped");c(this,"$groupField");c(this,"Kg");this.dataSource=new Fa,this.Kg=t.series||[],this.$grouped=t.grouped===!0,this.$groupField=t.groupField||"group",this.$model=t.dataSource,this.$modelFilter=t.dataSourceFilter}$init(){this.Kg.forEach(e=>{if(e.type==null||e.type===tr.type){let t=new tr(e,e.color||this.colorGenerator.generate(e),this.$groupField);this.$__series.push(t)}else if(e.type===Ua.type){let t=new Ua(e,this);this.$__series.push(t)}else if(e.type===Ya.type){let t=new Ya(e);this.$__series.push(t)}else if(e.type===Ec.type){let t=new Ec(e);this.$__series.push(t)}else if(e.type===za.type){let t=new za(e);this.$__series.push(t)}})}load(e,t){e.data?this.dataSource=new Ng(this,e.data):e.dataSource?this.dataSource=new mc(this,e.dataSource,e.dataSourceFilter):e.url&&(this.dataSource=new Ig(this,e.url)),this.$load(t)}setDataSourceFilter(e){this.$modelFilter=e,this.dataSource instanceof mc&&(this.dataSource.$setFilter(e),this.$load())}reload(){this.$load()}$reset(){this.$doReset()}$load(e){this.$reset(),this.dataSource.load(()=>{this.$doLoad(),this.$draw(),this.fire(wg,this),e&&e(this)})}hasData(){return this.dataSource.hasData()}};var kn="data-vjs-chart-category",Et="data-vjs-chart-series",Mg="data-vjs-chart-stack",Vg="data-vjs-chart-stack-total",Gg="data-vjs-chart-value",OB="data-vjs-filter",or="start",Si="end",Ti=2,$g=5,F_=10,ux=20,Bg=14,U_=14,Fg="normal",Y_="normal";var BD=["b","br","em","strong"],FD="vjs-tooltip",Ha=class extends es{constructor(e){super({formatter:(t,n)=>_c(t)?BA(t,n||"%d"):t});c(this,"$adt");this.parseAndValidate(e.format)}parseAndValidate(e){try{let t=o=>{if(o.type===Xr.type&&BD.indexOf(o.tag)===-1)throw U(`Unsupported element ${o.tag} in tooltip format. Supported elements are [${BD.join(" ")}]`),"error"},n=this.parse(e);n.filter(o=>o.type!==Ws.type).forEach(t),this.$adt=n}catch(t){U(`VisuallyJs - WARN: Cannot parse tooltip format ${e}`)}}ce(e){switch(e){case"b":case"strong":let t=M("tspan");return L(t,"vjs-b"),t.style.fontWeight="bold",t;case"i":case"em":let n=M("tspan");return n.style.fontStyle="italic",n;case"br":let o=M("tspan");return L(o,"vjs-br"),o.textContent="\u200B",o}}renderTooltip(e){return this.render(this.$adt,e)}},ja=class{constructor(r,e){this.parentElement=r;c(this,"root");c(this,"g");c(this,"bg");c(this,"text");c(this,"$parser");c(this,"$paddingX",8);c(this,"$paddingY",10);c(this,"$valueSuffix");c(this,"Nc");c(this,"qg");var n,o,s,a;if(this.$parser=new Ha(e),this.$valueSuffix=e.valueSuffix,this.Nc=e.timeout==null?2500:e.timeout,this.g=M(Q,{"pointer-events":"none"},{},FD),Lt(r)){this.root=this.g;let l=r,h=l.querySelector("defs");h==null&&(h=M("defs"),l.insertBefore(h,l.childNodes[0]));let d=M("filter",{x:"-20%",y:"-20%",width:"140%",height:"140%",id:"vjs-tooltip-shadow"}),u=M("feDropShadow",{dx:2,dy:2,stdDeviation:3,"flood-color":"rgba(0,0,0,0.5)"});d.appendChild(u),h.appendChild(d),this.g.setAttribute("filter","url(#vjs-tooltip-shadow)")}else this.root=M(Le),this.root.appendChild(this.g);this.bg=M(Z,{fill:e.fill||"#FFFFFF",stroke:e.outline||"#999999","stroke-width":e.outlineWidth||1,"data-z-index":"1000",rx:e.cornerRadius==null?3:e.cornerRadius}),this.g.appendChild(this.bg);let t={"font-size":((n=e.font)==null?void 0:n.size)||"0.8rem","dominant-baseline":"hanging",x:`${this.$paddingX}`,y:`${this.$paddingY}`};(o=e.font)!=null&&o.family&&(t["font-family"]=e.font.family),(s=e.font)!=null&&s.style&&(t["font-style"]=e.font.style),(a=e.font)!=null&&a.weight&&(t["font-weight"]=e.font.weight),e.textColor&&(t.fill=e.textColor),this.text=M(tt,t),this.g.appendChild(this.text),r.appendChild(this.root)}LA(){this.Nc!==-1&&(clearTimeout(this.qg),this.qg=setTimeout(()=>this.hide(),this.Nc))}$renderTooltip(r){this.text.innerHTML="",this.parentElement.insertBefore(this.root,null);let e=this.$parser.renderTooltip(r),t=2;this.text.appendChild(e.fragment);let n=this.text.getBBox().height+t,o=n;Array.from(this.text.querySelectorAll("tspan.vjs-br")).forEach(h=>{h.setAttribute("dy",`${n}`),h.setAttribute("x",`${this.$paddingX}`),h.getBBox().height===0?n=o:n=h.getBBox().height+t});let s=this.text.getBBox(),a=s.width+2*this.$paddingX,l=s.height+2*this.$paddingY;this.bg.setAttribute("x","0"),this.bg.setAttribute("width",`${a}`),this.bg.setAttribute("y","0"),this.bg.setAttribute("height",`${l}`)}formatValue(r){return r==null?null:this.$valueSuffix==null?`${r}`:`${r} ${this.$valueSuffix}`}show(r,e,t){if(this.$parser.$adt!=null){this.$renderTooltip(t);let n=this.g.getBBox(),o=Ze(this.parentElement),s=r.x-n.width*e.x,a=r.y-n.height*e.y,l=5;s=Math.max(l,Math.min(s,o.width-n.width)-l),a=Math.max(l,Math.min(a,o.height-n.height)-l);let h={x:s,y:a};Ie(this.root,h),this.LA()}}hide(){this.root&&this.root.parentElement&&this.parentElement.removeChild(this.root)}},ka=class extends ja{showTooltip(r,e,t,n,o){let s={series:t,category:n,point:{value:this.formatValue(o.value),rawValue:o.value,minValue:this.formatValue(o.minValue),rawMinValue:o.minValue,maxValue:this.formatValue(o.maxValue),rawMaxValue:o.maxValue,stackTotal:o.stackTotal},stack:o.stackId?{id:o.stackId,total:o.stackTotal}:null};super.show(r,e,s)}},Ug=class extends ja{showTooltip(r,e,t,n){super.show(r,e,{series:t,point:n})}};var fc=class{constructor(){c(this,"dataMax",0);c(this,"dataMin",0);c(this,"maxScale",0);c(this,"minScale",0);c(this,"range",0);c(this,"step",0);c(this,"stepCount",0);c(this,"steps",[])}},Wa=class extends Xa{constructor(e,t){super(e,t);c(this,"axisLineSize");c(this,"yAxisPadding");c(this,"yAxes");c(this,"xAxes");c(this,"$crosshairElements",{x:[],y:[]});c(this,"$roundCorners");c(this,"$cornerRadius");c(this,"$realisedSeries",[]);c(this,"un");c(this,"$tooltip");c(this,"$maxLabelSize");this.un=t.tooltip,this.axisLineSize=t.axisLineSize||Ti,this.yAxisPadding=t.yAxisPadding||F_,this.$roundCorners=t.roundCorners!==!1,this.$cornerRadius=t.cornerRadius||$g,this.dataSource=new Fa,this.$maxLabelSize=t.maxLabelSize||.2,this.$init(),this.$bind(st,z(xn),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s),this.$mouseOverChartPoint(o,s,n)}),this.$bind(ot,z(xn),n=>{this.setFocusedSeries(null),this.$mouseOutChartPoint(),this.$hideTooltip()}),this.legend.hover&&(this.$bind(st,z(vg),n=>{let o=n.target,s=parseInt(o.parentNode.getAttribute(Et),10);this.setFocusedSeries(s)}),this.$bind(ot,z(vg),n=>{this.setFocusedSeries(null)}))}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{e.expand().forEach(n=>{this.$realisedSeries.push(n)})})}getSeries(){return this.$realisedSeries}wA(e,t){e.showLine!==!1&&(e.lineElement=k(Z,{height:this.axisLineSize,y:-this.yAxisPadding,x:-(this.axisLineSize/2+this.yAxisPadding)},Qy,t)),e.titleElement=k(Q,{},"",t),e.title!=null&&(zt(e.titleElement,0,e.titlePadding),k(Z,{height:this.legend.padding,fill:"transparent",width:10},"",e.titleElement),ys(e.title,{"text-anchor":this.Qg(e),"dominant-baseline":"hanging",y:this.legend.padding},[ex,m_].join(" "),e.titleElement))}Qg(e){return e.titleAlign===$_?"start":e.titleAlign===B_?"end":"middle"}DA(e,t){e.titleElement=k(tt,{y:0,x:0,"text-anchor":this.Qg(e)},[ex,g_].join(" "),e.element),e.title&&(e.titleElement.innerHTML=e.title);let n=e.titleElement.getBBox(),o=n.height/2;e.titleElement.setAttribute(ee,`${o}`);let s=[],a=0;if(e.labels.forEach(u=>{let p=u.getBBox().width;a=Math.max(a,p),s.push([u,p])}),e.position===or)s.forEach(u=>u[0].setAttribute(ee,`${n.height+10+(a-u[1])}`));else{s.forEach(p=>p[0].setAttribute(ee,"0"));let u=o+a+this.yAxisPadding;e.titleElement.setAttribute(ee,`${u}`)}let l=e.titleAlign==="start"?t.height:e.titleAlign==="end"?0:t.height/2;e.titleElement.setAttribute(fe,`${l}`);let h=e.position===or?270:90;e.titleElement.setAttribute("transform",`rotate(${h}, ${e.titleElement.getAttribute(ee)}, ${l})`),e.showLine!==!1&&(e.lineElement=k(Z,{width:this.axisLineSize,height:t.height+this.axisLineSize/2,y:0,x:n.height+a+10+10},Qy,e.element))}$computeScaleLabel(e,t){if(t.labelFormatter)return t.labelFormatter(e);let n=`${e}`;return t.labelPrefix&&(n=t.labelPrefix+n),t.labelSuffix&&(n=n+t.labelSuffix),n}$precomputeLegend(e,t,n,o){let s=k(Q,{"data-z-index":100},d_,e);if(this.legend.visible&&(this.$realisedSeries.length>1||this.legend.$hideForSingleSeries===!1)){let a=k(Z,{height:1,rx:2,fill:this.style.legendBackgroundColor,stroke:this.style.legendOutlineColor,"stroke-width":this.style.legendOutlineWidth,width:1},"",s),l=2,h=[],d=0;this.$realisedSeries.forEach((g,m)=>{let E=k(Q,{[Et]:m},vg,s),y=k(tt,{y:d,"text-anchor":"start",x:l+19,"dominant-baseline":"hanging","font-size":this.legend.font.size,"font-weight":this.legend.font.weight||"normal","font-style":this.legend.font.style||"normal"},u_,E);y.innerHTML=g.label;let x=y.getBBox();k(Z,{rx:6,ry:6,width:12,height:12,fill:g.color,x:l,y:d},p_,E),s.appendChild(E),h.push([y,E,x]),this.legend.orientation===ax?l+=x.width+21+5:d+=x.height+5});let u=s.getBBox(),p=10;if(a.setAttribute(_e,`${u.width+2*p}`),a.setAttribute(Ve,`${u.height+2*p}`),a.setAttribute("transform",`translate(-${p}, -${p})`),!this.legend.floating){let g=this.legend.align===hx?t/2-u.width/2:this.legend.align===lx?this.margin:t-u.width-this.margin,m=this.legend.valign===cx?n-u.height-this.margin:this.legend.valign===dc?o:(n-u.height)/2;zt(s,g,m)}}return s}$getScaleGrid(e,t){let n=t.useSeriesTotal?t.stackedScale:t.scale,o=n.step/n.range;return n.steps.map((s,a)=>{let l=o*e*a;return e-l})}$getAxisLabels(e,t){return bn(e)?this.NA(e,t):[]}$drawChart(e,t,n,o){this.$recalc(),this.un&&(this.$tooltip=this.$createTooltip(e,this.un)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Ga,e);e.insertBefore(s,o.nextElementSibling);let a=`vjs-plot-clip-${Eo()}`,l=k("defs",{},null,e),h=k("clipPath",{id:a},null,l);k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight},null,h);let d=k(Q,{"clip-path":`url(#${a})`},ic,e),u=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:"transparent","data-z-index":"0"},null,d);u.addEventListener(ae,p=>{let g=this.$fromEventLocation(p);this.$onMouseMove(g)}),u.addEventListener(Xb,()=>{this.$onMouseLeave()}),this.$drawCrosshairs(d,!0,__,p=>!bn(p)),this.seriesElements=this.$realisedSeries.map((p,g)=>k(Q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,[Et]:`${g}`},c_,d)),this.$drawCrosshairs(d,!1,P_,p=>bn(p))}$drawCrosshairs(e,t,n,o){t&&(this.$crosshairElements={x:[],y:[]}),this.xAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:l.width||1,height:this.dim.chartHeight,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${oc} ${n}`,e),p;if(l.showLabel!==!1&&bn(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=ys("",g,sc,e)}this.$crosshairElements.x.push({line:u,label:p,options:l})}}),this.yAxes.forEach(s=>{var a;if(s.crosshair&&(!o||o(s))){let l=s.crosshair,h={width:this.dim.chartWidth,height:l.width||1,visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2},d=l.color;d&&(h.fill=d);let u=k(Z,h,`${oc} ${n}`,e),p;if(l.showLabel!==!1&&bn(s)){let g={visibility:"hidden","pointer-events":"none","data-z-index":l.zIndex||2,"dominant-baseline":"middle","font-size":((a=l.labelFont)==null?void 0:a.size)||13,fill:l.labelColor||l.color};l.labelFont&&(g["font-style"]=l.labelFont.style),p=ys("",g,sc,e)}this.$crosshairElements.y.push({line:u,label:p,options:l})}})}$drawDecoration(e,t,n){let o=k(Q,{},null,e),s=k(Q,{},null,e),a=k(Q,{},null,e),l=k(Q,{},null,e),{yAxes:h,yAxesAtStart:d,yAxesAtEnd:u}=this.$_generateYAxes(),{xAxes:p,xAxesAtStart:g,xAxesAtEnd:m}=this.$_generateXAxes();this.yAxes=h,this.xAxes=p;let E=this.$precomputeTitle(e,t),y=E.getBBox(),x=this.margin,f=this.$titlePlacement===pc?this.margin:x+y.height,b=this.$precomputeLegend(e,t,n,f),A=this.legend.floating?cc():b.getBBox(),T=(D,$)=>{let K=0;for(let xe=0;xe<D.length;xe++){let H=D[xe];H.element=k(Q,{"font-size":H.font.size,"font-face":H.font.style,fill:H.labelColor},[$a,Cg].join(" "),$),H.labelsElement=k(Q,{},qy,H.element),H.labels=this.$getAxisLabels(H,!0),this.wA(H,H.element);let Ee=H.element.getBBox();H.dim=Ee,K+=Ee.height+this.yAxisPadding}};T(g,a),T(m,l);let S=this.$titlePlacement===pc?this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===dc?A.height:0):x+y.height+this.titlePadding,O=()=>{let D=a.getBBox(),$=l.getBBox(),K=n-this.margin-y.height-this.titlePadding-D.height-this.yAxisPadding-this.yAxisPadding-$.height-(this.legend.visible&&!this.legend.floating?this.legend.padding:0)-(this.legend.valign===uc?0:A.height)-this.margin,xe=(this.$titlePlacement===pc?this.margin:S)+D.height+this.yAxisPadding+(this.legend.valign===dc?A.height:0);return{chartHeight:K,chartY:xe}},{chartHeight:v,chartY:_}=O(),P=(D,$)=>{let K=0;for(let xe=0;xe<D.length;xe++){let H=D[xe];H.element=k(Q,{"font-size":H.font.size,"font-face":H.font.style,fill:H.labelColor},[$a,Pg].join(" "),$),H.labelsElement=k(Q,{},qy,H.element),H.labels=this.$getAxisLabels(H,!1),this.DA(H,{y:_,height:v});let Ee=H.element.getBBox();zt(H.element,K-Ee.x,0),H.dim=Ee,K+=Ee.width+this.yAxisPadding}};P(d,o),P(u,s);let I=o.getBBox(),C=this.margin+(this.legend.visible&&!this.legend.floating&&this.legend.valign===uc&&this.legend.align===lx?this.legend.padding+A.width:0);zt(o,C,0);let R=C+I.width+this.yAxisPadding,w=t-R-(this.legend.visible&&!this.legend.floating&&this.legend.valign===uc&&this.legend.align===I_?this.legend.padding+A.width:0)-this.margin;if(u.length>0){let D=s.getBBox();zt(s,R+w+this.yAxisPadding-D.width,0),w-=this.margin+this.yAxisPadding+D.width}p.forEach(D=>{D.lineElement!=null&&D.lineElement.setAttribute(_e,`${w-this.axisLineSize+(this.axisLineSize/2+this.yAxisPadding)}`)});let B=R+w,N=_+v,V={chartWidth:w,chartHeight:v,chartX:R,chartY:_,chartEndX:B,chartEndY:N,width:t,height:n};if(this.$titlePlacement===pc){let D=l.getBBox(),$=this.legend.visible&&!this.legend.floating&&this.legend.valign!==dc&&this.legend.valign!==uc?A.height+this.legend.padding:0;if($>0){let xe=V.chartY+V.chartHeight+this.yAxisPadding+D.height+this.legend.padding;hc(b,xe)}let K=V.chartY+V.chartHeight+this.yAxisPadding+D.height+$+this.titlePadding-this.margin;zt(E,0,K)}for(let D=0;D<p.length;D++){let $=p[D].titleAlign==="start"?0:p[D].titleAlign==="end"?w:w/2;zt(p[D].titleElement,$,p[D].title!=null?p[D].titlePadding:0),bn(p[D])?this.IA(V,p[D]):this.VA(V,p[D].labels);let K=this.$maxLabelSize*V.height;if(N_(p[D].labels,K,"height","width")){let H=p[D].labelsElement.getBBox();p[D].titleElement&&hc(p[D].titleElement,H.y+H.height+this.yAxisPadding);let{chartHeight:Ee,chartY:Fe}=O();V.chartHeight=Ee,V.chartY=Fe,V.chartEndY=Fe+Ee}}zt(a,V.chartX,S),zt(l,V.chartX,V.chartY+V.chartHeight+this.yAxisPadding),hc(o,V.chartY),hc(s,V.chartY);for(let D=0;D<h.length;D++)h[D].lineElement&&h[D].lineElement.setAttribute(Ve,`${V.chartHeight}`),bn(h[D])?this.MA(V,h[D].labels,h[D]):this.GA(V,h[D].labels);if(this.hasData()){if(this.$getXAxisType()==="value")for(let D=0;D<p.length;D++){let $=p[D];$.showGrid&&this.$A(e,V,$)}if(this.$getYAxisType()==="value")for(let D=0;D<h.length;D++){let $=h[D];$.showGrid&&this.BA(e,V,$)}}if(this.legend.visible&&this.legend.floating){let D=V.chartX+V.chartWidth-b.getBBox().width,$=V.chartY;zt(b,D,$)}return V}setFocusedSeries(e){this.seriesElements.forEach((t,n)=>{e!=null&&n!=e?t.setAttribute("opacity","0.2"):t.setAttribute("opacity","1")}),this.$focusedSeries=e}VA(e,t){let n=e.chartWidth/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(ee,`${o*n+n/2}`)}IA(e,t){let n=this.$getScaleGrid(e.chartWidth,t).reverse();t.inverted&&(n=n.reverse());for(let o=0;o<t.labels.length;o++)t.labels[o].setAttribute(ee,`${n[o]}`)}GA(e,t){let n=e.chartHeight/t.length;for(let o=0;o<t.length;o++)t[o].setAttribute(fe,`${o*n+n/2}`)}NA(e,t){let n=[],o=e.useSeriesTotal?e.stackedScale:e.scale;return o.steps.forEach((s,a)=>{let l=t?{"text-anchor":a===o.stepCount?"end":"middle","dominant-baseline":"hanging",x:0,y:0}:{x:0,y:0,"dominant-baseline":"middle"},h=this.$computeScaleLabel(s,e),d=ys(h,l,O_,e.labelsElement);if(e.labelColorGenerator){let u=e.labelColorGenerator(s,a);u!=null&&d.setAttribute("fill",u)}n.push(d)}),n}MA(e,t,n){let o=this.$getScaleGrid(e.chartHeight,n);n.inverted&&(o=o.reverse());for(let s=0;s<t.length;s++)t[s].setAttribute(fe,`${o[s]}`)}$A(e,t,n){let o=this.$getScaleGrid(t.chartWidth,n),s=k(Q,{transform:`translate(${t.chartX}, ${t.chartY})`},rx,e);for(let a=0;a<o.length;a++)k(Z,{height:t.chartHeight,x:o[a],y:0,width:1,fill:this.style.gridLineColor},nx,s)}BA(e,t,n){let o=this.$getScaleGrid(t.chartHeight,n),s=k(Q,{transform:`translate(${t.chartX}, ${t.chartY})`},rx,e);for(let a=0;a<o.length;a++)k(Z,{width:t.chartWidth,y:o[a],x:0,height:1,fill:this.style.gridLineColor},nx,s)}$onMouseMove(e){this.xAxes.forEach((t,n)=>{let o=this.$crosshairElements.x[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.x,this.dim.chartWidth);if(h!=null){if(bn(t)){let d=this.dim.chartX+h*this.dim.chartWidth;if(s.setAttribute(ee,`${d}`),a){let u=t,p=u.scale.minScale+h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?ox(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ha({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d+m.width+5<this.dim.chartX+this.dim.chartWidth?d+5:d-m.width-5,y;l.labelPosition==="end"?y=this.dim.chartY+5+m.height/2:y=this.dim.chartY+this.dim.chartHeight-5-m.height/2,a.setAttribute(ee,`${E}`),a.setAttribute(fe,`${y}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartWidth/t.labels.length;s.setAttribute(_e,`${d}`);let u=Math.floor(e.x/d);s.setAttribute(ee,`${this.dim.chartX+u*d}`)}s.setAttribute(fe,`${this.dim.chartY}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}}),this.yAxes.forEach((t,n)=>{let o=this.$crosshairElements.y[n];if(o){let s=o.line,a=o.label,l=o.options,h=this.$getProportionalPos(t,e.y,this.dim.chartHeight,!0);if(h!=null){if(bn(t)){let d=this.dim.chartY+h*this.dim.chartHeight;if(s.setAttribute(fe,`${d}`),a){let u=t,p=u.scale.maxScale-h*(u.scale.maxScale-u.scale.minScale),g=l.labelValueFormat!==void 0?ox(p,l.labelValueFormat):Math.round(p).toString();if(l.labelFormat){let f=new Ha({format:l.labelFormat}).renderTooltip({value:g,rawValue:p}).fragment.childNodes[0];a.innerHTML="",a.appendChild(f)}else a.textContent=g;let m=a.getBBox(),E=d-m.height-5>this.dim.chartY?d-5:d+m.height+5,y;l.labelPosition==="end"?y=this.dim.chartX+this.dim.chartWidth-5-m.width/2:y=this.dim.chartX+5+m.width/2,a.setAttribute(ee,`${y}`),a.setAttribute(fe,`${E}`),a.removeAttribute("visibility")}}else{let d=this.dim.chartHeight/t.labels.length;s.setAttribute(Ve,`${d}`);let u=Math.floor(e.y/d);s.setAttribute(fe,`${this.dim.chartY+u*d}`)}s.setAttribute(ee,`${this.dim.chartX}`),s.removeAttribute("visibility")}else s.setAttribute("visibility","hidden"),a&&a.setAttribute("visibility","hidden")}})}$onMouseLeave(){this.$crosshairElements.x.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")}),this.$crosshairElements.y.forEach(e=>{e.line.setAttribute("visibility","hidden"),e.label&&e.label.setAttribute("visibility","hidden")})}$getProportionalPos(e,t,n,o=!1){if(t<0||t>n)return null;if(bn(e))return t/n;{let s=e.labels.length;if(s===0)return null;let a=1/s;return Math.floor(t/(n/s))*a+a/2}}$hideTooltip(){this.$tooltip&&this.$tooltip.hide()}};function Yg(i){return typeof i=="number"&&Number.isFinite(i)}function UD(i,r){if(r==null)return null;let e=r.min,t=r.max;return!Yg(e)||!Yg(t)?null:e<=t?{min:e,max:t}:{min:t,max:e}}function YD(i){var e,t,n;let r={};for(let o of i)if(o!=null)for(let[s,a]of Object.entries(o)){let l=UD(s,a);if(l==null)continue;let h=r[s];h==null?r[s]={min:l.min,max:l.max,step:a.step,stepCount:a.stepCount,minLimit:a.minLimit,maxLimit:a.maxLimit}:r[s]={min:Math.min(h.min,l.min),max:Math.max(h.max,l.max),step:(e=h.step)!=null?e:a.step,stepCount:h.stepCount,minLimit:(t=h.minLimit)!=null?t:a.minLimit,maxLimit:(n=h.maxLimit)!=null?n:a.maxLimit}}return r}function zD(i,r){if(r==null)return i;let e=vr({},i);for(let[t,n]of Object.entries(r)){if(n==null)continue;let o=e[t],s=Yg(n.min),a=Yg(n.max),l=Yg(n.step);if(!s&&!a&&!l)continue;let h=o!=null?vr({},o):{min:s?n.min:a?n.max:0,max:a?n.max:s?n.min:0};s&&(h.min=n.min,h.minLimit=n.min),a&&(h.max=n.max,h.maxLimit=n.max),l&&(h.step=n.step),e[t]=h.min<=h.max?h:Wg(vr({},h),{min:h.max,max:h.min,minLimit:h.maxLimit,maxLimit:h.minLimit})}return e}function XD(i){let r={};for(let[e,t]of Object.entries(i)){let n=UD(e,t);n!=null&&(t.step!=null?r[e]=lc(n.min,n.max,t.step):t.stepCount!=null?r[e]=w_(n.min,n.max,t.stepCount):r[e]=ac(n.min,n.max,6,t.minLimit,t.maxLimit))}return r}function z_(i){let r=YD(i.extentsList),e=zD(r,i.overrides),t=XD(e);return{extents:e,scales:t}}var px=class{constructor(r,e,t){this.chart=r;this.type=t;c(this,"$valueAxis");this.$valueAxis=(e==null?void 0:e.valueAxis)||be}getDomainExtents(){return{}}},uo=class extends px{get $inverted(){return this.chart.$getXAxisType()!=="value"}},X_=new Map;function Za(i,r){X_.set(i,r)}function j_(i,r,e){if(X_.has(i))return X_.get(i)(r,e)}function Ja(i){return i.stacked===!0||i.stacked==="percent"||i.stacked==="default"}var Ka=class extends Sr{constructor(e,t,n,o,s,a,l,h,d,u){super();this.xAxisField=e;this.yAxisField=t;c(this,"$data",[]);c(this,"$xAxis",{min:1/0,max:-1/0});c(this,"$yAxis",{min:1/0,max:-1/0});c(this,"marker");c(this,"markerType");c(this,"markerSize");c(this,"color");c(this,"outline");c(this,"outlineWidth");c(this,"outlineColor");c(this,"resolveMarker");this.marker=n,this.markerType=o,this.markerSize=s,this.color=a,this.outline=l!==!1,this.outlineWidth=h||1,this.outlineColor=d,this.resolveMarker=u}reset(){this.$data=[],this.$xAxis={min:1/0,max:-1/0},this.$yAxis={min:1/0,max:-1/0}}addValue(e){let t=e[this.xAxisField],n=e[this.yAxisField];t!=null&&n!=null&&(this.$data.push(e),this.$xAxis.min=Math.min(this.$xAxis.min,t),this.$xAxis.max=Math.max(this.$xAxis.max,t),this.$yAxis.min=Math.min(this.$yAxis.min,n),this.$yAxis.max=Math.max(this.$yAxis.max,n))}expand(){return[]}};function RB(i){return{position:i,showLine:!1,showGrid:!0,id:be}}function LB(i){return{position:i,id:be}}var Wn=class extends Wa{constructor(e,t){super(e,t);c(this,"$valueAxes");c(this,"$valueAxesMin");c(this,"$valueAxesMax");c(this,"$categoryAxes");c(this,"$inverted");c(this,"Ro");c(this,"Lo");c(this,"$categories",[]);c(this,"$plots",[]);c(this,"eE");this.Ro=t.valueAxis,this.Lo=t.categoryAxis,this.$inverted=t.inverted===!0,this.eE=t.pivot===!0;let n=t.plots;n!=null&&(Array.isArray(n)?n:[n]).forEach(s=>{let a=j_(s.type,this,s.options||{});this.$plots.push(a)}),this.load(t)}FA(e,t,n){let o=[];return this.$categories.forEach((s,a)=>{let l=n?{x:0,y:0,"text-anchor":"middle","dominant-baseline":"hanging"}:{"dominant-baseline":"middle","text-anchor":"start",x:0,y:0},h=ys(s[t],l,"",e);o.push(h)}),o}$getAxisLabels(e,t){return D_(e)?this.FA(e.labelsElement,e.labelField,t):super.$getAxisLabels(e,t)}UA(){var t,n,o;this.$categoryAxes=[];let e=this.Lo==null?[LB(this.$inverted?Si:or)]:Array.isArray(this.Lo)?this.Lo:[this.Lo];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:G(),h={showLine:a.showLine===!0,lineSize:a.lineSize||Ti,labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,id:l,labelField:a.labelField||"id",title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Ba,titlePadding:((o=a.title)==null?void 0:o.padding)||ux,position:a.position||(this.$inverted?Si:or),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,type:"category",titleElement:null,labelsElement:null,font:Ai(U_,Y_,"normal","sans-serif",a.font),crosshair:a.crosshair};this.$categoryAxes.push(h)}}$doReset(){super.$doReset(),this.$categories.length=0}zA(){if(this.$realisedSeries.length>0){let e=new Ds,t=this.$realisedSeries.map(l=>[l.label,l.valueField,l.minValueField,l.maxValueField]),n=this.$realisedSeries[0],o=n.getCategories(),s=n.isRangeSeries(),a=[];o.forEach(l=>{let h=s?{id:l.id,label:l.id,minValueField:"min",maxValueField:"max"}:{id:l.id,label:l.id,valueField:"value"},d=new tr(h,e.generate(),this.$groupField),u=l[this.$groupField],p=n.te.has(u);t.forEach(m=>{let E=o.find(y=>y.id===l.id);E&&(s?d.addValue({id:m[0],min:E[m[2]],max:E[m[3]]}):d.addValue({id:m[0],value:E[m[1]]}))});let g=d;p&&(g.stack=u),a.push(g)}),this.$realisedSeries=a}}$doLoad(){super.$doLoad(),(this.$grouped||this.eE)&&this.zA(),this.$realisedSeries.length>0&&(this.$categories=this.$realisedSeries[0].getCategories().slice())}$recalc(){this.UA(),this.YA();let e=this.$plots.map(o=>o.getDomainExtents()),t={};this.$valueAxes.forEach(o=>{t[o.domain]={min:o.min,max:o.max,step:o.step},o.stackedDomain&&(t[o.stackedDomain]={min:o.min,max:o.max,step:o.step})});let{scales:n}=z_({extentsList:e,overrides:t});this.$valueAxes.forEach(o=>{o.scale=n[o.domain],o.stackedScale=o.stackedDomain!=null&&n[o.stackedDomain]!=null?n[o.stackedDomain]:o.scale})}YA(){var t,n,o;this.$valueAxes=[],this.$valueAxesMax=null,this.$valueAxesMin=null;let e=this.Ro==null?[RB(this.$inverted?or:Si)]:Array.isArray(this.Ro)?this.Ro:[this.Ro];for(let s=0;s<e.length;s++){let a=e[s],l=a.id!=null?a.id:s===0?be:G(),h=this.$plots.find(p=>p.$valueAxis===l&&Ja(p))!=null,d=this.$plots.find(p=>p.$valueAxis===l&&p.stacked==="percent")!=null,u={domain:this.$inverted?"y":"x",stackedDomain:this.$inverted?"yStacked":"xStacked",labelColor:a.labelColor||this.style.labelColor,labelColorGenerator:a.labelColorGenerator||this.style.labelColorGenerator,min:a.min,max:a.max,showLine:a.showLine===!0,lineSize:a.lineSize||Ti,showGrid:a.showGrid!==!1,gridLineSize:a.gridLineSize||Ti,id:l,title:((t=a.title)==null?void 0:t.text)||"",titleAlign:((n=a.title)==null?void 0:n.align)||Ba,titlePadding:((o=a.title)==null?void 0:o.padding)||ux,position:a.position||(this.$inverted?or:Si),dim:{x:0,y:0,width:0,height:0},labels:[],element:null,useSeriesTotal:h,type:"value",titleElement:null,labelsElement:null,font:Ai(Bg,Fg,"normal","sans-serif",a.font),scale:new fc,stackedScale:new fc,crosshair:a.crosshair,isPercent:d,step:a.step,labelPrefix:a.labelPrefix,labelSuffix:d&&a.labelSuffix==null&&a.labelFormatter==null?"%":a.labelSuffix,labelFormatter:a.labelFormatter};this.$valueAxes.push(u),a.min!=null&&(this.$valueAxesMin=this.$valueAxesMin==null?a.min:Math.min(a.min,this.$valueAxesMin)),a.max!=null&&(this.$valueAxesMax=this.$valueAxesMax==null?a.max:Math.max(a.max,this.$valueAxesMax))}}$_generateYAxes(){return this.$inverted?{yAxes:this.$valueAxes,yAxesAtStart:this.$valueAxes.filter(e=>e.position===or),yAxesAtEnd:this.$valueAxes.filter(e=>e.position===Si)}:{yAxes:this.$categoryAxes,yAxesAtStart:this.$categoryAxes.filter(e=>e.position===or),yAxesAtEnd:this.$categoryAxes.filter(e=>e.position===Si)}}$_generateXAxes(){return this.$inverted?{xAxes:this.$categoryAxes,xAxesAtStart:this.$categoryAxes.filter(e=>e.position===or),xAxesAtEnd:this.$categoryAxes.filter(e=>e.position===Si)}:{xAxes:this.$valueAxes,xAxesAtStart:this.$valueAxes.filter(e=>e.position===or),xAxesAtEnd:this.$valueAxes.filter(e=>e.position===Si)}}$drawChart(e,t,n,o){super.$drawChart(e,t,n,o),this.$plots.forEach(s=>s.$draw(e,this.dim,this.$valueAxesMin,this.$valueAxesMax))}XA(e,t){return(t?e.chartHeight:e.chartWidth)/this.$categories.length}$getCategoryCenter(e,t,n){let o=this.XA(t,n);return o*e+o/2}$mouseOverChartPoint(e,t,n){let o=this.$fromEventLocation(n),s=parseInt(e.getAttribute(kn),10),a=e.getAttribute(Mg),l=e.getAttribute(Vg),h=e.getAttribute(Gg);this.$maybeShowTooltip(t,s,{x:o.x+this.dim.chartX,y:o.y+this.dim.chartY},{x:.5,y:1},a,l!=null?parseFloat(l):null,h!=null?parseFloat(h):null)}$mouseOutChartPoint(){}$maybeShowTooltip(e,t,n,o,s,a,l){if(this.$tooltip!=null){let h=this.$realisedSeries[e],d=this.$categories[t],u=d[h.valueField];l!=null&&(u=l);let p=d[h.minValueField],g=d[h.maxValueField];this.$tooltip.showTooltip(n,o,h,d.id,{value:u,minValue:p,maxValue:g,stackTotal:a,stackId:s})}}$getXAxisType(){return this.$inverted?"category":"value"}$getYAxisType(){return this.$inverted?"value":"category"}$createTooltip(e,t){return new ka(e,t)}};var wB=xr(),jD={square:(i,r,e)=>M(Z,{x:r-i/2,y:e-i/2,width:i,height:i}),circle:(i,r,e)=>M(Be,{cx:r,cy:e,r:i/2}),cross:(i,r,e)=>M(q,{d:`M ${r} ${e-i/2} v ${i} M ${r-i/2} ${e} h ${i}`,"stroke-width":2,stroke:"#000000",fill:"#000000"})};function zg(i,r,e,t,n,o){let s=i.markerType||"circle",l=(jD[s]||jD.circle)(t,r,e);if(n)for(let h in n)l.setAttribute(h,n[h]);return o&&L(l,o),l}function yc(i,r,e,t){let o=wB.template(G(),r||{},s=>i).childNodes[0];if(e)for(let s in e)o.setAttribute(s,e[s]);return t&&L(o,t),o}var qa=class extends Wa{constructor(e,t){super(e,t);this.options=t;c(this,"$xAxisDimensions",{min:1/0,max:-1/0});c(this,"$yAxisDimensions",{min:1/0,max:-1/0});c(this,"xAxis");c(this,"yAxis");c(this,"axisFont");c(this,"U");c(this,"j");c(this,"tE");c(this,"rE");this.axisFont=Ai(Bg,Fg,"normal","sans-serif",t.axisFont),this.U=t.xAxis||{},this.j=t.yAxis||{},this.tE=t.minimumMarkerSize!=null?t.minimumMarkerSize:8,this.rE=t.maximumMarkerSize!=null?t.maximumMarkerSize:50,this.$dualValueInit(t),this.load(t),this.$bind(st,z(_g),n=>{if(this.$tooltip){let o=n.target,s=parseInt(o.getAttribute(Et)),a=this.$__series[s],l=parseInt(o.getAttribute("data-idx"),10),h=a.$data[l],d=o.getBBox(),u={x:d.x,y:d.y,width:d.width,height:d.height},p={x:.5,y:.5},g={x:u.x+u.width*p.x+this.dim.chartX,y:u.y+u.height*p.y+this.dim.chartY};this.$tooltip.showTooltip(g,{x:.5,y:1.1},a,h)}}),this.$bind(ot,z(_g),n=>{this.$tooltip&&this.$tooltip.hide()})}$createTooltip(e,t){return new Ug(e,t)}$init(){}$dualValueInit(e){e.series.forEach(t=>{let n=new Ka(t.xAxisField,t.yAxisField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$doLoad(){this.$xAxisDimensions={min:this.U.min!==void 0?this.U.min:1/0,max:this.U.max!==void 0?this.U.max:-1/0},this.$yAxisDimensions={min:this.j.min!==void 0?this.j.min:1/0,max:this.j.max!==void 0?this.j.max:-1/0},this.$__series.forEach(e=>{this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,e.$xAxis.min),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,e.$xAxis.max),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,e.$yAxis.min),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,e.$yAxis.max)}),this.$adjustDimensionsForMarkers()}$adjustDimensionsForMarkers(){let e=this.$xAxisDimensions.max-this.$xAxisDimensions.min,t=this.$yAxisDimensions.max-this.$yAxisDimensions.min,n=this.wc||500,o=this.Dc||500,s=3;this.$__series.forEach(a=>{a.$data.forEach(l=>{let h=l[a.xAxisField],d=l[a.yAxisField];if(h!=null&&d!=null){let p=this.$getMarkerSize(a,l)/2+s,g=p/n*e,m=p/o*t;this.$xAxisDimensions.min=Math.min(this.$xAxisDimensions.min,h-g),this.$xAxisDimensions.max=Math.max(this.$xAxisDimensions.max,h+g),this.$yAxisDimensions.min=Math.min(this.$yAxisDimensions.min,d-m),this.$yAxisDimensions.max=Math.max(this.$yAxisDimensions.max,d+m)}})})}$setupValueAxes(e){var t,n,o,s,a,l,h,d;this.yAxis={domain:"y",inverted:this.j.inverted===!0,labelColor:this.j.labelColor||this.style.labelColor,labelColorGenerator:this.j.labelColorGenerator||this.style.labelColorGenerator,min:this.j.min,max:this.j.max,showLine:this.j.showLine===!0,lineSize:this.j.lineSize||Ti,dim:cc(),element:k(Q,{},[$a,Pg].join(" "),e),id:this.j.id||G(),position:this.j.position||or,titleAlign:((t=this.j.title)==null?void 0:t.align)||Ba,title:(n=this.j.title)==null?void 0:n.text,titlePadding:((o=this.j.title)==null?void 0:o.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.j.showGrid!==!1,gridLineSize:this.j.lineSize||2,useSeriesTotal:!1,font:((s=this.j)==null?void 0:s.font)||this.axisFont,scale:this.j.step!=null?lc(this.$yAxisDimensions.min,this.$yAxisDimensions.max,this.j.step):ac(this.$yAxisDimensions.min,this.$yAxisDimensions.max),stackedScale:null,crosshair:this.j.crosshair,step:this.j.step,labelPrefix:this.j.labelPrefix,labelSuffix:this.j.labelSuffix,labelFormatter:this.j.labelFormatter},this.xAxis={domain:"x",inverted:this.U.inverted===!0,labelColor:this.U.labelColor||this.style.labelColor,labelColorGenerator:this.U.labelColorGenerator||this.style.labelColorGenerator,min:this.U.min,max:this.U.max,showLine:this.U.showLine===!0,lineSize:this.U.lineSize||Ti,dim:cc(),element:k(Q,{},[$a,Cg].join(" "),e),id:this.U.id||G(),position:this.U.position||or,titleAlign:((a=this.U.title)==null?void 0:a.align)||Ba,title:((l=this.U.title)==null?void 0:l.text)||"",titlePadding:((h=this.U.title)==null?void 0:h.padding)||10,labels:[],type:"value",titleElement:null,lineElement:null,labelsElement:null,showGrid:this.U.showGrid!==!1,gridLineSize:this.U.lineSize||2,useSeriesTotal:!1,font:((d=this.U)==null?void 0:d.font)||this.axisFont,scale:this.U.step!=null?lc(this.$xAxisDimensions.min,this.$xAxisDimensions.max,this.U.step):ac(this.$xAxisDimensions.min,this.$xAxisDimensions.max),stackedScale:null,crosshair:this.U.crosshair,step:this.U.step,labelPrefix:this.U.labelPrefix,labelSuffix:this.U.labelSuffix,labelFormatter:this.U.labelFormatter}}$drawChart(e,t,n,o){this.$setupValueAxes(e),super.$drawChart(e,t,n,o),this.$plotPoints(e)}$doReset(){super.$doReset(),this.$xAxisDimensions.min=1/0,this.$yAxisDimensions.min=1/0,this.$xAxisDimensions.max=-1/0,this.$yAxisDimensions.max=-1/0}$plotPoints(e){let t=this.$getDataPointCssClass();this.$__series.forEach((n,o)=>{let s=[];n.$data.forEach((a,l)=>{let h=a[n.xAxisField],d=a[n.yAxisField],u;if(h&&d){let p=(h-this.xAxis.scale.minScale)/this.xAxis.scale.range,g=(d-this.yAxis.scale.minScale)/this.yAxis.scale.range;this.xAxis.inverted&&(p=1-p),this.yAxis.inverted||(g=1-g);let m=n.color||this.$defaultColor||"#000000",E=p*this.dim.chartWidth,y=g*this.dim.chartHeight,x;if(n.marker)x=yc(n.marker,a,{transform:`translate(${this.dim.chartX+E}, ${this.dim.chartY+y})`,fill:m});else if(n.resolveMarker){u=this.$getMarkerSize(n,a);let b=n.resolveMarker(a);x=yc(b,a,{transform:`translate(${this.dim.chartX+E-u/2}, ${this.dim.chartY+y-u/2})`,fill:m,width:u,height:u})}else u=this.$getMarkerSize(n,a),x=zg(n,E,y,u,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,fill:m});if(n.color&&x.setAttribute("fill",n.color),n.outline){let b=n.outlineColor||Kc(m).toString();x.setAttribute("stroke",b),x.setAttribute("stroke-width",(n.outlineWidth||1).toString())}x.setAttribute("data-x",h.toString()),x.setAttribute("data-y",d.toString()),x.setAttribute(Et,o.toString()),x.setAttribute("data-idx",l.toString()),x.classList.add(xn),t!=null&&x.classList.add(t),e.appendChild(x);let f=u==null?10:Math.max(10,u/2);s.push(M(Be,{cx:E,cy:y,r:f,fill:"transparent",stroke:"none",transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`,"data-x":h.toString(),"data-y":d.toString(),[Et]:o.toString(),"data-idx":l.toString()},null,_g))}}),s.forEach(a=>e.appendChild(a))})}$getBaseMarkerSize(){let e=0;this.$__series.forEach(l=>e+=l.$data.length);let t=10,n=this.dim.chartWidth*this.dim.chartHeight,o=Math.sqrt(n)/500,s=Math.max(1,Math.sqrt(e/100)),a=t*o/s;return Math.min(this.rE,Math.max(this.tE,a))}$getXAxisType(){return"value"}$getYAxisType(){return"value"}$mouseOutChartPoint(){}$mouseOverChartPoint(e,t){}$_generateYAxes(){return{yAxes:[this.yAxis],yAxesAtStart:[this.yAxis],yAxesAtEnd:[]}}$_generateXAxes(){return{xAxes:[this.xAxis],xAxesAtEnd:[this.xAxis],xAxesAtStart:[]}}$recalc(){}};var HD=.8,kD=50,WD=10;function DB(i){return i.type===wr.type}var gx=class gx extends uo{constructor(e,t){super(e,t,gx.type);this.chart=e;this.options=t;c(this,"stacked");c(this,"$distinctStacks",[]);this.stacked=t==null?void 0:t.stacked}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(h=>{typeof h.min=="number"&&Number.isFinite(h.min)&&(s=Math.min(s,h.min)),typeof h.max=="number"&&Number.isFinite(h.max)&&(a=Math.max(a,h.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),Ja(this)&&this.chart.$categories.length>0)if(this.$distinctStacks=Array.from(new Set(o.map(h=>h.stack||"default"))),this.stacked==="percent")n[t]={min:0,max:100,stepCount:4};else{let h=0;for(let d=0;d<this.chart.$categories.length;d++){let u={};this.$distinctStacks.forEach(p=>u[p]=0),o.forEach(p=>{var E,y;let g=p.stack||"default",m=(y=(E=p.values)==null?void 0:E[d])==null?void 0:y.max;typeof m=="number"&&Number.isFinite(m)&&(u[g]+=m)}),this.$distinctStacks.forEach(p=>{h=Math.max(h,u[p])})}n[t]={min:0,max:h}}return n}computeBarSize(e){let t=Ja(this)?Math.max(1,this.$distinctStacks.length):this.chart.seriesElements.length,n=this.options.barGap==null?WD:this.options.barGap,o=n*(t-1),s=e/this.chart.$categories.length,a=this.options.barSize!=null?this.options.barSize:(()=>{let h=(this.options.fillRatio==null?HD:this.options.fillRatio)*s,d=this.options.maxBarSize==null?kD:this.options.maxBarSize;return Math.min(d,(h-o)/t)})();return{barSize:a,gapBetweenBars:n,spaceUsedPerCategory:a*t+o,spacePerCategory:s,barsPerCategory:t}}$getBarCenter(e,t,n){let o=this.computeBarSize(this.$inverted?n.chartWidth:n.chartHeight);return this.chart.$getCategoryCenter(e,n,!this.$inverted)-o.spaceUsedPerCategory/2+o.barSize/2+t*(o.barSize+o.gapBetweenBars)}$computeBarPlacements(e,t,n,o){return Ja(this)?this.stacked==="percent"?this.$computeBarPlacementsStackedPercent(e,t):this.$computeBarPlacementsStacked(e,t):this.$computeBarPlacementsDefault(e,t,n,o)}$computeBarPlacementsStackedPercent(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(E=>(E.stack||"default")===h),p=[],g=0;u.forEach(E=>{let y=E.values[s].max;p.push([o.indexOf(E),y]),g+=y});let m=0;p.forEach((E,y)=>{if(this.$inverted){let x=(E[1]+m)/g,f=m/g,b=Math.abs((x-f)*e.chartHeight);f=e.chartHeight-f*e.chartHeight-b,n.push({x:l,y:f,height:b,width:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}else{let x=(E[1]+m)/g,f=m/g,b=(x-f)*e.chartWidth;f*=e.chartWidth,n.push({x:f,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:y===p.length-1,width:b,category:s,series:E[0],rounded:y===p.length-1,stackId:h,stackTotal:g,value:E[1]})}m+=E[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsStacked(e,t){let n=[],o=this.chart.getSeries();for(let s=0;s<this.chart.$categories.length;s++){let l=this.chart.$getCategoryCenter(s,e,!this.$inverted)-t.spaceUsedPerCategory/2;this.$distinctStacks.forEach((h,d)=>{let u=o.filter(y=>(y.stack||"default")===h),p=[],g=0;u.forEach(y=>{let x=y.values[s].max;p.push([o.indexOf(y),x]),g+=x});let m=0,E=this.chart.$valueAxes[0].stackedScale;p.forEach((y,x)=>{if(this.$inverted){let f=(y[1]+m)/E.range,b=m/E.range,A=Math.abs((f-b)*e.chartHeight);b=e.chartHeight-b*e.chartHeight-A,n.push({x:l,y:b,height:A,width:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}else{let f=(y[1]+m)/E.range,b=m/E.range,A=(f-b)*e.chartWidth;b*=e.chartWidth,n.push({x:b,y:l,height:t.barSize,canRoundStart:!1,canRoundEnd:x===p.length-1,width:A,category:s,series:y[0],rounded:x===p.length-1,stackId:h,stackTotal:g,value:y[1]})}m+=y[1]}),l+=t.barSize+t.gapBetweenBars})}return n}$computeBarPlacementsDefault(e,t,n,o){let s=this.chart.getSeries(),a=[],l=this.chart.$valueAxes[0].scale;for(let h=0;h<this.chart.$categories.length;h++){let u=this.chart.$getCategoryCenter(h,e,!this.$inverted)-t.spaceUsedPerCategory/2;for(let p=0;p<s.length;p++){let g=s[p],m=n==null?g.values[h].min:Math.max(n,g.values[h].min),E=o==null?g.values[h].max:Math.min(g.values[h].max,o);if(this.$inverted){let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=x!==0,b=Math.abs((y-x)*e.chartHeight);x=e.chartHeight-x*e.chartHeight-b,a.push({x:u,y:x,canRoundStart:f,canRoundEnd:!0,height:b,width:t.barSize,category:h,series:p,rounded:!0,value:g.values[h].max})}else{let y=(E-l.minScale)/l.range,x=(m-l.minScale)/l.range,f=Math.abs((y-x)*e.chartWidth);x*=e.chartWidth,a.push({x,canRoundStart:x!==0,canRoundEnd:!0,y:u,height:t.barSize,width:f,category:h,series:p,rounded:!0,value:g.values[h].max})}u+=t.barSize+t.gapBetweenBars}}return a}$draw(e,t,n,o){let s=this.computeBarSize(this.$inverted?t.chartWidth:t.chartHeight),a=this.$computeBarPlacements(t,s,n,o),l=this.$inverted?[f_,xn].join(" "):[x_,xn].join(" "),h=this.chart.getSeries();a.forEach(d=>{let u={fill:h[d.series].color,[kn]:`${d.category}`,[Et]:`${d.series}`};d.stackId!=null&&(u[Mg]=d.stackId),d.stackTotal!=null&&(u[Vg]=`${d.stackTotal}`),d.value!=null&&(u[Gg]=`${d.value}`),NB(d,!this.$inverted,u,l,this.chart.seriesElements[d.series],this.chart.$roundCorners&&d.canRoundStart,this.chart.$roundCorners&&d.canRoundEnd,this.chart.$cornerRadius),this.options.dataLabels&&this.$drawDataLabel(d,e)})}$drawDataLabel(e,t){let n=this.chart.getSeries()[e.series],o=this.chart.$categories[e.category],s=e.value,a="";if(this.options.dataLabels===!0?a=this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`:typeof this.options.dataLabels=="string"&&(a=this.options.dataLabels.replace("{series}",n.id).replace("{category}",o.id).replace("{value}",this.stacked==="percent"?`${Math.round(s/e.stackTotal*100)}%`:`${s}`),e.stackId!=null&&(a=a.replace("{stack}",e.stackId))),a.length>0){let l=this.chart.dim.chartX+e.x+e.width/2,h=this.chart.dim.chartY+e.y+e.height/2;Rg(a,l,h,n.color,{size:11},t)}}};c(gx,"type","bar");var wr=gx;Za(wr.type,(i,r)=>new wr(i,r));function NB(i,r,e,t,n,o,s,a){let l,h=a||$g;return r?o&&s&&i.width>h?l=`M ${i.x}, ${i.y+h} q0,-${h}, ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-2*h} q-${h},0 -${h},-${h} z`:s&&i.width>h?l=`M ${i.x},${i.y} h${i.width-h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} h-${i.width-h} z`:o&&i.width>h?l=`M ${i.x},${i.y+h} q0, -${h} ${h},-${h} h${i.width-h} v${i.height} h${-(i.width-h)} q-${h},0 -${h},-${h} z`:l=`M ${i.x},${i.y} h${i.width} v${i.height} h-${i.width} Z`:o&&s&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-2*h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-2*h} q0,${h} -${h},${h} z`:s&&i.height>h?l=`M ${i.x},${i.y+i.height} v-${i.height-h} q0,-${h} ${h},-${h} h${i.width-2*h} q${h},0 ${h},${h} v${i.height-h} z`:o&&i.height>h?l=`M ${i.x+h},${i.y+i.height} q-${h},0 -${h},-${h} v-${i.height-h} h${i.width} v${i.height-h} q0,${h} -${h},${h} z`:l=`M ${i.x},${i.y+i.height} v-${i.height} h${i.width} v${i.height} Z`,k(q,Object.assign({d:l},e),t,n)}var H_=class extends Wn{constructor(r,e){super(r,Object.assign({},e,{inverted:!(e!=null&&e.inverted),plots:{type:xc.type,options:e.plotOptions||{}}})),L(r,L_),this.$bind(ae,z(ic),t=>{let{x:n,y:o}=this.$fromEventLocation(t),s=null;if(this.$getXAxisType()==="category"){let a=this.dim.chartWidth/this.$categories.length;s=Math.floor(n/a)}else{let a=this.dim.chartHeight/this.$categories.length;s=Math.floor(o/a)}if(s!=null){let a=this.$plots[0],{loc:l,seriesIndex:h}=a.showMarker(s,this.dim,this.$focusedSeries);l!=null&&this.$tooltip!=null&&this.$maybeShowTooltip(h,s,{x:l.x+this.dim.chartX,y:l.y+this.dim.chartY},{x:.5,y:1.1})}}),this.$bind(ae,z(Og),t=>{let n=t.target,o=parseInt(n.getAttribute(Et),10);this.setFocusedSeries(o)}),this.$bind(ot,z(Og,ic),t=>{this.$plots[0].hideMarker(),this.setFocusedSeries(null),this.$hideTooltip()})}},mx=class mx extends uo{constructor(e,t){var n,o;super(e,t,mx.type);this.chart=e;c(this,"stacked");c(this,"Ic");c(this,"nE");c(this,"Vc");c(this,"Ot",[]);this.stacked=(t==null?void 0:t.stacked)===!0,this.Ic=((n=t.marker)==null?void 0:n.enabled)!==!1,this.nE=((o=t.marker)==null?void 0:o.size)||10}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.stacked&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===wr.type);return s==null?o:s.$getBarCenter(e,t,n)}}$draw(e,t,n,o){this.Ot.length=0;let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale;for(let l=0;l<this.chart.$categories.length;l++)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.Ot[h]=this.Ot[h]||[],this.$inverted){let p=t.chartHeight-(u.values[l].max-a.minScale)/a.range*t.chartHeight;this.Ot[h].push({x:d,y:p})}else{let p=(u.values[l].max-a.minScale)/a.range;this.Ot[h].push({x:p*t.chartWidth,y:d})}}for(let l=this.chart.$categories.length-1;l>-1;l--)for(let h=0;h<s.length;h++){let d=this.$getValueLocation(l,h,t),u=s[h];if(this.$inverted){let p=t.chartHeight-(u.values[l].min-a.minScale)/a.range*t.chartHeight;this.Ot[h].push({x:d,y:p})}else{let p=(u.values[l].min-a.minScale)/a.range;this.Ot[h].push({x:p*t.chartWidth,y:d})}}for(let l=0;l<this.Ot.length;l++){let h=s[l].color,d=`M ${this.Ot[l].map(u=>`${u.x} ${u.y}`).join(" L ")}`;k(q,{stroke:h,"stroke-width":"1",d,fill:h,opacity:.8,[Et]:`${l}`},Og,this.chart.seriesElements[l])}this.Vc=k(Be,{cx:"0",cy:"0",r:this.nE/2,visibility:"hidden","stroke-width":"1"},"vjs-area-marker",e)}showMarker(e,t,n){if(this.Ic!==!1){let o=this.chart.getSeries(),s=n==null?0:n,a=o[s],l=this.Ot[s][e];return ie(this.Vc,{visibility:"visible",cx:l.x+t.chartX,cy:l.y+t.chartY,fill:a.color,stroke:Kc(a.color).toString()}),{series:a,loc:l,seriesIndex:s}}}hideMarker(){this.Ic!==!1&&ie(this.Vc,{visibility:"hidden"})}};c(mx,"type","area");var xc=mx;Za(xc.type,(i,r)=>new xc(i,r));var k_=class extends Wn{constructor(r,e){super(r,Object.assign({},e,{inverted:!0,plots:{type:wr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,E_)}};var W_=class extends Wn{constructor(r,e){super(r,Object.assign({},e,{inverted:!1,plots:{type:wr.type,options:Object.assign({stacked:e.stacked!=null?e.stacked:null,grouped:e.grouped===!0,groupField:e.groupField,dataLabels:e.dataLabels},e.plotOptions||{})}})),L(r,y_)}};var Ex=class extends Ka{constructor(e,t,n,o,s,a,l,h,d,u,p){super(e,t,o,s,a,l,h,d,u,p);this.xAxisField=e;this.yAxisField=t;this.valueField=n;c(this,"$valueAxis",{min:1/0,max:-1/0})}addValue(e){super.addValue(e);let t=e[this.valueField];t!=null&&(this.$valueAxis.min=Math.min(this.$valueAxis.min,t),this.$valueAxis.max=Math.max(this.$valueAxis.max,t))}},Z_=class extends qa{constructor(e,t){super(e,t);this.options=t;L(e,b_)}$dualValueInit(e){e.series.forEach(t=>{let n=new Ex(t.xAxisField,t.yAxisField,t.valueField,t.marker,t.markerType,t.markerSize,t.color,t.outline,t.outlineWidth,t.outlineColor,t.resolveMarker);this.$__series.push(n)})}$getMarkerSize(e,t){let n=this.options.minPointSize||10,o=this.options.maxPointSize,s=t[e.valueField];if(s==null)return null;let a=this.$getBaseMarkerSize(),l=Math.min(this.dim.chartWidth,this.dim.chartHeight),h=Math.min(a*7,l*.2),d=o||h,u=e.$valueAxis.max-e.$valueAxis.min,p=u===0?.5:(s-e.$valueAxis.min)/u,g=n+Math.sqrt(p)*(d-n);return Math.max(n,g)}$getDataPointCssClass(){return A_}};var ZD="vjs-gauge-chart",JD="vjs-gauge-track",J_="vjs-gauge-zone",KD="vjs-gauge-tick",qD="vjs-gauge-label",QD="vjs-gauge-needle",eN="vjs-gauge-needle-pivot",K_=class extends co{constructor(e,t){var n,o,s,a,l,h;super(e,t);this.options=t;c(this,"_t");c(this,"wo");c(this,"Re");c(this,"Te");c(this,"Mt");c(this,"Mc");this._t=(n=t.startAngle)!=null?n:-135,this.wo=(o=t.endAngle)!=null?o:135,this.Re=(s=t.innerRadius)!=null?s:.8,this.Te=(a=t.min)!=null?a:0,this.Mt=(l=t.max)!=null?l:100,this.Mc=(h=t.value)!=null?h:this.Te,L(e,ZD),this.$draw()}getValue(){return this.Mc}setValue(e){this.Mc=e,this.$draw()}hasData(){return this.getValue()!=null}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){var xe;this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Ga,e);e.insertBefore(s,o.nextElementSibling);let a=H=>(H-90)*Math.PI/180,l=a(this._t),h=a(this.wo),d=Math.cos(l),u=Math.cos(l),p=Math.sin(l),g=Math.sin(l),m=[h];for(let H=-180;H<=270;H+=90){let Ee=a(H);H>=this._t&&H<=this.wo&&m.push(Ee)}m.forEach(H=>{d=Math.min(d,Math.cos(H)),u=Math.max(u,Math.cos(H)),p=Math.min(p,Math.sin(H)),g=Math.max(g,Math.sin(H))});let E=.9,y=u-d,x=g-p,f=Math.min(this.dim.chartWidth*E/y,this.dim.chartHeight*E/x),b=this.dim.chartX+this.dim.chartWidth/2-f*(u+d)/2,A=this.dim.chartY+this.dim.chartHeight/2-f*(g+p)/2,T=f*this.Re,S=b+f*Math.cos(l),O=A+f*Math.sin(l),v=b+f*Math.cos(h),_=A+f*Math.sin(h),P=b+T*Math.cos(h),I=A+T*Math.sin(h),C=b+T*Math.cos(l),R=A+T*Math.sin(l),w=this.wo-this._t<=180?0:1,B=[`M ${S} ${O}`,`A ${f} ${f} 0 ${w} 1 ${v} ${_}`,`L ${P} ${I}`,`A ${T} ${T} 0 ${w} 0 ${C} ${R}`,"Z"].join(" ");k(q,{d:B,fill:"#EEE",stroke:"#CCC","stroke-width":1},JD,e);let N=(xe=this.getValue())!=null?xe:this.Te,V=Math.max(this.Te,Math.min(this.Mt,N)),D=this.Mt-this.Te,$=this.wo-this._t,K=this.options.showNeedle!==!1;if(this.options.zones&&this.options.zones.forEach((H,Ee)=>{let Fe=H.from,Je=H.to;if(!K){if(V<=Fe)return;Je=Math.min(Je,V)}let Xt=this._t+(Fe-this.Te)/D*$,sr=this._t+(Je-this.Te)/D*$,rr=a(Xt),Dr=a(sr),go=b+f*Math.cos(rr),Qa=A+f*Math.sin(rr),el=b+f*Math.cos(Dr),tl=A+f*Math.sin(Dr),rl=b+T*Math.cos(Dr),nl=A+T*Math.sin(Dr),jg=b+T*Math.cos(rr),Hg=A+T*Math.sin(rr),Ac=sr-Xt<=180?0:1,kg=[`M ${go} ${Qa}`,`A ${f} ${f} 0 ${Ac} 1 ${el} ${tl}`,`L ${rl} ${nl}`,`A ${T} ${T} 0 ${Ac} 0 ${jg} ${Hg}`,"Z"].join(" "),Sc=H.color;if(H.gradient){let bs=e.querySelector("defs");bs||(bs=k("defs",{},"",e),e.insertBefore(bs,e.firstChild));let re=`vjs-gauge-gradient-${Ee}-${Math.round(Math.random()*1e6)}`,je=k("linearGradient",{id:re,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},"",bs);H.gradient.stops.forEach(wt=>{k("stop",{offset:`${wt.offset}%`,"stop-color":wt.color},"",je)}),Sc=`url(#${re})`}k(q,{d:kg,fill:Sc,stroke:"none"},`${J_} ${J_}-${Ee}`,e)}),this.options.ticks){let H=[];if(this.options.ticks.values)H=this.options.ticks.values;else if(this.options.ticks.interval!=null)for(let Ee=this.Te;Ee<=this.Mt;Ee+=this.options.ticks.interval)H.push(Ee);H.forEach(Ee=>{let Fe=this._t+(Ee-this.Te)/D*$,Je=a(Fe),Xt=f*.95,sr=b+f*Math.cos(Je),rr=A+f*Math.sin(Je),Dr=b+Xt*Math.cos(Je),go=A+Xt*Math.sin(Je);k(q,{d:`M ${sr} ${rr} L ${Dr} ${go}`,stroke:this.options.ticks.color||"#666","stroke-width":this.options.ticks.width||1},KD,e)})}if(this.options.labels){let H=[];if(this.options.labels.values)H=this.options.labels.values;else if(this.options.labels.interval!=null)for(let Fe=this.Te;Fe<=this.Mt;Fe+=this.options.labels.interval)H.push(Fe);let Ee=f+(this.options.labels.distance||0);H.forEach(Fe=>{let Je=this._t+(Fe-this.Te)/D*$,Xt=a(Je),sr=b+Ee*Math.cos(Xt),rr=A+Ee*Math.sin(Xt);k("text",{x:sr,y:rr,"text-anchor":"middle","dominant-baseline":"central","font-size":"12px",fill:"#333"},qD,e).textContent=Fe.toString()})}if(K){let H=this._t+(V-this.Te)/D*$,Ee=a(H),Fe=f*.9,Je=f*.05,Xt=Ee-Math.PI/2,sr=Ee+Math.PI/2,rr=b+Fe*Math.cos(Ee),Dr=A+Fe*Math.sin(Ee),go=b+Je*Math.cos(Xt),Qa=A+Je*Math.sin(Xt),el=b+Je*Math.cos(sr),tl=A+Je*Math.sin(sr),rl=`M ${go} ${Qa} L ${rr} ${Dr} L ${el} ${tl} Z`;k(q,{d:rl,fill:"#333",stroke:"#000","stroke-width":1},QD,e);let nl=Je*1.5;k("circle",{cx:b,cy:A,r:nl,fill:"#333",stroke:"#666","stroke-width":1},eN,e)}}};var q_=class extends Wn{constructor(e,t){super(e,Object.assign({},t,{inverted:!(t!=null&&t.inverted),plots:{type:bc.type,options:t.plotOptions||{}}}));this.options=t;L(e,R_)}},fx=class fx extends uo{constructor(e,t){super(e,t,fx.type);this.chart=e;c(this,"iE");c(this,"oE");this.iE=t.stacked===!0,this.oE=t.spline===!0}getDomainExtents(){let e=this.$inverted?"y":"x",t=this.$inverted?"yStacked":"xStacked",n={},o=this.chart.getSeries();if(o.length===0)return n;let s=1/0,a=-1/0;if(o.forEach(l=>{typeof l.min=="number"&&Number.isFinite(l.min)&&(s=Math.min(s,l.min)),typeof l.max=="number"&&Number.isFinite(l.max)&&(a=Math.max(a,l.max))}),s!==1/0&&a!==-1/0&&(n[e]={min:s,max:a}),this.iE&&this.chart.$categories.length>0){let l=0;for(let h=0;h<this.chart.$categories.length;h++){let d=0;o.forEach(u=>{var g,m;let p=(m=(g=u.values)==null?void 0:g[h])==null?void 0:m.max;typeof p=="number"&&Number.isFinite(p)&&(d+=p)}),l=Math.max(l,d)}n[t]={min:0,max:l}}return n}$getValueLocation(e,t,n){let o=this.chart.$getCategoryCenter(e,n,!this.$inverted);if(this.chart.getSeries().length===1)return o;if(this.chart.$plots.length===1)return o;{let s=this.chart.$plots.find(a=>a.type===wr.type);return s==null?o:s.$getBarCenter(e,t,n)}}jA(e,t){function n(a){return`C ${a.cp1.x} ${a.cp1.y}, ${a.cp2.x} ${a.cp2.y}, ${a.x2} ${a.y2} `}let o=RE(e.slice(t),.15),s=`M ${o[0].segment.x1} ${o[0].segment.y1}`;return s+=o.map(a=>n(a.segment)).join(""),s}kA(e,t){return`M ${e.slice(t).map(n=>`${n.x} ${n.y}`).join(" L ")}`}$draw(e,t,n,o){let s=this.chart.getSeries(),a=this.chart.$valueAxes[0].scale,l=[],h=[],d=(u,p)=>{let g,m;return this.$inverted?(m=t.chartHeight-(p-a.minScale)/a.range*t.chartHeight,g=u):(g=t.chartWidth*((p-a.minScale)/a.range),m=u),{cx:g,cy:m}};for(let u=0;u<this.chart.$categories.length;u++)for(let p=0;p<s.length;p++){let g=this.$getValueLocation(u,p,t);l[p]=l[p]||[],h[p]=h[p]||[];let m=s[p],E=m.values[u].max,{cx:y,cy:x}=d(g,E);if(E!=null&&this.sE(s[p],y,x,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),l[p].push({x:y,y:x,hasValue:E!=null}),m.isRangeSeries()){let{cx:f,cy:b}=d(g,m.values[u].min);m.values[u].min!=null&&this.sE(s[p],f,b,m.markerSize||10,m.color,this.chart.$getBackgroundColor(),u,p,this.chart.seriesElements[p]),h[p].push({x:f,y:b,hasValue:m.values[u].min!=null})}}for(let u=0;u<l.length;u++){let p=s[u].color,g=l[u].findIndex(E=>E.hasValue),m=this.oE?this.jA(l[u],g):this.kA(l[u],g);k(q,{stroke:p,"stroke-width":"1",d:m,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}for(let u=0;u<h.length;u++){let p=s[u].color;if(h[u].length>0){let g=h[u].findIndex(E=>E.hasValue),m=`M ${h[u].slice(g).map(E=>`${E.x} ${E.y}`).join(" L ")}`;k(q,{stroke:p,"stroke-width":"1",d:m,fill:"none",[Et]:`${u}`},[].join(" "),this.chart.seriesElements[u])}}}sE(e,t,n,o,s,a,l,h,d){if(e.marker){let u=yc(e.marker,null,{[kn]:`${l}`,[Et]:`${h}`},[xn].join(" "));d.appendChild(u);let p=u.getBBox();return u.setAttribute("transform",`translate(${t-p.width/2}, ${n-p.height/2})`),u}else{let u=zg(e,t,n,o,{fill:s,"stroke-width":"1",stroke:a,[kn]:`${l}`,[Et]:`${h}`},[xn].join(" "));return d.appendChild(u),u}}};c(fx,"type","line");var bc=fx;Za(bc.type,(i,r)=>new bc(i,r));var tN="vjs-pie-chart",Xg="vjs-pie-slice",Q_="vjs-pie-slice-selected",eO=class extends Xa{constructor(e,t){super(e,t);this.options=t;c(this,"$dataPoints",[]);c(this,"$tooltip");c(this,"Do");c(this,"No");c(this,"Gc");c(this,"oi");c(this,"Re");c(this,"$realisedSeries",[]);c(this,"un");this.Do=t.selectedCategory,this.Gc=t.selectedSliceOffset||10,this.oi=t.interactive===!0,this.Re=t.innerRadius,this.un=t.tooltip,this.$init(),this.load(t),this.$bind(st,z(Xg),n=>{if(this.$tooltip){let o=n.target,s=o.getBBox(),a={x:s.x,y:s.y,width:s.width,height:s.height},l={x:.5,y:.5},h={x:a.x+a.width*l.x,y:a.y+a.height*l.y},{category:d,series:u}=this.aE(o),p=this.$dataPoints[d],g=this.$realisedSeries[u];this.$tooltip.showTooltip(h,{x:.5,y:.5},g,p.label,{value:p.value})}}),this.$bind(ot,z(Xg),n=>{this.$tooltip&&this.$tooltip.hide()}),this.$bind(W,z(Xg),n=>{if(this.oi){let o=n.target,{category:s,series:a}=this.aE(o);this.HA(s,a,o)}}),L(e,tN)}aE(e){let t=parseInt(e.getAttribute(kn),10),n=parseInt(e.parentNode.getAttribute(Et),10);return{category:t,series:n}}$recalc(){if(this.$realisedSeries.length>0){this.$dataPoints.length=0;let e=0,t=this.$realisedSeries[0],n=t.getCategories();t.values.forEach((o,s)=>{let a=o.max/t.total,l=a*2*Math.PI,h={p:a,arc:l,arcStart:e,data:n[s],label:n[s].id,value:o.max};this.$dataPoints.push(h),e+=l})}}hasData(){return this.dataSource.hasData()}$doReset(){this.$__series.forEach(e=>e.reset()),this.$realisedSeries.length=0}$doLoad(){this.$__series.forEach(e=>{let t=e.expand();this.$realisedSeries.push(...t)}),this.$recalc()}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){this.un&&(this.$tooltip=new ka(e,this.un)),this.dim=this.$drawDecoration(e,t,n);let s=k(Z,{x:this.dim.chartX,y:this.dim.chartY,width:this.dim.chartWidth,height:this.dim.chartHeight,"aria-hidden":!0,fill:this.$getPlotBackgroundColor(),"data-z-index":"0"},Ga,e);e.insertBefore(s,o.nextElementSibling);let a={x:this.dim.chartX+this.dim.chartWidth/2,y:this.dim.chartY+this.dim.chartHeight/2},h=.35*Math.min(this.dim.chartWidth,this.dim.chartHeight),d=this.options.colors,u=this.options.color;this.$dataPoints.forEach((p,g)=>{let m=M(Q,{"data-name":p.label,"data-category":g});e.appendChild(m);let E=p.arcStart,y=p.arc+p.arcStart,x=p.arcStart+p.arc/2,f=a.x+h*Math.cos(E),b=a.y+h*Math.sin(E),A=a.x+h*Math.cos(y),T=a.y+h*Math.sin(y),S=p.p>.5?1:0,O="";if(p.p>=1)if(this.Re!=null){let $=this.Re*h;O=`M ${a.x+h} ${a.y}
|
|
137
137
|
A ${h} ${h} 0 1 1 ${a.x-h} ${a.y}
|
|
138
138
|
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y}
|
|
139
139
|
M ${a.x+$} ${a.y}
|
|
140
140
|
A ${$} ${$} 0 1 0 ${a.x-$} ${a.y}
|
|
141
141
|
A ${$} ${$} 0 1 0 ${a.x+$} ${a.y} Z`}else O=`M ${a.x+h} ${a.y}
|
|
142
142
|
A ${h} ${h} 0 1 1 ${a.x-h} ${a.y}
|
|
143
|
-
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(O=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this.Re!=null){let $=a.x+this.Re*h*Math.cos(E),K=a.y+this.Re*h*Math.sin(E),xe=a.x+this.Re*h*Math.cos(y),H=a.y+this.Re*h*Math.sin(y);O=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${xe} ${H} A ${this.Re*h} ${this.Re*h} 0 ${S} 0 ${$} ${K} Z `}let v={x:this.Dc*Math.cos(x),y:this.Dc*Math.sin(x)},_=M(q,{fill:u||(d?d[g%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:O,"data-t":`translate(${v.x}, ${v.y})`,[kn]:`${g}`});L(_,Yg),g===this.Ro&&this.eE(_),m.appendChild(_);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,R,w,B;if(p.p>=1)if(I&&this.Re!=null)R=a.x,w=a.y,B="middle";else{let $=-Math.PI/2;R=a.x+C*Math.cos($),w=a.y+C*Math.sin($),B="middle"}else R=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),B=R<a.x?"end":"start";let N=M("text",{"text-anchor":B,"dominant-baseline":"central",x:R,y:w});this.options.labelFont&&(this.options.labelFont.size&&N.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&N.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&N.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&N.setAttribute("font-style",this.options.labelFont.style));let V=p.label,D=this.options.showLabels||"label";if(D==="value"?V=`${p.value}`:D==="percentage"?V=`${Math.round(p.p*100)}%`:D==="label-value"?V=`${p.label}: ${p.value}`:D==="label-percentage"&&(V=`${p.label}: ${Math.round(p.p*100)}%`),N.innerHTML=V,m.appendChild(N),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let K=p.p<3&&g%2===0?h*.4:h*.5,xe=a.x+K*Math.cos(x),H=a.y+K*Math.sin(x),Ee=u||(d?d[g%d.length]:this.colorGenerator.generate(p)),Fe=this.options.labelFont||{size:12,weight:"bold"},Je="";this.options.dataLabels==="percentage"?Je=`${Math.round(p.p*100)}%`:Je=`${p.value}`,_g(Je,xe,H,Ee,Fe,m)}})}BA(){this.Lo!=null&&(this.FA(this.Lo),this.Lo=null)}eE(e){this.Lo=e,this.UA(this.Lo)}$A(e,t,n){this.BA(),this.Ro===e?this.Ro=null:(this.Ro=e,this.eE(n))}UA(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,K_)}FA(e){e.removeAttribute("transform"),F(e,K_)}};function xs(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function tN(i,r,e){return r.reduce((t,n)=>t+xs(n,e),0)}function wB(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function DB(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function NB(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function IB(i,r,e,t,n,o){MB(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>wB(s),s=>DB(s),o)}function MB(i,r,e,t,n,o,s,a,l,h){let d=t.filter(u=>o(u).length===0).map(u=>{let p=s(u),g=tN(u,p,h);return u.data.height=g,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:g},layer:0,id:u.id,type:"root",vertexSet:null,edges:p,leaf:p.length===0}});for(d.sort((u,p)=>p.edges.length-u.edges.length),r(d);e.size<t.length;){let u=new Set,p=[];d.forEach(g=>{a(g.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(g=>{let m=tN(g,o(g),h);g.data.height=m,g.data.width=n,p.push({offset:0,obj:g,size:{width:n,height:m},id:g.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(g.id,!0)}),r(p),d=p}}function Q_(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=NB(T,e),O=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:O})}IB(d,u,s,a,r,o),new Ls({layers:d},(T,S,O)=>{let v=[];for(let _=0;_<d[S].entries.length;_++)jx(d[S].entries[_].obj,O.obj)&&v.push([d[S].entries[_],_]);return v},null).execute();let g=d[h],E=e*(g.entries.length-1)+l,y=n===-1?1:n/E,x=(t-r)/(d.length-1),f=0;for(let T=0;T<d.length;T++){let S=d[T],O=S.size*y,v=E*y-O,_=S.entries.length-1,P=_>0?Math.max(e,v/(_+2)):e,C=(E*y-(O+P*_))/2;S.entries.forEach(R=>{let w=R.obj.getSourceEdges().length===0;R.size.height*=y,R.obj.data.height*=y,R.obj.data.left=f,R.obj.data.top=C,R.obj.data.layer=T,R.obj.data.isTerminus=w,R.obj.data.isSource=T===0,R.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=R.size.height+P}),f+=x}let b=E*y,A=e;for(let T=0;T<20;T++){for(let S=1;S<d.length;S++)rN(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)rN(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(O=>{let v=O.size.height/y,_=0,P=Array.from(O.obj.getSourceEdges());P.sort((C,R)=>{let w=C.target.data.top+C.target.data.height/2,B=R.target.data.top+R.target.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<P.length;C++){let R=xs(P[C],o);P[C].data.lineWidth=R*y;let w=_+R/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},_+=R}_=0;let I=Array.from(O.obj.getTargetEdges());I.sort((C,R)=>{let w=C.source.data.top+C.source.data.height/2,B=R.source.data.top+R.source.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<I.length;C++){let R=xs(I[C],o),w=_+R/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},_+=R}});return{layers:d,scale:y}}function rN(i,r,e,t,n){i.entries.forEach(a=>{let l=n?a.obj.getTargetEdges():a.obj.getSourceEdges();if(l.length>0){let h=0,d=0;l.forEach(u=>{let p=n?u.source:u.target,g=xs(u,r);d+=(p.data.top+p.data.height/2)*g,h+=g}),a.obj.data.top=d/h-a.obj.data.height/2}}),i.entries.sort((a,l)=>a.obj.data.top-l.obj.data.top);for(let a=0;a<i.entries.length-1;a++){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data,d=l.top+l.height+e-h.top;d>0&&(l.top-=d/2,h.top+=d/2)}let o=i.entries[0].obj.data;o.top<0&&(o.top=0);for(let a=1;a<i.entries.length;a++){let l=i.entries[a-1].obj.data,h=i.entries[a].obj.data;h.top<l.top+l.height+e&&(h.top=l.top+l.height+e)}let s=i.entries[i.entries.length-1].obj.data;if(s.top+s.height>t){s.top=t-s.height;for(let a=i.entries.length-2;a>=0;a--){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data;l.top+l.height+e>h.top&&(l.top=h.top-e-l.height)}}}var eO="sankey-csv",fx="vjs-sankey-edge",Qr="vjs-sankey-unselected",po="vjs-sankey-selected",nN="vjs-sankey",yx="vjs-sankey-node",xx="vjs-sankey-label",rO=class extends co{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"Nc");c(this,"Ic");c(this,"tE");c(this,"D");c(this,"Qe");c(this,"ni");c(this,"Le");c(this,"Do");c(this,"ga");c(this,"No");c(this,"Io",[]);c(this,"ii");c(this,"Vo",{});c(this,"oi",{});c(this,"Mo",{});c(this,"Go",{});c(this,"$o",[]);c(this,"wo",null);c(this,"pt");c(this,"$tooltip");L(e,nN),Zx("sankey-csv",AA),this.wo=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.ga=t.labelProperty||"label",this.Do=t.valueProperty||"value",this.tE=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.Nc=t.nodeWidth||15,this.Ic=t.nodePadding||10,this.ni=t.interactive!==!1;let n=t.labels||{};this.pt={font:Ai(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.YA(),this.Gn(t)}get currentModel(){return this.wo!=null?this.Qe:this.D}zA(e,t){switch(this.linkColorStrategy){case"source-target":return{gradient:[[0,e.color],[100,t.color]]};case"target":return{color:t.color};case"static":return{color:this.linkColor};case"source":default:return{color:e.color}}}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){if(this.D==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=M(Q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=Q_(this.D,this.Nc,this.Ic,t,n,this.Do);if(this.wo){if(this.Qe.getNodes().length===0){let b=VB(a,this.wo,this.Do,this.ga);this.XA(b)}a=Q_(this.Qe,this.Nc,this.Ic,t,n,this.Do).layers}this.$o=a;let l=M(Q);s.appendChild(l);let h=M(Q);s.appendChild(h);let d=M(Q);if(s.appendChild(d),this.$o.length===0||this.$o[0].entries.length===0)return;this.ni&&(this.$tooltip=new tO(e,{format:"{{content}}",valueSuffix:this.tE||""},this.Do,this.ga));let u=0,p=0,g=1/0,m=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),g=Math.min(g,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),m=Math.min(m,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=M(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[te]:b.id},{},yx);this.oi[b.id]=A,h.appendChild(A),E(A);let T=M(Q),S=b.data[this.ga]||b.getFullId(),O=M(et,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.pt.padding:b.data.labelAlign==="start"&&b.data.layer===this.$o.length-1?b.data.left+b.data.width+this.pt.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.pt.font.size,"font-style":this.pt.font.style,[te]:b.id},{},xx);if(O.innerHTML=S,this.Mo[b.id]=O,T.appendChild(O),d.appendChild(T),this.pt.backgroundColor!=="transparent"){let v=O.getBBox(),_=M(Z,{rx:"3",x:v.x-this.pt.padding,y:v.y-this.pt.padding,width:v.width+this.pt.padding*2,height:v.height+this.pt.padding*2,fill:this.pt.backgroundColor,[te]:b.id});this.Go[b.id]=_,T.insertBefore(_,O)}E(O)}});let x=y.getAllEdges().slice();x.sort((b,A)=>A.data.lineWidth-b.data.lineWidth),x.forEach(b=>{let A=b.anchors.source,T=b.anchors.target,S=b.source.data,O=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},_={x:O.left,y:O.top+T.y*O.height},P=.25*(_.x-v.x),I=b.data.lineWidth/2,C=v.y-I,R=v.y+I,w=_.y-I,B=_.y+I,V={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${_.x-P} ${w}, ${_.x} ${w}`,`L ${_.x} ${B}`,`C ${_.x-P} ${B}, ${v.x+P} ${R}, ${v.x} ${R}`,"Z"].join(" "),opacity:.3,stroke:"none",[Qe]:b.id};if(b.data.color)V.fill=b.data.color;else if(b.data.gradient){let{id:$,g:K}=TT(v.x,_.x,b.data.gradient);l.appendChild(K),V.fill=`url(#${$})`}let D=M(q,V,{},fx);this.Vo[b.id]=D,l.appendChild(D),E(D)}),t=u+this.dim.chartX-g,n=p+this.dim.chartY,e.setAttribute("viewBox",`${g} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${g}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${m}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-g,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:g,y:0,width:t,height:n},this.fire(Rg)}nodeDecorator(e,t){return Object.assign(e,{color:this.colorGenerator.generate(e),width:50,height:50})}edgeDecorator(e,t,n){return Object.assign(e,this.zA(t,n))}Gn(e){if(this.D=mn(),this.Qe=mn(),e.dataSource==null)(e.url!=null||e.csvData!=null||e.jsonData!=null)&&this.load({url:e.url,csvData:e.csvData,jsonData:e.jsonData});else{this.Le=e.dataSource;let t=la(()=>{this.rE()},150);this.Le.bind(Re,t),this.Le.bind(Ce,t),this.Le.bind(Jt,t),this.Le.bind(ve,t),this.Le.bind(Oe,t),this.Le.bind(Wt,t),this.Le.bind(xt,t),this.Le.bind(bt,t),this.Le.bind(hr,t),this.Le.bind(Zt,t),this.Le.bind(Ir,t),this.rE()}}XA(e){this.Qe.clear(),e.nodes.forEach(t=>{this.Qe.addNode(this.nodeDecorator(Object.assign({},t),!1))}),e.edges.forEach(t=>{let n=this.Qe.getVertex(t.source),o=this.Qe.getVertex(t.target);this.Qe.addEdge({source:n,target:o,data:this.edgeDecorator(Object.assign({},t.data||{}),n.data,o.data)})})}rE(){this.D.clear(),this.Qe.clear(),this.Le.getNodes().forEach(e=>{this.D.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Le.getAllEdges().forEach(e=>{let t=this.D.getVertex(e.source.id),n=this.D.getVertex(e.target.id);this.D.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e,t){this.Qe.clear(),this.D.clear();function n(){return e.dataType!=null?e.dataType:e.csvData!=null?eO:e.jsonData!=null?kt:e.url!=null&&e.url.indexOf(".json")!==-1?kt:eO}this.D.load({type:n(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw(),t&&t()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.D!=null&&this.D.getNodes().length>0}destroy(){super.destroy()}jA(){this.No!=null&&(this.ii.vertices.forEach(e=>{F(this.oi[e.id],po),F(this.Mo[e.id],po);let t=this.Go[e.id];t&&F(t,po)}),this.Io.forEach(e=>F(e[1],po)),Object.values(this.Vo).forEach(e=>F(e,Qr)),Object.values(this.oi).forEach(e=>F(e,Qr)),Object.values(this.Mo).forEach(e=>F(e,Qr)),Object.values(this.Go).forEach(e=>F(e,Qr))),this.No=null,this.ii=null,this.Io.length=0}nE(e){return this.$o.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}kA(e){let t=new Map;return e.getAllEdges().forEach(n=>{let o=n.source===e?n.target:n.source,s=`${o.getFullId()}-${n.id}`;t.has(s)||t.set(s,[o,n])}),Array.from(t.values())}HA(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.nE(s);this.kA(s).forEach(d=>{t.has(d[0])||this.nE(d[0])>l===a&&(n.add(d[1]),t.add(d[0]),o(d[0],a))})};return o(e,!0),o(e,!1),{vertices:Array.from(t),edges:Array.from(n)}}Vc(e){this.jA(),e!=null&&(this.No=this.currentModel.getNode(e),Object.values(this.oi).forEach(n=>L(n,Qr)),Object.values(this.Mo).forEach(n=>L(n,Qr)),Object.values(this.Go).forEach(n=>L(n,Qr)),Object.values(this.Vo).forEach(n=>L(n,Qr)),this.ii=this.HA(this.No),this.ii.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.Io=this.ii.edges.map(n=>[n,this.Vo[n.id]]),this.ii.vertices.forEach(n=>{Ut(this.oi[n.id],[po],[Qr]),Ut(this.Mo[n.id],[po],[Qr]);let o=this.Go[n.id];o&&Ut(o,[po],[Qr])}),this.Io.forEach(n=>{Ut(n[1],[po],[Qr])}),this.fire("sankey:hover",{vertex:this.No,edges:this.Io}))}YA(){this.ni&&(this.$eventManager.on(this.container,st,z(yx,xx),e=>{let n=e.target.getAttribute(te);this.Vc(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.oi[n])}),this.$eventManager.on(this.container,ot,z(yx,xx,fx),e=>{this.Vc(null)}),this.$eventManager.on(this.container,st,z(fx),e=>{let n=e.target.getAttribute(Qe);this.Vc(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.Vo[n])}))}pivot(e){this.wo=e!=null&&e.length>0?e:null,this.Qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},tO=class extends Xa{constructor(e,t,n,o){super(e,t);this.valueProperty=n;this.labelProperty=o}showEdgeTooltip(e,t,n){let o=[e.source,e.target];o.sort((d,u)=>d.data.layer-u.data.layer);let s=o[0].data[this.labelProperty]||o[0].id,a=o[1].data[this.labelProperty]||o[1].id,l=`${s} \u2192 ${a}: ${parseInt(e.data[this.valueProperty])} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}showNodeTooltip(e,t,n){let o=0,s=e.getSourceEdges();s.length>0?o=s.map(d=>xs(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>xs(u,this.valueProperty)).reduce((u,p)=>u+p);let l=`${e.data[this.labelProperty]||e.id} : ${o.toFixed(2)} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}};function VB(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(xn({id:l.id},l.obj.data))})});for(let a=0;a<i.length-1;a++){let l=i[a],h=new Map,d=new Map;l.entries.forEach(u=>{let p=u.id;u.obj.getSourceEdges().forEach(g=>{let m=g.target.id,E=g.data[r]||"Unspecified",y=xs(g,e),x=`v_${a}_${E}`;s.has(x)||(n.push({id:x,[t]:E,isVirtual:!0,type:"pivot-metadata"}),s.add(x)),h.has(p)||h.set(p,new Map);let f=h.get(p);f.set(E,(f.get(E)||0)+y),d.has(x)||d.set(x,new Map);let b=d.get(x);b.set(m,(b.get(m)||0)+y)})}),h.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:`v_${a}_${m}`,data:{[r]:m,[e]:g}})})}),d.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:m,data:{[r]:p.split("_").pop(),[e]:g}})})})}return{nodes:n,edges:o}}var nO=class extends Ka{constructor(e,t){super(e,t);this.options=t;L(e,b_)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return A_}};
|
|
143
|
+
A ${h} ${h} 0 1 1 ${a.x+h} ${a.y} Z`;else if(O=`M ${a.x} ${a.y} L ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} Z`,this.Re!=null){let $=a.x+this.Re*h*Math.cos(E),K=a.y+this.Re*h*Math.sin(E),xe=a.x+this.Re*h*Math.cos(y),H=a.y+this.Re*h*Math.sin(y);O=`M ${f} ${b} A ${h} ${h} 0 ${S} 1 ${A} ${T} L ${xe} ${H} A ${this.Re*h} ${this.Re*h} 0 ${S} 0 ${$} ${K} Z `}let v={x:this.Gc*Math.cos(x),y:this.Gc*Math.sin(x)},_=M(q,{fill:u||(d?d[g%d.length]:this.colorGenerator.generate(p)),opacity:"0.6",stroke:"white",d:O,"data-t":`translate(${v.x}, ${v.y})`,[kn]:`${g}`});L(_,Xg),g===this.Do&&this.lE(_),m.appendChild(_);let P=20,I=this.options.labelPosition==="inside",C=I?h*.7:h+P,R,w,B;if(p.p>=1)if(I&&this.Re!=null)R=a.x,w=a.y,B="middle";else{let $=-Math.PI/2;R=a.x+C*Math.cos($),w=a.y+C*Math.sin($),B="middle"}else R=a.x+C*Math.cos(x),w=a.y+C*Math.sin(x),B=R<a.x?"end":"start";let N=M("text",{"text-anchor":B,"dominant-baseline":"central",x:R,y:w});this.options.labelFont&&(this.options.labelFont.size&&N.setAttribute("font-size",`${this.options.labelFont.size}px`),this.options.labelFont.family&&N.setAttribute("font-family",this.options.labelFont.family),this.options.labelFont.weight&&N.setAttribute("font-weight",`${this.options.labelFont.weight}`),this.options.labelFont.style&&N.setAttribute("font-style",this.options.labelFont.style));let V=p.label,D=this.options.showLabels||"label";if(D==="value"?V=`${p.value}`:D==="percentage"?V=`${Math.round(p.p*100)}%`:D==="label-value"?V=`${p.label}: ${p.value}`:D==="label-percentage"&&(V=`${p.label}: ${Math.round(p.p*100)}%`),N.innerHTML=V,m.appendChild(N),this.options.dataLabels!=null&&this.options.dataLabels!==!1){let K=p.p<3&&g%2===0?h*.4:h*.5,xe=a.x+K*Math.cos(x),H=a.y+K*Math.sin(x),Ee=u||(d?d[g%d.length]:this.colorGenerator.generate(p)),Fe=this.options.labelFont||{size:12,weight:"bold"},Je="";this.options.dataLabels==="percentage"?Je=`${Math.round(p.p*100)}%`:Je=`${p.value}`,Rg(Je,xe,H,Ee,Fe,m)}})}WA(){this.No!=null&&(this.ZA(this.No),this.No=null)}lE(e){this.No=e,this.JA(this.No)}HA(e,t,n){this.WA(),this.Do===e?this.Do=null:(this.Do=e,this.lE(n))}JA(e){e.setAttribute("transform",e.getAttribute("data-t")),L(e,Q_)}ZA(e){e.removeAttribute("transform"),F(e,Q_)}};function xs(i,r){try{return parseFloat(i.data[r])}catch(e){return 0}}function rN(i,r,e){return r.reduce((t,n)=>t+xs(n,e),0)}function IB(i){let r={};return i.getSourceEdges().forEach(e=>{r[e.target.id]=e.target}),Object.values(r)}function MB(i){let r={};return i.getTargetEdges().forEach(e=>{r[e.source.id]=e.source}),Object.values(r)}function VB(i,r){return i.reduce((e,t)=>t.size.height+e,0)+r*(i.length-1)}function GB(i,r,e,t,n,o){$B(i,r,e,t,n,s=>s.getTargetEdges(),s=>s.getSourceEdges(),s=>IB(s),s=>MB(s),o)}function $B(i,r,e,t,n,o,s,a,l,h){let d=t.filter(u=>o(u).length===0).map(u=>{let p=s(u),g=rN(u,p,h);return u.data.height=g,u.data.width=n,e.set(u.id,!0),{offset:0,obj:u,size:{width:n,height:g},layer:0,id:u.id,type:"root",vertexSet:null,edges:p,leaf:p.length===0}});for(d.sort((u,p)=>p.edges.length-u.edges.length),r(d);e.size<t.length;){let u=new Set,p=[];d.forEach(g=>{a(g.obj).forEach(E=>{e.has(E.id)||l(E).find(x=>!e.has(x.id))||u.add(E)})}),Array.from(u).forEach(g=>{let m=rN(g,o(g),h);g.data.height=m,g.data.width=n,p.push({offset:0,obj:g,size:{width:n,height:m},id:g.id,vertexSet:null,layer:i.length,type:"",edges:[],leaf:!1}),e.set(g.id,!0)}),r(p),d=p}}function tO(i,r,e,t,n,o){let s=new Map,a=i.getNodes(),l=-1/0,h=-1,d=[];function u(T){let S=VB(T,e),O=d.length;S>l&&(l=S,h=d.length),d.push({entries:T,size:S,offset:0,layer:O})}GB(d,u,s,a,r,o),new Ls({layers:d},(T,S,O)=>{let v=[];for(let _=0;_<d[S].entries.length;_++)Hx(d[S].entries[_].obj,O.obj)&&v.push([d[S].entries[_],_]);return v},null).execute();let g=d[h],E=e*(g.entries.length-1)+l,y=n===-1?1:n/E,x=(t-r)/(d.length-1),f=0;for(let T=0;T<d.length;T++){let S=d[T],O=S.size*y,v=E*y-O,_=S.entries.length-1,P=_>0?Math.max(e,v/(_+2)):e,C=(E*y-(O+P*_))/2;S.entries.forEach(R=>{let w=R.obj.getSourceEdges().length===0;R.size.height*=y,R.obj.data.height*=y,R.obj.data.left=f,R.obj.data.top=C,R.obj.data.layer=T,R.obj.data.isTerminus=w,R.obj.data.isSource=T===0,R.obj.data.labelAlign=T===0?"end":T===d.length-1?"start":"middle",C+=R.size.height+P}),f+=x}let b=E*y,A=e;for(let T=0;T<20;T++){for(let S=1;S<d.length;S++)nN(d[S],o,A,b,!0);for(let S=d.length-2;S>=1;S--)nN(d[S],o,A,b,!1)}for(let T=0;T<d.length;T++)d[T].entries.forEach(O=>{let v=O.size.height/y,_=0,P=Array.from(O.obj.getSourceEdges());P.sort((C,R)=>{let w=C.target.data.top+C.target.data.height/2,B=R.target.data.top+R.target.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<P.length;C++){let R=xs(P[C],o);P[C].data.lineWidth=R*y;let w=_+R/2;P[C].anchors=P[C].anchors||{},P[C].anchors.source={y:w/v,x:1,ox:1,oy:0},_+=R}_=0;let I=Array.from(O.obj.getTargetEdges());I.sort((C,R)=>{let w=C.source.data.top+C.source.data.height/2,B=R.source.data.top+R.source.data.height/2;return w<B?-1:w>B?1:0});for(let C=0;C<I.length;C++){let R=xs(I[C],o),w=_+R/2;I[C].anchors=I[C].anchors||{},I[C].anchors.target={y:w/v,x:0,ox:-1,oy:0},_+=R}});return{layers:d,scale:y}}function nN(i,r,e,t,n){i.entries.forEach(a=>{let l=n?a.obj.getTargetEdges():a.obj.getSourceEdges();if(l.length>0){let h=0,d=0;l.forEach(u=>{let p=n?u.source:u.target,g=xs(u,r);d+=(p.data.top+p.data.height/2)*g,h+=g}),a.obj.data.top=d/h-a.obj.data.height/2}}),i.entries.sort((a,l)=>a.obj.data.top-l.obj.data.top);for(let a=0;a<i.entries.length-1;a++){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data,d=l.top+l.height+e-h.top;d>0&&(l.top-=d/2,h.top+=d/2)}let o=i.entries[0].obj.data;o.top<0&&(o.top=0);for(let a=1;a<i.entries.length;a++){let l=i.entries[a-1].obj.data,h=i.entries[a].obj.data;h.top<l.top+l.height+e&&(h.top=l.top+l.height+e)}let s=i.entries[i.entries.length-1].obj.data;if(s.top+s.height>t){s.top=t-s.height;for(let a=i.entries.length-2;a>=0;a--){let l=i.entries[a].obj.data,h=i.entries[a+1].obj.data;l.top+l.height+e>h.top&&(l.top=h.top-e-l.height)}}}var rO="sankey-csv",yx="vjs-sankey-edge",tn="vjs-sankey-unselected",po="vjs-sankey-selected",iN="vjs-sankey",xx="vjs-sankey-node",bx="vjs-sankey-label",iO=class extends co{constructor(e,t){super(e,t);c(this,"linkColorStrategy");c(this,"linkColor");c(this,"$c");c(this,"Bc");c(this,"hE");c(this,"D");c(this,"Qe");c(this,"oi");c(this,"Le");c(this,"Vo");c(this,"ya");c(this,"Mo");c(this,"Go",[]);c(this,"si");c(this,"$o",{});c(this,"ai",{});c(this,"Bo",{});c(this,"Fo",{});c(this,"Uo",[]);c(this,"Io",null);c(this,"pt");c(this,"$tooltip");L(e,iN),Jx("sankey-csv",TA),this.Io=t.pivot!=null&&t.pivot.length>0?t.pivot:null,this.ya=t.labelProperty||"label",this.Vo=t.valueProperty||"value",this.hE=t.tooltipSuffix||"",this.linkColorStrategy=t.linkColorStrategy||"static",this.linkColor=t.linkColor||"#444444",this.$c=t.nodeWidth||15,this.Bc=t.nodePadding||10,this.oi=t.interactive!==!1;let n=t.labels||{};this.pt={font:Ai(12,"normal","normal","sans-serif",n.font),padding:n.padding==null?5:n.padding,backgroundColor:n.backgroundColor||"#FFFFFF56"},this.qA(),this.Bn(t)}get currentModel(){return this.Io!=null?this.Qe:this.D}KA(e,t){switch(this.linkColorStrategy){case"source-target":return{gradient:[[0,e.color],[100,t.color]]};case"target":return{color:t.color};case"static":return{color:this.linkColor};case"source":default:return{color:e.color}}}$drawDecoration(e,t,n){let s=this.$precomputeTitle(e,t).getBBox(),a=this.margin+s.height;return{chartX:0,chartWidth:t,chartY:a,chartHeight:n-a,chartEndX:t,chartEndY:n,width:t,height:n}}$drawChart(e,t,n,o){if(this.D==null)return;this.dim=this.$drawDecoration(e,t,n),t=this.dim.chartWidth,n=this.dim.chartHeight;let s=M(Q,{transform:`translate(${this.dim.chartX}, ${this.dim.chartY})`});e.appendChild(s);let{layers:a}=tO(this.D,this.$c,this.Bc,t,n,this.Vo);if(this.Io){if(this.Qe.getNodes().length===0){let b=BB(a,this.Io,this.Vo,this.ya);this.QA(b)}a=tO(this.Qe,this.$c,this.Bc,t,n,this.Vo).layers}this.Uo=a;let l=M(Q);s.appendChild(l);let h=M(Q);s.appendChild(h);let d=M(Q);if(s.appendChild(d),this.Uo.length===0||this.Uo[0].entries.length===0)return;this.oi&&(this.$tooltip=new nO(e,{format:"{{content}}",valueSuffix:this.hE||""},this.Vo,this.ya));let u=0,p=0,g=1/0,m=1/0;function E(b){let A=b.getBBox();u=Math.max(u,Math.round(A.x+A.width)),g=Math.min(g,Math.round(A.x)),p=Math.max(p,Math.round(A.y+A.height)),m=Math.min(m,Math.round(A.y))}let y=this.currentModel;y.getNodes().forEach(b=>{if(b.data.height>0){let A=M(Z,{x:b.data.left,y:b.data.top,width:b.data.width,height:b.data.height,fill:b.data.color,[te]:b.id},{},xx);this.ai[b.id]=A,h.appendChild(A),E(A);let T=M(Q),S=b.data[this.ya]||b.getFullId(),O=M(tt,{"dominant-baseline":"center","text-anchor":b.data.labelAlign,x:b.data.labelAlign==="end"&&b.data.layer===0?b.data.left-this.pt.padding:b.data.labelAlign==="start"&&b.data.layer===this.Uo.length-1?b.data.left+b.data.width+this.pt.padding:b.data.left+b.data.width/2,y:b.data.top+b.data.height/2,"font-size":this.pt.font.size,"font-style":this.pt.font.style,[te]:b.id},{},bx);if(O.innerHTML=S,this.Bo[b.id]=O,T.appendChild(O),d.appendChild(T),this.pt.backgroundColor!=="transparent"){let v=O.getBBox(),_=M(Z,{rx:"3",x:v.x-this.pt.padding,y:v.y-this.pt.padding,width:v.width+this.pt.padding*2,height:v.height+this.pt.padding*2,fill:this.pt.backgroundColor,[te]:b.id});this.Fo[b.id]=_,T.insertBefore(_,O)}E(O)}});let x=y.getAllEdges().slice();x.sort((b,A)=>A.data.lineWidth-b.data.lineWidth),x.forEach(b=>{let A=b.anchors.source,T=b.anchors.target,S=b.source.data,O=b.target.data,v={x:S.left+S.width,y:S.top+A.y*S.height},_={x:O.left,y:O.top+T.y*O.height},P=.25*(_.x-v.x),I=b.data.lineWidth/2,C=v.y-I,R=v.y+I,w=_.y-I,B=_.y+I,V={d:[`M ${v.x} ${C}`,`C ${v.x+P} ${C}, ${_.x-P} ${w}, ${_.x} ${w}`,`L ${_.x} ${B}`,`C ${_.x-P} ${B}, ${v.x+P} ${R}, ${v.x} ${R}`,"Z"].join(" "),opacity:.3,stroke:"none",[et]:b.id};if(b.data.color)V.fill=b.data.color;else if(b.data.gradient){let{id:$,g:K}=CT(v.x,_.x,b.data.gradient);l.appendChild(K),V.fill=`url(#${$})`}let D=M(q,V,{},yx);this.$o[b.id]=D,l.appendChild(D),E(D)}),t=u+this.dim.chartX-g,n=p+this.dim.chartY,e.setAttribute("viewBox",`${g} 0 ${t} ${n}`);let f=this.container.querySelector(".vjs-chart-background");f.setAttribute("x",`${g}`),f.setAttribute("width",`${t}`),f.setAttribute("y",`${m}`),f.setAttribute("height",`${n}`),this.dim.chartWidth=u-g,this.dim.chartHeight=p,this.dim.chartEndX=t,this.dim.chartEndY=n,this.dim.width=t,this.dim.height=n,this.dim.viewBox={x:g,y:0,width:t,height:n},this.fire(wg)}nodeDecorator(e,t){return Object.assign(e,{color:this.colorGenerator.generate(e),width:50,height:50})}edgeDecorator(e,t,n){return Object.assign(e,this.KA(t,n))}Bn(e){if(this.D=fn(),this.Qe=fn(),e.dataSource==null)(e.url!=null||e.csvData!=null||e.jsonData!=null)&&this.load({url:e.url,csvData:e.csvData,jsonData:e.jsonData});else{this.Le=e.dataSource;let t=ha(()=>{this.cE()},150);this.Le.bind(Re,t),this.Le.bind(Ce,t),this.Le.bind(Jt,t),this.Le.bind(ve,t),this.Le.bind(Oe,t),this.Le.bind(Wt,t),this.Le.bind(xt,t),this.Le.bind(bt,t),this.Le.bind(cr,t),this.Le.bind(Zt,t),this.Le.bind(Vr,t),this.cE()}}QA(e){this.Qe.clear(),e.nodes.forEach(t=>{this.Qe.addNode(this.nodeDecorator(Object.assign({},t),!1))}),e.edges.forEach(t=>{let n=this.Qe.getVertex(t.source),o=this.Qe.getVertex(t.target);this.Qe.addEdge({source:n,target:o,data:this.edgeDecorator(Object.assign({},t.data||{}),n.data,o.data)})})}cE(){this.D.clear(),this.Qe.clear(),this.Le.getNodes().forEach(e=>{this.D.addNode(this.nodeDecorator(Object.assign({},e.data),!1))}),this.Le.getAllEdges().forEach(e=>{let t=this.D.getVertex(e.source.id),n=this.D.getVertex(e.target.id);this.D.addEdge({source:t,target:n,data:this.edgeDecorator(Object.assign({},e.data||{}),t.data,n.data)})}),this.$draw()}load(e,t){this.Qe.clear(),this.D.clear();function n(){return e.dataType!=null?e.dataType:e.csvData!=null?rO:e.jsonData!=null?kt:e.url!=null&&e.url.indexOf(".json")!==-1?kt:rO}this.D.load({type:n(),url:e.url,data:e.csvData||e.jsonData,incremental:!1,onload:()=>{this.$draw(),t&&t()},parameters:{nodeDecorator:this.nodeDecorator.bind(this),edgeDecorator:this.edgeDecorator.bind(this)}})}hasData(){return this.D!=null&&this.D.getNodes().length>0}destroy(){super.destroy()}eS(){this.Mo!=null&&(this.si.vertices.forEach(e=>{F(this.ai[e.id],po),F(this.Bo[e.id],po);let t=this.Fo[e.id];t&&F(t,po)}),this.Go.forEach(e=>F(e[1],po)),Object.values(this.$o).forEach(e=>F(e,tn)),Object.values(this.ai).forEach(e=>F(e,tn)),Object.values(this.Bo).forEach(e=>F(e,tn)),Object.values(this.Fo).forEach(e=>F(e,tn))),this.Mo=null,this.si=null,this.Go.length=0}dE(e){return this.Uo.findIndex(t=>t.entries.find(n=>n.id===e.id)!=null)}tS(e){let t=new Map;return e.getAllEdges().forEach(n=>{let o=n.source===e?n.target:n.source,s=`${o.getFullId()}-${n.id}`;t.has(s)||t.set(s,[o,n])}),Array.from(t.values())}rS(e){let t=new Set,n=new Set;t.add(e);let o=(s,a)=>{let l=this.dE(s);this.tS(s).forEach(d=>{t.has(d[0])||this.dE(d[0])>l===a&&(n.add(d[1]),t.add(d[0]),o(d[0],a))})};return o(e,!0),o(e,!1),{vertices:Array.from(t),edges:Array.from(n)}}Fc(e){this.eS(),e!=null&&(this.Mo=this.currentModel.getNode(e),Object.values(this.ai).forEach(n=>L(n,tn)),Object.values(this.Bo).forEach(n=>L(n,tn)),Object.values(this.Fo).forEach(n=>L(n,tn)),Object.values(this.$o).forEach(n=>L(n,tn)),this.si=this.rS(this.Mo),this.si.edges.slice().sort((n,o)=>n.data.lineWidth-o.data.lineWidth),this.Go=this.si.edges.map(n=>[n,this.$o[n.id]]),this.si.vertices.forEach(n=>{Ut(this.ai[n.id],[po],[tn]),Ut(this.Bo[n.id],[po],[tn]);let o=this.Fo[n.id];o&&Ut(o,[po],[tn])}),this.Go.forEach(n=>{Ut(n[1],[po],[tn])}),this.fire("sankey:hover",{vertex:this.Mo,edges:this.Go}))}qA(){this.oi&&(this.$eventManager.on(this.container,st,z(xx,bx),e=>{let n=e.target.getAttribute(te);this.Fc(n),this.$tooltip.showNodeTooltip(this.currentModel.getNode(n),e,this.ai[n])}),this.$eventManager.on(this.container,ot,z(xx,bx,yx),e=>{this.Fc(null)}),this.$eventManager.on(this.container,st,z(yx),e=>{let n=e.target.getAttribute(et);this.Fc(this.currentModel.getEdge(n).source.id),this.$tooltip.showEdgeTooltip(this.currentModel.getEdge(n),e,this.$o[n])}))}pivot(e){this.Io=e!=null&&e.length>0?e:null,this.Qe.clear(),this.$draw()}clearPivot(){this.pivot(null)}},nO=class extends ja{constructor(e,t,n,o){super(e,t);this.valueProperty=n;this.labelProperty=o}showEdgeTooltip(e,t,n){let o=[e.source,e.target];o.sort((d,u)=>d.data.layer-u.data.layer);let s=o[0].data[this.labelProperty]||o[0].id,a=o[1].data[this.labelProperty]||o[1].id,l=`${s} \u2192 ${a}: ${parseInt(e.data[this.valueProperty])} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}showNodeTooltip(e,t,n){let o=0,s=e.getSourceEdges();s.length>0?o=s.map(d=>xs(d,this.valueProperty)).reduce((d,u)=>d+u):o=e.getTargetEdges().map(u=>xs(u,this.valueProperty)).reduce((u,p)=>u+p);let l=`${e.data[this.labelProperty]||e.id} : ${o.toFixed(2)} `,h=n.getBBox();this.show({x:h.x+h.width/2,y:h.y+h.height/2},{x:.5,y:.5},{content:l})}};function BB(i,r,e,t){let n=[],o=[],s=new Set;i.forEach(a=>{a.entries.forEach(l=>{n.push(vr({id:l.id},l.obj.data))})});for(let a=0;a<i.length-1;a++){let l=i[a],h=new Map,d=new Map;l.entries.forEach(u=>{let p=u.id;u.obj.getSourceEdges().forEach(g=>{let m=g.target.id,E=g.data[r]||"Unspecified",y=xs(g,e),x=`v_${a}_${E}`;s.has(x)||(n.push({id:x,[t]:E,isVirtual:!0,type:"pivot-metadata"}),s.add(x)),h.has(p)||h.set(p,new Map);let f=h.get(p);f.set(E,(f.get(E)||0)+y),d.has(x)||d.set(x,new Map);let b=d.get(x);b.set(m,(b.get(m)||0)+y)})}),h.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:`v_${a}_${m}`,data:{[r]:m,[e]:g}})})}),d.forEach((u,p)=>{u.forEach((g,m)=>{o.push({source:p,target:m,data:{[r]:p.split("_").pop(),[e]:g}})})})}return{nodes:n,edges:o}}var oO=class extends qa{constructor(e,t){super(e,t);this.options=t;L(e,S_)}$getMarkerSize(e,t){return e.markerSize!=null?e.markerSize:this.$getBaseMarkerSize()}$getDataPointCssClass(){return T_}};
|